diff --git a/CMakeLists.txt b/CMakeLists.txt index 093f822128..c732a7f1f0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -107,18 +107,14 @@ project(GSI) endif(BUILD_REG_TESTING) cmake_policy(SET CMP0009 NEW) + cmake_policy(SET CMP0054 NEW) + cmake_policy(SET CMP0074 NEW) find_package(OpenMP) message("found openmp with flag ${OPENMP_Fortran_FLAGS}") # Set Host specific flags and options setHOST() - if(FIND_HDF5_HL) - find_package(HDF5 COMPONENTS C HL Fortran_HL ) - elseif(FIND_HDF5) - find_package(HDF5) - endif() - MESSAGE(${CMAKE_CURRENT_SOURCE_DIR}) # make sure that the default is a RELEASE if (NOT CMAKE_BUILD_TYPE) @@ -172,25 +168,18 @@ project(GSI) if( USE_BASELIBS ) find_package(Baselibs REQUIRED) else() - find_package( NetCDF REQUIRED) - if(NETCDF4) - if(CMAKE_MAJOR_VERSION GREATER 2) - find_package( ZLIB ) - endif() - find_package( CURL ) - endif() + find_package( NetCDF COMPONENTS C Fortran REQUIRED) endif() if(( NOT HOST-WCOSS_D ) AND ( NOT HOST-WCOSS_C ) AND ( NOT HOST-Gaea ) ) message(" trying to find lapack, ${host}") find_package( LAPACK ) endif() # build the WRF I/O libraries - if(DEFINED ENV{GSIWRF_LIB}) - set(wrflib "$ENV{GSIWRF_LIB}" CACHE INTERNAL "WRFIO library" ) + if(DEFINED ENV{GSIWRFIO_LIB}) + set(wrflib "$ENV{GSIWRFIO_LIB}" CACHE INTERNAL "WRFIO library" ) elseif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/libsrc/wrflib) add_subdirectory(libsrc/wrflib) else() - message("libsrc/wrflib not pulled from git, looking for WRF dependencies locally") message("libsrc/wrflib not pulled from git, looking for WRF dependencies locally") find_package( WRF ) endif() @@ -204,7 +193,7 @@ project(GSI) # FFLAGS depend on the compiler get_filename_component (Fortran_COMPILER_NAME ${CMAKE_Fortran_COMPILER} NAME) set(CFLAGS "-I. -DFortranByte=char -DFortranInt=int -DFortranLlong='long long' -O3 -Dfunder") - set (CMAKE_Fortran_INC_FLAGS "-I ./ -I ${CORE_INCS} -I ${NETCDF_INCLUDES} ") + set (CMAKE_Fortran_INC_FLAGS "-I ./ -I ${CORE_INCS} -I ${NETCDF_INCLUDE_DIRS} ") set (CFLAGS_N "-I. -DFortranByte=char -DFortranInt=int -DFortranLlong='long long' -O3 -Dfunder") @@ -271,12 +260,18 @@ project(GSI) endif(BUILD_ENKF) if(BUILD_UTIL) add_subdirectory(util/EnKF/gfs/src) - add_subdirectory(util/Ozone_Monitor/nwprod/oznmon_shared.v2.0.0/sorc/oznmon_horiz.fd) - add_subdirectory(util/Ozone_Monitor/nwprod/oznmon_shared.v2.0.0/sorc/oznmon_time.fd) - add_subdirectory(util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radang.fd) - add_subdirectory(util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radbcoef.fd) - add_subdirectory(util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radbcor.fd) - add_subdirectory(util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radtime.fd) + add_subdirectory(util/Ozone_Monitor/nwprod/oznmon_shared/sorc/oznmon_horiz.fd) + add_subdirectory(util/Ozone_Monitor/nwprod/oznmon_shared/sorc/oznmon_time.fd) + add_subdirectory(util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radang.fd) + add_subdirectory(util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radbcoef.fd) + add_subdirectory(util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radbcor.fd) + add_subdirectory(util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radtime.fd) + add_subdirectory(util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_lev.fd) + add_subdirectory(util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_mandlev.fd) + add_subdirectory(util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_sfc.fd) + add_subdirectory(util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_sfctime.fd) + add_subdirectory(util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_sig.fd) + add_subdirectory(util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_time.fd) endif(BUILD_UTIL) find_package( NDATE ) if( NOT NDATE ) @@ -309,10 +304,10 @@ project(GSI) if(USE_WRF) file(WRITE "${PROJECT_BINARY_DIR}/regression_var.out" "${CMAKE_SOURCE_DIR}/regression/regression_var.sh ${host} ${CMAKE_SOURCE_DIR}/.. ${PROJECT_BINARY_DIR} ${CMAKE_SOURCE_DIR} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${GSIEXEC} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${ENKFEXEC} ${GSICONTROL} ${ENKFCONTROL} ${BASELINE_FLAG} ") set( REG_TEST_NAMES "global_T62;global_T62_ozonly;global_4dvar_T62;global_4denvar_T126;global_fv3_4denvar_T126;;global_fv3_4denvar_C192;global_lanczos_T62;arw_netcdf; - arw_binary;nmm_binary;nmm_netcdf;nmmb_nems_4denvar;hwrf_nmm_d2;hwrf_nmm_d3;rtma;global_enkf_T62;netcdf_fv3_regional;global_C96_fv3aero") + arw_binary;nmm_binary;nmm_netcdf;nmmb_nems_4denvar;hwrf_nmm_d2;hwrf_nmm_d3;rtma;global_enkf_T62;netcdf_fv3_regional;global_C96_fv3aero;global_C96_fv3aerorad") else() file(WRITE "${PROJECT_BINARY_DIR}/regression_var.out" "${CMAKE_SOURCE_DIR}/regression/regression_var.sh ${host} ${CMAKE_SOURCE_DIR}/.. ${PROJECT_BINARY_DIR} ${CMAKE_SOURCE_DIR} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${GSIEXEC} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${ENKFEXEC} ${GSICONTROL} ${ENKFCONTROL} ${BASELINE_FLAG} ") - set( REG_TEST_NAMES "global_T62;global_T62_ozonly;global_4dvar_T62;global_lanczos_T62;global_nemsio_T62;global_C96_fv3aero") + set( REG_TEST_NAMES "global_T62;global_T62_ozonly;global_4dvar_T62;global_lanczos_T62;global_nemsio_T62;global_C96_fv3aero;global_C96_fv3aerorad") endif() foreach( REG_TEST ${REG_TEST_NAMES} ) add_test(NAME ${REG_TEST} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/regression COMMAND regression_driver.sh ${REG_TEST} ${PROJECT_BINARY_DIR}) diff --git a/cmake/Modules/FindBUFR.cmake b/cmake/Modules/FindBUFR.cmake index 58527743bc..a2d70b92bd 100644 --- a/cmake/Modules/FindBUFR.cmake +++ b/cmake/Modules/FindBUFR.cmake @@ -11,8 +11,8 @@ endif() set( NO_DEFAULT_PATH ) if(NOT BUILD_BUFR ) - if(DEFINED ENV{BUFR_LIBd} ) - set(BUFR_LIBRARY $ENV{BUFR_LIBd} ) + if(DEFINED ENV{BUFR_LIBd_DA} ) + set(BUFR_LIBRARY $ENV{BUFR_LIBd_DA} ) message("BUFR library ${BUFR_LIBRARY} set via Environment variable") else() find_library( BUFR_LIBRARY diff --git a/cmake/Modules/FindCORELIBS.cmake b/cmake/Modules/FindCORELIBS.cmake index 711864ebce..9aab567113 100644 --- a/cmake/Modules/FindCORELIBS.cmake +++ b/cmake/Modules/FindCORELIBS.cmake @@ -102,8 +102,8 @@ else() set( w3nco "w3nco${libsuffix}") endif() if(NOT BUILD_BUFR ) - if(DEFINED ENV{BUFR_LIBd} ) - set(BUFR_LIBRARY $ENV{BUFR_LIBd} ) + if(DEFINED ENV{BUFR_LIBd_DA} ) + set(BUFR_LIBRARY $ENV{BUFR_LIBd_DA} ) else() find_library( BUFR_LIBRARY NAMES libbufr.a libbufr_d_64.a libbufr_i4r8.a libbufr_v${BUFR_VER}_d_64.a diff --git a/cmake/Modules/FindNetCDF.cmake b/cmake/Modules/FindNetCDF.cmake index f114c8df86..1439ae8486 100644 --- a/cmake/Modules/FindNetCDF.cmake +++ b/cmake/Modules/FindNetCDF.cmake @@ -1,147 +1,337 @@ -# - Find NetCDF -# Find the native NetCDF includes and library -# -# NETCDF_INCLUDES - where to find netcdf.h, etc -# NETCDF_LIBRARIES - Link these libraries when using NetCDF -# NETCDF_FOUND - True if NetCDF found including required interfaces (see below) -# -# Your package can require certain interfaces to be FOUND by setting these -# -# NETCDF_CXX - require the C++ interface and link the C++ library -# NETCDF_F77 - require the F77 interface and link the fortran library -# NETCDF_F90 - require the F90 interface and link the fortran library -# -# The following are not for general use and are included in -# NETCDF_LIBRARIES if the corresponding option above is set. -# -# NETCDF_LIBRARIES_C - Just the C interface -# NETCDF_LIBRARIES_CXX - C++ interface, if available -# NETCDF_LIBRARIES_F77 - Fortran 77 interface, if available -# NETCDF_LIBRARIES_F90 - Fortran 90 interface, if available -# -# Normal usage would be: -# set (NETCDF_F90 "YES") -# find_package (NetCDF REQUIRED) -# target_link_libraries (uses_f90_interface ${NETCDF_LIBRARIES}) -# target_link_libraries (only_uses_c_interface ${NETCDF_LIBRARIES_C}) - - -set(NETCDF_DIR $ENV{NETCDF}) -message("Enviroment NETCDF is ${NetCDF}") - -if (NETCDF_INCLUDES AND NETCDF_LIBRARIES) - # Already in cache, be silent - set (NETCDF_FIND_QUIETLY TRUE) -endif (NETCDF_INCLUDES AND NETCDF_LIBRARIES) - -if(DEFINED ENV{NETCDF4}) - message("Enviroment NETCDF4 is ${NetCDF4}") - set(NETCDF_DIR $ENV{NETCDF4}) -elseif(DEFINED ENV{NETCDF_DIR}) - set(NETCDF_DIR $ENV{NETCDF_DIR}) -elseif(DEFINED ENV{NETCDF_HOME}) - set(NETCDF_DIR $ENV{NETCDF_HOME}) -elseif( DEFINED ENV{NETCDF} ) - set(NETCDF_DIR $ENV{NETCDF}) -elseif(DEFINED ENV{SSEC_NETCDF4_DIR}) - set(NETCDF_DIR $ENV{SSEC_NETCDF4_DIR}) -elseif(DEFINED ENV{SSEC_NETCDF_DIR}) - set(NETCDF_DIR $ENV{SSEC_NETCDF_DIR}) -endif() -if(DEFINED ENV{NETCDF_FORTRAN}) - set(NETCDF_FORTRAN $ENV{NETCDF_FORTRAN}) -elseif(DEFINED ENV{NETCDF_FORTRAN_DIR}) - set(NETCDF_FORTRAN $ENV{NETCDF_FORTRAN_DIR}) +# (C) Copyright 2011- ECMWF. +# +# This software is licensed under the terms of the Apache Licence Version 2.0 +# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. +# In applying this licence, ECMWF does not waive the privileges and immunities +# granted to it by virtue of its status as an intergovernmental organisation nor +# does it submit to any jurisdiction. + +# Try to find NetCDF includes and library. +# Supports static and shared libaries and allows each component to be found in sepearte prefixes. +# +# This module defines +# +# - NetCDF_FOUND - System has NetCDF +# - NetCDF_INCLUDE_DIRS - the NetCDF include directories +# - NetCDF_VERSION - the version of NetCDF +# - NetCDF_CONFIG_EXECUTABLE - the netcdf-config executable if found +# - NetCDF_PARALLEL - Boolean True if NetCDF4 has parallel IO support via hdf5 and/or pnetcdf +# - NetCDF_HAS_PNETCDF - Boolean True if NetCDF4 has pnetcdf support +# +# Deprecated Defines +# - NetCDF_LIBRARIES - [Deprecated] Use NetCDF::NetCDF_ targets instead. +# +# +# Following components are available: +# +# - C - C interface to NetCDF (netcdf) +# - CXX - CXX4 interface to NetCDF (netcdf_c++4) +# - Fortran - Fortran interface to NetCDF (netcdff) +# +# For each component the following are defined: +# +# - NetCDF__FOUND - whether the component is found +# - NetCDF__LIBRARIES - the libraries for the component +# - NetCDF__LIBRARY_SHARED - Boolean is true if libraries for component are shared +# - NetCDF__INCLUDE_DIRS - the include directories for specified component +# - NetCDF::NetCDF_ - target of component to be used with target_link_libraries() +# +# The following paths will be searched in order if set in CMake (first priority) or environment (second priority) +# +# - NetCDF_ROOT - root of NetCDF installation +# - NetCDF_PATH - root of NetCDF installation +# +# The search process begins with locating NetCDF Include headers. If these are in a non-standard location, +# set one of the following CMake or environment variables to point to the location: +# +# - NetCDF_INCLUDE_DIR or NetCDF_${comp}_INCLUDE_DIR +# - NetCDF_INCLUDE_DIRS or NetCDF_${comp}_INCLUDE_DIR +# +# Notes: +# +# - Use "NetCDF::NetCDF_" targets only. NetCDF_LIBRARIES exists for backwards compatibility and should not be used. +# - These targets have all the knowledge of include directories and library search directories, and a single +# call to target_link_libraries will provide all these transitive properties to your target. Normally all that is +# needed to build and link against NetCDF is, e.g.: +# target_link_libraries(my_c_tgt PUBLIC NetCDF::NetCDF_C) +# - "NetCDF" is always the preferred naming for this package, its targets, variables, and environment variables +# - For compatibility, some variables are also set/checked using alternate names NetCDF4, NETCDF, or NETCDF4 +# - Environments relying on these older environment variable names should move to using a "NetCDF_ROOT" environment variable +# - Preferred component capitalization follows the CMake LANGUAGES variables: i.e., C, Fortran, CXX +# - For compatibility, alternate capitalizations are supported but should not be used. +# - If no components are defined, all components will be searched +# + +list( APPEND _possible_components C CXX Fortran ) + +## Include names for each component +set( NetCDF_C_INCLUDE_NAME netcdf.h ) +set( NetCDF_CXX_INCLUDE_NAME netcdf ) +set( NetCDF_Fortran_INCLUDE_NAME netcdf.mod ) + +## Library names for each component +set( NetCDF_C_LIBRARY_NAME netcdf ) +set( NetCDF_CXX_LIBRARY_NAME netcdf_c++4 ) +set( NetCDF_Fortran_LIBRARY_NAME netcdff ) + +## Enumerate search components +foreach( _comp ${_possible_components} ) + string( TOUPPER "${_comp}" _COMP ) + set( _arg_${_COMP} ${_comp} ) + set( _name_${_COMP} ${_comp} ) +endforeach() + +set( _search_components C) +foreach( _comp ${${CMAKE_FIND_PACKAGE_NAME}_FIND_COMPONENTS} ) + string( TOUPPER "${_comp}" _COMP ) + set( _arg_${_COMP} ${_comp} ) + list( APPEND _search_components ${_name_${_COMP}} ) + if( NOT _name_${_COMP} ) + message(SEND_ERROR "Find${CMAKE_FIND_PACKAGE_NAME}: COMPONENT ${_comp} is not a valid component. Valid components: ${_possible_components}" ) + endif() +endforeach() +list( REMOVE_DUPLICATES _search_components ) + +## Search hints for finding include directories and libraries +foreach( _comp IN ITEMS "_" "_C_" "_Fortran_" "_CXX_" ) + foreach( _name IN ITEMS NetCDF4 NetCDF NETCDF4 NETCDF ) + foreach( _var IN ITEMS ROOT PATH ) + list(APPEND _search_hints ${${_name}${_comp}${_var}} $ENV{${_name}${_comp}${_var}} ) + list(APPEND _include_search_hints + ${${_name}${_comp}INCLUDE_DIR} $ENV{${_name}${_comp}INCLUDE_DIR} + ${${_name}${_comp}INCLUDE_DIRS} $ENV{${_name}${_comp}INCLUDE_DIRS} ) + endforeach() + endforeach() +endforeach() +#Old-school HPC module env variable names +foreach( _name IN ITEMS NetCDF4 NetCDF NETCDF4 NETCDF ) + foreach( _comp IN ITEMS "_C" "_Fortran" "_CXX" ) + list(APPEND _search_hints ${${_name}} $ENV{${_name}}) + list(APPEND _search_hints ${${_name}${_comp}} $ENV{${_name}${_comp}}) + endforeach() +endforeach() + +## Find headers for each component +set(NetCDF_INCLUDE_DIRS) +set(_new_search_components) +foreach( _comp IN LISTS _search_components ) + if(NOT ${PROJECT_NAME}_NetCDF_${_comp}_FOUND) + list(APPEND _new_search_components ${_comp}) + endif() + find_file(NetCDF_${_comp}_INCLUDE_FILE + NAMES ${NetCDF_${_comp}_INCLUDE_NAME} + DOC "NetCDF ${_comp} include directory" + HINTS ${_include_search_hints} ${_search_hints} + PATH_SUFFIXES include include/netcdf + ) + mark_as_advanced(NetCDF_${_comp}_INCLUDE_FILE) + message(DEBUG "NetCDF_${_comp}_INCLUDE_FILE: ${NetCDF_${_comp}_INCLUDE_FILE}") + if( NetCDF_${_comp}_INCLUDE_FILE ) + get_filename_component(NetCDF_${_comp}_INCLUDE_FILE ${NetCDF_${_comp}_INCLUDE_FILE} ABSOLUTE) + get_filename_component(NetCDF_${_comp}_INCLUDE_DIR ${NetCDF_${_comp}_INCLUDE_FILE} DIRECTORY) + list(APPEND NetCDF_INCLUDE_DIRS ${NetCDF_${_comp}_INCLUDE_DIR}) + endif() +endforeach() +if(NetCDF_INCLUDE_DIRS) + list(REMOVE_DUPLICATES NetCDF_INCLUDE_DIRS) endif() -find_path (NETCDF_INCLUDES netcdf.h - HINTS ${NETCDF_DIR}/include $ENV{SSEC_NETCDF_DIR}/include ) - -find_program (NETCDF_META netcdf_meta.h - HINTS ${NETCDF_INCLUDES} ${CMAKE_INSTALL_PREFIX} - ) -if (NETCDF_META) - file (STRINGS ${NETCDF_META} NETCDF_VERSION REGEX "define NC_VERSION_MAJOR") - string (REGEX REPLACE "#define NC_VERSION_MAJOR " "" NETCDF_VERSION ${NETCDF_VERSION}) - string (REGEX REPLACE "\\/\\*\\!< netcdf-c major version. \\*\\/" "" NETCDF_VERSION ${NETCDF_VERSION}) - string (REGEX REPLACE " " "" NETCDF_VERSION ${NETCDF_VERSION} ) - if(${NETCDF_VERSION} GREATER "3") - set(NETCDF_F90 "YES") +set(NetCDF_INCLUDE_DIRS "${NetCDF_INCLUDE_DIRS}" CACHE STRING "NetCDF Include directory paths" FORCE) + +## Find n*-config executables for search components +foreach( _comp IN LISTS _search_components ) + if( _comp MATCHES "^(C)$" ) + set(_conf "c") + elseif( _comp MATCHES "^(Fortran)$" ) + set(_conf "f") + elseif( _comp MATCHES "^(CXX)$" ) + set(_conf "cxx4") + endif() + find_program( NetCDF_${_comp}_CONFIG_EXECUTABLE + NAMES n${_conf}-config + HINTS ${NetCDF_INCLUDE_DIRS} ${_include_search_hints} ${_search_hints} + PATH_SUFFIXES bin Bin ../bin ../../bin + DOC "NetCDF n${_conf}-config helper" ) + message(DEBUG "NetCDF_${_comp}_CONFIG_EXECUTABLE: ${NetCDF_${_comp}_CONFIG_EXECUTABLE}") +endforeach() + +set(_C_libs_flag --libs) +set(_Fortran_libs_flag --flibs) +set(_CXX_libs_flag --libs) +set(_C_includes_flag --includedir) +set(_Fortran_includes_flag --includedir) +set(_CXX_includes_flag --includedir) +function(netcdf_config exec flag output_var) + set(${output_var} False PARENT_SCOPE) + if( exec ) + execute_process( COMMAND ${exec} ${flag} RESULT_VARIABLE _ret OUTPUT_VARIABLE _val) + if( _ret EQUAL 0 ) + string( STRIP ${_val} _val ) + set( ${output_var} ${_val} PARENT_SCOPE ) + endif() + endif() +endfunction() + +## Find libraries for each component +set( NetCDF_LIBRARIES ) +foreach( _comp IN LISTS _search_components ) + string( TOUPPER "${_comp}" _COMP ) + + find_library( NetCDF_${_comp}_LIBRARY + NAMES ${NetCDF_${_comp}_LIBRARY_NAME} + DOC "NetCDF ${_comp} library" + HINTS ${NetCDF_${_comp}_INCLUDE_DIRS} ${_search_hints} + PATH_SUFFIXES lib64 lib ../lib64 ../lib ../../lib64 ../../lib ) + mark_as_advanced( NetCDF_${_comp}_LIBRARY ) + get_filename_component(NetCDF_${_comp}_LIBRARY ${NetCDF_${_comp}_LIBRARY} ABSOLUTE) + set(NetCDF_${_comp}_LIBRARY ${NetCDF_${_comp}_LIBRARY} CACHE STRING "NetCDF ${_comp} library" FORCE) + message(DEBUG "NetCDF_${_comp}_LIBRARY: ${NetCDF_${_comp}_LIBRARY}") + + if( NetCDF_${_comp}_LIBRARY ) + if( NetCDF_${_comp}_LIBRARY MATCHES ".a$" ) + set( NetCDF_${_comp}_LIBRARY_SHARED FALSE ) + set( _library_type STATIC) + else() + list( APPEND NetCDF_LIBRARIES ${NetCDF_${_comp}_LIBRARY} ) + set( NetCDF_${_comp}_LIBRARY_SHARED TRUE ) + set( _library_type SHARED) + endif() + endif() + + #Use nc-config to set per-component LIBRARIES variable if possible + netcdf_config( ${NetCDF_${_comp}_CONFIG_EXECUTABLE} ${_${_comp}_libs_flag} _val ) + if( _val ) + set( NetCDF_${_comp}_LIBRARIES ${_val} ) + if(NOT NetCDF_${_comp}_LIBRARY_SHARED AND NOT NetCDF_${_comp}_FOUND) #Static targets should use nc_config to get a proper link line with all necessary static targets. + list( APPEND NetCDF_LIBRARIES ${NetCDF_${_comp}_LIBRARIES} ) + endif() + else() + set( NetCDF_${_comp}_LIBRARIES ${NetCDF_${_comp}_LIBRARY} ) + if(NOT NetCDF_${_comp}_LIBRARY_SHARED) + message(SEND_ERROR "Unable to properly find NetCDF. Found static libraries at: ${NetCDF_${_comp}_LIBRARY} but could not run nc-config: ${NetCDF_CONFIG_EXECUTABLE}") + endif() + endif() + + #Use nc-config to set per-component INCLUDE_DIRS variable if possible + netcdf_config( ${NetCDF_${_comp}_CONFIG_EXECUTABLE} ${_${_comp}_includes_flag} _val ) + if( _val ) + string( REPLACE " " ";" _val ${_val} ) + set( NetCDF_${_comp}_INCLUDE_DIRS ${_val} ) + else() + set( NetCDF_${_comp}_INCLUDE_DIRS ${NetCDF_${_comp}_INCLUDE_DIR} ) endif() -endif (NETCDF_META) - -find_library (NETCDF_flib - names libnetcdff.a netcdff.a libnetcdff.so netcdff.so - HINTS - ${NETCDF_DIR}/lib - ${NETCDF_FORTRAN_DIR}/lib - ${NETCDF_FORTRAN}/lib - ${NETCDF_FORTRAN_ROOT}/lib -) - -if (NETCDF_flib) - set(NETCDF_F90 "YES") - + + if( NetCDF_${_comp}_LIBRARIES AND NetCDF_${_comp}_INCLUDE_DIRS ) + set( ${CMAKE_FIND_PACKAGE_NAME}_${_arg_${_COMP}}_FOUND TRUE ) + if (NOT TARGET NetCDF::NetCDF_${_comp}) + add_library(NetCDF::NetCDF_${_comp} ${_library_type} IMPORTED) + set_target_properties(NetCDF::NetCDF_${_comp} PROPERTIES + IMPORTED_LOCATION ${NetCDF_${_comp}_LIBRARY} + INTERFACE_INCLUDE_DIRECTORIES "${NetCDF_${_comp}_INCLUDE_DIRS}" + INTERFACE_LINK_LIBRARIES ${NetCDF_${_comp}_LIBRARIES} ) + endif() + endif() +endforeach() +if(NetCDF_LIBRARIES AND NetCDF_${_comp}_LIBRARY_SHARED) + list(REMOVE_DUPLICATES NetCDF_LIBRARIES) endif() -find_library (NETCDF_LIBRARIES_C - NAMES netcdf - HINTS ${NETCDF_DIR}/lib ) -mark_as_advanced(NETCDF_LIBRARIES_C) +set(NetCDF_LIBRARIES "${NetCDF_LIBRARIES}" CACHE STRING "NetCDF library targets" FORCE) -if("${NETCDF_DIR}" STREQUAL "") - message(FATAL_ERROR " - Cannot find NETCDF!!!! +## Find version via netcdf-config if possible +if (NetCDF_INCLUDE_DIRS) + if( NetCDF_C_CONFIG_EXECUTABLE ) + netcdf_config( ${NetCDF_C_CONFIG_EXECUTABLE} --version _vers ) + if( _vers ) + string(REGEX REPLACE ".* ((([0-9]+)\\.)+([0-9]+)).*" "\\1" NetCDF_VERSION "${_vers}" ) + endif() + else() + foreach( _dir IN LISTS NetCDF_INCLUDE_DIRS) + if( EXISTS "${_dir}/netcdf_meta.h" ) + file(STRINGS "${_dir}/netcdf_meta.h" _netcdf_version_lines + REGEX "#define[ \t]+NC_VERSION_(MAJOR|MINOR|PATCH|NOTE)") + string(REGEX REPLACE ".*NC_VERSION_MAJOR *\([0-9]*\).*" "\\1" _netcdf_version_major "${_netcdf_version_lines}") + string(REGEX REPLACE ".*NC_VERSION_MINOR *\([0-9]*\).*" "\\1" _netcdf_version_minor "${_netcdf_version_lines}") + string(REGEX REPLACE ".*NC_VERSION_PATCH *\([0-9]*\).*" "\\1" _netcdf_version_patch "${_netcdf_version_lines}") + string(REGEX REPLACE ".*NC_VERSION_NOTE *\"\([^\"]*\)\".*" "\\1" _netcdf_version_note "${_netcdf_version_lines}") + set(NetCDF_VERSION "${_netcdf_version_major}.${_netcdf_version_minor}.${_netcdf_version_patch}${_netcdf_version_note}") + unset(_netcdf_version_major) + unset(_netcdf_version_minor) + unset(_netcdf_version_patch) + unset(_netcdf_version_note) + unset(_netcdf_version_lines) + endif() + endforeach() + endif() +endif () - ") +## Detect additional package properties +netcdf_config(${NetCDF_C_CONFIG_EXECUTABLE} --has-parallel4 _val) +if( NOT _val MATCHES "^(yes|no)$" ) + netcdf_config(${NetCDF_C_CONFIG_EXECUTABLE} --has-parallel _val) endif() -find_file (NETCDF_NCDUMP - NAMES ncdump - HINTS ${NETCDF_DIR}/bin ) -mark_as_advanced(NETCDF_NCDUMP) -execute_process(COMMAND ${NETCDF_NCDUMP} - ERROR_VARIABLE NCDUMP_INFO) -string(FIND "${NCDUMP_INFO}" "version" VERSION_LOC REVERSE) -math(EXPR VERSION_LOC "${VERSION_LOC} + 9") -string(SUBSTRING "${NCDUMP_INFO}" ${VERSION_LOC} 1 NETCDF_MAJOR_VERSION) -if (${NETCDF_MAJOR_VERSION} LESS 4) - message(FATAL_ERROR " - Current NETCDF is ${NETCDF_DIR} - !!!! NETCDF version 4.0 and above is required !!!! - - ") +if( _val MATCHES "^(yes)$" ) + set(NetCDF_PARALLEL TRUE CACHE STRING "NetCDF has parallel IO capability via pnetcdf or hdf5." FORCE) +else() + set(NetCDF_PARALLEL FALSE CACHE STRING "NetCDF has no parallel IO capability." FORCE) endif() -set (NetCDF_has_interfaces "YES") # will be set to NO if we're missing any interfaces -set (NetCDF_libs ${NETCDF_LIBRARIES_C} ${NETCDF_LIBRARIES_Fortran}) -message("netcdf_libs is ${NetCDF_libs}") -get_filename_component (NetCDF_lib_dirs "${NETCDF_LIBRARIES_C}" PATH) - -macro (NetCDF_check_interface lang header libs) - if (NETCDF_${lang}) - find_path (NETCDF_INCLUDES_${lang} NAMES ${header} - HINTS ${NETCDF_INCLUDES} ${NETCDF_FORTRAN}/include NO_DEFAULT_PATH) - find_library (NETCDF_LIBRARIES_${lang} NAMES ${libs} - HINTS ${NetCDF_lib_dirs} ${NETCDF_FORTRAN}/lib NO_DEFAULT_PATH) - mark_as_advanced (NETCDF_INCLUDES_${lang} NETCDF_LIBRARIES_${lang}) - if (NETCDF_INCLUDES_${lang} AND NETCDF_LIBRARIES_${lang}) - list (INSERT NetCDF_libs 0 ${NETCDF_LIBRARIES_${lang}}) # prepend so that -lnetcdf is last - else (NETCDF_INCLUDES_${lang} AND NETCDF_LIBRARIES_${lang}) - set (NetCDF_has_interfaces "NO") - message (STATUS "Failed to find NetCDF interface for ${lang}") - endif (NETCDF_INCLUDES_${lang} AND NETCDF_LIBRARIES_${lang}) - endif (NETCDF_${lang}) -endmacro (NetCDF_check_interface) - -NetCDF_check_interface (CXX netcdfcpp.h netcdf_c++) -NetCDF_check_interface (F77 netcdf.inc netcdff) -NetCDF_check_interface (F90 netcdf.mod netcdff) -if( NETCDF_LIBRARIES_F90 ) - set( NETCDF4 "YES" ) +## Finalize find_package +include(FindPackageHandleStandardArgs) + +if(NOT NetCDF_FOUND OR _new_search_components) + find_package_handle_standard_args( ${CMAKE_FIND_PACKAGE_NAME} + REQUIRED_VARS NetCDF_INCLUDE_DIRS NetCDF_LIBRARIES + VERSION_VAR NetCDF_VERSION + HANDLE_COMPONENTS ) +endif() + +foreach( _comp IN LISTS _search_components ) + if( NetCDF_${_comp}_FOUND ) + #Record found components to avoid duplication in NetCDF_LIBRARIES for static libraries + set(NetCDF_${_comp}_FOUND ${NetCDF_${_comp}_FOUND} CACHE BOOL "NetCDF ${_comp} Found" FORCE) + #Set a per-package, per-component found variable to communicate between multiple calls to find_package() + set(${PROJECT_NAME}_NetCDF_${_comp}_FOUND True) + endif() +endforeach() + +if( ${CMAKE_FIND_PACKAGE_NAME}_FOUND AND NOT ${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY AND _new_search_components) + message( STATUS "Find${CMAKE_FIND_PACKAGE_NAME} defines targets:" ) + message( STATUS " - NetCDF_VERSION [${NetCDF_VERSION}]") + message( STATUS " - NetCDF_PARALLEL [${NetCDF_PARALLEL}]") + foreach( _comp IN LISTS _new_search_components ) + string( TOUPPER "${_comp}" _COMP ) + message( STATUS " - NetCDF_${_comp}_CONFIG_EXECUTABLE [${NetCDF_${_comp}_CONFIG_EXECUTABLE}]") + if( ${CMAKE_FIND_PACKAGE_NAME}_${_arg_${_COMP}}_FOUND ) + get_filename_component(_root ${NetCDF_${_comp}_INCLUDE_DIR}/.. ABSOLUTE) + if( NetCDF_${_comp}_LIBRARY_SHARED ) + message( STATUS " - NetCDF::NetCDF_${_comp} [SHARED] [Root: ${_root}] Lib: ${NetCDF_${_comp}_LIBRARY} ") + else() + message( STATUS " - NetCDF::NetCDF_${_comp} [STATIC] [Root: ${_root}] Lib: ${NetCDF_${_comp}_LIBRARY} ") + endif() + endif() + endforeach() endif() -set (NETCDF_LIBRARIES "${NetCDF_libs}" CACHE STRING "All NetCDF libraries required for interface level") -# handle the QUIETLY and REQUIRED arguments and set NETCDF_FOUND to TRUE if -# all listed variables are TRUE -include (FindPackageHandleStandardArgs) -find_package_handle_standard_args (NetCDF DEFAULT_MSG NETCDF_LIBRARIES NETCDF_INCLUDES NetCDF_has_interfaces) +foreach( _prefix NetCDF NetCDF4 NETCDF NETCDF4 ${CMAKE_FIND_PACKAGE_NAME} ) + set( ${_prefix}_INCLUDE_DIRS ${NetCDF_INCLUDE_DIRS} ) + set( ${_prefix}_LIBRARIES ${NetCDF_LIBRARIES}) + set( ${_prefix}_VERSION ${NetCDF_VERSION} ) + set( ${_prefix}_FOUND ${${CMAKE_FIND_PACKAGE_NAME}_FOUND} ) + set( ${_prefix}_CONFIG_EXECUTABLE ${NetCDF_CONFIG_EXECUTABLE} ) + set( ${_prefix}_PARALLEL ${NetCDF_PARALLEL} ) + + foreach( _comp ${_search_components} ) + string( TOUPPER "${_comp}" _COMP ) + set( _arg_comp ${_arg_${_COMP}} ) + set( ${_prefix}_${_comp}_FOUND ${${CMAKE_FIND_PACKAGE_NAME}_${_arg_comp}_FOUND} ) + set( ${_prefix}_${_COMP}_FOUND ${${CMAKE_FIND_PACKAGE_NAME}_${_arg_comp}_FOUND} ) + set( ${_prefix}_${_arg_comp}_FOUND ${${CMAKE_FIND_PACKAGE_NAME}_${_arg_comp}_FOUND} ) + + set( ${_prefix}_${_comp}_LIBRARIES ${NetCDF_${_comp}_LIBRARIES} ) + set( ${_prefix}_${_COMP}_LIBRARIES ${NetCDF_${_comp}_LIBRARIES} ) + set( ${_prefix}_${_arg_comp}_LIBRARIES ${NetCDF_${_comp}_LIBRARIES} ) -mark_as_advanced (NETCDF_LIBRARIES NETCDF_INCLUDES) + set( ${_prefix}_${_comp}_INCLUDE_DIRS ${NetCDF_${_comp}_INCLUDE_DIRS} ) + set( ${_prefix}_${_COMP}_INCLUDE_DIRS ${NetCDF_${_comp}_INCLUDE_DIRS} ) + set( ${_prefix}_${_arg_comp}_INCLUDE_DIRS ${NetCDF_${_comp}_INCLUDE_DIRS} ) + endforeach() +endforeach() diff --git a/cmake/Modules/FindSFCIO.cmake b/cmake/Modules/FindSFCIO.cmake index d8928bc210..09d4366d66 100644 --- a/cmake/Modules/FindSFCIO.cmake +++ b/cmake/Modules/FindSFCIO.cmake @@ -15,6 +15,10 @@ if(NOT BUILD_SFCIO ) set(SFCIO_LIBRARY $ENV{SFCIO_LIB4} ) set(SFCIOINC $ENV{SFCIO_INC4} ) message("SFCIO library ${SFCIO_LIBRARY} set via Environment variable") + elseif(DEFINED ENV{SFCIO_LIB} ) + set(SFCIO_LIBRARY $ENV{SFCIO_LIB} ) + set(SFCIOINC $ENV{SFCIO_INC} ) + message("SFCIO library ${SFCIO_LIBRARY} set via Environment variable") else() findInc( sfcio SFCIO_VER SFCIOINC ) find_library( SFCIO_LIBRARY diff --git a/cmake/Modules/FindSIGIO.cmake b/cmake/Modules/FindSIGIO.cmake index 173328c45f..d504f53a81 100644 --- a/cmake/Modules/FindSIGIO.cmake +++ b/cmake/Modules/FindSIGIO.cmake @@ -15,6 +15,10 @@ if(NOT BUILD_SIGIO ) set(SIGIO_LIBRARY $ENV{SIGIO_LIB4} ) set(SIGIOINC $ENV{SIGIO_INC4} ) message("SIGIO library ${SIGIO_LIBRARY} set via Environment variable") + elseif(DEFINED ENV{SIGIO_LIB} ) + set(SIGIO_LIBRARY $ENV{SIGIO_LIB} ) + set(SIGIOINC $ENV{SIGIO_INC} ) + message("SIGIO library ${SIGIO_LIBRARY} set via Environment variable") else() findInc( sigio SIGIO_VER SIGIOINC ) find_library( SIGIO_LIBRARY diff --git a/cmake/Modules/platforms/Generic.cmake b/cmake/Modules/platforms/Generic.cmake index b584cf66cf..24f40107d5 100644 --- a/cmake/Modules/platforms/Generic.cmake +++ b/cmake/Modules/platforms/Generic.cmake @@ -20,5 +20,6 @@ macro (setGeneric) set(BUILD_SP "OFF" CACHE INTERNAL "Build the SP library" ) set(BUILD_CRTM "OFF" CACHE INTERNAL "Build the CRTM library" ) set(BUILD_W3EMC "OFF" CACHE INTERNAL "Build the EMC library" ) + set(BUILD_W3NCO "OFF" CACHE INTERNAL "Build the EMC library" ) set(BUILD_NCO "OFF" CACHE INTERNAL "Build the NCO library" ) endmacro() diff --git a/cmake/Modules/platforms/WCOSS-D.cmake b/cmake/Modules/platforms/WCOSS-D.cmake index e0daffa593..19a853e609 100644 --- a/cmake/Modules/platforms/WCOSS-D.cmake +++ b/cmake/Modules/platforms/WCOSS-D.cmake @@ -1,7 +1,5 @@ macro (setWCOSS_D) message("Setting paths for Dell") - option(FIND_HDF5 "Try to Find HDF5 libraries" ON) - option(FIND_HDF5_HL "Try to Find HDF5 libraries" OFF) set(HOST_FLAG "-xHOST" CACHE INTERNAL "Host Flag") set(MKL_FLAG "-mkl" CACHE INTERNAL "MKL Flag") @@ -9,7 +7,6 @@ macro (setWCOSS_D) set(GSI_LDFLAGS "${OpenMP_Fortran_FLAGS} ${MKL_FLAG}" CACHE INTERNAL "") set(ENKF_Platform_FLAGS "-O3 -fp-model strict -convert big_endian -assume byterecl -implicitnone -DGFS -D_REAL8_ ${OpenMP_Fortran_FLAGS} " CACHE INTERNAL "ENKF Fortran Flags") - set(HDF5_USE_STATIC_LIBRARIES "ON" CACHE INTERNAL "" ) if( NOT DEFINED ENV{COREPATH} ) set(COREPATH "/gpfs/dell1/nco/ops/nwprod/lib" ) else() diff --git a/cmake/Modules/setHOST.cmake b/cmake/Modules/setHOST.cmake index 1d0a3b5341..5133e0b208 100644 --- a/cmake/Modules/setHOST.cmake +++ b/cmake/Modules/setHOST.cmake @@ -17,8 +17,14 @@ macro( setHOST ) string(REGEX MATCH "t[0-9][0-9]a" HOST-WCOSS ${HOSTNAME} ) endif() string(REGEX MATCH "v[0-9][0-9]a" HOST-WCOSS_D ${HOSTNAME} ) - if( NOT HOST-WCOSS_D )# don't overwrite if we are on venus + if( NOT HOST-WCOSS_D )# don't overwrite if we are on venus Phase 3 + string(REGEX MATCH "v[0-9][0-9][0-9]a" HOST-WCOSS_D ${HOSTNAME} ) + endif() + if( NOT HOST-WCOSS_D )# don't overwrite if we are on venus/Phase 3.5 string(REGEX MATCH "m[0-9][0-9]a" HOST-WCOSS_D ${HOSTNAME} ) + if( NOT HOST-WCOSS_D )# don't overwrite if we are on mars Phase 3 + string(REGEX MATCH "m[0-9][0-9][0-9]a" HOST-WCOSS_D ${HOSTNAME} ) + endif() endif() string(REGEX MATCH "llogin" HOST-WCOSS_C ${HOSTNAME} ) if( NOT HOST-WCOSS_C )# don't overwrite if we are on luna @@ -27,8 +33,7 @@ macro( setHOST ) string(REGEX MATCH "discover" HOST-Discover ${HOSTNAME} ) string(REGEX MATCH "cheyenne" HOST-Cheyenne ${HOSTNAME} ) message("done figuring out host--${HOSTNAME}") - if ( BUILD_CORELIBS ) - MESSAGE(STATUS "BUILD_CORELIBS manually-specified as ON") + if ( COMGSI ) set( host "GENERIC" ) set( HOST-Generic "TRUE" ) setGeneric() diff --git a/cmake/Modules/setIntelFlags.cmake b/cmake/Modules/setIntelFlags.cmake index 70544725a3..88e5061ffc 100644 --- a/cmake/Modules/setIntelFlags.cmake +++ b/cmake/Modules/setIntelFlags.cmake @@ -64,7 +64,7 @@ function(set_GSI_ENKF_Intel) endfunction(set_GSI_ENKF_Intel) function (set_GSI_ENKF_Debug_Intel) - set(GSI_Fortran_FLAGS "-DPOUND_FOR_STRINGIFY -O0 -fp-model source -convert big_endian -assume byterecl -implicitnone -mcmodel medium -shared-intel -g -traceback -debug -ftrapuv -check all,noarg_temp_created -fp-stack-check -fstack-protector -warn all,nointerfaces -convert big_endian -implicitnone -D_REAL8_ ${OpenMP_Fortran_FLAGS} ${MPI_Fortran_COMPILE_FLAGS} ${GSDCLOUDOPT}" CACHE INTERNAL "") + set(GSI_Fortran_FLAGS "-DPOUND_FOR_STRINGIFY -O0 -fp-model source -convert big_endian -assume byterecl -implicitnone -g -traceback -debug -ftrapuv -check all,noarg_temp_created -fp-stack-check -fstack-protector -warn all,nointerfaces -convert big_endian -implicitnone -D_REAL8_ ${OpenMP_Fortran_FLAGS} ${MPI_Fortran_COMPILE_FLAGS} ${GSDCLOUDOPT}" CACHE INTERNAL "") set(ENKF_Fortran_FLAGS "-O0 ${HOST_FLAG} -warn all -implicitnone -traceback -g -debug all -check all,noarg_temp_created -fp-model strict -convert big_endian -assume byterecl -D_REAL8_ ${OpenMP_Fortran_FLAGS} ${GSDCLOUDOPT}" CACHE INTERNAL "") set(GSDCLOUD_Fortran_FLAGS "-DPOUND_FOR_STRINGIFY -O3 -convert big_endian" CACHE INTERNAL "") #Common debug flags diff --git a/doc/Release_Notes.gfsda.v16.0.0.txt b/doc/Release_Notes.gfsda.v16.0.0.txt new file mode 100644 index 0000000000..3858f2b64d --- /dev/null +++ b/doc/Release_Notes.gfsda.v16.0.0.txt @@ -0,0 +1,378 @@ +GFSDA.v16.0.0 RELEASE NOTES + +GIT TAG + * GFS DA v16.0.0 is in github repository NOAA-EMC/GSI. GFS DA v16 is intended to be installed + as part of the entire GFS v16 package. Please see GFS v16 release notes for the name and + location of the GFS tag in github. The GFS tag contains a script which checks out the + appropriate GFS DA v16 tag. + + + + +DOC CHANGES + * Rename Release_Notes.fv3gfs_da.v15.0.0.txt as Release_Notes.gfsda.v16.0.0 and update contents to + relect GFS DA v16 development. + + + + +CODE CHANGES + * Data assimilation changes + * Use a Local Ensemble Kalman Filter (LETKF) with model space localization and + linearized observation operator to replace the Ensemble Square Root Filter (EnSRF). + * Apply a new 4-Dimensional Incremental Analysis Update (4D-IAU) technique. + * Turn on Stochastic Kinetic Energy Backscatter (SKEB) scheme in GDAS ensemble forecasts. + * Update variational Quality Control (QC). + * Apply Hilbert curve to aircraft data. + * Update aircraft bias correction with safeguards. + * Assimilate additional COSMIC-2 GNSS-RO data (COSMIC-2 E1 and E2) + * Apply correlated observation error for CrIS over sea surfaces and IASI over sea and land. + * Assimilate AMSU-A channel 14 and ATMS channel 15 without bias correction. + * Assimilate CSR data from ABI_G16, AHI_Himawari8, and SEVIRI_M08. + * Assimilate AVHRR from NOAA-19 and Metop-B for near sea-surface temperature (NSST). + * Assimilate high-density flight-level wind, temperature, and moisture observations in tropical storm environment + * Upgrade to Community Radiative Transfer Model (CRTM) v2.3.0. + * New GFS DA v16 codes + * calc_analysis.fd - compute analysis by combining guess and increment + * calc_increment_ens_ncio.fd - compute ensemble increment using netcdf io + * interp_inc.fd - horizontally interpolate analysis increment to specified output grid + * ncdiag_cat.fd - concatenate netcdf diagnostic files created by GSI + + + + +JOB CHANGES + * Update jobs to run within GFS workflow + * Rename the following jobs + * JGDAS_ENKF_RECENTER - rename as JGDAS_ENKF_ECEN + * JGDAS_VERFOZN - rename as JGDAS_ATMOS_VERFOZN + * JGDAS_VERFRAD - rename as JGDAS_ATMOS_VERFRAD + * JGDAS_VMINMON - rename as JGDAS_ATMOS_VMINMON + * JGFS_VMINMON - rename as JGFS_ATMOS_VMINMON + * JGLOBAL_ANALYSIS - rename as JGLOBAL_ATMOS_ANALYSIS + * JGLOBAL_ENKF_SELECT_OBS - rename as JGDAS_ENKF_SELECT_OBS + * JGLOBAL_ENKF_UPDATE - rename as JGDAS_ENKF_UPDATE + * Remove the following job + * JGDAS_ENKF_INNOVATE_OBS - this job is no longer used + * Add the following new jobs + * JGDAS_ATMOS_ANALYSIS_DIAG - create GSI diagnostic files for deterministic analysis + * JGDAS_ATMOS_CHGRES_FORENKF - chgres deterministic forecast to EnKF resolution + * JGDAS_ENKF_DIAG - create GSI diagnosic files for EnKF members + * JGDAS_ENKF_SFC - create surface analysis files for EnKF members + * JGLOBAL_ATMOS_ANALYSIS_CALC - create gaussian grid atmospheric and surface analysis files + + + + +SCRIPT CHANGES + * Update scripts to run within GFS workflow. + * Remove ".ecf" suffix from script names + * Rename the following scripts + * exgdas_vrfminmon.sh.ecf - rename as exgdas_atmos_vminmon.sh + * exgdas_vrfyozn.sh.ecf - rename as exgdas_atmos_verfozn.sh + * exgdas_vrfyrad.sh.ecf - rename as exgdas_atmos_verfrad.sh + * exgfs_vrfminmon.sh.ecf - rename as exgfs_atmos_vminmon.sh + * exglobal_analysis_fv3gfs.sh.ecf - rename as exglobal_atmos_analysis.sh + * exglobal_enkf_fcst_fv3gfs.sh.ecf - rename as exgdas_enkf_fcst.sh + * exglobal_enkf_post_fv3gfs.sh.ecf - rename as exgdas_enkf_post.sh + * exglobal_enkf_recenter_fv3gfs.sh.ecf - rename as exgdas_enkf_ecen.sh + * exglobal_enkf_update_fv3gfs.sh.ecf - rename as exgdas_enkf_update.sh + * Remove the following job + * exglobal_enkf_innovate_obs_fv3gfs.sh.ecf - this script is no longer used + * Add the following new scripts + * exgdas_atmos_chgres_forenkf.sh - chgres deterministic forecast to EnKF resolution + * exgdas_enkf_sfc.sh - create surface analysis files for EnKF members + * exglobal_atmos_analysis_calc.sh - create gaussian grid atmospheric and surface analysis files + * exglobal_diag.sh - create GSI diagnostic files + + + + +PARM CHANGES + * Update to run within GFS workflow. Parm or configuration files for GFS components reside in + parm/config. Below are the parm (config) files used by each GFS DA v16 job. Note: the + config file prefix "config." is omitted below for the sake of readability. + * JGDAS_ATMOS_ANALYSIS_DIAG - base, anal, analdiag + * JGDAS_ATMOS_CHGRES_FORENKF - base, anal, echgres + * JGDAS_ENKF_DIAG - base, anal, eobs, analdiag, ediag + * JGDAS_ENKF_ECEN - base, ecen + * JGDAS_ENKF_FCST - base, fcst, efcs + * JGDAS_ENKF_POST - base, epos + * JGDAS_ENKF_SELECT_OBS - base, anal, eobs + * JGDAS_ENKF_SFC - base, esfc + * JGDAS_ENKF_UPDATE - base, anal, eupd + * JGLOBAL_ATMOS_ANALYSIS - base, anal + * JGLOBAL_ATMOS_ANALYSIS_CALC - base, anal, analcalc + Parameters common to all jobs are in config.base. Analysis jobs share config.anal. + This avoids duplication of identical parameters across multiple parameter files. + + + + +FIX CHANGES + * Updates to run GFS DA v16 + * New files and directory + * Big_Endian + * global_berror.l127y*.f77 - L127 static background error files for various resolutions + * global_berror.l64y194.f77, global_berror.l64y98.f77 - L64 static background error files + for additional resolutions + * global_anavinfo.l127.txt - change vertical resolution to 127, add correlated error section + * global_hybens_info.l127.txt - GSI localization parameters for L127 + * global_hybens_smoothinfo.l127.txt - smoothing parameters for L127 + * global_lightinfo.txt - lightning data info file + * Rcov_* - correlated observation error for CrIS and IASI + * vlocal_eig_l*.dat - LETKF model space localization parameters for L127 + * vqctp001.dat - variational quality control parameters + * Big_Endian/global_berror.l127y770.f77 - L127 static background error file for C768 + * gfsv16_historical/ - contain historical fix files + * Modify existing files + * global_convinfo.txt - updates for new variational quality control; adjust gross checks + limits for ps and sst; adjust gps error limits; assimilate + additional gps data; assimilate t 136, q 136, and uv 236; + remove sst 200, 201 and 202; assmilate sst 198; add uv 255 + (monitor); assimilate uv 260_225 + * global_ozinfo.txt - add ompslp_npp (monitor mode) + * global_satinfo.txt - assimilate the following: amsua channel 14 and atms channel 15 + (without bias correction), avhrr3_n19 channels 3-5, seviri_m08 + channels 5-6, ahi_himawari8 channels 8-10, abi_g16 channel 8 + * prepobs_errtable.global - update observation errors for ps types 120, 180, 181, 187; + type 136 t, q, and ps; uv 236, 245, 246, 247, 260, 290 + + + + +RESOURCE INFORMATION + * Frequency of run + * 6 hourly cycle (00, 06, 12, 18Z) - no change from current operations + + + * All versions of libraries, compiler, and modules used by GFS DA v16 are specified in + modulefiles/modulefile.ProdGSI.wcoss_d + + + * Data retention for files in $COMROOTp3 are the same as those specified for + the overall GFS v16 package + + + * Disk space. Please see disk usage estimates for entire GFS v16 package + + + * Computational resources and run times + * JGLOBAL_ATMOS_ANALYSIS (GFS) + * 250 nodes, 1000 tasks, ptile=4, 7 threads/task + * Runtime: 28.1 - 29.4 minutes + + * JGLOBAL_ATMOS_ANALYSIS_CALC (GFS) + * 5 nodes, 140 tasks, ptile=28, 1 thread/task + * Runtime: 2.4 - 2.7 minutes + + * JGLOBAL_ATMOS_ANALYSIS (GDAS) + * 250 nodes, 1000 tasks, ptile=4, 7 threads/task + * Runtime: 38.2 - 39.3 minutes + + * JGLOBAL_ATMOS_ANALYSIS_CALC (GDAS) + * 5 nodes, 140 tasks, ptile=28, 1 thread/task + * Runtime: 3.5 - 4.5 minutes + + * JGDAS_ATMOS_ANALYSIS_DIAG (GDAS) + * 4 nodes, 112 tasks, ptile=28, 1 thread/task + * Runtime: 3.0 - 3.3 minutes + + * JGDAS_ENKF_SELECT_OBS + * 120 nodes, 480 tasks, ptile=4, 7 threads/task + * Runtime: 4.1 - 4.8 minutes + + * JGDAS_ENKF_DIAG + * 2 nodes, 56 tasks, ptile=28, 1 thread/task + * Runtime: 2.9 - 3.2 minutes + + * JGDAS_ENKF_UPDATE + * 240 nodes, 960 tasks, ptile=4, 7 threads/task + * Runtime: 25.6 - 26.7 minutes + + * JGDAS_ENKF_ECEN (3x) + * 60 nodes, 240 tasks, ptile=4, 7 threads/task + * Concurrently run 3 realizations of JGDAS_ENKF_RECENTER. Each job + processes an IAU analysis time. Each job uses 20 nodes, 80 tasks, + ptile=4, 7 threads/task. + * Runtime: 4.1 - 4.8 minutes + + * JGDAS_ENKF_SFC + * 3 nodes, 84 tasks, ptile=28, 1 thread/task + * Runtime: 2.2 - 2.6 minutes + + * JGDAS_ENKF_FCST (40x) + * 600 nodes, 16800 tasks, ptile=28, 1 thread/task + * Concurrently run 40 realizations of JGDAS_ENKF_FCST. Each job + sequentially processes 2 EnKF members. Each job uses 15 nodes, + 420 tasks, ptile=28, 1 thread/task. + * Runtime: 28.5 - 31.6 minutes + + * JGDAS_ENKF_POST (7x) + * 140 nodes, 560 tasks, ptile=4, 7 threads/task + * Concurrently run 7 realizations of JGDAS_ENKF_POST. Each job + prcoesses one forecast hour. Each job uses 20 nodes, 80 tasks, + ptile=4, 7 threads/task. + * Runtime: 10.6 - 11.3 minutes + + + + +PRE-IMPLEMENTATION TESTING REQUIREMENTS + * Which production jobs should be tested as part of this implementation? + * The GFS DA package needs to tested with the entire GFS v16 suite. + + + * Does this change require a 30-day evaluation? + * Yes, the entire GFS v16 package requires a 30-day evaluation + + + * Suggested evaluators + * Same as those for entire GFS v16 package + + + +DISSEMINATION INFORMATION + * Where should this output be sent? + * same as current operations + + + * Who are the users? + * same as current operations + + + * Which output files should be transferred from PROD WCOSS to DEV WCOSS? + * Please refer to release notes for GFS v16 package + + + * Directory changes + * Add atmos and wave to gfs, gdas, and enkfgdas paths. GFS v16 paths are + - $COMROOTp3/gfs/prod/gfs.$PDY/$cyc/{atmos, wave} + - $COMROOTp3/gfs/prod/gdas.$PDY/$cyc/{atmos, wave} + - $COMROOTp3/gfs/prod/enkfgdas.$PDY/$cyc/atmos EnKF does not run with waves + * Write GSI subdomain specific diagnostic files to new directory, gsidiags, in + gdas.$PDY/$cyc/atmos and enkfgdas.$PDY/$cyc/atmos + + + * File changes. Only GFS DA v16.0.0 file changes are listed below. + + * $COMROOTp3/gfs/prod/gfs.$PDY/$cyc/atmos + * Rename + * replace ".nemsio" suffix with ".nc" for atm* and sfc* files + * Add + * gfs.t${cyc}z.atmi003.nc and gfs.t${cyc}z.atmi009.nc - analysis increment files + valid at the start and end of the IAU analysis window + * gfs.t${cyc}z.loganl.txt - text file indicating creation of GFS atmanl and sfcanl files + * gfs.t${cyc}z.loginc.txt - text file indicating creation of GFS IAU increment files + + + * $COMROOTp3/gfs/prod/gdas.$PDY/$cyc/atmos + * Rename + * replace ".nemsio" suffix with ".nc" for atm* and sfc* files + * Add + * gdas.t${cyc}z.atma003.ensres.nc, gdas.t${cyc}z.atma009.ensres.nc - analyses valid + at the start and end of the IAU analysis window interpolated to EnKF resolution + * gdas.t${cyc}z.atmf003.ensres.nc, gdas.t${cyc}z.atmf006.ensres.nc, + gdas.t${cyc}z.atmf009.ensres.nc - 3, 6, and 9 hour forecasts interpolated to + EnKF resolution + * gdas.t${cyc}z.atmi003.nc, gdas.t${cyc}z.atmi009.nc - IAU analysis increment files + at the start and end of the IAU analysis window + * gdas.t${cyc}z.loganl.txt - text file indicating creation of GDAS atmanl and sfcanl files + * gdas.t${cyc}z.loginc.txt - text file indicating creation of GDAS IAU increment files + * gsidiags - directory containing sub-domain GDAS GSI diagnostic files + + * $COMROOTp3/gfs/prod/enkfgdas.$PDY/$cyc/atmos + * Rename + * replace ".nemsio" suffix with ".nc" for atm* and sfc* files + * replace ".nc4" suffix with ".nc" for ensmean and ensspread files + * Add + * efcs.grpXX for XX=21 to 40 - efcs txt files for EnKF forecast groups 21 to 40 + * gdas.t${cyc}z.atmi003.ensmean.nc - ensemble mean analysis increment valid at start of IAU window + * gdas.t${cyc}z.atminc.ensmean.nc - ensemble mean analysis increment valid at center of IAU window + * gdas.t${cyc}z.atmi009.ensmean.nc - ensemble mean analysis increment valid at end of IAU window + * gdas.t${cyc}z.loginc.txt - text file indicating creation of EnKF IAU increment files + * gsidiags - directory containing sub-domain EnKF GSI diagnostic files + * memXXX/gdas.t${cyc}z.ratmi003.nc - recentered analysis increment valid at start of IAU window + for EnKF member memXXX + * memXXX/gdas.t${cyc}z.ratminc.nc - recentered analysis increment valid at center of IAU window + for EnKF member memXXX + * memXXX/gdas.t${cyc}z.ratmi009.nc - recentered analysis increment valid at end of IAU window + for EnKF member memXXX + * Remove + * remove eomg.grpXX - job creating these files is not run in GFS v16 + * gdas.t00z.atmanl.ensmean.nemsio + * memXXX/gdas.t${cyc}z.abias, abias_air, abias_pc, atmanl, cnvstat, gsistat, oznstat, ratmanl, + radstat - these files are not created in GFS v16 + + + + +HPSS ARCHIVE + * Retention length? + * Please refer to release notes for GFS v16 package + + + * List which output files should be archived + * Please refer to release notes for GFS v16 package + + + + +IMPLEMENTATION INSTRUCTIONS + * Please note that the GFS DA v16 components must be installed in conjunction with the entire GFS v16 package. + Thus, the implementation instructions below extract the entire GFS v16 package. The GFS package is + tagged in github as tag gfs.v16.0.0. Implementation instructions for this tag follow: + + 1) cd $NWROOTp3 + + 2) mkdir $NWROOTp3/gfs.v16.0.0 + + 3) cd $NWROOTp3/gfs.v16.0.0 + + 4) git clone https://github.com/NOAA-EMC/global-workflow.git . + * Notes: + * The "." after global-workflow.git is important. It tells git to clone the repository + fv3gfs into the local working directory, $NWROOTp3/gfs.v16.0.0. + * The SPA(s) handling the GFS v16 implementation may encounter "permission denied" messages when + attempting to clone github repositories. Code managers need to grant access the SPA(s). Please + contact Kate.Friedman@noaa.gov for assistance. + + 5) git checkout gfs.v16.0.0 + + 6) cd sorc + + 7) ./checkout.sh + * This script extracts the GFS v16 components from github + + 8) ./build_all.sh + * Script build_all.sh compiles GFS v16 components. Runtime output from the build for each + package is written to log files in directory logs. Specifically, GFS DA v16 build information + is written to logs/build_gsi.log. Script build_gsi.sh invokes gsi.fd/ush/build_all_cmke.sh. + This script uses cmake to build GFS DA v16 executables. Script build_all_cmake.sh accepts two + command line options: build type and directory path to package. Two build types are + supported - PRODUCTION (default) and DEBUG. + + 9) ./link_fv3gfs.sh nco dell + + + +JOB DEPENDENCIES & FLOW DIAGRAM + * GFS DA v16 adds several DA jobs to the GFS. Below are dependencies for + new jobs + * JGDAS_ATMOS_ANALYSIS_DIAG - trigger upon completion of JGLOBAL_ATMOS_ANALYSIS + * JGDAS_ATMOS_CHGRES_FORENKF - trigger upon completion of GDAS JGLOBAL_FORECAST and all JGDAS_ENKF_FCST + * JGDAS_ENKF_DIAG - trigger upon completion of JGDAS_ENKF_SELECT_OBS + * JGDAS_ENKF_SFC - trigger upon completion of JGDAS_ENKF_UPDATE + * JGLOBAL_ATMOS_ANALYSIS_CALC - trigger upon completion of JGLOBAL_ATMOS_ANALYSIS + * Dependencenies also change due to the renaming of existing jobs. These + dependencies are given below + * JGDAS_ENKF_ECEN - trigger upon completion of JGDAS_ENKF_UPDATE and JGLOBAL_ATMOS_ANALYSIS + * JGDAS_ATMOS_VERFOZN - trigger upon completion of JGDAS_ATMOS_ANALYSIS_DIAG + * JGDAS_ATMOS_VERFRAD - trigger upon completion of JGDAS_ATMOS_ANALYSIS_DIAG + * JGDAS_ATMOS_VMINMON - trigger upon completion of JGLOBAL_ATMOS_ANALYSIS + * JGFS_ATMOS_VMINMON - trigger upon completion of JGLOBAL_ATMOS_ANALYSIS + * JGLOBAL_ATMOS_ANALYSIS - trigger upcon completion of JGLOBAL_PREP + * JGDAS_ENKF_SELECT_OBS - trigger upon completion of JGLOBAL_PREP + * JGDAS_ENKF_UPDATE - tigger upon completion of JGDAS_ENKF_DIAG + + diff --git a/fix b/fix new file mode 120000 index 0000000000..2d6383d7b7 --- /dev/null +++ b/fix @@ -0,0 +1 @@ +../GSI-fix \ No newline at end of file diff --git a/jobs/JGLOBAL_ANALDIAG b/jobs/JGDAS_ATMOS_ANALYSIS_DIAG similarity index 81% rename from jobs/JGLOBAL_ANALDIAG rename to jobs/JGDAS_ATMOS_ANALYSIS_DIAG index 0dc227616a..59d33e1d4b 100755 --- a/jobs/JGLOBAL_ANALDIAG +++ b/jobs/JGDAS_ATMOS_ANALYSIS_DIAG @@ -54,10 +54,11 @@ export pgmerr=errfile ############################################## -# Set variables used in the exglobal script +# Set variables used in the script ############################################## export CDATE=${CDATE:-${PDY}${cyc}} export CDUMP=${CDUMP:-${RUN:-"gfs"}} +export COMPONENT=${COMPONENT:-atmos} if [ $RUN_ENVIR = "nco" ]; then export ROTDIR=${COMROOT:?}/$NET/$envir fi @@ -81,20 +82,19 @@ export ASUFFIX=${ASUFFIX:-$SUFFIX} if [ $RUN_ENVIR = "nco" -o ${ROTDIR_DUMP:-NO} = "YES" ]; then - export COMIN=${COMIN:-$ROTDIR/$RUN.$PDY/$cyc} - export COMOUT=${COMOUT:-$ROTDIR/$RUN.$PDY/$cyc} - export COMIN_OBS=${COMIN_OBS:-$ROTDIR/$RUN.$PDY/$cyc} - export COMIN_GES_OBS=${COMIN_GES_OBS:-$ROTDIR/$GDUMP.$gPDY/$gcyc} + export COMIN=${COMIN:-$ROTDIR/$RUN.$PDY/$cyc/$COMPONENT} + export COMOUT=${COMOUT:-$ROTDIR/$RUN.$PDY/$cyc/$COMPONENT} + export COMIN_OBS=${COMIN_OBS:-$ROTDIR/$RUN.$PDY/$cyc/$COMPONENT} + export COMIN_GES_OBS=${COMIN_GES_OBS:-$ROTDIR/$GDUMP.$gPDY/$gcyc/$COMPONENT} else - export COMOUT="$ROTDIR/$CDUMP.$PDY/$cyc" + export COMOUT="$ROTDIR/$CDUMP.$PDY/$cyc/$COMPONENT" export COMIN_OBS="$DMPDIR/$CDATE/$CDUMP" export COMIN_GES_OBS="$DMPDIR/$GDATE/$GDUMP" fi mkdir -m 775 -p $COMOUT -# COMIN_GES and COMIN_GES_ENS are used in exglobal script -# TO DO: Map NCO's directory into these variables -export COMIN_GES="$ROTDIR/$GDUMP.$gPDY/$gcyc" -export COMIN_GES_ENS="$ROTDIR/enkfgdas.$gPDY/$gcyc" +# COMIN_GES and COMIN_GES_ENS are used in script +export COMIN_GES="$ROTDIR/$GDUMP.$gPDY/$gcyc/$COMPONENT" +export COMIN_GES_ENS="$ROTDIR/enkfgdas.$gPDY/$gcyc/$COMPONENT" export ATMGES="$COMIN_GES/${GPREFIX}atmf006${GSUFFIX}" @@ -104,17 +104,6 @@ if [ ! -f $ATMGES ]; then fi -# Get LEVS -if [ ${GSUFFIX} = ".nc" ]; then - export LEVS=$($NCLEN $ATMGES pfull) - status=$? -else - export LEVS=$($NEMSIOGET $ATMGES dimz | awk '{print $2}') - status=$? -fi -[[ $status -ne 0 ]] && exit $status - - if [ $DOHYBVAR = "YES" ]; then export ATMGES_ENSMEAN="$COMIN_GES_ENS/${GPREFIX}atmf006.ensmean$GSUFFIX" if [ ! -f $ATMGES_ENSMEAN ]; then @@ -134,14 +123,14 @@ export DOGAUSFCANL=${DOGAUSFCANL:-"YES"} ############################################################### -# Run relevant exglobal script +# Run relevant script env msg="HAS BEGUN on `hostname`" postmsg "$jlogfile" "$msg" $LOGSCRIPT -${ANALDIAGSH:-$HOMEgsi/scripts/exglobal_analdiag_fv3gfs.sh.ecf} +${ANALDIAGSH:-$SCRgfs/exglobal_diag.sh} status=$? [[ $status -ne 0 ]] && exit $status diff --git a/jobs/JGDAS_ATMOS_CHGRES_FORENKF b/jobs/JGDAS_ATMOS_CHGRES_FORENKF new file mode 100755 index 0000000000..78a1d384bd --- /dev/null +++ b/jobs/JGDAS_ATMOS_CHGRES_FORENKF @@ -0,0 +1,137 @@ +#!/bin/ksh +set -x + +export RUN_ENVIR=${RUN_ENVIR:-"nco"} +export PS4='$SECONDS + ' +date + + +############################# +# Source relevant config files +############################# +export EXPDIR=${EXPDIR:-$HOMEgfs/parm/config} +configs="base anal echgres" +config_path=${EXPDIR:-$NWROOT/gfs.${gfs_ver}/parm/config} +for config in $configs; do + . $config_path/config.$config + status=$? + [[ $status -ne 0 ]] && exit $status +done + + +########################################## +# Source machine runtime environment +########################################## +. $HOMEgfs/env/${machine}.env anal +status=$? +[[ $status -ne 0 ]] && exit $status + + +############################################## +# Obtain unique process id (pid) and make temp directory +############################################## +export pid=${pid:-$$} +export outid=${outid:-"LL$job"} + +export DATA=${DATA:-${DATAROOT}/${jobid:?}} +mkdir -p $DATA +cd $DATA + + +############################################## +# Run setpdy and initialize PDY variables +############################################## +export cycle="t${cyc}z" +setpdy.sh +. ./PDY + + +############################################## +# Determine Job Output Name on System +############################################## +export pgmout="OUTPUT.${pid}" +export pgmerr=errfile + + +############################################## +# Set variables used in the script +############################################## +export CDATE=${CDATE:-${PDY}${cyc}} +export CDUMP=${CDUMP:-${RUN:-"gfs"}} +export COMPONENT=${COMPONENT:-atmos} +if [ $RUN_ENVIR = "nco" ]; then + export ROTDIR=${COMROOT:?}/$NET/$envir +fi +export DO_CALC_ANALYSIS=${DO_CALC_ANALYSIS:-"YES"} + + +############################################## +# Begin JOB SPECIFIC work +############################################## + +GDATE=$($NDATE -$assim_freq $CDATE) +gPDY=$(echo $GDATE | cut -c1-8) +gcyc=$(echo $GDATE | cut -c9-10) +GDUMP=${GDUMP:-"gdas"} + +export OPREFIX="${CDUMP}.t${cyc}z." +export GPREFIX="${GDUMP}.t${gcyc}z." +export APREFIX="${CDUMP}.t${cyc}z." +export GSUFFIX=${GSUFFIX:-$SUFFIX} +export ASUFFIX=${ASUFFIX:-$SUFFIX} + + +if [ $RUN_ENVIR = "nco" -o ${ROTDIR_DUMP:-NO} = "YES" ]; then + export COMIN=${COMIN:-$ROTDIR/$RUN.$PDY/$cyc/$COMPONENT} + export COMOUT=${COMOUT:-$ROTDIR/$RUN.$PDY/$cyc/$COMPONENT} + export COMOUT_ENS=${COMOUT_ENS:-$ROTDIR/enkfgdas.$PDY/$cyc/$COMPONENT} + export COMIN_OBS=${COMIN_OBS:-$ROTDIR/$RUN.$PDY/$cyc/$COMPONENT} + export COMIN_GES_OBS=${COMIN_GES_OBS:-$ROTDIR/$GDUMP.$gPDY/$gcyc/$COMPONENT} +else + export COMOUT="$ROTDIR/$CDUMP.$PDY/$cyc/$COMPONENT" + export COMOUT_ENS="$ROTDIR/enkfgdas.$PDY/$cyc/$COMPONENT" + export COMIN_OBS="$DMPDIR/$CDATE/$CDUMP" + export COMIN_GES_OBS="$DMPDIR/$GDATE/$GDUMP" +fi +mkdir -m 775 -p $COMOUT +# COMIN_GES and COMIN_GES_ENS are used in script +export COMIN_GES="$ROTDIR/$GDUMP.$gPDY/$gcyc/$COMPONENT" +export COMIN_GES_ENS="$ROTDIR/enkfgdas.$gPDY/$gcyc/$COMPONENT" + +############################################################### +# Run relevant script +env +msg="HAS BEGUN on `hostname`" +postmsg "$jlogfile" "$msg" +$LOGSCRIPT + + +${CHGRESFCSTSH:-$SCRgfs/exgdas_atmos_chgres_forenkf.sh} +status=$? +[[ $status -ne 0 ]] && exit $status + + +############################################## +# End JOB SPECIFIC work +############################################## + +############################################## +# Final processing +############################################## +if [ -e "$pgmout" ] ; then + cat $pgmout +fi + + +msg="ENDED NORMALLY." +postmsg "$jlogfile" "$msg" + + +########################################## +# Remove the Temporary working directory +########################################## +cd $DATAROOT +[[ $KEEPDATA = "NO" ]] && rm -rf $DATA + +date +exit 0 diff --git a/jobs/JGLOBAL_ENKF_ANALDIAG b/jobs/JGDAS_ENKF_DIAG similarity index 83% rename from jobs/JGLOBAL_ENKF_ANALDIAG rename to jobs/JGDAS_ENKF_DIAG index 6e08ea2f47..612e5a633a 100755 --- a/jobs/JGLOBAL_ENKF_ANALDIAG +++ b/jobs/JGDAS_ENKF_DIAG @@ -10,7 +10,7 @@ date # Source relevant config files ############################# export EXPDIR=${EXPDIR:-$HOMEgfs/parm/config} -configs="base anal eobs ediag" +configs="base anal eobs analdiag ediag" config_path=${EXPDIR:-$NWROOT/gfs.${gfs_ver}/parm/config} for config in $configs; do . $config_path/config.$config @@ -53,10 +53,11 @@ export pgmerr=errfile ############################################## -# Set variables used in the exglobal script +# Set variables used in the script ############################################## export CDATE=${CDATE:-${PDY}${cyc}} export CDUMP=${CDUMP:-${RUN:-"gdas"}} +export COMPONENT=${COMPONENT:-atmos} if [ $RUN_ENVIR = "nco" ]; then export ROTDIR=${COMROOT:?}/$NET/$envir fi @@ -81,20 +82,19 @@ export GSUFFIX="${GSUFFIX:-".ensmean${SUFFIX}"}" export ASUFFIX="${ASUFFIX:-"${SUFFIX}"}" if [ $RUN_ENVIR = "nco" -o ${ROTDIR_DUMP:-NO} = "YES" ]; then - export COMIN_OBS=${COMIN_OBS:-$ROTDIR/$RUN.$PDY/$cyc} - export COMIN_GES_OBS=${COMIN_GES_OBS:-$ROTDIR/$GDUMP.$gPDY/$gcyc} + export COMIN_OBS=${COMIN_OBS:-$ROTDIR/$RUN.$PDY/$cyc/$COMPONENT} + export COMIN_GES_OBS=${COMIN_GES_OBS:-$ROTDIR/$GDUMP.$gPDY/$gcyc/$COMPONENT} else export COMIN_OBS="$DMPDIR/$CDATE/$CDUMP" export COMIN_GES_OBS="$DMPDIR/$GDATE/$GDUMP" fi -# COMIN_GES, COMIN_ANL COMIN_GES_ENS, and COMOUT are used in exglobal script -# TO DO: Map NCO's directory into these variables -COMIN_GES_CTL="$ROTDIR/gdas.$gPDY/$gcyc" -export COMIN_ANL="$ROTDIR/$CDUMP.$PDY/$cyc" -export COMIN_GES_ENS="$ROTDIR/enkfgdas.$gPDY/$gcyc" +# COMIN_GES, COMIN_ANL COMIN_GES_ENS, and COMOUT are used in script +COMIN_GES_CTL="$ROTDIR/gdas.$gPDY/$gcyc/$COMPONENT" +export COMIN_ANL="$ROTDIR/$CDUMP.$PDY/$cyc/$COMPONENT" +export COMIN_GES_ENS="$ROTDIR/enkfgdas.$gPDY/$gcyc/$COMPONENT" export COMIN_GES=$COMIN_GES_ENS -export COMOUT="$ROTDIR/enkf$CDUMP.$PDY/$cyc" +export COMOUT="$ROTDIR/enkf$CDUMP.$PDY/$cyc/$COMPONENT" export ATMGES_ENSMEAN="$COMIN_GES_ENS/${GPREFIX}atmf006$GSUFFIX" @@ -103,9 +103,6 @@ if [ ! -f $ATMGES_ENSMEAN ]; then exit 1 fi -export LEVS=$($NCDUMP -h $ATMGES_ENSMEAN | grep -i "pfull" | head -1 | awk -F" = " '{print $2}' | awk -F" " '{print $1}') # get LEVS -status=$? -[[ $status -ne 0 ]] && exit $status # Link observational data export PREPQC="$COMIN_ANL/${OPREFIX}prepbufr" @@ -154,26 +151,18 @@ done ############################################################### -# Run relevant exglobal script +# Run relevant script env msg="HAS BEGUN on `hostname`" postmsg "$jlogfile" "$msg" $LOGSCRIPT -${ANALDIAGSH:-$SCRgsi/exglobal_analdiag_fv3gfs.sh.ecf} +${ANALDIAGSH:-$SCRgfs/exglobal_diag.sh} status=$? [[ $status -ne 0 ]] && exit $status -############################################## -# Send Alerts -############################################## -if [ $SENDDBN = YES ] ; then - $DBNROOT/bin/dbn_alert MODEL ENKF1_MSC_gsistat $job $GSISTAT -fi - - ############################################## # End JOB SPECIFIC work ############################################## diff --git a/jobs/JGDAS_ENKF_RECENTER b/jobs/JGDAS_ENKF_ECEN similarity index 85% rename from jobs/JGDAS_ENKF_RECENTER rename to jobs/JGDAS_ENKF_ECEN index 01c2b9cbdc..c185ed7c3b 100755 --- a/jobs/JGDAS_ENKF_RECENTER +++ b/jobs/JGDAS_ENKF_ECEN @@ -53,10 +53,11 @@ export pgmerr=errfile ############################################## -# Set variables used in the exglobal script +# Set variables used in the script ############################################## export CDATE=${CDATE:-${PDY}${cyc}} export CDUMP=${CDUMP:-${RUN:-"gdas"}} +export COMPONENT=${COMPONENT:-atmos} if [ $RUN_ENVIR = "nco" ]; then export ROTDIR=${COMROOT:?}/$NET/$envir fi @@ -89,30 +90,29 @@ export GSUFFIX=${GSUFFIX:-$SUFFIX} export ASUFFIX=${ASUFFIX:-$SUFFIX} if [ $RUN_ENVIR = "nco" -o ${ROTDIR_DUMP:-NO} = "YES" ]; then - export COMIN_OBS=${COMIN_OBS:-$ROTDIR/$RUN.$PDY/$cyc} - export COMIN_GES_OBS=${COMIN_GES_OBS:-$ROTDIR/$GDUMP.$gPDY/$gcyc} + export COMIN_OBS=${COMIN_OBS:-$ROTDIR/$RUN.$PDY/$cyc/$COMPONENT} + export COMIN_GES_OBS=${COMIN_GES_OBS:-$ROTDIR/$GDUMP.$gPDY/$gcyc/$COMPONENT} else export COMIN_OBS="$DMPDIR/$CDATE/$CDUMP" export COMIN_GES_OBS="$DMPDIR/$GDATE/$GDUMP" fi -# COMIN, COMIN_ENS and COMIN_GES_ENS are used in exglobal script -# TO DO: Map NCO's directory into these variables -export COMIN="$ROTDIR/$CDUMP.$PDY/$cyc" -export COMIN_ENS="$ROTDIR/enkf$CDUMP_ENKF.$PDY/$cyc" -export COMOUT_ENS="$ROTDIR/enkf$CDUMP.$PDY/$cyc" -export COMIN_GES_ENS="$ROTDIR/enkf$CDUMP.$gPDY/$gcyc" +# COMIN, COMIN_ENS and COMIN_GES_ENS are used in script +export COMIN="$ROTDIR/$CDUMP.$PDY/$cyc/$COMPONENT" +export COMIN_ENS="$ROTDIR/enkf$CDUMP_ENKF.$PDY/$cyc/$COMPONENT" +export COMOUT_ENS="$ROTDIR/enkf$CDUMP.$PDY/$cyc/$COMPONENT" +export COMIN_GES_ENS="$ROTDIR/enkf$CDUMP.$gPDY/$gcyc/$COMPONENT" ############################################################### -# Run relevant exglobal script +# Run relevant script env msg="HAS BEGUN on `hostname`" postmsg "$jlogfile" "$msg" $LOGSCRIPT -${ENKFRECENSH:-$SCRgsi/exglobal_enkf_recenter_fv3gfs.sh.ecf} +${ENKFRECENSH:-$SCRgfs/exgdas_enkf_ecen.sh} status=$? [[ $status -ne 0 ]] && exit $status diff --git a/jobs/JGDAS_ENKF_FCST b/jobs/JGDAS_ENKF_FCST index 67bc685d76..60da5e7063 100755 --- a/jobs/JGDAS_ENKF_FCST +++ b/jobs/JGDAS_ENKF_FCST @@ -53,10 +53,11 @@ export pgmerr=errfile ############################################## -# Set variables used in the exglobal script +# Set variables used in the script ############################################## export CDATE=${CDATE:-${PDY}${cyc}} export CDUMP=${CDUMP:-${RUN:-"gdas"}} +export COMPONENT=${COMPONENT:-atmos} if [ $RUN_ENVIR = "nco" ]; then export ROTDIR=${COMROOT:?}/$NET/$envir fi @@ -68,9 +69,8 @@ fi export CASE=$CASE_ENKF -# COMOUT is used in exglobal script -# TO DO: Map NCO's directory into these variables -export COMOUT="$ROTDIR/enkf$CDUMP.$PDY/$cyc" +# COMOUT is used in script +export COMOUT="$ROTDIR/enkf$CDUMP.$PDY/$cyc/$COMPONENT" # Forecast length for EnKF forecast @@ -85,14 +85,14 @@ export ENSBEG=$((ENSEND - NMEM_EFCSGRP + 1)) ############################################################### -# Run relevant exglobal script +# Run relevant script env msg="HAS BEGUN on `hostname`" postmsg "$jlogfile" "$msg" $LOGSCRIPT -${ENKFFCSTSH:-$SCRgsi/exglobal_enkf_fcst_fv3gfs.sh.ecf} +${ENKFFCSTSH:-$SCRgfs/exgdas_enkf_fcst.sh} status=$? [[ $status -ne 0 ]] && exit $status diff --git a/jobs/JGDAS_ENKF_POST b/jobs/JGDAS_ENKF_POST index 55bb97ee14..0aaac99afe 100755 --- a/jobs/JGDAS_ENKF_POST +++ b/jobs/JGDAS_ENKF_POST @@ -53,10 +53,11 @@ export pgmerr=errfile ############################################## -# Set variables used in the exglobal script +# Set variables used in the script ############################################## export CDATE=${CDATE:-${PDY}${cyc}} export CDUMP=${CDUMP:-${RUN:-"gdas"}} +export COMPONENT=${COMPONENT:-atmos} if [ $RUN_ENVIR = "nco" ]; then export ROTDIR=${COMROOT:?}/$NET/$envir fi @@ -69,24 +70,23 @@ export GFS_NCIO=${GFS_NCIO:-"YES"} export PREFIX="${CDUMP}.t${cyc}z." -# COMIN, COMOUT are used in exglobal script -# TO DO: Map NCO's directory into these variables -export COMIN="$ROTDIR/enkf$CDUMP.$PDY/$cyc" -export COMOUT="$ROTDIR/enkf$CDUMP.$PDY/$cyc" +# COMIN, COMOUT are used in script +export COMIN="$ROTDIR/enkf$CDUMP.$PDY/$cyc/$COMPONENT" +export COMOUT="$ROTDIR/enkf$CDUMP.$PDY/$cyc/$COMPONENT" export LEVS=$((LEVS-1)) ############################################################### -# Run relevant exglobal script +# Run relevant script env msg="HAS BEGUN on `hostname`" postmsg "$jlogfile" "$msg" $LOGSCRIPT -${ENKFPOSTSH:-$SCRgsi/exglobal_enkf_post_fv3gfs.sh.ecf} +${ENKFPOSTSH:-$SCRgfs/exgdas_enkf_post.sh} status=$? [[ $status -ne 0 ]] && exit $status diff --git a/jobs/JGLOBAL_ENKF_SELECT_OBS b/jobs/JGDAS_ENKF_SELECT_OBS similarity index 90% rename from jobs/JGLOBAL_ENKF_SELECT_OBS rename to jobs/JGDAS_ENKF_SELECT_OBS index de69dd94b0..4dc7948223 100755 --- a/jobs/JGLOBAL_ENKF_SELECT_OBS +++ b/jobs/JGDAS_ENKF_SELECT_OBS @@ -53,10 +53,11 @@ export pgmerr=errfile ############################################## -# Set variables used in the exglobal script +# Set variables used in the script ############################################## export CDATE=${CDATE:-${PDY}${cyc}} export CDUMP=${CDUMP:-${RUN:-"gdas"}} +export COMPONENT=${COMPONENT:-atmos} if [ $RUN_ENVIR = "nco" ]; then export ROTDIR=${COMROOT:?}/$NET/$envir fi @@ -81,20 +82,19 @@ export GSUFFIX="${GSUFFIX:-".ensmean${SUFFIX}"}" export ASUFFIX="${ASUFFIX:-"${SUFFIX}"}" if [ $RUN_ENVIR = "nco" -o ${ROTDIR_DUMP:-NO} = "YES" ]; then - export COMIN_OBS=${COMIN_OBS:-$ROTDIR/$RUN.$PDY/$cyc} - export COMIN_GES_OBS=${COMIN_GES_OBS:-$ROTDIR/$GDUMP.$gPDY/$gcyc} + export COMIN_OBS=${COMIN_OBS:-$ROTDIR/$RUN.$PDY/$cyc/$COMPONENT} + export COMIN_GES_OBS=${COMIN_GES_OBS:-$ROTDIR/$GDUMP.$gPDY/$gcyc/$COMPONENT} else export COMIN_OBS="$DMPDIR/$CDATE/$CDUMP" export COMIN_GES_OBS="$DMPDIR/$GDATE/$GDUMP" fi -# COMIN_GES, COMIN_ANL COMIN_GES_ENS, and COMOUT are used in exglobal script -# TO DO: Map NCO's directory into these variables -COMIN_GES_CTL="$ROTDIR/gdas.$gPDY/$gcyc" -export COMIN_ANL="$ROTDIR/$CDUMP.$PDY/$cyc" -export COMIN_GES_ENS="$ROTDIR/enkfgdas.$gPDY/$gcyc" +# COMIN_GES, COMIN_ANL COMIN_GES_ENS, and COMOUT are used in script +COMIN_GES_CTL="$ROTDIR/gdas.$gPDY/$gcyc/$COMPONENT" +export COMIN_ANL="$ROTDIR/$CDUMP.$PDY/$cyc/$COMPONENT" +export COMIN_GES_ENS="$ROTDIR/enkfgdas.$gPDY/$gcyc/$COMPONENT" export COMIN_GES=$COMIN_GES_ENS -export COMOUT="$ROTDIR/enkf$CDUMP.$PDY/$cyc" +export COMOUT="$ROTDIR/enkf$CDUMP.$PDY/$cyc/$COMPONENT" export ATMGES_ENSMEAN="$COMIN_GES_ENS/${GPREFIX}atmf006$GSUFFIX" @@ -153,14 +153,14 @@ done ############################################################### -# Run relevant exglobal script +# Run relevant script env msg="HAS BEGUN on `hostname`" postmsg "$jlogfile" "$msg" $LOGSCRIPT -${INVOBSSH:-$SCRgsi/exglobal_innovate_obs_fv3gfs.sh.ecf} +${INVOBSSH:-$SCRgfs/exgdas_enkf_select_obs.sh} status=$? [[ $status -ne 0 ]] && exit $status diff --git a/jobs/JGDAS_ENKF_SURFACE b/jobs/JGDAS_ENKF_SFC similarity index 85% rename from jobs/JGDAS_ENKF_SURFACE rename to jobs/JGDAS_ENKF_SFC index 1fe82beada..a143b829dc 100755 --- a/jobs/JGDAS_ENKF_SURFACE +++ b/jobs/JGDAS_ENKF_SFC @@ -53,10 +53,11 @@ export pgmerr=errfile ############################################## -# Set variables used in the exglobal script +# Set variables used in the script ############################################## export CDATE=${CDATE:-${PDY}${cyc}} export CDUMP=${CDUMP:-${RUN:-"gdas"}} +export COMPONENT=${COMPONENT:-atmos} if [ $RUN_ENVIR = "nco" ]; then export ROTDIR=${COMROOT:?}/$NET/$envir fi @@ -89,30 +90,29 @@ export GSUFFIX=${GSUFFIX:-$SUFFIX} export ASUFFIX=${ASUFFIX:-$SUFFIX} if [ $RUN_ENVIR = "nco" -o ${ROTDIR_DUMP:-NO} = "YES" ]; then - export COMIN_OBS=${COMIN_OBS:-$ROTDIR/$RUN.$PDY/$cyc} - export COMIN_GES_OBS=${COMIN_GES_OBS:-$ROTDIR/$GDUMP.$gPDY/$gcyc} + export COMIN_OBS=${COMIN_OBS:-$ROTDIR/$RUN.$PDY/$cyc/$COMPONENT} + export COMIN_GES_OBS=${COMIN_GES_OBS:-$ROTDIR/$GDUMP.$gPDY/$gcyc/$COMPONENT} else export COMIN_OBS="$DMPDIR/$CDATE/$CDUMP" export COMIN_GES_OBS="$DMPDIR/$GDATE/$GDUMP" fi -# COMIN, COMIN_ENS and COMIN_GES_ENS are used in exglobal script -# TO DO: Map NCO's directory into these variables -export COMIN="$ROTDIR/$CDUMP.$PDY/$cyc" -export COMIN_ENS="$ROTDIR/enkf$CDUMP_ENKF.$PDY/$cyc" -export COMOUT_ENS="$ROTDIR/enkf$CDUMP.$PDY/$cyc" -export COMIN_GES_ENS="$ROTDIR/enkf$CDUMP.$gPDY/$gcyc" +# COMIN, COMIN_ENS and COMIN_GES_ENS are used in script +export COMIN="$ROTDIR/$CDUMP.$PDY/$cyc/$COMPONENT" +export COMIN_ENS="$ROTDIR/enkf$CDUMP_ENKF.$PDY/$cyc/$COMPONENT" +export COMOUT_ENS="$ROTDIR/enkf$CDUMP.$PDY/$cyc/$COMPONENT" +export COMIN_GES_ENS="$ROTDIR/enkf$CDUMP.$gPDY/$gcyc/$COMPONENT" ############################################################### -# Run relevant exglobal script +# Run relevant script env msg="HAS BEGUN on `hostname`" postmsg "$jlogfile" "$msg" $LOGSCRIPT -${ENKFRESFCSH:-$SCRgsi/exglobal_enkf_surface_fv3gfs.sh.ecf} +${ENKFRESFCSH:-$SCRgfs/exgdas_enkf_sfc.sh} status=$? [[ $status -ne 0 ]] && exit $status diff --git a/jobs/JGLOBAL_ENKF_UPDATE b/jobs/JGDAS_ENKF_UPDATE similarity index 88% rename from jobs/JGLOBAL_ENKF_UPDATE rename to jobs/JGDAS_ENKF_UPDATE index b66b7e2870..56c4c6027d 100755 --- a/jobs/JGLOBAL_ENKF_UPDATE +++ b/jobs/JGDAS_ENKF_UPDATE @@ -53,10 +53,11 @@ export pgmerr=errfile ############################################## -# Set variables used in the exglobal script +# Set variables used in the script ############################################## export CDATE=${CDATE:-${PDY}${cyc}} export CDUMP=${CDUMP:-${RUN:-"gdas"}} +export COMPONENT=${COMPONENT:-atmos} if [ $RUN_ENVIR = "nco" ]; then export ROTDIR=${COMROOT:?}/$NET/$envir fi @@ -76,20 +77,19 @@ export ASUFFIX=${ASUFFIX:-$SUFFIX} export GSUFFIX=${GSUFFIX:-$SUFFIX} -# COMIN_GES_ENS and COMOUT_ANL_ENS are used in exglobal script -# TO DO: Map NCO's directory into these variables -export COMIN_GES_ENS="$ROTDIR/enkfgdas.$gPDY/$gcyc" -export COMOUT_ANL_ENS="$ROTDIR/enkf$CDUMP.$PDY/$cyc" +# COMIN_GES_ENS and COMOUT_ANL_ENS are used in script +export COMIN_GES_ENS="$ROTDIR/enkfgdas.$gPDY/$gcyc/$COMPONENT" +export COMOUT_ANL_ENS="$ROTDIR/enkf$CDUMP.$PDY/$cyc/$COMPONENT" ############################################################### -# Run relevant exglobal script +# Run relevant script env msg="HAS BEGUN on `hostname`" postmsg "$jlogfile" "$msg" $LOGSCRIPT -${ENKFUPDSH:-$SCRgsi/exglobal_enkf_update_fv3gfs.sh.ecf} +${ENKFUPDSH:-$SCRgfs/exgdas_enkf_update.sh} status=$? [[ $status -ne 0 ]] && exit $status diff --git a/jobs/JGLOBAL_ANALYSIS b/jobs/JGLOBAL_ATMOS_ANALYSIS similarity index 88% rename from jobs/JGLOBAL_ANALYSIS rename to jobs/JGLOBAL_ATMOS_ANALYSIS index 2933109c91..5644c75305 100755 --- a/jobs/JGLOBAL_ANALYSIS +++ b/jobs/JGLOBAL_ATMOS_ANALYSIS @@ -54,10 +54,11 @@ export pgmerr=errfile ############################################## -# Set variables used in the exglobal script +# Set variables used in the script ############################################## export CDATE=${CDATE:-${PDY}${cyc}} export CDUMP=${CDUMP:-${RUN:-"gfs"}} +export COMPONENT=${COMPONENT:-atmos} if [ $RUN_ENVIR = "nco" ]; then export ROTDIR=${COMROOT:?}/$NET/$envir fi @@ -81,20 +82,19 @@ export ASUFFIX=${ASUFFIX:-$SUFFIX} if [ $RUN_ENVIR = "nco" -o ${ROTDIR_DUMP:-NO} = "YES" ]; then - export COMIN=${COMIN:-$ROTDIR/$RUN.$PDY/$cyc} - export COMOUT=${COMOUT:-$ROTDIR/$RUN.$PDY/$cyc} - export COMIN_OBS=${COMIN_OBS:-$ROTDIR/$RUN.$PDY/$cyc} - export COMIN_GES_OBS=${COMIN_GES_OBS:-$ROTDIR/$GDUMP.$gPDY/$gcyc} + export COMIN=${COMIN:-$ROTDIR/$RUN.$PDY/$cyc/$COMPONENT} + export COMOUT=${COMOUT:-$ROTDIR/$RUN.$PDY/$cyc/$COMPONENT} + export COMIN_OBS=${COMIN_OBS:-$ROTDIR/$RUN.$PDY/$cyc/$COMPONENT} + export COMIN_GES_OBS=${COMIN_GES_OBS:-$ROTDIR/$GDUMP.$gPDY/$gcyc/$COMPONENT} else - export COMOUT="$ROTDIR/$CDUMP.$PDY/$cyc" + export COMOUT="$ROTDIR/$CDUMP.$PDY/$cyc/$COMPONENT" export COMIN_OBS="$DMPDIR/$CDATE/$CDUMP" export COMIN_GES_OBS="$DMPDIR/$GDATE/$GDUMP" fi mkdir -m 775 -p $COMOUT -# COMIN_GES and COMIN_GES_ENS are used in exglobal script -# TO DO: Map NCO's directory into these variables -export COMIN_GES="$ROTDIR/$GDUMP.$gPDY/$gcyc" -export COMIN_GES_ENS="$ROTDIR/enkfgdas.$gPDY/$gcyc" +# COMIN_GES and COMIN_GES_ENS are used in script +export COMIN_GES="$ROTDIR/$GDUMP.$gPDY/$gcyc/$COMPONENT" +export COMIN_GES_ENS="$ROTDIR/enkfgdas.$gPDY/$gcyc/$COMPONENT" export ATMGES="$COMIN_GES/${GPREFIX}atmf006${GSUFFIX}" @@ -145,14 +145,14 @@ export DOGAUSFCANL=${DOGAUSFCANL:-"YES"} ############################################################### -# Run relevant exglobal script +# Run relevant script env msg="HAS BEGUN on `hostname`" postmsg "$jlogfile" "$msg" $LOGSCRIPT -${ANALYSISSH:-$SCRgsi/exglobal_analysis_fv3gfs.sh.ecf} +${ANALYSISSH:-$SCRgfs/exglobal_atmos_analysis.sh} status=$? [[ $status -ne 0 ]] && exit $status diff --git a/jobs/JGLOBAL_ANALCALC b/jobs/JGLOBAL_ATMOS_ANALYSIS_CALC similarity index 86% rename from jobs/JGLOBAL_ANALCALC rename to jobs/JGLOBAL_ATMOS_ANALYSIS_CALC index 94e524a0e6..7233684cc2 100755 --- a/jobs/JGLOBAL_ANALCALC +++ b/jobs/JGLOBAL_ATMOS_ANALYSIS_CALC @@ -54,10 +54,11 @@ export pgmerr=errfile ############################################## -# Set variables used in the exglobal script +# Set variables used in the script ############################################## export CDATE=${CDATE:-${PDY}${cyc}} export CDUMP=${CDUMP:-${RUN:-"gfs"}} +export COMPONENT=${COMPONENT:-atmos} if [ $RUN_ENVIR = "nco" ]; then export ROTDIR=${COMROOT:?}/$NET/$envir fi @@ -81,20 +82,19 @@ export ASUFFIX=${ASUFFIX:-$SUFFIX} if [ $RUN_ENVIR = "nco" -o ${ROTDIR_DUMP:-NO} = "YES" ]; then - export COMIN=${COMIN:-$ROTDIR/$RUN.$PDY/$cyc} - export COMOUT=${COMOUT:-$ROTDIR/$RUN.$PDY/$cyc} - export COMIN_OBS=${COMIN_OBS:-$ROTDIR/$RUN.$PDY/$cyc} - export COMIN_GES_OBS=${COMIN_GES_OBS:-$ROTDIR/$GDUMP.$gPDY/$gcyc} + export COMIN=${COMIN:-$ROTDIR/$RUN.$PDY/$cyc/$COMPONENT} + export COMOUT=${COMOUT:-$ROTDIR/$RUN.$PDY/$cyc/$COMPONENT} + export COMIN_OBS=${COMIN_OBS:-$ROTDIR/$RUN.$PDY/$cyc/$COMPONENT} + export COMIN_GES_OBS=${COMIN_GES_OBS:-$ROTDIR/$GDUMP.$gPDY/$gcyc/$COMPONENT} else - export COMOUT="$ROTDIR/$CDUMP.$PDY/$cyc" + export COMOUT="$ROTDIR/$CDUMP.$PDY/$cyc/$COMPONENT" export COMIN_OBS="$DMPDIR/$CDATE/$CDUMP" export COMIN_GES_OBS="$DMPDIR/$GDATE/$GDUMP" fi mkdir -m 775 -p $COMOUT -# COMIN_GES and COMIN_GES_ENS are used in exglobal script -# TO DO: Map NCO's directory into these variables -export COMIN_GES="$ROTDIR/$GDUMP.$gPDY/$gcyc" -export COMIN_GES_ENS="$ROTDIR/enkfgdas.$gPDY/$gcyc" +# COMIN_GES and COMIN_GES_ENS are used in script +export COMIN_GES="$ROTDIR/$GDUMP.$gPDY/$gcyc/$COMPONENT" +export COMIN_GES_ENS="$ROTDIR/enkfgdas.$gPDY/$gcyc/$COMPONENT" export ATMGES="$COMIN_GES/${GPREFIX}atmf006${GSUFFIX}" @@ -134,14 +134,14 @@ export DOGAUSFCANL=${DOGAUSFCANL:-"YES"} ############################################################### -# Run relevant exglobal script +# Run relevant script env msg="HAS BEGUN on `hostname`" postmsg "$jlogfile" "$msg" $LOGSCRIPT -${ANALCALCSH:-$HOMEgsi/scripts/exglobal_analcalc_fv3gfs.sh.ecf} +${ANALCALCSH:-$SCRgfs/exglobal_atmos_analysis_calc.sh} status=$? [[ $status -ne 0 ]] && exit $status diff --git a/jobs/JGLOBAL_ENKF_INNOVATE_OBS b/jobs/JGLOBAL_ENKF_INNOVATE_OBS deleted file mode 100755 index 19ce533984..0000000000 --- a/jobs/JGLOBAL_ENKF_INNOVATE_OBS +++ /dev/null @@ -1,171 +0,0 @@ -#!/bin/ksh -set -x - -export RUN_ENVIR=${RUN_ENVIR:-"nco"} -export PS4='$SECONDS + ' -date - - -############################# -# Source relevant config files -############################# -export EXPDIR=${EXPDIR:-$HOMEgfs/parm/config} -configs="base anal eobs" -config_path=${EXPDIR:-$NWROOT/gfs.${gfs_ver}/parm/config} -for config in $configs; do - . $config_path/config.$config - status=$? - [[ $status -ne 0 ]] && exit $status -done - - -########################################## -# Source machine runtime environment -########################################## -. $HOMEgfs/env/${machine}.env eobs -status=$? -[[ $status -ne 0 ]] && exit $status - - -############################################## -# Obtain unique process id (pid) and make temp directory -############################################## -export pid=${pid:-$$} -export outid=${outid:-"LL$job"} -export DATA=${DATA:-${DATAROOT}/${jobid:?}} -mkdir -p $DATA -cd $DATA - - -############################################## -# Run setpdy and initialize PDY variables -############################################## -export cycle="t${cyc}z" -setpdy.sh -. ./PDY - - -############################################## -# Determine Job Output Name on System -############################################## -export pgmout="OUTPUT.${pid}" -export pgmerr=errfile - - -############################################## -# Set variables used in the exglobal script -############################################## -export CDATE=${CDATE:-${PDY}${cyc}} -export CDUMP=${CDUMP:-${RUN:-"gdas"}} -if [ $RUN_ENVIR = "nco" ]; then - export ROTDIR=${COMROOT:?}/$NET/$envir -fi - - -############################################## -# Begin JOB SPECIFIC work -############################################## - -GDATE=$($NDATE -$assim_freq $CDATE) -gPDY=$(echo $GDATE | cut -c1-8) -gcyc=$(echo $GDATE | cut -c9-10) - - -export CASE=$CASE_ENKF - -export OPREFIX="${CDUMP}.t${cyc}z." -export APREFIX="${CDUMP}.t${cyc}z." -export GPREFIX="gdas.t${gcyc}z." -export GSUFFIX="${GSUFFIX:-$SUFFIX}" -export ASUFFIX="${ASUFFIX:-$SUFFIX}" - - -# COMIN_GES, COMIN_GES_ENS and COMOUT are used in exglobal script -# TO DO: Map NCO's directory into these variables -COMIN_GES_CTL="$ROTDIR/gdas.$gPDY/$gcyc" -export COMIN_GES_ENS="$ROTDIR/enkfgdas.$gPDY/$gcyc" -export COMIN_GES=$COMIN_GES_ENS -export COMOUT="$ROTDIR/enkf$CDUMP.$PDY/$cyc" - - -export ATMGES_ENSMEAN="$COMIN_GES_ENS/${GPREFIX}atmf006.ensmean$GSUFFIX" -if [ ! -f $ATMGES_ENSMEAN ]; then - echo "FATAL ERROR: FILE MISSING: ATMGES_ENSMEAN = $ATMGES_ENSMEAN" - exit 1 -fi - - -export LEVS=$($NCDUMP -h $ATMGES_ENSMEAN | grep -i "pfull" | head -1 | awk -F" = " '{print $2}' | awk -F" " '{print $1}') # get LEVS -status=$? -[[ $status -ne 0 ]] && exit $status - - -# Guess Bias correction coefficients related to control -export GBIAS=${COMIN_GES_CTL}/${GPREFIX}abias -export GBIASPC=${COMIN_GES_CTL}/${GPREFIX}abias_pc -export GBIASAIR=${COMIN_GES_CTL}/${GPREFIX}abias_air -export GRADSTAT=${COMIN_GES_CTL}/${GPREFIX}radstat - - -# Use the selected observations from ensemble mean -export RUN_SELECT="NO" -export USE_SELECT="YES" -export SELECT_OBS="$COMOUT/${APREFIX}obsinput.ensmean" - - -# Get ENSBEG/ENSEND from ENSGRP and NMEM_EOMGGRP -export ENSEND=$((NMEM_EOMGGRP * ENSGRP)) -export ENSBEG=$((ENSEND - NMEM_EOMGGRP + 1)) - - -############################################################### -# Run relevant exglobal script -env -msg="HAS BEGUN on `hostname`" -postmsg "$jlogfile" "$msg" -$LOGSCRIPT - - -${ENKFINVOBSSH:-$SCRgsi/exglobal_enkf_innovate_obs_fv3gfs.sh.ecf} -status=$? -[[ $status -ne 0 ]] && exit $status - - -# Double check the status of members in ENSGRP -EOMGGRP=$ROTDIR/enkf${CDUMP}.$PDY/$cyc/eomg.grp${ENSGRP} -npass=0 -if [ -f $EOMGGRP ]; then - npass=$(grep "PASS" $EOMGGRP | wc -l) -fi -echo "$npass/$NMEM_EOMGGRP members successfull in eomg.grp$ENSGRP" -if [ $npass -ne $NMEM_EOMGGRP ]; then - echo "FATAL ERROR: Failed members in $ENSGRP, ABORT!" - cat $EOMGGRP - exit 99 -fi - - -############################################## -# End JOB SPECIFIC work -############################################## - -############################################## -# Final processing -############################################## -if [ -e "$pgmout" ] ; then - cat $pgmout -fi - - -msg="ENDED NORMALLY." -postmsg "$jlogfile" "$msg" - - -########################################## -# Remove the Temporary working directory -########################################## -cd $DATAROOT -[[ $KEEPDATA = "NO" ]] && rm -rf $DATA - -date -exit 0 diff --git a/modulefiles/modulefile.ProdGSI.cheyenne b/modulefiles/modulefile.ProdGSI.cheyenne index 589ee214d2..211b681ad7 100644 --- a/modulefiles/modulefile.ProdGSI.cheyenne +++ b/modulefiles/modulefile.ProdGSI.cheyenne @@ -1,7 +1,7 @@ #%Module###################################################################### ## Mark.Potts@noaa.gov ## NOAA/NWS/NCEP/EMC -## ProdGSI +## NOAA-EMC/GSI ##_____________________________________________________ module purge diff --git a/modulefiles/modulefile.ProdGSI.discover b/modulefiles/modulefile.ProdGSI.discover index 1d843b8438..2c6d32b661 100644 --- a/modulefiles/modulefile.ProdGSI.discover +++ b/modulefiles/modulefile.ProdGSI.discover @@ -1,10 +1,10 @@ #%Module###################################################################### proc ModulesHelp { } { - puts stderr "Set environment veriables for GSI" + puts stderr "Set environment variables for NOAA-EMC/GSI" puts stderr "This module initializes the environment " - puts stderr "for building and testing GSI on NCCS Discover\n" + puts stderr "for building and testing NOAA-EMC/GSI on NCCS Discover\n" } -module-whatis "Initialize GSI build/test environment" +module-whatis "Initialize NOAA-EMC/GSI build/test environment" module load comp/intel-18.0.3.222 module load lib/mkl-18.0.3.222 diff --git a/modulefiles/modulefile.ProdGSI.gaea b/modulefiles/modulefile.ProdGSI.gaea index d71bafc749..163da2c707 100644 --- a/modulefiles/modulefile.ProdGSI.gaea +++ b/modulefiles/modulefile.ProdGSI.gaea @@ -1,24 +1,13 @@ #%Module1.0 ###################################################################### -## Russ.Treadon@noaa.gov -## NOAA/NWS/NCEP/EMC -## GDAS_ENKF v6.2.3 +## NOAA-EMC/GSI ##_____________________________________________________ proc ModulesHelp { } { -puts stderr "Set environment veriables for GDAS_ENKF" +puts stderr "Set environment variables for NOAA-EMC/GSI" puts stderr "This module initializes the environment " puts stderr "for the Intel Compiler Suite $version\n" } -module-whatis " GDAS_ENKF whatis description" - -set ver v6.2.3 - -setenv COMP ftn -setenv COMP_MP ftn -setenv COMP_MPI ftn - -setenv C_COMP cc -setenv C_COMP_MP cc +module-whatis " NOAA-EMC/GSI whatis description" set COMPILER intel @@ -30,7 +19,6 @@ setenv LDFLAGS_COM " " #set WRF_SHARED_ROOT /lustre/f1/pdata/ncep_shared/NCEPLIBS/lib/EXTERNAL/wrf_shared #setenv WRF_SHARED_PATH ${WRF_SHARED_ROOT}.${WRF_SHARED_VER} -# Known conflicts setenv NCEPLIBS /lustre/f1/pdata/ncep_shared/NCEPLIBS/lib # Loading ncep environment diff --git a/modulefiles/modulefile.ProdGSI.hera b/modulefiles/modulefile.ProdGSI.hera index b2ac092ced..aa158d2b89 100644 --- a/modulefiles/modulefile.ProdGSI.hera +++ b/modulefiles/modulefile.ProdGSI.hera @@ -1,48 +1,44 @@ #%Module###################################################################### -## Russ.Treadon@noaa.gov -## NOAA/NWS/NCEP/EMC -## GDAS_ENKF v6.2.3 -##_____________________________________________________ -#set ver v6.2.3 - -set COMP ifort -set COMP_MP mpfort -set COMP_MPI mpiifort - -set C_COMP icc -set C_COMP_MP mpcc - -# Known conflicts - - -# Load compiler, mpi, cmake, and hdf5/netcdf -module load intel/18.0.5.274 -# python -module use -a /contrib/modulefiles -module load anaconda/2.3.0 - -module load impi/2018.0.4 - -module load contrib -module load cmake/3.9.0 - -# Load libraries -module use /scratch2/NCEPDEV/nwprod/NCEPLIBS/modulefiles -module load bacio/2.0.3 -module load bufr/11.3.0 +# NOAA-EMC/GSI +#_____________________________________________________ +#proc ModulesHelp { } { +#puts stderr "Set environment variables for NOAA-EMC/GSI" +#puts stderr "This module initializes the environment " +#puts stderr "for the Intel Compiler Suite $version\n" +##} +#module-whatis " NOAA-EMC/GSI whatis description" + +setenv CRTM_FIX /scratch2/NCEPDEV/nwprod/NCEPLIBS/fix/crtm_v2.3.0 + +# Load cmake +module use -a /contrib/cmake/modulefiles +module load cmake/3.16.1 + +# Load hpc-stack +module use /scratch2/NCEPDEV/nwprod/hpc-stack/libs/hpc-stack/modulefiles/stack +module load hpc/1.1.0 + +# Load intel compiler and mpi +module load hpc-intel/18.0.5.274 +module load hpc-impi/2018.0.4 + +# Load python +# Note: anaconda/2.3.0 requires intel be loaded prior to anaconda +module use -a /contrib/anaconda/modulefiles +module load anaconda/2.3.0 + +# Load production utilities +module load prod_util/1.2.2 + +# Load nceplibs +module load bufr/11.4.0 +module load ip/3.3.3 +module load nemsio/2.5.2 +module load sfcio/1.4.1 +module load sigio/2.3.2 +module load sp/2.3.3 +module load w3nco/2.4.1 +module load w3emc/2.7.3 +module load bacio/2.4.1 module load crtm/2.3.0 -module load ip/3.0.2 -module load nemsio/2.2.4 -module load prod_util/1.1.0 -module load sfcio/1.1.1 -module load sigio/2.1.1 -module load sp/2.0.3 -module load w3emc/2.3.1 -module load w3nco/2.0.7 -module load hdf5_parallel/1.10.6 -module load netcdf_parallel/4.7.4 - -# Set environmental variables to allow correlated error to reproduce on Hera -export MKL_NUM_THREADS=4 -export MKL_CBWR=AUTO - +module load netcdf/4.7.4 diff --git a/modulefiles/modulefile.ProdGSI.jet b/modulefiles/modulefile.ProdGSI.jet index 1f932ea765..dfc65dcb50 100644 --- a/modulefiles/modulefile.ProdGSI.jet +++ b/modulefiles/modulefile.ProdGSI.jet @@ -1,44 +1,43 @@ -#%Module###################################################################### -## Russ.Treadon@noaa.gov -## NOAA/NWS/NCEP/EMC -## GDAS_ENKF v6.2.3 + #%Module###################################################################### +## NOAA-EMC/GSI ##_____________________________________________________ #proc ModulesHelp { } { -#puts stderr "Set environment veriables for GSI build with CMake" +#puts stderr "Set environment variables for NOAA-EMC/GSI" #puts stderr "This module initializes the environment " #puts stderr "for the Intel Compiler Suite $version\n" #} -#module-whatis " GDAS_ENKF whatis description" +#module-whatis " NOAA-EMC/GSI whatis description" # # -module load newdefaults -module load intel/2016.2.181 -module load impi/5.1.1.109 -# -module load szip/2.1 -module load hdf5/1.8.9 -module load netcdf4/4.2.1.1 -export COREPATH=/lfs3/projects/hfv3gfs/nwprod/lib -export COREPATH=/mnt/lfs3/projects/hfv3gfs/gwv/ljtjet/lib -export NCEPLIBS=$COREPATH -module use $NCEPLIBS/modulefiles +set CRTM_FIX /lfs4/HFIP/hfv3gfs/gwv/l0530/lib/crtm/v2.3.0/fix + +# Load cmake +module load cmake/3.16.1 + +# Load python +module load intelpython/3.6.5 + +# Load hpc-stack +module use /lfs4/HFIP/hfv3gfs/nwprod/hpc-stack/libs/modulefiles/stack +module load hpc/1.1.0 -export FFLAGS="-openmp" -export LDFLAGS="-openmp" -module load bacio-intel-sandybridge/2.0.2 -module load crtm-intel-sandybridge/2.2.5 -module load bufr-intel-sandybridge/11.1.0 -module load nemsio-intel-sandybridge/2.2.2 -module load sp-intel-sandybridge/2.0.2 -module load w3emc-intel-sandybridge/2.2.0 -module load w3nco-intel-sandybridge/2.0.6 -module load sigio-intel-sandybridge/2.0.1 -module load sfcio-intel-sandybridge/1.0.0 +# Load intel compiler and mpi +module load hpc-intel/18.0.5.274 +module load hpc-impi/2018.4.274 -module use /home/George.Vandenberghe/t1/l1025/lib/modulefiles -module load hdf5 -module load netcdf +# Load production utilities +module load prod_util/1.2.2 -export NETCDF=${NETCDF4} -export NETCDF_DIR=${NETCDF4} +# Load nceplibs +module load bufr/11.4.0 +module load ip/3.3.3 +module load nemsio/2.5.2 +module load sfcio/1.4.1 +module load sigio/2.3.2 +module load sp/2.3.3 +module load w3nco/2.4.1 +module load w3emc/2.7.3 +module load bacio/2.4.1 +module load crtm/2.3.0 +module load netcdf/4.7.4 diff --git a/modulefiles/modulefile.ProdGSI.orion b/modulefiles/modulefile.ProdGSI.orion index db8a9f4c7f..238887a9f5 100644 --- a/modulefiles/modulefile.ProdGSI.orion +++ b/modulefiles/modulefile.ProdGSI.orion @@ -1,46 +1,49 @@ #%Module###################################################################### -## Russ.Treadon@noaa.gov -## NOAA/NWS/NCEP/EMC -## GDAS_ENKF v6.2.3 -##_____________________________________________________ -#set ver v6.2.3 +# NOAA-EMC/GSI +#_____________________________________________________ +#proc ModulesHelp { } { +#puts stderr "Set environment variables for NOAA-EMC/GSI" +#puts stderr "This module initializes the environment " +#puts stderr "for the Intel Compiler Suite $version\n" +##} +#module-whatis " NOAA-EMC/GSI whatis description" -set COMP ifort -set COMP_MP mpfort -set COMP_MPI mpiifort +setenv CRTM_FIX /apps/contrib/NCEPLIBS/orion/fix/crtm_v2.3.0 -set C_COMP icc -set C_COMP_MP mpcc +# Load cmake +module load cmake/3.17.3 -# Known conflicts - - -# Load compiler, mpi, cmake, and hdf5/netcdf -module load intel/2018.4 -module load impi/2018.4 - -module load cmake/3.15.4 - -# Python +# Load python module load python/3.7.5 -# Load libraries -module use /apps/contrib/NCEPLIBS/orion/modulefiles -module load bacio/2.0.3 +# Load hpc-stack +module use /apps/contrib/NCEP/libs/hpc-stack/modulefiles/stack +module load hpc/1.1.0 + +# Load intel compiler and mpi +# +# Note: hpc-intel/2018.4 erroneously loads mkl/2020.2. hpc-stack +# PR 173 submitted to resolves this. Until then, unload mkl/2020.2 +# after loading hpc-intel/2018.4 and load mkl/2018.4 to ensure +# consistency +# +module load hpc-intel/2018.4 +module unload mkl/2020.2 +module load mkl/2018.4 +module load hpc-impi/2018.4 + +# Load production utilities +module load prod_util/1.2.2 + +# Load nceplibs +module load bufr/11.4.0 +module load ip/3.3.3 +module load nemsio/2.5.2 +module load sfcio/1.4.1 +module load sigio/2.3.2 +module load sp/2.3.3 +module load w3nco/2.4.1 +module load w3emc/2.7.3 +module load bacio/2.4.1 module load crtm/2.3.0 -module load ip/3.1.0 -module load nemsio/2.3.0 -module load prod_util/1.2.0 -module load sfcio/1.2.0 -module load sigio/2.2.0 -module load sp/2.1.0 -module load w3emc/2.5.0 -module load w3nco/2.1.0 -module load bufr/11.3.0 -module load netcdf_parallel/4.7.4 -module load hdf5_parallel/1.10.6 - -# Fix MKL threads for reproducible global_gsi.x with correlated obs error -#export MKL_NUM_THREADS=4 -#export MKL_CBWR=AUTO - +module load netcdf/4.7.4 diff --git a/modulefiles/modulefile.ProdGSI.s4 b/modulefiles/modulefile.ProdGSI.s4 index 3db2ec137d..c95e453672 100644 --- a/modulefiles/modulefile.ProdGSI.s4 +++ b/modulefiles/modulefile.ProdGSI.s4 @@ -1,18 +1,8 @@ #%Module###################################################################### -## Russ.Treadon@noaa.gov -## NOAA/NWS/NCEP/EMC -## GDAS_ENKF v6.2.3 +## NOAA-EMC/GSI ##_____________________________________________________ -#set ver v6.2.3 -set COMP ifort -set COMP_MP mpfort -set COMP_MPI mpiifort -set C_COMP icc -set C_COMP_MP mpcc - -# Known conflicts module use -a /home/mpotts/s4-cardinal/spack/share/spack/modules/linux-centos7-x86_64 module load license_intel/S4 module load intel/18.0.3 diff --git a/modulefiles/modulefile.ProdGSI.wcoss b/modulefiles/modulefile.ProdGSI.wcoss deleted file mode 100644 index 88467187cc..0000000000 --- a/modulefiles/modulefile.ProdGSI.wcoss +++ /dev/null @@ -1,51 +0,0 @@ -#%Module###################################################################### -## Russ.Treadon@noaa.gov -## NOAA/NWS/NCEP/EMC -## GDAS_ENKF v6.2.3 -##_____________________________________________________ -proc ModulesHelp { } { -puts stderr "Set environment veriables for GDAS_ENKF" -puts stderr "This module initializes the environment " -puts stderr "for the Intel Compiler Suite $version\n" -} -module-whatis " GDAS_ENKF whatis description" - -set ver v6.2.3 - -setenv COMP ifort -setenv COMP_MP mpfort -setenv COMP_MPI mpiifort - -setenv C_COMP icc -setenv C_COMP_MP mpcc - -setenv FFLAGS_COM "-fp-model source" -setenv LDFLAGS_COM "-mkl" - -set WRF_SHARED_VER v1.1.0 -set WRF_SHARED_ROOT /nwprod/sorc/wrf_shared.fd -setenv WRF_SHARED_PATH ${WRF_SHARED_ROOT} - -# Known conflicts - -# Loading Intel Compiler Suite -module load ics/15.0.3 - -# Loading ibmpe -module load ibmpe -module load lsf - -# Loading nceplibs modules -module load NetCDF/4.2 -module load bufr/v11.0.0 -module load nemsio/v2.2.1 -module load sfcio/v1.0.0 -module load sigio/v2.1.0 -module load sp/v2.0.2 -module load w3nco/v2.0.6 -module load w3emc/v2.2.0 -module load crtm/v2.2.3 -module load bacio/v2.0.2 - -module use /usrx/local/dev/modulefiles -module load cmake diff --git a/modulefiles/modulefile.ProdGSI.wcoss_c b/modulefiles/modulefile.ProdGSI.wcoss_c index 8a2ec237ec..f02f4ded73 100644 --- a/modulefiles/modulefile.ProdGSI.wcoss_c +++ b/modulefiles/modulefile.ProdGSI.wcoss_c @@ -1,23 +1,12 @@ #%Module###################################################################### -## Russ.Treadon@noaa.gov -## NOAA/NWS/NCEP/EMC -## GDAS_ENKF v6.2.3 +## NOAA-EMC/GSI ##_____________________________________________________ proc ModulesHelp { } { -puts stderr "Set environment veriables for GDAS_ENKF" +puts stderr "Set environment variables for NOAA-EMC/GSI" puts stderr "This module initializes the environment " puts stderr "for the Intel Compiler Suite $version\n" } -module-whatis " GDAS_ENKF whatis description" - -set ver v6.2.3 - -setenv COMP ftn -setenv COMP_MP ftn -setenv COMP_MPI ftn - -setenv C_COMP cc -setenv C_COMP_MP cc +module-whatis " NOAA-EMC/GSI whatis description" set COMPILER intel @@ -28,45 +17,36 @@ set WRF_SHARED_VER v1.1.0 set WRF_SHARED_ROOT /gpfs/hps/nco/ops/nwprod/wrf_shared setenv WRF_SHARED_PATH ${WRF_SHARED_ROOT}.${WRF_SHARED_VER}-${COMPILER} -# Known conflicts - # Loading ncep environment module load ncep/1.0 -module load prod_util/1.0.29 +module load prod_util/1.1.2 # Loading Intel Compiler Suite -module load PrgEnv-intel/5.2.56 +module load PrgEnv-intel/5.2.82 module unload intel/15.0.3.187 module load intel/18.1.163 # Loading pe environment +module load craype-sandybridge module load cray-mpich/7.2.0 -module load craype-haswell -module use /usrx/local/dev/modulefiles -module load cmake/3.6.2 -module unuse /usrx/local/dev/modulefiles +module load cmake/3.16.2 # Loading netcdf modules -module load cray-netcdf/4.3.2 -module load cray-hdf5/1.8.14 +module load HDF5-parallel-intel-sandybridge/1.10.6 +module load NetCDF-intel-sandybridge/4.7.4 # Loading nceplibs modules -module use /gpfs/hps/nco/ops/nwprod/lib/modulefiles -module load bufr-intel/11.0.1 -module load ip-intel/3.0.0 -module load nemsio-intel/2.2.2 +module load bufr-intel/11.3.0 +module load ip-intel/3.0.2 +module load nemsio-intel/2.2.4 module load sfcio-intel/1.0.0 module load sigio-intel/2.1.0 -module load sp-intel/2.0.2 -module load w3nco-intel/2.0.6 -module load w3emc-intel/2.2.0 - -module use /usrx/local/nceplibs/modulefiles -module load bacio-intel/2.0.2 - -module use -a /usrx/local/nceplibs/NCEPLIBS/modulefiles -module load crtm/2.3.0 +module load sp-intel/2.0.3 +module load w3nco-intel/2.2.0 +module load w3emc-intel/2.4.0 +module load bacio-intel/2.0.3 +module load crtm-intel/2.3.0 # Loading python module load python/3.6.3 diff --git a/modulefiles/modulefile.ProdGSI.wcoss_d b/modulefiles/modulefile.ProdGSI.wcoss_d index 69fe0a4108..81a63ec6ea 100644 --- a/modulefiles/modulefile.ProdGSI.wcoss_d +++ b/modulefiles/modulefile.ProdGSI.wcoss_d @@ -1,56 +1,45 @@ #%Module###################################################################### -# Russ.Treadon@noaa.gov -# NOAA/NWS/NCEP/EMC -# GDAS_ENKF v6.2.3 +# NOAA-EMC/GSI #_____________________________________________________ #proc ModulesHelp { } { -#puts stderr "Set environment veriables for GDAS_ENKF" +#puts stderr "Set environment variables for NOAA-EMC/GSI" #puts stderr "This module initializes the environment " #puts stderr "for the Intel Compiler Suite $version\n" ##} -#module-whatis " GDAS_ENKF whatis description" +#module-whatis " NOAA-EMC/GSI whatis description" -#set ver v6.2.3 +setenv CRTM_FIX /gpfs/dell1/nco/ops/nwprod/lib/crtm/v2.3.0/fix -set COMP ifort -set COMP_MPI mpiifort -set C_COMP icc +# Load cmake +module load cmake/3.16.2 -# Known conflicts - -# Loading pe environment -module load lsf/10.1 - -# Loading Intel Compiler Suite -module load ips/18.0.1.163 - -# Loading intel mpi -module load impi/18.0.1 - -# Loading production utilities (ndate) -module load prod_util/1.1.0 - -# Loading nceplibs modules -module load bufr/11.3.0 -module load ip/3.0.1 -module load nemsio/2.2.3 -module load sfcio/1.0.0 -module load sigio/2.1.0 -module load sp/2.0.2 -module load w3nco/2.0.6 -module load w3emc/2.3.0 -module load bacio/2.0.2 +# Load python +module load python/3.6.3 -# Loading cmake -module load cmake/3.10.0 +# Load hpc-stack +module use /usrx/local/nceplibs/dev/hpc-stack/libs/hpc-stack/modulefiles/stack +module load hpc/1.1.0 -# Loading python -module load python/3.6.3 +# Load pe environment +module load lsf/10.1 -# Load modules from nceplibs (until installed by NCO) -module use -a /usrx/local/nceplibs/dev/NCEPLIBS/modulefiles +# Load intel compiler and mpi +module load hpc-ips/18.0.1.163 +module load hpc-impi/18.0.1 + +# Load production utilities +module load prod_util/1.2.2 + +# Load nceplibs +module load bufr/11.4.0 +module load ip/3.3.3 +module load nemsio/2.5.2 +module load sfcio/1.4.1 +module load sigio/2.3.2 +module load sp/2.3.3 +module load w3nco/2.4.1 +module load w3emc/2.7.3 +module load bacio/2.4.1 module load crtm/2.3.0 -module load hdf5_parallel/1.10.6 -module load netcdf_parallel/4.7.4 - +module load netcdf/4.7.4 diff --git a/regression/global_C96_fv3aero.sh b/regression/global_C96_fv3aero.sh index e5468b6139..006c87fbe3 100755 --- a/regression/global_C96_fv3aero.sh +++ b/regression/global_C96_fv3aero.sh @@ -27,7 +27,11 @@ ncp=/bin/cp # Given the analysis date, compute the date from which the # first guess comes. Extract cycle and set prefix and suffix # for guess and observation data files +PDY=`echo $global_C96_fv3aero_adate | cut -c1-8` +cyc=`echo $global_C96_fv3aero_adate | cut -c9-10` gdate=`$ndate -06 $global_C96_fv3aero_adate` +gPDY=`echo $gdate | cut -c1-8` +gcyc=`echo $gdate | cut -c9-10` hha=`echo $global_C96_fv3aero_adate | cut -c9-10` hhg=`echo $gdate | cut -c9-10` prefix_obs=gfs.t${hha}z. @@ -38,6 +42,10 @@ prefix_atm=gfsC96.t${hhg}z suffix_obs=gdas.${global_C96_fv3aero_adate} suffix_bias=gdas.${gdate} +datobs=$global_C96_fv3aero_obs/gfs.$PDY/$cyc +datanl=$global_C96_fv3aero_obs/gfs.$PDY/$cyc +datges=$global_C96_fv3aero_ges/gfs.$gPDY/$gcyc + # Set up $tmpdir rm -rf $tmpdir @@ -235,32 +243,32 @@ $ncp $fixcrtm/v.modis_terra.SpcCoeff.bin ./crtm_coeffs/v.modis_terra.SpcCoeff.bi $ncp $fixcrtm/v.modis_terra.TauCoeff.bin ./crtm_coeffs/v.modis_terra.TauCoeff.bin # Copy observational data to $tmpdir -ln -s -f $global_C96_fv3aero_obs/${prefix_obs}modisaod.tm00.bufr ./modisaodbufr +ln -s -f $datobs/${prefix_obs}modisaod.tm00.bufr ./modisaodbufr # Copy bias correction, atmospheric and surface files -ln -s -f $global_C96_fv3aero_ges/gfs.t18z.abias ./satbias_in -ln -s -f $global_C96_fv3aero_ges/gfs.t18z.abias_pc ./satbias_pc -#ln -s -f $global_C96_fv3aero_ges/gfs.t18z.radstat ./radstat.gdas +ln -s -f $datges/gfs.t18z.abias ./satbias_in +ln -s -f $datges/gfs.t18z.abias_pc ./satbias_pc +#ln -s -f $datges/gfs.t18z.radstat ./radstat.gdas if [[ "$endianness" = "Big_Endian" ]]; then - ln -s -f $global_C96_fv3aero_ges/${prefix_sfc}.sfcf03 ./sfcf03 - ln -s -f $global_C96_fv3aero_ges/${prefix_sfc}.sfcf06 ./sfcf06 - ln -s -f $global_C96_fv3aero_ges/${prefix_sfc}.sfcf09 ./sfcf09 + ln -s -f $datges/${prefix_sfc}.sfcf03 ./sfcf03 + ln -s -f $datges/${prefix_sfc}.sfcf06 ./sfcf06 + ln -s -f $datges/${prefix_sfc}.sfcf09 ./sfcf09 elif [[ "$endianness" = "Little_Endian" ]]; then - ln -s -f $global_C96_fv3aero_ges/${prefix_sfc}.sfcf03.le ./sfcf03 - ln -s -f $global_C96_fv3aero_ges/${prefix_sfc}.sfcf06.le ./sfcf06 - ln -s -f $global_C96_fv3aero_ges/${prefix_sfc}.sfcf09.le ./sfcf09 + ln -s -f $datges/${prefix_sfc}.sfcf03.le ./sfcf03 + ln -s -f $datges/${prefix_sfc}.sfcf06.le ./sfcf06 + ln -s -f $datges/${prefix_sfc}.sfcf09.le ./sfcf09 fi if [[ "$endianness" = "Big_Endian" ]]; then - ln -s -f $global_C96_fv3aero_ges/${prefix_atm}.sigf03 ./sigf03 - ln -s -f $global_C96_fv3aero_ges/${prefix_atm}.sigf06 ./sigf06 - ln -s -f $global_C96_fv3aero_ges/${prefix_atm}.sigf09 ./sigf09 + ln -s -f $datges/${prefix_atm}.sigf03 ./sigf03 + ln -s -f $datges/${prefix_atm}.sigf06 ./sigf06 + ln -s -f $datges/${prefix_atm}.sigf09 ./sigf09 elif [[ "$endianness" = "Little_Endian" ]]; then - ln -s -f $global_C96_fv3aero_ges/${prefix_atm}.sigf03.le ./sigf03 - ln -s -f $global_C96_fv3aero_ges/${prefix_atm}.sigf06.le ./sigf06 - ln -s -f $global_C96_fv3aero_ges/${prefix_atm}.sigf09.le ./sigf09 + ln -s -f $datges/${prefix_atm}.sigf03.le ./sigf03 + ln -s -f $datges/${prefix_atm}.sigf06.le ./sigf06 + ln -s -f $datges/${prefix_atm}.sigf09.le ./sigf09 fi # Run GSI diff --git a/regression/global_C96_fv3aerorad.sh b/regression/global_C96_fv3aerorad.sh new file mode 100755 index 0000000000..14a7d58bd1 --- /dev/null +++ b/regression/global_C96_fv3aerorad.sh @@ -0,0 +1,305 @@ +set -x +# Set experiment name and analysis date + +exp=$jobname + +# Set the JCAP resolution which you want. +# All resolutions use LEVS=64 +export LEVS=64 + +# Set runtime and save directories +tmpdir=$tmpdir/$tmpregdir/${exp} +savdir=$savdir/outC96_fv3aerorad/${exp} + +# Specify GSI fixed field and data directories. +fixcrtm=${fixcrtm:-$CRTM_FIX} + +# Set variables used in script +# CLEAN up $tmpdir when finished (YES=remove, NO=leave alone) +# ncp is cp replacement, currently keep as /bin/cp + +UNCOMPRESS=gunzip +CLEAN=NO +ncp=/bin/cp +ncpl="ln -fs" + +# Given the analysis date, compute the date from which the +# first guess comes. Extract cycle and set prefix and suffix +# for guess and observation data files +PDY=`echo $global_C96_fv3aerorad_adate | cut -c1-8` +cyc=`echo $global_C96_fv3aerorad_adate | cut -c9-10` +gdate=`$ndate -06 $global_C96_fv3aerorad_adate` +gPDY=`echo $gdate | cut -c1-8` +gcyc=`echo $gdate | cut -c9-10` +hha=`echo $global_C96_fv3aerorad_adate | cut -c9-10` +hhg=`echo $gdate | cut -c9-10` +prefix_obs=gfs.t${hha}z +prefix_prep=$prefix_obs +prefix_tbc=gdas1.t${hhg}z +prefix_sfc=gfsC96.t${hhg}z +prefix_atm=gfsC96.t${hhg}z +prefix_aer=gfsC96.t${hhg}z +suffix_obs=tm00.bufr_d + +datobs=$global_C96_fv3aerorad_obs/gfs.$PDY/$cyc +datanl=$global_C96_fv3aerorad_obs/gfs.$PDY/$cyc +datges=$global_C96_fv3aerorad_ges/gfs.$gPDY/$gcyc + +# Set up $tmpdir +rm -rf $tmpdir +mkdir -p $tmpdir +cd $tmpdir +rm -rf core* + + +# CO2 namelist and file decisions +ICO2=${ICO2:-0} +if [ $ICO2 -gt 0 ] ; then + # Copy co2 files to $tmpdir + co2dir=${CO2DIR:-$fixgsi} + yyyy=$(echo ${CDATE:-$global_C96_fv3aerorad_adate}|cut -c1-4) + rm ./global_co2_data.txt + co2=$co2dir/global_co2.gcmscl_$yyyy.txt + while [ ! -s $co2 ] ; do + ((yyyy-=1)) + co2=$co2dir/global_co2.gcmscl_$yyyy.txt + done + if [ -s $co2 ] ; then + $ncp $co2 ./global_co2_data.txt + fi + if [ ! -s ./global_co2_data.txt ] ; then + echo "\./global_co2_data.txt" not created + exit 1 + fi +fi +#CH4 file decision +ICH4=${ICH4:-0} +if [ $ICH4 -gt 0 ] ; then +# # Copy ch4 files to $tmpdir + ch4dir=${CH4DIR:-$fixgsi} + yyyy=$(echo ${CDATE:-$global_C96_fv3aerorad_adate}|cut -c1-4) + rm ./ch4globaldata.txt + ch4=$ch4dir/global_ch4_esrlctm_$yyyy.txt + while [ ! -s $ch4 ] ; do + ((yyyy-=1)) + ch4=$ch4dir/global_ch4_esrlctm_$yyyy.txt + done + if [ -s $ch4 ] ; then + $ncp $ch4 ./ch4globaldata.txt + fi + if [ ! -s ./ch4globaldata.txt ] ; then + echo "\./ch4globaldata.txt" not created + exit 1 + fi +fi +IN2O=${IN2O:-0} +if [ $IN2O -gt 0 ] ; then +# # Copy ch4 files to $tmpdir + n2odir=${N2ODIR:-$fixgsi} + yyyy=$(echo ${CDATE:-$global_C96_fv3aerorad_adate}|cut -c1-4) + rm ./n2oglobaldata.txt + n2o=$n2odir/global_n2o_esrlctm_$yyyy.txt + while [ ! -s $n2o ] ; do + ((yyyy-=1)) + n2o=$n2odir/global_n2o_esrlctm_$yyyy.txt + done + if [ -s $n2o ] ; then + $ncp $n2o ./n2oglobaldata.txt + fi + if [ ! -s ./n2oglobaldata.txt ] ; then + echo "\./n2oglobaldata.txt" not created + exit 1 + fi +fi +ICO=${ICO:-0} +if [ $ICO -gt 0 ] ; then +# # Copy CO files to $tmpdir + codir=${CODIR:-$fixgsi} + yyyy=$(echo ${CDATE:-$global_C96_fv3aerorad_adate}|cut -c1-4) + rm ./coglobaldata.txt + co=$codir/global_co_esrlctm_$yyyy.txt + while [ ! -s $co ] ; do + ((yyyy-=1)) + co=$codir/global_co_esrlctm_$yyyy.txt + done + if [ -s $co ] ; then + $ncp $co ./coglobaldata.txt + fi + if [ ! -s ./coglobaldata.txt ] ; then + echo "\./coglobaldata.txt" not created + exit 1 + fi +fi + +# Make gsi namelist + +. $scripts/regression_nl_update.sh + +SETUP="$SETUP_update" +GRIDOPTS="$GRIDOPTS_update" +BKGVERR="$BKGVERR_update" +ANBKGERR="$ANBKERR_update" +JCOPTS="$JCOPTS_update" +STRONGOPTS="$STRONGOPTS_update" +OBSQC="$OBSQC_update" +OBSINPUT="$OBSINPUT_update" +SUPERRAD="$SUPERRAD_update" +SINGLEOB="$SINGLEOB_update" + +. $scripts/regression_namelists.sh global_C96_fv3aerorad + +##! l4dvar=.false.,nhr_assimilation=6,nhr_obsbin=6, +##! lsqrtb=.true.,lcongrad=.false.,ltlint=.true., +##! idmodel=.true.,lwrtinc=.false., + +cat << EOF > gsiparm.anl + +$gsi_namelist + +EOF + +# Set fixed files +# berror = forecast model background error statistics +# specoef = CRTM spectral coefficients +# trncoef = CRTM transmittance coefficients +# emiscoef = CRTM coefficients for IR sea surface emissivity model +# aerocoef = CRTM coefficients for aerosol effects +# cldcoef = CRTM coefficients for cloud effects +# satinfo = text file with information about assimilation of brightness temperatures +# cloudyinfo = text file with information about assimilation of cloudy radiance +# satangl = angle dependent bias correction file (fixed in time) +# pcpinfo = text file with information about assimilation of prepcipitation rates +# ozinfo = text file with information about assimilation of ozone data +# errtable = text file with obs error for conventional data (optional) +# convinfo = text file with information about assimilation of conventional data +# bufrtable= text file ONLY needed for single obs test (oneobstest=.true.) +# bftab_sst= bufr table for sst ONLY needed for sst retrieval (retrieval=.true.) + +berror=$fixgsi/Big_Endian/global_berror.l64y194.f77 + +emiscoef_IRwater=$fixcrtm/Nalli.IRwater.EmisCoeff.bin +emiscoef_IRice=$fixcrtm/NPOESS.IRice.EmisCoeff.bin +emiscoef_IRland=$fixcrtm/NPOESS.IRland.EmisCoeff.bin +emiscoef_IRsnow=$fixcrtm/NPOESS.IRsnow.EmisCoeff.bin +emiscoef_VISice=$fixcrtm/NPOESS.VISice.EmisCoeff.bin +emiscoef_VISland=$fixcrtm/NPOESS.VISland.EmisCoeff.bin +emiscoef_VISsnow=$fixcrtm/NPOESS.VISsnow.EmisCoeff.bin +emiscoef_VISwater=$fixcrtm/NPOESS.VISwater.EmisCoeff.bin +emiscoef_MWwater=$fixcrtm/FASTEM6.MWwater.EmisCoeff.bin +aercoef=$fixcrtm/AerosolCoeff.bin +cldcoef=$fixcrtm/CloudCoeff.bin +satangl=$fixgsi/global_satangbias.txt +scaninfo=$fixgsi/global_scaninfo.txt +satinfo=$fixgsi/fv3aerorad_satinfo.txt +cloudyinfo=$fixgsi/cloudy_radiance_info.txt +convinfo=$fixgsi/global_convinfo_reg_test.txt +anavinfo=$fixgsi/anavinfo_fv3aerorad +ozinfo=$fixgsi/global_ozinfo.txt +pcpinfo=$fixgsi/global_pcpinfo.txt +hybens_info=$fixgsi/global_hybens_info.l64.txt +errtable=$fixgsi/prepobs_errtable.global +atmsbeaminfo=$fixgsi/atms_beamwidth.txt + +# Copy executable and fixed files to $tmpdir +if [[ $exp == *"updat"* ]]; then + $ncp $gsiexec_updat ./gsi.x +elif [[ $exp == *"contrl"* ]]; then + $ncp $gsiexec_contrl ./gsi.x +fi + +mkdir ./crtm_coeffs +$ncp $berror ./berror_stats +$ncp $emiscoef_IRwater ./crtm_coeffs/Nalli.IRwater.EmisCoeff.bin +$ncp $emiscoef_IRice ./crtm_coeffs/NPOESS.IRice.EmisCoeff.bin +$ncp $emiscoef_IRsnow ./crtm_coeffs/NPOESS.IRsnow.EmisCoeff.bin +$ncp $emiscoef_IRland ./crtm_coeffs/NPOESS.IRland.EmisCoeff.bin +$ncp $emiscoef_VISice ./crtm_coeffs/NPOESS.VISice.EmisCoeff.bin +$ncp $emiscoef_VISland ./crtm_coeffs/NPOESS.VISland.EmisCoeff.bin +$ncp $emiscoef_VISsnow ./crtm_coeffs/NPOESS.VISsnow.EmisCoeff.bin +$ncp $emiscoef_VISwater ./crtm_coeffs/NPOESS.VISwater.EmisCoeff.bin +$ncp $emiscoef_MWwater ./crtm_coeffs/FASTEM6.MWwater.EmisCoeff.bin +$ncp $aercoef ./crtm_coeffs/AerosolCoeff.bin +$ncp $cldcoef ./crtm_coeffs/CloudCoeff.bin +$ncp $satangl ./satbias_angle +$ncp $scaninfo ./scaninfo +$ncp $satinfo ./satinfo +$ncp $cloudyinfo ./cloudy_radiance_info.txt +$ncp $pcpinfo ./pcpinfo +$ncp $ozinfo ./ozinfo +$ncp $convinfo ./convinfo +$ncp $errtable ./errtable +$ncp $anavinfo ./anavinfo +$ncp $aeroinfo ./aeroinfo +$ncp $hybens_info ./hybens_info +$ncp $atmsbeaminfo ./atms_beamwidth.txt + +# Copy CRTM coefficient files +for file in `awk '{if($1!~"!"){print $1}}' ./satinfo | sort | uniq` ;do + $ncp $fixcrtm/${file}.SpcCoeff.bin ./crtm_coeffs + $ncp $fixcrtm/${file}.TauCoeff.bin ./crtm_coeffs +done + +# Copy observational data to $tmpdir +$ncpl $datobs/${prefix_obs}.prepbufr ./prepbufr +$ncpl $datobs/${prefix_obs}.prepbufr.acft_profiles ./prepbufr_profl +$ncpl $datobs/${prefix_obs}.nsstbufr ./nsstbufr +$ncpl $datobs/${prefix_obs}.airsev.${suffix_obs} ./airsbufr +$ncpl $datobs/${prefix_obs}.mtiasi.${suffix_obs} ./iasibufr +$ncpl $datobs/${prefix_obs}.cris.${suffix_obs} ./crisbufr + +# Copy bias correction, atmospheric and surface files +$ncpl $datges/gfs.t18z.abias ./satbias_in +$ncpl $datges/gfs.t18z.abias_pc ./satbias_pc +$ncpl $datges/gfs.t18z.abias_air ./aircftbias_in +#$ncpl $datges/gfs.t18z.radstat ./radstat.gdas + +if [[ "$endianness" = "Big_Endian" ]]; then + ln -s -f $datges/${prefix_sfc}.sfcf03 ./sfcf03 + ln -s -f $datges/${prefix_sfc}.sfcf06 ./sfcf06 + ln -s -f $datges/${prefix_sfc}.sfcf09 ./sfcf09 +elif [[ "$endianness" = "Little_Endian" ]]; then + ln -s -f $datges/${prefix_sfc}.sfcf03.le ./sfcf03 + ln -s -f $datges/${prefix_sfc}.sfcf06.le ./sfcf06 + ln -s -f $datges/${prefix_sfc}.sfcf09.le ./sfcf09 +fi + +if [[ "$endianness" = "Big_Endian" ]]; then + ln -s -f $datges/${prefix_atm}.sigf03 ./sigf03 + ln -s -f $datges/${prefix_atm}.sigf06 ./sigf06 + ln -s -f $datges/${prefix_atm}.sigf09 ./sigf09 +elif [[ "$endianness" = "Little_Endian" ]]; then + ln -s -f $datges/${prefix_atm}.sigf03.le ./sigf03 + ln -s -f $datges/${prefix_atm}.sigf06.le ./sigf06 + ln -s -f $datges/${prefix_atm}.sigf09.le ./sigf09 +fi + +if [[ "$endianness" = "Big_Endian" ]]; then + $ncpl $datges/${prefix_aer}.sigf03 ./aerf03 + $ncpl $datges/${prefix_aer}.sigf06 ./aerf06 + $ncpl $datges/${prefix_aer}.sigf09 ./aerf09 +elif [[ "$endianness" = "Little_Endian" ]]; then + $ncpl $datges/${prefix_aer}.sigf03.le ./aerf03 + $ncpl $datges/${prefix_aer}.sigf06.le ./aerf06 + $ncpl $datges/${prefix_aer}.sigf09.le ./aerf09 +fi + +# Run GSI +cd $tmpdir +echo "run gsi now" +eval "$APRUN $tmpdir/gsi.x > stdout 2>&1" +rc=$? +exit $rc + +# If requested, clean up $tmpdir +if [[ "$CLEAN" = "YES" ]];then + if [[ $rc -eq 0 ]];then + rm -rf $tmpdir + cd $tmpdir + cd ../ + rmdir $tmpdir + fi +fi + + +# End of script +exit diff --git a/regression/multi_regression.sh b/regression/multi_regression.sh index fc19da4c6d..da6fcb8d46 100755 --- a/regression/multi_regression.sh +++ b/regression/multi_regression.sh @@ -17,7 +17,8 @@ regtests_all="global_T62 hwrf_nmm_d3 rtma global_enkf_T62 - global_C96_fv3aero" + global_C96_fv3aero + global_C96_fv3aerorad" regtests_debug="global_T62 global_4dvar_T62 @@ -33,7 +34,8 @@ regtests_debug="global_T62 netcdf_fv3_regional hwrf_nmm_d2 hwrf_nmm_d3 - global_C96_fv3aero" + global_C96_fv3aero + global_C96_fv3aerorad" # Choose which regression test to run; by default, run all regtests=${1:-$regtests_all} diff --git a/regression/regression_namelists.sh b/regression/regression_namelists.sh index 37e07a67d6..95eb6858c9 100755 --- a/regression/regression_namelists.sh +++ b/regression/regression_namelists.sh @@ -2922,6 +2922,123 @@ OBS_INPUT:: obhourset=0., / + &NST + nst_gsi=3, + nstinfo=4,fac_dtl=1,fac_tsl=1,zsea1=0,zsea2=0, + /" +;; + + global_C96_fv3aerorad) + +# Define namelist for global run (aerosol analysis) + +export gsi_namelist=" + &SETUP + niter(1)=100,niter(2)=100 + niter_no_qc(1)=50,niter_no_qc(2)=0, + write_diag(1)=.true.,write_diag(2)=.false.,write_diag(3)=.true., + qoption=2, + gencode=82,factqmin=0.5,factqmax=0.005,deltim=1200, + iguess=-1, + tzr_qc=1, + oneobtest=.false.,retrieval=.false.,l_foto=.false., + use_pbl=.false.,use_compress=.true.,nsig_ext=12,gpstop=50., + use_gfs_nemsio=.true.,sfcnst_comb=.true., + use_readin_anl_sfcmask=.false., + lrun_subdirs=.true., + crtm_coeffs_path='./crtm_coeffs/', + newpc4pred=.true.,adp_anglebc=.true.,angord=4,passive_bc=.true.,use_edges=.false., + diag_precon=.true.,step_start=1.e-3,emiss_bc=.true.,nhr_obsbin=3, + cwoption=3,imp_physics=11,lupp=.true., + netcdf_diag=.true.,binary_diag=.false., + lobsdiag_forenkf=.false., + diag_aero=.false., use_fv3_aero=.true.,offtime_data=.true., + diag_rad=.true.,diag_pcp=.false.,diag_conv=.true.,diag_ozone=.false., + / + + &GRIDOPTS + JCAP_B=190,JCAP=190,NLAT=194,NLON=384,nsig=64, + regional=.false.,nlayers(63)=3,nlayers(64)=6, + / + + &BKGERR + vs=0.7, + hzscl=1.7,0.8,0.5, + hswgt=0.45,0.3,0.25, + bw=0.0,norsp=4, + bkgv_flowdep=.true.,bkgv_rewgtfct=1.5, + bkgv_write=.false., + cwcoveqqcov=.false., + / + + &ANBKGERR + anisotropic=.false., + / + + &JCOPTS + ljcdfi=.false.,alphajc=0.0,ljcpdry=.true.,bamp_jcpdry=5.0e7, + / + + &STRONGOPTS + tlnmc_option=2,nstrong=1,nvmodes_keep=8,period_max=6.,period_width=1.5, + / + + &OBSQC + dfact=0.75,dfact1=3.0,noiqc=.true.,oberrflg=.false.,c_varqc=0.02, + use_poq7=.true.,qc_noirjaco3_pole=.true.,vqc=.true., + aircraft_t_bc=.false.,biaspredt=1000.0,upd_aircraft=.true.,cleanup_tail=.true., + / + + &OBS_INPUT + dmesh(1)=145.0,dmesh(2)=150.0,dmesh(3)=100.0,time_window_max=3.0, + / + +OBS_INPUT:: +! dfile dtype dplat dsis dval dthin dsfcalc + prepbufr ps null ps 0.0 0 0 + prepbufr t null t 0.0 0 0 + prepbufr q null q 0.0 0 0 + prepbufr pw null pw 0.0 0 0 + prepbufr uv null uv 0.0 0 0 + prepbufr spd null spd 0.0 0 0 + prepbufr dw null dw 0.0 0 0 + airsbufr airs aqua airs_aqua 0.0 1 1 + iasibufr iasi metop-a iasi_metop-a 0.0 1 1 + iasibufr iasi metop-b iasi_metop-b 0.0 1 0 + crisbufr cris npp cris_npp 0.0 1 0 + nsstbufr sst nsst sst 0.0 0 0 +:: + + &SUPEROB_RADAR + / + + &LAG_DATA + / + + &HYBRID_ENSEMBLE + l_hyb_ens=.false., + generate_ens=.false., + beta_s0=0.125,readin_beta=.false., + s_ens_h=800.,s_ens_v=-0.8,readin_localization=.true., + aniso_a_en=.false.,oz_univ_static=.false.,uv_hyb_ens=.true., + ensemble_path='./ensemble_data/', + ens_fast_read=.true., + / + + &RAPIDREFRESH_CLDSURF + dfi_radar_latent_heat_time_period=30.0, + / + + &CHEM + lread_ext_aerosol=.true., + / + + &SINGLEOB_TEST + maginnov=0.1,magoberr=0.1,oneob_type='t', + oblat=45.,oblon=180.,obpres=1000.,obdattim=2019061718, + obhourset=0., + / + &NST nst_gsi=3, nstinfo=4,fac_dtl=1,fac_tsl=1,zsea1=0,zsea2=0, diff --git a/regression/regression_namelists_db.sh b/regression/regression_namelists_db.sh index 2b0d3fb39f..9eed1bbd54 100755 --- a/regression/regression_namelists_db.sh +++ b/regression/regression_namelists_db.sh @@ -288,8 +288,6 @@ OBS_INPUT:: amsuabufr amsua n19 amsua_n19 0.0 1 1 mhsbufr mhs n19 mhs_n19 0.0 1 1 tcvitl tcp null tcp 0.0 0 0 - modisbufr modis aqua modis_aqua 0.0 1 0 - modisbufr modis terra modis_terra 0.0 1 0 mlsbufr mls30 aura mls30_aura 1.0 0 0 seviribufr seviri m08 seviri_m08 0.0 5 0 seviribufr seviri m09 seviri_m09 0.0 5 0 diff --git a/regression/regression_param.sh b/regression/regression_param.sh index 3d1e30e647..488b4f4691 100755 --- a/regression/regression_param.sh +++ b/regression/regression_param.sh @@ -632,6 +632,39 @@ case $regtest in ;; + global_C96_fv3aerorad) + + if [[ "$machine" = "Hera" ]]; then + topts[1]="0:20:00" ; popts[1]="16/4/" ; ropts[1]="/1" + topts[2]="0:20:00" ; popts[2]="16/8/" ; ropts[2]="/2" + elif [[ "$machine" = "Cheyenne" ]]; then + topts[1]="0:15:00" ; popts[1]="16/2/" ; ropts[1]="/1" + topts[2]="0:15:00" ; popts[2]="16/4/" ; ropts[2]="/2" + elif [[ "$machine" = "WCOSS" ]]; then + topts[1]="0:15:00" ; popts[1]="16/2/" ; ropts[1]="/1" + topts[2]="0:15:00" ; popts[2]="16/4/" ; ropts[2]="/2" + elif [[ "$machine" = "WCOSS_C" ]]; then + topts[1]="0:15:00" ; popts[1]="36/4/" ; ropts[1]="1024/1" # sub_wcoss_c popts are "#tasks/#nodes/" + topts[2]="0:15:00" ; popts[2]="72/8/" ; ropts[2]="1024/2" + elif [[ "$machine" = "WCOSS_D" ]]; then + topts[1]="0:30:00" ; popts[1]="28/2/" ; ropts[1]="/1" + topts[2]="0:30:00" ; popts[2]="28/4/" ; ropts[2]="/2" + elif [[ "$machine" = "Discover" ]]; then + topts[1]="0:30:00" ; popts[1]="20/4" ; ropts[1]="/1" + topts[2]="0:30:00" ; popts[2]="40/2" ; ropts[2]="/2" + elif [[ "$machine" = "s4" ]]; then + topts[1]="0:25:00" ; popts[1]="36/2/" ; ropts[1]="/1" + topts[2]="0:25:00" ; popts[2]="72/3/" ; ropts[2]="/2" + fi + + if [ "$debug" = ".true." ] ; then + topts[1]="1:00:00" + fi + + scaling[1]=10; scaling[2]=8; scaling[3]=4 + + ;; + *) # EXIT out for unresolved regtest echo "unknown $regtest" diff --git a/regression/regression_var.sh b/regression/regression_var.sh index e6e5c4744c..1a8b5d9fa9 100755 --- a/regression/regression_var.sh +++ b/regression/regression_var.sh @@ -112,6 +112,7 @@ case $machine in elif [ -d /scratch2/BMC/gsienkf/$LOGNAME ]; then export noscrub="/scratch2/BMC/gsienkf/$LOGNAME" fi + export group="global" export queue="batch" if [[ "$cmaketest" = "false" ]]; then @@ -137,6 +138,8 @@ case $machine in export noscrub="/gpfs/hps3/emc/global/noscrub/$LOGNAME" elif [ -d /gpfs/hps3/emc/da/noscrub/$LOGNAME ]; then export noscrub="/gpfs/hps3/emc/da/noscrub/$LOGNAME" + elif [ -d /gpfs/hps3/emc/hwrf/noscrub/$LOGNAME ]; then + export noscrub="/gpfs/hps3/emc/hwrf/noscrub/$LOGNAME" fi if [[ "$cmaketest" = "false" ]]; then export basedir="/gpfs/hps3/emc/global/noscrub/$LOGNAME/svn/gsi" @@ -233,6 +236,7 @@ export rtma_adate="2020022420" export hwrf_nmm_adate="2012102812" export fv3_netcdf_adate="2017030100" export global_C96_fv3aero_adate="2019062200" +export global_C96_fv3aerorad_adate="2019062200" # Paths for canned case data. export global_T62_obs="$casesdir/global/sigmap/$global_T62_adate" @@ -271,6 +275,8 @@ export fv3_netcdf_obs="$casesdir/regional/fv3_netcdf/$fv3_netcdf_adate" export fv3_netcdf_ges="$casesdir/regional/fv3_netcdf/$fv3_netcdf_adate" export global_C96_fv3aero_obs="$casesdir/global/fv3/$global_C96_fv3aero_adate" export global_C96_fv3aero_ges="$casesdir/global/fv3/$global_C96_fv3aero_adate" +export global_C96_fv3aerorad_obs="$casesdir/global/fv3/$global_C96_fv3aerorad_adate" +export global_C96_fv3aerorad_ges="$casesdir/global/fv3/$global_C96_fv3aerorad_adate" # Define type of GPSRO data to be assimilated (refractivity or bending angle) export gps_dtype="gps_bnd" diff --git a/scripts/exgdas_atmos_chgres_forenkf.sh b/scripts/exgdas_atmos_chgres_forenkf.sh new file mode 100755 index 0000000000..bb131c4276 --- /dev/null +++ b/scripts/exgdas_atmos_chgres_forenkf.sh @@ -0,0 +1,217 @@ +#!/bin/ksh +################################################################################ +#### UNIX Script Documentation Block +# . . +# Script name: exgdas_atmos_chgres_forenkf.sh +# Script description: Runs chgres on full-resolution forecast for EnKF recentering +# +# Author: Cory Martin Org: NCEP/EMC Date: 2020-06-08 +# +# Abstract: This script runs chgres on full-resolution forecast for later +# use in the EnKF recentering step +# +# $Id$ +# +# Attributes: +# Language: POSIX shell +# Machine: WCOSS-Dell / Hera +# +################################################################################ + +# Set environment. +export VERBOSE=${VERBOSE:-"YES"} +if [ $VERBOSE = "YES" ]; then + echo $(date) EXECUTING $0 $* >&2 + set -x +fi + +# Directories. +pwd=$(pwd) +export FIXgsm=${FIXgsm:-$HOMEgfs/fix/fix_am} + +# Base variables +CDATE=${CDATE:-"2001010100"} +CDUMP=${CDUMP:-"gdas"} +GDUMP=${GDUMP:-"gdas"} + +# Derived base variables +GDATE=$($NDATE -$assim_freq $CDATE) +BDATE=$($NDATE -3 $CDATE) +PDY=$(echo $CDATE | cut -c1-8) +cyc=$(echo $CDATE | cut -c9-10) +bPDY=$(echo $BDATE | cut -c1-8) +bcyc=$(echo $BDATE | cut -c9-10) + +# Utilities +export NCP=${NCP:-"/bin/cp"} +export NMV=${NMV:-"/bin/mv"} +export NLN=${NLN:-"/bin/ln -sf"} +export CHGRP_CMD=${CHGRP_CMD:-"chgrp ${group_name:-rstprod}"} +export NCLEN=${NCLEN:-$HOMEgfs/ush/getncdimlen} +export ERRSCRIPT=${ERRSCRIPT:-'eval [[ $err = 0 ]]'} + +# IAU +DOIAU=${DOIAU:-"NO"} +export IAUFHRS=${IAUFHRS:-"6"} + +# Dependent Scripts and Executables +export APRUN_CHGRES=${APRUN_CHGRES:-${APRUN:-""}} +export CHGRESNCEXEC=${CHGRESNCEXEC:-$HOMEgfs/exec/enkf_chgres_recenter_nc.x} +export NTHREADS_CHGRES=${NTHREADS_CHGRES:-1} +APRUNCFP=${APRUNCFP:-""} + +# OPS flags +RUN=${RUN:-""} +SENDECF=${SENDECF:-"NO"} +SENDDBN=${SENDDBN:-"NO"} + +# level info file +SIGLEVEL=${SIGLEVEL:-${FIXgsm}/global_hyblev.l${LEVS}.txt} + +# forecast files +APREFIX=${APREFIX:-""} +ASUFFIX=${ASUFFIX:-$SUFFIX} +# at full resolution +ATMF03=${ATMF03:-${COMOUT}/${APREFIX}atmf003${ASUFFIX}} +ATMF04=${ATMF04:-${COMOUT}/${APREFIX}atmf004${ASUFFIX}} +ATMF05=${ATMF05:-${COMOUT}/${APREFIX}atmf005${ASUFFIX}} +ATMF06=${ATMF06:-${COMOUT}/${APREFIX}atmf006${ASUFFIX}} +ATMF07=${ATMF07:-${COMOUT}/${APREFIX}atmf007${ASUFFIX}} +ATMF08=${ATMF08:-${COMOUT}/${APREFIX}atmf008${ASUFFIX}} +ATMF09=${ATMF09:-${COMOUT}/${APREFIX}atmf009${ASUFFIX}} +# at ensemble resolution +ATMF03ENS=${ATMF03ENS:-${COMOUT}/${APREFIX}atmf003.ensres${ASUFFIX}} +ATMF04ENS=${ATMF04ENS:-${COMOUT}/${APREFIX}atmf004.ensres${ASUFFIX}} +ATMF05ENS=${ATMF05ENS:-${COMOUT}/${APREFIX}atmf005.ensres${ASUFFIX}} +ATMF06ENS=${ATMF06ENS:-${COMOUT}/${APREFIX}atmf006.ensres${ASUFFIX}} +ATMF07ENS=${ATMF07ENS:-${COMOUT}/${APREFIX}atmf007.ensres${ASUFFIX}} +ATMF08ENS=${ATMF08ENS:-${COMOUT}/${APREFIX}atmf008.ensres${ASUFFIX}} +ATMF09ENS=${ATMF09ENS:-${COMOUT}/${APREFIX}atmf009.ensres${ASUFFIX}} +ATMFCST_ENSRES=${ATMFCST_ENSRES:-${COMOUT_ENS}/mem001/${APREFIX}atmf006${ASUFFIX}} + +# Set script / GSI control parameters +DOHYBVAR=${DOHYBVAR:-"NO"} +lrun_subdirs=${lrun_subdirs:-".true."} +USE_CFP=${USE_CFP:-"NO"} +CFP_MP=${CFP_MP:-"NO"} +nm="" +if [ $CFP_MP = "YES" ]; then + nm=0 +fi +if [ $DOHYBVAR = "YES" ]; then + l_hyb_ens=.true. + export l4densvar=${l4densvar:-".false."} + export lwrite4danl=${lwrite4danl:-".false."} +else + echo "DOHYBVAR != YES, this script will exit without regridding deterministic forecast" + exit 0 +fi + +################################################################################ +################################################################################ +# Preprocessing +mkdata=NO +if [ ! -d $DATA ]; then + mkdata=YES + mkdir -p $DATA +fi + +cd $DATA || exit 99 + +############################################################## +# get resolution information +LONB_ENKF=${LONB_ENKF:-$($NCLEN $ATMFCST_ENSRES grid_xt)} # get LONB_ENKF +LATB_ENKF=${LATB_ENKF:-$($NCLEN $ATMFCST_ENSRES grid_yt)} # get LATB_ENFK +LEVS_ENKF=${LEVS_ENKF:-$($NCLEN $ATMFCST_ENSRES pfull)} # get LATB_ENFK + +############################################################## +# If analysis increment is written by GSI, regrid forecasts to increment resolution +if [ $DO_CALC_ANALYSIS == "YES" ]; then + $NLN $ATMF06 fcst.06 + $NLN $ATMF06ENS fcst.ensres.06 + $NLN $ATMFCST_ENSRES atmens_fcst + if [ $DOHYBVAR = "YES" -a $l4densvar = ".true." -a $lwrite4danl = ".true." ]; then + $NLN $ATMF03 fcst.03 + $NLN $ATMF03ENS fcst.ensres.03 + $NLN $ATMF04 fcst.04 + $NLN $ATMF04ENS fcst.ensres.04 + $NLN $ATMF05 fcst.05 + $NLN $ATMF05ENS fcst.ensres.05 + $NLN $ATMF07 fcst.07 + $NLN $ATMF07ENS fcst.ensres.07 + $NLN $ATMF08 fcst.08 + $NLN $ATMF08ENS fcst.ensres.08 + $NLN $ATMF09 fcst.09 + $NLN $ATMF09ENS fcst.ensres.09 + fi + export OMP_NUM_THREADS=$NTHREADS_CHGRES + SIGLEVEL=${SIGLEVEL:-${FIXgsm}/global_hyblev.l${LEVS_ENKF}.txt} + + if [ $USE_CFP = "YES" ]; then + [[ -f $DATA/mp_chgres.sh ]] && rm $DATA/mp_chgres.sh + fi + + nfhrs=`echo $IAUFHRS_ENKF | sed 's/,/ /g'` + for FHR in $nfhrs; do + echo "Regridding deterministic forecast for forecast hour $FHR" + rm -f chgres_nc_gauss0$FHR.nml +cat > chgres_nc_gauss0$FHR.nml << EOF +&chgres_setup +i_output=$LONB_ENKF +j_output=$LATB_ENKF +input_file="fcst.0$FHR" +output_file="fcst.ensres.0$FHR" +terrain_file="atmens_fcst" +ref_file="atmens_fcst" +/ +EOF + if [ $USE_CFP = "YES" ]; then + echo "$nm $APRUN_CHGRES $CHGRESNCEXEC chgres_nc_gauss0$FHR.nml" | tee -a $DATA/mp_chgres.sh + if [ ${CFP_MP:-"NO"} = "YES" ]; then + nm=$((nm+1)) + fi + else + + export pgm=$CHGRESNCEXEC + . prep_step + + $APRUN_CHGRES $CHGRESNCEXEC chgres_nc_gauss0$FHR.nml + rc=$? + export ERR=$rc + export err=$ERR + $ERRSCRIPT || exit 1 + fi + done + + if [ $USE_CFP = "YES" ]; then + chmod 755 $DATA/mp_chgres.sh + ncmd=$(cat $DATA/mp_chgres.sh | wc -l) + if [ $ncmd -gt 0 ]; then + ncmd_max=$((ncmd < npe_node_max ? ncmd : npe_node_max)) + APRUNCFP_CHGRES=$(eval echo $APRUNCFP) + + export pgm=$CHGRESNCEXEC + . prep_step + + $APRUNCFP_CHGRES $DATA/mp_chgres.sh + export ERR=$? + export err=$ERR + $ERRSCRIPT || exit 3 + fi + fi + +else + echo "DO_CALC_ANALYSIS != YES, doing nothing" +fi + + +################################################################################ +# Postprocessing +cd $pwd +[[ $mkdata = "YES" ]] && rm -rf $DATA + +set +x +if [ $VERBOSE = "YES" ]; then + echo $(date) EXITING $0 with return code $err >&2 +fi +exit $err diff --git a/scripts/exglobal_enkf_recenter_fv3gfs.sh.ecf b/scripts/exgdas_enkf_ecen.sh similarity index 88% rename from scripts/exglobal_enkf_recenter_fv3gfs.sh.ecf rename to scripts/exgdas_enkf_ecen.sh index 707fcc3141..645baa3f7c 100755 --- a/scripts/exglobal_enkf_recenter_fv3gfs.sh.ecf +++ b/scripts/exgdas_enkf_ecen.sh @@ -2,7 +2,7 @@ ################################################################################ #### UNIX Script Documentation Block # . . -# Script name: exglobal_enkf_recenter_fv3gfs.sh.ecf +# Script name: exgdas_enkf_ecen.sh # Script description: recenter ensemble around hi-res deterministic analysis # # Author: Rahul Mahajan Org: NCEP/EMC Date: 2017-03-02 @@ -26,22 +26,10 @@ fi # Directories. pwd=$(pwd) -export NWPROD=${NWPROD:-$pwd} -export HOMEgfs=${HOMEgfs:-$NWPROD} -HOMEgsi=${HOMEgsi:-$NWPROD} -export DATA=${DATA:-$pwd} -COMIN=${COMIN:-$pwd} -COMIN_ENS=${COMIN_ENS:-$COMIN} -COMIN_OBS=${COMIN_OBS:-$COMIN} -COMIN_GES=${COMIN_GES:-$COMIN} -COMIN_GES_ENS=${COMIN_GES_ENS:-$COMIN_ENS} -COMIN_GES_OBS=${COMIN_GES_OBS:-$COMIN_GES} -COMOUT=${COMOUT:-$COMIN} -COMOUT_ENS=${COMOUT_ENS:-$COMIN_ENS} +# Base variables CDATE=${CDATE:-"2010010100"} DONST=${DONST:-"NO"} - export CASE=${CASE:-384} ntiles=${ntiles:-6} @@ -55,11 +43,11 @@ NCLEN=${NCLEN:-$HOMEgfs/ush/getncdimlen} # Scripts # Executables. -GETATMENSMEANEXEC=${GETATMENSMEANEXEC:-$HOMEgsi/exec/getsigensmeanp_smooth.x} -GETSFCENSMEANEXEC=${GETSFCENSMEANEXEC:-$HOMEgsi/exec/getsfcensmeanp.x} -RECENATMEXEC=${RECENATMEXEC:-$HOMEgsi/exec/recentersigp.x} -CALCINCNEMSEXEC=${CALCINCNEMSEXEC:-$HOMEgsi/exec/calc_increment_ens.x} -CALCINCNCEXEC=${CALCINCEXEC:-$HOMEgsi/exec/calc_increment_ens_ncio.x} +GETATMENSMEANEXEC=${GETATMENSMEANEXEC:-$HOMEgfs/exec/getsigensmeanp_smooth.x} +GETSFCENSMEANEXEC=${GETSFCENSMEANEXEC:-$HOMEgfs/exec/getsfcensmeanp.x} +RECENATMEXEC=${RECENATMEXEC:-$HOMEgfs/exec/recentersigp.x} +CALCINCNEMSEXEC=${CALCINCNEMSEXEC:-$HOMEgfs/exec/calc_increment_ens.x} +CALCINCNCEXEC=${CALCINCEXEC:-$HOMEgfs/exec/calc_increment_ens_ncio.x} # Files. OPREFIX=${OPREFIX:-""} @@ -83,8 +71,8 @@ DO_CALC_INCREMENT=${DO_CALC_INCREMENT:-"NO"} # global_chgres stuff -CHGRESNEMS=${CHGRESNEMS:-$HOMEgfs/exec/chgres_recenter.exe} -CHGRESNC=${CHGRESNC:-$HOMEgfs/exec/chgres_recenter_ncio.exe} +CHGRESNEMS=${CHGRESNEMS:-$HOMEgfs/exec/enkf_chgres_recenter.x} +CHGRESNC=${CHGRESNC:-$HOMEgfs/exec/enkf_chgres_recenter_nc.x} NTHREADS_CHGRES=${NTHREADS_CHGRES:-24} APRUN_CHGRES=${APRUN_CHGRES:-""} @@ -171,6 +159,8 @@ if [ $DO_CALC_INCREMENT = "YES" ]; then ATMANLMEANNAME="atmanl_ensmean" export OMP_NUM_THREADS=$NTHREADS_ECEN + export pgm=$GETATMENSMEANEXEC + . prep_step $NCP $GETATMENSMEANEXEC $DATA $APRUN_ECEN ${DATA}/$(basename $GETATMENSMEANEXEC) $DATAPATH $ATMANLMEANNAME $ATMANLNAME $NMEM_ENKF @@ -193,6 +183,8 @@ else ATMINCMEANNAME="atminc_ensmean" export OMP_NUM_THREADS=$NTHREADS_ECEN + export pgm=$GETATMENSMEANEXEC + . prep_step $NCP $GETATMENSMEANEXEC $DATA $APRUN_ECEN ${DATA}/$(basename $GETATMENSMEANEXEC) $DATAPATH $ATMINCMEANNAME $ATMINCNAME $NMEM_ENKF @@ -211,6 +203,8 @@ else ATMGESMEANNAME="atmges_ensmean" export OMP_NUM_THREADS=$NTHREADS_ECEN + export pgm=$GETATMENSMEANEXEC + . prep_step $NCP $GETATMENSMEANEXEC $DATA $APRUN_ECEN ${DATA}/$(basename $GETATMENSMEANEXEC) $DATAPATH $ATMGESMEANNAME $ATMGESNAME $NMEM_ENKF @@ -277,7 +271,7 @@ if [ $RECENTER_ENKF = "YES" ]; then export OMP_NUM_THREADS=$NTHREADS_CHGRES - rm -f $chgresnml + [[ -f $chgresnml ]] && rm -f $chgresnml cat > $chgresnml << EOF &${nmltitle}_setup i_output=$LONB_ENKF @@ -308,6 +302,8 @@ EOF FILENAMEOUT="ratmanl" export OMP_NUM_THREADS=$NTHREADS_ECEN + export pgm=$RECENATMEXEC + . prep_step $NCP $RECENATMEXEC $DATA $APRUN_ECEN ${DATA}/$(basename $RECENATMEXEC) $FILENAMEIN $FILENAME_MEANIN $FILENAME_MEANOUT $FILENAMEOUT $NMEM_ENKF @@ -317,13 +313,6 @@ EOF export err=$ERR $ERRSCRIPT || exit 2 - # Optionally alert recentered files - if [ ${SENDDBN:-"NO"} = "YES" ]; then - for imem in $(seq 1 $NMEM_ENKF); do - memchar="mem"$(printf %03i $imem) - $DBNROOT/bin/dbn_alert MODEL GFS_ENKF $job $COMOUT_ENS/$memchar/${APREFIX}ratmanl$ASUFFIX - done - fi else ################################################################################ # Recenter ensemble member atmospheric increments about hires analysis @@ -338,7 +327,7 @@ EOF # make the small namelist file for incvars_to_zero - rm recenter.nml + [[ -f recenter.nml ]] && rm recenter.nml cat > recenter.nml << EOF &recenter incvars_to_zero = $INCREMENTS_TO_ZERO @@ -346,6 +335,9 @@ EOF EOF cat recenter.nml + export pgm=$RECENATMEXEC + . prep_step + $NCP $RECENATMEXEC $DATA $APRUN_ECEN ${DATA}/$(basename $RECENATMEXEC) $FILENAMEIN $FILENAME_INCMEANIN $FILENAME_GSIDET $FILENAMEOUT $NMEM_ENKF $FILENAME_GESMEANIN rc=$? @@ -354,13 +346,6 @@ cat recenter.nml export err=$ERR $ERRSCRIPT || exit 2 - # Optionally alert recentered files - if [ ${SENDDBN:-"NO"} = "YES" ]; then - for imem in $(seq 1 $NMEM_ENKF); do - memchar="mem"$(printf %03i $imem) - $DBNROOT/bin/dbn_alert MODEL GFS_ENKF $job $COMOUT_ENS/$memchar/${APREFIX}ratminc$ASUFFIX - done - fi fi fi @@ -375,11 +360,14 @@ if [ $DO_CALC_INCREMENT = "YES" ]; then export OMP_NUM_THREADS=$NTHREADS_CALCINC if [ ${SUFFIX} = ".nc" ]; then - CALCINCEXEC=$CALCINCNCEXEC else CALCINCEXEC=$CALCINCNEMSEXEC fi + + export pgm=$CALCINCEXEC + . prep_step + $NCP $CALCINCEXEC $DATA rm calc_increment.nml diff --git a/scripts/exglobal_enkf_fcst_fv3gfs.sh.ecf b/scripts/exgdas_enkf_fcst.sh similarity index 93% rename from scripts/exglobal_enkf_fcst_fv3gfs.sh.ecf rename to scripts/exgdas_enkf_fcst.sh index 11b7a0a5b0..45da2d4e78 100755 --- a/scripts/exglobal_enkf_fcst_fv3gfs.sh.ecf +++ b/scripts/exgdas_enkf_fcst.sh @@ -2,7 +2,7 @@ ################################################################################ #### UNIX Script Documentation Block # . . -# Script name: exglobal_enkf_fcst_fv3gfs.sh.ecf +# Script name: exgdas_enkf_fcst.sh # Script description: Run ensemble forecasts # # Author: Rahul Mahajan Org: NCEP/EMC Date: 2017-03-02 @@ -27,15 +27,8 @@ fi # Directories. pwd=$(pwd) -export NWPROD=${NWPROD:-$pwd} -export HOMEgfs=${HOMEgfs:-$NWPROD} export FIX_DIR=${FIX_DIR:-$HOMEgfs/fix} export FIX_AM=${FIX_AM:-$FIX_DIR/fix_am} -export DATA=${DATA:-$pwd/enkf_fcst.$$} -export COMIN=${COMIN:-$pwd} -export COMOUT=${COMOUT:-$COMIN} - -GSUFFIX=${GSUFFIX:-$SUFFIX} # Utilities export NCP=${NCP:-"/bin/cp -p"} @@ -45,7 +38,7 @@ export ERRSCRIPT=${ERRSCRIPT:-'eval [[ $err = 0 ]]'} export NDATE=${NDATE:-/$NWPROD/util/exec/ndate} # Scripts. -FORECASTSH=${FORECASTSH:-$HOMEgfs/scripts/exglobal_fcst_nemsfv3gfs.sh.ecf} +FORECASTSH=${FORECASTSH:-$HOMEgfs/scripts/exglobal_forecast.sh} # Enemble group, begin and end ENSGRP=${ENSGRP:-1} @@ -74,6 +67,7 @@ export PREFIX_ATMINC=${PREFIX_ATMINC:-""} # Ops related stuff SENDECF=${SENDECF:-"NO"} SENDDBN=${SENDDBN:-"NO"} +GSUFFIX=${GSUFFIX:-$SUFFIX} ################################################################################ # Preprocessing @@ -196,7 +190,7 @@ for imem in $(seq $ENSBEG $ENSEND); do while [ $fhr -le $FHMAX ]; do FH3=$(printf %03i $fhr) if [ $(expr $fhr % 3) -eq 0 ]; then - $DBNROOT/bin/dbn_alert MODEL GFS_ENKF $job $COMOUT/$memchar/${CDUMP}.t${cyc}z.sfcf${FH3}.${GSUFFIX} + $DBNROOT/bin/dbn_alert MODEL GFS_ENKF $job $COMOUT/$memchar/${CDUMP}.t${cyc}z.sfcf${FH3}${GSUFFIX} fi fhr=$((fhr+FHOUT)) done @@ -204,14 +198,21 @@ for imem in $(seq $ENSBEG $ENSEND); do cd $DATATOP - $NCP $EFCSGRP log_old - rm log log_new + if [ -s $EFCSGRP ]; then + $NCP $EFCSGRP log_old + fi + [[ -f log ]] && rm log + [[ -f log_new ]] && rm log_new if [ $ra -ne 0 ]; then echo "MEMBER $cmem : FAIL" > log else echo "MEMBER $cmem : PASS" > log fi - cat log_old log > log_new + if [ -s log_old ] ; then + cat log_old log > log_new + else + cat log > log_new + fi $NCP log_new $EFCSGRP done @@ -221,7 +222,7 @@ done cd $DATATOP echo "Status of ensemble members in group $ENSGRP:" cat $EFCSGRP -rm ${EFCSGRP}.fail +[[ -f ${EFCSGRP}.fail ]] && rm ${EFCSGRP}.fail ################################################################################ # If any members failed, error out diff --git a/scripts/exglobal_enkf_post_fv3gfs.sh.ecf b/scripts/exgdas_enkf_post.sh similarity index 87% rename from scripts/exglobal_enkf_post_fv3gfs.sh.ecf rename to scripts/exgdas_enkf_post.sh index b46f46ff82..32e709dc2f 100755 --- a/scripts/exglobal_enkf_post_fv3gfs.sh.ecf +++ b/scripts/exgdas_enkf_post.sh @@ -2,7 +2,7 @@ ################################################################################ #### UNIX Script Documentation Block # . . -# Script name: exglobal_enkf_post_fv3gfs.sh.ecf +# Script name: exgdas_enkf_post.sh # Script description: Global ensemble forecast post processing # # Author: Rahul Mahajan Org: NCEP/EMC Date: 2017-03-02 @@ -26,12 +26,6 @@ fi # Directories. pwd=$(pwd) -NWPROD=${NWPROD:-$pwd} -HOMEgsi=${HOMEgsi:-$NWPROD} -FIXgsi=${FIXgsi:-$HOMEgsi/fix} -DATA=${DATA:-$pwd} -COMIN=${COMIN:-$pwd} -COMOUT=${COMOUT:-$COMIN} # Utilities ERRSCRIPT=${ERRSCRIPT:-'eval [[ $err = 0 ]]'} @@ -49,8 +43,8 @@ LEVS=${LEVS:-64} HYBENSMOOTH=${HYBENSMOOTH:-$FIXgsi/global_hybens_smoothinfo.l${LEVS}.txt} # Executables. -GETATMENSMEANEXEC=${GETATMENSMEANEXEC:-$HOMEgsi/exec/getsigensmeanp_smooth.x} -GETSFCENSMEANEXEC=${GETSFCENSMEANEXEC:-$HOMEgsi/exec/getsfcensmeanp.x} +GETATMENSMEANEXEC=${GETATMENSMEANEXEC:-$HOMEgfs/exec/getsigensmeanp_smooth.x} +GETSFCENSMEANEXEC=${GETSFCENSMEANEXEC:-$HOMEgfs/exec/getsfcensmeanp.x} # Other variables. PREFIX=${PREFIX:-""} @@ -109,15 +103,22 @@ done ################################################################################ # Generate ensemble mean surface and atmospheric files -rm ./hybens_smoothinfo [[ $SMOOTH_ENKF = "YES" ]] && $NCP $HYBENSMOOTH ./hybens_smoothinfo rc=0 for fhr in $(seq $FHMIN $FHOUT $FHMAX); do fhrchar=$(printf %03i $fhr) + + export pgm=$GETSFCENSMEANEXEC + . prep_step + $APRUN_EPOS ${DATA}/$(basename $GETSFCENSMEANEXEC) ./ sfcf${fhrchar}.ensmean sfcf${fhrchar} $NMEM_ENKF ra=$? ((rc+=ra)) + + export_pgm=$GETATMENSMEANEXEC + . prep_step + if [ $ENKF_SPREAD = "YES" ]; then $APRUN_EPOS ${DATA}/$(basename $GETATMENSMEANEXEC) ./ atmf${fhrchar}.ensmean atmf${fhrchar} $NMEM_ENKF atmf${fhrchar}.ensspread else @@ -159,15 +160,6 @@ if [ $SENDDBN = "YES" ]; then fi done -# Maintain gfs.v14 dbn_alerts of 6 and 9 hour EnKF forecasts - if [ $FHMIN -eq 6 -o $FHMIN -eq 9 ]; then - fhrchar=$(printf %03i $FHMIN) - for imem in $(seq 1 $NMEM_ENKF); do - memchar="mem"$(printf %03i $imem) - $DBNROOT/bin/dbn_alert MODEL GFS_ENKF $job $COMOUT/$memchar/${PREFIX}atmf${fhrchar}${ENKF_SUFFIX}${SUFFIX} - done - fi - fi ################################################################################ diff --git a/scripts/exglobal_innovate_obs_fv3gfs.sh.ecf b/scripts/exgdas_enkf_select_obs.sh similarity index 92% rename from scripts/exglobal_innovate_obs_fv3gfs.sh.ecf rename to scripts/exgdas_enkf_select_obs.sh index e7e888c38e..5298398e4f 100755 --- a/scripts/exglobal_innovate_obs_fv3gfs.sh.ecf +++ b/scripts/exgdas_enkf_select_obs.sh @@ -2,7 +2,7 @@ ################################################################################ #### UNIX Script Documentation Block # . . -# Script name: exglobal_innovate_obs_fv3gfs.sh.ecf +# Script name: exgdas_enkf_select_obs.sh # Script description: Compute global_gsi innovations # # Author: Rahul Mahajan Org: NCEP/EMC Date: 2017-03-02 @@ -26,19 +26,13 @@ fi # Directories. pwd=$(pwd) -export NWPROD=${NWPROD:-$pwd} -export HOMEgsi=${HOMEgsi:-$NWPROD} -export DATA=${DATA:-$pwd/innovate_obs.$$} -export COMIN=${COMIN:-$pwd} -export COMIN_GES=${COMIN_GES:-$COMIN} -export COMOUT=${COMOUT:-$COMIN} # Utilities export NLN=${NLN:-"/bin/ln -sf"} export ERRSCRIPT=${ERRSCRIPT:-'eval [[ $err = 0 ]]'} # Scripts. -ANALYSISSH=${ANALYSISSH:-$HOMEgsi/scripts/exglobal_analysis_fv3gfs.sh.ecf} +ANALYSISSH=${ANALYSISSH:-$HOMEgfs/scripts/exglobal_atmos_analysis.sh} # Prefix and Suffix Variables. export APREFIX=${APREFIX:-""} diff --git a/scripts/exglobal_enkf_surface_fv3gfs.sh.ecf b/scripts/exgdas_enkf_sfc.sh similarity index 93% rename from scripts/exglobal_enkf_surface_fv3gfs.sh.ecf rename to scripts/exgdas_enkf_sfc.sh index f4dd0a1e19..f5ff74a824 100755 --- a/scripts/exglobal_enkf_surface_fv3gfs.sh.ecf +++ b/scripts/exgdas_enkf_sfc.sh @@ -2,7 +2,7 @@ ################################################################################ #### UNIX Script Documentation Block # . . -# Script name: exglobal_enkf_surface_fv3gfs.sh.ecf +# Script name: exgdas_enkf_sfc.sh # Script description: generate ensemble surface analyses on tiles # # Author: Rahul Mahajan Org: NCEP/EMC Date: 2017-03-02 @@ -26,23 +26,11 @@ fi # Directories. pwd=$(pwd) -export NWPROD=${NWPROD:-$pwd} -export HOMEgfs=${HOMEgfs:-$NWPROD} -HOMEgsi=${HOMEgsi:-$NWPROD} -export DATA=${DATA:-$pwd} -COMIN=${COMIN:-$pwd} -COMIN_ENS=${COMIN_ENS:-$COMIN} -COMIN_OBS=${COMIN_OBS:-$COMIN} -COMIN_GES=${COMIN_GES:-$COMIN} -COMIN_GES_ENS=${COMIN_GES_ENS:-$COMIN_ENS} -COMIN_GES_OBS=${COMIN_GES_OBS:-$COMIN_GES} -COMOUT=${COMOUT:-$COMIN} -COMOUT_ENS=${COMOUT_ENS:-$COMIN_ENS} +# Base variables CDATE=${CDATE:-"2010010100"} DONST=${DONST:-"NO"} DOSFCANL_ENKF=${DOSFCANL_ENKF:-"YES"} - export CASE=${CASE:-384} ntiles=${ntiles:-6} diff --git a/scripts/exglobal_enkf_update_fv3gfs.sh.ecf b/scripts/exgdas_enkf_update.sh similarity index 94% rename from scripts/exglobal_enkf_update_fv3gfs.sh.ecf rename to scripts/exgdas_enkf_update.sh index 24d273813f..6e8186a55a 100755 --- a/scripts/exglobal_enkf_update_fv3gfs.sh.ecf +++ b/scripts/exgdas_enkf_update.sh @@ -2,7 +2,7 @@ ################################################################################ #### UNIX Script Documentation Block # . . -# Script name: exglobal_enkf_update_fv3gfs.sh.ecf +# Script name: exgdas_enkf_update.sh # Script description: Make global_enkf update # # Author: Rahul Mahajan Org: NCEP/EMC Date: 2017-03-02 @@ -26,14 +26,6 @@ fi # Directories. pwd=$(pwd) -NWPROD=${NWPROD:-$pwd} -HOMEgsi=${HOMEgsi:-$NWPROD} -FIXgsi=${FIXgsi:-$HOMEgsi/fix} -DATA=${DATA:-$pwd/enkf_update.$$} -COMIN=${COMIN:-$pwd} -COMIN_GES_ENS=${COMIN_GES_ENS:-$COMIN} -COMOUT=${COMOUT:-$COMIN} -COMOUT_ANL_ENS=${COMOUT_ANL_ENS:-$COMOUT} # Utilities NCP=${NCP:-"/bin/cp -p"} @@ -42,12 +34,17 @@ ERRSCRIPT=${ERRSCRIPT:-'eval [[ $err = 0 ]]'} NEMSIOGET=${NEMSIOGET:-$NWPROD/utils/exec/nemsio_get} NCLEN=${NCLEN:-$HOMEgfs/ush/getncdimlen} USE_CFP=${USE_CFP:-"NO"} +CFP_MP=${CFP_MP:-"NO"} +nm="" +if [ $CFP_MP = "YES" ]; then + nm=0 +fi APRUNCFP=${APRUNCFP:-""} APRUN_ENKF=${APRUN_ENKF:-${APRUN:-""}} NTHREADS_ENKF=${NTHREADS_ENKF:-${NTHREADS:-1}} # Executables -ENKFEXEC=${ENKFEXEC:-$HOMEgsi/exec/global_enkf.x} +ENKFEXEC=${ENKFEXEC:-$HOMEgfs/exec/global_enkf.x} # Cycling and forecast hour specific parameters CDATE=${CDATE:-"2001010100"} @@ -143,13 +140,6 @@ if [ ! -d $DATA ]; then fi cd $DATA || exit 99 -################################################################################ -# Clean up the run directory -rm convinfo satinfo ozinfo hybens_info anavinfo -rm satbias_angle satbias_in -rm enkf.nml -rm sanl* - ################################################################################ # Fixed files $NLN $SATANGL satbias_angle @@ -167,7 +157,8 @@ $NLN $COMOUT_ANL_ENS/$GBIASe satbias_in ################################################################################ if [ $USE_CFP = "YES" ]; then - rm $DATA/untar.sh $DATA/mp_untar.sh + [[ -f $DATA/untar.sh ]] && rm $DATA/untar.sh + [[ -f $DATA/mp_untar.sh ]] && rm $DATA/mp_untar.sh set +x cat > $DATA/untar.sh << EOFuntar #!/bin/sh @@ -191,7 +182,10 @@ fi flist="$CNVSTAT $OZNSTAT $RADSTAT" if [ $USE_CFP = "YES" ]; then - echo "$DATA/untar.sh ensmean" | tee -a $DATA/mp_untar.sh + echo "$nm $DATA/untar.sh ensmean" | tee -a $DATA/mp_untar.sh + if [ ${CFP_MP:-"NO"} = "YES" ]; then + nm=$((nm+1)) + fi else for ftype in $flist; do fname=$COMOUT_ANL_ENS/${ftype}.ensmean @@ -203,7 +197,10 @@ for imem in $(seq 1 $NMEM_ENKF); do memchar="mem"$(printf %03i $imem) if [ $lobsdiag_forenkf = ".false." ]; then if [ $USE_CFP = "YES" ]; then - echo "$DATA/untar.sh $memchar" | tee -a $DATA/mp_untar.sh + echo "$nm $DATA/untar.sh $memchar" | tee -a $DATA/mp_untar.sh + if [ ${CFP_MP:-"NO"} = "YES" ]; then + nm=$((nm+1)) + fi else for ftype in $flist; do fname=$COMOUT_ANL_ENS/$memchar/$ftype @@ -248,10 +245,9 @@ if [ $USE_CFP = "YES" ]; then ncmd_max=$((ncmd < npe_node_max ? ncmd : npe_node_max)) APRUNCFP=$(eval echo $APRUNCFP) $APRUNCFP $DATA/mp_untar.sh - rc=$? - export ERR=$rc + export ERR=$? export err=$ERR - $ERRSCRIPT || exit 2 + $ERRSCRIPT || exit 3 fi fi @@ -375,13 +371,13 @@ EOFnml ################################################################################ # Run enkf update -export OMP_NUM_THREADS=$NTHREADS_ENKF -PGM=$DATA/enkf.x -$NCP $ENKFEXEC $PGM +export OMP_NUM_THREADS=$NTHREADS_ENKF +export pgm=$ENKFEXEC +. prep_step -# Execute EnKF using same number of mpi tasks on all nodes -$APRUN_ENKF $PGM 1>stdout 2>stderr +$NCP $ENKFEXEC $DATA +$APRUN_ENKF ${DATA}/$(basename $ENKFEXEC) 1>stdout 2>stderr rc=$? export ERR=$rc diff --git a/scripts/exglobal_analysis.sh.ecf b/scripts/exglobal_analysis.sh.ecf deleted file mode 100755 index 97566ebbce..0000000000 --- a/scripts/exglobal_analysis.sh.ecf +++ /dev/null @@ -1,1700 +0,0 @@ -#!/bin/ksh -################################################################################ -#### UNIX Script Documentation Block -# . . -# Script name: global_analysis.sh -# Script description: Makes a global spectral model analysis -# -# Author: Mark Iredell Org: NP23 Date: 1999-07-15 -# -# Abstract: This script makes a global spectral model analysis. -# Both the surface analysis and the upper-air analysis are performed. -# -# Script history log: -# 1999-05-01 Mark Iredell -# 2002-04-26 Russ Treadon add global_angupdate processing -# 2003-08-05 Russ Treadon add processing of hourly sigma and surface guess -# 2004-03-26 Russ Treadon remove reference to IEEE TOVS-1b files, fix sfcg bug -# 2005-01-03 Cheng-Hsuan Lu :set FSMCL(2:4) = FSMCL2 -# add FNVMNC,FNVMXC,FNSLPC,FNABSC -# 2005-07-22 Russ Treadon add processing of NOAA-18 hirs4, amsua, and mhs data -# 2006-11-29 Russ Treadon update for global_gsi -# 2007-10-18 Russ Treadon add new options (not activated) to GSI namelist; -# update CRTM related pieces for use with CRTM_GFS -# (revision 799); modify SBUVBF variable and -# sbuvbufr OBS_INPUT "dsis" variable to process -# version 8 (sbuv8_*) sbuv/2 ozone data. -# 2007-10-18 Diane Stokes clean up processing of diagnostic files -# 2008-04-04 Russ Treadon remove global_chgres -# 2008-09-29 Russ Treadon add IASI, update to crtm_gfsgsi (rev1855), -# turn on varqc and bkgv_flowdep, tsfc_sdv=3 -# 2009-02-05 Russ Treadon add unique thread / stack variables for GSIEXEC -# and ANGUPDATEXEC; add OMIBF, TCVITL; add dsfcalc -# 2009-03-19 Russ Treadon add JCAP_A,NLAT_A,NLON_A,JCAP_B -# 2010-04-28 Russ Treadon remove global_angupdate -# 2010-05-05 George Gayno add ANAVINFO file -# 2011-05-10 EMC/SPA update RTMFIX defaults to ${FIXGLOBAL}/crtm_2.0.2, instead of crtm_gfsgsi -# 2012-01-16 Treadon add hooks for hybrid ensemble -# 2012-02-14 S. Moorthi Edited for Zeus and Gaea -# 2013-10-31 R. Todling Revisit OBS_INPUT (add table) -# 2014-03-13 X. Li Add NSST -# 2016-05-01 Yanqiu Zhu Add RADCLOUDINFO and use satinfo with icloud & iaerosol -# 2016-05-10 J. Jung Added RARS and direct broadcast data -# 2016-08-28 X. Li Introduce USE_READIN_ANL_SFCMASK for surface mask consistency between analysis and ensemble grids -# 2018-10-24 Karina Apodaca add processing of GOES-GLM light -# -# Usage: global_analysis.sh SFCGES SIGGES NSTGES GBIAS GBIASPC GRADSTAT GBIASAIR -# SFCANL SIGANL NSTANL ABIAS ABIASPC ABIASAIR IGEN -# -# Input script positional parameters: -# 1 Input surface guess -# defaults to $SFCGES; required -# 2 Input sigma guess -# defaults to $SIGGES; required -# 3 Input NSST guess -# defaults to $NSTGES; required -# 4 Input guess time dependent bias correction coefficients -# defaults to $GBIAS; required -# 5 Input guess radiance bias correction pre-conditioning -# defaults to $GBIASPC; required -# 6 Input guess radiance diagnostic file -# defaults to $GRADSTAT; required -# 7 Input guess aircraft bias correction coefficients -# defaults to $GBIASAIR; required -# 8 Output surface analysis -# defaults to $SFCANL, then to ${COMOUT}/sfcanl -# 9 Output sigma analysis -# defaults to $SIGANL, then to ${COMOUT}/siganl -# 10 Output NSST analysis -# defaults to $NSTANL, then to ${COMOUT}/nstanl -# 11 Output bias correction -# defaults to $ABIAS, then to ${COMOUT}/abias -# 12 Output bias correction pre-conditioning -# defaults to $ABIASPC, then to ${COMOUT}/abias_pc -# 13 Output aircraft bias correction coefficients -# defaults to $ABIASAIR, then to ${COMOUT}/abias_air -# 14 Output generating code -# defaults to $IGEN, then to 0 -# -# Imported Shell Variables: -# SFCGES Input surface guess -# overridden by $1; required -# SIGGES Input sigma guess -# overridden by $2; required -# GBIAS Input guess bias correction -# overridden by $3; required -# GBIASPC Input guess radiance bias correction pre-conditioning -# overridden by $4; required -# GRADSTAT Input guess angle dependent bias correction -# overridden by $5; required -# GBIASAIR Input guess aircraft bias correction -# overridden by $6; required -# SFCANL Output surface analysis -# overridden by $7; defaults to ${COMOUT}/sfcanl -# SIGANL Output sigma analysis -# overridden by $8; defaults to ${COMOUT}/siganl -# ABIAS Output bias correction -# overridden by $9; defaults to ${COMOUT}/abias -# ABIASPC Output bias correction pre-conditioning -# overridden by $10; defaults to ${COMOUT}/abias_pc -# ABIASAIR Output aircraft bias correction -# overridden by $11; defaults to ${COMOUT}/abias_air -# NSTGES Input NSST guess -# overridden by $10; required -# NSTANL Output NSST analysis -# overridden by $11; defaults to ${COMOUT}/nstanl -# IGEN Output generating code -# overridden by $12; defaults to 0 -# SFCG03 Surface guess valid at -03 hour -# defaults to ${COMOUT}/sfcf03; optional input -# SFCG04 Surface guess valid at -04 hour -# defaults to ${COMOUT}/sfcf04; optional input -# SFCG05 Surface guess valid at -05 hour -# defaults to ${COMOUT}/sfcf05; optional input -# SFCG07 Surface guess valid at -07 hour -# defaults to ${COMOUT}/sfcf07; optional input -# SFCG08 Surface guess valid at -08 hour -# defaults to ${COMOUT}/sfcf08; optional input -# SFCG09 Surface guess valid at -09 hour -# defaults to ${COMOUT}/sfcf09; optional input -# NSTG03 NSST guess valid at -03 hour -# defaults to ${COMOUT}/nstf03; optional input -# NSTG04 NSST guess valid at -04 hour -# defaults to ${COMOUT}/nstf04; optional input -# NSTG05 NSST guess valid at -05 hour -# defaults to ${COMOUT}/nstf05; optional input -# NSTG07 NSST guess valid at -07 hour -# defaults to ${COMOUT}/nstf07; optional input -# NSTG08 NSST guess valid at -08 hour -# defaults to ${COMOUT}/nstf08; optional input -# NSTG09 NSST guess valid at -09 hour -# defaults to ${COMOUT}/nstf09; optional input -# SIGG03 Sigma guess valid at -03 hour -# defaults to ${COMOUT}/sigf03; optional input -# SIGG04 Sigma guess valid at -04 hour -# defaults to ${COMOUT}/sigf04; optional input -# SIGG05 Sigma guess valid at -05 hour -# defaults to ${COMOUT}/sigf05; optional input -# SIGG07 Sigma guess valid at -07 hour -# defaults to ${COMOUT}/sigf07; optional input -# SIGG08 Sigma guess valid at -08 hour -# defaults to ${COMOUT}/sigf08; optional input -# SIGG09 Sigma guess valid at -09 hour -# defaults to ${COMOUT}/sigf09; optional input -# SIGGESENS template for ensemble member sigma guess -# defaults to ${COMOUT}/sigf06_ens; optional input -# DOHYBVAR flag (YES or NO) for hybrid ensemble variational option -# defaults to NO -# NMEM_ENS number of ensemble members included in analysis -# defauls to 0 -# GINCIN Input increment to guess -# defaults to ${COMOUT}/gesfile_in; optional -# BIASIN Input bias correction to guess -# defaults to ${COMOUT}/biascor_in; optional -# USE_NEWRADBC Flag to use new radiance bias correction scheme (YES or NO) -# defaults to NO -# USE_RADSTAT Flag to use guess radstat file for bias correction -# initialization (YES or NO). defaults to NO -# RADSTAT Output radiance assimilation statistics -# defaults to ${COMIN}/${PREINP}radstat -# GSISTAT Output gsi (obs-ges), qc, and iteration statistics -# defaults to ${COMIN}/${PREINP}gsistat -# PCPSTAT Output precipitation assimilation statistics -# defaults to ${COMIN}/${PREINP}pcpstat -# CNVSTAT Output conventional observation assimilation statistics -# defaults to ${COMIN}/${PREINP}cnvstat -# OZNSTAT Output ozone observation assimilation statistics -# defaults to ${COMIN}/${PREINP}oznstat -# LIGSTAT Output lightning observation assimilation statistics -# defaults to ${COMIN}/${PREINP}ligstat -# GINCOUT Output increment to guess -# defaults to ${COMIN}/${PREINP}gesfile_out -# BIASOUT Output bias correction to guess -# defaults to ${COMIN}/${PREINP}biascor_out -# RUN_SELECT Flag to only select data (YES or NO) -# defaults to NO -# USE_SELECT Flag to use selected data (YES or NO) -# defaults to NO -# SELECT_OBS Tarball containing selected data -# defaults to ${COMIN}/${PREINP}obsinput -# DIAG_SUFFIX optional suffix for diagnostics files -# defaults to empty string -# DIAG_COMPRESS flag to compress (YES) diagnostics files -# defaults to YES -# DIAG_TARBALL flag to collect (YES) diagnostic files in tarballs -# defaults to YES -# FIXgsm Directory for global fixed files -# defaults to /nwprod/fix -# EXECgsm Directory for global executables -# defaults to /nwprod/exec -# USHgsm Directory for global ush scripts -# defaults to /nwprod/ush -# DATA working directory -# (if nonexistent will be made, used and deleted) -# defaults to current working directory -# COMIN input directory -# defaults to current working directory -# COMOUT output directory -# (if nonexistent will be made) -# defaults to current working directory -# XC Suffix to add to executables -# defaults to none -# PREINP Prefix to add to input observation files -# defaults to none -# SUFINP Suffix to add to input observation files -# defaults to none -# NCP Copy command -# defaults to cp -# SIGHDR Command to read sigma header -# defaults to ${EXECgsm}/global_sighdr$XC -# SFCHDR Command to read surface header -# defaults to ${EXECgsm}/global_sfchdr$XC -# CYCLEXEC Surface cycle executable -# defaults to ${EXECgsm}/global_cycle$XC -# GSIEXEC Spectral analysis executable -# defaults to ${EXECgsm}/global_gsi$XC -# CYCLESH Surface cycle script -# defaults to ${USHgsm}/global_cycle.sh -# BERROR Input background error file -# defaults to ${FIXgsm}/global_berror.l${LEVS}y${NLAT_A}.sig.f77 -# SATANGL Input satellite angle bias file -# defaults to ${FIXgsm}/global_satangbias.txt -# SATINFO Input satellite information file -# defaults to ${FIXgsm}/global_satinfo.txt -# RADCLOUDINFO Input cloud-related usage for satellite intrument -# defaults to ${FIXgsm}/cloudy_radiance_info.txt -# ATMSFILTER Path to file describing how ATMS is spatially filtered -# defaults to ${FIXgsm}/atms_beamwidth.txt -# RTMFIX Input directory containing CRTM coefficients -# defaults to ${FIXgsm}/crtm_v2.2.3 -# ANAVINFO Input analysis variable file -# defaults to ${FIXgsm}/global_anavinfo.l${LEVS}.txt -# CONVINFO Input conventional observation information file -# defaults to ${FIXgsm}/global_convinfo.txt -# INSITUINFO Input nsst insitu information file -# defaults to ${FIXgsm}/global_insituinfo.txt -# OZINFO Input ozone information file -# defaults to ${FIXgsm}/global_ozone.txt -# PCPINFO Input precipitation information file -# defaults to ${FIXgsm}/global_pcpinfo.txt -# AEROINFO Input aerosol information file -# defaults to ${FIXgsm}/global_aeroinfo.txt -# SCANINFO Input satellite scan information file -# defaults to ${FIXgsm}/global_scaninfo.txt -# HYBENSINFO Input hybrid ensemble localization information file -# defaults to ${FIXgsm}/global_hybens_locinfo.l${LEVS}.txt -# LIGHTINFO Input lightning information file -# defaults to ${FIXgsm}/global_lightinfo.txt -# PREPQC Input QC-ed observation BUFR file -# defaults to ${COMIN}/${PREINP}prepbufr${SUFINP} -# PREPQCPF Input QC-ed observation profile BUFR file -# defaults to ${COMIN}/${PREINP}prepbufr.acft_profiles${SUFINP} -# SATWND Input satellite wind file (bufr format) -# defaults to ${COMIN}/${PREINP}satwnd.tm00.bufr_d${SUFINP} -# OSCATBF Input OSCAT wind file (bufr format) -# defaults to ${COMIN}/${PREINP}oscatw.tm00.bufr_d${SUFINP} -# RAPIDSCATBF Input RAPIDSCAT wind file (bufr format) -# defaults to ${COMIN}/${PREINP}rapidscatw.tm00.bufr_d${SUFINP} -# GSNDBF Input GOES sounder radiance file (bufr format) -# defaults to ${COMIN}/${PREINP}goesnd.tm00.bufr_d${SUFINP} -# GSNDBF1 Input GOES 1x1 sounder radiance file (bufr format) -# defaults to ${COMIN}/${PREINP}goesfv.tm00.bufr_d${SUFINP} -# GLMBF Input GOES-16/GLM lightning flash rate file -# defaults to ${COMIN}/${PREINP}glm.tm00.bufr_d${SUFINP} -# B1HRS2 Input HIRS/2 radiance file (bufr format) -# defaults to ${COMIN}/${PREINP}1bhrs2.tm00.bufr_d${SUFINP} -# B1MSU Input MSU radiance file (bufr format) -# defaults to ${COMIN}/${PREINP}1bmsu.tm00.bufr_d${SUFINP} -# B1HRS3 Input HIRS/3 radiance file (bufr format) -# defaults to ${COMIN}/${PREINP}1bhrs3.tm00.bufr_d${SUFINP} -# B1HRS4 Input HIRS/4 radiance file (bufr format) -# defaults to ${COMIN}/${PREINP}1bhrs4.tm00.bufr_d${SUFINP} -# B1AMUA Input AMSU/A radiance file (bufr format) -# defaults to ${COMIN}/${PREINP}1bamua.tm00.bufr_d${SUFINP} -# B1AMUB Input AMSU/B radiance file (bufr format) -# defaults to ${COMIN}/${PREINP}1bamub.tm00.bufr_d${SUFINP} -# B1MHS Input MHS radiance file (bufr format) -# defaults to ${COMIN}/${PREINP}1bmhs.tm00.bufr_d${SUFINP} -# ESHRS3 Input EARS HIRS/3 radiance file (bufr format) -# defaults to ${COMIN}/${PREINP}eshrs3.tm00.bufr_d${SUFINP} -# ESAMUA Input EARS AMSU/A radiance file (bufr format) -# defaults to ${COMIN}/${PREINP}esamua.tm00.bufr_d${SUFINP} -# ESAMUB Input EARS AMSU/B radiance file (bufr format) -# defaults to ${COMIN}/${PREINP}esamub.tm00.bufr_d${SUFINP} -# HRS3DB Input direct broadcast HIRS/3 radiance file (bufr format) -# defaults to ${COMIN}/${PREINP}hrs3db.tm00.bufr_d${SUFINP} -# AMUADB Input direct broadcast AMSU/A radiance file (bufr format) -# defaults to ${COMIN}/${PREINP}amuadb.tm00.bufr_d${SUFINP} -# AMUBDB Input direct broadcast AMSU/B radiance file (bufr format) -# defaults to ${COMIN}/${PREINP}amubdb.tm00.bufr_d${SUFINP} -# AIRSBF Input AIRS radiace file (bufr format) -# defaults to ${COMIN}/${PREINP}airs.tm00.bufr_d${SUFINP} -# IASIBF Input IASI radiace file (bufr format) -# defaults to ${COMIN}/${PREINP}mtiasi.tm00.bufr_d${SUFINP} -# ESIASI Input EARS/RARS IASI radiace file (bufr format) -# defaults to ${COMIN}/${PREINP}esiasi.tm00.bufr_d${SUFINP} -# IASIDB Input direct broadcast IASI radiace file (bufr format) -# defaults to ${COMIN}/${PREINP}iasidb.tm00.bufr_d${SUFINP} -# AMSREBF Input AMSRE radiace file (bufr format) -# defaults to ${COMIN}/${PREINP}amsre.tm00.bufr_d${SUFINP} -# SEVIRIBF Input SEVIRI radiace file (bufr format) -# defaults to ${COMIN}/${PREINP}sevcsr.tm00.bufr_d${SUFINP} -# AHIBF Input AHI radiace file (bufr format) -# defaults to ${COMIN}/${PREINP}ahi.tm00.bufr_d${SUFINP} -# CRISBF Input CRIS radiance file (bufr format) -# defaults to ${COMIN}/${PREINP}cris.tm00.bufr_d${SUFINP} -# ESCRIS Input EARS/RARS CRIS radiance file (bufr format) -# defaults to ${COMIN}/${PREINP}escris.tm00.bufr_d${SUFINP} -# CRISDB Input direct broadcast CRIS radiance file (bufr format) -# defaults to ${COMIN}/${PREINP}crisdb.tm00.bufr_d${SUFINP} -# CRISFSBF Input CRIS radiance file (bufr format) -# defaults to ${COMIN}/${PREINP}crisf4.tm00.bufr_d${SUFINP} -# ESCRISFS Input EARS/RARS CRIS-FSR radiance file (bufr format) -# defaults to ${COMIN}/${PREINP}escrisf4.tm00.bufr_d${SUFINP} -# CRISFSDB Input direct broadcast CRIS-FSR radiance file (bufr format) -# defaults to ${COMIN}/${PREINP}crisf4db.tm00.bufr_d${SUFINP} -# ATMSBF Input ATMS radiance file (bufr format) -# defaults to ${COMIN}/${PREINP}atms.tm00.bufr_d${SUFINP} -# ESATMS Input EARS/RARS ATMS radiance file (bufr format) -# defaults to ${COMIN}/${PREINP}esatms.tm00.bufr_d${SUFINP} -# ATMSDB Input direct broadcast ATMS radiance file (bufr format) -# defaults to ${COMIN}/${PREINP}atmsdb.tm00.bufr_d${SUFINP} -# SAPHIRBF Input SAPHIR radiance file (bufr format) -# defaults to ${COMIN}/${PREINP}saphir.tm00.bufr_d${SUFINP} -# AMSR2BF Input AMSR2 L1B brightness temperature files -# defaults to ${COMIN}/${PREINP}amsr2.tm00.bufr_d${SUFINP} -# GMI1CRBF Input GMI L1CR brightness temperature files -# defaults to ${COMIN}/${PREINP}gmi1cr.tm00.bufr_d${SUFINP} -# SSMITBF Input SSMI radiace file (bufr format) -# defaults to ${COMIN}/${PREINP}ssmit.tm00.bufr_d${SUFINP} -# SSMISBF Input SSMIS radiace file (bufr format) -# defaults to ${COMIN}/${PREINP}ssmisu.tm00.bufr_d${SUFINP} -# SBUVBF Input NOAA POES SBUV ozone retrieval file -# defaults to ${COMIN}/${PREINP}osbuv8.tm00.bufr_d${SUFINP} -# GOMEBF Input GOME ozone retrieval file -# defaults to ${COMIN}/${PREINP}gome.tm00.bufr_d${SUFINP} -# OMIBF Input OMI ozone retrieval file -# defaults to ${COMIN}/${PREINP}omi.tm00.bufr_d${SUFINP} -# MLSBF Input MLS ozone retrieval file -# defaults to ${COMIN}/${PREINP}mls.tm00.bufr_d${SUFINP} -# SMIPCP Input SSM/I precipitation rate file -# defaults to ${COMIN}/${PREINP}spssmip.tm00.bufr_d${SUFINP} -# TMIPCP Input TMI precipitation rate file -# defaults to ${COMIN}/${PREINP}sptrmm.tm00.bufr_d${SUFINP} -# GPSROBF Input GPS radio occultation data -# defaults to ${COMIN}/${PREINP}gpsro.tm00.bufr_d${SUFINP} -# TCVITL Input tcvitals file -# defaults to ${COMIN}/${PREINP}syndata.tcvitals.tm00 -# NSSTBF Input in situ sea temperature file -# defaults to ${COMIN}/${PREINP}nsstbufr.tm00.bufr_d${SUFINP} -# B1AVHAM Input AVHRR GAC (AM) file -# defaults to ${COMIN}/${PREINP}avcsam.tm00.bufr_d${SUFINP} -# B1AVHPM Input AVHRR GAC (PM) file -# defaults to ${COMIN}/${PREINP}avcspm.tm00.bufr_d${SUFINP} -# INISCRIPT Preprocessing script -# defaults to none -# LOGSCRIPT Log posting script -# defaults to none -# ERRSCRIPT Error processing script -# defaults to 'eval [[ $err = 0 ]]' -# ENDSCRIPT Postprocessing script -# defaults to none -# JCAP_A Spectral truncation for analysis -# defaults to the value in the input sigma file header -# JCAP Spectral truncation for background -# defaults to the value in the input sigma file header -# LEVS Number of levels -# DELTIM Timestep in seconds -# defaults to 3600/($JCAP_A/20) -# CDATE Current analysis date in yyyymmddhh format -# defaults to the value in the input surface file header -# LATB Number of latitudes in surface cycling -# defaults to the value in the input surface file header -# LONB Number of longitudes in surface cycling -# defaults to the value in the input surface file header -# LSOIL Number of soil layers -# defaults to 2 -# FSMCL2 Scale in days to relax to soil moisture climatology -# defaults to 60 -# DELTSFC Cycling frequency in hours -# defaults to forecast hour of $SFCGES -# LATA Number of latitudes in spectral analysis -# defaults to $LATB -# LONA Number of longitudes in spectral analysis -# defaults to $LONB -# NSIG1 Number of levels per MPI task -# (Important: number of MPI tasks must be 5*$LEVS/$NSIG1+2) -# defaults to 1 -# CYCLVARS Other namelist inputs to the cycle executable -# defaults to none set -# GSIVARS Other namelist inputs to the analysis executable -# defaults to none set -# SATVARS Other namelist input to analysis data usage namelist -# defaults to none set -# NTHREADS Number of threads -# defaults to 1 -# NTHSTACK Size of stack per thread -# defaults to 1024000000 -# NTHREADS_GSI Number of threads for GSIEXEC -# defaults to 1 -# NTHSTACK_GSI Size of stack per thread for GSIEXEC -# defaults to 1024000000 -# FILESTYLE File management style flag -# ('C' to copy to/from $DATA, 'L' for symbolic links in $DATA, -# 'X' to use XLFUNIT or symbolic links where appropriate) -# defaults to 'X' -# PGMOUT Executable standard output -# defaults to $pgmout, then to '&1' -# PGMERR Executable standard error -# defaults to $pgmerr, then to '&1' -# pgmout Executable standard output default -# pgmerr Executable standard error default -# REDOUT standard output redirect ('1>' or '1>>') -# defaults to '1>', or to '1>>' to append if $PGMOUT is a file -# REDERR standard error redirect ('2>' or '2>>') -# defaults to '2>', or to '2>>' to append if $PGMERR is a file -# VERBOSE Verbose flag (YES or NO) -# defaults to NO -# lrun_subdirs logical to toggle use of subdirectories at runtime for -# pe-specific files -# defaults to .true. -# l4densvar logical to toggle 4D-EnsVar option -# defaults to .false. -# lwrite4danl logical to toggle write 4D analysis files -# defaults to .false. -# -# Exported Shell Variables: -# PGM Current program name -# pgm -# ERR Last return code -# err -# -# Modules and files referenced: -# scripts : $INISCRIPT -# $LOGSCRIPT -# $ERRSCRIPT -# $ENDSCRIPT -# -# programs : $CYCLEXEC -# $GSIEXEC -# -# fixed data : $BERROR -# $SATANGL -# $SATINFO -# $RADCLOUDINFO -# $ATMSFILTER -# $RTMFIX -# $ANAVINFO -# $CONVINFO -# $INSITUINFO -# $OZINFO -# $PCPINFO -# $AEROINFO -# $SCANINFO -# $HYBENSINFO -# -# input data : $SFCGES -# $SIGGES -# $GBIAS -# $GBIASPC -# $GRADSTAT -# $GBIASAIR -# $SFCG03 -# $SFCG04 -# $SFCG05 -# $SFCG07 -# $SFCG08 -# $SFCG09 -# $NSTG03 -# $NSTG04 -# $NSTG05 -# $NSTG07 -# $NSTG08 -# $NSTG09 -# $SIGG03 -# $SIGG04 -# $SIGG05 -# $SIGG07 -# $SIGG08 -# $SIGG09 -# $GINCIN -# $BIASIN -# $FNTSFA -# $FNACNA -# $FNSNOA -# $PREPQC -# $PREPQCPF -# $SATWND -# $OSCATBF -# $GSNDBF -# $GSNDBF1 -# $B1HRS2 -# $B1MSU -# $B1HRS3 -# $B1HRS4 -# $B1AMUA -# $B1AMUB -# $B1MHS -# $ESHRS3 -# $ESAMUA -# $ESAMUB -# $AIRSBF -# $IASIBF -# $AMSREBF -# $SEVIRIBF -# $CRISBF -# $ATMSBF -# $SSMITBF -# $SSMISBF -# $SBUVBF -# $GOMEBF -# $OMIBF -# $MLSBF -# $SMIPCP -# $TMIPCP -# $GPSROBF -# $G16GLMBF -# $TCVITL -# $NSSTBF -# $B1AVHAM -# $B1AVHPM -# -# output data: $SFCANL -# $NSTANL -# $SIGANL -# $ABIAS -# $ABIASPC -# $ABIASAIR -# $RADSTAT -# $GSISTAT -# $PCPSTAT -# $CNVSTAT -# $OZNSTAT -# $LIGSTAT -# $GINCOUT -# $BIASOUT -# $PGMOUT -# $PGMERR -# -# Remarks: -# -# Condition codes -# 0 - no problem encountered -# >0 - some problem encountered -# -# Control variable resolution priority -# 1 Command line argument. -# 2 Environment variable. -# 3 Inline default. -# -# Attributes: -# Language: POSIX shell -# Machine: IBM SP / Zeus / Gaea -# -################################################################################ -# Set environment. -export VERBOSE=${VERBOSE:-"NO"} -if [[ "$VERBOSE" = "YES" ]] -then - echo $(date) EXECUTING $0 $* >&2 - set -x -fi -export machine=${machine:-IBMP6} -export machine=$(echo $machine|tr '[a-z]' '[A-Z]') - -# Command line arguments. -export SFCGES=${1:-${SFCGES:?}} -export SIGGES=${2:-${SIGGES:?}} -export NSTGES=${3:-${NSTGES:?}} -export GBIAS=${4:-${GBIAS:?}} -export GBIASPC=${5:-${GBIASPC:?}} -export GRADSTAT=${6:-${GRADSTAT:?}} -export GBIASAIR=${7:-${GBIASAIR:?}} -export SFCANL=${8:-${SFCANL}} -export SIGANL=${9:-${SIGANL}} -export NSTANL=${10:-${NSTANL:?}} -export ABIAS=${11:-${ABIAS}} -export ABIASPC=${12:-${ABIASPC}} -export ABIASAIR=${13:-${ABIASAIR}} -export IGEN=${14:-${IGEN:-0}} -export ABIASe=${15:-${ABIASe:-satbias_int.out}} -# Directories. -export HOMEDIR=${HOMEDIR:-$NWROOT} -export NWPROD=${NWPROD:-$HOMEDIR} -export FIXSUBDA=${FIXSUBDA:-fix/fix_am} -export FIXgsm=${FIXgsm:-$NWPROD/global_shared.${global_shared_ver}/fix/fix_am} -export EXECgsm=${EXECgsm:-$NWPROD/global_shared.${global_shared_ver}/exec} -export USHgsm=${USHgsm:-$NWPROD/global_shared.${global_shared_ver}/ush} -export FIXgsi=${FIXgsi:-$NWPROD/global_shared.${global_shared_ver}/fix} -export EXECgsi=${EXECgsi:-$NWPROD/global_shared.${global_shared_ver}/exec} -export DATA=${DATA:-$(pwd)} -export COMIN=${COMIN:-$(pwd)} -export COMOUT=${COMOUT:-$(pwd)} -# Set script / GSI control parameters -NST_GSI=${NST_GSI:-0} -NSTINFO=${NSTINFO:-0} -ZSEA1=${ZSEA1:-0} -ZSEA2=${ZSEA2:-0} -FAC_DTL=${FAC_DTL:-0} -FAC_TSL=${FAC_TSL:-0} -TZR_QC=${TZR_QC:-0} - -export use_gfs_nemsio=${use_gfs_nemsio:-".false."} # run GSI with NEMSIO input/output -export l4densvar=${l4densvar:-".false."} # run GSI in hybrid 4D ensemble-variational mode -export lwrite4danl=${lwrite4danl:-".false."} # .false. = write single analysis at center time -export DOIAU=${DOIAU:-"NO"} # run global_cycle for IAU -export lrun_subdirs=${lrun_subdirs:-".true."} # run GSI with scratch files in sub-directories -# Filenames. -export XC=${XC} -export PREINP=${PREINP} -export SUFINP=${SUFINP} -export SIGHDR=${SIGHDR:-${EXECgsm}/global_sighdr$XC} -export SFCHDR=${SFCHDR:-${EXECgsm}/global_sfchdr$XC} -if [ $use_gfs_nemsio = .true. ]; then - export JCAP=${JCAP:-$($SIGHDR $SIGGES jcap |grep -i "jcap" |awk -F"= " '{print $2}' |awk -F" " '{print $1}')} - export JCAP_A=${JCAP_A:-$($SIGHDR $SIGGES jcap |grep -i "jcap" |awk -F"= " '{print $2}' |awk -F" " '{print $1}')} - export LATB=${LATB:-$($SFCHDR $SFCGES latr |grep -i "latr" |awk -F"= " '{print $2}' |awk -F" " '{print $1}')} - export LONB=${LONB:-$($SFCHDR $SFCGES lonr |grep -i "lonr" |awk -F"= " '{print $2}' |awk -F" " '{print $1}')} - export LEVS=${LEVS:-$($SIGHDR $SIGGES levs |grep -i "levs" |awk -F"= " '{print $2}' |awk -F" " '{print $1}')} -else - export JCAP=${JCAP:-$($SIGHDR $SIGGES JCAP||echo 0)} - export JCAP_A=${JCAP_A:-$($SIGHDR $SIGGES JCAP||echo 0)} - export LATB=${LATB:-$($SFCHDR $SFCGES LATB||echo 0)} - export LONB=${LONB:-$($SFCHDR $SFCGES LONB||echo 0)} - export LEVS=${LEVS:-$($SIGHDR $SIGGES LEVS||echo 0)} -fi -export LATA=${LATA:-$LATB} -export LONA=${LONA:-$LONB} -export NLAT_A=${NLAT_A:-$(($LATA+2))} -export NLON_A=${NLON_A:-$LONA} -export DELTIM=${DELTIM:-$((3600/($JCAP_A/20)))} -export CYCLEXEC=${CYCLEXEC:-${EXECgsm}/global_cycle$XC} -export GSIEXEC=${GSIEXEC:-${EXECgsi}/global_gsi$XC} -export CYCLESH=${CYCLESH:-${USHgsm}/global_cycle.sh} -export BERROR=${BERROR:-${FIXgsi}/global_berror.l${LEVS}y${NLAT_A}.f77} -export SATANGL=${SATANGL:-${FIXgsi}/global_satangbias.txt} -export SATINFO=${SATINFO:-${FIXgsi}/global_satinfo.txt} -export RADCLOUDINFO=${RADCLOUDINFO:-${FIXgsi}/cloudy_radiance_info.txt} -export ATMSFILTER=${ATMSFILTER:-${FIXgsi}/atms_beamwidth.txt} -export RTMFIX=${RTMFIX:-$NWROOT/lib/crtm/${crtm_ver}/fix} -export ANAVINFO=${ANAVINFO:-${FIXgsi}/global_anavinfo.l${LEVS}.txt} -export CONVINFO=${CONVINFO:-${FIXgsi}/global_convinfo.txt} -export INSITUINFO=${INSITUINFO:-${FIXgsi}/global_insituinfo.txt} -export OZINFO=${OZINFO:-${FIXgsi}/global_ozinfo.txt} -export PCPINFO=${PCPINFO:-${FIXgsi}/global_pcpinfo.txt} -export AEROINFO=${AEROINFO:-${FIXgsi}/global_aeroinfo.txt} -export SCANINFO=${SCANINFO:-${FIXgsi}/global_scaninfo.txt} -export HYBENSINFO=${HYBENSINFO:-${FIXgsi}/global_hybens_locinfo.l${LEVS}.txt} -export LIGHTINFO=${LIGHTINFO:-${FIXgsi}/global_lightinfo.txt} -export OBERROR=${OBERROR:-${FIXgsi}/prepobs_errtable.global} -export PREPQC=${PREPQC:-${COMIN}/${PREINP}prepbufr${SUFINP}} -export PREPQCPF=${PREPQCPF:-${COMIN}/${PREINP}prepbufr.acft_profiles${SUFINP}} -export SATWND=${SATWND:-${COMIN}/${PREINP}satwnd.tm00.bufr_d${SUFINP}} -export OSCATBF=${OSCATBF:-${COMIN}/${PREINP}oscatw.tm00.bufr_d${SUFINP}} -export RAPIDSCATBF=${RAPIDSCATBF:-${COMIN}/${PREINP}rapidscatw.tm00.bufr_d${SUFINP}} -export GSNDBF=${GSNDBF:-${COMIN}/${PREINP}goesnd.tm00.bufr_d${SUFINP}} -export GSNDBF1=${GSNDBF1:-${COMIN}/${PREINP}goesfv.tm00.bufr_d${SUFINP}} -export B1HRS2=${B1HRS2:-${COMIN}/${PREINP}1bhrs2.tm00.bufr_d${SUFINP}} -export B1MSU=${B1MSU:-${COMIN}/${PREINP}1bmsu.tm00.bufr_d${SUFINP}} -export B1HRS3=${B1HRS3:-${COMIN}/${PREINP}1bhrs3.tm00.bufr_d${SUFINP}} -export B1HRS4=${B1HRS4:-${COMIN}/${PREINP}1bhrs4.tm00.bufr_d${SUFINP}} -export B1AMUA=${B1AMUA:-${COMIN}/${PREINP}1bamua.tm00.bufr_d${SUFINP}} -export B1AMUB=${B1AMUB:-${COMIN}/${PREINP}1bamub.tm00.bufr_d${SUFINP}} -export B1MHS=${B1MHS:-${COMIN}/${PREINP}1bmhs.tm00.bufr_d${SUFINP}} -export ESHRS3=${ESHRS3:-${COMIN}/${PREINP}eshrs3.tm00.bufr_d${SUFINP}} -export ESAMUA=${ESAMUA:-${COMIN}/${PREINP}esamua.tm00.bufr_d${SUFINP}} -export ESAMUB=${ESAMUB:-${COMIN}/${PREINP}esamub.tm00.bufr_d${SUFINP}} -export ESMHS=${ESMHS:-${COMIN}/${PREINP}esmhs.tm00.bufr_d${SUFINP}} -export HRS3DB=${HRS3DB:-${COMIN}/${PREINP}hrs3db.tm00.bufr_d${SUFINP}} -export AMUADB=${AMUADB:-${COMIN}/${PREINP}amuadb.tm00.bufr_d${SUFINP}} -export AMUBDB=${AMUBDB:-${COMIN}/${PREINP}amubdb.tm00.bufr_d${SUFINP}} -export MHSDB=${MHSDB:-${COMIN}/${PREINP}mhsdb.tm00.bufr_d${SUFINP}} -export AIRSBF=${AIRSBF:-${COMIN}/${PREINP}airsev.tm00.bufr_d${SUFINP}} -export IASIBF=${IASIBF:-${COMIN}/${PREINP}mtiasi.tm00.bufr_d${SUFINP}} -export ESIASI=${ESIASI:-${COMIN}/${PREINP}esiasi.tm00.bufr_d${SUFINP}} -export IASIDB=${IASIDB:-${COMIN}/${PREINP}iasidb.tm00.bufr_d${SUFINP}} -export AMSREBF=${AMSREBF:-${COMIN}/${PREINP}amsre.tm00.bufr_d${SUFINP}} -export AMSR2BF=${AMSR2BF:-${COMIN}/${PREINP}amsr2.tm00.bufr_d${SUFINP}} -export GMI1CRBF=${GMI1CRBF:-${COMIN}/${PREINP}gmi1cr.tm00.bufr_d${SUFINP}} -export SAPHIRBF=${SAPHIRBF:-${COMIN}/${PREINP}saphir.tm00.bufr_d${SUFINP}} -export SEVIRIBF=${SEVIRIBF:-${COMIN}/${PREINP}sevcsr.tm00.bufr_d${SUFINP}} -export AHIBF=${AHIBF:-${COMIN}/${PREINP}ahi.tm00.bufr_d${SUFINP}} -export CRISBF=${CRISBF:-${COMIN}/${PREINP}cris.tm00.bufr_d${SUFINP}} -export ESCRIS=${ESCRIS:-${COMIN}/${PREINP}escris.tm00.bufr_d${SUFINP}} -export CRISDB=${CRISDB:-${COMIN}/${PREINP}crisdb.tm00.bufr_d${SUFINP}} -export CRISFSBF=${CRISFSBF:-${COMIN}/${PREINP}crisf4.tm00.bufr_d${SUFINP}} -export ESCRISFS=${ESCRISFS:-${COMIN}/${PREINP}escrisf4.tm00.bufr_d${SUFINP}} -export CRISFSDB=${CRISFSDB:-${COMIN}/${PREINP}crisf4db.tm00.bufr_d${SUFINP}} -export ATMSBF=${ATMSBF:-${COMIN}/${PREINP}atms.tm00.bufr_d${SUFINP}} -export ESATMS=${ESATMS:-${COMIN}/${PREINP}esatms.tm00.bufr_d${SUFINP}} -export ATMSDB=${ATMSDB:-${COMIN}/${PREINP}atmsdb.tm00.bufr_d${SUFINP}} -export SSMITBF=${SSMITBF:-${COMIN}/${PREINP}ssmit.tm00.bufr_d${SUFINP}} -export SSMISBF=${SSMISBF:-${COMIN}/${PREINP}ssmisu.tm00.bufr_d${SUFINP}} -export SBUVBF=${SBUVBF:-${COMIN}/${PREINP}osbuv8.tm00.bufr_d${SUFINP}} -export GOMEBF=${GOMEBF:-${COMIN}/${PREINP}gome.tm00.bufr_d${SUFINP}} -export OMIBF=${OMIBF:-${COMIN}/${PREINP}omi.tm00.bufr_d${SUFINP}} -export MLSBF=${MLSBF:-${COMIN}/${PREINP}mls.tm00.bufr_d${SUFINP}} -export SMIPCP=${SMIPCP:-${COMIN}/${PREINP}spssmi.tm00.bufr_d${SUFINP}} -export TMIPCP=${TMIPCP:-${COMIN}/${PREINP}sptrmm.tm00.bufr_d${SUFINP}} -export GPSROBF=${GPSROBF:-${COMIN}/${PREINP}gpsro.tm00.bufr_d${SUFINP}} -export TCVITL=${TCVITL:-${COMIN}/${PREINP}syndata.tcvitals.tm00} -export NSSTBF=${NSSTBF:-${COMIN}/${PREINP}nsstbufr.tm00.bufr_d${SUFINP}} -export B1AVHAM=${B1AVHAM:-${COMIN}/${PREINP}avcsam.tm00.bufr_d${SUFINP}} -export B1AVHPM=${B1AVHPM:-${COMIN}/${PREINP}avcspm.tm00.bufr_d${SUFINP}} -export GINCIN=${GINCIN:-${COMOUT}/gesfile_in} -export BIASIN=${BIASIN:-${COMOUT}/biascor_in} -export SFCG03=${SFCG03:-${COMOUT}/sfcf03} -export SFCG04=${SFCG04:-${COMOUT}/sfcf04} -export SFCG05=${SFCG05:-${COMOUT}/sfcf05} -export SFCG07=${SFCG07:-${COMOUT}/sfcf07} -export SFCG08=${SFCG08:-${COMOUT}/sfcf08} -export SFCG09=${SFCG09:-${COMOUT}/sfcf09} -export NSTG03=${NSTG03:-${COMOUT}/nstf03} -export NSTG04=${NSTG04:-${COMOUT}/nstf04} -export NSTG05=${NSTG05:-${COMOUT}/nstf05} -export NSTG07=${NSTG07:-${COMOUT}/nstf07} -export NSTG08=${NSTG08:-${COMOUT}/nstf08} -export NSTG09=${NSTG09:-${COMOUT}/nstf09} -export USE_NEWRADBC=${USE_NEWRADBC:-"NO"} -export USE_RADSTAT=${USE_RADSTAT:-"NO"} -export SIGG03=${SIGG03:-${COMOUT}/sigf03} -export SIGG04=${SIGG04:-${COMOUT}/sigf04} -export SIGG05=${SIGG05:-${COMOUT}/sigf05} -export SIGG07=${SIGG07:-${COMOUT}/sigf07} -export SIGG08=${SIGG08:-${COMOUT}/sigf08} -export SIGG09=${SIGG09:-${COMOUT}/sigf09} -export SIGGESENS=${SIGGESENS:-${COMOUT}/sigf06_ens} -export NSTGESENS=${NSTGESENS:-${COMOUT}/nstf06_ens} -export SFCGESENS=${SFCGESENS:-${COMOUT}/sfcf06_ens} -export SFCGCYENS=${SFCGCYENS:-${COMOUT}/sfcgcy_ens} -export NSTGESENS_MEAN=${NSTGESENS_MEAN:-${COMOUT}/nstf06_ensmean} -export SFCGESENS_MEAN=${SFCGESENS_MEAN:-${COMOUT}/sfcf06_ensmean} -export SFCGCYENS_MEAN=${SFCGCYENS_MEAN:-${COMOUT}/sfcgcy_ensmean} -export SFCANLENS_MEAN=${SFCANLENS_MEAN:-${COMOUT}/sfcanl_ensmean} -export DOHYBVAR=${DOHYBVAR:-"NO"} -export USE_READIN_ANL_SFCMASK=${USE_READIN_ANL_SFCMASK:-.false.} -export NMEM_ENS=${NMEM_ENS:-0} -export SFCANL=${SFCANL:-${COMOUT}/${PREINP}sfcanl} -export DTFANL=${DTFANL:-${COMOUT}/${PREINP}dtfanl} -export SFCGCY=${SFCGCY:-${COMOUT}/${PREINP}sfcgcy} -export SFCTSK=${SFCTSK:-${COMOUT}/${PREINP}sfctsk} -export NSTANL=${NSTANL:-${COMOUT}/${PREINP}nstanl} -export SIGANL=${SIGANL:-${COMOUT}/${PREINP}sanl} -export ABIAS=${ABIAS:-${COMOUT}/${PREINP}abias} -export ABIASPC=${ABIASPC:-${COMOUT}/${PREINP}abias_pc} -export ABIASAIR=${ABIASAIR:-${COMOUT}/${PREINP}abias_air} -export GINCOUT=${GINCOUT:-${COMOUT}/${PREINP}gesfile_out} -export BIASOUT=${BIASOUT:-${COMOUT}/${PREINP}biascor_out} -export RADSTAT=${RADSTAT:-${COMOUT}/${PREINP}radstat} -export GSISTAT=${GSISTAT:-${COMOUT}/${PREINP}gsistat} -export PCPSTAT=${PCPSTAT:-${COMOUT}/${PREINP}pcpstat} -export CNVSTAT=${CNVSTAT:-${COMOUT}/${PREINP}cnvstat} -export OZNSTAT=${OZNSTAT:-${COMOUT}/${PREINP}oznstat} -export LIGSTAT=${LIGSTAT:-${COMOUT}/${PREINP}ligstat} -export RUN_SELECT=${RUN_SELECT:-"NO"} -export USE_SELECT=${USE_SELECT:-"NO"} -export SELECT_OBS=${SELECT_OBS:-${COMOUT}/${PREINP}obsinput} -export DIAG_SUFFIX=${DIAG_SUFFIX:-""} -export DIAG_COMPRESS=${DIAG_COMPRESS:-"YES"} -export DIAG_TARBALL=${DIAG_TARBALL:-"YES"} -export INISCRIPT=${INISCRIPT} -export ERRSCRIPT=${ERRSCRIPT:-'eval [[ $err = 0 ]]'} -export LOGSCRIPT=${LOGSCRIPT} -export ENDSCRIPT=${ENDSCRIPT} -# Other variables. -export LSOIL=${LSOIL:-2} -export FSMCL2=${FSMCL2:-60} -if [ $use_gfs_nemsio = .true. ]; then - export CDATE=${CDATE:-$($SFCHDR $SFCGES fcstdate | grep -i "fcstdate_ymdh" |awk -F= '{print $2}')} - export DELTSFC=${DELTSFC:-`$SFCHDR $SFCGES nfhour |awk -F" " '{print $2}'`} -else - export CDATE=${CDATE:-$($SFCHDR $SFCGES VDATE||echo 0)} - export DELTSFC=${DELTSFC:-$($SFCHDR $SFCGES FHOUR||echo 0)} -fi -export CYCLVARS=${CYCLVARS} -export SETUP=${SETUP:-""} -export GRIDOPTS=${GRIDOPTS:-""} -export BKGVERR=${BKGVERR:-""} -export ANBKGERR=${ANBKGERR:-""} -export JCOPTS=${JCOPTS:-""} -export STRONGOPTS=${STRONGOPTS:-""} -export OBSQC=${OBSQC:-""} -export OBSINPUT=${OBSINPUT:-""} -export SUPERRAD=${SUPERRAD:-""} -export SINGLEOB=${SINGLEOB:-""} -export LAGDATA=${LAGDATA:-""} -export HYBRID_ENSEMBLE=${HYBRID_ENSEMBLE:-""} -export RAPIDREFRESH_CLDSURF=${RAPIDREFRESH_CLDSURF:-""} -export CHEM=${CHEM:-""} -export NST=${NST:-""} -export FILESTYLE=${FILESTYLE:-'X'} -export PGMOUT=${PGMOUT:-${pgmout:-'&1'}} -export PGMERR=${PGMERR:-${pgmerr:-'&2'}} -export OBERRFLAG=${OBERRFLAG:-.false.} -export NCP=${NCP:-cp} -export CHGRP_CMD=${CHGRP_CMD:-"chgrp ${group_name:-rstprod}"} -export NTHREADS=${NTHREADS:-1} -export NTHREADS_GSI=${NTHREADS_GSI:-1} -if [ $machine = IBMP6 ] ; then - export NTHSTACK=${NTHSTACK:-1024000000} - export NTHSTACK_GSI=${NTHSTACK_GSI:-1024000000} - typeset -L1 l=$PGMOUT - [[ $l = '&' ]]&&a=''||a='>' - export REDOUT=${REDOUT:-'1>'$a} - typeset -L1 l=$PGMERR - [[ $l = '&' ]]&&a=''||a='>' - export REDERR=${REDERR:-'2>'$a} - COMPRESS=compress - UNCOMPRESS=uncompress -else - typeset -L1 l=$PGMOUT - [[ $l = '&' ]]&&a=''||a='>' - export REDOUT=${REDOUT:-'1>'$a} - typeset -L1 l=$PGMERR - [[ $l = '&' ]]&&a=''||a='>' - export REDERR=${REDERR:-'2>'$a} - COMPRESS=${COMPRESS:-gzip} - UNCOMPRESS=${UNCOMPRESS:-gunzip} -fi -export wc=${wc:-/usr/bin/wc} -export APRUN=${APRUN:-""} -export APRUNCFP=${APRUNCFP:-""} -export USE_CFP=${USE_CFP:-"NO"} - -# Set 4D-EnVar specific variables -if [ $l4densvar = .true. ]; then - export SIGA03=${SIGA03:-${COMOUT}/siga03} - export SIGA04=${SIGA04:-${COMOUT}/siga04} - export SIGA05=${SIGA05:-${COMOUT}/siga05} - export SIGA07=${SIGA07:-${COMOUT}/siga07} - export SIGA08=${SIGA08:-${COMOUT}/siga08} - export SIGA09=${SIGA09:-${COMOUT}/siga09} - export SIGF03ENS=${SIGF03ENS:-${COMROT}/sigf03_ens} - export SIGF04ENS=${SIGF04ENS:-${COMROT}/sigf04_ens} - export SIGF05ENS=${SIGF05ENS:-${COMROT}/sigf05_ens} - export SIGF06ENS=${SIGF06ENS:-${COMROT}/sigf06_ens} - export SIGF07ENS=${SIGF07ENS:-${COMROT}/sigf07_ens} - export SIGF08ENS=${SIGF08ENS:-${COMROT}/sigf08_ens} - export SIGF09ENS=${SIGF09ENS:-${COMROT}/sigf09_ens} -fi - -################################################################################ -# Preprocessing -$INISCRIPT -pwd=$(pwd) -if [[ -d $DATA ]] -then - mkdata=NO -else - mkdir -p $DATA - mkdata=YES -fi -cd $DATA||exit 99 - -################################################################################ -# Update surface guess file to produce surface analysis -rc=0 -if [ $NST_GSI -eq 3 ] ; then - $CYCLESH $SFCGES $SFCGCY - ra=$? - ((rc+=ra)) -else - $CYCLESH $SFCGES $SFCANL - ra=$? - ((rc+=ra)) - if [ $DOIAU = YES ]; then - export CDATE_SAVE=$CDATE - export CDATE=$($NDATE -3 $CDATE_SAVE) - $CYCLESH $SFCG03 $SFCA03 - ra=$? - ((rc+=ra)) - export CDATE=$CDATE_SAVE - fi -fi - -export ERR=$rc -export err=$ERR -$ERRSCRIPT||exit 11 - - -################################################################################ -# Make atmospheric analysis -if [ $machine = IBMP6 ] ; then - export XLSMPOPTS="parthds=$NTHREADS_GSI:stack=$NTHSTACK_GSI" -fi -export OMP_NUM_THREADS=$NTHREADS_GSI -export PGM='$APRUN $DATA/$(basename $GSIEXEC)' -export pgm=$PGM -$LOGSCRIPT - -rm berror_stats satbias_angle satinfo *SpcCoeff.bin *TauCoeff.bin EmisCoeff.bin -rm AerosolCoeff.bin CloudCoeff.bin anavinfo convinfo ozinfo pcpinfo aeroinfo scaninfo -rm errtable prepbufr prepbufr_profl gsndrbufr gsnd1bufr hirs2bufr msubufr hirs3bufr hirs4bufr -rm amsuabufr amsubbufr mhsbufr sbuvbufr gomebufr omibufr mlsbufr ssmirrbufr tmirrbufr ahibufr -rm airsbufr iasibufr iasibufrears iasibufr_db amsrebufr amsr2bufr gmibufr saphirbufr ssmitbufr -rm ssmisbufr gpsrobufr tcvitl hybens_locinfo atms_beamwidth.txt -rm hirs3bufr_db hirs3bufrears amsuabufr_db amsuabufrears -rm amsubbufr_db amsubbufrears mhsbufr_db mhsbufrears seviribufr -rm crisbufr crisbufr_db crisbufrears crisfsbufr crisfsbufrears crisfsbufr_db -rm atmsbufr atmsbufr_db atmsbufrears -rm satbias_in satbias_ang.in satbias_out gsiparm.anl satbias_pc satbias_pc.out satbias_out.int -rm aircftbias_in aircftbias_out -rm sfcf03 sfcf04 sfcf05 sfcf06 sfcf07 sfcf08 sfcf09 -rm sigf03 sigf04 sigf05 sigf06 sigf07 sigf08 sigf09 -rm siga03 siga04 siga05 siganl siga07 siga08 siga09 -rm nstf03 nstf04 nstf05 nstf06 nstf07 nstf08 nstf09 -rm nstanl -rm gesfile_in gesfiles_out -rm -rf dir* - -$NCP $GSIEXEC $DATA - -if [[ $FILESTYLE = 'C' ]]; then - export FCPLN=$NCP -else - export FCPLN="ln -fs" -fi - -# Fixed fields -$FCPLN $BERROR berror_stats -$FCPLN $SATANGL satbias_angle -$FCPLN $SATINFO satinfo -$FCPLN $RADCLOUDINFO cloudy_radiance_info.txt -$FCPLN $ATMSFILTER atms_beamwidth.txt -$FCPLN $ANAVINFO anavinfo -$FCPLN $CONVINFO convinfo -$FCPLN $INSITUINFO insituinfo -$FCPLN $OZINFO ozinfo -$FCPLN $PCPINFO pcpinfo -$FCPLN $AEROINFO aeroinfo -$FCPLN $SCANINFO scaninfo -$FCPLN $HYBENSINFO hybens_info -$FCPLN $LIGHTINFO lightinfo -$FCPLN $OBERROR errtable - -#If using correlated error, link to the covariance files -if grep -q "Rcov" $ANAVINFO ; -then - if ls ${FIXgsi}/Rcov* 1> /dev/null 2>&1; - then - $NLN ${FIXgsi}/Rcov* $DATA - else - echo "Warning: Satellite error covariance files are missing." - echo "Check for the required files in " $ANAVINFO - exit 1 - fi -fi - - -# CRTM Spectral and Transmittance coefficients -mkdir -p crtm_coeffs -for file in `awk '{if($1!~"!"){print $1}}' satinfo | sort | uniq` ;do - $FCPLN $RTMFIX/${file}.SpcCoeff.bin ./crtm_coeffs/ - $FCPLN $RTMFIX/${file}.TauCoeff.bin ./crtm_coeffs/ -done - -$FCPLN $RTMFIX/Nalli.IRwater.EmisCoeff.bin ./crtm_coeffs/Nalli.IRwater.EmisCoeff.bin -$FCPLN $RTMFIX/NPOESS.IRice.EmisCoeff.bin ./crtm_coeffs/NPOESS.IRice.EmisCoeff.bin -$FCPLN $RTMFIX/NPOESS.IRland.EmisCoeff.bin ./crtm_coeffs/NPOESS.IRland.EmisCoeff.bin -$FCPLN $RTMFIX/NPOESS.IRsnow.EmisCoeff.bin ./crtm_coeffs/NPOESS.IRsnow.EmisCoeff.bin -$FCPLN $RTMFIX/NPOESS.VISice.EmisCoeff.bin ./crtm_coeffs/NPOESS.VISice.EmisCoeff.bin -$FCPLN $RTMFIX/NPOESS.VISland.EmisCoeff.bin ./crtm_coeffs/NPOESS.VISland.EmisCoeff.bin -$FCPLN $RTMFIX/NPOESS.VISsnow.EmisCoeff.bin ./crtm_coeffs/NPOESS.VISsnow.EmisCoeff.bin -$FCPLN $RTMFIX/NPOESS.VISwater.EmisCoeff.bin ./crtm_coeffs/NPOESS.VISwater.EmisCoeff.bin -$FCPLN $RTMFIX/FASTEM6.MWwater.EmisCoeff.bin ./crtm_coeffs/FASTEM6.MWwater.EmisCoeff.bin -$FCPLN $RTMFIX/AerosolCoeff.bin ./crtm_coeffs/AerosolCoeff.bin -$FCPLN $RTMFIX/CloudCoeff.bin ./crtm_coeffs/CloudCoeff.bin - -# Observational data -$FCPLN $PREPQC prepbufr -$FCPLN $PREPQCPF prepbufr_profl -$FCPLN $SATWND satwndbufr -$FCPLN $OSCATBF oscatbufr -$FCPLN $RAPIDSCATBF rapidscatbufr -$FCPLN $GSNDBF gsndrbufr -$FCPLN $GSNDBF1 gsnd1bufr -$FCPLN $B1HRS2 hirs2bufr -$FCPLN $B1MSU msubufr -$FCPLN $B1HRS3 hirs3bufr -$FCPLN $B1HRS4 hirs4bufr -$FCPLN $B1AMUA amsuabufr -$FCPLN $B1AMUB amsubbufr -$FCPLN $B1MHS mhsbufr -$FCPLN $ESHRS3 hirs3bufrears -$FCPLN $ESAMUA amsuabufrears -$FCPLN $ESAMUB amsubbufrears -#$FCPLN $ESMHS mhsbufrears -$FCPLN $HRS3DB hirs3bufr_db -$FCPLN $AMUADB amsuabufr_db -$FCPLN $AMUBDB amsubbufr_db -#$FCPLN $MHSDB mhsbufr_db -$FCPLN $SBUVBF sbuvbufr -$FCPLN $GOMEBF gomebufr -$FCPLN $OMIBF omibufr -$FCPLN $MLSBF mlsbufr -$FCPLN $SMIPCP ssmirrbufr -$FCPLN $TMIPCP tmirrbufr -$FCPLN $AIRSBF airsbufr -$FCPLN $IASIBF iasibufr -$FCPLN $ESIASI iasibufrears -$FCPLN $IASIDB iasibufr_db -$FCPLN $AMSREBF amsrebufr -$FCPLN $AMSR2BF amsr2bufr -$FCPLN $GMI1CRBF gmibufr -$FCPLN $SAPHIRBF saphirbufr -$FCPLN $SEVIRIBF seviribufr -$FCPLN $CRISBF crisbufr -$FCPLN $ESCRIS crisbufrears -$FCPLN $CRISDB crisbufr_db -$FCPLN $CRISFSBF crisfsbufr -#$FCPLN $ESCRISFS crisfsbufrears -#$FCPLN $CRISFSDB crisfsbufr_db -$FCPLN $ATMSBF atmsbufr -$FCPLN $ESATMS atmsbufrears -$FCPLN $ATMSDB atmsbufr_db -$FCPLN $SSMITBF ssmitbufr -$FCPLN $SSMISBF ssmisbufr -$FCPLN $GPSROBF gpsrobufr -$FCPLN $GLMBF glmbufr -$FCPLN $TCVITL tcvitl -$FCPLN $NSSTBF nsstbufr -$FCPLN $B1AVHAM avhambufr -$FCPLN $B1AVHPM avhpmbufr -$FCPLN $AHIBF ahibufr - -# Required guess fields -$FCPLN $GBIAS satbias_in -$FCPLN $GBIASPC satbias_pc -$FCPLN $GRADSTAT radstat.gdas -$FCPLN $GBIASAIR aircftbias_in - -$FCPLN $SIGG03 sigf03 -$FCPLN $SIGGES sigf06 -$FCPLN $SIGG09 sigf09 -$FCPLN $SFCG03 sfcf03 -$FCPLN $SFCGES sfcf06 -$FCPLN $SFCG09 sfcf09 -$FCPLN $NSTG03 nstf03 -$FCPLN $NSTGES nstf06 -$FCPLN $NSTG09 nstf09 - -if [[ "$DOHYBVAR" = "YES" && $JCAP != JCAP_A && $JCAP_A = $JCAP_ENKF ]]; then - if [[ -e $SFCGESENS_MEAN ]]; then - USE_READIN_ANL_SFCMASK=.true. - $FCPLN $SFCGESENS_MEAN sfcf06_anlgrid - else - echo "Warning: Inconsistent sfc mask between analysis and ensemble grids used in hybrid EnKF" - fi -fi - -if [[ $NST_GSI -gt 0 ]]; then - if [[ $NST_GSI -eq 3 ]]; then - $FCPLN $SFCGCY sfcgcy - else - $FCPLN $SFCANL sfcgcy - fi -fi - -if [[ "$DOHYBVAR" = "YES" ]]; then - mkdir -p ensemble_data - imem=1 - while [[ $imem -le $NMEM_ENS ]]; do - member="_mem"`printf %03i $imem` - if [ $l4densvar = .true. ]; then - sigens3=${SIGF03ENS}${member} - sigens4=${SIGF04ENS}${member} - sigens5=${SIGF05ENS}${member} - sigens6=${SIGF06ENS}${member} - sigens7=${SIGF07ENS}${member} - sigens8=${SIGF08ENS}${member} - sigens9=${SIGF09ENS}${member} - $FCPLN $sigens3 ./ensemble_data/sigf03_ens${member} - $FCPLN $sigens4 ./ensemble_data/sigf04_ens${member} - $FCPLN $sigens5 ./ensemble_data/sigf05_ens${member} - $FCPLN $sigens6 ./ensemble_data/sigf06_ens${member} - $FCPLN $sigens7 ./ensemble_data/sigf07_ens${member} - $FCPLN $sigens8 ./ensemble_data/sigf08_ens${member} - $FCPLN $sigens9 ./ensemble_data/sigf09_ens${member} - else - sigens=${SIGGESENS}${member} - $FCPLN $sigens ./ensemble_data/sigf06_ens${member} - fi - (( imem = $imem + 1 )) - done -fi - - -## NOTE: 10/01/2003, r.treadon -## (1) While the global_gsi can handle hourly forecast -## files, we do not currently utilize hourly input. -## To prevent misleading error messages in operations, -## test for file existence before cp -## -## (2) File gesfile_in is not currently used in the global_gsi -## To prevent misleading error messages in operations, -## test for file existence before cp -## -## (3) File biascor_in is not currently used in the global_gsi -## To prevent misleading error messages in operations, -## test for file existence before cp - - -if [[ -s $SIGG04 ]]; then - $FCPLN $SIGG04 sigf04 -fi -if [[ -s $SIGG05 ]]; then - $FCPLN $SIGG05 sigf05 -fi -if [[ -s $SIGG07 ]]; then - $FCPLN $SIGG07 sigf07 -fi -if [[ -s $SIGG08 ]]; then - $FCPLN $SIGG08 sigf08 -fi - -if [[ -s $SFCG04 ]]; then - $FCPLN $SFCG04 sfcf04 -fi -if [[ -s $SFCG05 ]]; then - $FCPLN $SFCG05 sfcf05 -fi -if [[ -s $SFCG07 ]]; then - $FCPLN $SFCG07 sfcf07 -fi -if [[ -s $SFCG08 ]]; then - $FCPLN $SFCG08 sfcf08 -fi - -if [[ -s $NSTG04 ]]; then - $FCPLN $NSTG04 nstf04 -fi -if [[ -s $NSTG05 ]]; then - $FCPLN $NSTG05 nstf05 -fi -if [[ -s $NSTG07 ]]; then - $FCPLN $NSTG07 nstf07 -fi -if [[ -s $NSTG08 ]]; then - $FCPLN $NSTG08 nstf08 -fi - -if [[ -s $GINCIN ]]; then - $FCPLN $GINCIN gesfile_in -fi -if [[ -s $BIASIN ]]; then - $FCPLN $BIASIN biascor_in -fi - -## NOTE: 10/01/2003, r.treadon -## Do not add above file existence tests since -## we do not link to files in operations - -if [ $FILESTYLE != 'C' ]; then - - # Output files - ln -fs $SIGANL siganl - if [ $l4densvar = .true. -a $lwrite4danl = .true. ]; then - ln -fs $SIGA03 siga03 - ln -fs $SIGA04 siga04 - ln -fs $SIGA05 siga05 - ln -fs $SIGA07 siga07 - ln -fs $SIGA08 siga08 - ln -fs $SIGA09 siga09 - fi - ln -fs $ABIAS satbias_out - ln -fs $ABIASPC satbias_pc.out - ln -fs $GINCOUT gesfile_out - ln -fs $BIASOUT biascor_out - ln -fs $ABIASAIR aircftbias_out - - if [ $NST_GSI -gt 0 ] ; then - ln -fs $NSTANL nstanl - ln -fs $SFCTSK sfctsk - if [[ "$DOHYBVAR" = "YES" ]]; then - ln -fs $DTFANL dtfanl - fi - if [ $NST_GSI -eq 3 ] ; then - ln -fs $SFCANL sfcanl - fi - fi -# If requested, create obs_input tarball - if [[ "$RUN_SELECT" = "YES" ]]; then - ln -fs $SELECT_OBS obs_input.tar - fi - -fi - -# If requested, copy and de-tar obs_input -if [[ "$USE_SELECT" = "YES" ]]; then - rm obs_input* - $FCPLN $SELECT_OBS ./obs_input.tar - tar -xvf obs_input.tar -fi - - -# If requested, copy and de-tar guess radstat file -if [ $USE_NEWRADBC = YES -a $USE_RADSTAT = YES ]; then - - if [[ $USE_CFP = YES ]]; then - rm $DATA/unzip.sh - rm $DATA/mp_unzip.sh - set +x -cat <<\EOFunzip > unzip.sh -#!/bin/ksh -{ echo - set -aux - diag_file=$1 - fname=`echo $diag_file | cut -d'.' -f1` - date=`echo $diag_file | cut -d'.' -f2` - $UNCOMPRESS $diag_file - fnameges=$(echo $fname|sed 's/_ges//g') - mv $fname.$date $fnameges -} -EOFunzip - set -x - chmod 755 $DATA/unzip.sh - fi - - listdiag=`tar xvf radstat.gdas | cut -d' ' -f2 | grep _ges` - for type in $listdiag; do - diag_file=`echo $type | cut -d',' -f1` - if [[ $USE_CFP = YES ]] ; then - echo "$DATA/unzip.sh $diag_file" | tee -a $DATA/mp_unzip.sh - else - fname=`echo $diag_file | cut -d'.' -f1` - date=`echo $diag_file | cut -d'.' -f2` - $UNCOMPRESS $diag_file - fnameges=$(echo $fname|sed 's/_ges//g') - mv $fname.$date $fnameges - fi - done -fi -if [ $USE_CFP = YES -a $USE_RADSTAT = YES ] ; then - chmod 755 $DATA/mp_unzip.sh - ncmd=`cat $DATA/mp_unzip.sh | wc -l` - if [ $ncmd -gt 0 ]; then - export APRUNCFP_UNZIP=$(eval echo $APRUNCFP) - $APRUNCFP_UNZIP $DATA/mp_unzip.sh - fi -fi - - -# Create global_gsi namelist -cat < gsiparm.anl - &SETUP - miter=2,niter(1)=50,niter(2)=150, - niter_no_qc(1)=25,niter_no_qc(2)=0, - write_diag(1)=.true.,write_diag(2)=.false.,write_diag(3)=.true., - qoption=2, - gencode=$IGEN,factqmin=5.0,factqmax=0.005,deltim=$DELTIM, - iguess=-1, - tzr_qc=$TZR_QC, - oneobtest=.false.,retrieval=.false.,l_foto=.false., - use_pbl=.false.,use_compress=.true.,nsig_ext=12,gpstop=50., - use_gfs_nemsio=${use_gfs_nemsio},use_readin_anl_sfcmask=${USE_READIN_ANL_SFCMASK},lrun_subdirs=${lrun_subdirs}, - crtm_coeffs_path='./crtm_coeffs/', - newpc4pred=.true.,adp_anglebc=.true.,angord=4,passive_bc=.true.,use_edges=.false., - diag_precon=.true.,step_start=1.e-3,emiss_bc=.true.,thin4d=.true.,cwoption=3, - $SETUP - / - &GRIDOPTS - JCAP_B=$JCAP,JCAP=$JCAP_A,NLAT=$NLAT_A,NLON=$NLON_A,nsig=$LEVS, - regional=.false.,nlayers(63)=3,nlayers(64)=6, - $GRIDOPTS - / - &BKGERR - vs=0.7, - hzscl=1.7,0.8,0.5, - hswgt=0.45,0.3,0.25, - bw=0.0,norsp=4, - bkgv_flowdep=.true.,bkgv_rewgtfct=1.5, - bkgv_write=.false., - cwcoveqqcov=.false., - $BKGVERR - / - &ANBKGERR - anisotropic=.false., - $ANBKGERR - / - &JCOPTS - ljcdfi=.false.,alphajc=0.0,ljcpdry=.true.,bamp_jcpdry=5.0e7, - $JCOPTS - / - &STRONGOPTS - tlnmc_option=2,nstrong=1,nvmodes_keep=8,period_max=6.,period_width=1.5, - $STRONGOPTS - / - &OBSQC - dfact=0.75,dfact1=3.0,noiqc=.true.,oberrflg=.false.,c_varqc=0.04, - use_poq7=.true.,qc_noirjaco3_pole=.true.,vqc=.true., - aircraft_t_bc=.true.,biaspredt=1000.0,upd_aircraft=.true.,cleanup_tail=.true., - $OBSQC - / - &OBS_INPUT - dmesh(1)=145.0,dmesh(2)=150.0,dmesh(3)=100.0,time_window_max=3.0, - $OBSINPUT - / -OBS_INPUT:: -! dfile dtype dplat dsis dval dthin dsfcalc - prepbufr ps null ps 0.0 0 0 - prepbufr t null t 0.0 0 0 - prepbufr_profl t null t 0.0 0 0 - prepbufr q null q 0.0 0 0 - prepbufr_profl q null q 0.0 0 0 - prepbufr pw null pw 0.0 0 0 - prepbufr uv null uv 0.0 0 0 - prepbufr_profl uv null uv 0.0 0 0 - satwndbufr uv null uv 0.0 0 0 - prepbufr spd null spd 0.0 0 0 - prepbufr dw null dw 0.0 0 0 - radarbufr rw null rw 0.0 0 0 - nsstbufr sst nsst sst 0.0 0 0 - gpsrobufr gps_bnd null gps 0.0 0 0 - ssmirrbufr pcp_ssmi dmsp pcp_ssmi 0.0 -1 0 - tmirrbufr pcp_tmi trmm pcp_tmi 0.0 -1 0 - sbuvbufr sbuv2 n16 sbuv8_n16 0.0 0 0 - sbuvbufr sbuv2 n17 sbuv8_n17 0.0 0 0 - sbuvbufr sbuv2 n18 sbuv8_n18 0.0 0 0 - hirs3bufr hirs3 n17 hirs3_n17 0.0 1 0 - hirs4bufr hirs4 metop-a hirs4_metop-a 0.0 1 1 - gimgrbufr goes_img g11 imgr_g11 0.0 1 0 - gimgrbufr goes_img g12 imgr_g12 0.0 1 0 - airsbufr airs aqua airs_aqua 0.0 1 1 - amsuabufr amsua n15 amsua_n15 0.0 1 1 - amsuabufr amsua n18 amsua_n18 0.0 1 1 - amsuabufr amsua metop-a amsua_metop-a 0.0 1 1 - airsbufr amsua aqua amsua_aqua 0.0 1 1 - amsubbufr amsub n17 amsub_n17 0.0 1 1 - mhsbufr mhs n18 mhs_n18 0.0 1 1 - mhsbufr mhs metop-a mhs_metop-a 0.0 1 1 - ssmitbufr ssmi f15 ssmi_f15 0.0 1 0 - amsrebufr amsre_low aqua amsre_aqua 0.0 1 0 - amsrebufr amsre_mid aqua amsre_aqua 0.0 1 0 - amsrebufr amsre_hig aqua amsre_aqua 0.0 1 0 - ssmisbufr ssmis f16 ssmis_f16 0.0 1 0 - ssmisbufr ssmis f17 ssmis_f17 0.0 1 0 - ssmisbufr ssmis f18 ssmis_f18 0.0 1 0 - ssmisbufr ssmis f19 ssmis_f19 0.0 1 0 - gsnd1bufr sndrd1 g12 sndrD1_g12 0.0 1 0 - gsnd1bufr sndrd2 g12 sndrD2_g12 0.0 1 0 - gsnd1bufr sndrd3 g12 sndrD3_g12 0.0 1 0 - gsnd1bufr sndrd4 g12 sndrD4_g12 0.0 1 0 - gsnd1bufr sndrd1 g11 sndrD1_g11 0.0 1 0 - gsnd1bufr sndrd2 g11 sndrD2_g11 0.0 1 0 - gsnd1bufr sndrd3 g11 sndrD3_g11 0.0 1 0 - gsnd1bufr sndrd4 g11 sndrD4_g11 0.0 1 0 - gsnd1bufr sndrd1 g13 sndrD1_g13 0.0 1 0 - gsnd1bufr sndrd2 g13 sndrD2_g13 0.0 1 0 - gsnd1bufr sndrd3 g13 sndrD3_g13 0.0 1 0 - gsnd1bufr sndrd4 g13 sndrD4_g13 0.0 1 0 - iasibufr iasi metop-a iasi_metop-a 0.0 1 1 - gomebufr gome metop-a gome_metop-a 0.0 2 0 - omibufr omi aura omi_aura 0.0 2 0 - sbuvbufr sbuv2 n19 sbuv8_n19 0.0 0 0 - hirs4bufr hirs4 n19 hirs4_n19 0.0 1 1 - amsuabufr amsua n19 amsua_n19 0.0 1 1 - mhsbufr mhs n19 mhs_n19 0.0 1 1 - tcvitl tcp null tcp 0.0 0 0 - seviribufr seviri m08 seviri_m08 0.0 1 0 - seviribufr seviri m09 seviri_m09 0.0 1 0 - seviribufr seviri m10 seviri_m10 0.0 1 0 - hirs4bufr hirs4 metop-b hirs4_metop-b 0.0 1 1 - amsuabufr amsua metop-b amsua_metop-b 0.0 1 1 - mhsbufr mhs metop-b mhs_metop-b 0.0 1 1 - iasibufr iasi metop-b iasi_metop-b 0.0 1 1 - gomebufr gome metop-b gome_metop-b 0.0 2 0 - atmsbufr atms npp atms_npp 0.0 1 1 - atmsbufr atms n20 atms_n20 0.0 1 1 - crisbufr cris npp cris_npp 0.0 1 0 - crisfsbufr cris-fsr npp cris-fsr_npp 0.0 1 0 - crisfsbufr cris-fsr n20 cris-fsr_n20 0.0 1 0 - gsnd1bufr sndrd1 g14 sndrD1_g14 0.0 1 0 - gsnd1bufr sndrd2 g14 sndrD2_g14 0.0 1 0 - gsnd1bufr sndrd3 g14 sndrD3_g14 0.0 1 0 - gsnd1bufr sndrd4 g14 sndrD4_g14 0.0 1 0 - gsnd1bufr sndrd1 g15 sndrD1_g15 0.0 1 0 - gsnd1bufr sndrd2 g15 sndrD2_g15 0.0 1 0 - gsnd1bufr sndrd3 g15 sndrD3_g15 0.0 1 0 - gsnd1bufr sndrd4 g15 sndrD4_g15 0.0 1 0 - oscatbufr uv null uv 0.0 0 0 - mlsbufr mls30 aura mls30_aura 0.0 0 0 - avhambufr avhrr metop-a avhrr3_metop-a 0.0 1 0 - avhpmbufr avhrr n18 avhrr3_n18 0.0 1 0 - amsr2bufr amsr2 gcom-w1 amsr2_gcom-w1 0.0 3 0 - gmibufr gmi gpm gmi_gpm 0.0 3 0 - saphirbufr saphir meghat saphir_meghat 0.0 3 0 - ahibufr ahi himawari8 ahi_himawari8 0.0 3 0 - rapidscatbufr uv null uv 0.0 0 0 - glmbufr light g16 light 0.0 0 0 -:: - &SUPEROB_RADAR - $SUPERRAD - / - &LAG_DATA - $LAGDATA - / - &HYBRID_ENSEMBLE - ensemble_path='./ensemble_data/', - $HYBRID_ENSEMBLE - / - &RAPIDREFRESH_CLDSURF - dfi_radar_latent_heat_time_period=30.0, - $RAPIDREFRESH_CLDSURF - / - &CHEM - $CHEM - / - &SINGLEOB_TEST - maginnov=0.1,magoberr=0.1,oneob_type='t', - oblat=45.,oblon=180.,obpres=1000.,obdattim=${CDATE}, - obhourset=0., - $SINGLEOB - / - &NST - nst_gsi=$NST_GSI,nstinfo=$NSTINFO,fac_dtl=$FAC_DTL,fac_tsl=$FAC_TSL, - zsea1=$ZSEA1,zsea2=$ZSEA2, - $NST -/ -EOF - - -# Run global_gsi -eval $PGM < gsiparm.anl $REDOUT$PGMOUT $REDERR$PGMERR -rc=$? - -export ERR=$rc -export err=$ERR -$ERRSCRIPT||exit 2 - - -if [[ $FILESTYLE = 'C' ]]; then - # Output files - $NCP siganl $SIGANL - if [ $l4densvar = .true. -a $lwrite4danl = .true. ]; then - $NCP siga03 $SIGA03 - $NCP siga04 $SIGA04 - $NCP siga05 $SIGA05 - $NCP siga07 $SIGA07 - $NCP siga08 $SIGA08 - $NCP siga09 $SIGA09 - fi - $NCP satbias_out $ABIAS - $NCP satbias_pc.out $ABIASPC - $NCP aircftbias_out $ABIASAIR - if [[ -s gesfile_out ]]; then - $NCP gesfile_out $GINCOUT - fi - if [[ -s biascor_out ]]; then - $NCP biascor_out $BIASOUT - fi - if [ $NST_GSI -gt 0 ] ; then - $NCP nstanl $NSTANL - if [[ "$DOHYBVAR" = "YES" ]]; then - $NCP dtfanl $DTFANL - fi - if [ $NST_GSI -eq 3 ] ; then - $NCP sfcanl $SFCANL - fi - fi -fi - -# For eobs, eomn and eupd -if [[ -s satbias_out.int ]]; then - $NCP satbias_out.int $ABIASe -else - $NCP satbias_in $ABIASe -fi - -if test "$SAVEGES" = "YES" -then - cp $SFCANL $GESOUT/${PREINP}sfcanl - if [ $NST_GSI -gt 0 ] ; then - cp $NSTANL $GESOUT/${PREINP}nstanl - fi - cp $SIGANL $GESOUT/${PREINP}sanl - cp $ABIAS $GESOUT/${PREINP}abias - cp $ABIASPC $GESOUT/${PREINP}abias_pc - cp $ABIASAIR $GESOUT/${PREINP}abias_air -fi -if test "$SENDCOM" = "YES" -then - cp $SFCANL $COMOUT/${PREINP}sfcanl - cp $SIGANL $COMOUT/${PREINP}sanl - cp $ABIAS $COMOUT/${PREINP}abias - cp $ABIASPC $COMOUT/${PREINP}abias_pc - cp $ABIASAIR $COMOUT/${PREINP}abias_air - if [ $NST_GSI -gt 0 ] ; then - cp $NSTANL $COMOUT/${PREINP}nstanl - fi -fi - -############################################################## -# Add this statement to release the forecast job once the GSI -# step is completed. Do not release forecast when RUN=enkf -############################################################## -if [ "$SENDECF" = YES -a "$RUN" != enkf ] -then - ecflow_client --event release_fcst -fi - -# Cat runtime output files. -cat fort.2* > $GSISTAT -cat fort.2* - -# If requested, create obs_input tarball -if [[ "$RUN_SELECT" = "YES" ]]; then - echo $(date) START tar obs_input >&2 - rm obs_input.tar - if [[ $FILESTYLE = 'L' ]]; then - ln -fs $SELECT_OBS ./obs_input.tar - fi - tar -cvf obs_input.tar obs_input* - if [[ $FILESTYLE = 'C' ]]; then - $NCP obs_input.tar $SELECT_OBS - fi - chmod 750 $SELECT_OBS - ${CHGRP_CMD} $SELECT_OBS - echo $(date) END tar obs_input >&2 -fi - -# Loop over first and last outer loops to generate innovation -# diagnostic files for indicated observation types (groups) -# -# NOTE: Since we set miter=2 in GSI namelist SETUP, outer -# loop 03 will contain innovations with respect to -# the analysis. Creation of o-a innovation files -# is triggered by write_diag(3)=.true. The setting -# write_diag(1)=.true. turns on creation of o-g -# innovation files. -# - -cd $DATA # we should already be in $DATA, but extra cd to be sure. - -# Set up lists and variables for various types of diagnostic files. -ntype=3 - -diagtype[0]="conv" -diagtype[1]="pcp_ssmi_dmsp pcp_tmi_trmm" -diagtype[2]="sbuv2_n16 sbuv2_n17 sbuv2_n18 sbuv2_n19 gome_metop-a gome_metop-b omi_aura mls30_aura" -diagtype[3]="hirs2_n14 msu_n14 sndr_g08 sndr_g11 sndr_g12 sndr_g13 sndr_g08_prep sndr_g11_prep sndr_g12_prep sndr_g13_prep sndrd1_g11 sndrd2_g11 sndrd3_g11 sndrd4_g11 sndrd1_g12 sndrd2_g12 sndrd3_g12 sndrd4_g12 sndrd1_g13 sndrd2_g13 sndrd3_g13 sndrd4_g13 sndrd1_g14 sndrd2_g14 sndrd3_g14 sndrd4_g14 sndrd1_g15 sndrd2_g15 sndrd3_g15 sndrd4_g15 hirs3_n15 hirs3_n16 hirs3_n17 amsua_n15 amsua_n16 amsua_n17 amsub_n15 amsub_n16 amsub_n17 hsb_aqua airs_aqua amsua_aqua imgr_g08 imgr_g11 imgr_g12 imgr_g14 imgr_g15 ssmi_f13 ssmi_f15 hirs4_n18 hirs4_metop-a amsua_n18 amsua_metop-a mhs_n18 mhs_metop-a amsre_low_aqua amsre_mid_aqua amsre_hig_aqua ssmis_f16 ssmis_f17 ssmis_f18 ssmis_f19 ssmis_f20 iasi_metop-a hirs4_n19 amsua_n19 mhs_n19 seviri_m08 seviri_m09 seviri_m10 seviri_m11 cris_npp cris-fsr_npp cris-fsr_n20 atms_npp atms_n20 hirs4_metop-b amsua_metop-b mhs_metop-b iasi_metop-b avhrr_n18 avhrr_metop-a amsr2_gcom-w1 gmi_gpm saphir_meghat ahi_himawari8" -diagtype[4]="light" - -diaglist[0]=listcnv -diaglist[1]=listpcp -diaglist[2]=listozn -diaglist[3]=listrad -diaglist[4]=listlig - -diagfile[0]=$CNVSTAT -diagfile[1]=$PCPSTAT -diagfile[2]=$OZNSTAT -diagfile[3]=$RADSTAT -diagfile[4]=$LIGSTAT - -numfile[0]=0 -numfile[1]=0 -numfile[2]=0 -numfile[3]=0 - - -# Set diagnostic file prefix based on lrun_subdirs variable -if [ $lrun_subdirs = ".true." ]; then - prefix=" dir.*/" -else - prefix="pe*" -fi - -if [[ $USE_CFP = YES ]]; then - rm $DATA/diag.sh - rm $DATA/mp_diag.sh - set +x -cat <<\EOFdiag > $DATA/diag.sh -#!/bin/ksh -{ echo - set -aux - lrun_subdirs=$1 - type=$2 - loop=$3 - string=$4 - CDATE=$5 - DIAG_COMPRESS=$6 - DIAG_SUFFIX=$7 - if [ $lrun_subdirs = ".true." ]; then - prefix=" dir.*/" - else - prefix="pe*" - fi - file=diag_${type}_${string}.${CDATE}${DIAG_SUFFIX} - cat ${prefix}${type}_${loop}* > $file - if [[ $DIAG_COMPRESS = YES ]]; then - $COMPRESS $file - fi -} -EOFdiag - set -x - chmod 755 $DATA/diag.sh -fi - -# Collect diagnostic files as a function of loop and type. -loops="01 03" -for loop in $loops; do - case $loop in - 01) string=ges;; - 03) string=anl;; - *) string=$loop;; - esac - echo $(date) START loop $string >&2 - n=-1 - while [ $((n+=1)) -le $ntype ] ;do - for type in `echo ${diagtype[n]}`; do - count=`ls ${prefix}${type}_${loop}* | $wc -l` - if [ $count -gt 0 ]; then - if [[ $USE_CFP = YES ]]; then - echo "$DATA/diag.sh $lrun_subdirs $type $loop $string $CDATE $DIAG_COMPRESS $DIAG_SUFFIX" | tee -a $DATA/mp_diag.sh - else - cat ${prefix}${type}_${loop}* > diag_${type}_${string}.${CDATE}${DIAG_SUFFIX} - fi - echo "diag_${type}_${string}.${CDATE}*" >> ${diaglist[n]} - numfile[n]=`expr ${numfile[n]} + 1` - fi - done - done - echo $(date) END loop $string >&2 -done - -cd $DATA # we should already be in $DATA, but extra cd to be sure. - -# If requested, compress diagnostic files -if [ $DIAG_COMPRESS = YES -a $USE_CFP = NO ]; then - echo $(date) START $COMPRESS diagnostic files >&2 - for file in `ls diag_*${CDATE}${DIAG_SUFFIX}`; do - $COMPRESS $file - done - echo $(date) END $COMPRESS diagnostic files >&2 -fi - -if [[ $USE_CFP = YES ]] ; then - chmod 755 $DATA/mp_diag.sh - ncmd=`cat $DATA/mp_diag.sh | wc -l` - if [ $ncmd -gt 0 ]; then - export APRUNCFP_DIAG=$(eval echo $APRUNCFP) - $APRUNCFP_DIAG $DATA/mp_diag.sh - fi -fi - -# If requested, create diagnostic file tarballs -if [[ $DIAG_TARBALL = YES ]]; then - echo $(date) START tar diagnostic files >&2 - n=-1 - while [ $((n+=1)) -le $ntype ] ;do - TAROPTS="-uvf" - if [ ! -s ${diagfile[n]} ]; then - TAROPTS="-cvf" - fi - if [ ${numfile[n]} -gt 0 ]; then - tar $TAROPTS ${diagfile[n]} `cat ${diaglist[n]}` - fi - done - -# Restrict CNVSTAT - chmod 750 $CNVSTAT - ${CHGRP_CMD} $CNVSTAT - -# Restrict RADSTAT - chmod 750 $RADSTAT - ${CHGRP_CMD} $RADSTAT - - echo $(date) END tar diagnostic files >&2 -fi - - -################################################################################ - -if test "$RUN" = 'gdas' -then - if test "$SENDDBN" = 'YES' - then - $DBNROOT/bin/dbn_alert MODEL GDAS1RADSTAT $job $RADSTAT - fi -fi - -if test "$RUN" = 'gfs' -then - if test "$SENDDBN" = 'YES' - then - $DBNROOT/bin/dbn_alert MODEL GFS_abias $job $COMOUT/${PREINP}abias - fi -fi - -################################################################################ -# Postprocessing -cd $pwd -[[ $mkdata = YES ]]&&rmdir $DATA -$ENDSCRIPT - -set +x -if [[ "$VERBOSE" = "YES" ]] -then - echo $(date) EXITING $0 with return code $err >&2 -fi -exit $err diff --git a/scripts/exglobal_analysis_fv3gfs.sh.ecf b/scripts/exglobal_atmos_analysis.sh similarity index 94% rename from scripts/exglobal_analysis_fv3gfs.sh.ecf rename to scripts/exglobal_atmos_analysis.sh index ac1805febc..ebca996f30 100755 --- a/scripts/exglobal_analysis_fv3gfs.sh.ecf +++ b/scripts/exglobal_atmos_analysis.sh @@ -2,7 +2,7 @@ ################################################################################ #### UNIX Script Documentation Block # . . -# Script name: exglobal_analysis_fv3gfs.sh.ecf.sh +# Script name: exglobal_atmos_analysis.sh # Script description: Makes a global model upper air analysis with GSI # # Author: Rahul Mahajan Org: NCEP/EMC Date: 2017-03-02 @@ -26,18 +26,6 @@ fi # Directories. pwd=$(pwd) -export NWPROD=${NWPROD:-$pwd} -export HOMEgfs=${HOMEgfs:-$NWPROD} -export HOMEgsi=${HOMEgsi:-$NWPROD} -FIXgsi=${FIXgsi:-$HOMEgsi/fix} -GSIEXEC=${GSIEXEC:-$HOMEgsi/exec/global_gsi.x} -export DATA=${DATA:-$pwd/analysis.$$} -export COMIN=${COMIN:-$pwd} -export COMIN_OBS=${COMIN_OBS:-$COMIN} -export COMIN_GES=${COMIN_GES:-$COMIN} -export COMIN_GES_ENS=${COMIN_GES_ENS:-$COMIN_GES} -export COMIN_GES_OBS=${COMIN_GES_OBS:-$COMIN_GES} -export COMOUT=${COMOUT:-$COMIN} # Base variables CDATE=${CDATE:-"2001010100"} @@ -59,7 +47,6 @@ export NLN=${NLN:-"/bin/ln -sf"} export CHGRP_CMD=${CHGRP_CMD:-"chgrp ${group_name:-rstprod}"} export NEMSIOGET=${NEMSIOGET:-${NWPROD}/exec/nemsio_get} export NCLEN=${NCLEN:-$HOMEgfs/ush/getncdimlen} -export CATEXEC=${CATEXEC:-$HOMEgsi/exec/nc_diag_cat_serial.x} export ERRSCRIPT=${ERRSCRIPT:-'eval [[ $err = 0 ]]'} COMPRESS=${COMPRESS:-gzip} UNCOMPRESS=${UNCOMPRESS:-gunzip} @@ -105,19 +92,20 @@ DOIAU=${DOIAU:-"NO"} export IAUFHRS=${IAUFHRS:-"6"} # Dependent Scripts and Executables +GSIEXEC=${GSIEXEC:-$HOMEgfs/exec/global_gsi.x} export NTHREADS_CALCINC=${NTHREADS_CALCINC:-1} export APRUN_CALCINC=${APRUN_CALCINC:-${APRUN:-""}} export APRUN_CALCANL=${APRUN_CALCANL:-${APRUN:-""}} export APRUN_CHGRES=${APRUN_CALCANL:-${APRUN:-""}} -export CALCINCEXEC=${CALCINCEXEC:-$HOMEgsi/exec/calc_increment_ens.x} -export CALCINCNCEXEC=${CALCINCNCEXEC:-$HOMEgsi/exec/calc_increment_ens_ncio.x} -export CALCANLEXEC=${CALCANLEXEC:-$HOMEgsi/exec/calc_analysis.x} -export CHGRESNCEXEC=${CHGRESNCEXEC:-$HOMEgfs/exec/chgres_recenter_ncio.exe} -export CHGRESINCEXEC=${CHGRESINCEXEC:-$HOMEgsi/exec/interp_inc.x} -CHGRESEXEC=${CHGRESEXEC:-$HOMEgfs/exec/chgres_recenter.exe} +export CALCINCEXEC=${CALCINCEXEC:-$HOMEgfs/exec/calc_increment_ens.x} +export CALCINCNCEXEC=${CALCINCNCEXEC:-$HOMEgfs/exec/calc_increment_ens_ncio.x} +export CALCANLEXEC=${CALCANLEXEC:-$HOMEgfs/exec/calc_analysis.x} +export CHGRESNCEXEC=${CHGRESNCEXEC:-$HOMEgfs/exec/enkf_chgres_recenter_nc.x} +export CHGRESINCEXEC=${CHGRESINCEXEC:-$HOMEgfs/exec/interp_inc.x} +CHGRESEXEC=${CHGRESEXEC:-$HOMEgfs/exec/enkf_chgres_recenter.x} export NTHREADS_CHGRES=${NTHREADS_CHGRES:-24} -CALCINCPY=${CALCINCPY:-$HOMEgsi/ush/calcinc_gfs.py} -CALCANLPY=${CALCANLPY:-$HOMEgsi/ush/calcanl_gfs.py} +CALCINCPY=${CALCINCPY:-$HOMEgfs/ush/calcinc_gfs.py} +CALCANLPY=${CALCANLPY:-$HOMEgfs/ush/calcanl_gfs.py} # OPS flags RUN=${RUN:-""} @@ -188,6 +176,7 @@ GPSROBF=${GPSROBF:-${COMIN_OBS}/${OPREFIX}gpsro.tm00.bufr_d${OSUFFIX}} TCVITL=${TCVITL:-${COMIN_OBS}/${OPREFIX}syndata.tcvitals.tm00} B1AVHAM=${B1AVHAM:-${COMIN_OBS}/${OPREFIX}avcsam.tm00.bufr_d${OSUFFIX}} B1AVHPM=${B1AVHPM:-${COMIN_OBS}/${OPREFIX}avcspm.tm00.bufr_d${OSUFFIX}} +HDOB=${HDOB:-${COMIN_OBS}/${OPREFIX}hdob.tm00.bufr_d${OSUFFIX}} # Guess files GPREFIX=${GPREFIX:-""} @@ -243,7 +232,12 @@ fi DIAG_COMPRESS=${DIAG_COMPRESS:-"YES"} DIAG_TARBALL=${DIAG_TARBALL:-"YES"} USE_CFP=${USE_CFP:-"NO"} -DIAG_DIR=${COMOUT}/${APREFIX}gsidiags +CFP_MP=${CFP_MP:-"NO"} +nm="" +if [ $CFP_MP = "YES" ]; then + nm=0 +fi +DIAG_DIR=${DIAG_DIR:-${COMOUT}/gsidiags} # Set script / GSI control parameters DOHYBVAR=${DOHYBVAR:-"NO"} @@ -417,45 +411,6 @@ fi cd $DATA || exit 99 -################################################################################ -# Clean the run-directory -rm berror_stats hybens_info -rm scaninfo satbias_angle satinfo -rm anavinfo convinfo ozinfo pcpinfo aeroinfo vqctp001.dat -rm errtable atms_beamwidth.txt -rm cloudy_radiance_info.txt - -rm prepbufr prepbufr_profl -rm gpsrobufr -rm tcvitl -rm gsndrbufr gsnd1bufr -rm ssmisbufr ssmitbufr ssmirrbufr tmirrbufr -rm sbuvbufr gomebufr omibufr mlsbufr msubufr ompsnpbufr ompstcbufr -rm airsbufr -rm iasibufr iasibufrears iasibufr_db -rm amsrebufr amsr2bufr -rm gmibufr saphirbufr -rm hirs2bufr hirs3bufr hirs4bufr hirs3bufr_db hirs3bufrears -rm amsuabufr amsuabufr_db amsuabufrears -rm amsubbufr amsubbufr_db amsubbufrears -rm mhsbufr mhsbufr_db mhsbufrears -rm seviribufr ahibufr abibufr -rm crisbufr crisbufrears crisbufr_db crisfsbufr crisfsbufrears crisfsbufr_db -rm atmsbufr atmsbufr_db atmsbufrears - -rm satbias_in satbias_ang.in satbias_out satbias_pc satbias_pc.out satbias_out.int -rm aircftbias_in aircftbias_out - -rm sfcf* sigf* nstf* -rm sfca* siga* nsta* -rm sigi* - -rm gsiparm.anl - -rm -rf dir* -rm -rf crtm_coeffs -rm -rf ensemble_data - ############################################################## # Fixed files $NLN $BERROR berror_stats @@ -481,12 +436,12 @@ if [ $USE_CORRELATED_OBERRS == "YES" ]; then $NLN ${FIXgsi}/Rcov* $DATA echo "using correlated obs error" else - echo "Error: Satellite error covariance files are missing." + echo "FATAL ERROR: Satellite error covariance files (Rcov) are missing." echo "Check for the required Rcov files in " $ANAVINFO exit 1 fi else - echo "Error: Satellite error covariance info missing in " $ANAVINFO + echo "FATAL ERROR: Satellite error covariance info missing in " $ANAVINFO exit 1 fi @@ -577,6 +532,7 @@ $NLN $B1AVHAM avhambufr $NLN $B1AVHPM avhpmbufr $NLN $AHIBF ahibufr $NLN $ABIBF abibufr +$NLN $HDOB hdobbufr [[ $DONST = "YES" ]] && $NLN $NSSTBF nsstbufr @@ -668,7 +624,7 @@ if [ $GENDIAG = "YES" ] ; then $NLN $DIAG_DIR/$pedir $pedir done else - echo "lrun_subdirs must be true; exit with error" + echo "FATAL ERROR: lrun_subdirs must be true. lrun_subdirs=$lrun_subdirs" $ERRSCRIPT || exit 2 fi fi @@ -721,7 +677,8 @@ fi # If requested, copy and de-tar guess radstat file if [ $USE_RADSTAT = "YES" ]; then if [ $USE_CFP = "YES" ]; then - rm $DATA/unzip.sh $DATA/mp_unzip.sh + [[ -f $DATA/unzip.sh ]] && rm $DATA/unzip.sh + [[ -f $DATA/mp_unzip.sh ]] && rm $DATA/mp_unzip.sh cat > $DATA/unzip.sh << EOFunzip #!/bin/sh diag_file=\$1 @@ -739,7 +696,10 @@ EOFunzip for type in $listdiag; do diag_file=$(echo $type | cut -d',' -f1) if [ $USE_CFP = "YES" ] ; then - echo "$DATA/unzip.sh $diag_file $DIAG_SUFFIX" | tee -a $DATA/mp_unzip.sh + echo "$nm $DATA/unzip.sh $diag_file $DIAG_SUFFIX" | tee -a $DATA/mp_unzip.sh + if [ ${CFP_MP:-"NO"} = "YES" ]; then + nm=$((nm+1)) + fi else fname=$(echo $diag_file | cut -d'.' -f1) date=$(echo $diag_file | cut -d'.' -f2) @@ -756,6 +716,9 @@ EOFunzip ncmd_max=$((ncmd < npe_node_max ? ncmd : npe_node_max)) APRUNCFP_UNZIP=$(eval echo $APRUNCFP) $APRUNCFP_UNZIP $DATA/mp_unzip.sh + export ERR=$? + export err=$ERR + $ERRSCRIPT || exit 3 fi fi fi # if [ $USE_RADSTAT = "YES" ] @@ -850,13 +813,17 @@ OBS_INPUT:: prepbufr ps null ps 0.0 0 0 prepbufr t null t 0.0 0 0 prepbufr_profl t null t 0.0 0 0 + hdobbufr t null t 0.0 0 0 prepbufr q null q 0.0 0 0 prepbufr_profl q null q 0.0 0 0 + hdobbufr q null q 0.0 0 0 prepbufr pw null pw 0.0 0 0 prepbufr uv null uv 0.0 0 0 prepbufr_profl uv null uv 0.0 0 0 satwndbufr uv null uv 0.0 0 0 + hdobbufr uv null uv 0.0 0 0 prepbufr spd null spd 0.0 0 0 + hdobbufr spd null spd 0.0 0 0 prepbufr dw null dw 0.0 0 0 radarbufr rw null rw 0.0 0 0 nsstbufr sst nsst sst 0.0 0 0 @@ -983,14 +950,19 @@ EOF cat gsiparm.anl ############################################################## -# Make atmospheric analysis -$NCP $GSIEXEC $DATA/gsi.x +# Run gsi analysis + export OMP_NUM_THREADS=$NTHREADS_GSI -$APRUN_GSI ${DATA}/gsi.x 1>&1 2>&2 +export pgm=$GSIEXEC +. prep_step + +$NCP $GSIEXEC $DATA +$APRUN_GSI ${DATA}/$(basename $GSIEXEC) 1>&1 2>&2 +rc=$? -export ERR=$? +export ERR=$rc export err=$ERR -$ERRSCRIPT || exit 2 +$ERRSCRIPT || exit 4 ############################################################## @@ -1002,7 +974,7 @@ if [ $DO_CALC_INCREMENT = "YES" ]; then export ERR=$rc export err=$ERR - $ERRSCRIPT || exit 3 + $ERRSCRIPT || exit 5 fi ############################################################## @@ -1098,7 +1070,7 @@ cat fort.2* > $GSISTAT # If requested, create obsinput tarball from obs_input.* files if [ $RUN_SELECT = "YES" ]; then echo $(date) START tar obs_input >&2 - rm obsinput.tar + [[ -s obsinput.tar ]] && rm obsinput.tar $NLN $SELECT_OBS obsinput.tar tar -cvf obsinput.tar obs_input.* chmod 750 $SELECT_OBS @@ -1107,6 +1079,14 @@ if [ $RUN_SELECT = "YES" ]; then echo $(date) END tar obs_input >&2 fi +################################################################################ +# Send alerts +if [ $SENDDBN = "YES" ]; then + if [ $RUN = "gfs" ]; then + $DBNROOT/bin/dbn_alert MODEL GFS_abias $job $ABIAS + fi +fi + ################################################################################ # Postprocessing cd $pwd diff --git a/scripts/exglobal_analcalc_fv3gfs.sh.ecf b/scripts/exglobal_atmos_analysis_calc.sh similarity index 84% rename from scripts/exglobal_analcalc_fv3gfs.sh.ecf rename to scripts/exglobal_atmos_analysis_calc.sh index c40b7c9783..7204af81f0 100755 --- a/scripts/exglobal_analcalc_fv3gfs.sh.ecf +++ b/scripts/exglobal_atmos_analysis_calc.sh @@ -2,7 +2,7 @@ ################################################################################ #### UNIX Script Documentation Block # . . -# Script name: exglobal_anlcalc_fv3gfs.sh.ecf.sh +# Script name: exglobal_atmos_analysis_calc.sh # Script description: Runs non-diagnostic file tasks after GSI analysis is performed # # Author: Cory Martin Org: NCEP/EMC Date: 2020-03-03 @@ -26,17 +26,7 @@ fi # Directories. pwd=$(pwd) -export NWPROD=${NWPROD:-$pwd} -export HOMEgfs=${HOMEgfs:-$NWPROD} -export HOMEgsi=${HOMEgsi:-$NWPROD} export FIXgsm=${FIXgsm:-$HOMEgfs/fix/fix_am} -export DATA=${DATA:-$pwd/anlcalc.$$} -export COMIN=${COMIN:-$pwd} -export COMIN_OBS=${COMIN_OBS:-$COMIN} -export COMIN_GES=${COMIN_GES:-$COMIN} -export COMIN_GES_ENS=${COMIN_GES_ENS:-$COMIN_GES} -export COMIN_GES_OBS=${COMIN_GES_OBS:-$COMIN_GES} -export COMOUT=${COMOUT:-$COMIN} # Base variables CDATE=${CDATE:-"2001010100"} @@ -58,7 +48,6 @@ export NLN=${NLN:-"/bin/ln -sf"} export CHGRP_CMD=${CHGRP_CMD:-"chgrp ${group_name:-rstprod}"} export NEMSIOGET=${NEMSIOGET:-${NWPROD}/exec/nemsio_get} export NCLEN=${NCLEN:-$HOMEgfs/ush/getncdimlen} -export CATEXEC=${CATEXEC:-$HOMEgsi/exec/nc_diag_cat_serial.x} export ERRSCRIPT=${ERRSCRIPT:-'eval [[ $err = 0 ]]'} COMPRESS=${COMPRESS:-gzip} UNCOMPRESS=${UNCOMPRESS:-gunzip} @@ -78,12 +67,12 @@ export APRUN_CALCINC=${APRUN_CALCINC:-${APRUN:-""}} export APRUN_CALCANL=${APRUN_CALCANL:-${APRUN:-""}} export APRUN_CHGRES=${APRUN_CALCANL:-${APRUN:-""}} -export CALCANLEXEC=${CALCANLEXEC:-$HOMEgsi/exec/calc_analysis.x} -export CHGRESNCEXEC=${CHGRESNCEXEC:-$HOMEgfs/exec/chgres_recenter_ncio.exe} -export CHGRESINCEXEC=${CHGRESINCEXEC:-$HOMEgsi/exec/interp_inc.x} +export CALCANLEXEC=${CALCANLEXEC:-$HOMEgfs/exec/calc_analysis.x} +export CHGRESNCEXEC=${CHGRESNCEXEC:-$HOMEgfs/exec/enkf_chgres_recenter_nc.x} +export CHGRESINCEXEC=${CHGRESINCEXEC:-$HOMEgfs/exec/interp_inc.x} export NTHREADS_CHGRES=${NTHREADS_CHGRES:-1} -CALCINCPY=${CALCINCPY:-$HOMEgsi/ush/calcinc_gfs.py} -CALCANLPY=${CALCANLPY:-$HOMEgsi/ush/calcanl_gfs.py} +CALCINCPY=${CALCINCPY:-$HOMEgfs/ush/calcinc_gfs.py} +CALCANLPY=${CALCANLPY:-$HOMEgfs/ush/calcanl_gfs.py} DOGAUSFCANL=${DOGAUSFCANL-"NO"} GAUSFCANLSH=${GAUSFCANLSH:-$HOMEgfs/ush/gaussian_sfcanl.sh} @@ -106,9 +95,6 @@ ATMGES=${ATMGES:-${COMIN_GES}/${GPREFIX}atmf006${GSUFFIX}} ATMG07=${ATMG07:-${COMIN_GES}/${GPREFIX}atmf007${GSUFFIX}} ATMG08=${ATMG08:-${COMIN_GES}/${GPREFIX}atmf008${GSUFFIX}} ATMG09=${ATMG09:-${COMIN_GES}/${GPREFIX}atmf009${GSUFFIX}} -GBIAS=${GBIAS:-${COMIN_GES}/${GPREFIX}abias} -GBIASPC=${GBIASPC:-${COMIN_GES}/${GPREFIX}abias_pc} -GBIASAIR=${GBIASAIR:-${COMIN_GES}/${GPREFIX}abias_air} # Analysis files export APREFIX=${APREFIX:-""} @@ -224,14 +210,6 @@ fi echo "$CDUMP $CDATE atmanl and sfcanl done at `date`" > $COMOUT/${APREFIX}loganl.txt -################################################################################ -# Send alerts -if [ $SENDDBN = "YES" ]; then - if [ $RUN = "gfs" ]; then - $DBNROOT/bin/dbn_alert MODEL GFS_abias $job $ABIAS - fi -fi - ################################################################################ # Postprocessing cd $pwd diff --git a/scripts/exglobal_analdiag_fv3gfs.sh.ecf b/scripts/exglobal_diag.sh similarity index 81% rename from scripts/exglobal_analdiag_fv3gfs.sh.ecf rename to scripts/exglobal_diag.sh index ad07327f25..1afc49f246 100755 --- a/scripts/exglobal_analdiag_fv3gfs.sh.ecf +++ b/scripts/exglobal_diag.sh @@ -2,7 +2,7 @@ ################################################################################ #### UNIX Script Documentation Block # . . -# Script name: exglobal_analdiag_fv3gfs.sh.ecf.sh +# Script name: exglobal_diag.sh # Script description: Creates diagnostic files after GSI analysis is performed # # Author: Cory Martin Org: NCEP/EMC Date: 2020-03-03 @@ -19,24 +19,13 @@ # Set environment. export VERBOSE=${VERBOSE:-"YES"} -if [ $VERBOSE = "YES" ]; then +if [[ "$VERBOSE" = "YES" ]]; then echo $(date) EXECUTING $0 $* >&2 set -x fi # Directories. pwd=$(pwd) -export NWPROD=${NWPROD:-$pwd} -export HOMEgfs=${HOMEgfs:-$NWPROD} -export HOMEgsi=${HOMEgsi:-$NWPROD} -export FIXgsm=${FIXgsm:-$HOMEgfs/fix/fix_am} -export DATA=${DATA:-$pwd/analdiag.$$} -export COMIN=${COMIN:-$pwd} -export COMIN_OBS=${COMIN_OBS:-$COMIN} -export COMIN_GES=${COMIN_GES:-$COMIN} -export COMIN_GES_ENS=${COMIN_GES_ENS:-$COMIN_GES} -export COMIN_GES_OBS=${COMIN_GES_OBS:-$COMIN_GES} -export COMOUT=${COMOUT:-$COMIN} # Base variables CDATE=${CDATE:-"2001010100"} @@ -58,7 +47,7 @@ export NLN=${NLN:-"/bin/ln -sf"} export CHGRP_CMD=${CHGRP_CMD:-"chgrp ${group_name:-rstprod}"} export NEMSIOGET=${NEMSIOGET:-${NWPROD}/exec/nemsio_get} export NCLEN=${NCLEN:-$HOMEgfs/ush/getncdimlen} -export CATEXEC=${CATEXEC:-$HOMEgsi/exec/nc_diag_cat_serial.x} +export CATEXEC=${CATEXEC:-$HOMEgfs/exec/ncdiag_cat.x} export ERRSCRIPT=${ERRSCRIPT:-'eval [[ $err = 0 ]]'} COMPRESS=${COMPRESS:-gzip} UNCOMPRESS=${UNCOMPRESS:-gunzip} @@ -84,10 +73,10 @@ CNVSTAT=${CNVSTAT:-${COMOUT}/${APREFIX}cnvstat} OZNSTAT=${OZNSTAT:-${COMOUT}/${APREFIX}oznstat} # Remove stat file if file already exists -if [ -s $RADSTAT ]; then rm -f $RADSTAT; fi -if [ -s $PCPSTAT ]; then rm -f $PCPSTAT; fi -if [ -s $CNVSTAT ]; then rm -f $CNVSTAT; fi -if [ -s $OZNSTAT ]; then rm -f $OZNSTAT; fi +[[ -s $RADSTAT ]] && rm -f $RADSTAT +[[ -s $PCPSTAT ]] && rm -f $PCPSTAT +[[ -s $CNVSTAT ]] && rm -f $CNVSTAT +[[ -s $OZNSTAT ]] && rm -f $OZNSTAT # Obs diag GENDIAG=${GENDIAG:-"YES"} @@ -98,7 +87,13 @@ fi DIAG_COMPRESS=${DIAG_COMPRESS:-"YES"} DIAG_TARBALL=${DIAG_TARBALL:-"YES"} USE_CFP=${USE_CFP:-"NO"} -DIAG_DIR=${COMOUT}/${APREFIX}gsidiags/ +CFP_MP=${CFP_MP:-"NO"} +nm="" +if [ $CFP_MP = "YES" ]; then + nm=0 +fi +DIAG_DIR=${DIAG_DIR:-${COMOUT}/gsidiags} +REMOVE_DIAG_DIR=${REMOVE_DIAG_DIR:-"NO"} # Set script / GSI control parameters lrun_subdirs=${lrun_subdirs:-".true."} @@ -114,13 +109,15 @@ if [ $GENDIAG = "YES" ] ; then done else echo "lrun_subdirs must be true; exit with error" + export ERR=$? + export err=$ERR $ERRSCRIPT || exit 2 fi # Set up lists and variables for various types of diagnostic files. ntype=3 - diagtype[0]="conv conv_gps conv_ps conv_pw conv_q conv_sst conv_t conv_tcp conv_uv" + diagtype[0]="conv conv_gps conv_ps conv_pw conv_q conv_sst conv_t conv_tcp conv_uv conv_spd" diagtype[1]="pcp_ssmi_dmsp pcp_tmi_trmm" diagtype[2]="sbuv2_n16 sbuv2_n17 sbuv2_n18 sbuv2_n19 gome_metop-a gome_metop-b omi_aura mls30_aura ompsnp_npp ompstc8_npp gome_metop-c" diagtype[3]="hirs2_n14 msu_n14 sndr_g08 sndr_g11 sndr_g12 sndr_g13 sndr_g08_prep sndr_g11_prep sndr_g12_prep sndr_g13_prep sndrd1_g11 sndrd2_g11 sndrd3_g11 sndrd4_g11 sndrd1_g12 sndrd2_g12 sndrd3_g12 sndrd4_g12 sndrd1_g13 sndrd2_g13 sndrd3_g13 sndrd4_g13 sndrd1_g14 sndrd2_g14 sndrd3_g14 sndrd4_g14 sndrd1_g15 sndrd2_g15 sndrd3_g15 sndrd4_g15 hirs3_n15 hirs3_n16 hirs3_n17 amsua_n15 amsua_n16 amsua_n17 amsub_n15 amsub_n16 amsub_n17 hsb_aqua airs_aqua amsua_aqua imgr_g08 imgr_g11 imgr_g12 imgr_g14 imgr_g15 ssmi_f13 ssmi_f15 hirs4_n18 hirs4_metop-a amsua_n18 amsua_metop-a mhs_n18 mhs_metop-a amsre_low_aqua amsre_mid_aqua amsre_hig_aqua ssmis_f16 ssmis_f17 ssmis_f18 ssmis_f19 ssmis_f20 iasi_metop-a hirs4_n19 amsua_n19 mhs_n19 seviri_m08 seviri_m09 seviri_m10 seviri_m11 cris_npp cris-fsr_npp cris-fsr_n20 atms_npp atms_n20 hirs4_metop-b amsua_metop-b mhs_metop-b iasi_metop-b avhrr_metop-b avhrr_n18 avhrr_n19 avhrr_metop-a amsr2_gcom-w1 gmi_gpm saphir_meghat ahi_himawari8 abi_g16 abi_g17 amsua_metop-c mhs_metop-c iasi_metop-c avhrr_metop-c" @@ -148,7 +145,8 @@ if [ $GENDIAG = "YES" ] ; then fi if [ $USE_CFP = "YES" ]; then - rm $DATA/diag.sh $DATA/mp_diag.sh + [[ -f $DATA/diag.sh ]] && rm $DATA/diag.sh + [[ -f $DATA/mp_diag.sh ]] && rm $DATA/mp_diag.sh cat > $DATA/diag.sh << EOFdiag #!/bin/sh lrun_subdirs=\$1 @@ -199,10 +197,13 @@ EOFdiag n=-1 while [ $((n+=1)) -le $ntype ] ;do for type in $(echo ${diagtype[n]}); do - count=$(ls ${prefix}${type}_${loop}* | wc -l) - if [ $count -gt 0 ]; then + count=$(ls ${prefix}${type}_${loop}* 2>/dev/null | wc -l) + if [ $count -gt 1 ]; then if [ $USE_CFP = "YES" ]; then - echo "$DATA/diag.sh $lrun_subdirs $binary_diag $type $loop $string $CDATE $DIAG_COMPRESS $DIAG_SUFFIX" | tee -a $DATA/mp_diag.sh + echo "$nm $DATA/diag.sh $lrun_subdirs $binary_diag $type $loop $string $CDATE $DIAG_COMPRESS $DIAG_SUFFIX" | tee -a $DATA/mp_diag.sh + if [ ${CFP_MP:-"NO"} = "YES" ]; then + nm=$((nm+1)) + fi else if [ $binary_diag = ".true." ]; then cat ${prefix}${type}_${loop}* > diag_${type}_${string}.${CDATE}${DIAG_SUFFIX} @@ -212,6 +213,13 @@ EOFdiag fi echo "diag_${type}_${string}.${CDATE}*" >> ${diaglist[n]} numfile[n]=$(expr ${numfile[n]} + 1) + elif [ $count -eq 1 ]; then + cat ${prefix}${type}_${loop}* > diag_${type}_${string}.${CDATE}${DIAG_SUFFIX} + if [ $DIAG_COMPRESS = "YES" ]; then + $COMPRESS diag_${type}_${string}.${CDATE}${DIAG_SUFFIX} + fi + echo "diag_${type}_${string}.${CDATE}*" >> ${diaglist[n]} + numfile[n]=$(expr ${numfile[n]} + 1) fi done done @@ -236,18 +244,10 @@ EOFdiag if [ $ncmd -gt 0 ]; then ncmd_max=$((ncmd < npe_node_max ? ncmd : npe_node_max)) APRUNCFP_DIAG=$(eval echo $APRUNCFP) - if [ ${CFP_MP:-"NO"} = "YES" ]; then - if [ -s $DATA/mp_diag_srun.sh ]; then rm -f $DATA/mp_diag_srun.sh; fi - touch $DATA/mp_diag_srun.sh - nm=0 - cat $DATA/mp_diag.sh | while read line; do - echo "$nm $line" >> $DATA/mp_diag_srun.sh - nm=$((nm+1)) - done - $APRUNCFP_DIAG -n $nm --multi-prog $DATA/mp_diag_srun.sh - else - $APRUNCFP_DIAG $DATA/mp_diag.sh - fi + $APRUNCFP_DIAG $DATA/mp_diag.sh + export ERR=$? + export err=$ERR + $ERRSCRIPT || exit 3 fi fi @@ -262,6 +262,9 @@ EOFdiag fi if [ ${numfile[n]} -gt 0 ]; then tar $TAROPTS ${diagfile[n]} $(cat ${diaglist[n]}) + export ERR=$? + export err=$ERR + $ERRSCRIPT || exit 4 fi done @@ -278,20 +281,17 @@ EOFdiag fi # End diagnostic file generation block - if [ $GENDIAG = "YES" ] ################################################################################ -# Send alerts -if [ $SENDDBN = "YES" ]; then - if [ $RUN = "gdas" ]; then - $DBNROOT/bin/dbn_alert MODEL GDASRADSTAT $job $RADSTAT - fi +# Postprocessing +# If no processing error, remove $DIAG_DIR +if [[ "$REMOVE_DIAG_DIR" = "YES" && "$err" = "0" ]]; then + rm -rf $DIAG_DIR fi -################################################################################ -# Postprocessing cd $pwd [[ $mkdata = "YES" ]] && rm -rf $DATA set +x -if [ $VERBOSE = "YES" ]; then +if [[ "$VERBOSE" = "YES" ]]; then echo $(date) EXITING $0 with return code $err >&2 fi exit $err diff --git a/scripts/exglobal_enkf_fcst.sh.ecf b/scripts/exglobal_enkf_fcst.sh.ecf deleted file mode 100755 index 2de38101a0..0000000000 --- a/scripts/exglobal_enkf_fcst.sh.ecf +++ /dev/null @@ -1,464 +0,0 @@ -#!/bin/ksh -################################################################################ -#### UNIX Script Documentation Block -# . . -# Script name: exglobal_enkffcs.sh.sms -# Script description: Run global_enkf ensemble forecasts -# -# Author: Russ Treadon Org: NP23 Date: 2011-12-16 -# -# Abstract: This script runs global_enkf ensemble forecasts -# -# Script history log: -# 2011-12-16 Russ Treadon based on GCWMB parallel script efcs.sh -# other upgrades related to model changes -# 2014-05-16 Xu Li Add NSST -# -# Input script positional parameters: -# -# Imported Shell Variables: -# FIXgsm Directory for global fixed files -# defaults to /nwprod/fix -# EXECgsm Directory for global executables -# defaults to /nwprod/exec -# DATA working directory -# (if nonexistent will be made, used and deleted) -# defaults to current working directory -# COMIN Path to input sigma and surface analysis files -# defalts to pwd -# COMOUT output directory -# (if nonexistent will be made) -# defaults to current working directory -# SUFOUT Suffix to add to output filenames -# defaults to unique ensemble member -# NCP Copy command -# defaults to cp -# JCAP Spectral truncation -# defaults to 254 -# LEVS Number of levels -# defaults to 64 -# FCSTEXEC Forecast executable -# defaults to ${EXECgsm}/global_fcst$XC -# OROGRAPHY Input orography GRIB file (horiz resolution dependent) -# defaults to ${FIXgsm}/global_orography.t$JCAP.grb -# OROGRAPHY_UF Input unfiltered orography GRIB file (resolution dependent) -# defaults to ${FIXgsm}/global_orography_uf.t$JCAP.grb -# LONSPERLAT Input txt file containing reduced grid information -# defaults to ${FIXgsm}/global_lonsperlat.t$MTNRSL.txt} -# FNMSKH Input high resolution land mask GRIB file -# defaults to ${FIXgsm}/seaice_newland.grb -# INISCRIPT Preprocessing script -# defaults to none -# LOGSCRIPT Log posting script -# defaults to none -# ERRSCRIPT Error processing script -# defaults to 'eval [[ $err = 0 ]]' -# ENDSCRIPT Postprocessing script -# defaults to none -# FHDFI_ENKF Half number of hours of digital filter initialization -# defaults to 0 -# FHCYC_ENKF Surface cycling frequency in hours -# defaults to 0 for no cycling -# FCSTVARS Other namelist inputs to the forecast executable -# defaults to none set -# FSMCL2 Scale in days to relax to soil moisture climatology -# defaults to 99999 for no relaxation -# NTHREADS Number of threads -# defaults to 2 -# NTHSTACK Size of stack per thread -# defaults to 1024000000 -# FILESTYLE File management style flag -# ('C' to copy to/from $DATA, 'L' for symbolic links in $DATA, -# 'X' to use XLFUNIT or symbolic links where appropriate) -# defaults to 'X' -# PGMOUT Executable standard output -# defaults to $pgmout, then to '&1' -# PGMERR Executable standard error -# defaults to $pgmerr, then to '&1' -# pgmout Executable standard output default -# pgmerr Executable standard error default -# REDOUT standard output redirect ('1>' or '1>>') -# defaults to '1>', or to '1>>' to append if $PGMOUT is a file -# REDERR standard error redirect ('2>' or '2>>') -# defaults to '2>', or to '2>>' to append if $PGMERR is a file -# VERBOSE Verbose flag (YES or NO) -# defaults to YES -# -# Exported Shell Variables: -# PGM Current program name -# pgm -# ERR Last return code -# err -# -# Modules and files referenced: -# scripts : $INISCRIPT -# $LOGSCRIPT -# $ERRSCRIPT -# $ENDSCRIPT -# -# programs : $FCSTEXEC -# -# input data : -# -# fixed data : $FNOROG -# $FNMASK -# $OROGRAPHY -# $OROGRAPHY_UF -# $LONSPERLAT -# $SLMASK -# -# output data: -# $PGMOUT -# $PGMERR -# -# scratch : -# -# Remarks: -# -# Condition codes -# 0 - no problem encountered -# >0 - some problem encountered -# -# Control variable resolution priority -# 1 Command line argument. -# 2 Environment variable. -# 3 Inline default. -# -# Attributes: -# Language: POSIX shell -# Machine: IBM SP -# -#### -################################################################################ -# Set environment. -export VERBOSE=${VERBOSE:-"NO"} -if [[ "$VERBOSE" = "YES" ]] ; then - echo $(date) EXECUTING $0 $* >&2 - set -x -fi -export machine=${machine:-WCOSS} -export machine=$(echo $machine|tr '[a-z]' '[A-Z]') - -# Command line arguments. -# *** currently none *** - -# Directories. -#-------------- -export HOMEDIR=${HOMEDIR:-$NWROOT} -export NWPROD=${NWPROD:-$HOMEDIR} -export FIXSUBDA=${FIXSUBDA:-fix/fix_am} -export FIXgsm=${FIXgsm:-$NWPROD/global_shared.${global_shared_ver}/fix/fix_am} -export EXECgsm=${EXECgsm:-$NWPROD/global_shared.${global_shared_ver}/exec} -export USHgsm=${USHgsm:-$NWPROD/global_shared.${global_shared_ver}/ush} -export SCRgsm=${SCRgsm:-$NWPROD/global_shared.${global_shared_ver}/scripts} - -export DATA=${DATA:-$(pwd)} -export COMIN=${COMIN:-$(pwd)} -export COMOUT=${COMOUT:-$(pwd)} - -# Filenames. -#------------ -export FORECASTSH=${FORECASTSH:-$SCRgsm/exglobal_fcst.sh.sms} -[[ -n ${AMEXECTMP:-""} ]]&&eval export AM_EXEC=$AMEXECTMP -export FCSTEXEC=${FCSTEXEC:-$AM_EXEC} -export JCAP=${JCAP_ENKF:-254} -export JCAP_A=$JCAP -export LEVS=${LEVS_ENKF:-64} -export LONB=${LONB_ENKF:-768} -export LATB=${LATB_ENKF:-384} -export LONA=${LONA_ENKF:-512} -export LATA=${LATA_ENKF:-256} -export NLON_A=$LONA -export NLAT_A=$(($LATA+2)) -export DELTIM=${DELTIM_ENKF:-900} -export DTPHYS=${DTPHYS_ENKF:-300} -export SET_STP_SEED=${SET_STP_SEED:-"NO"} -export FSMCL2=99999 -export FNOROG=${FNOROG_ENKF:-$FIXgsm/global_orography.t$JCAP.grb} -export FNMASK=${FNMASK_ENKF:-$FIXgsm/global_slmask.t$JCAP.grb} -export OROGRAPHY=${OROGRAPHY_ENKF:-$FIXgsm/global_orography.t$JCAP.grb} -export OROGRAPHY_UF=${OROGRAPHY_UF_ENKF:-$FIXgsm/global_orography_uf.t$JCAP.$LONB.$LATB.grb} -export LONSPERLAT=${LONSPERLAT_ENKF:-${FIXgsm}/global_lonsperlat.t$MTNRSL.txt} -export SLMASK=${SLMASK_ENKF:-$FIXgsm/global_slmask.t$JCAP.grb} -export MTNVAR=${MTNVAR_ENKF:-$FIXgsm/global_mtnvar.t$JCAP.f77} -export DOIAU=${DOIAU_ENKF:-"NO"} -export INISCRIPT=${INISCRIPT} -export ERRSCRIPT=${ERRSCRIPT:-'eval [[ $err = 0 ]]'} -export LOGSCRIPT=${LOGSCRIPT} -export ENDSCRIPT=${ENDSCRIPT} - -# Other variables. -#------------------ -export NTHREADS=${NTHREADS_EFCS:-2} -export NTHSTACK=${NTHSTACK_EFCS:-1024000000} -export FILESTYLE=${FILESTYLE:-'L'} - -if [ $machine = IBMP6 ] ; then - export MP_BINDPROC=${MP_BINDPROC:-yes} - export MEMORY_AFFINIY=${MEMORY_AFFINIY:-MCM} - export MP_SYNC_QP=${MP_SYNC_QP:-yes} - export MP_SHARED_MEMORY=${MP_SHARED_MEMORY:-"NO"} - export MP_COREFILE_FORMAT=${MP_COREFILE_FORMAT:-"lite"} - export MP_EAGER_LIMIT=32768 -elif [ $machine = ZEUS ] ; then - export MPI_BUFS_PER_PROC=${MPI_BUFS_PER_PROC:-1024} - export MPI_BUFS_PER_HOST=${MPI_BUFS_PER_HOST:-1024} -elif [ $machine = WCOSS ] ; then - export MP_EUIDEVICE=${MP_EUIDEVICE:-min} - export MPICH_ALLTOALL_THROTTLE=${MPICH_ALLTOALL_THROTTLE:-0} - export MP_SINGLE_THREAD=${MP_SINGLE_THREAD:-yes} - export MP_COREFILE_FORMAT=${MP_COREFILE_FORMAT:-lite} - export MP_EUIDEVELOP=${MP_EUIDEVELOP:-min} - export MP_MPILIB=${MP_MPILIB:-mpich2} - export MP_LABELIO=${MP_LABELIO:-yes} - export MP_SINGLE_THREAD=${MP_SINGLE_THREAD:-yes} - export MP_USE_BULK_XFER=${MP_USE_BULK_XFER:-yes} - export MP_SHARED_MEMORY=${MP_SHARED_MEMORY:-yes} - export MP_COLLECTIVE_OFFLOAD=${MP_COLLECTIVE_OFFLOAD:-no} - export KMP_STACKSIZE=${KMP_STACKSIZE:-1024m} -# export MP_EAGER_LIMIT=${MP_EAGER_LIMIT:-32768} -# export MP_EUILIB=${MP_EUILIB:-us} -# export MP_EUIDEVICE=${MP_EUIDEVICE:-sn_all} - export NTHREADS_EFCS=${NTHREADS_EFCS:-1} -fi - -export NST_GSI=${NST_GSI:-0} -export PGMOUT=${PGMOUT:-${pgmout:-'&1'}} -export PGMERR=${PGMERR:-${pgmerr:-'&2'}} -export NCP=${NCP:-/bin/cp} -export SIGOSUF=${SIGOSUF:-'sig'} -export SFCOSUF=${SFCOSUF:-'sfc'} -export FLXOSUF=${FLXOSUF:-'flx'} -export NSTOSUF=${NSTOSUF:-'nst'} - -if [ $machine = IBMP6 ] ; then - typeset -L1 l=$PGMOUT - [[ $l = '&' ]]&&a=''||a='>' - export REDOUT=${REDOUT:-'1>'$a} - typeset -L1 l=$PGMERR - [[ $l = '&' ]]&&a=''||a='>' - export REDERR=${REDERR:-'2>'$a} -else - export REDOUT=${REDOUT:-'1>'} - export REDERR=${REDERR:-'2>'} -fi - - -################################################################################ -# Preprocessing -#---------------- -$INISCRIPT -pwd=$(pwd) -if [[ -d $DATA ]] ; then - mkdata=NO -else - mkdir -p $DATA - mkdata=YES -fi -cd $DATA||exit 99 -[[ -d $COMOUT ]]||mkdir -p $COMOUT -export DATATOP=$DATA - - -################################################################################ -# Set output data -#---------------- - -EFCSGRP=$COMOUT/fcsstat_${CDATE}_grp${ENSGRP} -rm -f $EFCSGRP - - -################################################################################ -# Run forecast for ensemble member -#--------------------------------- -rc=0 -imem=$ENSBEG -while [[ $imem -le $ENSEND ]]; do - - export member="mem"`printf %03i $imem` - export DATA=$DATATOP/$member - export pgmoutm=$DATA/${pgmout:-pgmout.$member} - - export SUFOUT="_${member}" - - export COMOUTSAVE=$COMOUT - export COMOUT=$DATATOP - - export FHROT=${FHROT_ENKF:-0} - export FHOUT=${FHOUT_ENKF:-3} - export FHMAX=${FHMAX_ENKF:-9} - export FHZER=${FHZER_ENKF:-6} - export FHCYC=${FHCYC_ENKF:-24} - export FHDFI=${FHDFI_ENKF:-3} - export FHLWR=${FHLWR_ENKF:-1} - export FHSWR=${FHSWR_ENKF:-1} - export IEMS=${IEMS_ENKF:-0} - export ISOL=${ISOL_ENKF:-0} - export IAER=${IAER_ENKF:-111} - export ICO2=${ICO2_ENKF:-1} - export ICTM=${ICTM_ENKF:-1} - - export FHOUT_HF=${FHOUTHF_ENKF:-3} - export FHMAX_HF=${FHMAXHF_ENKF:-9} - - export FHGOC3D=${FHGOC3D_ENKF:-0} - export LGOC3D=${LGOC3D_ENKF:-.false.} - - export IALB=${IALB_ENKF:-0} - export IOVR_SW=${IOVR_SW_ENKF:-1} - export FCSTVARS_TMP=${FCSTVARS_ENKF:-" "} - - if [[ "$SET_STP_SEED" = "YES" ]] ; then - ISEED_SPPT=$((CDATE*1000 + imem*10 + 1)) - ISEED_SKEB=$((CDATE*1000 + imem*10 + 2)) - ISEED_VC=$((CDATE*1000 + imem*10 + 3)) - ISEED_SHUM=$((CDATE*1000 + imem*10 + 4)) - export FCSTVARS_TMP="ISEED_SPPT=$ISEED_SPPT,ISEED_SKEB=$ISEED_SKEB,ISEED_VC=$ISEED_VC,ISEED_SHUM=$ISEED_SHUM,$FCSTVARS_TMP" - fi - - if [ $DOIAU = YES ]; then - export FHROT=3 - export FHDFI=0 - export FHBAK=3 - export FHINI=3 - export FHMAX=$((FHMAX + 6)) - export FHMAX_HF=$((FHMAX_HF + 6)) - export GDATE=$($NDATE -$FHBAK $CDATE) - export GDATE=$($NDATE -$FHBAK $GDATE) - [[ $FHBAK -lt 10 ]]&&FHBAK=0$FHBAK - export SIGI=$COMIN/sfg_${GDATE}_fhr$FHBAK$SUFOUT - export GRDI=$SIGI - export SFCI=$COMIN/sfca${FHBAK}_$CDATE$SUFOUT - export NSTI=$COMIN/nsta${FHBAK}_$CDATE$SUFOUT - iaufiles_fg=\'$COMIN/sfg_${GDATE}_fhr06$SUFOUT\' - iaufiles_anl=\'$COMIN/siganl_$CDATE$SUFOUT\' - export FCSTVARS_TMP="iau=.true.,iau_delthrs=6,iaufhrs=6,iaufiles_fg=$iaufiles_fg,iaufiles_anl=$iaufiles_anl,$FCSTVARS_TMP" - FHSTART=`expr 6 + $FHOUT` - else - export SIGI=$COMIN/siganl_$CDATE$SUFOUT - export GRDI=$SIGI - export SFCI=$COMIN/sfcanl_$CDATE$SUFOUT - export NSTI=$COMIN/nstanl_$CDATE$SUFOUT - export FHINI=0 - FHSTART=$FHOUT - fi - [[ $FHINI -lt 10 ]]&&FHINI=0$FHINI - - export FCSTVARS=${FCSTVARS_TMP:-" "} - - if [[ $FILESTYLE = 'L' ]]; then - FH=$FHSTART - while [[ $FH -le $FHMAX ]]; do - if [ $DOIAU = YES ]; then - if [ $FH -ge 9 ]; then - FHIAU=$((FH - 6)) - [[ $FHIAU -lt 10 ]]&&FHIAU=0$FHIAU - fi - else - FHIAU=$FH - [[ $FHIAU -lt 10 ]]&&FHIAU=0$FHIAU - fi - [[ $FH -lt 10 ]]&&FH=0$FH - ln -fs $COMOUTSAVE/sfg_${CDATE}_fhr$FHIAU$SUFOUT ${SIGOSUF}f$FH$SUFOUT - ln -fs $COMOUTSAVE/bfg_${CDATE}_fhr$FHIAU$SUFOUT ${SFCOSUF}f$FH$SUFOUT - ln -fs $COMOUTSAVE/flg_${CDATE}_fhr$FHIAU$SUFOUT ${FLXOSUF}f$FH$SUFOUT - if [ $NST_GSI -gt 0 ]; then - ln -fs $COMOUTSAVE/nfg_${CDATE}_fhr$FHIAU$SUFOUT ${NSTOSUF}f$FH$SUFOUT - fi - FH=$((10#$FH)) - FH=`expr $FH + $FHOUT` - done - fi - - $FORECASTSH - ra=$? - ((rc+=ra)) - - ############################################################## - # Add this statement to notify a member forecast failed to - # complete. Continue ahead with other members, but freeze epos - ############################################################## - if [ "$SENDECF" = YES -a $ra -ne 0 ]; then - ecflow_client --abort="forecast of member $imem FAILED" - fi - - cat $pgmoutm - - export COMOUT=$COMOUTSAVE - - if [[ $FILESTYLE = 'C' ]]; then - FH=$FHSTART - while [[ $FH -le $FHMAX ]]; do - if [ $DOIAU = YES ]; then - if [ $FH -ge 9 ]; then - FHIAU=$((FH - 6)) - [[ $FHIAU -lt 10 ]]&&FHIAU=0$FHIAU - fi - else - FHIAU=$FH - [[ $FHIAU -lt 10 ]]&&FHIAU=0$FHIAU - fi - [[ $FH -lt 10 ]]&&FH=0$FH - $NCP ${SIGOSUF}f$FH$SUFOUT $COMOUT/sfg_${CDATE}_fhr$FHIAU$SUFOUT - $NCP ${SFCOSUF}f$FH$SUFOUT $COMOUT/bfg_${CDATE}_fhr$FHIAU$SUFOUT - $NCP ${FLXOSUF}f$FH$SUFOUT $COMOUT/flg_${CDATE}_fhr$FHIAU$SUFOUT - if [ $NST_GSI -gt 0 ]; then - $NCP ${NSTOSUF}f$FH$SUFOUT $COMOUT/nfg_${CDATE}_fhr$FHIAU$SUFOUT - fi - FH=$((10#$FH)) - FH=`expr $FH + $FHOUT` - done - fi - - if [ $SENDDBN = YES ]; then - FH=$FHOUT - while [[ $FH -le $FHMAX ]]; do - [[ $FH -lt 10 ]]&&FH=0$FH - if [[ `expr $FH % 3` -eq 0 ]] - then - $DBNROOT/bin/dbn_alert MODEL GFS_ENKF $job $COMOUT/bfg_${CDATE}_fhr$FH$SUFOUT - fi - FH=$((FH+FHOUT)) - done - fi - - rm log - $NCP $DATATOP/log_all ./log_old - if [ $ra -ne 0 ]; then - echo "MEMBER $imem : FAIL" > log - else - echo "MEMBER $imem : PASS" > log - fi - cat log_old log > log_new - $NCP log_new $DATATOP/log_all - - (( imem = $imem + 1 )) - -done - -################################################################################ -# Save log -#--------- - -cd $DATATOP -$NCP log_all $EFCSGRP - -################################################################################ -# If any members failed, error out -#--------------------------------- - -export ERR=$rc -export err=$ERR -$ERRSCRIPT||exit 2 - -################################################################################ -# Postprocessing -#---------------- -cd $pwd -[[ $mkdata = YES ]]&&rmdir $DATA -$ENDSCRIPT -set +x -if [[ $VERBOSE = YES ]] ; then - echo $(date) EXITING $0 with return code $err >&2 -fi -exit $err diff --git a/scripts/exglobal_enkf_fcst_nems.sh.ecf b/scripts/exglobal_enkf_fcst_nems.sh.ecf deleted file mode 100755 index 4f5bb10267..0000000000 --- a/scripts/exglobal_enkf_fcst_nems.sh.ecf +++ /dev/null @@ -1,468 +0,0 @@ -#!/bin/ksh -################################################################################ -#### UNIX Script Documentation Block -# . . -# Script name: exglobal_enkffcs.sh.sms -# Script description: Run global_enkf ensemble forecasts -# -# Author: Russ Treadon Org: NP23 Date: 2011-12-16 -# -# Abstract: This script runs global_enkf ensemble forecasts -# -# Script history log: -# 2011-12-16 Russ Treadon based on GCWMB parallel script efcs.sh -# other upgrades related to model changes -# 2014-05-16 Xu Li Add NSST -# -# Input script positional parameters: -# -# Imported Shell Variables: -# FIXgsm Directory for global fixed files -# defaults to /nwprod/fix -# EXECgsm Directory for global executables -# defaults to /nwprod/exec -# DATA working directory -# (if nonexistent will be made, used and deleted) -# defaults to current working directory -# COMIN Path to input sigma and surface analysis files -# defalts to pwd -# COMOUT output directory -# (if nonexistent will be made) -# defaults to current working directory -# SUFOUT Suffix to add to output filenames -# defaults to unique ensemble member -# NCP Copy command -# defaults to cp -# JCAP Spectral truncation -# defaults to 254 -# LEVS Number of levels -# defaults to 64 -# FCSTEXEC Forecast executable -# defaults to ${EXECgsm}/global_fcst$XC -# OROGRAPHY Input orography GRIB file (horiz resolution dependent) -# defaults to ${FIXgsm}/global_orography.t$JCAP.grb -# OROGRAPHY_UF Input unfiltered orography GRIB file (resolution dependent) -# defaults to ${FIXgsm}/global_orography_uf.t$JCAP.grb -# LONSPERLAT Input txt file containing reduced grid information -# defaults to ${FIXgsm}/global_lonsperlat.t$MTNRSL.txt} -# FNMSKH Input high resolution land mask GRIB file -# defaults to ${FIXgsm}/seaice_newland.grb -# INISCRIPT Preprocessing script -# defaults to none -# LOGSCRIPT Log posting script -# defaults to none -# ERRSCRIPT Error processing script -# defaults to 'eval [[ $err = 0 ]]' -# ENDSCRIPT Postprocessing script -# defaults to none -# FHDFI_ENKF Half number of hours of digital filter initialization -# defaults to 0 -# FHCYC_ENKF Surface cycling frequency in hours -# defaults to 0 for no cycling -# DYNVARS_ENKF Other namelist inputs to the dynamics executable -# defaults to none set -# PHYVARS_ENKF Other namelist inputs to the physics executable -# defaults to none set -# FSMCL2 Scale in days to relax to soil moisture climatology -# defaults to 99999 for no relaxation -# NTHREADS Number of threads -# defaults to 2 -# NTHSTACK Size of stack per thread -# defaults to 1024000000 -# FILESTYLE File management style flag -# ('C' to copy to/from $DATA, 'L' for symbolic links in $DATA, -# 'X' to use XLFUNIT or symbolic links where appropriate) -# defaults to 'X' -# PGMOUT Executable standard output -# defaults to $pgmout, then to '&1' -# PGMERR Executable standard error -# defaults to $pgmerr, then to '&1' -# pgmout Executable standard output default -# pgmerr Executable standard error default -# REDOUT standard output redirect ('1>' or '1>>') -# defaults to '1>', or to '1>>' to append if $PGMOUT is a file -# REDERR standard error redirect ('2>' or '2>>') -# defaults to '2>', or to '2>>' to append if $PGMERR is a file -# VERBOSE Verbose flag (YES or NO) -# defaults to YES -# -# Exported Shell Variables: -# PGM Current program name -# pgm -# ERR Last return code -# err -# -# Modules and files referenced: -# scripts : $INISCRIPT -# $LOGSCRIPT -# $ERRSCRIPT -# $ENDSCRIPT -# -# programs : $FCSTEXEC -# -# input data : -# -# fixed data : $FNOROG -# $FNMASK -# $OROGRAPHY -# $OROGRAPHY_UF -# $LONSPERLAT -# $SLMASK -# -# output data: -# $PGMOUT -# $PGMERR -# -# scratch : -# -# Remarks: -# -# Condition codes -# 0 - no problem encountered -# >0 - some problem encountered -# -# Control variable resolution priority -# 1 Command line argument. -# 2 Environment variable. -# 3 Inline default. -# -# Attributes: -# Language: POSIX shell -# Machine: IBM SP -# -#### -################################################################################ -# Set environment. -export VERBOSE=${VERBOSE:-"NO"} -if [[ "$VERBOSE" = "YES" ]] ; then - echo $(date) EXECUTING $0 $* >&2 - set -x -fi -export machine=${machine:-WCOSS} -export machine=$(echo $machine|tr '[a-z]' '[A-Z]') - -# Command line arguments. -# *** currently none *** - -# Directories. -#-------------- -export HOMEDIR=${HOMEDIR:-$NWROOT} -export NWPROD=${NWPROD:-$HOMEDIR} -export FIXSUBDA=${FIXSUBDA:-fix/fix_am} -export FIXgsm=${FIXgsm:-$NWPROD/global_shared.${global_shared_ver}/fix/fix_am} -export EXECgsm=${EXECgsm:-$NWPROD/global_shared.${global_shared_ver}/exec} -export USHgsm=${USHgsm:-$NWPROD/global_shared.${global_shared_ver}/ush} -export SCRgsm=${SCRgsm:-$NWPROD/global_shared.${global_shared_ver}/scripts} - -export DATA=${DATA:-$(pwd)} -export COMIN=${COMIN:-$(pwd)} -export COMOUT=${COMOUT:-$(pwd)} - -# Filenames. -#------------ -export FORECASTSH=${FORECASTSH:-$SCRgsm/exglobal_fcst.sh.sms} -[[ -n ${AMEXECTMP:-""} ]]&&eval export AM_EXEC=$AMEXECTMP -export FCSTEXEC=${FCSTEXEC:-$AM_EXEC} -export JCAP=${JCAP_ENKF:-254} -export JCAP_A=$JCAP -export LEVS=${LEVS_ENKF:-64} -export LONB=${LONB_ENKF:-768} -export LATB=${LATB_ENKF:-384} -export LONA=${LONA_ENKF:-512} -export LATA=${LATA_ENKF:-256} -export NLON_A=$LONA -export NLAT_A=$(($LATA+2)) -export DELTIM=${DELTIM_ENKF:-900} -export DTPHYS=${DTPHYS_ENKF:-300} -export SET_STP_SEED=${SET_STP_SEED:-"NO"} -export FSMCL2=99999 -export FNOROG=${FNOROG_ENKF:-$FIXgsm/global_orography.t$JCAP.grb} -export FNMASK=${FNMASK_ENKF:-$FIXgsm/global_slmask.t$JCAP.grb} -export OROGRAPHY=${OROGRAPHY_ENKF:-$FIXgsm/global_orography.t$JCAP.grb} -export OROGRAPHY_UF=${OROGRAPHY_UF_ENKF:-$FIXgsm/global_orography_uf.t$JCAP.$LONB.$LATB.grb} -export LONSPERLAT=${LONSPERLAT_ENKF:-${FIXgsm}/global_lonsperlat.t$MTNRSL.txt} -export SLMASK=${SLMASK_ENKF:-$FIXgsm/global_slmask.t$JCAP.grb} -export MTNVAR=${MTNVAR_ENKF:-$FIXgsm/global_mtnvar.t$JCAP.f77} -export DOIAU=${DOIAU_ENKF:-"NO"} -export INISCRIPT=${INISCRIPT} -export ERRSCRIPT=${ERRSCRIPT:-'eval [[ $err = 0 ]]'} -export LOGSCRIPT=${LOGSCRIPT} -export ENDSCRIPT=${ENDSCRIPT} - -# Other variables. -#------------------ -export NTHREADS=${NTHREADS_EFCS:-2} -export NTHSTACK=${NTHSTACK_EFCS:-1024000000} -export FILESTYLE=${FILESTYLE:-'L'} - -if [ $machine = IBMP6 ] ; then - export MP_BINDPROC=${MP_BINDPROC:-yes} - export MEMORY_AFFINIY=${MEMORY_AFFINIY:-MCM} - export MP_SYNC_QP=${MP_SYNC_QP:-yes} - export MP_SHARED_MEMORY=${MP_SHARED_MEMORY:-"NO"} - export MP_COREFILE_FORMAT=${MP_COREFILE_FORMAT:-"lite"} - export MP_EAGER_LIMIT=32768 -elif [ $machine = ZEUS ] ; then - export MPI_BUFS_PER_PROC=${MPI_BUFS_PER_PROC:-1024} - export MPI_BUFS_PER_HOST=${MPI_BUFS_PER_HOST:-1024} -elif [ $machine = WCOSS ] ; then - export MP_EUIDEVICE=${MP_EUIDEVICE:-min} - export MPICH_ALLTOALL_THROTTLE=${MPICH_ALLTOALL_THROTTLE:-0} - export MP_SINGLE_THREAD=${MP_SINGLE_THREAD:-yes} - export MP_COREFILE_FORMAT=${MP_COREFILE_FORMAT:-lite} - export MP_EUIDEVELOP=${MP_EUIDEVELOP:-min} - export MP_MPILIB=${MP_MPILIB:-mpich2} - export MP_LABELIO=${MP_LABELIO:-yes} - export MP_SINGLE_THREAD=${MP_SINGLE_THREAD:-yes} - export MP_USE_BULK_XFER=${MP_USE_BULK_XFER:-yes} - export MP_SHARED_MEMORY=${MP_SHARED_MEMORY:-yes} - export MP_COLLECTIVE_OFFLOAD=${MP_COLLECTIVE_OFFLOAD:-no} - export KMP_STACKSIZE=${KMP_STACKSIZE:-1024m} -# export MP_EAGER_LIMIT=${MP_EAGER_LIMIT:-32768} -# export MP_EUILIB=${MP_EUILIB:-us} -# export MP_EUIDEVICE=${MP_EUIDEVICE:-sn_all} - export NTHREADS_EFCS=${NTHREADS_EFCS:-1} -fi - -export NST_GSI=${NST_GSI:-0} -export PGMOUT=${PGMOUT:-${pgmout:-'&1'}} -export PGMERR=${PGMERR:-${pgmerr:-'&2'}} -export NCP=${NCP:-/bin/cp} -export SIGOSUF=${SIGOSUF:-'sig'} -export SFCOSUF=${SFCOSUF:-'sfc'} -export FLXOSUF=${FLXOSUF:-'flx'} -export NSTOSUF=${NSTOSUF:-'nst'} - -if [ $machine = IBMP6 ] ; then - typeset -L1 l=$PGMOUT - [[ $l = '&' ]]&&a=''||a='>' - export REDOUT=${REDOUT:-'1>'$a} - typeset -L1 l=$PGMERR - [[ $l = '&' ]]&&a=''||a='>' - export REDERR=${REDERR:-'2>'$a} -else - export REDOUT=${REDOUT:-'1>'} - export REDERR=${REDERR:-'2>'} -fi - - -################################################################################ -# Preprocessing -#---------------- -$INISCRIPT -pwd=$(pwd) -if [[ -d $DATA ]] ; then - mkdata=NO -else - mkdir -p $DATA - mkdata=YES -fi -cd $DATA||exit 99 -[[ -d $COMOUT ]]||mkdir -p $COMOUT -export DATATOP=$DATA - - -################################################################################ -# Set output data -#---------------- - -EFCSGRP=$COMOUT/fcsstat_${CDATE}_grp${ENSGRP} -rm -f $EFCSGRP - - -################################################################################ -# Run forecast for ensemble member -#--------------------------------- -rc=0 -imem=$ENSBEG -while [[ $imem -le $ENSEND ]]; do - - export member="mem"`printf %03i $imem` - export DATA=$DATATOP/$member - export pgmoutm=$DATA/${pgmout:-pgmout.$member} - - export SUFOUT="_${member}" - - export COMOUTSAVE=$COMOUT - export COMOUT=$DATATOP - - export FHROT=${FHROT_ENKF:-0} - export FHOUT=${FHOUT_ENKF:-3} - export FHMAX=${FHMAX_ENKF:-9} - export FHZER=${FHZER_ENKF:-6} - export FHCYC=${FHCYC_ENKF:-24} - export FHDFI=${FHDFI_ENKF:-3} - export FHLWR=${FHLWR_ENKF:-1} - export FHSWR=${FHSWR_ENKF:-1} - export IEMS=${IEMS_ENKF:-0} - export ISOL=${ISOL_ENKF:-0} - export IAER=${IAER_ENKF:-111} - export ICO2=${ICO2_ENKF:-1} - export ICTM=${ICTM_ENKF:-1} - - export FHOUT_HF=${FHOUTHF_ENKF:-3} - export FHMAX_HF=${FHMAXHF_ENKF:-9} - - export FHGOC3D=${FHGOC3D_ENKF:-0} - export LGOC3D=${LGOC3D_ENKF:-.false.} - - export IALB=${IALB_ENKF:-0} - export IOVR_SW=${IOVR_SW_ENKF:-1} - export DYNVARS_TMP=${DYNVARS_ENKF:-" "} - export PHYVARS_TMP=${PHYVARS_ENKF:-" "} - - if [[ "$SET_STP_SEED" = "YES" ]] ; then - ISEED_SPPT=$((CDATE*1000 + imem*10 + 1)) - ISEED_SKEB=$((CDATE*1000 + imem*10 + 2)) - ISEED_VC=$((CDATE*1000 + imem*10 + 3)) - ISEED_SHUM=$((CDATE*1000 + imem*10 + 4)) - export DYNVARS_TMP="ISEED_SPPT=$ISEED_SPPT,ISEED_SKEB=$ISEED_SKEB,ISEED_VC=$ISEED_VC,ISEED_SHUM=$ISEED_SHUM,$DYNVARS_TMP" - fi - - if [ $DOIAU = YES ]; then - export FHROT=3 - export FHDFI=0 - export FHBAK=3 - export FHINI=3 - export FHMAX=$((FHMAX + 6)) - export FHMAX_HF=$((FHMAX_HF + 6)) - export GDATE=$($NDATE -$FHBAK $CDATE) - export GDATE=$($NDATE -$FHBAK $GDATE) - [[ $FHBAK -lt 10 ]]&&FHBAK=0$FHBAK - export SIGI=$COMIN/sfg_${GDATE}_fhr$FHBAK$SUFOUT - export GRDI=$SIGI - export SFCI=$COMIN/sfca${FHBAK}_$CDATE$SUFOUT - export NSTI=$COMIN/nsta${FHBAK}_$CDATE$SUFOUT - iaufiles_fg=\'$COMIN/sfg_${GDATE}_fhr06$SUFOUT\' - iaufiles_anl=\'$COMIN/siganl_$CDATE$SUFOUT\' - export PHYVARS_TMP="iau=.true.,iau_delthrs=6,iaufhrs=6,iaufiles_fg=$iaufiles_fg,iaufiles_anl=$iaufiles_anl,$PHYVARS_TMP" - FHSTART=`expr 6 + $FHOUT` - else - export SIGI=$COMIN/siganl_$CDATE$SUFOUT - export GRDI=$SIGI - export SFCI=$COMIN/sfcanl_$CDATE$SUFOUT - export NSTI=$COMIN/nstanl_$CDATE$SUFOUT - export FHINI=0 - FHSTART=$FHOUT - fi - [[ $FHINI -lt 10 ]]&&FHINI=0$FHINI - - export DYNVARS=${DYNVARS_TMP:-" "} - export PHYVARS=${PHYVARS_TMP:-" "} - - if [[ $FILESTYLE = 'L' ]]; then - FH=$FHSTART - while [[ $FH -le $FHMAX ]]; do - if [ $DOIAU = YES ]; then - if [ $FH -ge 9 ]; then - FHIAU=$((FH - 6)) - [[ $FHIAU -lt 10 ]]&&FHIAU=0$FHIAU - fi - else - FHIAU=$FH - [[ $FHIAU -lt 10 ]]&&FHIAU=0$FHIAU - fi - [[ $FH -lt 10 ]]&&FH=0$FH - ln -fs $COMOUTSAVE/sfg_${CDATE}_fhr$FHIAU$SUFOUT ${SIGOSUF}f$FH$SUFOUT - ln -fs $COMOUTSAVE/bfg_${CDATE}_fhr$FHIAU$SUFOUT ${SFCOSUF}f$FH$SUFOUT - ln -fs $COMOUTSAVE/flg_${CDATE}_fhr$FHIAU$SUFOUT ${FLXOSUF}f$FH$SUFOUT - if [ $NST_GSI -gt 0 ]; then - ln -fs $COMOUTSAVE/nfg_${CDATE}_fhr$FHIAU$SUFOUT ${NSTOSUF}f$FH$SUFOUT - fi - FH=$((10#$FH)) - FH=`expr $FH + $FHOUT` - done - fi - - $FORECASTSH - ra=$? - ((rc+=ra)) - - ############################################################## - # Add this statement to notify a member forecast failed to - # complete. Continue ahead with other members, but freeze epos - ############################################################## - if [ "$SENDECF" = YES -a $ra -ne 0 ]; then - ecflow_client --abort="forecast of member $imem FAILED" - fi - - cat $pgmoutm - - export COMOUT=$COMOUTSAVE - - if [[ $FILESTYLE = 'C' ]]; then - FH=$FHSTART - while [[ $FH -le $FHMAX ]]; do - if [ $DOIAU = YES ]; then - if [ $FH -ge 9 ]; then - FHIAU=$((FH - 6)) - [[ $FHIAU -lt 10 ]]&&FHIAU=0$FHIAU - fi - else - FHIAU=$FH - [[ $FHIAU -lt 10 ]]&&FHIAU=0$FHIAU - fi - [[ $FH -lt 10 ]]&&FH=0$FH - $NCP ${SIGOSUF}f$FH$SUFOUT $COMOUT/sfg_${CDATE}_fhr$FHIAU$SUFOUT - $NCP ${SFCOSUF}f$FH$SUFOUT $COMOUT/bfg_${CDATE}_fhr$FHIAU$SUFOUT - $NCP ${FLXOSUF}f$FH$SUFOUT $COMOUT/flg_${CDATE}_fhr$FHIAU$SUFOUT - if [ $NST_GSI -gt 0 ]; then - $NCP ${NSTOSUF}f$FH$SUFOUT $COMOUT/nfg_${CDATE}_fhr$FHIAU$SUFOUT - fi - FH=$((10#$FH)) - FH=`expr $FH + $FHOUT` - done - fi - - if [ $SENDDBN = YES ]; then - FH=$FHOUT - while [[ $FH -le $FHMAX ]]; do - [[ $FH -lt 10 ]]&&FH=0$FH - if [[ `expr $FH % 3` -eq 0 ]] - then - $DBNROOT/bin/dbn_alert MODEL GFS_ENKF $job $COMOUT/bfg_${CDATE}_fhr$FH$SUFOUT - fi - FH=$((FH+FHOUT)) - done - fi - - rm log - $NCP $DATATOP/log_all ./log_old - if [ $ra -ne 0 ]; then - echo "MEMBER $imem : FAIL" > log - else - echo "MEMBER $imem : PASS" > log - fi - cat log_old log > log_new - $NCP log_new $DATATOP/log_all - - (( imem = $imem + 1 )) - -done - -################################################################################ -# Save log -#--------- - -cd $DATATOP -$NCP log_all $EFCSGRP - -################################################################################ -# If any members failed, error out -#--------------------------------- - -export ERR=$rc -export err=$ERR -$ERRSCRIPT||exit 2 - -################################################################################ -# Postprocessing -#---------------- -cd $pwd -[[ $mkdata = YES ]]&&rmdir $DATA -$ENDSCRIPT -set +x -if [[ $VERBOSE = YES ]] ; then - echo $(date) EXITING $0 with return code $err >&2 -fi -exit $err diff --git a/scripts/exglobal_enkf_inflate_recenter.sh.ecf b/scripts/exglobal_enkf_inflate_recenter.sh.ecf deleted file mode 100755 index 32dae4f19d..0000000000 --- a/scripts/exglobal_enkf_inflate_recenter.sh.ecf +++ /dev/null @@ -1,555 +0,0 @@ -#!/bin/ksh -################################################################################ -#### UNIX Script Documentation Block -# . . -# Script name: exglobal_enkfcen.sh.sms -# Script description: Make global_enkf additive error and recenter -# -# Author: Russ Treadon Org: NP23 Date: 2011-12-16 -# -# Abstract: This script performs the global_enkf additive error and recenter -# -# Script history log: -# 2011-12-16 Russ Treadon based on GCWMB parallel script ecen.sh -# 2014-05-16 Xu Li Add NSST -# -# Usage: exglobal_enkfcen.sh.sms -# -# Input script positional parameters: -# -# Imported Shell Variables: -# FIXgsm Directory for global fixed files -# defaults to /nwprod/fix -# PERTURBDIR Directory for global enkf perturbation database -# defaults to /nwprod/fix/enkf_gfs -# EXECgsm Directory for global executables -# defaults to /nwprod/exec -# USHgsm Directory for global scripts -# defaults to /nwprod/ush -# DATA working directory -# (if nonexistent will be made, used and deleted) -# defaults to current working directory -# COMIN input directory -# defaults to current working directory -# COMOUT output directory -# (if nonexistent will be made) -# defaults to current working directory -# XC Suffix to add to executables -# defaults to none -# PREINP Prefix to add to input observation files -# defaults to none -# SUFINP Suffix to add to input observation files -# defaults to none -# NCP Copy command -# defaults to cp -# GETATMENSMEANEXEC Compute ensemble mean sigma (optonally smoothed) -# defaults to ${EXECgsm}/getsigensmean_smooth$XC -# ADDERRSPECEXEC Perturb sigma files -# defaults to ${EXECgsm}/adderrspec_nmcmeth_spec$XC -# RECENATMPEXEC Recenter sigma files -# defaults to ${EXECgsm}/recentersigp$XC -# INISCRIPT Preprocessing script -# defaults to none -# LOGSCRIPT Log posting script -# defaults to none -# ERRSCRIPT Error processing script -# defaults to 'eval [[ $err = 0 ]]' -# ENDSCRIPT Postprocessing script -# defaults to none -# JCAP_ENKF Spectral truncation for background -# defaults to 254 -# LEVS_ENKF Number of levels -# defaults to 64 -# CDATE Current analysis date in yyyymmddhh format -# defaults to the value in the input surface file header -# LATB_ENKF Number of latitudes -# defaults to the value in the input surface file header -# LONB_ENKF Number of longitudes -# defaults to the value in the input surface file header -# NTHREADS Number of threads -# defaults to 1 -# NTHSTACK Size of stack per thread -# defaults to 1024000000 -# NTHREADS_ENKF Number of threads for ENKFUPDEXEC -# defaults to 1 -# NTHSTACK_ENKF Size of stack per thread for ENKFUPDEXEC -# defaults to 1024000000 -# FILESTYLE File management style flag -# ('C' to copy to/from $DATA, 'L' for symbolic links in $DATA, -# 'X' to use XLFUNIT or symbolic links where appropriate) -# defaults to 'X' -# PGMOUT Executable standard output -# defaults to $pgmout, then to '&1' -# PGMERR Executable standard error -# defaults to $pgmerr, then to '&1' -# pgmout Executable standard output default -# pgmerr Executable standard error default -# REDOUT standard output redirect ('1>' or '1>>') -# defaults to '1>', or to '1>>' to append if $PGMOUT is a file -# REDERR standard error redirect ('2>' or '2>>') -# defaults to '2>', or to '2>>' to append if $PGMERR is a file -# VERBOSE Verbose flag (YES or NO) -# defaults to NO -# -# Exported Shell Variables: -# PGM Current program name -# pgm -# ERR Last return code -# err -# -# Modules and files referenced: -# scripts : $INISCRIPT -# $LOGSCRIPT -# $ERRSCRIPT -# $ENDSCRIPT -# -# programs : $GETATMENSMEANEXEC -# $ADDERRSPECEXEC -# $RECENATMPEXEC -# -# fixed data : -# -# input data : $SIGANL_HI -# $SFCANL_HI -# $SIGGES -# $SIGANLENS_IN -# -# output data: $SANLENSMEAN -# $PERTDATES -# $SIGANLENS_OUT -# -# Remarks: -# -# Condition codes -# 0 - no problem encountered -# >0 - some problem encountered -# -# Control variable resolution priority -# 1 Command line argument. -# 2 Environment variable. -# 3 Inline default. -# -# Attributes: -# Language: POSIX shell -# Machine: IBM SP -# -################################################################################ -# Set environment. -export VERBOSE=${VERBOSE:-"NO"} -if [[ "$VERBOSE" = "YES" ]]; then - echo $(date) EXECUTING $0 $* >&2 - set -x -fi -export machine=${machine:-IBMP6} -export machine=$(echo $machine|tr '[a-z]' '[A-Z]') - -# Command line arguments. - -# Directories. -export HOMEDIR=${HOMEDIR:-$NWROOT} -export NWPROD=${NWPROD:-$HOMEDIR} -export FIXgsm=${FIXgsm:-$NWPROD/global_shared.${global_shared_ver}/fix/fix_am} -export EXECgsm=${EXECgsm:-$NWPROD/global_shared.${global_shared_ver}/exec} -export USHgsm=${USHgsm:-$NWPROD/global_shared.${global_shared_ver}/ush} -export PERTURBDIR=${PERTURBDIR:-$NWPROD/fix/enkf_gfs} -export EXECGDAS=${EXECGDAS:-$NWPROD/gdas.${gdas_ver}/exec} - -export utilscript=${utilscript:-$NWPROD/util/ush} -export DATA=${DATA:-$(pwd)} -export COMIN=${COMIN:-$(pwd)} -export COMOUT=${COMOUT:-$(pwd)} -# Set script control parameters -export use_gfs_nemsio=${use_gfs_nemsio:-".false."} # run script with NEMSIO input/output -# Filenames. -export XC=${XC} -export PREINP=${PREINP} -export SUFINP=${SUFINP} -export JCAP_ENKF=${JCAP_ENKF:-254} -export LEVS_ENKF=${LEVS_ENKF:-64} -export LONB_ENKF=${LONB_ENKF:-768} -export LATB_ENKF=${LATB_ENKF:-384} -export SFCHDR=${SFCHDR:-${EXECgsm}/global_sfchdr$XC} -export GETATMENSMEANEXEC=${GETATMENSMEANEXEC:-${EXECgdas}/getsigensmean_smooth$XC} -export ADDERRSPECEXEC=${ADDERRSPECEXEC:-${EXECgdas}/adderrspec_nmcmeth_spec$XC} -export RECENATMPEXEC=${RECENATMPEXEC:-${EXECgdas}/recentersigp$XC} -export CHGRESSH=${CHGRESSH:-${USHgsm}/global_chgres.sh} -export CHGRESEXEC=${CHGRESEXEC-${EXECgsm}/global_chgres} -export CHGRESVARS_ENKF=${CHGRESVARS_ENKF:-""} -export NMEM_ENKF=${NMEM_ENKF:-0} -export SCALEFACT=${SCALEFACT:-00} -export INISCRIPT=${INISCRIPT} -export ERRSCRIPT=${ERRSCRIPT:-'eval [[ $err = 0 ]]'} -export LOGSCRIPT=${LOGSCRIPT} -export ENDSCRIPT=${ENDSCRIPT} -# Other variables. -if [ $use_gfs_nemsio = .true. ]; then - export CDATE=${CDATE:-$($SFCHDR $SFCGES fcstdate | grep -i "fcstdate_ymdh" |awk -F= '{print $2}')} -else - export CDATE=${CDATE:-$($SFCHDR $SFCGES VDATE||echo 0)} -fi -export NDATE=${NDATE:-$NWPROD/util/exec/ndate} -export GDATE=${GDATE:-($NDATE -06 $CDATE)} -export NDAYS=${NDAYS:-60} -export NHOURS=$((NDAYS*24)) -export PBDATE=${PBDATE:-2010050100} -export PEDATE=${PEDATE:-2011043018} -export SWITCH=${SWITCH:-043018} -export NTHREADS=${NTHREADS:-1} -export NTHSTACK=${NTHSTACK:-1024000000} -export NTHREADS_ENKF=${NTHREADS_ENKF:-1} -export NTHSTACK_ENKF=${NTHSTACK_ENKF:-1024000000} -export CHGRESTHREAD=${CHGRESTHREAD:-32} -export LATCH=${LATCH:-8} -export IDSL=${IDSL:-1} -export IDVT=${IDVT:-21} -export IDVM=${IDVM:-0} -export IALB=${IALB:-0} -export IDVC=${IDVC:-2} -export LSOIL=${LSOIL:-4} -export FILESTYLE=${FILESTYLE:-'X'} -export PGMOUT=${PGMOUT:-${pgmout:-'&1'}} -export PGMERR=${PGMERR:-${pgmerr:-'&2'}} -export OBERRFLAG=${OBERRFLAG:-.false.} -export NCP=${NCP:-cp} -export POE=${POE:-NO} -export APRUN=${APRUN:-""} -export NST_GSI=${NST_GSI:-0} -export SIGISUF=${SIGISUF:-'siganl'} -export SFCISUF=${SFCISUF:-'sfcanl'} - -if [ $machine = IBMP6 ] ; then - typeset -L1 l=$PGMOUT - [[ $l = '&' ]]&&a=''||a='>' - export REDOUT=${REDOUT:-'1>'$a} - typeset -L1 l=$PGMERR - [[ $l = '&' ]]&&a=''||a='>' - export REDERR=${REDERR:-'2>'$a} -else - export REDOUT=${REDOUT:-'1>'} - export REDERR=${REDERR:-'2>'} -fi - -################################################################################ -# Preprocessing -$INISCRIPT -pwd=$(pwd) -if [[ -d $DATA ]]; then - mkdata=NO -else - mkdir -p $DATA - mkdata=YES -fi -cd $DATA||exit 99 - -################################################################################ - -################################################################################ -# Copy input files - -export SIGANL_HI=${SIGANL_HI:-$SIGISUF.$CDUMP.$CDATE} -export SFCANL_HI=${SFCANL_HI:-$SFCISUF.$CDUMP.$CDATE} -export SIGGES=${SIGGES:-sfg_${GDATE}_fhr06_ensmean} - -if [[ $FILESTYLE = 'C' ]]; then - export FCPLN=$NCP -else - export FCPLN="ln -sf" -fi - -imem=1 -while [[ $imem -le $NMEM_ENKF ]]; do - member="_mem"`printf %03i $imem` - $FCPLN ${SIGANLENS_IN}${member} ./sanl_${CDATE}${member} - (( imem = $imem + 1 )) -done - - -################################################################################ -# Compute mean for enkf ensemble analysis members -export DATAPATH2=./ -export FILENAMEOUT=sanl_${CDATE}_ensmean -export FILEPREFIX=sanl_${CDATE} -export NANALS=$NMEM_ENKF - -if [[ $FILESTYLE = 'L' ]]; then - ln -fs $SANLENSMEAN ./sanl_${CDATE}_ensmean -fi - -rm stdout.sanl_ensmean -if [[ "$POE" = "YES" ]]; then - poe $GETATMENSMEANEXEC $DATAPATH2 $FILENAMEOUT $FILEPREFIX $NANALS > stdout.sanl_ensmean - rc=$? -else - eval "$APRUN $GETATMENSMEANEXEC $DATAPATH2 $FILENAMEOUT $FILEPREFIX $NANALS > stdout.sanl_ensmean" - rc=$? -fi - -export ERR=$rc -export err=$ERR -$ERRSCRIPT||exit 2 - -cat stdout.sanl_ensmean -if [[ $FILESTYLE = 'C' ]]; then - $NCP sanl_${CDATE}_ensmean $SANLENSMEAN -fi - - -################################################################################ -# If requested, perturb and recenter ensemble analysis members -if [[ $SCALEFACT -gt 0 ]]; then - -# Generate sequential list of perturbation dates - BDATE=`$NDATE -$NHOURS $CDATE` - EDATE=`$NDATE +$NHOURS $CDATE` - - rm temp_all temp_dat temp_new - npert=0 - SDATE=$BDATE - while [[ $SDATE -le $EDATE ]]; do - MMDDHH=`echo $SDATE | cut -c5-10` - YYYY=2010 - if [[ "$MMDDHH" -le "$SWITCH" ]]; then - YYYY=2011 - fi - PDATE=${YYYY}${MMDDHH} - echo $PDATE > temp_dat - cat temp_all temp_dat > temp_new - mv temp_new temp_all - IDATE=`$NDATE +06 $SDATE` - SDATE=$IDATE - npert=$((npert+1)) - done - mv temp_all dates_seq.dat - rm temp_dat temp_new - - export NPERTURB_PAIRS=$npert - -# Perturb and recenter ensemble analysis members - export LONB=$LONB_ENKF - export LATB=$LATB_ENKF - export ADDPERTPATH=$PERTURBDIR/ - rm dates_ran.dat stdout.adderr - - ln -fs $SIGGES sfg_${CDATE}_fhr06_ensmean - if [[ $FILESTYLE = 'L' ]]; then - ln -fs $PERTDATES dates_ran.dat - fi - - if [[ "$POE" = "YES" ]]; then - poe $ADDERRSPECEXEC $NANALS $CDATE $SCALEFACT $ADDPERTPATH $NPERTURB_PAIRS > stdout.adderr - rc=$? - else - eval "$APRUN $ADDERRSPECEXEC $NANALS $CDATE $SCALEFACT $ADDPERTPATH $NPERTURB_PAIRS > stdout.adderr" - rc=$? - fi - - export ERR=$rc - export err=$ERR - $ERRSCRIPT||exit 2 - - cat stdout.adderr - if [[ $FILESTYLE = 'C' ]]; then - $NCP dates_ran.dat $PERTDATES - fi - -# Compute mean for perturbed and recentered ensemble analysis members - export DATAPATH2=./ - export FILENAMEOUT=sanlpr_${CDATE}_ensmean - export FILEPREFIX=sanlpr_${CDATE} - export NANALS=$NMEM_ENKF - rm stdout.sanlpr_ensmean - eval "$APRUN $GETATMENSMEANEXEC $DATAPATH2 $FILENAMEOUT $FILEPREFIX $NANALS > stdout.sanlpr_ensmean" - rc=$? - - export ERR=$rc - export err=$ERR - $ERRSCRIPT||exit 2 - - cat stdout.sanlpr_ensmean - -fi - - -################################################################################ -# Chgres high resolution analysis to ensemble resolution -$FCPLN $SIGANL_HI sanl_${CDATE}_highres -$FCPLN $SFCANL_HI sfcanl_${CDATE}_highres -export SIGI=sanl_${CDATE}_highres -export SFCI=sfcanl_${CDATE}_highres -export SIGO=sanl_${CDATE}_hybrid_lores -export SFCO=sfcanl_${CDATE}_hybrid_lores -if [ $use_gfs_nemsio = .true. ]; then - export GFSOUT=$SIGO -fi -rm -f $SIGO -rm -f $SFCO - -export JCAP_ens=$JCAP_ENKF -export LEVS_ens=$LEVS_ENKF -export LONB_ens=$LONB_ENKF -export LATB_ens=$LATB_ENKF -export OUTTYP=${OUTTYP:-2} -export PGMOUT=stdout.chgres -export PGMERR=stderr.chgres - -# specify threads for running chgres -if [ $machine = IBMP6 ]; then - export OMP_NUM_THREADS=$CHGRESTHREAD - export NTHREADS=$OMP_NUM_THREADS -else - export OMP_NUM_THREADS=1 - export NTHREADS=1 -fi -export OROGRAPHY=$OROGRAPHY_ENKF -export OROGRAPHY_UF=$OROGRAPHY_UF_ENKF -export SLMASK=$SLMASK_ENKF -export LONSPERLAT=$LONSPERLAT_ENKF - -export CHGRESVARS=$CHGRESVARS_ENKF - -eval "$CHGRESSH $SIGI $SFCI $SIGO $SFCO $JCAP_ens $LEVS_ens $LONB_ens $LATB_ens" -rc=$? - -export ERR=$rc -export err=$ERR -$ERRSCRIPT||exit 2 - -# reduce thread to 1 since post runs with mpi -export OMP_NUM_THREADS=1 -export NTHREADS=$OMP_NUM_THREADS - -cat stderr.chgres -cat stdout.chgres - - -################################################################################ -# Recenter ensemble member atmospheric analyses about hires analysis -if [[ $SCALEFACT -gt 0 ]]; then - export FILENAME_MEANIN=sanlpr_${CDATE}_ensmean # current mean (perturbed & recentered) - export FILENAMEIN=sanlpr_${CDATE} -else - export FILENAME_MEANIN=sanl_${CDATE}_ensmean # current mean (unperturbed & recentered) - export FILENAMEIN=sanl_${CDATE} -fi -export FILENAME_MEANOUT=sanl_${CDATE}_hybrid_lores # recenter around this mean (hires analysis) -export FILENAMEOUT=sanlprc_${CDATE} - -if [[ $FILESTYLE = 'L' ]]; then - imem=1 - while [[ $imem -le $NMEM_ENKF ]]; do - member="_mem"`printf %03i $imem` - ln -fs ${SIGANLENS_OUT}${member} sanlprc_${CDATE}${member} - (( imem = $imem + 1 )) - done -fi - -rm stdout_recenter_hires -if [[ "$POE" = "YES" ]]; then - poe $RECENATMPEXEC $FILENAMEIN $FILENAME_MEANIN $FILENAME_MEANOUT $FILENAMEOUT $NANALS > stdout_recenter_hires - rc=$? -else - eval "$APRUN $RECENATMPEXEC $FILENAMEIN $FILENAME_MEANIN $FILENAME_MEANOUT $FILENAMEOUT $NANALS > stdout_recenter_hires" - rc=$? -fi - -export ERR=$rc -export err=$ERR -$ERRSCRIPT||exit 2 - -cat stdout_recenter_hires - -if [[ $FILESTYLE = 'C' ]]; then - imem=1 - while [[ $imem -le $NMEM_ENKF ]]; do - member="_mem"`printf %03i $imem` - $NCP sanlprc_${CDATE}${member} ${SIGANLENS_OUT}${member} - (( imem = $imem + 1 )) - done -fi - -# Optionally alert $SIGANLENS_OUT files -if [ $SENDDBN = YES ]; then - imem=1 - while [[ $imem -le $NMEM_ENKF ]]; do - member="_mem"`printf %03i $imem` - if [ $SENDDBN = YES ]; then - $DBNROOT/bin/dbn_alert MODEL GFS_ENKF $job ${SIGANLENS_OUT}${member} - fi - (( imem = $imem + 1 )) - done -fi - -################################################################################ -# Update ensemble member surface and nst analyses -################################################################################ -if [ $NST_GSI -gt 0 ]; then - - export DTFANL=${DTFANL:-${COMIN}/${PREINP}dtfanl} - export NSTGES_ENS=${NSTGES_ENS:-${COMIN}/nfg_${GDATE}_fhr06} - export SFCGES_ENS=${SFCGES_ENS:-${COMIN}/bfg_${GDATE}_fhr06} - export SFCGCY_ENS=${SFCGCY_ENS:-${COMIN}/sfcgcy_${CDATE}} - export NSTANL_ENS=${NSTANL_ENS:-${COMOUT}/nstanl_${CDATE}} - export SFCANL_ENS=${SFCANL_ENS:-${COMOUT}/sfcanl_${CDATE}} - - - $FCPLN $DTFANL dtfanl - imem=1 - while [[ $imem -le $NMEM_ENKF ]]; do - member="_mem"`printf %03i $imem` - $FCPLN ${NSTGES_ENS}${member} nstf06${member} - $FCPLN ${SFCGES_ENS}${member} sfcf06${member} - if [ $NST_GSI -eq 3 ]; then - $FCPLN ${SFCGCY_ENS}${member} sfcgcy${member} - else - $FCPLN ${SFCANL_ENS}${member} sfcgcy${member} - fi - (( imem = $imem + 1 )) - done - - if [[ $FILESTYLE = 'L' ]]; then - imem=1 - while [[ $imem -le $NMEM_ENKF ]]; do - member="_mem"`printf %03i $imem` - ln -fs ${NSTANL_ENS}${member} nstanl${member} - if [ $NST_GSI -eq 3 ]; then - ln -fs ${SFCANL_ENS}${member} sfcanl${member} - fi - (( imem = $imem + 1 )) - done - fi - - rm stdout_recenter_sfcnstupd - if [[ "$POE" = "YES" ]]; then - poe $GETSFCNSTENSUPDEXEC $NANALS $NST_GSI $ZSEA1 $ZSEA2 > stdout_recenter_sfcnstupd - rc=$? - else - eval "$APRUN $GETSFCNSTENSUPDEXEC $NANALS $NST_GSI $ZSEA1 $ZSEA2 > stdout_recenter_sfcnstupd" - rc=$? - fi - - export ERR=$rc - export err=$ERR - $ERRSCRIPT||exit 2 - - if [[ $FILESTYLE = 'C' ]]; then - imem=1 - while [[ $imem -le $NMEM_ENKF ]]; do - member="_mem"`printf %03i $imem` - $NCP nstanl${member} ${NSTANL_ENS}${member} - $NCP sfcanl${member} ${SFCANL_ENS}${member} - (( imem = $imem + 1 )) - done - fi - - cat stdout_recenter_sfcnstupd -fi -################################################################################ -# Postprocessing -cd $pwd -[[ $mkdata = YES ]]&&rmdir $DATA -$ENDSCRIPT -set +x -if [[ "$VERBOSE" = "YES" ]]; then - echo $(date) EXITING $0 with return code $err >&2 -fi -exit $err diff --git a/scripts/exglobal_enkf_innovate_obs.sh.ecf b/scripts/exglobal_enkf_innovate_obs.sh.ecf deleted file mode 100755 index 18d5146d25..0000000000 --- a/scripts/exglobal_enkf_innovate_obs.sh.ecf +++ /dev/null @@ -1,632 +0,0 @@ -#!/bin/ksh -################################################################################ -#### UNIX Script Documentation Block -# . . -# Script name: global_enkfomg.sh -# Script description: Compute global_enkf innovations -# -# Author: Russ Treadonl Org: NP23 Date: 2011-12-16 -# -# Abstract: This script computes global_enkf innovations -# -# Script history log: -# 2011-12-16 Russ Treadon based on GCWMB parallel script eomg.sh -# 2014-02-16 Xu Li add NSST related variables -# -# Usage: exglobal_enkfomg.sh.sms SFCGESMEAN SIGGESMEAN -# -# Input script positional parameters: -# 1 Input surface guess -# defaults to $SFCGESMEAN; required -# 2 Input sigma guess -# defaults to $SIGGESMEAN; required -# -# Imported Shell Variables: -# SFCGESMEAN Input ensemble mean surface guess -# overridden by $1; required -# SIGGESMEAN Input ensemble mean sigma guess -# overridden by $2; required -# SELECT_OBS Tarball containing selected data -# defaults to ${COMIN}/${PREINP}obsinput -# SFCANL Output surface analysis -# defaults to ${COMOUT}/sfcanl -# SFCGCY Output intermideate surface analysis -# defaults to ${COMOUT}/sfcgcy -# SFCG03 Surface guess valid at -03 hour -# defaults to ${COMOUT}/sfcf03 -# SFCG04 Surface guess valid at -04 hour -# defaults to ${COMOUT}/sfcf04 -# SFCG05 Surface guess valid at -05 hour -# defaults to ${COMOUT}/sfcf05 -# SFCG07 Surface guess valid at -07 hour -# defaults to ${COMOUT}/sfcf07 -# SFCG08 Surface guess valid at -08 hour -# defaults to ${COMOUT}/sfcf08 -# SFCG09 Surface guess valid at -09 hour -# defaults to ${COMOUT}/sfcf09 -# NSTG03 NSST guess valid at -03 hour -# defaults to ${COMOUT}/sfcf03 -# NSTG04 NSST guess valid at -04 hour -# defaults to ${COMOUT}/sfcf04 -# NSTG05 NSST guess valid at -05 hour -# defaults to ${COMOUT}/sfcf05 -# NSTG07 NSST guess valid at -07 hour -# defaults to ${COMOUT}/sfcf07 -# NSTG08 NSST guess valid at -08 hour -# defaults to ${COMOUT}/sfcf08 -# NSTG09 NSST guess valid at -09 hour -# defaults to ${COMOUT}/sfcf09 -# SIGG03 Sigma guess valid at -03 hour -# defaults to ${COMOUT}/sigf03 -# SIGG04 Sigma guess valid at -04 hour -# defaults to ${COMOUT}/sigf04 -# SIGG05 Sigma guess valid at -05 hour -# defaults to ${COMOUT}/sigf05 -# SIGG07 Sigma guess valid at -07 hour -# defaults to ${COMOUT}/sigf07 -# SIGG08 Sigma guess valid at -08 hour -# defaults to ${COMOUT}/sigf08 -# SIGG09 Sigma guess valid at -09 hour -# defaults to ${COMOUT}/sigf09 -# DOHYBVAR flag (YES or N) for hybrid ensemble variational option -# defaults to NO -# USE_NEWRADBC Flag to use new radiance bias correction scheme (YES or NO) -# defaults to NO -# RADSTAT Output radiance assimilation statistics -# defaults to ${COMIN}/${PREINP}radstat -# GSISTAT Output gsi (obs-ges), qc, and iteration statistics -# defaults to ${COMIN}/${PREINP}gsistat -# PCPSTAT Output precipitation assimilation statistics -# defaults to ${COMIN}/${PREINP}pcpstat -# CNVSTAT Output conventional observation assimilation statistics -# defaults to ${COMIN}/${PREINP}cnvstat -# OZNSTAT Output ozone observation assimilation statistics -# defaults to ${COMIN}/${PREINP}oznstat -# RUN_SELECT Flag to only select data (YES or NO) -# defaults to NO -# USE_SELECT Flag to use selected data (YES or NO) -# defaults to NO -# DIAG_SUFFIX optional suffix for diagnostics files -# defaults to empty string -# DIAG_COMPRESS flag to compress (YES) diagnostics files -# defaults to YES -# DIAG_TARBALL flag to collect (YES) diagnostic files in tarballs -# defaults to YES -# FIXgsm Directory for global fixed files -# defaults to /nwprod/fix -# EXECgsm Directory for global executables -# defaults to /nwprod/exec -# USHgsm Directory for global ush scripts -# defaults to /nwprod/ush -# DATA working directory -# (if nonexistent will be made, used and deleted) -# defaults to current working directory -# COMIN input directory -# defaults to current working directory -# COMOUT output directory -# (if nonexistent will be made) -# defaults to current working directory -# XC Suffix to add to executables -# defaults to none -# PREINP Prefix to add to input observation files -# defaults to none -# SUFINP Suffix to add to input observation files -# defaults to none -# NCP Copy command -# defaults to cp -# SIGHDR Command to read sigma header -# defaults to ${EXECgsm}/global_sighdr$XC -# SFCHDR Command to read surface header -# defaults to ${EXECgsm}/global_sfchdr$XC -# NSTHDR Command to read NSST header -# defaults to ${EXECgsm}/global_nsthdr$XC -# CYCLEXEC Surface cycle executable -# defaults to ${EXECgsm}/global_cycle$XC -# GSIEXEC Spectral analysis executable -# defaults to ${EXECgsm}/global_gsi$XC -# CYCLESH Surface cycle script -# defaults to ${USHgsm}/global_cycle.sh -# BERROR Input background error file -# defaults to ${FIXgsm}/global_berror.l${LEVS}y${NLAT_A}.sig.f77 -# SATANGL Input satellite angle bias file -# defaults to ${FIXgsm}/global_satangbias.txt -# SATINFO Input satellite information file -# defaults to ${FIXgsm}/global_satinfo.txt -# RTMFIX Input directory containing CRTM coefficients -# defaults to ${FIXgsm}/crtm_v2.2.3 -# ANAVINFO Input analysis variable file -# defaults to ${FIXgsm}/global_anavinfo.l${LEVS}.txt -# CONVINFO Input conventional observation information file -# defaults to ${FIXgsm}/global_convinfo.txt -# INSITUINFO Input In Situ sea water temperature observation information file -# defaults to ${FIXgsm}/global_insituinfo.txt -# OZINFO Input ozone information file -# defaults to ${FIXgsm}/global_ozone.txt -# PCPINFO Input precipitation information file -# defaults to ${FIXgsm}/global_pcpinfo.txt -# AEROINFO Input aerosol information file -# defaults to ${FIXgsm}/global_aeroinfo.txt -# SCANINFO Input satellite scan information file -# defaults to ${FIXgsm}/global_scaninfo.txt -# HYBENSINFO Input hybrid ensemble localization information file -# defaults to ${FIXgsm}/global_hybens_locinfo.l${LEVS}.txt -# defaults to ${COMIN}/${PREINP}syndata.tcvitals.tm00 -# INISCRIPT Preprocessing script -# defaults to none -# LOGSCRIPT Log posting script -# defaults to none -# ERRSCRIPT Error processing script -# defaults to 'eval [[ $err = 0 ]]' -# ENDSCRIPT Postprocessing script -# defaults to none -# JCAP_A Spectral truncation for analysis -# defaults to the value in the input sigma file header -# JCAP Spectral truncation for background -# defaults to the value in the input sigma file header -# LEVS Number of levels -# DELTIM Timestep in seconds -# defaults to 3600/($JCAP_A/20) -# CDATE Current analysis date in yyyymmddhh format -# defaults to the value in the input surface file header -# LATB Number of latitudes in surface cycling -# defaults to the value in the input surface file header -# LONB Number of longitudes in surface cycling -# defaults to the value in the input surface file header -# LSOIL Number of soil layers -# defaults to 2 -# FSMCL2 Scale in days to relax to soil moisture climatology -# defaults to 60 -# DELTSFC Cycling frequency in hours -# defaults to forecast hour of $SFCGESMEAN -# LATA Number of latitudes in spectral analysis -# defaults to $LATB -# LONA Number of longitudes in spectral analysis -# defaults to $LONB -# CYCLVARS Other namelist inputs to the cycle executable -# defaults to none set -# NTHREADS Number of threads -# defaults to 1 -# NTHSTACK Size of stack per thread -# defaults to 1024000000 -# NTHREADS_GSI Number of threads for GSIEXEC -# defaults to 1 -# NTHSTACK_GSI Size of stack per thread for GSIEXEC -# defaults to 1024000000 -# FILESTYLE File management style flag -# ('C' to copy to/from $DATA, 'L' for symbolic links in $DATA, -# 'X' to use XLFUNIT or symbolic links where appropriate) -# defaults to 'X' -# PGMOUT Executable standard output -# defaults to $pgmout, then to '&1' -# PGMERR Executable standard error -# defaults to $pgmerr, then to '&1' -# pgmout Executable standard output default -# pgmerr Executable standard error default -# REDOUT standard output redirect ('1>' or '1>>') -# defaults to '1>', or to '1>>' to append if $PGMOUT is a file -# REDERR standard error redirect ('2>' or '2>>') -# defaults to '2>', or to '2>>' to append if $PGMERR is a file -# VERBOSE Verbose flag (YES or NO) -# defaults to NO -# -# Exported Shell Variables: -# PGM Current program name -# pgm -# ERR Last return code -# err -# -# Modules and files referenced: -# scripts : $INISCRIPT -# $LOGSCRIPT -# $ERRSCRIPT -# $ENDSCRIPT -# -# programs : $CYCLEXEC -# $GSIEXEC -# -# fixed data : $BERROR -# $SATANGL -# $SATINFO -# $RTMFIX -# $ANAVINFO -# $CONVINFO -# $INSITUINFO -# $OZINFO -# $PCPINFO -# $AEROINFO -# $SCANINFO -# $HYBENSINFO -# -# input data : $SFCGESMEAN -# $SIGGESMEAN -# $SELECT_OBS -# $SFCG03 -# $SFCG04 -# $SFCG05 -# $SFCG07 -# $SFCG08 -# $SFCG09 -# $NSTG03 -# $NSTG04 -# $NSTG05 -# $NSTG07 -# $NSTG08 -# $NSTG09 -# $SIGG03 -# $SIGG04 -# $SIGG05 -# $SIGG07 -# $SIGG08 -# $SIGG09 -# $FNTSFA -# $FNACNA -# $FNSNOA -# -# output data: $SFCANL -# $SFCGCY -# $RADSTAT -# $GSISTAT -# $PCPSTAT -# $CNVSTAT -# $OZNSTAT -# $PGMOUT -# $PGMERR -# -# Remarks: -# -# Condition codes -# 0 - no problem encountered -# >0 - some problem encountered -# -# Control variable resolution priority -# 1 Command line argument. -# 2 Environment variable. -# 3 Inline default. -# -# Attributes: -# Language: POSIX shell -# Machine: IBM SP -# -################################################################################ -# Set environment. -export VERBOSE=${VERBOSE:-"NO"} -if [[ "$VERBOSE" = "YES" ]] -then - echo $(date) EXECUTING $0 $* >&2 - set -x -fi -export machine=${machine:-IBMP6} -export machine=$(echo $machine|tr '[a-z]' '[A-Z]') - -# Command line arguments. -export SFCGESMEAN=${1:-${SFCGESMEAN:?}} -export SIGGESMEAN=${2:-${SIGGESMEAN:?}} -export NSTGESMEAN=${3:-${NSTGESMEAN:?}} -# Directories. -export HOMEDIR=${HOMEDIR:-$NWROOT} -export NWPROD=${NWPROD:-$HOMEDIR} -export FIXSUBDA=${FIXSUBDA:-fix/fix_am} -export FIXgsm=${FIXgsm:-$NWPROD/global_shared.${global_shared_ver}/fix/fix_am} -export EXECgsm=${EXECgsm:-$NWPROD/global_shared.${global_shared_ver}/exec} -export USHgsm=${USHgsm:-$NWPROD/global_shared.${global_shared_ver}/ush} -export FIXgsi=${FIXgsi:-$NWPROD/global_shared.${global_shared_ver}/fix} -export EXECgsi=${EXECgsi:-$NWPROD/global_shared.${global_shared_ver}/exec} -export utilscript=${utilscript:-$NWPROD/util/ush} -export DATA=${DATA:-$(pwd)} -export COMIN=${COMIN:-$(pwd)} -export COMOUT=${COMOUT:-$(pwd)} - -# Set script / GSI control parameters -export use_gfs_nemsio=${use_gfs_nemsio:-".false."} # run GSI with NEMSIO input/output - -# Scripts. -export ANALYSISSH=${ANALYSISSH:-$SCRGSI/exglobal_analysis.sh.sms} - -# Variables. -export XC=${XC} -export PREINP=${PREINP} -export SUFINP=${SUFINP} -export SIGHDR=${SIGHDR:-${EXECgsm}/global_sighdr$XC} -export SFCHDR=${SFCHDR:-${EXECgsm}/global_sfchdr$XC} -if [ $use_gfs_nemsio = .true. ]; then - export JCAP=${JCAP:-$($SIGHDR $SIGGESMEAN jcap |grep -i "jcap" |awk -F"= " '{print $2}' |awk -F" " '{print $1}')} - export JCAP_A=${JCAP_A:-$($SIGHDR $SIGGESMEAN jcap |grep -i "jcap" |awk -F"= " '{print $2}' |awk -F" " '{print $1}')} - export LATB=${LATB:-$($SFCHDR $SFCGESMEAN latr |grep -i "latr" |awk -F"= " '{print $2}' |awk -F" " '{print $1}')} - export LONB=${LONB:-$($SFCHDR $SFCGESMEAN lonr |grep -i "lonr" |awk -F"= " '{print $2}' |awk -F" " '{print $1}')} - export LEVS=${LEVS:-$($SIGHDR $SIGGESMEAN levs |grep -i "levs" |awk -F"= " '{print $2}' |awk -F" " '{print $1}')} -else - export JCAP=${JCAP:-$($SIGHDR $SIGGESMEAN JCAP||echo 0)} - export JCAP_A=${JCAP_A:-$($SIGHDR $SIGGESMEAN JCAP||echo 0)} - export LATB=${LATB:-$($SFCHDR $SFCGESMEAN LATB||echo 0)} - export LONB=${LONB:-$($SFCHDR $SFCGESMEAN LONB||echo 0)} - export LEVS=${LEVS:-$($SIGHDR $SIGGESMEAN LEVS||echo 0)} -fi -export LATA=${LATA:-$LATB} -export LONA=${LONA:-$LONB} -export NLAT_A=${NLAT_A:-$(($LATA+2))} -export NLON_A=${NLON_A:-$LONA} -export DELTIM=${DELTIM:-$((3600/($JCAP_A/20)))} -export USE_NEWRADBC=${USE_NEWRADBC:-"NO"} -export DOHYBVAR=${DOHYBVAR:-"NO"} -export DOIAU=${DOIAU:-"NO"} - -# Files. -export CYCLEXEC=${CYCLEXEC:-${EXECgsm}/global_cycle$XC} -export GSIEXEC=${GSIEXEC:-${EXECgsi}/global_gsi$XC} -export CYCLESH=${CYCLESH:-${USHgsm}/global_cycle.sh} -export BERROR=${BERROR:-${FIXgsi}/global_berror.l${LEVS}y${NLAT_A}.f77} -export SATANGL=${SATANGL:-${FIXgsi}/global_satangbias.txt} -export SATINFO=${SATINFO:-${FIXgsi}/global_satinfo.txt} -export RADCLOUDINFO=${RADCLOUDINFO:-${FIXgsi}/cloudy_radiance_info.txt} -export RTMFIX=${RTMFIX:-$NWROOT/lib/crtm/${crtm_ver}/fix} -export ANAVINFO=${ANAVINFO:-${FIXgsi}/global_anavinfo.l${LEVS}.txt} -export CONVINFO=${CONVINFO:-${FIXgsi}/global_convinfo.txt} -export INSITUINFO=${INSITUINFO:-${FIXgsi}/global_insituinfo.txt} -export OZINFO=${OZINFO:-${FIXgsi}/global_ozinfo.txt} -export PCPINFO=${PCPINFO:-${FIXgsi}/global_pcpinfo.txt} -export AEROINFO=${AEROINFO:-${FIXgsi}/global_aeroinfo.txt} -export SCANINFO=${SCANINFO:-${FIXgsi}/global_scaninfo.txt} -export HYBENSINFO=${HYBENSINFO:-${FIXgsi}/global_hybens_locinfo.l${LEVS}.txt} -export OBERROR=${OBERROR:-${FIXgsi}/prepobs_errtable.global} -export SELECT_OBS=${SELECT_OBS:-${COMIN}/obsinput_${CDATE}_ensmean} -export SFCG03=${SFCG03:-${COMOUT}/sfcf03} -export SFCG04=${SFCG04:-${COMOUT}/sfcf04} -export SFCG05=${SFCG05:-${COMOUT}/sfcf05} -export SFCG07=${SFCG07:-${COMOUT}/sfcf07} -export SFCG08=${SFCG08:-${COMOUT}/sfcf08} -export SFCG09=${SFCG09:-${COMOUT}/sfcf09} -export NSTG03=${NSTG03:-${COMOUT}/nstf03} -export NSTG04=${NSTG04:-${COMOUT}/nstf04} -export NSTG05=${NSTG05:-${COMOUT}/nstf05} -export NSTG07=${NSTG07:-${COMOUT}/nstf07} -export NSTG08=${NSTG08:-${COMOUT}/nstf08} -export NSTG09=${NSTG09:-${COMOUT}/nstf09} -export SIGG03=${SIGG03:-${COMOUT}/sigf03} -export SIGG04=${SIGG04:-${COMOUT}/sigf04} -export SIGG05=${SIGG05:-${COMOUT}/sigf05} -export SIGG07=${SIGG07:-${COMOUT}/sigf07} -export SIGG08=${SIGG08:-${COMOUT}/sigf08} -export SIGG09=${SIGG09:-${COMOUT}/sigf09} -export RADSTAT=${RADSTAT:-${COMOUT}/${PREINP}radstat} -export GSISTAT=${GSISTAT:-${COMOUT}/${PREINP}gsistat} -export PCPSTAT=${PCPSTAT:-${COMOUT}/${PREINP}pcpstat} -export CNVSTAT=${CNVSTAT:-${COMOUT}/${PREINP}cnvstat} -export OZNSTAT=${OZNSTAT:-${COMOUT}/${PREINP}oznstat} -export RUN_SELECT=${RUN_SELECT:-"NO"} -export USE_SELECT=${USE_SELECT:-"NO"} -export DIAG_SUFFIX=${DIAG_SUFFIX:-""} -export DIAG_COMPRESS=${DIAG_COMPRESS:-"YES"} -export DIAG_TARBALL=${DIAG_TARBALL:-"YES"} -export INISCRIPT=${INISCRIPT} -export ERRSCRIPT=${ERRSCRIPT:-'eval [[ $err = 0 ]]'} -export LOGSCRIPT=${LOGSCRIPT} -export ENDSCRIPT=${ENDSCRIPT} -# Other variables. -export LSOIL=${LSOIL:-2} -export FSMCL2=${FSMCL2:-60} -if [ $use_gfs_nemsio = .true. ]; then - export CDATE=${CDATE:-$($SFCHDR $SFCGESMEAN fcstdate | grep -i "fcstdate_ymdh" |awk -F= '{print $2}')} - export DELTSFC=${DELTSFC:-`$SFCHDR $SFCGESMEAN nfhour |awk -F" " '{print $2}'`} -else - export CDATE=${CDATE:-$($SFCHDR $SFCGESMEAN VDATE||echo 0)} - export DELTSFC=${DELTSFC:-$($SFCHDR $SFCGESMEAN FHOUR||echo 0)} -fi -export CYCLVARS=${CYCLVARS} -export SETUP_ENKF=${SETUP_ENKF:-""} -export GRIDOPTS_ENKF=${GRIDOPTS_ENKF:-""} -export BKGVERR_ENKF=${BKGVERR_ENKF:-""} -export ANBKGERR_ENKF=${ANBKGERR_ENKF:-""} -export JCOPTS_ENKF=${JCOPTS_ENKF:-""} -export STRONGOPTS_ENKF=${STRONGOPTS_ENKF:-""} -export OBSQC_ENKF=${OBSQC_ENKF:-""} -export OBSINPUT_ENKF=${OBSINPUT_ENKF:-""} -export SUPERRAD_ENKF=${SUPERRAD_ENKF:-""} -export SINGLEOB_ENKF=${SINGLEOB_ENKF:-""} -export LAGDATA_ENKF=${LAGDATA_ENKF:-""} -export HYBRID_ENSEMBLE_ENKF=${HYBRID_ENSEMBLE_ENKF:-""} -export RAPIDREFRESH_CLDSURF_ENKF=${RAPIDREFRESH_CLDSURF_ENKF:-""} -export CHEM_ENKF=${CHEM_ENKF:-""} -export SMOOTH_ENKF=${SMOOTH_ENKF:-"NO"} -export NTHREADS=${NTHREADS:-1} -export NTHSTACK=${NTHSTACK:-1024000000} -export NTHREADS_GSI=${NTHREADS_GSI:-1} -export NTHSTACK_GSI=${NTHSTACK_GSI:-1024000000} -export FILESTYLE=${FILESTYLE:-'X'} -export PGMOUT=${PGMOUT:-${pgmout:-'&1'}} -export PGMERR=${PGMERR:-${pgmerr:-'&2'}} -export OBERRFLAG=${OBERRFLAG:-.false.} -export NCP=${NCP:-cp} -if [ $machine = IBMP6 ] ; then - typeset -L1 l=$PGMOUT - [[ $l = '&' ]]&&a=''||a='>' - export REDOUT=${REDOUT:-'1>'$a} - typeset -L1 l=$PGMERR - [[ $l = '&' ]]&&a=''||a='>' - export REDERR=${REDERR:-'2>'$a} -else -##export REDOUT=${REDOUT:-'1>'} -##export REDERR=${REDERR:-'2>'} - typeset -L1 l=$PGMOUT - [[ $l = '&' ]]&&a=''||a='>' - export REDOUT=${REDOUT:-'1>'$a} - typeset -L1 l=$PGMERR - [[ $l = '&' ]]&&a=''||a='>' - export REDERR=${REDERR:-'2>'$a} -fi - -################################################################################ -# Preprocessing -$INISCRIPT -pwd=$(pwd) -if [[ -d $DATA ]] -then - mkdata=NO -else - mkdir -p $DATA - mkdata=YES -fi -cd $DATA||exit 99 -export DATATOP=$DATA - - -################################################################################ -# Copy or link input data -if [[ $FILESTYLE = 'C' ]] -then - $NCP $SELECT_OBS ./ -else - ln -fs $SELECT_OBS obs_input.tar -fi - - -################################################################################ -# Set output data - -EOMGGRP=$COMOUT/omgstat_${CDATE}_grp${ENSGRP} -rm -f $EOMGGRP - -################################################################################ -# Generate ensemble innovations -imem=$ENSBEG -while [[ $imem -le $ENSEND ]]; do - export RUN_SELECT=NO - export USE_SELECT=YES - export SELECT_OBS=${SELECT_OBS:-$DATATOP/obsinput_${CDATE}_ensmean} - export SETUP="miter=0,niter=1,lread_obs_save=.false.,lread_obs_skip=.true.,lwrite_predterms=.true.,lwrite_peakwt=.true.,reduce_diag=.true.,$SETUP_ENKF" - export GRIDOPTS="$GRIDOPTS $GRIDOPTS_ENKF" - export BKGVERR="bkgv_flowdep=.false.,$BKGVERR_ENKF" - export ANBKGERR="$ANBKGERR $ANBKGERR_ENKF" - export JCOPTS="$JCOPTS $JCOPTS_ENKF" - export STRONGOPTS="tlnmc_option=0,nstrong=0,nvmodes_keep=0,baldiag_full=.false.,baldiag_inc=.false.,$STRONGOPTS_ENKF" - export OBSQC="tcp_width=60.0,tcp_ermin=2.0,tcp_ermax=12.0,$OBSQC_ENKF" - export OBSINPUT="dmesh(1)=225.0,dmesh(2)=225.0,$OBSINPUT_ENKF" - export SUPERRAD="$SUPERRAD $SUPERRAD_ENKF" - export SINGLEOB="$SINGLEOB $SINGLEOB_ENKF" - export LAGDATA="$LAGDATA $LAGDATA_ENKF" - export HYBRID_ENSEMBLE="$HYBRID_ENSEMBLE $HYBRID_ENSEMBLE_ENKF" - export RAPIDREFRESH_CLDSURF="$RAPIDREFRESH_CLDSURF $RAPIDREFRESH_CLDSURF_ENKF" - export CHEM="$CHEM $CHEM_ENKF" - - export member="mem"`printf %03i $imem` - export DATA=$DATATOP/$member - export pgmoutm=$DATA/${pgmout:-pgmout.$member} - - export SFCG03=$COMINGES/bfg_${GDATE}_fhr03_${member} - export SFCG04=$COMINGES/bfg_${GDATE}_fhr04_${member} - export SFCG05=$COMINGES/bfg_${GDATE}_fhr05_${member} - export SFCG06=$COMINGES/bfg_${GDATE}_fhr06_${member} - export SFCG07=$COMINGES/bfg_${GDATE}_fhr07_${member} - export SFCG08=$COMINGES/bfg_${GDATE}_fhr08_${member} - export SFCG09=$COMINGES/bfg_${GDATE}_fhr09_${member} - export SFCGES=$COMINGES/bfg_${GDATE}_fhr06_${member} - - export NSTG03=$COMINGES/nfg_${GDATE}_fhr03_${member} - export NSTG04=$COMINGES/nfg_${GDATE}_fhr04_${member} - export NSTG05=$COMINGES/nfg_${GDATE}_fhr05_${member} - export NSTG06=$COMINGES/nfg_${GDATE}_fhr06_${member} - export NSTG07=$COMINGES/nfg_${GDATE}_fhr07_${member} - export NSTG08=$COMINGES/nfg_${GDATE}_fhr08_${member} - export NSTG09=$COMINGES/nfg_${GDATE}_fhr09_${member} - export NSTGES=$COMINGES/nfg_${GDATE}_fhr06_${member} - - ENKF_SUFFIX="" - if [[ "$SMOOTH_ENKF" = "YES" ]]; then - ENKF_SUFFIX="s" - fi - export SIGG03=$COMINGES/sfg_${GDATE}_fhr03${ENKF_SUFFIX}_${member} - export SIGG04=$COMINGES/sfg_${GDATE}_fhr04${ENKF_SUFFIX}_${member} - export SIGG05=$COMINGES/sfg_${GDATE}_fhr05${ENKF_SUFFIX}_${member} - export SIGG06=$COMINGES/sfg_${GDATE}_fhr06${ENKF_SUFFIX}_${member} - export SIGG07=$COMINGES/sfg_${GDATE}_fhr07${ENKF_SUFFIX}_${member} - export SIGG08=$COMINGES/sfg_${GDATE}_fhr08${ENKF_SUFFIX}_${member} - export SIGG09=$COMINGES/sfg_${GDATE}_fhr09${ENKF_SUFFIX}_${member} - export SIGGES=$COMINGES/sfg_${GDATE}_fhr06${ENKF_SUFFIX}_${member} - - export SIGANL=$DATA/sanl - export ABIAS=$DATA/abias - export ABIASPC=$DATA/abias_pc - export ABIASAIR=$DATA/abias_air - - export SFCGCY=$COMOUT/sfcgcy_${CDATE}_${member} - export SFCANL=$COMOUT/sfcanl_${CDATE}_${member} - export NSTANL=$COMOUT/nstanl_${CDATE}_${member} - export GSISTAT=$COMOUT/gsistat_${CDATE}_${member} - export RADSTAT=$COMOUT/radstat_${CDATE}_${member} - export OZNSTAT=$COMOUT/oznstat_${CDATE}_${member} - export PCPSTAT=$COMOUT/pcpstat_${CDATE}_${member} - export CNVSTAT=$COMOUT/cnvstat_${CDATE}_${member} - if [ $DOIAU = YES ]; then - export SFCA03=$COMOUT/sfca03_${CDATE}_${member} - fi - - export DIAG_SUFFIX="_${member}" - export DIAG_COMPRESS=NO - export DIAG_TARBALL=YES - export DOHYBVAR=NO - export HYBRID_ENSEMBLE=" " - - if [ -s $SFCANL ] ; then - rm -f $SFCANL - fi - if [ $DOIAU = YES && -s $SFCA03 ] ; then - rm -f $SFCA03 - fi - if [ -s $GSISTAT ] ; then - rm -f $GSISTAT - fi - if [ -s $RADSTAT ] ; then - rm -f $RADSTAT - fi - if [ -s $OZNSTAT ] ; then - rm -f $OZNSTAT - fi - if [ -s $PCPSTAT ] ; then - rm -f $PCPSTAT - fi - if [ -s $CNVSTAT ] ; then - rm -f $CNVSTAT - fi - - - $ANALYSISSH - rc=$? - - cat $pgmoutm - - export ERR=$rc - export err=$ERR - $ERRSCRIPT||exit 2 - - rm log - cp $DATATOP/log_all ./log_old - echo "Process member $imem" > log - cat log_old log > log_new - cp log_new $DATATOP/log_all - - if [ $SENDDBN = YES ]; then - $DBNROOT/bin/dbn_alert MODEL GFS_ENKF $job $SFCANL - fi - - (( imem = $imem + 1 )) - -done - - -################################################################################ -# Save log - -cd $DATATOP -cp log_all $EOMGGRP - - -################################################################################ -# Postprocessing -cd $pwd -[[ $mkdata = YES ]]&&rmdir $DATA -$ENDSCRIPT -set +x -if [[ "$VERBOSE" = "YES" ]] -then - echo $(date) EXITING $0 with return code $err >&2 -fi -exit $err diff --git a/scripts/exglobal_enkf_innovate_obs_fv3gfs.sh.ecf b/scripts/exglobal_enkf_innovate_obs_fv3gfs.sh.ecf deleted file mode 100755 index bd87811543..0000000000 --- a/scripts/exglobal_enkf_innovate_obs_fv3gfs.sh.ecf +++ /dev/null @@ -1,197 +0,0 @@ -#!/bin/ksh -################################################################################ -#### UNIX Script Documentation Block -# . . -# Script name: exglobal_enkf_innovate_obs_fv3gfs.sh.ecf -# Script description: Compute ensemble innovations -# -# Author: Rahul Mahajan Org: NCEP/EMC Date: 2017-03-02 -# -# Abstract: This script runs the innovation calculation script serially over ensemble members -# -# $Id$ -# -# Attributes: -# Language: POSIX shell -# Machine: WCOSS-Cray/Theia -# -################################################################################ - -# Set environment. -export VERBOSE=${VERBOSE:-"YES"} -if [ $VERBOSE = "YES" ] ; then - echo $(date) EXECUTING $0 $* >&2 - set -x -fi - -# Directories. -pwd=$(pwd) -export NWPROD=${NWPROD:-$pwd} -export HOMEgsi=${HOMEgsi:-$NWPROD} -export COMIN=${COMIN:-$pwd} -export COMIN_GES_ENS=${COMIN_GES_ENS:-$COMIN} -export COMOUT=${COMOUT:-$COMIN} -DATA=${DATA:-$pwd/enkf_innovate_obs.$$} - -# Utilities -export NCP=${NCP:-"/bin/cp -p"} -export NMV=${NMV:-"/bin/mv"} -export NLN=${NLN:-"/bin/ln -sf"} -export ERRSCRIPT=${ERRSCRIPT:-'eval [[ $err = 0 ]]'} - -# Scripts. -INVOBSSH=${INVOBSSH:-$HOMEgsi/scripts/exglobal_innovate_obs_fv3gfs.sh.ecf} -export ANALYSISSH=${ANALYSISSH:-$HOMEgsi/scripts/exglobal_analysis_fv3gfs.sh.ecf} - -# Enemble group, begin and end -ENSGRP=${ENSGRP:-1} -ENSBEG=${ENSBEG:-1} -ENSEND=${ENSEND:-1} - -# Cycling and forecast hour specific parameters -export CDATE=${CDATE:-"2001010100"} -export CDUMP=${CDUMP:-"gdas"} - -# Re-run failed members, or entire group -RERUN_EOMGGRP=${RERUN_EOMGGRP:-"YES"} - -# Ops related stuff -SENDECF=${SENDECF:-"NO"} - -export SMOOTH_ENKF=${SMOOTH_ENKF:-"YES"} -export USE_SELECT=${USE_SELECT:-"NO"} -export SELECT_OBS=${SELECT_OBS:-${COMOUT}/${APREFIX}obsinput} - -################################################################################ -# Preprocessing -mkdata=NO -if [ ! -d $DATA ]; then - mkdata=YES - mkdir -p $DATA -fi -cd $DATA || exit 99 -DATATOP=$DATA - -ENKF_SUFFIX="s" -[[ $SMOOTH_ENKF = "NO" ]] && ENKF_SUFFIX="" - -################################################################################ -# Set output data -EOMGGRP=$COMOUT/eomg.grp${ENSGRP} -if [ -f $EOMGGRP ]; then - if [ $RERUN_EOMGGRP = "YES" ]; then - rm -f $EOMGGRP - else - echo "RERUN_EOMGGRP = $RERUN_EOMGGRP, will re-run FAILED members only!" - $NMV $EOMGGRP ${EOMGGRP}.fail - fi -fi - -################################################################################ -# Save variables from over-writing -COMOUT_SAVE=$COMOUT - -################################################################################ -# If requested, link and de-tar obs_input -if [ $USE_SELECT = "YES" ]; then - rm -rf obsinput ; mkdir -p obsinput ; cd obsinput - $NLN $SELECT_OBS obsinput.tar - tar -xvf obsinput.tar - rm obsinput.tar - export SELECT_OBS=$DATA/obsinput - cd $DATA -fi - -################################################################################ -# Run innovation script for ensemble member -rc=0 -for imem in $(seq $ENSBEG $ENSEND); do - - cd $DATATOP - - cmem=$(printf %03i $imem) - memchar="mem$cmem" - - echo "Processing MEMBER: $cmem" - - ra=0 - - skip_mem="NO" - if [ -f ${EOMGGRP}.fail ]; then - memstat=$(cat ${EOMGGRP}.fail | grep "MEMBER $cmem" | grep "PASS" | wc -l) - [[ $memstat -eq 1 ]] && skip_mem="YES" - fi - - if [ $skip_mem = "NO" ]; then - - export DATA=$DATATOP/$memchar - [[ -d $DATA ]] && rm -rf $DATA - - export DIAG_SUFFIX="_$memchar" - export COMIN_GES=$COMIN_GES_ENS/$memchar - export COMOUT=$COMOUT_SAVE/$memchar - [[ ! -d $COMOUT ]] && mkdir -p $COMOUT - - export ATMG03="$COMIN_GES/${GPREFIX}atmf003${ENKF_SUFFIX}${GSUFFIX}" - export ATMG04="$COMIN_GES/${GPREFIX}atmf004${ENKF_SUFFIX}${GSUFFIX}" - export ATMG05="$COMIN_GES/${GPREFIX}atmf005${ENKF_SUFFIX}${GSUFFIX}" - export ATMGES="$COMIN_GES/${GPREFIX}atmf006${ENKF_SUFFIX}${GSUFFIX}" - export ATMG07="$COMIN_GES/${GPREFIX}atmf007${ENKF_SUFFIX}${GSUFFIX}" - export ATMG08="$COMIN_GES/${GPREFIX}atmf008${ENKF_SUFFIX}${GSUFFIX}" - export ATMG09="$COMIN_GES/${GPREFIX}atmf009${ENKF_SUFFIX}${GSUFFIX}" - - # Ensure clean tarballs for ensemble member - for ftype in cnvstat oznstat radstat; do - fstat=$COMOUT/${APREFIX}$ftype - [[ -f $fstat ]] && rm -f $fstat - done - - $INVOBSSH - ra=$? - ((rc+=ra)) - - # Notify a member observation innovation failed, freeze eupd, but continue on to next member - if [ $ra -ne 0 ]; then - msg="observation innovation of member $cmem FAILED" - echo $msg - [[ $SENDECF = "YES" ]] && ecflow_client --abort=$msg - fi - - fi - - cd $DATATOP - - $NCP $EOMGGRP log_old - rm log log_new - if [ $ra -ne 0 ]; then - echo "MEMBER $cmem : FAIL" > log - else - echo "MEMBER $cmem : PASS" > log - fi - cat log_old log > log_new - $NCP log_new $EOMGGRP - -done - -################################################################################ -# Echo status of ensemble group -cd $DATATOP -echo "Status of ensemble members in group $ENSGRP:" -cat $EOMGGRP -rm ${EOMGGRP}.fail - -################################################################################ -# If any members failed, error out -export ERR=$rc -export err=$ERR -$ERRSCRIPT || exit 2 - -################################################################################ -# Postprocessing -cd $pwd -[[ $mkdata = "YES" ]]&& rm -rf $DATATOP -set +x -if [ $VERBOSE = "YES" ] ; then - echo $(date) EXITING $0 with return code $err >&2 -fi -exit $err diff --git a/scripts/exglobal_enkf_post.sh.ecf b/scripts/exglobal_enkf_post.sh.ecf deleted file mode 100755 index 2b5675f8c7..0000000000 --- a/scripts/exglobal_enkf_post.sh.ecf +++ /dev/null @@ -1,599 +0,0 @@ -#!/bin/ksh -################################################################################ -#### UNIX Script Documentation Block -# . . -# Script name: exglobal_enkfpos.sh.sms -# Script description: global_enkf forecast post processing -# -# Author: Russ Treadon Org: NP23 Date: 2011-12-16 -# -# Abstract: This script runs the global_enkf forecast post processing -# -# Script history log: -# 2011-12-16 Russ Treadon based on GCWMB parallel script epos.sh -# 2014-05-16 Xu Li Add NSST -# -# Usage: exglobal_enkfpos.sh.sms -# -# Input script positional parameters: -# defaults to $IGEN, then to 0 -# -# Imported Shell Variables: -# FIXgsm Directory for global fixed files -# defaults to /nwprod/fix -# EXECgsm Directory for global executables -# defaults to /nwprod/exec -# USHgsm Directory for global scripts -# defaults to /nwprod/ush -# DATA working directory -# (if nonexistent will be made, used and deleted) -# defaults to current working directory -# COMIN input directory -# defaults to current working directory -# COMOUT output directory -# (if nonexistent will be made) -# defaults to current working directory -# XC Suffix to add to executables -# defaults to none -# NCP Copy command -# defaults to cp -# GETATMENSMEANEXEC Compute ensemble mean sigma (optonally smoothed) -# defaults to ${EXECgsm}/getsigensmeanp_smooth$XC -# GETSFCENSMEANEXEC Compute ensemble mean surface file -# defaults to ${EXECgsm}/getsfcensmeanp$XC -# GETNSTENSMEANEXEC Compute ensemble mean NSST file -# defaults to ${EXECgsm}/getnstensmeanp$XC -# HYBENSMOOTH Input level dependent smoothing paramters for sigma file -# defaults to ${FIXgsm}/global_hybens_smoothinfo.l${LEVS}.txt -# INISCRIPT Preprocessing script -# defaults to none -# LOGSCRIPT Log posting script -# defaults to none -# ERRSCRIPT Error processing script -# defaults to 'eval [[ $err = 0 ]]' -# ENDSCRIPT Postprocessing script -# defaults to none -# LEVS Number of levels -# defaults to 64 -# CDATE Current analysis date in yyyymmddhh format -# defaults to the value in the input surface file header -# NTHREADS Number of threads -# defaults to 1 -# NTHSTACK Size of stack per thread -# defaults to 1024000000 -# FILESTYLE File management style flag -# ('C' to copy to/from $DATA, 'L' for symbolic links in $DATA, -# 'X' to use XLFUNIT or symbolic links where appropriate) -# defaults to 'X' -# PGMOUT Executable standard output -# defaults to $pgmout, then to '&1' -# PGMERR Executable standard error -# defaults to $pgmerr, then to '&1' -# pgmout Executable standard output default -# pgmerr Executable standard error default -# REDOUT standard output redirect ('1>' or '1>>') -# defaults to '1>', or to '1>>' to append if $PGMOUT is a file -# REDERR standard error redirect ('2>' or '2>>') -# defaults to '2>', or to '2>>' to append if $PGMERR is a file -# VERBOSE Verbose flag (YES or NO) -# defaults to NO -# -# Exported Shell Variables: -# PGM Current program name -# pgm -# ERR Last return code -# err -# -# Modules and files referenced: -# scripts : $INISCRIPT -# $LOGSCRIPT -# $ERRSCRIPT -# $ENDSCRIPT -# -# programs : $GETATMENSMEANEXEC -# $GETATMENSMEANEXEC -# -# fixed data : $HYBENSMOOTH -# -# input data : -# -# output data: -# -# Remarks: -# -# Condition codes -# 0 - no problem encountered -# >0 - some problem encountered -# -# Control variable resolution priority -# 1 Command line argument. -# 2 Environment variable. -# 3 Inline default. -# -# Attributes: -# Language: POSIX shell -# Machine: IBM SP -# -################################################################################ -# Set environment. -export VERBOSE=${VERBOSE:-"NO"} -if [[ "$VERBOSE" = "YES" ]] -then - echo $(date) EXECUTING $0 $* >&2 - set -x -fi -export machine=${machine:-IBMP6} -export machine=$(echo $machine|tr '[a-z]' '[A-Z]') - -# Command line arguments. -# none -# Directories. -export HOMEDIR=${HOMEDIR:-$NWROOT} -export NWPROD=${NWPROD:-$HOMEDIR} -export FIXgsm=${FIXgsm:-$NWPROD/global_shared.${global_shared_ver}/fix/fix_am} -export EXECgsm=${EXECgsm:-$NWPROD/global_shared.${global_shared_ver}/exec} -export USHgsm=${USHgsm:-$NWPROD/global_shared.${global_shared_ver}/ush} -export FIXgsi=${FIXgsi:-$NWPROD/global_shared.${global_shared_ver}/fix} -export EXECgdas=${EXECgdas:-$NWPROD/gdas.${gdas_ver}/exec} -export USHgdas=${USHgdas:-$NWPROD/gdas.${gdas_ver}/ush} -export DATA=${DATA:-$(pwd)} -export COMIN=${COMIN:-$(pwd)} -export COMOUT=${COMOUT:-$(pwd)} -# Set script / EnKF update control parameters -export use_gfs_nemsio=${use_gfs_nemsio:-".false."} # run script with NEMSIO input/output -# Filenames. -export XC=${XC:-".x"} -export LEVS=${LEVS:-64} -export INISCRIPT=${INISCRIPT} -export ERRSCRIPT=${ERRSCRIPT:-'eval [[ $err = 0 ]]'} -export LOGSCRIPT=${LOGSCRIPT} -export ENDSCRIPT=${ENDSCRIPT} -export HYBENSMOOTH=${HYBENSMOOTH:-$FIXgsi/global_hybens_smoothinfo.l${LEVS}.txt} -export SFCHDR=${SFCHDR:-${EXECgsm}/global_sfchdr$XC} -# I/O filenames. -if [ $use_gfs_nemsio = .true. ]; then - export CDATE=${CDATE:-$($SFCHDR $SFCGES fcstdate | grep -i "fcstdate_ymdh" |awk -F= '{print $2}')} -else - export CDATE=${CDATE:-$($SFCHDR $SFCGES VDATE||echo 0)} -fi -export SIGENS_IN=${SIGENS_IN:-$COMIN/sfg_${CDATE}_fhr} -export SFCENS=${SFCENS:-$COMIN/bfg_${CDATE}_fhr} -export ENSSTAT=${ENSSTAT:-$COMOUT/ensstat_${CDATE}_all} -export SIGENSMEAN=${SIGENSMEAN:-$COMOUT/sfg_${CDATE}_fhr} -export SFCENSMEAN=${SFCENSMEAN:-$COMOUT/bfg_${CDATE}_fhr} -export SIGENS_OUT=${SIGENS_OUT:-${COMOUT}/sfg_${CDATE}_fhr} -# Executables. -export GETATMENSMEANEXEC=${GETATMENSMEANEXEC:-$EXECgdas/getsigensmean_smoothp$XC} -export GETSFCENSMEANEXEC=${GETSFCENSMEANEXEC:-$EXECgdas/getsfcensmeanp$XC} -export GETATMENSSTATEXEC=${GETATMENSSTATEXEC:-$EXECgdas/getsigensstatp$XC} -export NSTENS=${NSTENS:-$COMIN/nfg_${CDATE}_fhr} -export NSTENSMEAN=${NSTENSMEAN:-$COMOUT/nfg_${CDATE}_fhr} -export GETNSTENSMEANEXEC=${GETNSTENSMEANEXEC:-$EXECgdas/getnstensmeanp$XC} -# Other variables. -export FHOUTEFCS=${FHOUT_ENKF:-3} -export FHMINEFCS=${FHMIN_ENKF:-3} -export FHMAXEFCS=${FHMAX_ENKF:-9} -export NMEM_ENKF=${NMEM_ENKF:-80} -export SMOOTH_ENKF=${SMOOTH_ENKF:-"NO"} -export MPMD=${MPMD:-NO} -export MPMD_OPTS=${MPMD_OPTS:-"-pgmmodel mpmd -ilevel 2 -labelio yes -stdoutmode ordered"} -export NTHREADS_EPOS=${NTHREADS_EPOS:-1} -export NTHSTACK=${NTHSTACK:-1024000000} -export FILESTYLE=${FILESTYLE:-'X'} -export PGMOUT=${PGMOUT:-${pgmout:-'&1'}} -export PGMERR=${PGMERR:-${pgmerr:-'&2'}} -export NCP=${NCP:-cp} -export APRUN=${APRUN:-""} -export NST_GSI=${NST_GSI:-0} - -if [ $machine = IBMP6 ] ; then - typeset -L1 l=$PGMOUT - [[ $l = '&' ]]&&a=''||a='>' - export REDOUT=${REDOUT:-'1>'$a} - typeset -L1 l=$PGMERR - [[ $l = '&' ]]&&a=''||a='>' - export REDERR=${REDERR:-'2>'$a} -else - export REDOUT=${REDOUT:-'1>'} - export REDERR=${REDERR:-'2>'} -fi -export l4densvar=${l4densvar:-".false."} - -ENKF_SUFFIX="" -if [[ "$SMOOTH_ENKF" = "YES" ]]; then - ENKF_SUFFIX="s" -fi - - -################################################################################ -# Preprocessing -$INISCRIPT -pwd=$(pwd) -if [[ -d $DATA ]] -then - mkdata=NO -else - mkdir -p $DATA - mkdata=YES -fi -cd $DATA||exit 99 - - -################################################################################ -# Copy or link files -if [ $machine = IBMP6 ] ; then - export XLSMPOPTS="parthds=$NTHREADS_EPOS:stack=$NTHSTACK" -fi -export OMP_NUM_THREADS=$NTHREADS_EPOS - -export XLSMPOPTS="stack=$NTHSTACK" -$LOGSCRIPT - -rm getsigensmean_smooth.x getsfcensmean_smooth.x hybens_smoothinfo -rm sfg*fhr03* sfg*fhr04* sfg*fhr05* sfg*fhr06* sfg*fhr07* sfg*fhr08* sfg*fhr09* -rm bfg*fhr03* bfg*fhr04* bfg*fhr05* bfg*fhr06* bfg*fhr07* bfg*fhr08* bfg*fhr09* -rm nfg*fhr03* nfg*fhr04* nfg*fhr05* nfg*fhr06* nfg*fhr07* nfg*fhr08* nfg*fhr09* - - -$NCP $GETSFCENSMEANEXEC $DATA -$NCP $GETATMENSMEANEXEC $DATA -$NCP $GETATMENSSTATEXEC $DATA -if [ $NST_GSI -gt 0 ]; then - $NCP $GETNSTENSMEANEXEC $DATA -fi - -if [[ $FILESTYLE = 'C' ]] -then - # Forecast fields - - FHOUT=$FHOUTEFCS - FHMIN=$FHMINEFCS - FHMAX=$FHMAXEFCS - imem=1 - while [[ $imem -le $NMEM_ENKF ]]; do - member="_mem"`printf %03i $imem` - FHBEG=$FHMIN - FHEND=$FHMAX - FH=$FHBEG - until [[ $FH -gt $FHEND ]];do - [[ $FH -lt 10 ]]&&FH=0$FH - $NCP ${SFCENS}${FH}${member} bfg_${CDATE}_fhr${FH}$member - $NCP ${SIGENS_IN}${FH}${member} sfg_${CDATE}_fhr${FH}$member - if [ $NST_GSI -gt 0 ]; then - $NCP ${NSTENS}${FH}${member} nfg_${CDATE}_fhr${FH}$member - fi - FH=`expr $FH + $FHOUT` - done - (( imem = $imem + 1 )) - done - -else - # Forecast fields - FHOUT=$FHOUTEFCS - FHMIN=$FHMINEFCS - FHMAX=$FHMAXEFCS - - imem=1 - while [[ $imem -le $NMEM_ENKF ]]; do - member="_mem"`printf %03i $imem` - FHBEG=$FHMIN - FHEND=$FHMAX - FH=$FHBEG - until [[ $FH -gt $FHEND ]];do - [[ $FH -lt 10 ]]&&FH=0$FH - ln -fs ${SFCENS}${FH}${member} bfg_${CDATE}_fhr${FH}$member - ln -fs ${SIGENS_IN}${FH}${member} sfg_${CDATE}_fhr${FH}$member - if [ $NST_GSI -gt 0 ]; then - ln -fs ${NSTENS}${FH}${member} nfg_${CDATE}_fhr${FH}$member - fi - FH=`expr $FH + $FHOUT` - done - (( imem = $imem + 1 )) - done - - # Output files - FHBEG=$FHMIN - FHEND=$FHMAX - FH=$FHBEG - until [[ $FH -gt $FHEND ]];do - [[ $FH -lt 10 ]]&&FH=0$FH - ln -fs ${SIGENSMEAN}${FH}_ensmean sfg_${CDATE}_fhr${FH}_ensmean - ln -fs ${SFCENSMEAN}${FH}_ensmean bfg_${CDATE}_fhr${FH}_ensmean - ln -fs ${SIGENSMEAN}${FH}_ensmean.nc4 sfg_${CDATE}_fhr${FH}_ensmean.nc4 - ln -fs ${SIGENSMEAN}${FH}_ensspread.nc4 sfg_${CDATE}_fhr${FH}_ensspread.nc4 - if [ $NST_GSI -gt 0 ]; then - ln -fs ${NSTENSMEAN}${FH}_ensmean nfg_${CDATE}_fhr${FH}_ensmean - fi - FH=`expr $FH + $FHOUT` - done - if [[ "$SMOOTH_ENKF" = "YES" ]]; then - imem=1 - while [[ $imem -le $NMEM_ENKF ]]; do - member="_mem"`printf %03i $imem` - FHBEG=$FHMIN - FHEND=$FHMAX - FH=$FHBEG - until [[ $FH -gt $FHEND ]];do - [[ $FH -lt 10 ]]&&FH=0$FH - ln -fs ${SIGENS_OUT}${FH}${ENKF_SUFFIX}${member} sfg_${CDATE}_fhr${FH}${ENKF_SUFFIX}$member - FH=`expr $FH + $FHOUT` - done - (( imem = $imem + 1 )) - done - fi -fi - -################################################################################ -# Set output data -ENSSTAT=$COMOUT/ensstat_${CDATE}_all -rm -f $ENSSTAT - - -################################################################################ -# Generate ensemble mean surface and atmospheric files -analdate=$CDATE -datapath=. -FHBEG=$FHMIN -FHEND=$FHMAX -FH=$FHBEG - -if [[ "$SMOOTH_ENKF" = "YES" ]]; then - cp $HYBENSMOOTH ./hybens_smoothinfo -fi - -if [[ "$MPMD" = "YES" ]]; then - if [ $machine = IBMP6 ] ; then - nprocs=$(echo $LOADL_PROCESSOR_LIST|wc -w) - elif [ $machine = WCOSS ] ; then - nprocs=$LSB_DJOB_NUMPROC - fi - FHBEG=$FHMINEFCS - FHEND=$FHMAXEFCS - FHOUT=$FHOUTEFCS - FH=$FHMIN - cnt=0 - ncnt=-1 - until [[ $FH -gt $FHEND ]];do - [[ $FH -lt 10 ]]&&FH=0$FH - cmd[$cnt]="$GETSFCENSMEANEXEC ${datapath}/ bfg_${analdate}_fhr${FH}_ensmean bfg_${analdate}_fhr${FH} $NMEM_ENKF" - cmd[$cnt]="$GETATMENSMEANEXEC ${datapath}/ sfg_${analdate}_fhr${FH}_ensmean sfg_${analdate}_fhr${FH} $NMEM_ENKF" - cmd[$cnt]="$GETATMENSSTATEXEC ${datapath}/ sfg_${analdate}_fhr${FH} $NMEM_ENKF" - if [ $NST_GSI -gt 0 ]; then - cmd[$cnt]="$GETNSTENSMEANEXEC ${datapath}/ nfg_${analdate}_fhr${FH}_ensmean nfg_${analdate}_fhr${FH} $NMEM_ENKF" - fi - ((cnt+=1)) - ((ncnt+=1)) - FH=`expr $FH + $FHOUT` - done - - rm $DATA/cmdfile - m=-1 - n=0 - while [ $((n+=1)) -le $nprocs ] ;do - while [ $((m+=1)) -le $ncnt ] ;do - echo "${cmd[m]}" >> $DATA/cmdfile - ((n+=1)) - done - if [ $n -le $nprocs ] ; then - echo "echo do-nothing" >> $DATA/cmdfile - fi - done - if [ $machine = IBMP6 ] ; then - /usr/bin/poe -cmdfile $DATA/cmdfile $MPMD_OPTS - rc=$? - elif [ $machine = WCOSS ]; then - export MP_PGMMODEL=${MP_PGMMODEL:-mpmd} - export MP_CMDFILE=$DATA/cmdfile - $APRUN - rc=$? - fi -else -# Run serially instead - - FHBEG=$FHMINEFCS - FHEND=$FHMAXEFCS - FHOUT=$FHOUTEFCS - FH=$FHMIN - rc=0 - until [[ $FH -gt $FHEND ]];do - [[ $FH -lt 10 ]]&&FH=0$FH - eval "$APRUN $GETSFCENSMEANEXEC ${datapath}/ bfg_${analdate}_fhr${FH}_ensmean bfg_${analdate}_fhr${FH} $NMEM_ENKF" - eval "$APRUN $GETATMENSMEANEXEC ${datapath}/ sfg_${analdate}_fhr${FH}_ensmean sfg_${analdate}_fhr${FH} $NMEM_ENKF" - eval "$APRUN $GETATMENSSTATEXEC ${datapath}/ sfg_${analdate}_fhr${FH} $NMEM_ENKF" - if [ $NST_GSI -gt 0 ]; then - eval "$APRUN $GETNSTENSMEANEXEC ${datapath}/ nfg_${analdate}_fhr${FH}_ensmean nfg_${analdate}_fhr${FH} $NMEM_ENKF" - fi - ra=$? - ((rc+=ra)) - FH=`expr $FH + $FHOUT` - done -fi -export ERR=$rc -export err=$ERR -$ERRSCRIPT||exit 2 - -################################################################################ -# If smoothing on but no smoothing output, copy smoothed enkf atmospheric files -if [[ "$SMOOTH_ENKF" = "YES" ]]; then - if [[ ! -s sfg_${CDATE}_fhr06s_mem001 ]]; then - FILEPREFIX=sfg_${CDATE}_fhr - if [[ $FILESTYLE = 'L' ]] then - FILEPREFIX=${SIGENS_OUT} - fi - imem=1 - while [[ $imem -le $NMEM_ENKF ]]; do - member="_mem"`printf %03i $imem` - FHBEG=$FHMIN - FHEND=$FHMAX - FH=$FHBEG - until [[ $FH -gt $FHEND ]];do - [[ $FH -lt 10 ]]&&FH=0$FH - cp sfg_${CDATE}_fhr${FH}$member ${FILEPREFIX}${FH}${ENKF_SUFFIX}$member - FH=`expr $FH + $FHOUT` - done - (( imem = $imem + 1 )) - done - fi -fi - -################################################################################ -# Copy output files -if [[ $FILESTYLE = 'C' ]] -then - FHBEG=$FHMIN - FHEND=$FHMAX - FH=$FHBEG - until [[ $FH -gt $FHEND ]];do - [[ $FH -lt 10 ]]&&FH=0$FH - cp sfg_${CDATE}_fhr${FH}_ensmean ${SIGENSMEAN}${FH}_ensmean - cp bfg_${CDATE}_fhr${FH}_ensmean ${SFCENSMEAN}${FH}_ensmean - cp sfg_${CDATE}_fhr${FH}_ensmean.nc4 ${SIGENSMEAN}${FH}_ensmean.nc4 - cp sfg_${CDATE}_fhr${FH}_ensspread.nc4 ${SIGENSMEAN}${FH}_ensspread.nc4 - if [ $NST_GSI -gt 0 ]; then - cp nfg_${CDATE}_fhr${FH}_ensmean ${NSTENSMEAN}${FH}_ensmean - fi - FH=`expr $FH + $FHOUT` - done - - imem=1 - while [[ $imem -le $NMEM_ENKF ]]; do - member="_mem"`printf %03i $imem` - FHBEG=$FHMIN - FHEND=$FHMAX - FH=$FHBEG - until [[ $FH -gt $FHEND ]];do - [[ $FH -lt 10 ]]&&FH=0$FH - cp sfg_${CDATE}_fhr${FH}${ENKF_SUFFIX}$member ${SIGENS_OUT}${FH}${ENKF_SUFFIX}${member} - FH=`expr $FH + $FHOUT` - done - (( imem = $imem + 1 )) - done -fi - -################################################################################ -# If requested, generate low resolution fhr06 ensemble mean and ensemble member -# files - -export JCAP_ENKF=${JCAP_ENKF:-574} -export JCAP_LORES=${JCAP_LORES:-254} -export LATB_LORES=${LATB_LORES:-384} -export LONB_LORES=${LONB_LORES:-768} -export LEVS_LORES=${LEVS_LORES:-64} - -export OROGRAPHY_LORES=$FIXgsm/global_orography.t$JCAP_LORES.$LONB_LORES.$LATB_LORES.grb -export OROGRAPHY_UF_LORES=$FIXgsm/global_orography_uf.t$JCAP_LORES.$LONB_LORES.$LATB_LORES.grb -export LONSPERLAT_LORES=$FIXgsm/global_lonsperlat.t${JCAP_LORES}.$LONB_LORES.$LATB_LORES.txt -export SLMASK_LORES=$FIXgsm/global_slmask.t$JCAP_LORES.$LONB_LORES.$LATB_LORES.grb -export MTNVAR_LORES=$FIXgsm/global_mtnvar.t$JCAP_LORES.$LONB_LORES.$LATB_LORES.f77 -export SIGLEVEL_LORES=$FIXgsm/global_hyblev.l${LEVS_LORES}.txt - - -if [[ "$JCAP_LORES" -lt "$JCAP_ENKF" ]]; then - fhrlist="06" - if [ $l4densvar = .true. ]; then - fhrlist="03 06 09" - fi - for fhr in $fhrlist; do - rm -rf $DATA/poescript.$fhr - member="ensmean" - export SIGINP=${SIGENS_OUT}${fhr}_${member} - export SIGOUT=${SIGENS_OUT}${fhr}_${member}_t${JCAP_LORES} - echo "$USHgdas/gfs_truncate_enkf.sh $member $SIGINP $SIGOUT $JCAP_LORES $LATB_LORES $LONB_LORES" >> $DATA/poescript.$fhr - imem=1 - while [[ $imem -le $NMEM_ENKF ]]; do - member="mem"`printf %03i $imem` - export SIGINP=${SIGENS_OUT}${fhr}${ENKF_SUFFIX}_${member} - export SIGOUT=${SIGENS_OUT}${fhr}${ENKF_SUFFIX}_${member}_t${JCAP_LORES} - echo "$USHgdas/gfs_truncate_enkf.sh $member $SIGINP $SIGOUT $JCAP_LORES $LATB_LORES $LONB_LORES" >> $DATA/poescript.$fhr - (( imem = $imem + 1 )) - done - chmod 755 poescript.$fhr - if [ $machine = WCOSS ] ; then - export MP_PGMMODEL=mpmd - export MP_CMDFILE=$DATA/poescript.$fhr - mpirun.lsf - export err=$?; err_chk - else - $DATA/poescript.$fhr - export err=$? - fi - done -fi - - - -################################################################################ -# Generate status log -rm log_allsfc -rm log_allatm - -FHBEG=$FHMIN -FHEND=$FHMAX -FH=$FHBEG -until [[ $FH -gt $FHEND ]];do - [[ $FH -lt 10 ]]&&FH=0$FH - if [[ `expr $FH % 3` -eq 0 ]]; then - - if [[ -s ${datapath}/bfg_${analdate}_fhr${FH}_ensmean ]]; then - if [ $SENDDBN = YES ]; then - $DBNROOT/bin/dbn_alert MODEL GFS_ENKF $job ${SFCENSMEAN}${FH}_ensmean - fi - string="DONE bfg fhr $FH" - else - string="MISS bfg fhr $FH" - fi - fi - rm log log_old log_new - cp log_allsfc ./log_old - echo $string > log - cat log_old log > log_new - cp log_new log_allsfc - - if [[ -s ${datapath}/sfg_${analdate}_fhr${FH}_ensmean ]]; then - string="DONE sfg fhr $FH" - else - string="MISS sfg fhr $FH" - fi - rm log log_old log_new - cp log_allatm ./log_old - echo $string > log - cat log_old log > log_new - cp log_new log_allatm - - FH=`expr $FH + $FHOUT` -done - -rm log_all -cat log_allsfc log_allatm > log_all -cp log_all $ENSSTAT - -if [ $SENDDBN = YES ] ; then -imem=1 -while [[ $imem -le $NMEM_ENKF ]]; do - member="_mem"`printf %03i $imem` - #FHBEG=$FHMIN - FHEND=$FHMAX - FH=6 - until [[ $FH -gt $FHEND ]];do - [[ $FH -lt 10 ]]&&FH=0$FH - if [[ `expr $FH % 3` -eq 0 ]] - then - $DBNROOT/bin/dbn_alert MODEL GFS_ENKF $job ${SIGENS_OUT}${FH}${ENKF_SUFFIX}${member} - fi - FH=`expr $FH + $FHOUT` - done - (( imem = $imem + 1 )) -done -fi - -################################################################################ -# Postprocessing -cd $pwd -[[ $mkdata = YES ]]&&rmdir $DATA -$ENDSCRIPT -set +x -if [[ "$VERBOSE" = "YES" ]] -then - echo $(date) EXITING $0 with return code $err >&2 -fi -exit $err diff --git a/scripts/exglobal_enkf_update.sh.ecf b/scripts/exglobal_enkf_update.sh.ecf deleted file mode 100755 index 0e98b8c6d8..0000000000 --- a/scripts/exglobal_enkf_update.sh.ecf +++ /dev/null @@ -1,607 +0,0 @@ -#!/bin/ksh -################################################################################ -#### UNIX Script Documentation Block -# . . -# Script name: exglobal_enkfupdat.sh.sms -# Script description: Make global_enkf update -# -# Author: Daryl Kleist Org: NP23 Date: 2011-03-24 -# -# Abstract: This script runs the global_enkf update -# -# Script history log: -# 2011-03-24 Russ Treadon copy from enkf/trunk/scripts_ncep -# -# Usage: exglobal_enkfupdat.sh.sms SFCGES SIGGES GBIAS GBIASE -# -# Input script positional parameters: -# 1 Input surface guess -# defaults to $SFCGES; required -# 2 Input sigma guess -# defaults to $SIGGES; required -# 3 Input guess time dependent bias correction coefficients -# defaults to $GBIAS; required -# 4 Input guess angle dependent bias correction -# defaults to $GBIASE; required -# -# Imported Shell Variables: -# SFCGES Input ensemble mean surface guess -# overridden by $1; required -# SIGGES Input ensemble mean sigma guess -# overridden by $2; required -# GBIAS Input guess bias correction -# overridden by $3; required -# GBIASE Input guess angle dependent bias correction -# overridden by $4; required -# ENKFSTAT Output enkf update statistics -# defaults to ${COMIN}/${PREINP}enkfstat -# FIXGSM Directory for global fixed files -# defaults to /nwprod/fix -# EXECgsm Directory for global executables -# defaults to /nwprod/exec -# DATA working directory -# (if nonexistent will be made, used and deleted) -# defaults to current working directory -# COMIN input directory -# defaults to current working directory -# COMOUT output directory -# (if nonexistent will be made) -# defaults to current working directory -# XC Suffix to add to executables -# defaults to none -# PREINP Prefix to add to input observation files -# defaults to none -# SUFINP Suffix to add to input observation files -# defaults to none -# NCP Copy command -# defaults to cp -# SIGHDR Command to read sigma header -# defaults to ${EXECgsm}/global_sighdr$XC -# SFCHDR Command to read surface header -# defaults to ${EXECgsm}/global_sfchdr$XC -# ENKFUPDEXEC Spectral analysis executable -# defaults to ${EXECgsm}/global_enkf$XC -# SATINFO Input satellite information file -# defaults to ${FIXgsi}/global_satinfo.txt -# CONVINFO Input conventional observation information file -# defaults to ${FIXgsi}/global_convinfo.txt -# OZINFO Input ozone information file -# defaults to ${FIXgsi}/global_ozone.txt -# SCANINFO Input satellite scan information file -# defaults to ${FIXgsi}/global_scaninfo.txt -# HYBENSINFO Input hybrid ensemble localization information file -# defaults to ${FIXgsi}/global_hybens_locinfo.l${LEVS}.txt -# ANAVINFO Input control vector information file -# defaults to ${FIXgsi}/global_anavinfo.l64.txt -# TCVITL Input tcvitals file -# defaults to ${COMIN}/${PREINP}syndata.tcvitals.tm00 -# INISCRIPT Preprocessing script -# defaults to none -# LOGSCRIPT Log posting script -# defaults to none -# ERRSCRIPT Error processing script -# defaults to 'eval [[ $err = 0 ]]' -# ENDSCRIPT Postprocessing script -# defaults to none -# LEVS Number of levels -# CDATE Current analysis date in yyyymmddhh format -# defaults to the value in the input surface file header -# LATB Number of latitudes in surface cycling -# defaults to the value in the input surface file header -# LONB Number of longitudes in surface cycling -# defaults to the value in the input surface file header -# LATA Number of latitudes in spectral analysis -# defaults to $LATB -# LONA Number of longitudes in spectral analysis -# defaults to $LONB -# NTHREADS Number of threads -# defaults to 1 -# NTHSTACK Size of stack per thread -# defaults to 1024000000 -# NTHREADS_ENKF Number of threads for ENKFUPDEXEC -# defaults to 1 -# NTHSTACK_ENKF Size of stack per thread for ENKFUPDEXEC -# defaults to 1024000000 -# FILESTYLE File management style flag -# ('C' to copy to/from $DATA, 'L' for symbolic links in $DATA, -# 'X' to use XLFUNIT or symbolic links where appropriate) -# defaults to 'X' -# PGMOUT Executable standard output -# defaults to $pgmout, then to '&1' -# PGMERR Executable standard error -# defaults to $pgmerr, then to '&1' -# pgmout Executable standard output default -# pgmerr Executable standard error default -# REDOUT standard output redirect ('1>' or '1>>') -# defaults to '1>', or to '1>>' to append if $PGMOUT is a file -# REDERR standard error redirect ('2>' or '2>>') -# defaults to '2>', or to '2>>' to append if $PGMERR is a file -# VERBOSE Verbose flag (YES or NO) -# defaults to NO -# -# Exported Shell Variables: -# PGM Current program name -# pgm -# ERR Last return code -# err -# -# Modules and files referenced: -# scripts : $INISCRIPT -# $LOGSCRIPT -# $ERRSCRIPT -# $ENDSCRIPT -# -# programs : $CYCLEXEC -# $ENKFUPDEXEC -# -# fixed data : $BERROR -# $SATANGL -# $SATINFO -# $RTMFIX -# $RTMEMIS -# $RTMAERO -# $RTMCLDS -# $CONVINFO -# $OZINFO -# $PCPINFO -# $AEROINFO -# $SCANINFO -# $HYBENSINFO -# $ANAVINFO -# -# input data : $SFCGES -# $SIGGES -# $SIGGESENS -# $GBIAS -# $GBIASE -# $CNVSTAT -# $OZNSTAT -# $RADSTAT -# -# output data: -# $SIGANLENS -# $OSENSE -# $ENKFSTAT -# $PGMOUT -# $PGMERR -# -# Remarks: -# -# Condition codes -# 0 - no problem encountered -# >0 - some problem encountered -# -# Control variable resolution priority -# 1 Command line argument. -# 2 Environment variable. -# 3 Inline default. -# -# Attributes: -# Language: POSIX shell -# Machine: IBM SP -# -################################################################################ -# Set environment. -export VERBOSE=${VERBOSE:-"NO"} -if [[ "$VERBOSE" = "YES" ]] -then - echo $(date) EXECUTING $0 $* >&2 - set -x -fi -export machine=${machine:-IBMP6} -export machine=$(echo $machine|tr '[a-z]' '[A-Z]') -if [ $machine = ZEUS ] ; then - export MPI_BUFS_PER_PROC=512 - export MPI_BUFS_PER_HOST=512 - export MPI_GROUP_MAX=512 -fi -# Command line arguments. -export SFCGES=${1:-${SFCGES:?}} -export SIGGES=${2:-${SIGGES:?}} -export GBIAS=${3:-${GBIAS:?}} -export GBIASE=${4:-${GBIASE:?}} -# Directories. -export HOMEDIR=${HOMEDIR:-$NWROOT} -export NWPROD=${NWPROD:-$HOMEDIR} -export FIXgsi=${FIXgsi:-$NWPROD/global_shared.${global_shared_ver}/fix} -export EXECgsm=${EXECgsm:-$NWPROD/global_shared.${global_shared_ver}/exec} -export EXECgdas=${EXECgdas:-$NWPROD/gdas.${gdas_ver}/exec} - -export utilscript=${utilscript:-$NWPROD/util/ush} -export DATA=${DATA:-$(pwd)} -export COMIN=${COMIN:-$(pwd)} -export COMOUT=${COMOUT:-$(pwd)} -# Set script / EnKF update control parameters -export use_gfs_nemsio=${use_gfs_nemsio:-".false."} # run EnKF update with NEMSIO input/output -export fso_cycling=${fso_cycling:-".false."} # write additional files needed for EFSOI calculations -# Filenames. -export XC=${XC} -export PREINP=${PREINP} -export SUFINP=${SUFINP} -export SIGHDR=${SIGHDR:-${EXECgsm}/global_sighdr$XC} -export SFCHDR=${SFCHDR:-${EXECgsm}/global_sfchdr$XC} -if [ $use_gfs_nemsio = .true. ]; then - export LATB=${LATB:-$($SFCHDR $SFCGES latr |grep -i "latr" |awk -F"= " '{print $2}' |awk -F" " '{print $1}')} - export LONB=${LONB:-$($SFCHDR $SFCGES lonr |grep -i "lonr" |awk -F"= " '{print $2}' |awk -F" " '{print $1}')} - export LEVS=${LEVS:-$($SIGHDR $SIGGES levs |grep -i "levs" |awk -F"= " '{print $2}' |awk -F" " '{print $1}')} - export CDATE=${CDATE:-$($SFCHDR $SFCGES fcstdate | grep -i "fcstdate_ymdh" |awk -F= '{print $2}')} -else - export LATB=${LATB:-$($SFCHDR $SFCGES LATB||echo 0)} - export LONB=${LONB:-$($SFCHDR $SFCGES LONB||echo 0)} - export LEVS=${LEVS:-$($SIGHDR $SIGGES LEVS||echo 0)} - export CDATE=${CDATE:-$($SFCHDR $SFCGES VDATE||echo 0)} -fi -export LATA=${LATA:-$LATB} -export LONA=${LONA:-$LONB} -export NPTS=`expr \( $LONA \) \* \( $LATA \)` -export ENKFUPDEXEC=${ENKFUPDEXEC:-${EXECgdas}/global_enkf$XC} -export SATANGL=${SATANGL:-${FIXgsi}/global_satangbias.txt} -export SATINFO=${SATINFO:-${FIXgsi}/global_satinfo.txt} -export CONVINFO=${CONVINFO:-${FIXgsi}/global_convinfo.txt} -export OZINFO=${OZINFO:-${FIXgsi}/global_ozinfo.txt} -export SCANINFO=${SCANINFO:-${FIXgsi}/global_scaninfo.txt} -export HYBENSINFO=${HYBENSINFO:-${FIXgsi}/global_hybens_locinfo.l${LEVS}.txt} -export ANAVINFO=${ANAVINFO:-${FIXgsi}/global_anavinfo.l${LEVS}.txt} -export SIGGESENS=${SIGGESENS:-${COMIN}/sigf06_ens} -if [ $fso_cycling = .true. ]; then - export OSENSE=${OSENSE:-${COMOUT}/osense_} -fi -export SIGANLENS=${SIGANLENS:-${COMOUT}/sanl} -export USE_NEWRADBC=${USE_NEWRADBC:-"NO"} -export NMEM_ENKF=${NMEM_ENKF:-0} -export ENKFSTAT=${ENKFSTAT:-${COMOUT}/${PREINP}enkfstat} -export CNVSTAT=${CNVSTAT:-${COMIN}/${PREINP}cnvstat} -export OZNSTAT=${OZNSTAT:-${COMIN}/${PREINP}oznstat} -export RADSTAT=${RADSTAT:-${COMIN}/${PREINP}radstat} -export INISCRIPT=${INISCRIPT} -export ERRSCRIPT=${ERRSCRIPT:-'eval [[ $err = 0 ]]'} -export LOGSCRIPT=${LOGSCRIPT} -export ENDSCRIPT=${ENDSCRIPT} -# Other variables. -export NDATE=${NDATE:-/$NWPROD/util/exec/ndate} -export GDATE=${GDATE:-($NDATE -06 $CDATE)} -export NANALS=${NANALS:-80} -export SMOOTHINF=${SMOOTHINF:-24} -export NTRAC=${NTRAC:-3} -export NAM_ENKF=${NAM_ENKF:-""} -export SATOBS_ENKF=${SATOBS_ENKF:-""} -export OZOBS_ENKF=${OZOBS_ENKF:-""} -export NTHREADS=${NTHREADS:-1} -export NTHSTACK=${NTHSTACK:-1024000000} -export NTHREADS_ENKF=${NTHREADS_ENKF:-1} -export NTHSTACK_ENKF=${NTHSTACK_ENKF:-1024000000} -export FILESTYLE=${FILESTYLE:-'X'} -export PGMOUT=${PGMOUT:-${pgmout:-'&1'}} -export PGMERR=${PGMERR:-${pgmerr:-'&2'}} -export OBERRFLAG=${OBERRFLAG:-.false.} -export NCP=${NCP:-cp} -if [ $machine = IBMP6 ] ; then - typeset -L1 l=$PGMOUT - [[ $l = '&' ]]&&a=''||a='>' - export REDOUT=${REDOUT:-'1>'$a} - typeset -L1 l=$PGMERR - [[ $l = '&' ]]&&a=''||a='>' - export REDERR=${REDERR:-'2>'$a} -else - export REDOUT=${REDOUT:-'1>'} - export REDERR=${REDERR:-'2>'} -fi -export APRUN=${APRUN:-""} -export APRUNCFP=${APRUNCFP:-""} -export USE_CFP=${USE_CFP:-"NO"} - - -################################################################################ -# Preprocessing -$INISCRIPT -pwd=$(pwd) -if [[ -d $DATA ]] -then - mkdata=NO -else - mkdir -p $DATA - mkdata=YES -fi -cd $DATA||exit 99 - -################################################################################ - - -################################################################################ -# Run enkf update -if [ $machine = IBMP6 ] ; then - export XLSMPOPTS="parthds=$NTHREADS_ENKF:stack=$NTHSTACK_ENKF" -fi -export OMP_NUM_THREADS=$NTHREADS_ENKF -export PGM='$APRUN $DATA/$(basename $ENKFUPDEXEC)' -export pgm=$PGM -$LOGSCRIPT - -rm convinfo satinfo ozinfo satbias_angle satbias_in enkf.nml -rm hybens_info -rm sanl* - -if [[ $USE_CFP = YES ]]; then - rm $DATA/untar.sh $DATA/mp_untar.sh - set +x -cat <<\EOFuntar > $DATA/untar.sh -#!/bin/ksh -{ echo - member=$1 - list="$CNVSTAT $OZNSTAT $RADSTAT" - for type in $list; do - if [[ $FILESTYLE = 'C' ]]; then - $NCP ${type}${member} ./ - fi - tar -xvf ${type}${member} - done -} -EOFuntar - set -x - chmod 755 $DATA/untar.sh -fi - -$NCP $ENKFUPDEXEC $DATA -if [[ $FILESTYLE = 'C' ]] -then - # Fixed fields - $NCP $SATANGL satbias_angle - $NCP $SATINFO satinfo - $NCP $SCANINFO scaninfo - $NCP $CONVINFO convinfo - $NCP $OZINFO ozinfo - $NCP $HYBENSINFO hybens_info - $NCP $ANAVINFO anavinfo - - # Ensemble observational and guess data - if [[ $USE_CFP = YES ]]; then - echo "$DATA/untar.sh _ensmean" | tee -a $DATA/mp_untar.sh - else - list="$CNVSTAT $OZNSTAT $RADSTAT" - for type in $list; do - $NCP ${type}_ensmean ./ - tar -xvf ${type}_ensmean - done - fi - imem=1 - while [[ $imem -le $NMEM_ENKF ]]; do - member="_mem"`printf %03i $imem` - if [[ $USE_CFP = YES ]]; then - echo "$DATA/untar.sh $member" | tee -a $DATA/mp_untar.sh - else - list="$CNVSTAT $OZNSTAT $RADSTAT" - for type in $list; do - $NCP ${type}${member} ./ - tar -xvf ${type}${member} - done - fi - sigens=${SIGGESENS}${member} - $NCP $sigens sfg_${CDATE}_fhr06${member} - (( imem = $imem + 1 )) - done - - # Guess fields - $NCP $GBIAS satbias_in - if [[ "$USE_NEWRADBC" = "YES" ]]; then - rm satbias_in - $NCP $GBIASE satbias_in - fi - - $NCP $SIGGES sfg_${CDATE}_fhr06_ensmean - $NCP $SFCGES bfg_${CDATE}_fhr06_ensmean - -else - # Fixed fields - ln -fs $SATANGL satbias_angle - ln -fs $SATINFO satinfo - ln -fs $SCANINFO scaninfo - ln -fs $CONVINFO convinfo - ln -fs $OZINFO ozinfo - ln -fs $HYBENSINFO hybens_info - ln -fs $ANAVINFO anavinfo - - # Ensemble observational and guess data - if [[ $USE_CFP = YES ]]; then - echo "$DATA/untar.sh _ensmean" | tee -a $DATA/mp_untar.sh - else - list="$CNVSTAT $OZNSTAT $RADSTAT" - for type in $list; do - tar -xvf ${type}_ensmean - done - fi - imem=1 - while [[ $imem -le $NMEM_ENKF ]]; do - member="_mem"`printf %03i $imem` - if [[ $USE_CFP = YES ]]; then - echo "$DATA/untar.sh $member" | tee -a $DATA/mp_untar.sh - else - list="$CNVSTAT $OZNSTAT $RADSTAT" - for type in $list; do - tar -xvf ${type}${member} - done - fi - sigens=${SIGGESENS}${member} - ln -fs $sigens sfg_${CDATE}_fhr06${member} - (( imem = $imem + 1 )) - done - - # Guess fields - ln -fs $GBIAS satbias_in - if [[ "$USE_NEWRADBC" = "YES" ]]; then - rm satbias_in - ln -fs $GBIASE satbias_in - fi - - ln -fs $SIGGES sfg_${CDATE}_fhr06_ensmean - ln -fs $SFCGES bfg_${CDATE}_fhr06_ensmean - - # Output files - imem=1 - while [[ $imem -le $NMEM_ENKF ]]; do - member="_mem"`printf %03i $imem` - ln -fs ${SIGANLENS}${member} sanl_${CDATE}_fhr06${member} - if [ $fso_cycling = .true. ]; then - memberni="_nimem"`printf %03i $imem` - ln -fs ${SIGANLENS}${memberni} sanl_${CDATE}_fhr06${memberni} - fi - (( imem = $imem + 1 )) - done - - if [ $fso_cycling = .true. ]; then - ln -fs ${OSENSE}${CDATE}.dat osense_${CDATE}.dat - fi - -fi - -if [[ $USE_CFP = YES ]]; then - chmod 755 $DATA/mp_untar.sh - ncmd=`cat $DATA/mp_untar.sh | wc -l` - if [ $ncmd -gt 0 ]; then - export APRUNCFP=$(eval echo $APRUNCFP) - $APRUNCFP $DATA/mp_untar.sh - fi -fi - -# Create global_enkf namelist -cat < enkf.nml - &nam_enkf - datestring="$CDATE",datapath="$DATA/", - analpertwtnh=0.85,analpertwtsh=0.85,analpertwttr=0.85, - covinflatemax=1.e2,covinflatemin=1,pseudo_rh=.true.,iassim_order=0, - corrlengthnh=2000,corrlengthsh=2000,corrlengthtr=2000, - lnsigcutoffnh=2.0,lnsigcutoffsh=2.0,lnsigcutofftr=2.0, - lnsigcutoffpsnh=2.0,lnsigcutoffpssh=2.0,lnsigcutoffpstr=2.0, - lnsigcutoffsatnh=2.0,lnsigcutoffsatsh=2.0,lnsigcutoffsattr=2.0, - obtimelnh=1.e30,obtimelsh=1.e30,obtimeltr=1.e30, - saterrfact=1.0,numiter=1, - sprd_tol=1.e30,paoverpb_thresh=0.98, - nlons=$LONA,nlats=$LATA,nlevs=$LEVS,nanals=$NMEM_ENKF, - deterministic=.true.,sortinc=.true.,lupd_satbiasc=.false., - reducedgrid=.true.,readin_localization=.true., - use_gfs_nemsio=${use_gfs_nemsio}, - univaroz=.false.,adp_anglebc=.true.,angord=4,use_edges=.false.,emiss_bc=.true., - fso_cycling=${fso_cycling}, - $NAM_ENKF - / - &END - &satobs_enkf - sattypes_rad(1) = 'amsua_n15', dsis(1) = 'amsua_n15', - sattypes_rad(2) = 'amsua_n18', dsis(2) = 'amsua_n18', - sattypes_rad(3) = 'amsua_n19', dsis(3) = 'amsua_n19', - sattypes_rad(4) = 'amsub_n16', dsis(4) = 'amsub_n16', - sattypes_rad(5) = 'amsub_n17', dsis(5) = 'amsub_n17', - sattypes_rad(6) = 'amsua_aqua', dsis(6) = 'amsua_aqua', - sattypes_rad(7) = 'amsua_metop-a', dsis(7) = 'amsua_metop-a', - sattypes_rad(8) = 'airs_aqua', dsis(8) = 'airs_aqua', - sattypes_rad(9) = 'hirs3_n17', dsis(9) = 'hirs3_n17', - sattypes_rad(10)= 'hirs4_n19', dsis(10)= 'hirs4_n19', - sattypes_rad(11)= 'hirs4_metop-a', dsis(11)= 'hirs4_metop-a', - sattypes_rad(12)= 'mhs_n18', dsis(12)= 'mhs_n18', - sattypes_rad(13)= 'mhs_n19', dsis(13)= 'mhs_n19', - sattypes_rad(14)= 'mhs_metop-a', dsis(14)= 'mhs_metop-a', - sattypes_rad(15)= 'goes_img_g11', dsis(15)= 'imgr_g11', - sattypes_rad(16)= 'goes_img_g12', dsis(16)= 'imgr_g12', - sattypes_rad(17)= 'goes_img_g13', dsis(17)= 'imgr_g13', - sattypes_rad(18)= 'goes_img_g14', dsis(18)= 'imgr_g14', - sattypes_rad(19)= 'goes_img_g15', dsis(19)= 'imgr_g15', - sattypes_rad(20)= 'avhrr_n18', dsis(20)= 'avhrr3_n18', - sattypes_rad(21)= 'avhrr_metop-a', dsis(21)= 'avhrr3_metop-a', - sattypes_rad(22)= 'avhrr_n19', dsis(22)= 'avhrr3_n19', - sattypes_rad(23)= 'amsre_aqua', dsis(23)= 'amsre_aqua', - sattypes_rad(24)= 'ssmis_f16', dsis(24)= 'ssmis_f16', - sattypes_rad(25)= 'ssmis_f17', dsis(25)= 'ssmis_f17', - sattypes_rad(26)= 'ssmis_f18', dsis(26)= 'ssmis_f18', - sattypes_rad(27)= 'ssmis_f19', dsis(27)= 'ssmis_f19', - sattypes_rad(28)= 'ssmis_f20', dsis(28)= 'ssmis_f20', - sattypes_rad(29)= 'sndrd1_g11', dsis(29)= 'sndrD1_g11', - sattypes_rad(30)= 'sndrd2_g11', dsis(30)= 'sndrD2_g11', - sattypes_rad(31)= 'sndrd3_g11', dsis(31)= 'sndrD3_g11', - sattypes_rad(32)= 'sndrd4_g11', dsis(32)= 'sndrD4_g11', - sattypes_rad(33)= 'sndrd1_g12', dsis(33)= 'sndrD1_g12', - sattypes_rad(34)= 'sndrd2_g12', dsis(34)= 'sndrD2_g12', - sattypes_rad(35)= 'sndrd3_g12', dsis(35)= 'sndrD3_g12', - sattypes_rad(36)= 'sndrd4_g12', dsis(36)= 'sndrD4_g12', - sattypes_rad(37)= 'sndrd1_g13', dsis(37)= 'sndrD1_g13', - sattypes_rad(38)= 'sndrd2_g13', dsis(38)= 'sndrD2_g13', - sattypes_rad(39)= 'sndrd3_g13', dsis(39)= 'sndrD3_g13', - sattypes_rad(40)= 'sndrd4_g13', dsis(40)= 'sndrD4_g13', - sattypes_rad(41)= 'sndrd1_g14', dsis(41)= 'sndrD1_g14', - sattypes_rad(42)= 'sndrd2_g14', dsis(42)= 'sndrD2_g14', - sattypes_rad(43)= 'sndrd3_g14', dsis(43)= 'sndrD3_g14', - sattypes_rad(44)= 'sndrd4_g14', dsis(44)= 'sndrD4_g14', - sattypes_rad(45)= 'sndrd1_g15', dsis(45)= 'sndrD1_g15', - sattypes_rad(46)= 'sndrd2_g15', dsis(46)= 'sndrD2_g15', - sattypes_rad(47)= 'sndrd3_g15', dsis(47)= 'sndrD3_g15', - sattypes_rad(48)= 'sndrd4_g15', dsis(48)= 'sndrD4_g15', - sattypes_rad(49)= 'iasi_metop-a', dsis(49)= 'iasi_metop-a', - sattypes_rad(50)= 'seviri_m08', dsis(50)= 'seviri_m08', - sattypes_rad(51)= 'seviri_m09', dsis(51)= 'seviri_m09', - sattypes_rad(52)= 'seviri_m10', dsis(52)= 'seviri_m10', - sattypes_rad(53)= 'amsua_metop-b', dsis(53)= 'amsua_metop-b', - sattypes_rad(54)= 'hirs4_metop-b', dsis(54)= 'hirs4_metop-b', - sattypes_rad(55)= 'mhs_metop-b', dsis(55)= 'mhs_metop-b', - sattypes_rad(56)= 'iasi_metop-b', dsis(56)= 'iasi_metop-b', - sattypes_rad(57)= 'avhrr_metop-b', dsis(57)= 'avhrr3_metop-b', - sattypes_rad(58)= 'atms_npp', dsis(58)= 'atms_npp', - sattypes_rad(59)= 'atms_n20', dsis(59)= 'atms_n20', - sattypes_rad(60)= 'cris_npp', dsis(60)= 'cris_npp', - sattypes_rad(61)= 'cris-fsr_npp', dsis(61)= 'cris-fsr_npp', - sattypes_rad(62)= 'cris-fsr_n20', dsis(62)= 'cris-fsr_n20', - sattypes_rad(63)= 'gmi_gpm', dsis(63)= 'gmi_gpm', - sattypes_rad(64)= 'saphir_meghat', dsis(64)= 'saphir_meghat', - $SATOBS_ENKF - / - &END - &ozobs_enkf - sattypes_oz(1) = 'sbuv2_n16', - sattypes_oz(2) = 'sbuv2_n17', - sattypes_oz(3) = 'sbuv2_n18', - sattypes_oz(4) = 'sbuv2_n19', - sattypes_oz(5) = 'omi_aura', - sattypes_oz(6) = 'gome_metop-a', - sattypes_oz(7) = 'gome_metop-b', - sattypes_oz(8) = 'mls30_aura', - $OZOBS_ENKF - / - &END -EOF - -# Run global_enkf -eval $PGM < enkf.nml $REDOUT$PGMOUT $REDERR$PGMERR -rc=$? - -export ERR=$rc -export err=$ERR -$ERRSCRIPT||exit 2 - -if [[ $FILESTYLE = 'C' ]] -then - imem=1 - while [[ $imem -le $NMEM_ENKF ]]; do - member="_mem"`printf %03i $imem` - $NCP sanl_${CDATE}${member} ${SIGANLENS}${member} - if [ $fso_cycling = .true. ]; then - memberni="_nimem"`printf %03i $imem` - $NCP sanl_${CDATE}${memberni} ${SIGANLENS}${memberni} - fi - (( imem = $imem + 1 )) - done - if [ $fso_cycling = .true. ]; then - $NCP osense_${CDATE}.dat ${OSENSE}${CDATE}.dat - fi -fi - -# Cat runtime output files. -cat $PGMOUT $PGMERR fort.2* > $ENKFSTAT - -################################################################################ -# Postprocessing -cd $pwd -[[ $mkdata = YES ]]&&rmdir $DATA -$ENDSCRIPT -set +x -if [[ "$VERBOSE" = "YES" ]] -then - echo $(date) EXITING $0 with return code $err >&2 -fi -exit $err diff --git a/scripts/exurma2p5_gsianl.sh.ecf b/scripts/exurma2p5_gsianl.sh similarity index 99% rename from scripts/exurma2p5_gsianl.sh.ecf rename to scripts/exurma2p5_gsianl.sh index 7a89821c63..d867e752f9 100755 --- a/scripts/exurma2p5_gsianl.sh.ecf +++ b/scripts/exurma2p5_gsianl.sh @@ -3,7 +3,7 @@ ################################################################################ #### UNIX Script Documentation Block # . . -# Script name: exuma2p5_gsianl.sh.sms +# Script name: exuma2p5_gsianl.sh # Script description: Runs regional GSI variational analysis # # Author: Manuel Pondeca Org: NP22 Date: 2006-06-23 diff --git a/src/enkf/CMakeLists.txt b/src/enkf/CMakeLists.txt index 2b126c2e1a..394c6b52b5 100644 --- a/src/enkf/CMakeLists.txt +++ b/src/enkf/CMakeLists.txt @@ -25,11 +25,6 @@ if(BUILD_ENKF) set(ENKF_SUFFIX "wrf") set(ENKF_BASE "enkf_wrf") endif() -# if(USE_WRF) -# set(GSILIB "gsilib_${debug_suffix}") -# else() -# set(GSILIB "gsilib_global${debug_suffix}") -# endif() set(ENKF_EXTRA_SRCS ${ENKF_extra_src1} gridio_${ENKF_SUFFIX}.f90 ) add_library( MODS1 OBJECT gridinfo_${ENKF_SUFFIX}.f90 ) add_library( MODS2 OBJECT ${ENKF_EXTRA_SRCS} ) @@ -61,8 +56,8 @@ if(BUILD_ENKF) # endif() add_definitions(${MPI_Fortran_FLAGS}) - - include_directories(${CMAKE_CURRENT_BINARY_DIR} "${PROJECT_BINARY_DIR}/include/wrf" "${PROJECT_BINARY_DIR}/include/global" ${CMAKE_CURRENT_BINARY_DIR}/.. ${MPI_Fortran_INCLUDE_DIRS} ${MPI_Fortran_INCLUDE_PATH} ${CORE_INCS} ${NETCDF_INCLUDES} ${NCDIAG_INCS} ${FV3GFS_NCIO_INCS}) + + include_directories(${CMAKE_CURRENT_BINARY_DIR} "${PROJECT_BINARY_DIR}/include/wrf" "${PROJECT_BINARY_DIR}/include/global" ${CMAKE_CURRENT_BINARY_DIR}/.. ${MPI_Fortran_INCLUDE_DIRS} ${MPI_Fortran_INCLUDE_PATH} ${CORE_INCS} ${NETCDF_INCLUDE_DIRS} ${NCDIAG_INCS} ${FV3GFS_NCIO_INCS}) link_directories(${MPI_Fortran_LIBRARIES}) set_source_files_properties( ${ENKF_SRCS} PROPERTIES COMPILE_FLAGS ${ENKF_Fortran_FLAGS} ) @@ -78,8 +73,9 @@ if(BUILD_ENKF) set(ENKFEXEC "${ENKF_BASE}${debug_suffix}${GSISUFFIX}" CACHE INTERNAL "ENKF Executable name") add_executable(${ENKFEXEC} enkf_main.f90) target_link_libraries(${ENKFEXEC} enkflib enkfdeplib ${GSILIB} ${GSISHAREDLIB} ${CORE_LIBRARIES} - ${MPI_Fortran_LIBRARIES} ${LAPACK_LIBRARIES} ${NETCDF_LIBRARIES_F90} ${NETCDF_LIBRARIES} ${HDF5_Fortran_HL_LIBRARIES} - ${EXTRA_LINKER_FLAGS} ${HDF5_LIBRARIES} ${CURL_LIBRARIES} ${GSI_LDFLAGS} ${CORE_BUILT} ${CORE_LIBRARIES} ${CORE_BUILT} ${NCDIAG_LIBRARIES} ${FV3GFS_NCIO_LIBRARIES}) + ${MPI_Fortran_LIBRARIES} ${LAPACK_LIBRARIES} ${CORE_LIBRARIES} ${CORE_BUILT} + ${NETCDF_Fortran_LIBRARIES} ${NETCDF_C_LIBRARIES} ${FV3GFS_NCIO_LIBRARIES} + ${EXTRA_LINKER_FLAGS} ${GSI_LDFLAGS} ${NCDIAG_LIBRARIES}) install(TARGETS ${ENKFEXEC} enkfdeplib enkflib RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib diff --git a/src/enkf/gridio_fv3reg.f90 b/src/enkf/gridio_fv3reg.f90 index 9b81d349b0..8c6fec3f9a 100644 --- a/src/enkf/gridio_fv3reg.f90 +++ b/src/enkf/gridio_fv3reg.f90 @@ -42,14 +42,14 @@ module gridio !------------------------------------------------------------------------- ! Define all public subroutines within this module private - public :: readgriddata - public :: writegriddata + public :: readgriddata,readgriddata_pnc + public :: writegriddata,writegriddata_pnc + public :: writeincrement, writeincrement_pnc !------------------------------------------------------------------------- contains - ! Generic WRF read routine, calls ARW-WRF or NMM-WRF - subroutine readgriddata(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,ntimes,fileprefixes,reducedgrid,vargrid,qsat) + subroutine readgriddata(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,ntimes,fileprefixes,filesfcprefixes,reducedgrid,vargrid,qsat) use constants, only:zero,one,half,fv, max_varname_length use gridinfo,only: eta1_ll use netcdf, only: nf90_open,nf90_close,nf90_get_var,nf90_noerr @@ -61,6 +61,7 @@ subroutine readgriddata(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,ntimes,f character(len=max_varname_length), dimension(n3d), intent(in) :: vars3d integer, dimension(0:n3d), intent(in) :: levels character(len=120), dimension(7), intent(in) :: fileprefixes + character(len=120), dimension(7), intent(in) :: filesfcprefixes logical, intent(in) :: reducedgrid real(r_single), dimension(npts,ndim,ntimes,nanal2-nanal1+1), intent(out) :: vargrid @@ -360,12 +361,12 @@ subroutine readgriddata(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,ntimes,f end subroutine readgriddata !======================================================================== - ! readgriddata_nmm.f90: read WRF-NMM state or control vector + ! readgriddata_nmm.f90: read FV3-Lam state or control vector !------------------------------------------------------------------------- !======================================================================== - ! writegriddata.f90: write WRF-ARW or WRF-NMM analysis + ! writegriddata.f90: write FV3-LAM analysis !------------------------------------------------------------------------- subroutine writegriddata(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,vargrid,no_inflate_flag) @@ -680,6 +681,70 @@ subroutine writegriddata(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,vargrid !====================================================================== end subroutine writegriddata + subroutine writeincrement(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,grdin,no_inflate_flag) + !Dummy subroutine declaration in place of the actual subroutine definition in + !the GFS EnKF + !to be implemented in the future + use constants, only: max_varname_length + use params, only: nbackgrounds + implicit none + integer, intent(in) :: nanal1,nanal2 + character(len=max_varname_length), dimension(n2d), intent(in) :: vars2d + character(len=max_varname_length), dimension(n3d), intent(in) :: vars3d + integer, intent(in) :: n2d,n3d,ndim + integer, dimension(0:n3d), intent(in) :: levels + real(r_single), dimension(npts,ndim,nbackgrounds,1), intent(inout) :: grdin + logical, intent(in) :: no_inflate_flag + end subroutine writeincrement + + subroutine writeincrement_pnc(vars3d,vars2d,n3d,n2d,levels,ndim,grdin,no_inflate_flag) + !Dummy subroutine declaration in place of the actual subroutine definition in + !the GFS EnKF + !to be implemented in the future + use constants, only: max_varname_length + use params, only: nbackgrounds + implicit none + character(len=max_varname_length), dimension(n2d), intent(in) :: vars2d + character(len=max_varname_length), dimension(n3d), intent(in) :: vars3d + integer, intent(in) :: n2d,n3d,ndim + integer, dimension(0:n3d), intent(in) :: levels + real(r_single), dimension(npts,ndim,nbackgrounds,1), intent(inout) :: grdin + logical, intent(in) :: no_inflate_flag + end subroutine writeincrement_pnc + + subroutine readgriddata_pnc(vars3d,vars2d,n3d,n2d,levels,ndim,ntimes, & + fileprefixes,filesfcprefixes,reducedgrid,grdin,qsat) + !Dummy subroutine declaration in place of the actual subroutine definition in + !the GFS EnKF + !to be implemented in the future + use constants, only: max_varname_length + implicit none + character(len=max_varname_length), dimension(n2d), intent(in) :: vars2d + character(len=max_varname_length), dimension(n3d), intent(in) :: vars3d + integer, intent(in) :: n2d, n3d + integer, dimension(0:n3d), intent(in) :: levels + integer, intent(in) :: ndim, ntimes + character(len=120), dimension(7), intent(in) :: fileprefixes + character(len=120), dimension(7), intent(in) :: filesfcprefixes + logical, intent(in) :: reducedgrid + real(r_single), dimension(npts,ndim,ntimes,1), intent(out) :: grdin + real(r_double), dimension(npts,nlevs,ntimes,1), intent(out) :: qsat + end subroutine readgriddata_pnc + + subroutine writegriddata_pnc(vars3d,vars2d,n3d,n2d,levels,ndim,grdin,no_inflate_flag) + !Dummy subroutine declaration in place of the actual subroutine definition in + !the GFS EnKF + !to be implemented in the future + use constants, only: max_varname_length + use params, only: nbackgrounds + implicit none + character(len=max_varname_length), dimension(n2d), intent(in) :: vars2d + character(len=max_varname_length), dimension(n3d), intent(in) :: vars3d + integer, intent(in) :: n2d,n3d,ndim + integer, dimension(0:n3d), intent(in) :: levels + real(r_single), dimension(npts,ndim,nbackgrounds,1), intent(inout) :: grdin + logical, intent(in) :: no_inflate_flag + end subroutine writegriddata_pnc end module gridio diff --git a/src/enkf/gridio_gfs.f90 b/src/enkf/gridio_gfs.f90 index 0d5216bc07..f245afdf3f 100644 --- a/src/enkf/gridio_gfs.f90 +++ b/src/enkf/gridio_gfs.f90 @@ -164,6 +164,7 @@ subroutine readgriddata_pnc(vars3d,vars2d,n3d,n2d,levels,ndim,ntimes, & kap = rd/cp kapr = cp/rd kap1 = kap+one + clip = tiny(vg(1)) u_ind = getindex(vars3d, 'u') !< indices in the state or control var arrays v_ind = getindex(vars3d, 'v') ! U and V (3D) diff --git a/src/enkf/gridio_wrf.f90 b/src/enkf/gridio_wrf.f90 index 2717b1e0b6..80a4404679 100644 --- a/src/enkf/gridio_wrf.f90 +++ b/src/enkf/gridio_wrf.f90 @@ -46,7 +46,8 @@ module gridio ! Define all public subroutines within this module private public :: readgriddata, readgriddata_pnc - public :: writegriddata, writegriddata_pnc, WRITEINCREMENT, WRITEINCREMENT_PNC + public :: writegriddata, writegriddata_pnc + public :: writeincrement, writeincrement_pnc !------------------------------------------------------------------------- @@ -74,6 +75,7 @@ subroutine readgriddata(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,ntimes,f end subroutine readgriddata + !======================================================================== ! readgriddata_arw.f90: read WRF-ARW state or control vector !------------------------------------------------------------------------- @@ -1036,6 +1038,7 @@ subroutine writegriddata(nanal1,nanal2,vars3d,vars2d,n3d,n2d,levels,ndim,vargrid end subroutine writegriddata + !====================================================================== ! readwrfvar.f90: This subroutine reads a varname variable from WRF ! ARW or NMM netcdf file and returns the variable interpolated to diff --git a/src/enkf/mpi_readobs.f90 b/src/enkf/mpi_readobs.f90 index 420ebe3227..bca5d7c715 100644 --- a/src/enkf/mpi_readobs.f90 +++ b/src/enkf/mpi_readobs.f90 @@ -273,41 +273,31 @@ subroutine mpi_getobs(obspath, datestring, nobs_conv, nobs_oz, nobs_sat, nobs_to ! make anal_ob contain ob prior ensemble *perturbations* analsi=1._r_single/float(nanals) analsim1=1._r_single/float(nanals-1) -!$omp parallel do private(nob) do nob=1,nobs_tot ensmean_obbc(nob) = sum(anal_ob(:,nob))*analsi enddo -!$omp end parallel do if (nproc_shm == 0) then -!$omp parallel do private(nob) do nob=1,nobs_tot ! remove ensemble mean from each member. ! ensmean_obbc is biascorrected ensemble mean (anal_ob is ens pert) anal_ob(:,nob) = anal_ob(:,nob)-ensmean_obbc(nob) enddo -!$omp end parallel do if (neigv > 0) then -!$omp parallel do private(nob) do nob=1,nobs_tot anal_ob_modens(:,nob) = anal_ob_modens(:,nob)-ensmean_obbc(nob) enddo -!$omp end parallel do endif endif call mpi_barrier(mpi_comm_world,ierr) -!$omp parallel do private(nob) do nob=1,nobs_tot ! compute sprd sprd_ob(nob) = sum(anal_ob(:,nob)**2)*analsim1 enddo -!$omp end parallel do ! modulated ensemble. if (neigv > 0) then -!$omp parallel do private(nob) do nob=1,nobs_tot sprd_ob(nob) = sum(anal_ob_modens(:,nob)**2)*analsim1 enddo -!$omp end parallel do endif if (nproc == 0) then print *, 'prior spread conv: ', minval(sprd_ob(1:nobs_conv)), maxval(sprd_ob(1:nobs_conv)) @@ -317,8 +307,8 @@ subroutine mpi_getobs(obspath, datestring, nobs_conv, nobs_oz, nobs_sat, nobs_to maxval(sprd_ob(nobs_conv+nobs_oz+1:nobs_tot)) do nob =nobs_conv+nobs_oz+1 , nobs_tot if (sprd_ob(nob) > 1000.) then - print *, nob, ' sat spread: ', sprd_ob(nob), ', ensmean_ob: ', ensmean_obbc(nob), & - ', anal_ob: ', anal_ob(:,nob), ', mem_ob: ', mem_ob(nob) + print *, nob, trim(obtype(nob)),ob(nob),' sat spread: ', sprd_ob(nob), ', ensmean_ob: ', ensmean_obbc(nob), & + ', anal_ob: ', anal_ob(:,nob) endif enddo endif diff --git a/src/enkf/observer_fv3reg.f90 b/src/enkf/observer_fv3reg.f90 index 428196c44f..8f77bca417 100644 --- a/src/enkf/observer_fv3reg.f90 +++ b/src/enkf/observer_fv3reg.f90 @@ -62,7 +62,8 @@ subroutine setup_linhx(rlat, rlon, time, ix, delx, ixp, delxp, iy, dely, & end subroutine setup_linhx -subroutine calc_linhx(hx, dens, dhx_dx, hx_ens, & + +subroutine calc_linhx(hx, dens, dhx_dx, hxpert, hx_ens, & ix, delx, ixp, delxp, iy, dely, iyp, delyp, & it, delt, itp, deltp) !$$$ subprogram documentation block @@ -76,19 +77,27 @@ subroutine calc_linhx(hx, dens, dhx_dx, hx_ens, & ! 2016-11-29 shlyaeva ! ! input argument list: +! hx: observation prior ensemble mean +! dens: state space ensemble perturbations +! dhx_dx: Jacobian +! ix,delx,ixp,delxp,iy,dely,iyp,delyp,it,delt,itp,deltp: horizontal +! and temporal linear interpolation indices and weights. ! ! output argument list: +! hx_ens: observation prior ensemble perturbation +! hxpert: ens pert profile that multiplies dhx_dx to yield hx_ens (in +! compressed format - temporally and horizontally interpolated) ! ! attributes: ! language: f95 ! !$$$ use kinds, only: r_kind,i_kind,r_single - use params, only: nstatefields, nlons, nlats, nlevs, nhr_state, fhr_assim - use gridinfo, only: npts, latsgrd, lonsgrd + use params, only: nstatefields, nlons + use gridinfo, only: npts use statevec, only: nsdim - use constants, only: zero,one,pi - use sparsearr, only: sparr + use constants, only: zero,one + use sparsearr, only: sparr, raggedarr use mpisetup implicit none @@ -98,18 +107,16 @@ subroutine calc_linhx(hx, dens, dhx_dx, hx_ens, & integer(i_kind), intent(in) :: ix, iy, it, ixp, iyp, itp real(r_kind), intent(in) :: delx, dely, delxp, delyp, delt, deltp type(sparr) ,intent(in ) :: dhx_dx ! dH(x)/dx |x_mean profiles + type(raggedarr) ,intent(inout) :: hxpert ! interpolated background real(r_single) ,intent( out) :: hx_ens ! H (x_ens) - integer(i_kind) i,j,k - + integer(i_kind) i,j write(6,*)'this is a dummy subroutine, running this means something wrong ,stop' call stop2(555) return end subroutine calc_linhx -subroutine calc_linhx_modens(hx, dens, dhx_dx, hx_ens, & - ix, delx, ixp, delxp, iy, dely, iyp, delyp, & - it, delt, itp, deltp, vscale) +subroutine calc_linhx_modens(hx, dhx_dx, hxpert, hx_ens, vscale) !$$$ subprogram documentation block ! . . . . ! subprogram: calc_linhx @@ -118,34 +125,36 @@ subroutine calc_linhx_modens(hx, dens, dhx_dx, hx_ens, & ! abstract: ! ! program history log: -! 2016-11-29 shlyaeva +! 2016-11-29 shlyaeva, initial version +! 2019-12-09 whitaker, optimizations ! ! input argument list: +! hx: observation prior ensemble mean +! dhx_dx: Jacobian +! hxpert: 'unmodulated' ens pert profile that multiplies dhx_dx +! vscale: vertical scaling from vertical localization eigenvectors used +! to generate modulated ensemble. ! ! output argument list: +! hx_ens: observation prior ensemble perturbation for each verticali +! localization eigenvector ! ! attributes: ! language: f95 ! !$$$ use kinds, only: r_kind,i_kind,r_single - use params, only: nstatefields, nlons, nlats, nlevs, nhr_state, fhr_assim - use gridinfo, only: npts, latsgrd, lonsgrd - use statevec, only: nsdim - use constants, only: zero,one,pi - use sparsearr, only: sparr + use sparsearr, only: sparr, raggedarr use mpisetup implicit none ! Declare passed variables real(r_single) ,intent(in ) :: hx ! H(x_mean) - real(r_single),dimension(npts,nsdim,nstatefields),intent(in ) :: dens ! x_ens - x_mean, state vector space - integer(i_kind), intent(in) :: ix, iy, it, ixp, iyp, itp - real(r_kind), intent(in) :: delx, dely, delxp, delyp, delt, deltp type(sparr) ,intent(in ) :: dhx_dx ! dH(x)/dx |x_mean profiles + type(raggedarr) ,intent(in ) :: hxpert ! interpolated background real(r_single) ,intent( out) :: hx_ens(neigv)! H (x_ens) real(r_double),dimension(neigv,nlevs+1) ,intent(in ) :: vscale ! vertical scaling (for modulated ens) - integer(i_kind) i,j,k + integer(i_kind) i write(6,*)'this is a dummy subroutine, running this means something wrong ,stop' call stop2(555) diff --git a/src/enkf/readconvobs.f90 b/src/enkf/readconvobs.f90 index 5b734e848f..17ffc63c71 100644 --- a/src/enkf/readconvobs.f90 +++ b/src/enkf/readconvobs.f90 @@ -334,7 +334,9 @@ subroutine get_num_convobs_nc(obspath,datestring,num_obs_tot,num_obs_totdiag,id) errorlimit2=errorlimit2_obs - if (obtype == 'gps' .and. GPS_Type(i)==1) errorlimit2=errorlimit2_bnd + if (obtype == 'gps' ) then + if (GPS_Type(i)==1) errorlimit2=errorlimit2_bnd + endif ! for q, normalize by qsatges if (obtype == ' q') then @@ -661,7 +663,9 @@ subroutine get_convobs_data_nc(obspath, datestring, nobs_max, nobs_maxdiag, & do i = 1, nobs nobdiag = nobdiag + 1 ! special handling for error limits for GPS bend angle - if (obtype == 'gps' .and. GPS_Type(i)==1) errorlimit2=errorlimit2_bnd + if (obtype == 'gps' ) then + if (GPS_Type(i)==1) errorlimit2=errorlimit2_bnd + endif ! for q, normalize by qsatges if (obtype == ' q') then diff --git a/src/fv3gfs_ncio/CMakeLists.txt b/src/fv3gfs_ncio/CMakeLists.txt index 337a5378c8..08474d7eba 100644 --- a/src/fv3gfs_ncio/CMakeLists.txt +++ b/src/fv3gfs_ncio/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 2.8) if(BUILD_FV3GFS_NCIO) set(Fortran_MODULE_DIRECTORY "${PROJECT_BINARY_DIR}/include") # NetCDF-4 library - include_directories( ${NETCDF_INCLUDES} ${FV3GFS_NCIO_INCS} ) + include_directories( ${NETCDF_INCLUDE_DIRS} ${FV3GFS_NCIO_INCS} ) FILE(GLOB FV3GFS_NCIO_SRC ${CMAKE_CURRENT_SOURCE_DIR}/module_fv3gfs_ncio.f90 ) set_source_files_properties( ${FV3GFS_NCIO_SRC} PROPERTIES COMPILE_FLAGS ${FV3GFS_NCIO_Fortran_FLAGS} ) add_library(fv3gfs_ncio STATIC ${FV3GFS_NCIO_SRC}) diff --git a/src/gsi/CMakeLists.txt b/src/gsi/CMakeLists.txt index 7adab2eed1..7621690929 100644 --- a/src/gsi/CMakeLists.txt +++ b/src/gsi/CMakeLists.txt @@ -84,7 +84,7 @@ cmake_minimum_required(VERSION 2.8) # Add the include paths message("MPI include PATH ${MPI_Fortran_INCLUDE_PATH}") - include_directories( ${CORE_INCS} ${NETCDF_INCLUDES} ${MPI_Fortran_INCLUDE_PATH} ${FV3GFS_NCIO_INCS} "./" ) + include_directories( ${CORE_INCS} ${NETCDF_INCLUDE_DIRS} ${MPI_Fortran_INCLUDE_PATH} ${FV3GFS_NCIO_INCS} "./" ) #define the name used for GSI Shared lib and add it with properties and include dirs set(GSISHAREDLIB "gsilib_shrd${debug_suffix}" CACHE INTERNAL "") @@ -145,9 +145,11 @@ cmake_minimum_required(VERSION 2.8) endif() # Specify all the libraries to be linked into the executable target_link_libraries(${GSIEXEC} ${GSISHAREDLIB} ${GSILIB} ${GSISHAREDLIB} ${WRF_LIBRARIES} - ${NETCDF_LIBRARIES_F90} ${NETCDF_LIBRARIES} ${HDF5_Fortran_HL_LIBRARIES} ${MPI_Fortran_LIBRARIES} - ${LAPACK_LIBRARIES} -L./ ${EXTRA_LINKER_FLAGS} ${HDF5_LIBRARIES} ${CURL_LIBRARIES} ${CORE_LIBRARIES} ${CORE_BUILT} - ${GSI_LDFLAGS} ${NCDIAG_LIBRARIES} ${GSDCLOUD_LIBRARY} ${ZLIB_LIBRARIES} ${wrflib} ${EXTRA_LINKER_FLAGS} ${FV3GFS_NCIO_LIBRARIES}) + ${MPI_Fortran_LIBRARIES} ${LAPACK_LIBRARIES} + ${CORE_LIBRARIES} ${CORE_BUILT} + ${NETCDF_Fortran_LIBRARIES} ${NETCDF_C_LIBRARIES} + ${GSI_LDFLAGS} ${NCDIAG_LIBRARIES} ${GSDCLOUD_LIBRARY} ${wrflib} + ${EXTRA_LINKER_FLAGS} ${FV3GFS_NCIO_LIBRARIES}) install(TARGETS ${GSIEXEC} RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib diff --git a/src/gsi/anberror.f90 b/src/gsi/anberror.f90 index aef1adaeae..1acc9040c9 100644 --- a/src/gsi/anberror.f90 +++ b/src/gsi/anberror.f90 @@ -284,7 +284,7 @@ subroutine create_anberror_vars(mype) !$$$ end documentation block use fgrid2agrid_mod, only: create_fgrid2agrid - use jfunc, only: nrclen,nclen,diag_precon + use jfunc, only: nrclen,nclen use berror, only: varprd,vprecond,bnf=>nf,bnr=>nr use gridmod, only: nlat,nlon implicit none @@ -292,7 +292,7 @@ subroutine create_anberror_vars(mype) integer(i_kind),intent(in ) :: mype allocate(varprd(max(1,nrclen))) - if(diag_precon)allocate(vprecond(nclen)) + allocate(vprecond(nclen)) allocate(an_amp(max_ngauss,nvars)) an_amp=one/three @@ -388,14 +388,13 @@ subroutine destroy_anberror_vars ! !$$$ use fgrid2agrid_mod, only: destroy_fgrid2agrid - use jfunc, only: diag_precon use berror, only: vprecond implicit none deallocate(an_amp) deallocate(afact0) deallocate(qvar3d) - if(diag_precon)deallocate(vprecond) + deallocate(vprecond) call destroy_fgrid2agrid(pf2aP1) call destroy_fgrid2agrid(pf2aP2) @@ -431,7 +430,7 @@ subroutine create_anberror_vars_reg(mype) ! !$$$ use fgrid2agrid_mod, only: create_fgrid2agrid - use jfunc, only: nrclen,nclen,diag_precon + use jfunc, only: nrclen,nclen use berror, only: varprd,vprecond use gridmod, only: nlat,nlon,istart,jstart use general_commvars_mod, only: s2g_raf @@ -442,7 +441,7 @@ subroutine create_anberror_vars_reg(mype) logical regional allocate(varprd(max(1,nrclen))) - if(diag_precon)allocate(vprecond(nclen)) + allocate(vprecond(nclen)) allocate(an_amp(max_ngauss,nvars)) an_amp=one/three @@ -654,7 +653,6 @@ subroutine destroy_anberror_vars_reg !$$$ end documentation block use fgrid2agrid_mod, only: destroy_fgrid2agrid - use jfunc, only: diag_precon use berror, only: vprecond use general_sub2grid_mod, only: general_sub2grid_destroy_info implicit none @@ -662,7 +660,7 @@ subroutine destroy_anberror_vars_reg deallocate(an_amp) deallocate(afact0) deallocate(qvar3d) - if(diag_precon)deallocate(vprecond) + deallocate(vprecond) call destroy_fgrid2agrid(pf2aP1) call general_sub2grid_destroy_info(s2g_rff) !write(6,'(" FOR TEST ONLY--REMOVE THIS MESSAGE BEFORE FINAL COMMIT--SUCCESSFUL CALL TO general_sub2grid_destroy_info to remove s2g_rff in destroy_anberror_vars_reg")') diff --git a/src/gsi/anbkerror.f90 b/src/gsi/anbkerror.f90 index adcd769ddf..999a00f1ab 100644 --- a/src/gsi/anbkerror.f90 +++ b/src/gsi/anbkerror.f90 @@ -1,4 +1,4 @@ -subroutine anbkerror(gradx,grady) +subroutine anbkerror(grady) !$$$ subprogram documentation block ! . . . . ! subprogram: anbkerror apply anisotropic background error covariance @@ -33,10 +33,10 @@ subroutine anbkerror(gradx,grady) ! 2015-07-02 pondeca - update slab mode option to work with any number of control variables ! ! input argument list: -! gradx - input field +! grady - input field ! ! output -! grady - background structure * gradx +! grady - background structure * grady ! ! attributes: ! language: f90 @@ -57,7 +57,6 @@ subroutine anbkerror(gradx,grady) implicit none ! Declare passed variables - type(control_vector),intent(inout) :: gradx type(control_vector),intent(inout) :: grady ! Declare local variables @@ -82,9 +81,6 @@ subroutine anbkerror(gradx,grady) ! Initialize timer call timer_ini('anbkerror') -! Put things in grady first since operations change input variables - grady=gradx - ! Since each internal vector [step(jj)] of grad has the same structure, pointers ! are the same independent of the subwindow jj call gsi_bundlegetpointer (grady%step(1),myvnames,ipnts,istatus) diff --git a/src/gsi/aniso_ens_util.f90 b/src/gsi/aniso_ens_util.f90 index 249b011308..f118bee40f 100644 --- a/src/gsi/aniso_ens_util.f90 +++ b/src/gsi/aniso_ens_util.f90 @@ -65,6 +65,7 @@ subroutine ens_uv_to_psichi(u,v,truewind) ! ! program history log: ! 2008-08-21 pondeca +! 2020-05-04 wu - no rotate_wind for fv3_regional ! ! input argument list: ! u(nlat,nlon) - earth relative u-field on analysis grid @@ -82,7 +83,7 @@ subroutine ens_uv_to_psichi(u,v,truewind) use kinds, only: i_kind,r_kind,r_single use constants, only: one,two use gridmod, only: nlon,nlat,region_lon,region_lat,region_dx,region_dy, & - rotate_wind_ll2xy + rotate_wind_ll2xy,fv3_regional use wind_fft, only: divvort_to_psichi implicit none @@ -116,19 +117,21 @@ subroutine ens_uv_to_psichi(u,v,truewind) ! minval(region_lon),maxval(region_lon) ! print*,'in ens_uv_to_psichi: region_lat,min,max=', & ! minval(region_lat),maxval(region_lat) - do i=1,nlat - do j=1,nlon - rlon=region_lon(i,j) - rlat=region_lat(i,j) - dlon=float(j)*one - dlat=float(i)*one - ue=u(i,j) - ve=v(i,j) - call rotate_wind_ll2xy(ue,ve,ug,vg,rlon,dlon,dlat) - u(i,j)=ug - v(i,j)=vg + if(.not.fv3_regional)then + do i=1,nlat + do j=1,nlon + rlon=region_lon(i,j) + rlat=region_lat(i,j) + dlon=float(j)*one + dlat=float(i)*one + ue=u(i,j) + ve=v(i,j) + call rotate_wind_ll2xy(ue,ve,ug,vg,rlon,dlon,dlat) + u(i,j)=ug + v(i,j)=vg + enddo enddo - enddo + endif if (truewind) return !========================================================================== !==>divergence and vorticity computation diff --git a/src/gsi/berror.f90 b/src/gsi/berror.f90 index ba501c6262..71bd4f1ea8 100644 --- a/src/gsi/berror.f90 +++ b/src/gsi/berror.f90 @@ -249,7 +249,7 @@ subroutine create_berror_vars !$$$ use balmod, only: llmin,llmax use gridmod, only: nlat,nlon,lat2,lon2,nsig,nnnn1o - use jfunc, only: nrclen,nclen,diag_precon + use jfunc, only: nrclen,nclen use constants, only: zero,one implicit none @@ -293,7 +293,7 @@ subroutine create_berror_vars dssvs = zero endif allocate(varprd(nrclen)) - if(diag_precon)allocate(vprecond(nclen)) + allocate(vprecond(nclen)) allocate(inaxs(nf,nlon/8),inxrs(nlon/8,mr:nr) ) allocate(slw(ny*nx,nnnn1o),& @@ -330,7 +330,6 @@ subroutine destroy_berror_vars ! machine: ibm RS/6000 SP ! !$$$ - use jfunc, only: diag_precon implicit none if(allocated(table)) deallocate(table) deallocate(wtaxs) @@ -342,7 +341,7 @@ subroutine destroy_berror_vars if(allocated(alv)) deallocate(alv) if(allocated(dssv)) deallocate(dssv) if(allocated(dssvs)) deallocate(dssvs) - if(diag_precon)deallocate(vprecond) + deallocate(vprecond) deallocate(slw,slw1,slw2) deallocate(ii,jj,ii1,jj1,ii2,jj2) @@ -566,7 +565,7 @@ subroutine pcinfo use kinds, only: r_kind,i_kind use radinfo, only: ostats,rstats,varA,jpch_rad,npred,newpc4pred use aircraftinfo, only: aircraft_t_bc_pof,aircraft_t_bc,ntail,npredt,ostats_t,rstats_t,varA_t - use jfunc, only: nclen,nrclen,diag_precon,step_start,ntclen + use jfunc, only: nclen,nrclen,step_start,ntclen,diag_precon use constants, only: zero,one implicit none @@ -580,10 +579,10 @@ subroutine pcinfo ! Only diagonal elements are considered ! set a coeff. factor for variances of control variables - if(diag_precon)then - lfact=step_start - vprecond=lfact + lfact=step_start + vprecond=lfact + if(diag_precon)then if(newpc4pred)then ! for radiance bias predictor coeff. nclen1=nclen-nrclen @@ -591,6 +590,7 @@ subroutine pcinfo do i=1,jpch_rad do j=1,npred ii=ii+1 +! if (ostats(i)>zero) vprecond(nclen1+ii)=vprecond(nclen1+ii)/(one+rstats(j,i)*varprd(ii)) if (ostats(i)>zero) vprecond(nclen1+ii)=one/(one+rstats(j,i)*varprd(ii)) if (ostats(i)>20.0_r_kind) then if (rstats(j,i)>zero) then @@ -615,6 +615,7 @@ subroutine pcinfo if (aircraft_t_bc_pof) obs_count = ostats_t(j,i) if (aircraft_t_bc) obs_count = ostats_t(1,i) +! if (obs_count>zero) vprecond(nclen1+ii)=vprecond(nclen1+ii)/(one+rstats_t(j,i)*varprd(jj)) if (obs_count>zero) vprecond(nclen1+ii)=one/(one+rstats_t(j,i)*varprd(jj)) if (obs_count>3.0_r_kind) then varA_t(j,i)=one/(one/varprd(jj)+rstats_t(j,i)) @@ -917,7 +918,7 @@ subroutine create_berror_vars_reg use constants, only: zero use balmod, only: llmin,llmax use gridmod, only: nlat,nlon,nsig,nnnn1o,lat2,lon2 - use jfunc, only: nrclen,nclen,diag_precon + use jfunc, only: nrclen,nclen implicit none nx=nlon @@ -940,7 +941,7 @@ subroutine create_berror_vars_reg endif allocate(varprd(max(1,nrclen) ) ) - if(diag_precon)allocate(vprecond(nclen)) + allocate(vprecond(nclen)) allocate(slw(ny*nx,nnnn1o) ) allocate(ii(ny,nx,3,nnnn1o),jj(ny,nx,3,nnnn1o) ) @@ -973,7 +974,6 @@ subroutine destroy_berror_vars_reg ! machine: ibm RS/6000 SP ! !$$$ - use jfunc, only:diag_precon implicit none deallocate(be,qvar3d) @@ -984,7 +984,7 @@ subroutine destroy_berror_vars_reg deallocate(ii,jj) deallocate(slw) deallocate(varprd) - if(diag_precon)deallocate(vprecond) + deallocate(vprecond) return end subroutine destroy_berror_vars_reg diff --git a/src/gsi/bicg.f90 b/src/gsi/bicg.f90 index 4fc7dbe863..6eb2f78905 100644 --- a/src/gsi/bicg.f90 +++ b/src/gsi/bicg.f90 @@ -31,8 +31,7 @@ subroutine bicg() use kinds, only: r_kind,i_kind,r_quad use gsi_4dvar, only: l4dvar, & ladtest, lgrtest, lanczosave, ltcost, nwrvecs -use jfunc, only: jiter,miter,niter,xhatsave,yhatsave,jiterstart, & - diag_precon +use jfunc, only: jiter,miter,niter,xhatsave,yhatsave,jiterstart use constants, only: zero,tiny_r_kind use mpimod, only: mype use obs_sensitivity, only: lobsensmin, lobsensfc, lobsensincr, & @@ -99,23 +98,24 @@ subroutine bicg() if(LMPCGL) then call pcgprecond(gradx,grady) else - call bkerror(gradx,grady) + grady=gradx + call bkerror(grady) ! If hybrid ensemble run, then multiply ensemble control variable a_en ! by its localization correlation if(l_hyb_ens) then if(aniso_a_en) then - ! call anbkerror_a_en(gradx,grady) ! not available yet + ! call anbkerror_a_en(grady) ! not available yet write(6,*)' ANBKERROR_A_EN not written yet, program stops' call stop2 (999) else - call bkerror_a_en(gradx,grady) + call bkerror_a_en(grady) end if end if ! Add potential additional preconditioner - if(diag_precon) call precond(grady) + call precond(grady) endif zg0=dot_product(gradx,grady,r_quad) @@ -188,24 +188,25 @@ subroutine bicg() else ! not sensitivity run - call bkerror(gradf,grads) + grads=gradf + call bkerror(grads) ! If hybrid ensemble run, then multiply ensemble control variable a_en ! by its localization correlation if(l_hyb_ens) then if(aniso_a_en) then -! call anbkerror_a_en(gradf,grads) ! not available yet +! call anbkerror_a_en(grads) ! not available yet write(6,*)' ANBKERROR_A_EN not written yet, program stops' stop else - call bkerror_a_en(gradf,grads) + call bkerror_a_en(grads) end if end if ! Add potential additional preconditioner - if(diag_precon) call precond(grads) + call precond(grads) ! Update xhatsave do ii=1,xhat%lencv diff --git a/src/gsi/bicglanczos.F90 b/src/gsi/bicglanczos.F90 index ea0d89ddd0..1914b0214d 100755 --- a/src/gsi/bicglanczos.F90 +++ b/src/gsi/bicglanczos.F90 @@ -66,7 +66,7 @@ module bicglanczos use gsi_bundlemod, only: assignment(=) use mpimod , only : mpi_comm_world use mpimod, only: mype -use jfunc , only : iter, jiter, diag_precon,step_start +use jfunc , only : iter, jiter use gsi_4dvar, only : nwrvecs,l4dvar,lanczosave use gsi_4dvar, only : nsubwin, nobs_bins use hybrid_ensemble_parameters,only : l_hyb_ens,aniso_a_en @@ -246,7 +246,7 @@ subroutine pcglanczos(xhat,yhat,pcost,gradx,grady,preduc,kmaxit,lsavevecs) call allocate_cv(dirx) call allocate_cv(diry) if(nprt>=1.and.ltcost_) call allocate_cv(gradf) -if(diag_precon) call allocate_cv(dirw) +call allocate_cv(dirw) !--- 'zeta' is an upper bound on the relative error of the gradient. @@ -256,7 +256,7 @@ subroutine pcglanczos(xhat,yhat,pcost,gradx,grady,preduc,kmaxit,lsavevecs) ilen=xhat%lencv -if(diag_precon) dirw=zero +dirw=zero !$omp parallel do do jj=1,ilen @@ -266,12 +266,10 @@ subroutine pcglanczos(xhat,yhat,pcost,gradx,grady,preduc,kmaxit,lsavevecs) end do !$omp end parallel do -if(diag_precon) then - do jj=1,ilen - dirw%values(jj)=diry%values(jj) - end do - call precond(diry) -end if +do jj=1,ilen + dirw%values(jj)=diry%values(jj) +end do +call precond(diry) if(LMPCGL) then dirx=zero @@ -284,7 +282,7 @@ subroutine pcglanczos(xhat,yhat,pcost,gradx,grady,preduc,kmaxit,lsavevecs) zg0=dot_product(gradx,grady,r_quad) if(zg0=1.and.ltcost_) call deallocate_cv(gradf) call deallocate_cv(diry) call deallocate_cv(dirx) @@ -370,24 +368,25 @@ subroutine pcglanczos(xhat,yhat,pcost,gradx,grady,preduc,kmaxit,lsavevecs) if(LMPCGL) then call pcgprecond(gradx,grady) else - call bkerror(gradx,grady) + grady=gradx + call bkerror(grady) ! If hybrid ensemble run, then multiply ensemble control variable a_en ! by its localization correlation if(l_hyb_ens) then if(aniso_a_en) then - ! call anbkerror_a_en(gradx,grady) ! not available yet + ! call anbkerror_a_en(grady) ! not available yet write(6,*)' ANBKERROR_A_EN not written yet, program stops' stop else - call bkerror_a_en(gradx,grady) + call bkerror_a_en(grady) end if end if endif ! Add potential additional preconditioner - if(diag_precon) call precond(grady) + call precond(grady) ! Second re-orthogonalization @@ -416,21 +415,17 @@ subroutine pcglanczos(xhat,yhat,pcost,gradx,grady,preduc,kmaxit,lsavevecs) endif ! Update search direction - if(diag_precon) then - do jj=1,ilen - diry%values(jj)=dirw%values(jj) - enddo - end if + do jj=1,ilen + diry%values(jj)=dirw%values(jj) + enddo do jj=1,ilen dirx%values(jj)=-grady%values(jj)+beta(iter)*dirx%values(jj) diry%values(jj)=-gradx%values(jj)+beta(iter)*diry%values(jj) end do - if(diag_precon) then - do jj=1,ilen - dirw%values(jj)=diry%values(jj) - end do - call precond(diry) - end if + do jj=1,ilen + dirw%values(jj)=diry%values(jj) + end do + call precond(diry) ! Diagnostics if(zgk < zero) then @@ -682,7 +677,7 @@ subroutine pcglanczos(xhat,yhat,pcost,gradx,grady,preduc,kmaxit,lsavevecs) call deallocate_cv(dirx) call deallocate_cv(diry) if(nprt>=1.and.ltcost_) call deallocate_cv(gradf) -if(diag_precon) call deallocate_cv(dirw) +call deallocate_cv(dirw) call inquire_cv @@ -905,18 +900,19 @@ subroutine pcgprecond(xcvx,ycvx) enddo !Apply B -call bkerror(xcvx,ycvx) +ycvx=xcvx +call bkerror(ycvx) ! If hybrid ensemble run, then multiply ensemble control variable a_en ! by its localization correlation if(l_hyb_ens) then if(aniso_a_en) then -! call anbkerror_a_en(xcvx,ycvx) ! not available yet +! call anbkerror_a_en(ycvx) ! not available yet write(6,*)' ANBKERROR_A_EN not written yet, program stops' call stop2(999) else - call bkerror_a_en(xcvx,ycvx) + call bkerror_a_en(ycvx) end if end if diff --git a/src/gsi/bkerror.f90 b/src/gsi/bkerror.f90 index 261a4c66ca..b3a0140691 100644 --- a/src/gsi/bkerror.f90 +++ b/src/gsi/bkerror.f90 @@ -1,4 +1,4 @@ -subroutine bkerror(gradx,grady) +subroutine bkerror(grady) !$$$ subprogram documentation block ! . . . . @@ -41,10 +41,10 @@ subroutine bkerror(gradx,grady) ! this is a hybrid ensemble run. ! ! input argument list: -! gradx - input field +! grady - input field ! ! output -! grady - background structure * gradx +! grady - background structure * grady ! ! attributes: ! language: f90 @@ -55,7 +55,6 @@ subroutine bkerror(gradx,grady) use berror, only: varprd,fpsproj,fut2ps use balmod, only: balance,tbalance use gsi_4dvar, only: nsubwin, lsqrtb - use gridmod, only: nlat,nlon,periodic use jfunc, only: nsclen,npclen,ntclen use jfunc, only: set_sqrt_2dsize use constants, only: zero @@ -63,15 +62,11 @@ subroutine bkerror(gradx,grady) use control_vectors, only: mvars,nrf,nrf_var,nrf_3d use timermod, only: timer_ini,timer_fnl use gsi_bundlemod, only: gsi_bundlegetpointer,gsi_bundlemerge,gsi_bundle,gsi_bundledup,gsi_bundledestroy - use general_sub2grid_mod, only: general_sub2grid,general_grid2sub -! use general_commvars_mod, only: s2g_raf - use general_commvars_mod, only: s2g_cv use hybrid_ensemble_isotropic, only: sqrt_beta_s_mult use hybrid_ensemble_parameters, only: l_hyb_ens implicit none ! Declare passed variables - type(control_vector),intent(inout) :: gradx type(control_vector),intent(inout) :: grady ! Declare local variables @@ -79,7 +74,6 @@ subroutine bkerror(gradx,grady) integer(i_kind) i_t,i_p,i_st,i_vp integer(i_kind) ipnts(4),istatus ! integer(i_kind) nval_lenz,ndim2d - real(r_kind),dimension(nlat*nlon*s2g_cv%nlevs_alloc)::workcv real(r_kind),pointer,dimension(:,:,:):: p_t =>NULL() real(r_kind),pointer,dimension(:,:,:):: p_st =>NULL() real(r_kind),pointer,dimension(:,:,:):: p_vp =>NULL() @@ -100,23 +94,6 @@ subroutine bkerror(gradx,grady) ! Initialize timer call timer_ini('bkerror') -! If dealing with periodic (sub)domain, gather full domain grids, -! account for periodicity, and redistribute to subdomains. This -! only needs to be done when running with a single mpi task and -! then only for array gradx. - if (periodic) then - do ii=1,nsubwin - call general_sub2grid(s2g_cv,gradx%step(ii)%values,workcv) - call general_grid2sub(s2g_cv,workcv,gradx%step(ii)%values) - end do - endif - -! Put things in grady first since operations change input variables - grady=gradx - -! if ensemble run, multiply by sqrt_beta_s - if(l_hyb_ens) call sqrt_beta_s_mult(grady) - ! Only need to get pointer for ii=1 - all other are the same call gsi_bundlegetpointer ( grady%step(1), (/'t ','sf','vp','ps'/), & ipnts, istatus ) @@ -126,6 +103,9 @@ subroutine bkerror(gradx,grady) i_p = ipnts(4) dobal = i_t>0.and.i_p>0.and.i_st>0.and.i_vp>0 +! if ensemble run, multiply by sqrt_beta_s + if(l_hyb_ens) call sqrt_beta_s_mult(grady) + ! Loop on control steps do ii=1,nsubwin @@ -186,7 +166,12 @@ subroutine bkerror(gradx,grady) call stop2(999) endif +! if ensemble run, multiply by sqrt_beta_s + if(l_hyb_ens) call sqrt_beta_s_mult(grady) + + ! Take care of background error for bias correction terms + do i=1,nsclen grady%predr(i)=grady%predr(i)*varprd(i) end do @@ -199,9 +184,6 @@ subroutine bkerror(gradx,grady) end do end if -! if ensemble run, multiply by sqrt_beta_s - if(l_hyb_ens) call sqrt_beta_s_mult(grady) - ! Finalize timer call timer_fnl('bkerror') diff --git a/src/gsi/bkgvar.f90 b/src/gsi/bkgvar.f90 index f2f5e449a5..705212eeb5 100644 --- a/src/gsi/bkgvar.f90 +++ b/src/gsi/bkgvar.f90 @@ -83,7 +83,7 @@ subroutine bkgvar(cvec,iflg) real(r_kind),pointer,dimension(:,:) ::ptrsst=>NULL() real(r_kind),pointer,dimension(:,:) ::ptrstl=>NULL() real(r_kind),pointer,dimension(:,:) ::ptrsti=>NULL() - real(r_kind),dimension(lat2,lon2) :: sst,stl,sti + real(r_kind),dimension(lat2,lon2) :: sst ! Multipy by variances !$omp parallel do schedule(dynamic,1) private(n,k,i,j,ptr3d,istatus) @@ -105,15 +105,17 @@ subroutine bkgvar(cvec,iflg) call gsi_bundlegetpointer(cvec,'sst',ptrsst,istatus) call gsi_bundlegetpointer(cvec,'stl',ptrstl,istatus) call gsi_bundlegetpointer(cvec,'sti',ptrsti,istatus) - sst=zero - stl=zero - sti=zero + if(iflg == 0)then + if(i_sst > 0)sst=zero + if(i_stl > 0)ptrstl=zero + if(i_sti > 0)ptrsti=zero + end if ! Surface fields ! !$omp parallel do schedule(dynamic,1) private(n,i,j,ptr2d,istatus) do n=1,cvec%n2d - call gsi_bundlegetpointer(cvec,cvec%r2(n)%shortname,ptr2d,istatus) if(n/=i_sst.and.n/=i_stl.and.n/=i_sti) then + call gsi_bundlegetpointer(cvec,cvec%r2(n)%shortname,ptr2d,istatus) do i=1,lon2 do j=1,lat2 ptr2d(j,i)=ptr2d(j,i)*dssvs(j,i,n) @@ -130,13 +132,13 @@ subroutine bkgvar(cvec,iflg) elseif(n==i_stl) then do i=1,lon2 do j=1,lat2 - if(isli2(j,i) == 1) stl(j,i)=ptrsst(j,i)*dssvs(j,i,n) + if(isli2(j,i) == 1) ptrstl(j,i)=ptrsst(j,i)*dssvs(j,i,n) end do end do elseif(n==i_sti) then do i=1,lon2 do j=1,lat2 - if(isli2(j,i) == 2) sti(j,i)=ptrsst(j,i)*dssvs(j,i,n) + if(isli2(j,i) == 2) ptrsti(j,i)=ptrsst(j,i)*dssvs(j,i,n) end do end do end if @@ -144,19 +146,19 @@ subroutine bkgvar(cvec,iflg) if(n==i_sst) then do i=1,lon2 do j=1,lat2 - if(isli2(j,i)/=1.and.isli2(j,i)/=2) sst(j,i)=ptrsst(j,i)*dssvs(j,i,n) + if(isli2(j,i)/=1.and.isli2(j,i)/=2) ptrsst(j,i)=ptrsst(j,i)*dssvs(j,i,n) end do end do elseif(n==i_stl) then do i=1,lon2 do j=1,lat2 - if(isli2(j,i) == 1) sst(j,i)=ptrstl(j,i)*dssvs(j,i,n) + if(isli2(j,i) == 1) ptrsst(j,i)=ptrstl(j,i)*dssvs(j,i,n) end do end do elseif(n==i_sti) then do i=1,lon2 do j=1,lat2 - if(isli2(j,i) == 2) sst(j,i)=ptrsti(j,i)*dssvs(j,i,n) + if(isli2(j,i) == 2) ptrsst(j,i)=ptrsti(j,i)*dssvs(j,i,n) end do end do end if @@ -164,15 +166,8 @@ subroutine bkgvar(cvec,iflg) end if end do + if(iflg == 0 .and. i_sst>0) ptrsst=sst - if(iflg==0) then - if(i_sst>0) ptrsst=sst - if(i_stl>0) ptrstl=stl - if(i_sti>0) ptrsti=sti - else - if(i_sst>0) ptrsst=sst -! ignore contents of ptrstl,ptrsti - end if return end subroutine bkgvar diff --git a/src/gsi/bkgvar_rewgt.f90 b/src/gsi/bkgvar_rewgt.f90 index 5c1174dc6e..ca82882af3 100644 --- a/src/gsi/bkgvar_rewgt.f90 +++ b/src/gsi/bkgvar_rewgt.f90 @@ -222,15 +222,15 @@ subroutine bkgvar_rewgt(sfvar,vpvar,tvar,psvar,mype) do k=1,nsig do j=1,lon2 do i=1,lat2 - delpsi(i,j,k)=sqrt( delpsi(i,j,k)**two ) - delchi(i,j,k)=sqrt( delchi(i,j,k)**two ) - deltv (i,j,k)=sqrt( deltv (i,j,k)**two ) + delpsi(i,j,k)=abs( delpsi(i,j,k) ) + delchi(i,j,k)=abs( delchi(i,j,k) ) + deltv (i,j,k)=abs( deltv (i,j,k) ) end do end do end do do j=1,lon2 do i=1,lat2 - delps(i,j)=sqrt( delps(i,j)**two ) + delps(i,j)=abs( delps(i,j) ) end do end do diff --git a/src/gsi/control2state.f90 b/src/gsi/control2state.f90 index c652d1574d..d32e37b13a 100644 --- a/src/gsi/control2state.f90 +++ b/src/gsi/control2state.f90 @@ -237,7 +237,7 @@ subroutine control2state(xhat,sval,bval) call general_grid2sub(s2g_cv,hwork,wbundle%values) end if -!$omp parallel sections private(istatus,ii,ic,id,sv_u,sv_v,sv_prse,sv_q,sv_tsen,uland,vland,uwter,vwter) +!$omp parallel sections private(istatus,ii,ic,id,uland,vland,uwter,vwter) !$omp section @@ -289,6 +289,8 @@ subroutine control2state(xhat,sval,bval) call gsi_bundlegetpointer (wbundle,'t' ,cv_t, istatus) call gsi_bundlegetpointer (wbundle,'q' ,cv_rh ,istatus) +! Copy other variables + call gsi_bundlegetvar ( wbundle, 't' , sv_tv, istatus ) ! Get 3d pressure if(do_getprs_tl) call getprs_tl(cv_ps,cv_t,sv_prse) @@ -298,8 +300,6 @@ subroutine control2state(xhat,sval,bval) ! Calculate sensible temperature if(do_tv_to_tsen) call tv_to_tsen(cv_t,sv_q,sv_tsen) -! Copy other variables - call gsi_bundlegetvar ( wbundle, 't' , sv_tv, istatus ) if (do_cw_to_hydro .and. .not.do_cw_to_hydro_hwrf) then ! Case when cloud-vars do not map one-to-one (cv-to-sv) @@ -323,10 +323,10 @@ subroutine control2state(xhat,sval,bval) endif enddo end if - -!$omp section call gsi_bundlegetpointer (sval(jj),'ps' ,sv_ps, istatus) call gsi_bundlegetvar ( wbundle, 'ps' , sv_ps, istatus ) + +!$omp section call gsi_bundlegetpointer (sval(jj),'sst' ,sv_sst, istatus) call gsi_bundlegetvar ( wbundle, 'sst', sv_sst, istatus ) call gsi_bundlegetpointer (sval(jj),'oz' ,sv_oz , istatus_oz) diff --git a/src/gsi/convinfo.f90 b/src/gsi/convinfo.f90 index 9b19a29b06..f6ba29c2e1 100755 --- a/src/gsi/convinfo.f90 +++ b/src/gsi/convinfo.f90 @@ -250,9 +250,11 @@ subroutine convinfo_read end if if(cflg == '!')cycle read(crecord,*)ictypet,icsubtypet,icuset - if (mype==0 .and. icuset < use_limit) write(6, *) & - 'line ignored in convinfo due to use flag ',cflg,iotype,ictypet,icsubtypet,icuset - if(icuset < use_limit)cycle + if(icuset < use_limit)then + if (mype==0) write(6, *) 'line ignored in convinfo due to use flag ',& + cflg,iotype,ictypet,icsubtypet,icuset + cycle + end if nc=nc+1 ioctype(nc)=iotype !otype type isub iuse twindow numgrp ngroup nmiter gross ermax ermin var_b var_pg ithin rmesh pmesh npred pmot ptime diff --git a/src/gsi/correlated_obsmod.F90 b/src/gsi/correlated_obsmod.F90 index c56c1e1764..287c39bb0c 100644 --- a/src/gsi/correlated_obsmod.F90 +++ b/src/gsi/correlated_obsmod.F90 @@ -432,7 +432,7 @@ subroutine set_(instrument,fname,mask,method,kreq,kmut,ErrorCov) ! Done reading file close(lu) else - write(6,*) 'No Rcov files found. Turning off Correlated Error' + if (iamroot_) write(6,*) 'No Rcov files found. Turning off Correlated Error' return end if diff --git a/src/gsi/cplr_gfs_ensmod.f90 b/src/gsi/cplr_gfs_ensmod.f90 index d9614b83aa..8baf06067a 100644 --- a/src/gsi/cplr_gfs_ensmod.f90 +++ b/src/gsi/cplr_gfs_ensmod.f90 @@ -104,26 +104,16 @@ subroutine get_gfs_Nens(this,grd,members,ntindex,atm_bundle,iret) ! Declare internal variables character(len=*),parameter :: myname_='get_user_ens_gfs' - real(r_single),allocatable,dimension(:,:,:,:) :: en_loc3 - integer(i_kind) :: m_cvars2d(nc2d),m_cvars3d(nc3d) integer(i_kind) :: n - real(r_kind),allocatable,dimension(:) :: clons,slons associate( this => this ) ! eliminates warning for unused dummy argument needed for binding end associate if ( (use_gfs_nemsio .or. use_gfs_ncio) .and. ens_fast_read ) then - allocate(en_loc3(grd_ens%lat2,grd_ens%lon2,nc2d+nc3d*grd_ens%nsig,members)) - allocate(clons(grd_ens%nlon),slons(grd_ens%nlon)) - call get_user_ens_gfs_fastread_(ntindex,en_loc3,m_cvars2d,m_cvars3d, & - grd_ens%lat2,grd_ens%lon2,grd_ens%nsig, & - nc2d,nc3d,members,iret,clons,slons) - do n=1,members - call move2bundle_(grd,en_loc3(:,:,:,n),atm_bundle(n), & - m_cvars2d,m_cvars3d,iret,clons,slons) - end do - deallocate(en_loc3,clons,slons) + call get_user_ens_gfs_fastread_(ntindex,atm_bundle, & + grd_ens%lat2,grd_ens%lon2, & + nc2d,nc3d,iret,grd) else do n = 1,members call get_gfs_ens(this,grd,n,ntindex,atm_bundle(n),iret) @@ -134,8 +124,8 @@ subroutine get_gfs_Nens(this,grd,members,ntindex,atm_bundle,iret) end subroutine get_gfs_Nens -subroutine get_user_ens_gfs_fastread_(ntindex,en_loc3,m_cvars2d,m_cvars3d, & - lat2in,lon2in,nsigin,nc2din,nc3din,n_ensin,iret,clons,slons) +subroutine get_user_ens_gfs_fastread_(ntindex,atm_bundle, & + lat2in,lon2in,nc2din,nc3din,iret,grd) !$$$ subprogram documentation block ! . . . . ! subprogram: get_user_ens_gfs_fastread_ @@ -178,8 +168,9 @@ subroutine get_user_ens_gfs_fastread_(ntindex,en_loc3,m_cvars2d,m_cvars3d, & use mpimod, only: mpi_comm_world,ierror,mpi_real8,mpi_integer4,mpi_max use kinds, only: i_kind,r_single,r_kind use constants, only: zero - use general_sub2grid_mod, only: sub2grid_info + use general_sub2grid_mod, only: sub2grid_info,general_sub2grid_destroy_info use gsi_4dvar, only: ens_fhrlevs + use gsi_bundlemod, only: gsi_bundle use hybrid_ensemble_parameters, only: n_ens,grd_ens use hybrid_ensemble_parameters, only: ensemble_path use control_vectors, only: nc2d,nc3d @@ -192,11 +183,10 @@ subroutine get_user_ens_gfs_fastread_(ntindex,en_loc3,m_cvars2d,m_cvars3d, & ! Declare passed variables integer(i_kind), intent(in ) :: ntindex - real(r_single), intent(inout) :: en_loc3(lat2in,lon2in,nc2din+nc3din*nsigin,n_ensin) - integer(i_kind), intent(inout) :: m_cvars2d(nc2din),m_cvars3d(nc3din) - integer(i_kind), intent(in ) :: lat2in,lon2in,nsigin,nc2din,nc3din,n_ensin + integer(i_kind), intent(in ) :: lat2in,lon2in,nc2din,nc3din integer(i_kind), intent( out) :: iret - real(r_kind), intent(inout) :: clons(grd_ens%nlon),slons(grd_ens%nlon) + type(sub2grid_info), intent(in ) :: grd + type(gsi_bundle), intent(inout) :: atm_bundle(:) ! Declare internal variables @@ -214,27 +204,21 @@ subroutine get_user_ens_gfs_fastread_(ntindex,en_loc3,m_cvars2d,m_cvars3d, & integer(i_kind) :: nlon,nlat,nsig type(genex_info) :: s_a2b real(r_single),allocatable,dimension(:,:,:,:) :: en_full,en_loc + real(r_kind),allocatable,dimension(:,:,:) :: en_loc3 integer(i_kind),allocatable,dimension(:) :: m_cvars2dw,m_cvars3dw - integer(i_kind) base_pe,base_pe0 + integer(i_kind) :: m_cvars2d(nc2d),m_cvars3d(nc3d) + type(sub2grid_info) :: grd3d - iret = 0 nlat=grd_ens%nlat nlon=grd_ens%nlon nsig=grd_ens%nsig - ! write out contents of cvars2d, cvars3d - - !if (mype == 0 ) then - ! write(6,*) ' in get_user_ens_fastread_,cvars2d=',(trim(cvars2d(i)),i=1,2) - ! write(6,*) ' in get_user_ens_fastread_,cvars3d=',(trim(cvars3d(i)),i=1,6) - !endif - ! set up partition of available processors for parallel read if ( n_ens > npe ) & call die(myname_, ': ***ERROR*** CANNOT READ ENSEMBLE n_ens > npe, increase npe >= n_ens', 99) - call ens_io_partition_(n_ens,io_pe,n_io_pe_s,n_io_pe_e,n_io_pe_em,i_ens) + call ens_io_partition_(n_ens,ntindex,io_pe,n_io_pe_s,n_io_pe_e,n_io_pe_em,i_ens) ! setup communicator for scatter to subdomains: @@ -253,9 +237,9 @@ subroutine get_user_ens_gfs_fastread_(ntindex,en_loc3,m_cvars2d,m_cvars3d, & n2d=nc3d*grd_ens%nsig+nc2d ias=1 ; iae=0 ; jas=1 ; jae=0 ; kas=1 ; kae=0 ; mas=1 ; mae=0 if(mype==io_pe) then - ias=1 ; iae=nlat - jas=1 ; jae=nlon - kas=1 ; kae=n2d + iae=nlat + jae=nlon + kae=n2d mas=n_io_pe_s ; mae=n_io_pe_em endif iasm=ias ; iaem=iae ; jasm=jas ; jaem=jae ; kasm=kas ; kaem=kae ; masm=mas ; maem=mae @@ -273,52 +257,44 @@ subroutine get_user_ens_gfs_fastread_(ntindex,en_loc3,m_cvars2d,m_cvars3d, & iasm,iaem,jasm,jaem,kasm,kaem,masm,maem, & ibsm,ibem,jbsm,jbem,kbsm,kbem,mbsm,mbem) -!! read ensembles - - allocate(en_full(iasm:iaemz,jasm:jaemz,kasm:kaemz,masm:maemz)) - write(filename,22) trim(adjustl(ensemble_path)),ens_fhrlevs(ntindex),mas 22 format(a,'sigf',i2.2,'_ens_mem',i3.3) - if (cnvw_option) then - write(filenamesfc,23) trim(adjustl(ensemble_path)),ens_fhrlevs(ntindex),mas -23 format(a,'sfcf',i2.2,'_ens_mem',i3.3) - end if - allocate(m_cvars2dw(nc2din),m_cvars3dw(nc3din)) m_cvars2dw=-999 m_cvars3dw=-999 + allocate(en_full(iasm:iaemz,jasm:jaemz,kasm:kaemz,masm:maemz)) + +!! read ensembles + if ( mas == mae ) then if ( use_gfs_nemsio ) then if (cnvw_option) then + write(filenamesfc,23) trim(adjustl(ensemble_path)),ens_fhrlevs(ntindex),mas +23 format(a,'sfcf',i2.2,'_ens_mem',i3.3) call parallel_read_nemsio_state_(en_full,m_cvars2dw,m_cvars3dw,nlon,nlat,nsig, & ias,jas,mas, & iasm,iaemz,jasm,jaemz,kasm,kaemz,masm,maemz, & - filename,.true.,clons,slons,filenamesfc) + filename,.true.,filenamesfc) else call parallel_read_nemsio_state_(en_full,m_cvars2dw,m_cvars3dw,nlon,nlat,nsig, & ias,jas,mas, & iasm,iaemz,jasm,jaemz,kasm,kaemz,masm,maemz, & - filename,.true.,clons,slons) + filename,.true.) end if else call parallel_read_gfsnc_state_(en_full,m_cvars2dw,m_cvars3dw,nlon,nlat,nsig, & ias,jas,mas, & iasm,iaemz,jasm,jaemz,kasm,kaemz,masm,maemz, & - filename,.true.,clons,slons) + filename) end if end if - base_pe0=-999 - if ( mas == 1 .and. mae == 1 ) base_pe0=mype - - call mpi_allreduce(base_pe0,base_pe,1,mpi_integer4,mpi_max,mpi_comm_world,ierror) - call mpi_bcast(clons,grd_ens%nlon,mpi_real8,base_pe,mpi_comm_world,ierror) - call mpi_bcast(slons,grd_ens%nlon,mpi_real8,base_pe,mpi_comm_world,ierror) call mpi_allreduce(m_cvars2dw,m_cvars2d,nc2d,mpi_integer4,mpi_max,mpi_comm_world,ierror) call mpi_allreduce(m_cvars3dw,m_cvars3d,nc3d,mpi_integer4,mpi_max,mpi_comm_world,ierror) + deallocate(m_cvars2dw,m_cvars3dw) ! scatter to subdomains: allocate(en_loc(ibsm:ibemz,jbsm:jbemz,kbsm:kbemz,mbsm:mbemz)) @@ -329,9 +305,12 @@ subroutine get_user_ens_gfs_fastread_(ntindex,en_loc3,m_cvars2d,m_cvars3d, & deallocate(en_full) call genex_destroy_info(s_a2b) ! check on actual routine name -! transfer en_loc to en_loc3 +! transfer en_loc to en_loc3 then to atm_bundle + + allocate(en_loc3(lat2in,lon2in,nc2d+nc3d*nsig)) -! Look to thread here OMP + iret = 0 + call create_grd23d_(grd3d,nc2d+nc3d*grd%nsig) do n=1,n_ens do k=1,nc2d+nc3d*nsig jj=0 @@ -340,15 +319,19 @@ subroutine get_user_ens_gfs_fastread_(ntindex,en_loc3,m_cvars2d,m_cvars3d, & ii=0 do i=ibsm,ibem ii=ii+1 - en_loc3(ii,jj,k,n)=en_loc(i,j,k,n) + en_loc3(ii,jj,k)=en_loc(i,j,k,n) enddo enddo enddo + call move2bundle_(grd3d,en_loc3,atm_bundle(n),m_cvars2d,m_cvars3d,iret) enddo + call general_sub2grid_destroy_info(grd3d,grd) + deallocate(en_loc,en_loc3) + end subroutine get_user_ens_gfs_fastread_ -subroutine move2bundle_(grd,en_loc3,atm_bundle,m_cvars2d,m_cvars3d,iret,clons,slons) +subroutine move2bundle_(grd3d,en_loc3,atm_bundle,m_cvars2d,m_cvars3d,iret) !$$$ subprogram documentation block ! . . . . @@ -380,10 +363,10 @@ subroutine move2bundle_(grd,en_loc3,atm_bundle,m_cvars2d,m_cvars3d,iret,clons,sl use kinds, only: i_kind,r_kind,r_single use constants, only: zero,one,two,fv - use general_sub2grid_mod, only: sub2grid_info,general_sub2grid_destroy_info + use general_sub2grid_mod, only: sub2grid_info use hybrid_ensemble_parameters, only: en_perts use gsi_bundlemod, only: gsi_bundle - use gsi_bundlemod, only: gsi_bundlegetpointer,gsi_bundleputvar + use gsi_bundlemod, only: gsi_bundlegetpointer use gsi_bundlemod, only : assignment(=) use control_vectors, only: cvars2d,cvars3d,nc2d,nc3d use mpeu_util, only: getindex @@ -391,35 +374,28 @@ subroutine move2bundle_(grd,en_loc3,atm_bundle,m_cvars2d,m_cvars3d,iret,clons,sl implicit none ! Declare passed variables - type(sub2grid_info), intent(in ) :: grd - real(r_single), intent(in ) :: en_loc3(grd%lat2,grd%lon2,nc2d+nc3d*grd%nsig) + type(sub2grid_info), intent(in ) :: grd3d + real(r_kind), intent(inout) :: en_loc3(grd3d%lat2,grd3d%lon2,nc2d+nc3d*grd3d%nsig) type(gsi_bundle), intent(inout) :: atm_bundle integer(i_kind), intent(in ) :: m_cvars2d(nc2d),m_cvars3d(nc3d) integer(i_kind), intent( out) :: iret - real(r_kind), intent(in ) :: clons(grd%nlon),slons(grd%nlon) ! Declare internal variables character(len=*),parameter :: myname_='move2bundle_' character(len=70) :: filename integer(i_kind) :: ierr - integer(i_kind) :: im,jm,km,m,k + integer(i_kind) :: km,m integer(i_kind) :: icw,iql,iqi,iqr,iqs,iqg real(r_kind),pointer,dimension(:,:) :: ps !real(r_kind),pointer,dimension(:,:) :: sst real(r_kind),pointer,dimension(:,:,:) :: u,v,tv,q,oz,cwmr real(r_kind),pointer,dimension(:,:,:) :: qlmr,qimr,qrmr,qsmr,qgmr - real(r_single),allocatable,dimension(:,:) :: scr2 - real(r_single),allocatable,dimension(:,:,:) :: scr3 - type(sub2grid_info) :: grd2d,grd3d real(r_kind),parameter :: r0_001 = 0.001_r_kind - im = en_perts(1,1)%grid%im - jm = en_perts(1,1)%grid%jm - km = en_perts(1,1)%grid%km - allocate(scr2(im,jm)) - allocate(scr3(im,jm,km)) +!--- now update halo values of all variables using general_sub2grid + call update_halos_(grd3d,en_loc3) ! Check hydrometeors in control variables icw=getindex(cvars3d,'cw') @@ -457,81 +433,44 @@ subroutine move2bundle_(grd,en_loc3,atm_bundle,m_cvars2d,m_cvars3d,iret,clons,sl return endif + do m=1,nc2d - scr2(:,:)=en_loc3(:,:,m_cvars2d(m)) - if(trim(cvars2d(m))=='ps') ps=scr2 - ! if(trim(cvars2d(m))=='sst') sst=scr2 ! no sst for now +! convert ps from Pa to cb + if(trim(cvars2d(m))=='ps') ps=r0_001*en_loc3(:,:,m_cvars2d(m)) +! if(trim(cvars2d(m))=='sst') sst=en_loc3(:,:,m_cvars2d(m)) !no sst for now enddo + + km = en_perts(1,1)%grid%km +!$omp parallel do schedule(dynamic,1) private(m) do m=1,nc3d - do k=1,km - scr3(:,:,k)=en_loc3(:,:,m_cvars3d(m)+k-1) - enddo - if(trim(cvars3d(m))=='sf') u = scr3 - if(trim(cvars3d(m))=='vp') v = scr3 - if(trim(cvars3d(m))=='t') tv = scr3 - if(trim(cvars3d(m))=='q') q = scr3 - if(trim(cvars3d(m))=='oz') oz = scr3 - if(trim(cvars3d(m))=='cw') cwmr = scr3 - if(trim(cvars3d(m))=='ql') qlmr = scr3 - if(trim(cvars3d(m))=='qi') qimr = scr3 - if(trim(cvars3d(m))=='qr') qrmr = scr3 - if(trim(cvars3d(m))=='qs') qsmr = scr3 - if(trim(cvars3d(m))=='qg') qgmr = scr3 + if(trim(cvars3d(m))=='sf')then + u = en_loc3(:,:,m_cvars3d(m):m_cvars3d(m)+km) + else if(trim(cvars3d(m))=='vp') then + v = en_loc3(:,:,m_cvars3d(m):m_cvars3d(m)+km) + else if(trim(cvars3d(m))=='t') then + tv = en_loc3(:,:,m_cvars3d(m):m_cvars3d(m)+km) + else if(trim(cvars3d(m))=='q') then + q = en_loc3(:,:,m_cvars3d(m):m_cvars3d(m)+km) + else if(trim(cvars3d(m))=='oz') then + oz = en_loc3(:,:,m_cvars3d(m):m_cvars3d(m)+km) + else if(trim(cvars3d(m))=='cw') then + cwmr = en_loc3(:,:,m_cvars3d(m):m_cvars3d(m)+km) + else if(trim(cvars3d(m))=='ql') then + qlmr = en_loc3(:,:,m_cvars3d(m):m_cvars3d(m)+km) + else if(trim(cvars3d(m))=='qi') then + qimr = en_loc3(:,:,m_cvars3d(m):m_cvars3d(m)+km) + else if(trim(cvars3d(m))=='qr') then + qrmr = en_loc3(:,:,m_cvars3d(m):m_cvars3d(m)+km) + else if(trim(cvars3d(m))=='qs') then + qsmr = en_loc3(:,:,m_cvars3d(m):m_cvars3d(m)+km) + else if(trim(cvars3d(m))=='qg') then + qgmr = en_loc3(:,:,m_cvars3d(m):m_cvars3d(m)+km) + end if enddo -! convert ps from Pa to cb - ps=r0_001*ps ! convert t to virtual temperature tv=tv*(one+fv*q) -!--- now update pole values of atm_bundle using general_sub2grid (so halos also -! automatically updated. - - call create_grd23d_(grd2d,1) - call create_grd23d_(grd3d,grd%nsig) - - call update_scalar_poles_(grd2d,ps) - call update_vector_poles_(grd3d,u,v,clons,slons) - call update_scalar_poles_(grd3d,tv) - call update_scalar_poles_(grd3d,q) - call update_scalar_poles_(grd3d,oz) - if (icw>0) call update_scalar_poles_(grd3d,cwmr) - if (iql>0) call update_scalar_poles_(grd3d,qlmr) - if (iqi>0) call update_scalar_poles_(grd3d,qimr) - if (iqr>0) call update_scalar_poles_(grd3d,qrmr) - if (iqs>0) call update_scalar_poles_(grd3d,qsmr) - if (iqg>0) call update_scalar_poles_(grd3d,qgmr) - - call gsi_bundleputvar(atm_bundle,'ps',ps, ierr); iret = ierr - !call gsi_bundleputvar(atm_bundle,'sst',sst,ierr); iret = ierr + iret ! no sst for now - call gsi_bundleputvar(atm_bundle,'sf',u , ierr); iret = ierr + iret - call gsi_bundleputvar(atm_bundle,'vp',v , ierr); iret = ierr + iret - call gsi_bundleputvar(atm_bundle,'t' ,tv, ierr); iret = ierr + iret - call gsi_bundleputvar(atm_bundle,'q' ,q , ierr); iret = ierr + iret - call gsi_bundleputvar(atm_bundle,'oz',oz, ierr); iret = ierr + iret - if (icw>0) call gsi_bundleputvar(atm_bundle,'cw',cwmr,ierr); iret = ierr + iret - if (iql>0) call gsi_bundleputvar(atm_bundle,'ql',qlmr,ierr); iret = ierr + iret - if (iqi>0) call gsi_bundleputvar(atm_bundle,'qi',qimr,ierr); iret = ierr + iret - if (iqr>0) call gsi_bundleputvar(atm_bundle,'qr',qrmr,ierr); iret = ierr + iret - if (iqs>0) call gsi_bundleputvar(atm_bundle,'qs',qsmr,ierr); iret = ierr + iret - if (iqg>0) call gsi_bundleputvar(atm_bundle,'qg',qgmr,ierr); iret = ierr + iret - if ( iret /= 0 ) then - if ( mype == 0 ) then - write(6,'(A)') trim(myname_) // ': ERROR!' - write(6,'(A)') trim(myname_) // ': For now, GFS needs to put all MetFields: ps,u,v,(sf,vp)tv,q,oz,cw' - write(6,'(A)') trim(myname_) // ': but some have not been found. Aborting ... ' - write(6,'(A)') trim(myname_) // ': WARNING!' - write(6,'(3A,I5)') trim(myname_) // ': Trouble reading ensemble file : ', trim(filename), ', IRET = ', iret - endif - return - endif - - call general_sub2grid_destroy_info(grd2d,grd) - call general_sub2grid_destroy_info(grd3d,grd) - - if ( allocated(scr2) ) deallocate(scr2) - if ( allocated(scr3) ) deallocate(scr3) - return end subroutine move2bundle_ @@ -559,7 +498,7 @@ subroutine create_grd23d_(grd23d,nvert) end subroutine create_grd23d_ -subroutine update_scalar_poles_(grd,s) +subroutine update_halos_(grd,s) use kinds, only: i_kind,r_kind use general_sub2grid_mod, only: sub2grid_info,general_sub2grid,general_grid2sub @@ -598,9 +537,6 @@ subroutine update_scalar_poles_(grd,s) enddo call general_sub2grid(grd,sloc,work) - do k=kbegin_loc,kend_loc - call fillpoles_s_(work(1,:,:,k),nlon,nlat) - enddo call general_grid2sub(grd,work,sloc) ii=0 do k=1,nvert @@ -614,93 +550,9 @@ subroutine update_scalar_poles_(grd,s) deallocate(sloc,work) -end subroutine update_scalar_poles_ - -subroutine update_vector_poles_(grd,u,v,clons,slons) - - use kinds, only: i_kind,r_kind - use constants, only: zero - use general_sub2grid_mod, only: sub2grid_info,general_sub2grid,general_grid2sub - - implicit none - - ! Declare local parameters - - ! Declare passed variables - type(sub2grid_info) ,intent(in ) :: grd - real(r_kind) ,intent(inout) :: u(grd%lat2,grd%lon2,grd%num_fields) - real(r_kind) ,intent(inout) :: v(grd%lat2,grd%lon2,grd%num_fields) - real(r_kind) ,intent(in ) :: clons(grd%nlon),slons(grd%nlon) - - ! Declare local variables - integer(i_kind) inner_vars,lat2,lon2,nlat,nlon,nvert,kbegin_loc,kend_loc,kend_alloc - integer(i_kind) ii,i,j,k - real(r_kind),allocatable,dimension(:) :: uloc,vloc - real(r_kind),allocatable,dimension(:,:,:,:) :: uwork,vwork - real(r_kind),allocatable,dimension(:,:) :: tempu,tempv - - lat2=grd%lat2 - lon2=grd%lon2 - nlat=grd%nlat - nlon=grd%nlon - nvert=grd%num_fields - inner_vars=grd%inner_vars - kbegin_loc=grd%kbegin_loc - kend_loc=grd%kend_loc - kend_alloc=grd%kend_alloc - allocate(uloc(lat2*lon2*nvert)) - allocate(vloc(lat2*lon2*nvert)) - allocate(uwork(inner_vars,nlat,nlon,kbegin_loc:kend_alloc)) - allocate(vwork(inner_vars,nlat,nlon,kbegin_loc:kend_alloc)) - allocate(tempu(nlat,nlon),tempv(nlat,nlon)) - uwork=zero ; vwork=zero ; uloc=zero ; vloc=zero - ii=0 - do k=1,nvert - do j=1,lon2 - do i=1,lat2 - ii=ii+1 - uloc(ii)=u(i,j,k) - vloc(ii)=v(i,j,k) - enddo - enddo - enddo - call general_sub2grid(grd,uloc,uwork) - call general_sub2grid(grd,vloc,vwork) - - do k=kbegin_loc,kend_loc - do j=1,nlon - do i=1,nlat - tempu(i,j)=uwork(1,i,j,k) - tempv(i,j)=vwork(1,i,j,k) - enddo - enddo - call fillpoles_v_(tempu,tempv,nlon,nlat,clons,slons) - do j=1,nlon - do i=1,nlat - uwork(1,i,j,k)=tempu(i,j) - vwork(1,i,j,k)=tempv(i,j) - enddo - enddo - enddo - call general_grid2sub(grd,uwork,uloc) - call general_grid2sub(grd,vwork,vloc) - ii=0 - do k=1,nvert - do j=1,lon2 - do i=1,lat2 - ii=ii+1 - u(i,j,k)=uloc(ii) - v(i,j,k)=vloc(ii) - enddo - enddo - enddo - - deallocate(uloc,uwork,tempu) - deallocate(vloc,vwork,tempv) - -end subroutine update_vector_poles_ +end subroutine update_halos_ -subroutine ens_io_partition_(n_ens,io_pe,n_io_pe_s,n_io_pe_e,n_io_pe_em,i_ens) +subroutine ens_io_partition_(n_ens,ntindex,io_pe,n_io_pe_s,n_io_pe_e,n_io_pe_em,i_ens) ! do computation on all processors, then assign final local processor ! values. @@ -711,7 +563,7 @@ subroutine ens_io_partition_(n_ens,io_pe,n_io_pe_s,n_io_pe_e,n_io_pe_em,i_ens) implicit none ! Declare passed variables - integer(i_kind),intent(in ) :: n_ens + integer(i_kind),intent(in ) :: n_ens,ntindex integer(i_kind),intent( out) :: io_pe,n_io_pe_s,n_io_pe_e,n_io_pe_em,i_ens ! Declare local variables @@ -739,9 +591,11 @@ subroutine ens_io_partition_(n_ens,io_pe,n_io_pe_s,n_io_pe_e,n_io_pe_em,i_ens) endif ipe=ipe+jskip enddo - do n=1,n_ens - if(mype==0) write(6,'(2(a,1x,i5,1x))') 'reading ensemble member', n, 'on pe', io_pe0(n) - enddo + if(mype==0)then + do n=1,n_ens + write(6,'(3(a,1x,i5,1x))') 'reading ensemble member', n,' time level',ntindex,'on pe', io_pe0(n) + enddo + end if do n=1,n_ens if(mype==io_pe0(n)) then @@ -758,10 +612,10 @@ end subroutine ens_io_partition_ subroutine parallel_read_nemsio_state_(en_full,m_cvars2d,m_cvars3d,nlon,nlat,nsig, & ias,jas,mas, & iasm,iaemz,jasm,jaemz,kasm,kaemz,masm,maemz, & - filename,init_head,clons,slons,filenamesfc) + filename,init_head,filenamesfc) use kinds, only: i_kind,r_kind,r_single - use constants, only: r60,r3600,zero,one,half,pi,deg2rad + use constants, only: r60,r3600,zero,one,half,deg2rad use nemsio_module, only: nemsio_init,nemsio_open,nemsio_close use ncepnems_io, only: error_msg,imp_physics use nemsio_module, only: nemsio_gfile,nemsio_getfilehead,nemsio_readrecv @@ -783,7 +637,6 @@ subroutine parallel_read_nemsio_state_(en_full,m_cvars2d,m_cvars3d,nlon,nlat,nsi character(len=*), intent(in ) :: filename character(len=*), optional, intent(in) :: filenamesfc logical, intent(in ) :: init_head - real(r_kind), intent(inout) :: clons(nlon),slons(nlon) ! Declare local variables integer(i_kind) i,ii,j,jj,k,lonb,latb,levs,latb2,lonb2 @@ -809,8 +662,9 @@ subroutine parallel_read_nemsio_state_(en_full,m_cvars2d,m_cvars3d,nlon,nlat,nsi real(r_kind) :: fhour type(nemsio_gfile) :: gfile type(nemsio_gfile) :: gfilesfc - real(r_kind),allocatable,dimension(:) :: rlats,rlons - real(r_single),allocatable,dimension(:) :: r4lats,r4lons + real(r_kind),allocatable,dimension(:) :: rlons + real(r_kind) :: clons(nlon),slons(nlon) + real(r_single),allocatable,dimension(:) :: r4lons if ( init_head)call nemsio_init(iret=iret) if (iret /= 0) call error_msg(trim(myname_),trim(filename),null,'init',istop,iret,.true.) @@ -849,24 +703,19 @@ subroutine parallel_read_nemsio_state_(en_full,m_cvars2d,m_cvars3d,nlon,nlat,nsi endif endif -! obtain r4lats,r4lons,rlats,rlons,clons,slons exactly as computed in general_read_gfsatm_nems: +! obtain r4lons,rlons,clons,slons exactly as computed in general_read_gfsatm_nems: - allocate(rlats(latb+2),rlons(lonb),r4lats(lonb*latb),r4lons(lonb*latb)) - call nemsio_getfilehead(gfile,lat=r4lats,iret=iret) + allocate(rlons(lonb),r4lons(lonb*latb)) call nemsio_getfilehead(gfile,lon=r4lons,iret=iret) - do j=1,latb - rlats(latb+2-j)=deg2rad*r4lats(lonb/2+(j-1)*lonb) - enddo do j=1,lonb rlons(j)=deg2rad*r4lons(j) enddo - deallocate(r4lats,r4lons) - rlats(1)=-half*pi - rlats(latb+2)=half*pi + deallocate(r4lons) do j=1,lonb clons(j)=cos(rlons(j)) slons(j)=sin(rlons(j)) enddo + deallocate(rlons) fhour = float(nfhour) + float(nfminute)/r60 + float(nfsecondn)/float(nfsecondd)/r3600 odate(1) = idate(4) !hour @@ -913,38 +762,48 @@ subroutine parallel_read_nemsio_state_(en_full,m_cvars2d,m_cvars3d,nlon,nlat,nsi end if end if call move1_(work,temp3(:,:,k,k3),nlon,nlat) + call fillpoles_ss_(temp3(:,:,k,k3),nlon,nlat) elseif(trim(cvars3d(k3))=='ql') then call nemsio_readrecv(gfile,'clwmr','mid layer',k,work,iret=iret) if (iret /= 0) call error_msg(trim(myname_),trim(filename),'clwmr','read',istop+8,iret) call move1_(work,temp3(:,:,k,k3),nlon,nlat) + call fillpoles_ss_(temp3(:,:,k,k3),nlon,nlat) elseif(trim(cvars3d(k3))=='qi') then call nemsio_readrecv(gfile,'icmr','mid layer',k,work,iret=iret) if (iret /= 0) call error_msg(trim(myname_),trim(filename),'icmr','read',istop+9,iret) call move1_(work,temp3(:,:,k,k3),nlon,nlat) + call fillpoles_ss_(temp3(:,:,k,k3),nlon,nlat) elseif(trim(cvars3d(k3))=='qr') then call nemsio_readrecv(gfile,'rwmr','mid layer',k,work,iret=iret) if (iret /= 0) call error_msg(trim(myname_),trim(filename),'rwmr','read',istop+10,iret) call move1_(work,temp3(:,:,k,k3),nlon,nlat) + call fillpoles_ss_(temp3(:,:,k,k3),nlon,nlat) elseif(trim(cvars3d(k3))=='qs') then call nemsio_readrecv(gfile,'snmr','mid layer',k,work,iret=iret) + call fillpoles_ss_(temp3(:,:,k,k3),nlon,nlat) if (iret /= 0) call error_msg(trim(myname_),trim(filename),'snmr','read',istop+11,iret) call move1_(work,temp3(:,:,k,k3),nlon,nlat) + call fillpoles_ss_(temp3(:,:,k,k3),nlon,nlat) elseif(trim(cvars3d(k3))=='qg') then call nemsio_readrecv(gfile,'grle','mid layer',k,work,iret=iret) if (iret /= 0) call error_msg(trim(myname_),trim(filename),'grle','read',istop+12,iret) call move1_(work,temp3(:,:,k,k3),nlon,nlat) + call fillpoles_ss_(temp3(:,:,k,k3),nlon,nlat) elseif(trim(cvars3d(k3))=='oz') then call nemsio_readrecv(gfile,'o3mr','mid layer',k,work,iret=iret) if (iret /= 0) call error_msg(trim(myname_),trim(filename),'o3mr','read',istop+5,iret,.true.) call move1_(work,temp3(:,:,k,k3),nlon,nlat) + call fillpoles_ss_(temp3(:,:,k,k3),nlon,nlat) elseif(trim(cvars3d(k3))=='q') then call nemsio_readrecv(gfile,'spfh','mid layer',k,work,iret=iret) if (iret /= 0) call error_msg(trim(myname_),trim(filename),trim(cvars3d(k3)),'read',istop+4,iret,.true.) call move1_(work,temp3(:,:,k,k3),nlon,nlat) + call fillpoles_ss_(temp3(:,:,k,k3),nlon,nlat) elseif(trim(cvars3d(k3))=='t') then call nemsio_readrecv(gfile,'tmp','mid layer',k,work,iret=iret) if (iret /= 0) call error_msg(trim(myname_),trim(filename),'tmp','read',istop+3,iret,.true.) call move1_(work,temp3(:,:,k,k3),nlon,nlat) + call fillpoles_ss_(temp3(:,:,k,k3),nlon,nlat) elseif(trim(cvars3d(k3))=='sf') then call nemsio_readrecv(gfile,'ugrd','mid layer',k,work,iret=iret) if (iret /= 0) call error_msg(trim(myname_),trim(filename),'ugrd','read',istop+1,iret,.true.) @@ -956,10 +815,14 @@ subroutine parallel_read_nemsio_state_(en_full,m_cvars2d,m_cvars3d,nlon,nlat,nsi endif enddo enddo + do k=1,nsig + call fillpoles_sv_(temp3(:,:,k,k3u),temp3(:,:,k,k3v),nlon,nlat,clons,slons) + end do ! if (k3u==0.or.k3v==0.or.k3t==0.or.k3q==0.or.k3cw==0.or.k3oz==0) & if (k3u==0.or.k3v==0.or.k3t==0.or.k3q==0.or.k3oz==0) & write(6,'(" WARNING, problem with one of k3-")') + ! convert T to Tv: postpone this calculation ! temp3(:,:,:,k3t)=temp3(:,:,:,k3t)*(one+fv*temp3(:,:,:,k3q)) @@ -975,6 +838,7 @@ subroutine parallel_read_nemsio_state_(en_full,m_cvars2d,m_cvars3d,nlon,nlat,nsi if (iret /= 0) call error_msg(trim(myname_),trim(filename),'hgt','read',istop+8,iret,.true.) !work=r0_001*work ! convert Pa to cb ! postpone this calculation call move1_(work,temp2(:,:,k2),nlon,nlat) + call fillpoles_ss_(temp2(:,:,k2),nlon,nlat) endif enddo deallocate(work) @@ -997,6 +861,7 @@ subroutine parallel_read_nemsio_state_(en_full,m_cvars2d,m_cvars3d,nlon,nlat,nsi enddo enddo enddo + deallocate(temp3) do k2=1,nc2d m_cvars2d(k2)=kf+1 kf=kf+1 @@ -1011,7 +876,6 @@ subroutine parallel_read_nemsio_state_(en_full,m_cvars2d,m_cvars3d,nlon,nlat,nsi enddo enddo - deallocate(temp3) deallocate(temp2) end subroutine parallel_read_nemsio_state_ @@ -1019,7 +883,7 @@ end subroutine parallel_read_nemsio_state_ subroutine parallel_read_gfsnc_state_(en_full,m_cvars2d,m_cvars3d,nlon,nlat,nsig, & ias,jas,mas, & iasm,iaemz,jasm,jaemz,kasm,kaemz,masm,maemz, & - filename,init_head,clons,slons) + filename) !$$$ subprogram documentation block ! . . . . ! subprogram: parallel_read_gfsnc_state_ read GFS netCDF ensemble member @@ -1031,7 +895,7 @@ subroutine parallel_read_gfsnc_state_(en_full,m_cvars2d,m_cvars3d,nlon,nlat,nsig !$$$ use kinds, only: i_kind,r_kind,r_single - use constants, only: r60,r3600,zero,one,half,pi,deg2rad + use constants, only: r60,r3600,zero,one,half,deg2rad use control_vectors, only: cvars2d,cvars3d,nc2d,nc3d use general_sub2grid_mod, only: sub2grid_info use module_fv3gfs_ncio, only: Dataset, Variable, Dimension, open_dataset,& @@ -1048,18 +912,17 @@ subroutine parallel_read_gfsnc_state_(en_full,m_cvars2d,m_cvars3d,nlon,nlat,nsig integer(i_kind), intent(inout) :: m_cvars2d(nc2d),m_cvars3d(nc3d) real(r_single), intent(inout) :: en_full(iasm:iaemz,jasm:jaemz,kasm:kaemz,masm:maemz) character(len=*), intent(in ) :: filename - logical, intent(in ) :: init_head - real(r_kind), intent(inout) :: clons(nlon),slons(nlon) ! Declare local variables integer(i_kind) i,ii,j,jj,k,lonb,latb,levs,kr integer(i_kind) k2,k3,k3u,k3v,k3t,k3q,k3cw,k3oz,kf character(len=120) :: myname_ = 'parallel_read_gfsnc_state_' - real(r_single),allocatable,dimension(:,:,:) :: temp2, rwork3d1, rwork3d2 - real(r_single),allocatable,dimension(:,:) :: rwork2d + real(r_single),allocatable,dimension(:,:,:) :: rwork3d1, rwork3d2 + real(r_single),allocatable,dimension(:,:) :: temp2,rwork2d real(r_single),allocatable,dimension(:,:,:,:) :: temp3 - real(r_kind),allocatable,dimension(:) :: rlats,rlons - real(r_kind),allocatable,dimension(:) :: rlats_tmp,rlons_tmp + real(r_kind),allocatable,dimension(:) :: rlons_tmp + real(r_kind) :: clons(nlon),slons(nlon) + real(r_kind) :: rlons type(Dataset) :: atmges type(Dimension) :: ncdim @@ -1079,70 +942,66 @@ subroutine parallel_read_gfsnc_state_(en_full,m_cvars2d,m_cvars3d,nlon,nlat,nsig call die(myname_, ': ***ERROR*** incorrect resolution',101) endif -! obtain rlats_tmp,rlons_tnp,rlats,rlons,clons,slons exactly as computed in general_read_gfsatm_nems: +! obtain rlons_tnp,rlons,clons,slons exactly as computed in general_read_gfsatm_nems: - allocate(rlats(latb+2),rlons(lonb)) call read_vardata(atmges, 'grid_xt', rlons_tmp) - call read_vardata(atmges, 'grid_yt', rlats_tmp) - do j=1,latb - rlats(latb+2-j)=deg2rad*rlats_tmp(j) - enddo do j=1,lonb - rlons(j)=deg2rad*rlons_tmp(j) - enddo - deallocate(rlats_tmp,rlons_tmp) - rlats(1)=-half*pi - rlats(latb+2)=half*pi - do j=1,lonb - clons(j)=cos(rlons(j)) - slons(j)=sin(rlons(j)) + rlons=deg2rad*rlons_tmp(j) + clons(j)=cos(rlons) + slons(j)=sin(rlons) enddo + deallocate(rlons_tmp) - allocate(rwork3d2(nlon,(nlat-2),nsig)) + allocate(rwork3d1(nlon,(nlat-2),nsig)) allocate(temp3(nlat,nlon,nsig,nc3d)) - allocate(temp2(nlat,nlon,nc2d)) k3u=0 ; k3v=0 ; k3t=0 ; k3q=0 ; k3cw=0 ; k3oz=0 do k3=1,nc3d - if(cvars3d(k3)=='sf') k3u=k3 - if(cvars3d(k3)=='vp') k3v=k3 - if(cvars3d(k3)=='t') k3t=k3 - if(cvars3d(k3)=='q') k3q=k3 - if(cvars3d(k3)=='cw') k3cw=k3 - if(cvars3d(k3)=='oz') k3oz=k3 if (trim(cvars3d(k3))=='cw') then + k3cw=k3 call read_vardata(atmges, 'clwmr', rwork3d1) - rwork3d2 = 0 + allocate(rwork3d2(nlon,(nlat-2),nsig)) + rwork3d2 = 0._r_single call read_vardata(atmges, 'icmr', rwork3d2) rwork3d1 = rwork3d1 + rwork3d2 + deallocate(rwork3d2) do k=1,nsig kr = levs+1-k call move1_(rwork3d1(:,:,kr),temp3(:,:,k,k3),nlon,nlat) + call fillpoles_ss_(temp3(:,:,k,k3),nlon,nlat) end do else if(trim(cvars3d(k3))=='oz') then + k3oz=k3 call read_vardata(atmges, 'o3mr', rwork3d1) do k=1,nsig kr = levs+1-k call move1_(rwork3d1(:,:,kr),temp3(:,:,k,k3),nlon,nlat) + call fillpoles_ss_(temp3(:,:,k,k3),nlon,nlat) end do else if(trim(cvars3d(k3))=='q') then + k3q=k3 call read_vardata(atmges, 'spfh', rwork3d1) do k=1,nsig kr = levs+1-k call move1_(rwork3d1(:,:,kr),temp3(:,:,k,k3),nlon,nlat) + call fillpoles_ss_(temp3(:,:,k,k3),nlon,nlat) end do else if(trim(cvars3d(k3))=='t') then + k3t=k3 call read_vardata(atmges, 'tmp', rwork3d1) do k=1,nsig kr = levs+1-k call move1_(rwork3d1(:,:,kr),temp3(:,:,k,k3),nlon,nlat) + call fillpoles_ss_(temp3(:,:,k,k3),nlon,nlat) end do else if(trim(cvars3d(k3))=='sf') then + k3u=k3 call read_vardata(atmges, 'ugrd', rwork3d1) do k=1,nsig kr = levs+1-k call move1_(rwork3d1(:,:,kr),temp3(:,:,k,k3),nlon,nlat) end do else if(trim(cvars3d(k3))=='vp') then + k3v=k3 call read_vardata(atmges, 'vgrd', rwork3d1) do k=1,nsig kr = levs+1-k @@ -1150,18 +1009,14 @@ subroutine parallel_read_gfsnc_state_(en_full,m_cvars2d,m_cvars3d,nlon,nlat,nsig end do end if enddo + deallocate(rwork3d1) + if (k3u==0.or.k3v==0.or.k3t==0.or.k3q==0.or.k3cw==0.or.k3oz==0) & write(6,'(" WARNING, problem with one of k3-")') - temp2=zero - do k2=1,nc2d - if(trim(cvars2d(k2))=='ps') then - call read_vardata(atmges, 'pressfc', rwork2d) - call move1_(rwork2d,temp2(:,:,k2),nlon,nlat) - endif - enddo - deallocate(rwork2d, rwork3d1) - deallocate(rwork3d2) + do k=1,nsig + call fillpoles_sv_(temp3(:,:,k,k3u),temp3(:,:,k,k3v),nlon,nlat,clons,slons) + end do ! move temp2,temp3 to en_full kf=0 @@ -1180,29 +1035,41 @@ subroutine parallel_read_gfsnc_state_(en_full,m_cvars2d,m_cvars3d,nlon,nlat,nsig enddo enddo enddo + + deallocate(temp3) + allocate(temp2(nlat,nlon)) + allocate(rwork2d(nlon,(nlat-2))) do k2=1,nc2d - m_cvars2d(k2)=kf+1 + if(trim(cvars2d(k2))=='ps') then + call read_vardata(atmges, 'pressfc', rwork2d) + call move1_(rwork2d,temp2,nlon,nlat) + call fillpoles_ss_(temp2,nlon,nlat) + else + temp2=zero + endif + kf=kf+1 + m_cvars2d(k2)=kf jj=jas-1 do j=1,nlon jj=jj+1 ii=ias-1 do i=1,nlat ii=ii+1 - en_full(ii,jj,kf,mas)=temp2(i,j,k2) + en_full(ii,jj,kf,mas)=temp2(i,j) enddo enddo enddo - deallocate(temp3) + deallocate(rwork2d) deallocate(temp2) end subroutine parallel_read_gfsnc_state_ -subroutine fillpoles_s_(temp,nlon,nlat) +subroutine fillpoles_ss_(temp,nlon,nlat) !$$$ subprogram documentation block ! . . . . -! subprogram: fillpoles_s_ make pole points average of nearest pole row +! subprogram: fillpoles_ss_ make pole points average of nearest pole row ! prgmmr: parrish org: emc/ncep date: 2016-10-14 ! ! abstract: make pole points average of nearest pole row. @@ -1225,13 +1092,13 @@ subroutine fillpoles_s_(temp,nlon,nlat) ! !$$$ - use kinds, only: i_kind,r_kind + use kinds, only: i_kind,r_kind,r_single use constants, only: zero,one implicit none integer(i_kind),intent(in ) :: nlon,nlat - real(r_kind), intent(inout) :: temp(nlat,nlon) + real(r_single), intent(inout) :: temp(nlat,nlon) integer(i_kind) nlatm1,i real(r_kind) sumn,sums,rnlon @@ -1254,12 +1121,12 @@ subroutine fillpoles_s_(temp,nlon,nlat) temp(nlat,i)=sumn end do -end subroutine fillpoles_s_ +end subroutine fillpoles_ss_ -subroutine fillpoles_v_(tempu,tempv,nlon,nlat,clons,slons) +subroutine fillpoles_sv_(tempu,tempv,nlon,nlat,clons,slons) !$$$ subprogram documentation block ! . . . . -! subprogram: fillpoles_v_ create vector values at pole from nearest pole row +! subprogram: fillpoles_sv_ create vector values at pole from nearest pole row ! prgmmr: parrish org: emc/ncep date: 2016-10-14 ! ! abstract: create vector values at pole from nearest pole row. @@ -1283,13 +1150,13 @@ subroutine fillpoles_v_(tempu,tempv,nlon,nlat,clons,slons) ! !$$$ - use kinds, only: i_kind,r_kind + use kinds, only: i_kind,r_kind,r_single use constants, only: zero implicit none integer(i_kind),intent(in ) :: nlon,nlat - real(r_kind), intent(inout) :: tempu(nlat,nlon),tempv(nlat,nlon) + real(r_single), intent(inout) :: tempu(nlat,nlon),tempv(nlat,nlon) real(r_kind), intent(in ) :: clons(nlon),slons(nlon) integer(i_kind) i @@ -1317,7 +1184,7 @@ subroutine fillpoles_v_(tempu,tempv,nlon,nlat,clons,slons) tempv(1,i )= polsu*slons(i)-polsv*clons(i) end do -end subroutine fillpoles_v_ +end subroutine fillpoles_sv_ subroutine move1_(work,temp,nlon,nlat) !$$$ subprogram documentation block @@ -1356,8 +1223,7 @@ subroutine move1_(work,temp,nlon,nlat) integer(i_kind) ii,i,j ii=0 - temp(1,:)=zero - temp(nlat,:)=zero +! Polar points will be filled in later do i=nlat-1,2,-1 do j=1,nlon ii=ii+1 diff --git a/src/gsi/crtm_interface.f90 b/src/gsi/crtm_interface.f90 index 6e5d775c9c..d03715059f 100644 --- a/src/gsi/crtm_interface.f90 +++ b/src/gsi/crtm_interface.f90 @@ -854,7 +854,7 @@ subroutine init_crtm(init_pass,mype_diaghdr,mype,nchanl,nreal,isis,obstype,radmo if (n_actual_aerosols_wk>0 .or. n_clouds_fwd_wk>0 .and. imp_physics==11) then if (mype==0) write(6,*)myname_,':initial and load GFDL saturation water vapor pressure tables' - + allocate(table (length)) allocate(table2(length)) allocate(tablew(length)) @@ -2074,7 +2074,7 @@ subroutine call_crtm(obstype,obstime,data_s,nchanl,nreal,ich, & hwp_total = sum(hwp_guess(:)) theta_700 = atmosphere(1)%temperature(idx700)*(r1000/atmosphere(1)%pressure(idx700))**rd_over_cp theta_sfc = data_s(itsavg)*(r100/ps)**rd_over_cp - stability = theta_700 - theta_sfc + if (present(stability)) stability = theta_700 - theta_sfc endif ! Set clouds for CRTM diff --git a/src/gsi/dtast.f90 b/src/gsi/dtast.f90 index baa1c5af1e..2b6c4ab5fb 100644 --- a/src/gsi/dtast.f90 +++ b/src/gsi/dtast.f90 @@ -65,7 +65,7 @@ subroutine dtast(work1,nlev,pbot,ptop,mesage,jiter,iout,pflag) ! First, print message and level information imsg=max(1,index(mesage,'$')-1) - ilin=max(imsg,min(nlev*9+34,240)) + ilin=max(imsg,min(nlev*11+34,240)) write(iout,'(a)') mesage(1:imsg) if (nlev > 1) then write(iout,800) '', '', '', '', '', 'ptop',(ptop(k),k=1,nlev) @@ -206,16 +206,16 @@ subroutine dtast(work1,nlev,pbot,ptop,mesage,jiter,iout,pflag) endif ! if ( nlev == 1 ) 600 format(1x,'pressure levels (hPa)=',f6.1,1x,f6.1) -700 format(1x,'o-g',1x,a2, 1x,a7,1x,a3,1x,a3, 1x,a4, 1x,a9, 1x,4(a9, 1x)) -701 format(1x,'o-g',1x,i2.2,1x,a7,1x,a3,1x,i3.3,1x,i4.4,1x,i9,1x, 4(f9.4,1x)) -702 format(1x,'o-g',1x,i2.2,1x,a7,1x,a3,1x,a3, 1x,a4, 1x,i9,1x, 4(f9.4,1x)) -800 format(1x,'o-g',1x,a2, 1x,a7,1x,a3,1x,a3, 1x,a4, 1x,a5,1x,12(f8.1,1x)) -801 format(1x,'o-g',1x,i2.2,1x,a7,1x,a3,1x,i3.3,1x,i4.4,1x,a5,1x,12(i8, 1x)) -802 format(1x,'o-g',1x,i2.2,1x,a7,1x,a3,1x,i3.3,1x,i4.4,1x,a5,1x,12(f8.2,1x)) -803 format(1x,'o-g',1x,i2.2,1x,a7,1x,a3,1x,a3, 1x,a4, 1x,a5,1x,12(i8, 1x)) -804 format(1x,'o-g',1x,i2.2,1x,a7,1x,a3,1x,a3, 1x,a4, 1x,a5,1x,12(f8.2,1x)) -901 format(1x,'o-g',1x,i2.2,1x,a7,1x,a3,1x,i3.3,1x,i4.4,1x,i9,1x, 2(f12.4,1x),2(f9.4,1x)) -902 format(1x,'o-g',1x,i2.2,1x,a7,1x,a3,1x,a3, 1x,a4, 1x,i9,1x, 2(f12.4,1x),2(f9.4,1x)) +700 format(1x,'o-g',1x,a2, 1x,a7,1x,a3,1x,a3, 1x,a4, 1x,a9,1x, 4(a10, 1x)) +701 format(1x,'o-g',1x,i2.2,1x,a7,1x,a3,1x,i3.3,1x,i4.4,1x,i9,1x, 4(e10.3,1x)) +702 format(1x,'o-g',1x,i2.2,1x,a7,1x,a3,1x,a3, 1x,a4, 1x,i9,1x, 4(e10.3,1x)) +800 format(1x,'o-g',1x,a2, 1x,a7,1x,a3,1x,a3, 1x,a4, 1x,a5,1x,12(e10.3,1x)) +801 format(1x,'o-g',1x,i2.2,1x,a7,1x,a3,1x,i3.3,1x,i4.4,1x,a5,1x,12(i10, 1x)) +802 format(1x,'o-g',1x,i2.2,1x,a7,1x,a3,1x,i3.3,1x,i4.4,1x,a5,1x,12(e10.3,1x)) +803 format(1x,'o-g',1x,i2.2,1x,a7,1x,a3,1x,a3, 1x,a4, 1x,a5,1x,12(i10, 1x)) +804 format(1x,'o-g',1x,i2.2,1x,a7,1x,a3,1x,a3, 1x,a4, 1x,a5,1x,12(e10.3,1x)) +901 format(1x,'o-g',1x,i2.2,1x,a7,1x,a3,1x,i3.3,1x,i4.4,1x,i9,1x, 2(e10.3,1x),2(e10.3,1x)) +902 format(1x,'o-g',1x,i2.2,1x,a7,1x,a3,1x,a3, 1x,a4, 1x,i9,1x, 2(e10.3,1x),2(e10.3,1x)) return end subroutine dtast diff --git a/src/gsi/general_read_gfsatm.f90 b/src/gsi/general_read_gfsatm.f90 index 2ac8bfe596..fb7c568b33 100755 --- a/src/gsi/general_read_gfsatm.f90 +++ b/src/gsi/general_read_gfsatm.f90 @@ -1659,10 +1659,9 @@ subroutine general_read_gfsatm_nc(grd,sp_a,filename,uvflag,vordivflag,zflag, & ! !$$$ use kinds, only: r_kind,r_single,i_kind - use mpimod, only: mype use general_sub2grid_mod, only: sub2grid_info use general_specmod, only: spec_vars - use mpimod, only: npe + use mpimod, only: npe,mype,mpi_comm_world,ierror,mpi_integer,mpi_max,setcomm use constants, only: zero,one,fv,r0_01 use egrid2agrid_mod,only: g_egrid2agrid,g_create_egrid2agrid,egrid2agrid_parm,destroy_egrid2agrid use general_commvars_mod, only: fill2_ns,filluv2_ns @@ -1704,6 +1703,8 @@ subroutine general_read_gfsatm_nc(grd,sp_a,filename,uvflag,vordivflag,zflag, & integer(i_kind),dimension(npe)::ilev,iflag,mype_use integer(i_kind),dimension(6):: idate integer(i_kind),dimension(4):: odate + integer(i_kind) :: nread,iworld,iworld_group,mpi_comm_read + integer(i_kind),dimension(npe):: mype_read,mype_read_max,mype_read_rank real(r_kind),allocatable,dimension(:) :: fhour real(r_kind),allocatable,dimension(:):: spec_div,spec_vor @@ -1745,13 +1746,31 @@ subroutine general_read_gfsatm_nc(grd,sp_a,filename,uvflag,vordivflag,zflag, & endif enddo icm=icount + + mype_read=-1 + if (procuse) mype_read(mype+1) = mype + + mype_read_max = -1 + call mpi_allreduce(mype_read,mype_read_max,npe,mpi_integer,mpi_max,mpi_comm_world,ierror) + + nread=0 + mype_read_rank=-1 + do i=1,npe + if (mype_read_max(i)>=0) then + nread=nread+1 + mype_read_rank(nread)=mype_read_max(i) + endif + end do + + call setcomm(iworld,iworld_group,nread,mype_read_rank,mpi_comm_read,ierror) + allocate( work(grd%itotsub),work_v(grd%itotsub) ) work=zero work_v=zero if ( procuse ) then - atmges = open_dataset(filename, paropen=.true.) + atmges = open_dataset(filename, paropen=.true., mpicomm=mpi_comm_read) ! get dimension sizes ncdim = get_dim(atmges, 'grid_xt'); lonb = ncdim%len diff --git a/src/gsi/general_spectral_transforms.f90 b/src/gsi/general_spectral_transforms.f90 index 86cf88e42c..d4f0959489 100644 --- a/src/gsi/general_spectral_transforms.f90 +++ b/src/gsi/general_spectral_transforms.f90 @@ -399,7 +399,6 @@ subroutine sfilter(grd,sp,filter,grid) end do return - return end subroutine sfilter diff --git a/src/gsi/genex_mod.f90 b/src/gsi/genex_mod.f90 index a9e7ea2142..278dbdf2f5 100644 --- a/src/gsi/genex_mod.f90 +++ b/src/gsi/genex_mod.f90 @@ -775,27 +775,6 @@ subroutine genex_destroy_info(s) if(associated(s%kabe_rc)) deallocate(s%kabe_rc) if(associated(s%mabs_rc)) deallocate(s%mabs_rc) if(associated(s%mabe_rc)) deallocate(s%mabe_rc) -! following is probably redundant - s%lefts => NULL() - s%rights => NULL() - s%numl => NULL() - s%numrc => NULL() - s%iabs_l => NULL() - s%iabe_l => NULL() - s%jabs_l => NULL() - s%jabe_l => NULL() - s%kabs_l => NULL() - s%kabe_l => NULL() - s%mabs_l => NULL() - s%mabe_l => NULL() - s%iabs_rc => NULL() - s%iabe_rc => NULL() - s%jabs_rc => NULL() - s%jabe_rc => NULL() - s%kabs_rc => NULL() - s%kabe_rc => NULL() - s%mabs_rc => NULL() - s%mabe_rc => NULL() s%lallocated=.false. end subroutine genex_destroy_info diff --git a/src/gsi/genqsat.f90 b/src/gsi/genqsat.f90 index 37927f1847..2719ed28f8 100644 --- a/src/gsi/genqsat.f90 +++ b/src/gsi/genqsat.f90 @@ -53,7 +53,7 @@ subroutine genqsat(qsat,tsen,prsl,lat2,lon2,nsig,ice,iderivative) !$$$ use kinds, only: r_kind,i_kind use constants, only: xai,tmix,xb,omeps,eps,xbi,one,zero,& - xa,psat,ttp,half,one_tenth + xa,psat,ttp,half,one_tenth,qmin use derivsmod, only: qgues,dqdt,dqdrh,dqdp use jfunc, only: pseudo_q2 use gridmod, only: wrf_nmm_regional,wrf_mass_regional,nems_nmmb_regional,aeta2_ll,regional,cmaq_regional @@ -161,6 +161,7 @@ subroutine genqsat(qsat,tsen,prsl,lat2,lon2,nsig,ice,iderivative) end if es2=min(es,esmax) qsat(i,j,k) = eps * es2 / (pw - omeps * es2) + qsat(i,j,k) = max(qmin,qsat(i,j,k)) if(iderivative > 0)then if(es <= esmax .and. iderivative == 2)then diff --git a/src/gsi/genstats_gps.f90 b/src/gsi/genstats_gps.f90 index 4db3965c41..ce90d06f50 100644 --- a/src/gsi/genstats_gps.f90 +++ b/src/gsi/genstats_gps.f90 @@ -562,6 +562,7 @@ subroutine genstats_gps(bwork,awork,toss_gps_sub,conv_diagsave,mype) end if endif endif + if (gps_allptr%rdiag(10) == six) muse =.false. endif diff --git a/src/gsi/gesinfo.F90 b/src/gsi/gesinfo.F90 index 136271aae0..48757c2135 100644 --- a/src/gsi/gesinfo.F90 +++ b/src/gsi/gesinfo.F90 @@ -453,7 +453,7 @@ subroutine gesinfo ! FV3GFS write component does not write JCAP to the NEMSIO file if ( mype == mype_out ) then write(6,*)'GESINFO: ***WARNING*** guess jcap inconsistent with namelist' - write(6,*)'GESINFO: ***WARNING*** this is a FV3GFS NEMSIO file' + write(6,*)'GESINFO: ***WARNING*** this is a FV3GFS NEMSIO/NetCDF file' endif fatal = .false. else @@ -481,7 +481,7 @@ subroutine gesinfo else write(6,200) gfshead%jcap,gfshead%levs,gfshead%latb,gfshead%lonb,& gfshead%ntrac,gfshead%ncldt,idvc5,gfshead%nvcoord,idsl5 -200 format('GESINFO: jcap_b=',i4,', levs=',i3,', latb=',i5,& +200 format('GESINFO: jcap_b=',i5,', levs=',i3,', latb=',i5,& ', lonb=',i5,', ntrac=',i3,', ncldt=',i3,', idvc=',i3,& ', nvcoord=',i3,', idsl=',i3) end if diff --git a/src/gsi/get_gefs_ensperts_dualres.f90 b/src/gsi/get_gefs_ensperts_dualres.f90 index 39ec7541da..5e657349eb 100644 --- a/src/gsi/get_gefs_ensperts_dualres.f90 +++ b/src/gsi/get_gefs_ensperts_dualres.f90 @@ -51,7 +51,6 @@ subroutine get_gefs_ensperts_dualres use mpeu_util, only: die use gridmod, only: idsl5 use hybrid_ensemble_parameters, only: n_ens,write_ens_sprd,oz_univ_static,ntlevs_ens - use hybrid_ensemble_parameters, only: sst_staticB use hybrid_ensemble_parameters, only: en_perts,ps_bar,nelen use constants,only: zero,zero_single,half,fv,rd_over_cp,one,qcmin use mpimod, only: mpi_comm_world,mype,npe @@ -76,20 +75,17 @@ subroutine get_gefs_ensperts_dualres real(r_kind),pointer,dimension(:,:,:) :: q ! real(r_kind),dimension(grd_ens%nlat,grd_ens%nlon):: sst_full,dum real(r_kind),pointer,dimension(:,:,:):: p3 - real(r_kind),pointer,dimension(:,:):: p2 - real(r_single),pointer,dimension(:,:,:):: w3 - real(r_single),pointer,dimension(:,:):: w2 - real(r_kind),pointer,dimension(:,:,:):: x3 real(r_kind),pointer,dimension(:,:):: x2 type(gsi_bundle),allocatable,dimension(:) :: en_read - type(gsi_bundle),allocatable,dimension(:) :: en_bar + type(gsi_bundle):: en_bar ! type(gsi_grid) :: grid_ens - real(r_kind) bar_norm,sig_norm,kapr,kap1,rh - real(r_kind),allocatable,dimension(:,:):: z,sst2 + real(r_kind) bar_norm,sig_norm,kapr,kap1 +! real(r_kind),allocatable,dimension(:,:):: z,sst2 real(r_kind),allocatable,dimension(:,:,:) :: tsen,prsl,pri,qs ! integer(i_kind),dimension(grd_ens%nlat,grd_ens%nlon):: idum - integer(i_kind) istatus,iret,i,ic2,ic3,j,k,n,mm1,iderivative,im,jm,km,m,ipic + integer(i_kind) istatus,iret,i,ic3,j,k,n,iderivative,im,jm,km,m,ipic +! integer(i_kind) mm1 integer(i_kind) ipc3d(nc3d),ipc2d(nc2d) integer(i_kind) ier ! integer(i_kind) il,jl @@ -119,24 +115,20 @@ subroutine get_gefs_ensperts_dualres call stop2(999) endif - mm1=mype+1 - kap1=rd_over_cp+one - kapr=one/rd_over_cp im=en_perts(1,1)%grid%im jm=en_perts(1,1)%grid%jm km=en_perts(1,1)%grid%km + bar_norm = one/float(n_ens) + sig_norm=sqrt(one/max(one,n_ens-one)) ! Create temporary communication information for read ensemble routines call gsi_enscoupler_create_sub2grid_info(grd_tmp,km,npe,grd_ens) ! Allocate bundle to hold mean of ensemble members - allocate(en_bar(ntlevs_ens)) - do m=1,ntlevs_ens - call gsi_bundlecreate(en_bar(m),en_perts(1,1)%grid,'ensemble',istatus,names2d=cvars2d,names3d=cvars3d) - if ( istatus /= 0 ) & - call die('get_gefs_ensperts_dualres',': trouble creating en_bar bundle, istatus =',istatus) - end do + call gsi_bundlecreate(en_bar,en_perts(1,1)%grid,'ensemble',istatus,names2d=cvars2d,names3d=cvars3d) + if ( istatus /= 0 ) & + call die('get_gefs_ensperts_dualres',': trouble creating en_bar bundle, istatus =',istatus) ! Allocate bundle used for reading members allocate(en_read(n_ens)) @@ -146,15 +138,21 @@ subroutine get_gefs_ensperts_dualres call die('get_gefs_ensperts_dualres',': trouble creating en_read bundle, istatus =',istatus) end do - allocate(z(im,jm)) - allocate(sst2(im,jm)) +! allocate(z(im,jm)) +! allocate(sst2(im,jm)) - sst2=zero ! for now, sst not used in ensemble perturbations, so if sst array is called for +! sst2=zero ! for now, sst not used in ensemble perturbations, so if sst array is called for ! then sst part of en_perts will be zero when sst2=zero - ntlevs_ens_loop: do m=1,ntlevs_ens +!$omp parallel do schedule(dynamic,1) private(m,n) + do m=1,ntlevs_ens + do n=1,n_ens + en_perts(n,m)%valuesr4=zero_single + end do + end do - en_bar(m)%values=zero + + ntlevs_ens_loop: do m=1,ntlevs_ens call gsi_enscoupler_get_user_Nens(grd_tmp,n_ens,m,en_read,iret) @@ -168,11 +166,11 @@ subroutine get_gefs_ensperts_dualres cycle endif - n_ens_loop: do n=1,n_ens - - en_perts(n,m)%valuesr4=zero + if (.not.q_hyb_ens) then !use RH + kap1=rd_over_cp+one + kapr=one/rd_over_cp + do n=1,n_ens - if (.not.q_hyb_ens) then !use RH call gsi_bundlegetpointer(en_read(n),'ps',ps,ier);istatus=ier call gsi_bundlegetpointer(en_read(n),'t' ,tv,ier);istatus=istatus+ier call gsi_bundlegetpointer(en_read(n),'q' ,q ,ier);istatus=istatus+ier @@ -209,10 +207,24 @@ subroutine get_gefs_ensperts_dualres ice=.true. iderivative=0 call genqsat(qs,tsen,prsl,im,jm,km,ice,iderivative) - deallocate(tsen,prsl) - end if + do k=1,km + do j=1,jm + do i=1,im + q(i,j,k)=q(i,j,k)/qs(i,j,k) + end do + end do + end do + deallocate(tsen,prsl,qs) + enddo + end if + + + en_bar%values=zero + + n_ens_loop: do n=1,n_ens -!_$omp parallel do schedule(dynamic,1) private(i,k,j,ic3,rh) + +!$omp parallel do schedule(dynamic,1) private(i,k,j,ic3,hydrometeor,istatus,p3) do ic3=1,nc3d hydrometeor = trim(cvars3d(ic3))=='cw' .or. trim(cvars3d(ic3))=='ql' .or. & @@ -222,145 +234,56 @@ subroutine get_gefs_ensperts_dualres call gsi_bundlegetpointer(en_read(n),trim(cvars3d(ic3)),p3,istatus) if(istatus/=0) then - write(6,*)' error retrieving pointer to ',trim(cvars3d(ic3)),' from read in member ',m - call stop2(999) - end if - call gsi_bundlegetpointer(en_perts(n,m),trim(cvars3d(ic3)),w3,istatus) - if(istatus/=0) then - write(6,*)' error retrieving pointer to ',trim(cvars3d(ic3)),' for ensemble member ',n - call stop2(999) - end if - call gsi_bundlegetpointer(en_bar(m),trim(cvars3d(ic3)),x3,istatus) - if(istatus/=0) then - write(6,*)' error retrieving pointer to ',trim(cvars3d(ic3)),' for en_bar' + write(6,*)' error retrieving pointer to ',trim(cvars3d(ic3)),' from read in member ',n,m call stop2(999) end if - if ( trim(cvars3d(ic3)) == 'q' ) then - if (.not.q_hyb_ens) then !use RH - do k=1,km - do j=1,jm - do i=1,im - rh=p3(i,j,k)/qs(i,j,k) - w3(i,j,k) = rh - x3(i,j,k)=x3(i,j,k)+rh - end do - end do - end do - cycle - end if - end if if ( hydrometeor ) then -!$omp parallel do schedule(dynamic,1) private(i,j,k) do k=1,km do j=1,jm do i=1,im - w3(i,j,k) = max(p3(i,j,k),qcmin) - x3(i,j,k)=x3(i,j,k)+max(p3(i,j,k),qcmin) + p3(i,j,k) = max(p3(i,j,k),qcmin) end do end do end do - cycle - end if - if ( trim(cvars3d(ic3)) == 'oz' .and. oz_univ_static ) then - w3 = zero_single - cycle + else if ( trim(cvars3d(ic3)) == 'oz' .and. oz_univ_static ) then + p3 = zero end if -!$omp parallel do schedule(dynamic,1) private(i,j,k) - do k=1,km - do j=1,jm - do i=1,im - w3(i,j,k) = p3(i,j,k) - x3(i,j,k)=x3(i,j,k)+p3(i,j,k) - end do - end do - end do - end do !c3d - if (.not.q_hyb_ens) deallocate(qs) - -!_$omp parallel do schedule(dynamic,1) private(i,j,ic2,ipic) - do ic2=1,nc2d + do i=1,nelen + en_perts(n,m)%valuesr4(i)=en_read(n)%values(i) + en_bar%values(i)=en_bar%values(i)+en_read(n)%values(i) + end do - call gsi_bundlegetpointer(en_read(n),trim(cvars2d(ic2)),p2,istatus) - if(istatus/=0) then - write(6,*)' error retrieving pointer to ',trim(cvars2d(ic2)),' from read in member ',m - call stop2(999) - end if - call gsi_bundlegetpointer(en_perts(n,m),trim(cvars2d(ic2)),w2,istatus) - if(istatus/=0) then - write(6,*)' error retrieving pointer to ',trim(cvars2d(ic2)),' for ens-pert member ',n - call stop2(999) - end if - call gsi_bundlegetpointer(en_bar(m),trim(cvars2d(ic2)),x2,istatus) - if(istatus/=0) then - write(6,*)' error retrieving pointer to ',trim(cvars2d(ic2)),' for en_bar' - call stop2(999) - end if -!$omp parallel do schedule(dynamic,1) private(i,j) - do j=1,jm - do i=1,im - w2(i,j)=p2(i,j) - x2(i,j)=x2(i,j)+p2(i,j) - end do - end do - - if (sst_staticB.and.trim(cvars2d(ic2))=='sst') then - w2 = zero - x2 = zero ! NOTE: if anyone implements alternative use of SST (as from sst2) care need ! be given to those applications getting SST directly from the members of ! the ensemble for which this code is already handling - i.e., I don't ! know who would want to commented out code below but be mindful ! of how it interacts with option sst_staticB, please - Todling. -!_$omp parallel do schedule(dynamic,1) private(i,j) -! do j=1,jm -! do i=1,im -! w2(i,j) = sst2(i,j) -! x2(i,j)=x2(i,j)+sst2(i,j) -! end do -! end do - cycle - end if - - end do - end do n_ens_loop ! end do over ensemble - end do ntlevs_ens_loop !end do over bins - - do n=n_ens,1,-1 - call gsi_bundledestroy(en_read(n),istatus) - if ( istatus /= 0 ) & - call die('get_gefs_ensperts_dualres',': trouble destroying en_read bundle, istatus = ', istatus) - end do - deallocate(en_read) - call gsi_enscoupler_destroy_sub2grid_info(grd_tmp) + end do n_ens_loop ! end do over ensemble -! Copy pbar to module array. ps_bar may be needed for vertical localization -! in terms of scale heights/normalized p/p -! Convert to mean - bar_norm = one/float(n_ens) - sig_norm=sqrt(one/max(one,n_ens-one)) -!$omp parallel do schedule(dynamic,1) private(i,j,k,n,m,ic2,ic3,ipic,x2) - do m=1,ntlevs_ens do i=1,nelen - en_bar(m)%values(i)=en_bar(m)%values(i)*bar_norm + en_bar%values(i)=en_bar%values(i)*bar_norm end do ! Before converting to perturbations, get ensemble spread - !-- if (m == 1 .and. write_ens_sprd ) call ens_spread_dualres(en_bar(1),1) + !-- if (m == 1 .and. write_ens_sprd ) call ens_spread_dualres(en_bar,1) !!! it is not clear of the next statement is thread/$omp safe. - if (write_ens_sprd ) call ens_spread_dualres(en_bar(m),m) + if (write_ens_sprd ) call ens_spread_dualres(en_bar,m) - call gsi_bundlegetpointer(en_bar(m),'ps',x2,istatus) + call gsi_bundlegetpointer(en_bar,'ps',x2,istatus) if(istatus/=0) & call die('get_gefs_ensperts_dualres:',' error retrieving pointer to (ps) for en_bar, istatus = ', istatus) +! Copy pbar to module array. ps_bar may be needed for vertical localization +! in terms of scale heights/normalized p/p +! Convert to mean do j=1,jm do i=1,im ps_bar(i,j,m)=x2(i,j) @@ -369,14 +292,15 @@ subroutine get_gefs_ensperts_dualres ! Convert ensemble members to perturbations +!$omp parallel do schedule(dynamic,1) private(n,i,ic3,ipic,k,j) do n=1,n_ens do i=1,nelen - en_perts(n,m)%valuesr4(i)=en_perts(n,m)%valuesr4(i)-en_bar(m)%values(i) + en_perts(n,m)%valuesr4(i)=en_perts(n,m)%valuesr4(i)-en_bar%values(i) end do if(.not. q_hyb_ens) then do ic3=1,nc3d - ipic=ipc3d(ic3) if(trim(cvars3d(ic3)) == 'q' .or. trim(cvars3d(ic3)) == 'Q')then + ipic=ipc3d(ic3) do k=1,km do j=1,jm do i=1,im @@ -392,8 +316,17 @@ subroutine get_gefs_ensperts_dualres en_perts(n,m)%valuesr4(i)=en_perts(n,m)%valuesr4(i)*sig_norm end do end do + end do ntlevs_ens_loop !end do over bins + + do n=n_ens,1,-1 + call gsi_bundledestroy(en_read(n),istatus) + if ( istatus /= 0 ) & + call die('get_gefs_ensperts_dualres',': trouble destroying en_read bundle, istatus = ', istatus) end do + deallocate(en_read) + call gsi_enscoupler_destroy_sub2grid_info(grd_tmp) +! mm1=mype+1 ! since initial version is ignoring sst perturbations, skip following code for now. revisit ! later--creating general_read_gfssfc, analogous to general_read_gfsatm above. !! GET SST PERTURBATIONS HERE @@ -436,17 +369,8 @@ subroutine get_gefs_ensperts_dualres ! end do ! end do - do m=ntlevs_ens,1,-1 - call gsi_bundledestroy(en_bar(m),istatus) - if(istatus/=0) then - write(6,*)' in get_gefs_ensperts_dualres: trouble destroying en_bar bundle' - call stop2(999) - endif - end do - - deallocate(sst2) - deallocate(z) - deallocate(en_bar) +! deallocate(sst2) +! deallocate(z) return end subroutine get_gefs_ensperts_dualres diff --git a/src/gsi/get_gefs_for_regional.f90 b/src/gsi/get_gefs_for_regional.f90 index 022f1f1612..4a217f2de3 100644 --- a/src/gsi/get_gefs_for_regional.f90 +++ b/src/gsi/get_gefs_for_regional.f90 @@ -22,6 +22,8 @@ subroutine get_gefs_for_regional ! 2016-05-19 Carley/s.liu - prevent the GSI from printing out erroneous error ! when using ensembles from different time ! 2016-12-12 tong - add code to get nemsio meta data, if use_gfs_nemsio=True +! 2020-07-01 Bi - add code to get netCDF data, if use_gfs_ncio=.true. +! 2020-05-04 wu - no rotate_wind for fv3_regional ! ! input argument list: ! @@ -33,8 +35,10 @@ subroutine get_gefs_for_regional ! !$$$ end documentation block - use gridmod, only: idsl5,regional,use_gfs_nemsio - use gridmod, only: nlon,nlat,lat2,lon2,nsig,rotate_wind_ll2xy + use gridmod, only: idsl5,regional,use_gfs_nemsio,use_gfs_ncio,& + ncepgfs_head,ncepgfs_headv + use gridmod, only: nlon,nlat,lat2,lon2,nsig,rotate_wind_ll2xy,& + fv3_regional use hybrid_ensemble_parameters, only: region_lat_ens,region_lon_ens use hybrid_ensemble_parameters, only: en_perts,ps_bar,nelen use hybrid_ensemble_parameters, only: n_ens,grd_ens,grd_a1,grd_e1,p_e2a,uv_hyb_ens,dual_res @@ -74,6 +78,9 @@ subroutine get_gefs_for_regional use nemsio_module, only: nemsio_init,nemsio_open,nemsio_close use ncepnems_io, only: error_msg use nemsio_module, only: nemsio_gfile,nemsio_getfilehead + use module_fv3gfs_ncio, only: Dimension, Dataset, open_dataset, get_dim, & + read_vardata, get_idate_from_time_units,& + read_attribute, close_dataset use get_wrf_mass_ensperts_mod, only: get_wrf_mass_ensperts_class use gsi_io, only: verbose use obsmod, only: l_wcp_cwm @@ -112,6 +119,8 @@ subroutine get_gefs_for_regional integer(i_kind) ic2,ic3,it integer(i_kind) ku,kv,kt,kq,koz,kcw,kz,kps character(255) filename,filelists(ntlevs_ens) + character(6) sfilename + logical ice integer(sigio_intkind):: lunges = 11 type(sigio_head):: sighead @@ -121,10 +130,11 @@ subroutine get_gefs_for_regional logical,allocatable :: vector(:) real(r_kind),parameter:: zero_001=0.001_r_kind real(r_kind),allocatable,dimension(:) :: xspli,yspli,xsplo,ysplo - integer(i_kind) iyr,ihourg + integer(i_kind) iyr,ihourg,kr integer(i_kind),dimension(4):: idate4 integer(i_kind),dimension(8) :: ida,jda integer(i_kind),dimension(5) :: iadate_gfs + integer(i_kind),dimension(6):: idate6 real(r_kind) hourg real(r_kind),dimension(5):: fha integer(i_kind) istatus @@ -136,6 +146,13 @@ subroutine get_gefs_for_regional integer(i_kind),dimension(7):: idate real(r_kind) :: fhour type(nemsio_gfile) :: gfile + type(Dataset) :: atmges + type(ncepgfs_head):: gfshead + type(ncepgfs_headv):: gfsheadv + real(r_single),allocatable,dimension(:) :: aknc, bknc, fhour1 + + + type(Dimension) :: ncdim integer(i_kind) :: nvcoord real(r_single),allocatable:: nems_vcoord(:,:,:) real(r_single),allocatable:: vcoord(:,:) @@ -170,6 +187,7 @@ subroutine get_gefs_for_regional real(r_kind), pointer :: ges_tv(:,:,:)=>NULL() real(r_kind), pointer :: ges_q (:,:,:)=>NULL() logical :: print_verbose + real(r_kind), allocatable :: ges_z_ens(:,:) print_verbose=.false. if(verbose)print_verbose=.true. @@ -223,7 +241,7 @@ subroutine get_gefs_for_regional rewind (10) read(10,'(a)',err=20,end=20)filename - if(.not. use_gfs_nemsio)then + if ((.not. use_gfs_nemsio) .and. (.not. use_gfs_ncio))then open(lunges,file=trim(filename),form='unformatted') call sigio_srhead(lunges,sighead,iret) close(lunges) @@ -264,7 +282,7 @@ subroutine get_gefs_for_regional idate4(2)= sighead%idate(2) idate4(3)= sighead%idate(3) idate4(4)= sighead%idate(4) - else + else if ( use_gfs_nemsio ) then call nemsio_init(iret=iret) if (iret /= 0) call error_msg(trim(my_name),trim(filename),' ','init',istop,iret) @@ -336,12 +354,75 @@ subroutine get_gefs_for_regional if(mype == 0) then write(6,*) ' nemsio: fhour,idate=',fhour,idate write(6,*) ' iadate(y,m,d,hr,min)=',iadate - write(6,*) ' nemsio: jcap,levs=',njcap,levs + write(6,*) ' nemsio: jcap,levs=',levs write(6,*) ' nemsio: latb,lonb=',latb,lonb write(6,*) ' nemsio: idvc,nvcoord=',idvc,nvcoord write(6,*) ' nemsio: idsl=',idsl end if +! add netCDF header information: + else ! use_gfs_ncio and get this information + write(sfilename,'("sfcf",i2.2)')nhr_assimilation + ! open the netCDF file + atmges = open_dataset(filename) + ! get dimension sizes + ncdim = get_dim(atmges, 'grid_xt'); gfshead%lonb = ncdim%len + ncdim = get_dim(atmges, 'grid_yt'); gfshead%latb = ncdim%len + ncdim = get_dim(atmges, 'pfull') ; gfshead%levs = ncdim%len + nsig_gfs = gfshead%levs + ! hard code jcap,idsl,idvc + gfshead%jcap = -9999 + gfshead%idsl= 1 + gfshead%idvc = 2 + + + nlat_gfs=gfshead%latb+2 + nlon_gfs=gfshead%lonb + nsig_gfs=gfshead%levs + + jcap_gfs=gfshead%latb-2 + + if (mype==0) write(6,*)'GESINFO: Read NCEP FV3GFS netCDF ', & + 'format file, ',trim(filename) + ! hard code nvcoord to be 2 + gfshead%nvcoord=2 ! ak and bk + if (allocated(gfsheadv%vcoord)) deallocate(gfsheadv%vcoord) + allocate(gfsheadv%vcoord(gfshead%levs+1,gfshead%nvcoord)) + call read_attribute(atmges, 'ak', aknc) + call read_attribute(atmges, 'bk', bknc) + do k=1,gfshead%levs+1 + kr = gfshead%levs+2-k + gfsheadv%vcoord(k,1) = aknc(kr) + gfsheadv%vcoord(k,2) = bknc(kr) + end do + deallocate(aknc,bknc) + ! get time information + idate6 = get_idate_from_time_units(atmges) + gfshead%idate(1) = idate6(4) !hour + gfshead%idate(2) = idate6(2) !month + gfshead%idate(3) = idate6(3) !day + gfshead%idate(4) = idate6(1) !year + call read_vardata(atmges, 'time', fhour1) ! might need to change this to attribute later + ! depends on model changes from Jeff Whitaker + gfshead%fhour = fhour1(1) + + call close_dataset(atmges) + + if(mype == 0) then + write(6,*) ' netCDF:fhour,idate=',fhour1,idate6 + write(6,*) ' netCDF:iadate(y,m,d,hr,min)=',iadate + write(6,*) ' netCDF: jcap,levs=',gfshead%levs + write(6,*) ' netCDF: latb,lonb=',gfshead%latb,gfshead%lonb + write(6,*) ' netCDF: nvcoord=',gfshead%nvcoord + write(6,*) ' netCDF: idvc,idsl=',gfshead%idvc,gfshead%idsl + endif + + hourg = fhour1(1) + idate4(1) = idate6(4) + idate4(2) = idate6(2) + idate4(3) = idate6(3) + idate4(4) = idate6(1) + end if ! Compute valid time from ensemble date and forecast length and compare to iadate, the analysis time @@ -354,6 +435,7 @@ subroutine get_gefs_for_regional iyr=iyr+2000 end if end if + fha=zero ; ida=0; jda=0 fha(2)=ihourg ! relative time interval in hours ida(1)=iyr ! year @@ -371,30 +453,36 @@ subroutine get_gefs_for_regional iadate_gfs(4)=jda(5) ! hour endif iadate_gfs(5)=0 ! minute + + if(mype == 0) then write(6,*)' in get_gefs_for_regional, iadate_gefs=',iadate_gfs write(6,*)' in get_gefs_for_regional, iadate =',iadate end if - call w3fs21(iadate,nming1) - call w3fs21(iadate_gfs,nming2) + + call w3fs21(iadate,nming1) + call w3fs21(iadate_gfs,nming2) + if( (nming1/=nming2) .and. (.not.l_ens_in_diff_time) ) then if(mype == 0) write(6,*)' GEFS ENSEMBLE MEMBER DATE NOT EQUAL TO ANALYSIS DATE, PROGRAM STOPS' call stop2(85) end if - ! set up ak5,bk5,ck5 for use in computing 3d pressure field (needed for vertical interp to regional) ! following is code segment from gesinfo.F90 allocate(ak5(nsig_gfs+1)) allocate(bk5(nsig_gfs+1)) allocate(ck5(nsig_gfs+1)) allocate(tref5(nsig_gfs)) + + idvc=gfshead%idvc + idsl=gfshead%idsl do k=1,nsig_gfs+1 ak5(k)=zero bk5(k)=zero ck5(k)=zero end do - if (.not. use_gfs_nemsio) then + if ((.not. use_gfs_nemsio) .and. (.not. use_gfs_ncio))then if (sighead%nvcoord == 1) then do k=1,sighead%levs+1 bk5(k) = sighead%vcoord(k,1) @@ -414,6 +502,26 @@ subroutine get_gefs_for_regional write(6,*)'GET_GEFS_FOR_REGIONAL: ***ERROR*** INVALID value for nvcoord=',sighead%nvcoord call stop2(85) endif + else if ( use_gfs_ncio ) then + if (gfshead%nvcoord == 1) then + do k=1,nsig_gfs+1 + bk5(k) = gfsheadv%vcoord(k,1) + end do + elseif (gfshead%nvcoord == 2) then + do k = 1,nsig_gfs+1 + ak5(k) = gfsheadv%vcoord(k,1)*zero_001 + bk5(k) = gfsheadv%vcoord(k,2) + end do + elseif (gfshead%nvcoord == 3) then + do k = 1,nsig_gfs+1 + ak5(k) = gfsheadv%vcoord(k,1)*zero_001 + bk5(k) = gfsheadv%vcoord(k,2) + ck5(k) = gfsheadv%vcoord(k,3)*zero_001 + end do + else + write(6,*)'GET_GEFS_FOR_REGIONAL netCDF: ***ERROR*** INVALID value for nvcoord=',gfshead%nvcoord + call stop2(85) + endif else if (nvcoord == 1) then do k=1,nsig_gfs+1 @@ -436,6 +544,7 @@ subroutine get_gefs_for_regional endif end if + if(mype == 0 .and. print_verbose)then do k=1,nsig_gfs+1 write(6,*)' ak5,bk5,ck5=',ak5(k),bk5(k),ck5(k) @@ -486,6 +595,23 @@ subroutine get_gefs_for_regional st_eg=zero ; vp_eg=zero ; t_eg=zero ; rh_eg=zero ; oz_eg=zero ; cw_eg=zero p_eg_nmmb=zero +! +! prepare terrain height +! + allocate(ges_z_ens(grd_mix%lat2,grd_mix%lon2)) + if (dual_res) then + allocate ( tmp_ens(grd_ens%lat2,grd_ens%lon2,grd_ens%nsig,1) ) + allocate ( tmp_anl(lat2,lon2,nsig,1) ) + tmp_anl=0.0_r_kind + tmp_anl(:,:,1,1)=ges_z(:,:) + call general_suba2sube(grd_a1,grd_e1,p_e2a,tmp_anl,tmp_ens,regional) + ges_z_ens(:,:)=tmp_ens(:,:,1,1) + deallocate(tmp_ens) + deallocate(tmp_anl) + else + ges_z_ens(:,:)=ges_z(:,:) + endif + ! begin loop over ensemble members rewind(10) @@ -509,6 +635,9 @@ subroutine get_gefs_for_regional if(use_gfs_nemsio)then call general_read_gfsatm_nems(grd_gfst,sp_gfs,filename,uv_hyb_ens,.false.,.true., & atm_bundle,.true.,iret) + else if (use_gfs_ncio) then + call general_read_gfsatm_nc(grd_gfst,sp_gfs,filename,uv_hyb_ens,.false.,.true., & + atm_bundle,.true.,iret) else call general_read_gfsatm(grd_gfst,sp_gfs,sp_gfs,filename,uv_hyb_ens,.false.,.true., & atm_bundle,inithead,iret) @@ -543,6 +672,8 @@ subroutine get_gefs_for_regional end do end do end do + + kz=num_fields ; kps=kz-1 do j=1,grd_gfs%lon2 do i=1,grd_gfs%lat2 @@ -666,7 +797,7 @@ subroutine get_gefs_for_regional ilook=-1 ; jlook=-1 allocate(prsl1000(grd_mix%lat2,grd_mix%lon2,grd_mix%nsig)) prsl1000=1000._r_kind*prsl - call compute_nmm_surfacep ( ges_z(:,:), zbarl,prsl1000, & + call compute_nmm_surfacep ( ges_z_ens(:,:), zbarl,prsl1000, & psfc_out,grd_mix%nsig,grd_mix%lat2,grd_mix%lon2, & ilook,jlook) deallocate(tt,zbarl,prsl1000) @@ -746,37 +877,52 @@ subroutine get_gefs_for_regional jjmin=grd_mix%nlon ratio_x=(nlon-one)/(grd_mix%nlon-one) ratio_y=(nlat-one)/(grd_mix%nlat-one) - do k=1,grd_mix%nsig - ku=k ; kv=ku+grd_mix%nsig ; kt=kv+grd_mix%nsig ; kq=kt+grd_mix%nsig ; koz=kq+grd_mix%nsig - kcw=koz+grd_mix%nsig - do j=1,grd_mix%lon2 - do i=1,grd_mix%lat2 + if(.not. fv3_regional)then + do k=1,grd_mix%nsig + ku=k ; kv=ku+grd_mix%nsig ; kt=kv+grd_mix%nsig ; kq=kt+grd_mix%nsig ; koz=kq+grd_mix%nsig + kcw=koz+grd_mix%nsig + do j=1,grd_mix%lon2 + do i=1,grd_mix%lat2 - ii=i+grd_mix%istart(mm1)-2 - jj=j+grd_mix%jstart(mm1)-2 - ii=min(grd_mix%nlat,max(1,ii)) - jj=min(grd_mix%nlon,max(1,jj)) - iimax=max(ii,iimax) - iimin=min(ii,iimin) - jjmax=max(jj,jjmax) - jjmin=min(jj,jjmin) - dlon_ens=float(jj) - dlat_ens=float(ii) - dlon=one+(dlon_ens-one)*ratio_x - dlat=one+(dlat_ens-one)*ratio_y - - call rotate_wind_ll2xy(work_sub(1,i,j,ku),work_sub(1,i,j,kv), & - uob,vob,region_lon_ens(ii,jj),dlon,dlat) - st_eg(i,j,k,n)=uob - vp_eg(i,j,k,n)=vob - - t_eg(i,j,k,n)=work_sub(1,i,j,kt) ! now pot virtual temp - rh_eg(i,j,k,n)=work_sub(1,i,j,kq) ! now rh - oz_eg(i,j,k,n)=work_sub(1,i,j,koz) - cw_eg(i,j,k,n)=work_sub(1,i,j,kcw) + ii=i+grd_mix%istart(mm1)-2 + jj=j+grd_mix%jstart(mm1)-2 + ii=min(grd_mix%nlat,max(1,ii)) + jj=min(grd_mix%nlon,max(1,jj)) + iimax=max(ii,iimax) + iimin=min(ii,iimin) + jjmax=max(jj,jjmax) + jjmin=min(jj,jjmin) + dlon_ens=float(jj) + dlat_ens=float(ii) + dlon=one+(dlon_ens-one)*ratio_x + dlat=one+(dlat_ens-one)*ratio_y + call rotate_wind_ll2xy(work_sub(1,i,j,ku),work_sub(1,i,j,kv), & + uob,vob,region_lon_ens(ii,jj),dlon,dlat) + st_eg(i,j,k,n)=uob + vp_eg(i,j,k,n)=vob + t_eg(i,j,k,n)=work_sub(1,i,j,kt) ! now pot virtual temp + rh_eg(i,j,k,n)=work_sub(1,i,j,kq) ! now rh + oz_eg(i,j,k,n)=work_sub(1,i,j,koz) + cw_eg(i,j,k,n)=work_sub(1,i,j,kcw) + end do end do end do - end do + else + do k=1,grd_mix%nsig + ku=k ; kv=ku+grd_mix%nsig ; kt=kv+grd_mix%nsig ; kq=kt+grd_mix%nsig ; koz=kq+grd_mix%nsig + kcw=koz+grd_mix%nsig + do j=1,grd_mix%lon2 + do i=1,grd_mix%lat2 + st_eg(i,j,k,n)=work_sub(1,i,j,ku) + vp_eg(i,j,k,n)=work_sub(1,i,j,kv) + t_eg(i,j,k,n)=work_sub(1,i,j,kt) ! now pot virtual temp + rh_eg(i,j,k,n)=work_sub(1,i,j,kq) ! now rh + oz_eg(i,j,k,n)=work_sub(1,i,j,koz) + cw_eg(i,j,k,n)=work_sub(1,i,j,kcw) + end do + end do + end do + endif kz=num_fields ; kps=kz-1 do j=1,grd_mix%lon2 do i=1,grd_mix%lat2 @@ -805,6 +951,8 @@ subroutine get_gefs_for_regional end do ! end loop over ensemble members. + deallocate(ges_z_ens) + ! next, compute mean of ensembles. allocate(stbar(grd_mix%lat2,grd_mix%lon2,grd_mix%nsig)) diff --git a/src/gsi/getcount_bufr.f90 b/src/gsi/getcount_bufr.f90 index 1af117dfc2..fff6e9db78 100644 --- a/src/gsi/getcount_bufr.f90 +++ b/src/gsi/getcount_bufr.f90 @@ -33,7 +33,6 @@ subroutine getcount_bufr(inpfile,nmsg,nsub) lunit=get_lun() nsub=0;nmsg=0 - call closbf(lunit) open(lunit,file=trim(inpfile),form='unformatted') call openbf(lunit,'IN',lunit) do while(ireadmg(lunit,subset,idate) >=0) diff --git a/src/gsi/gfs_stratosphere.f90 b/src/gsi/gfs_stratosphere.f90 index 6d6a3de433..4a855673a2 100644 --- a/src/gsi/gfs_stratosphere.f90 +++ b/src/gsi/gfs_stratosphere.f90 @@ -109,7 +109,7 @@ subroutine init_gfs_stratosphere use_gfs_stratosphere=.false. good_o3mr=.false. - nsig_max=120 + nsig_max=127 k0m=0 k1m=0 k0r=0 @@ -851,6 +851,7 @@ subroutine add_gfs_stratosphere ! of unused variables ! 2016-12-10 tong - add code to gfs nemsio meta data, if use_gfs_nemsio=True ! 2019-09-24 martin - add support for when use_gfs_ncio is True +! 2020-05-04 wu - no rotate_wind for fv3_regional ! ! input argument list: ! @@ -864,7 +865,7 @@ subroutine add_gfs_stratosphere use gridmod, only: regional,wrf_nmm_regional,use_gfs_nemsio,use_gfs_ncio use gridmod, only: region_lat,region_lon,aeta1_ll,aeta2_ll,pdtop_ll,pt_ll - use gridmod, only: nlon,nlat,lat2,lon2,nsig,rotate_wind_ll2xy + use gridmod, only: nlon,nlat,lat2,lon2,nsig,rotate_wind_ll2xy,fv3_regional use gridmod, only: use_gfs_ozone,jcap_gfs,nlat_gfs,nlon_gfs use constants,only: zero,one_tenth,half,one,ten,fv,t0c,r0_05,r60,r3600 use mpimod, only: mype @@ -1153,7 +1154,12 @@ subroutine add_gfs_stratosphere ncdim = get_dim(atmges, 'grid_xt'); lonb = ncdim%len ncdim = get_dim(atmges, 'grid_yt'); latb = ncdim%len ncdim = get_dim(atmges, 'pfull'); levs = ncdim%len + if ( mype == 0 ) then + write(6,*) 'ncio lonb latb lev =',lonb, latb, levs + endif njcap = -9999 + ! FV3GFS write component does not include JCAP, infer from DIMY-2 + if (njcap<0) njcap=latb-2 jcap_org = njcap idate6 = get_idate_from_time_units(atmges) call read_vardata(atmges, 'time', fhour2) @@ -1581,13 +1587,20 @@ subroutine add_gfs_stratosphere if (xsplo(k) > xspli_g(1)) ysplov_g(k)=yspliv_g(1) enddo ! blend contributions from regional and global: - do k=1,nsig - ! rotate gfs wind to nmmb coordinate: - call rotate_wind_ll2xy(ysplou_g(k),ysplov_g(k), & - uob,vob,region_lon(ii,jj),dlon,dlat) - ut(i,j,k)=blend_rm(k)*ysplou_r(k)+blend_gm(k)*uob - vt(i,j,k)=blend_rm(k)*ysplov_r(k)+blend_gm(k)*vob - enddo + if(fv3_regional)then + do k=1,nsig + ut(i,j,k)=blend_rm(k)*ysplou_r(k)+blend_gm(k)*ysplou_g(k) + vt(i,j,k)=blend_rm(k)*ysplov_r(k)+blend_gm(k)*ysplov_g(k) + enddo + else + do k=1,nsig + ! rotate gfs wind to nmmb coordinate: + call rotate_wind_ll2xy(ysplou_g(k),ysplov_g(k), & + uob,vob,region_lon(ii,jj),dlon,dlat) + ut(i,j,k)=blend_rm(k)*ysplou_r(k)+blend_gm(k)*uob + vt(i,j,k)=blend_rm(k)*ysplov_r(k)+blend_gm(k)*vob + enddo + endif ! t -- regional contribution do k=1,nsig_save diff --git a/src/gsi/glbsoi.f90 b/src/gsi/glbsoi.f90 index 222b49e832..d9dbee7b3b 100644 --- a/src/gsi/glbsoi.f90 +++ b/src/gsi/glbsoi.f90 @@ -169,7 +169,7 @@ subroutine glbsoi ! Declare local variables logical laltmin - integer(i_kind) jiterlast + integer(i_kind) jiterlast,lunix,lunit real(r_kind) :: zgg,zxy character(len=12) :: clfile logical print_verbose @@ -210,8 +210,17 @@ subroutine glbsoi ! Set cost function call create_jfunc + lunit=0 + lunix=0 + call isetprm('MXMSGL',400000) + call isetprm('MAXSS',250000) +! Initialize bufr read on all processors (so that exitbufr works, lunit and +! lunix are dummys) + call openbf(lunit,'FIRST',lunix) ! Read observations and scatter call observer_set +! release bufr memory + call exitbufr ! cloud analysis if(i_gsdcldanal_type==6 .or. i_gsdcldanal_type==3) then diff --git a/src/gsi/gridmod.F90 b/src/gsi/gridmod.F90 index fea4a06059..e89250ff8e 100644 --- a/src/gsi/gridmod.F90 +++ b/src/gsi/gridmod.F90 @@ -91,6 +91,7 @@ module gridmod ! 2019-04-19 martin - add use_fv3_aero option to distingiush between NGAC and FV3-Chem ! 2019-09-04 martin - add write_fv3_incr to write netCDF increment rather than analysis in NEMSIO format ! 2019-09-23 martin - add use_gfs_ncio to read global first guess from netCDF file +! 2020-12-18 Hu - add grid_type_fv3_regional ! ! ! @@ -145,7 +146,8 @@ module gridmod public :: nlat_regional,nlon_regional,update_regsfc,half_grid,gencode public :: diagnostic_reg,nmmb_reference_grid,filled_grid public :: grid_ratio_nmmb,isd_g,isc_g,dx_gfs,lpl_gfs,nsig5,nmmb_verttype - public :: grid_ratio_fv3_regional,fv3_regional + public :: grid_ratio_fv3_regional,fv3_regional,grid_type_fv3_regional + public :: l_reg_update_hydro_delz public :: nsig3,nsig4,grid_ratio_wrfmass public :: use_gfs_ozone,check_gfs_ozone_date,regional_ozone,nvege_type public :: jcap,jcap_b,hires_b,sp_a,grd_a @@ -176,6 +178,7 @@ module gridmod logical wrf_nmm_regional ! logical fv3_regional ! .t. to run with fv3 regional model + logical l_reg_update_hydro_delz ! .true. to update delz in fv3 model logical nems_nmmb_regional! .t. to run with NEMS NMMB model logical wrf_mass_regional ! logical wrf_mass_hybridcord @@ -202,6 +205,7 @@ module gridmod character(1) nmmb_reference_grid ! ='H': use nmmb H grid as reference for analysis grid ! ='V': use nmmb V grid as reference for analysis grid real(r_kind) grid_ratio_fv3_regional ! ratio of analysis grid to fv3 model grid in fv3 grid units. + integer(i_kind) grid_type_fv3_regional! type of fv3 model grid (grid orientation). real(r_kind) grid_ratio_nmmb ! ratio of analysis grid to nmmb model grid in nmmb model grid units. real(r_kind) grid_ratio_wrfmass ! ratio of analysis grid to wrf model grid in wrf mass grid units. character(3) nmmb_verttype ! 'OLD' for old vertical coordinate definition @@ -412,6 +416,7 @@ subroutine init_grid ! between analysis grids and others ! 2019-04-19 martin - add use_fv3_aero option for NGAC vs FV3-Chem ! 2019-09-23 martin - add flag use_gfs_ncio to determine whether to use netCDF to read global first gues field +! 2021-01-05 x.zhang/lei - add code for updating delz analysis in regional da ! ! !REMARKS: ! language: f90 @@ -448,6 +453,7 @@ subroutine init_grid wrf_mass_hybridcord = .false. cmaq_regional=.false. fv3_regional=.false. + l_reg_update_hydro_delz=.false. nems_nmmb_regional = .false. twodvar_regional = .false. use_gfs_ozone = .false. @@ -457,6 +463,7 @@ subroutine init_grid filled_grid = .false. half_grid = .false. grid_ratio_fv3_regional = one + grid_type_fv3_regional = 0 grid_ratio_nmmb = sqrt(two) grid_ratio_wrfmass = one nmmb_reference_grid = 'H' diff --git a/src/gsi/gsi_rfv3io_mod.f90 b/src/gsi/gsi_rfv3io_mod.f90 index c0366c9b3d..fe6a59cb85 100644 --- a/src/gsi/gsi_rfv3io_mod.f90 +++ b/src/gsi/gsi_rfv3io_mod.f90 @@ -23,6 +23,7 @@ module gsi_rfv3io_mod ! sub gsi_fv3ncdf_writeuv ! sub gsi_fv3ncdf_writeps ! sub gsi_fv3ncdf_write +! sub gsi_fv3ncdf_write_v1 ! sub check ! ! variable definitions: @@ -78,7 +79,7 @@ module gsi_rfv3io_mod public :: k_snwdph,k_f10m,mype_2d,n2d,k_orog,k_psfc public :: ijns,ijns2d,displss,displss2d,ijnz,displsz_g - integer(i_kind) mype_u,mype_v,mype_t,mype_q,mype_p,mype_oz,mype_ql + integer(i_kind) mype_u,mype_v,mype_t,mype_q,mype_p,mype_delz,mype_oz,mype_ql integer(i_kind) k_slmsk,k_tsea,k_vfrac,k_vtype,k_stype,k_zorl,k_smc,k_stc integer(i_kind) k_snwdph,k_f10m,mype_2d,n2d,k_orog,k_psfc parameter( & @@ -94,6 +95,7 @@ module gsi_rfv3io_mod k_slmsk=10, & !isli k_orog =11, & !terrain n2d=11 ) + logical :: grid_reverse_flag contains subroutine fv3regfilename_init(this,grid_spec_input,ak_bk_input,dynvars_input, & @@ -178,8 +180,9 @@ subroutine gsi_rfv3io_get_grid_specs(fv3filenamegin,ierr) use netcdf, only: nf90_inquire_variable use mpimod, only: mype use mod_fv3_lola, only: generate_anl_grid - use gridmod, only:nsig,regional_time,regional_fhr,aeta1_ll,aeta2_ll + use gridmod, only:nsig,regional_time,regional_fhr,regional_fmin,aeta1_ll,aeta2_ll use gridmod, only:nlon_regional,nlat_regional,eta1_ll,eta2_ll + use gridmod, only:grid_type_fv3_regional use kinds, only: i_kind,r_kind use constants, only: half,zero use mpimod, only: mpi_comm_world,mpi_itype,mpi_rtype @@ -196,6 +199,7 @@ subroutine gsi_rfv3io_get_grid_specs(fv3filenamegin,ierr) character(len=128) :: name integer(i_kind) myear,mmonth,mday,mhour,mminute,msecond real(r_kind),allocatable:: abk_fv3(:) + integer(i_kind) imiddle,jmiddle coupler_res_filenam=fv3filenamegin%couplerres grid_spec=fv3filenamegin%grid_spec @@ -215,6 +219,7 @@ subroutine gsi_rfv3io_get_grid_specs(fv3filenamegin,ierr) regional_time(5)=mminute regional_time(6)=msecond regional_fhr=zero ! forecast hour set zero for now + regional_fmin=zero ! forecast min set zero for now !!!!!!!!!! grid_spec !!!!!!!!!!!!!!! ierr=0 @@ -258,6 +263,42 @@ subroutine gsi_rfv3io_get_grid_specs(fv3filenamegin,ierr) iret=nf90_get_var(gfile_loc,k,grid_lont) endif enddo +! +! need to decide the grid orientation of the FV regional model +! +! grid_type_fv3_regional = 0 : decide grid orientation based on +! grid_lat/grid_lon +! 1 : input is E-W N-S grid +! 2 : input is W-E S-N grid +! + if(grid_type_fv3_regional == 0) then + imiddle=nx/2 + jmiddle=ny/2 + if( (grid_latt(imiddle,1) < grid_latt(imiddle,ny)) .and. & + (grid_lont(1,jmiddle) < grid_lont(nx,jmiddle)) ) then + grid_type_fv3_regional = 2 + else + grid_type_fv3_regional = 1 + endif + endif +! check the grid type + if( grid_type_fv3_regional == 1 ) then + if(mype==0) write(6,*) 'FV3 regional input grid is E-W N-S grid' + grid_reverse_flag=.true. ! grid is revered comparing to usual map view + elseif(grid_type_fv3_regional == 2) then + if(mype==0) write(6,*) 'FV3 regional input grid is W-E S-N grid' + grid_reverse_flag=.false. ! grid orientated just like we see on map view + else + write(6,*) 'Error: FV3 regional input grid is unknown grid' + call stop2(678) + endif +! + if(grid_type_fv3_regional == 2) then + call reverse_grid_r(grid_lont,nx,ny,1) + call reverse_grid_r(grid_latt,nx,ny,1) + call reverse_grid_r(grid_lon,nx+1,ny+1,1) + call reverse_grid_r(grid_lat,nx+1,ny+1,1) + endif iret=nf90_close(gfile_loc) @@ -317,6 +358,8 @@ subroutine gsi_rfv3io_get_grid_specs(fv3filenamegin,ierr) !!!!!!! setup A grid and interpolation/rotation coeff. call generate_anl_grid(nx,ny,grid_lon,grid_lont,grid_lat,grid_latt) + + deallocate (grid_lon,grid_lat,grid_lont,grid_latt) deallocate (ak,bk,abk_fv3) @@ -617,6 +660,7 @@ subroutine read_fv3_netcdf_guess(fv3filenamegin) mype_ql=5 mype_oz=6 mype_2d=7 + mype_delz=8 allocate(ijns(npe),ijns2d(npe),ijnz(npe) ) allocate(displss(npe),displss2d(npe),displsz_g(npe) ) @@ -671,6 +715,7 @@ subroutine read_fv3_netcdf_guess(fv3filenamegin) else call gsi_fv3ncdf2d_read_v1(dynvars,'ps','PS',ges_ps,mype_p) ges_prsi(:,:,nsig+1,it)=eta1_ll(nsig+1) + ges_ps=ges_ps*0.001_r_kind do k=1,nsig ges_prsi(:,:,k,it)=eta1_ll(k)+eta2_ll(k)*ges_ps enddo @@ -805,7 +850,7 @@ subroutine gsi_fv3ncdf2d_read(fv3filenamegin,it,ges_z) if(allocated(sfc )) deallocate(sfc ) allocate(sfc(dim(dim_id(1)),dim(dim_id(2)),dim(dim_id(3)))) iret=nf90_get_var(gfile_loc,i,sfc) - call fv3_h_to_ll(sfc(:,:,1),a,nx,ny,nxa,nya) + call fv3_h_to_ll(sfc(:,:,1),a,nx,ny,nxa,nya,grid_reverse_flag) kk=0 do n=1,npe @@ -853,7 +898,7 @@ subroutine gsi_fv3ncdf2d_read(fv3filenamegin,it,ges_z) iret=nf90_close(gfile_loc) k=k_orog - call fv3_h_to_ll(sfc1,a,nx,ny,nxa,nya) + call fv3_h_to_ll(sfc1,a,nx,ny,nxa,nya,grid_reverse_flag) kk=0 do n=1,npe @@ -973,7 +1018,7 @@ subroutine gsi_fv3ncdf2d_read_v1(filenamein,varname,varname2,work_sub,mype_io) if(allocated(uu )) deallocate(uu ) allocate(uu(nx,ny,1)) iret=nf90_get_var(gfile_loc,var_id,uu) - call fv3_h_to_ll(uu(:,:,1),a,nx,ny,nlon,nlat) + call fv3_h_to_ll(uu(:,:,1),a,nx,ny,nlon,nlat,grid_reverse_flag) kk=0 do n=1,npe do j=1,ijn_s(n) @@ -1085,7 +1130,7 @@ subroutine gsi_fv3ncdf_read(filenamein,varname,varname2,work_sub,mype_io) nzp1=nz+1 do i=1,nz ir=nzp1-i - call fv3_h_to_ll(uu(:,:,i),a,dim(dim_id(1)),dim(dim_id(2)),nlon,nlat) + call fv3_h_to_ll(uu(:,:,i),a,dim(dim_id(1)),dim(dim_id(2)),nlon,nlat,grid_reverse_flag) kk=0 do n=1,npe ns=displss(n)+(ir-1)*ijn_s(n) @@ -1204,7 +1249,7 @@ subroutine gsi_fv3ncdf_read_v1(filenamein,varname,varname2,work_sub,mype_io) nzp1=nztmp+1 do i=1,nztmp ir=nzp1-i - call fv3_h_to_ll(uu(:,:,i),a,nx,ny,nlon,nlat) + call fv3_h_to_ll(uu(:,:,i),a,nx,ny,nlon,nlat,grid_reverse_flag) kk=0 do n=1,npe ns=displss(n)+(ir-1)*ijn_s(n) @@ -1315,10 +1360,29 @@ subroutine gsi_fv3ncdf_readuv(dynvarsfile,ges_u,ges_v) if(allocated(uu)) deallocate(uu) allocate(uu(dim(dim_id(1)),dim(dim_id(2)),dim(dim_id(3)))) iret=nf90_get_var(gfile_loc,k,uu) +! NOTE on transfor to earth u/v: +! The u and v before transferring need to be in E-W/N-S grid, which is +! defined as reversed grid here because it is revered from map view. +! +! Have set the following flag for grid orientation +! grid_reverse_flag=true: E-W/N-S grid +! grid_reverse_flag=false: W-E/S-N grid +! +! So for preparing the wind transferring, need to reverse the grid from +! W-E/S-N grid to E-W/N-S grid when grid_reverse_flag=false: +! +! if(.not.grid_reverse_flag) call reverse_grid_r_uv +! +! and the last input parameter for fv3_h_to_ll is alway true: +! +! call fv3_h_to_ll(u,a,nx,ny,nxa,nya,.true.) +! if(trim(name)=='u'.or.trim(name)=='U') then allocate(temp1(dim(dim_id(1)),dim(dim_id(2)),dim(dim_id(3)))) + if(.not.grid_reverse_flag) call reverse_grid_r_uv(uu,dim(dim_id(1)),dim(dim_id(2)),dim(dim_id(3))) temp1=uu else if(trim(name)=='v'.or.trim(name)=='V') then + if(.not.grid_reverse_flag) call reverse_grid_r_uv(uu,dim(dim_id(1)),dim(dim_id(2)),dim(dim_id(3))) exit endif endif @@ -1330,9 +1394,9 @@ subroutine gsi_fv3ncdf_readuv(dynvarsfile,ges_u,ges_v) ir=nzp1-i call fv3uv2earth(temp1(:,:,i),uu(:,:,i),nx,ny,u,v) if(mype==mype_u)then - call fv3_h_to_ll(u,a,nx,ny,nxa,nya) + call fv3_h_to_ll(u,a,nx,ny,nxa,nya,.true.) else - call fv3_h_to_ll(v,a,nx,ny,nxa,nya) + call fv3_h_to_ll(v,a,nx,ny,nxa,nya,.true.) endif kk=0 do n=1,npe @@ -1459,12 +1523,12 @@ subroutine gsi_fv3ncdf_readuv_v1(dynvarsfile,ges_u,ges_v) uorv(:,j)=half*(uu(:,j,i)+uu(:,j+1,i)) enddo - call fv3_h_to_ll(uorv(:,:),a,nx,ny,nxa,nya) + call fv3_h_to_ll(uorv(:,:),a,nx,ny,nxa,nya,grid_reverse_flag) else do j=1,nx uorv(j,:)=half*(uu(j,:,i)+uu(j+1,:,i)) enddo - call fv3_h_to_ll(uorv(:,:),a,nx,ny,nxa,nya) + call fv3_h_to_ll(uorv(:,:),a,nx,ny,nxa,nya,grid_reverse_flag) endif kk=0 do n=1,npe @@ -1500,6 +1564,7 @@ subroutine wrfv3_netcdf(fv3filenamegin) ! abstract: write FV3 analysis in netcdf format ! ! program history log: +! 2021-01-05 x.zhang/lei - add code for updating delz analysis in regional da ! ! input argument list: ! @@ -1515,6 +1580,11 @@ subroutine wrfv3_netcdf(fv3filenamegin) use gsi_metguess_mod, only: gsi_metguess_bundle use gsi_bundlemod, only: gsi_bundlegetpointer use mpeu_util, only: die + + use gridmod,only: l_reg_update_hydro_delz + use gridmod, only: lat2,lon2,nsig + use guess_grids, only:geom_hgti,geom_hgti_bg + implicit none type (type_fv3regfilenameg),intent(in) :: fv3filenamegin @@ -1528,6 +1598,10 @@ subroutine wrfv3_netcdf(fv3filenamegin) real(r_kind),pointer,dimension(:,:,:):: ges_u =>NULL() real(r_kind),pointer,dimension(:,:,:):: ges_v =>NULL() real(r_kind),pointer,dimension(:,:,:):: ges_q =>NULL() + + real(r_kind),allocatable,dimension(:,:,:)::ges_delzinc + integer(i_kind) k + dynvars=fv3filenamegin%dynvars tracers=fv3filenamegin%tracers @@ -1542,16 +1616,25 @@ subroutine wrfv3_netcdf(fv3filenamegin) add_saved=.true. ! write out - if( fv3sar_bg_opt == 0) then - call gsi_fv3ncdf_write(dynvars,'T',ges_tsen(1,1,1,it),mype_t,add_saved) - call gsi_fv3ncdf_write(tracers,'sphum',ges_q ,mype_q,add_saved) - call gsi_fv3ncdf_writeuv(dynvars,ges_u,ges_v,mype_v,add_saved) - call gsi_fv3ncdf_writeps(dynvars,'delp',ges_ps,mype_p,add_saved) + if(fv3sar_bg_opt == 0) then + call gsi_fv3ncdf_write(dynvars,'T',ges_tsen(1,1,1,it),mype_t,add_saved) + call gsi_fv3ncdf_write(tracers,'sphum',ges_q ,mype_q,add_saved) + call gsi_fv3ncdf_writeuv(dynvars,ges_u,ges_v,mype_v,add_saved) + call gsi_fv3ncdf_writeps(dynvars,'delp',ges_ps,mype_p,add_saved) + if(l_reg_update_hydro_delz) then + allocate(ges_delzinc(lat2,lon2,nsig)) + do k=1,nsig + ges_delzinc(:,:,k)=geom_hgti(:,:,k+1,it)-geom_hgti_bg(:,:,k+1,it)-geom_hgti(:,:,k,it)+geom_hgti_bg(:,:,k,it) + enddo + call gsi_fv3ncdf_write_fv3_dz(dynvars,"DZ",ges_delzinc,mype_delz,add_saved) + deallocate(ges_delzinc) + endif + else - call gsi_fv3ncdf_write(dynvars,'t',ges_tsen(1,1,1,it),mype_t,add_saved) - call gsi_fv3ncdf_write(tracers,'sphum',ges_q ,mype_q,add_saved) - call gsi_fv3ncdf_writeuv_v1(dynvars,ges_u,ges_v,mype_v,add_saved) - call gsi_fv3ncdf_writeps_v1(dynvars,'ps',ges_ps,mype_p,add_saved) + call gsi_fv3ncdf_write_v1(dynvars,'t',ges_tsen(1,1,1,it),mype_t,add_saved) + call gsi_fv3ncdf_write_v1(tracers,'sphum',ges_q ,mype_q,add_saved) + call gsi_fv3ncdf_writeuv_v1(dynvars,ges_u,ges_v,mype_v,add_saved) + call gsi_fv3ncdf_writeps_v1(dynvars,'ps',ges_ps,mype_p,add_saved) endif @@ -1630,8 +1713,8 @@ subroutine gsi_fv3ncdf_writeuv(dynvars,varu,varv,mype_io,add_saved) do m=1,npe do k=1,nsig do n=displs_g(m)+1,displs_g(m)+ijn(m) - ns=ns+1 - work_au(ltosi(n),ltosj(n),k)=work(ns) + ns=ns+1 + work_au(ltosi(n),ltosj(n),k)=work(ns) end do enddo enddo @@ -1675,10 +1758,14 @@ subroutine gsi_fv3ncdf_writeuv(dynvars,varu,varv,mype_io,add_saved) !!!!!!!! readin work_b !!!!!!!!!!!!!!!! call check( nf90_get_var(gfile_loc,ugrd_VarId,work_bu) ) call check( nf90_get_var(gfile_loc,vgrd_VarId,work_bv) ) + if(.not.grid_reverse_flag) then + call reverse_grid_r_uv(work_bu,nlon_regional,nlat_regional+1,nsig) + call reverse_grid_r_uv(work_bv,nlon_regional+1,nlat_regional,nsig) + endif do k=1,nsig call fv3uv2earth(work_bu(1,1,k),work_bv(1,1,k),nlon_regional,nlat_regional,u,v) - call fv3_h_to_ll(u,workau2,nlon_regional,nlat_regional,nlon,nlat) - call fv3_h_to_ll(v,workav2,nlon_regional,nlat_regional,nlon,nlat) + call fv3_h_to_ll(u,workau2,nlon_regional,nlat_regional,nlon,nlat,.true.) + call fv3_h_to_ll(v,workav2,nlon_regional,nlat_regional,nlon,nlat,.true.) !!!!!!!! find analysis_inc: work_a !!!!!!!!!!!!!!!! work_au(:,:,k)=work_au(:,:,k)-workau2(:,:) work_av(:,:,k)=work_av(:,:,k)-workav2(:,:) @@ -1697,6 +1784,10 @@ subroutine gsi_fv3ncdf_writeuv(dynvars,varu,varv,mype_io,add_saved) call earthuv2fv3(u,v,nlon_regional,nlat_regional,work_bu(:,:,k),work_bv(:,:,k)) enddo endif + if(.not.grid_reverse_flag) then + call reverse_grid_r_uv(work_bu,nlon_regional,nlat_regional+1,nsig) + call reverse_grid_r_uv(work_bv,nlon_regional+1,nlat_regional,nsig) + endif deallocate(work_au,work_av,u,v) print *,'write out u/v to ',trim(dynvars ) @@ -1758,7 +1849,6 @@ subroutine gsi_fv3ncdf_writeps(filename,varname,var,mype_io,add_saved) real(r_kind),allocatable,dimension(:,:,:):: work_b,work_bi real(r_kind),allocatable,dimension(:,:):: workb2,worka2 - mm1=mype+1 allocate( work(max(iglobal,itotsub)),work_sub(lat1,lon1) ) do i=1,lon1 @@ -1768,7 +1858,6 @@ subroutine gsi_fv3ncdf_writeps(filename,varname,var,mype_io,add_saved) end do call mpi_gatherv(work_sub,ijn(mm1),mpi_rtype, & work,ijn,displs_g,mpi_rtype,mype_io,mpi_comm_world,ierror) - if(mype==mype_io) then allocate( work_a(nlat,nlon)) do i=1,iglobal @@ -1778,9 +1867,9 @@ subroutine gsi_fv3ncdf_writeps(filename,varname,var,mype_io,add_saved) allocate( work_b(nlon_regional,nlat_regional,nsig)) call check( nf90_open(trim(filename),nf90_write,gfile_loc) ) call check( nf90_inq_varid(gfile_loc,trim(varname),VarId) ) + allocate( workb2(nlon_regional,nlat_regional)) if(add_saved)then - allocate( workb2(nlon_regional,nlat_regional)) allocate( worka2(nlat,nlon)) !!!!!!!! read in guess delp !!!!!!!!!!!!!! call check( nf90_get_var(gfile_loc,VarId,work_b) ) @@ -1788,17 +1877,18 @@ subroutine gsi_fv3ncdf_writeps(filename,varname,var,mype_io,add_saved) do i=2,nsig+1 work_bi(:,:,i)=work_b(:,:,i-1)*0.001_r_kind+work_bi(:,:,i-1) enddo - call fv3_h_to_ll(work_bi(:,:,nsig+1),worka2,nlon_regional,nlat_regional,nlon,nlat) + call fv3_h_to_ll(work_bi(:,:,nsig+1),worka2,nlon_regional,nlat_regional,nlon,nlat,grid_reverse_flag) !!!!!!! analysis_inc Psfc: work_a work_a(:,:)=work_a(:,:)-worka2(:,:) - call fv3_ll_to_h(work_a,workb2,nlon,nlat,nlon_regional,nlat_regional,.true.) + call fv3_ll_to_h(work_a,workb2,nlon,nlat,nlon_regional,nlat_regional,grid_reverse_flag) do k=1,nsig+1 kr=nsig+2-k !!!!!!! ges_prsi+hydrostatic analysis_inc !!!!!!!!!!!!!!!! work_bi(:,:,k)=work_bi(:,:,k)+eta2_ll(kr)*workb2(:,:) enddo + else - call fv3_ll_to_h(work_a,workb2,nlon,nlat,nlon_regional,nlat_regional,.true.) + call fv3_ll_to_h(work_a,workb2,nlon,nlat,nlon_regional,nlat_regional,grid_reverse_flag) do k=1,nsig+1 kr=nsig+2-k !!!!!!! Psfc_ges+hydrostatic analysis_inc !!!!!!!!!!!!!!!! @@ -1813,7 +1903,9 @@ subroutine gsi_fv3ncdf_writeps(filename,varname,var,mype_io,add_saved) call check( nf90_put_var(gfile_loc,VarId,work_b) ) call check( nf90_close(gfile_loc) ) - deallocate(worka2,workb2) + if (allocated(worka2)) deallocate(worka2) + if (allocated(workb2)) deallocate(workb2) + deallocate(work_b,work_a,work_bi) end if !mype_io @@ -1832,6 +1924,7 @@ subroutine gsi_fv3ncdf_writeuv_v1(dynvars,varu,varv,mype_io,add_saved) ! program history log: ! 2019-04-22 lei modified from gsi_nemsio_writeuv_v1 for update ! u_w,v_w,u_s,v_s in the cold start files! +! 2020-03-06 lei added ilev0 fix ! input argument list: ! varu,varv ! add_saved - true: add analysis increments to readin guess then write out @@ -1870,6 +1963,7 @@ subroutine gsi_fv3ncdf_writeuv_v1(dynvars,varu,varv,mype_io,add_saved) integer(i_kind) :: u_wgrd_VarId,v_wgrd_VarId integer(i_kind) :: u_sgrd_VarId,v_sgrd_VarId integer(i_kind) i,j,mm1,n,k,ns,kr,m + integer(i_kind) ilev0 real(r_kind),allocatable,dimension(:):: work real(r_kind),allocatable,dimension(:,:,:):: work_sub,work_au,work_av real(r_kind),allocatable,dimension(:,:,:):: work_bu_s,work_bv_s @@ -1879,6 +1973,7 @@ subroutine gsi_fv3ncdf_writeuv_v1(dynvars,varu,varv,mype_io,add_saved) real(r_kind),allocatable,dimension(:,:):: workbu_w2,workbv_w2 mm1=mype+1 + ilev0=1 allocate( work(max(iglobal,itotsub)*nsig),work_sub(lat1,lon1,nsig)) !!!!!! gather analysis u !! revers k !!!!!!!!!!! @@ -1929,18 +2024,18 @@ subroutine gsi_fv3ncdf_writeuv_v1(dynvars,varu,varv,mype_io,add_saved) enddo enddo deallocate(work,work_sub) -!clt u and v would contain winds at either D-grid or A-grid -!clt do not diretly use them in between fv3uv2eath and fv3_h_to_ll unless paying +! u and v would contain winds at either D-grid or A-grid +! do not diretly use them in between fv3uv2eath and fv3_h_to_ll unless paying !attention to the actual storage layout call check( nf90_open(trim(dynvars ),nf90_write,gfile_loc) ) allocate( u(nlon_regional,nlat_regional)) allocate( v(nlon_regional,nlat_regional)) - allocate( work_bu_s(nlon_regional,nlat_regional+1,nsig)) - allocate( work_bv_s(nlon_regional,nlat_regional+1,nsig)) - allocate( work_bu_w(nlon_regional+1,nlat_regional,nsig)) - allocate( work_bv_w(nlon_regional+1,nlat_regional,nsig)) + allocate( work_bu_s(nlon_regional,nlat_regional+1,nsig+1)) + allocate( work_bv_s(nlon_regional,nlat_regional+1,nsig+1)) + allocate( work_bu_w(nlon_regional+1,nlat_regional,nsig+1)) + allocate( work_bv_w(nlon_regional+1,nlat_regional,nsig+1)) @@ -1949,8 +2044,6 @@ subroutine gsi_fv3ncdf_writeuv_v1(dynvars,varu,varv,mype_io,add_saved) call check( nf90_inq_varid(gfile_loc,'v_s',v_sgrd_VarId) ) call check( nf90_inq_varid(gfile_loc,'v_w',v_wgrd_VarId) ) - if(add_saved)then - allocate( workau2(nlat,nlon),workav2(nlat,nlon)) allocate( workbu_w2(nlon_regional+1,nlat_regional)) allocate( workbv_w2(nlon_regional+1,nlat_regional)) allocate( workbu_s2(nlon_regional,nlat_regional+1)) @@ -1960,33 +2053,36 @@ subroutine gsi_fv3ncdf_writeuv_v1(dynvars,varu,varv,mype_io,add_saved) call check( nf90_get_var(gfile_loc,u_wgrd_VarId,work_bu_w) ) call check( nf90_get_var(gfile_loc,v_sgrd_VarId,work_bv_s) ) call check( nf90_get_var(gfile_loc,v_wgrd_VarId,work_bv_w) ) + + if(add_saved)then + allocate( workau2(nlat,nlon),workav2(nlat,nlon)) do k=1,nsig do j=1,nlat_regional - u(:,j)=half * (work_bu_s(:,j,k)+ work_bu_s(:,j+1,k)) + u(:,j)=half * (work_bu_s(:,j,ilev0+k)+ work_bu_s(:,j+1,ilev0+k)) enddo do i=1,nlon_regional - v(i,:)=half*(work_bv_w(i,:,k)+work_bv_w(i+1,:,k)) + v(i,:)=half*(work_bv_w(i,:,ilev0+k)+work_bv_w(i+1,:,ilev0+k)) enddo - call fv3_h_to_ll(u,workau2,nlon_regional,nlat_regional,nlon,nlat) - call fv3_h_to_ll(v,workav2,nlon_regional,nlat_regional,nlon,nlat) + call fv3_h_to_ll(u,workau2,nlon_regional,nlat_regional,nlon,nlat,grid_reverse_flag) + call fv3_h_to_ll(v,workav2,nlon_regional,nlat_regional,nlon,nlat,grid_reverse_flag) !!!!!!!! find analysis_inc: work_a !!!!!!!!!!!!!!!! work_au(:,:,k)=work_au(:,:,k)-workau2(:,:) work_av(:,:,k)=work_av(:,:,k)-workav2(:,:) - call fv3_ll_to_h(work_au(:,:,k),u,nlon,nlat,nlon_regional,nlat_regional,.true.) - call fv3_ll_to_h(work_av(:,:,k),v,nlon,nlat,nlon_regional,nlat_regional,.true.) + call fv3_ll_to_h(work_au(:,:,k),u,nlon,nlat,nlon_regional,nlat_regional,grid_reverse_flag) + call fv3_ll_to_h(work_av(:,:,k),v,nlon,nlat,nlon_regional,nlat_regional,grid_reverse_flag) !!!!!!!! add analysis_inc to readin work_b !!!!!!!!!!!!!!!! - do i=2,nlon_regional-1 - workbu_w2(i,:)=half*(u(i,:)+u(i+1,:)) - workbv_w2(i,:)=half*(v(i,:)+v(i+1,:)) + do i=2,nlon_regional + workbu_w2(i,:)=half*(u(i-1,:)+u(i,:)) + workbv_w2(i,:)=half*(v(i-1,:)+v(i,:)) enddo workbu_w2(1,:)=u(1,:) workbv_w2(1,:)=v(1,:) workbu_w2(nlon_regional+1,:)=u(nlon_regional,:) workbv_w2(nlon_regional+1,:)=v(nlon_regional,:) - do j=2,nlat_regional-1 - workbu_s2(:,j)=half*(u(:,j)+u(:,j+1)) - workbv_s2(:,j)=half*(v(:,j)+v(:,j+1)) + do j=2,nlat_regional + workbu_s2(:,j)=half*(u(:,j-1)+u(:,j)) + workbv_s2(:,j)=half*(v(:,j-1)+v(:,j)) enddo workbu_s2(:,1)=u(:,1) workbv_s2(:,1)=v(:,1) @@ -1995,36 +2091,36 @@ subroutine gsi_fv3ncdf_writeuv_v1(dynvars,varu,varv,mype_io,add_saved) - work_bu_w(:,:,k)=work_bu_w(:,:,k)+workbu_w2(:,:) - work_bu_s(:,:,k)=work_bu_s(:,:,k)+workbu_s2(:,:) - work_bv_w(:,:,k)=work_bv_w(:,:,k)+workbv_w2(:,:) - work_bv_s(:,:,k)=work_bv_s(:,:,k)+workbv_s2(:,:) + work_bu_w(:,:,ilev0+k)=work_bu_w(:,:,ilev0+k)+workbu_w2(:,:) + work_bu_s(:,:,ilev0+k)=work_bu_s(:,:,ilev0+k)+workbu_s2(:,:) + work_bv_w(:,:,ilev0+k)=work_bv_w(:,:,ilev0+k)+workbv_w2(:,:) + work_bv_s(:,:,ilev0+k)=work_bv_s(:,:,ilev0+k)+workbv_s2(:,:) enddo deallocate(workau2,workav2) deallocate(workbu_w2,workbv_w2) deallocate(workbu_s2,workbv_s2) else do k=1,nsig - call fv3_ll_to_h(work_au(:,:,k),u,nlon,nlat,nlon_regional,nlat_regional,.true.) - call fv3_ll_to_h(work_av(:,:,k),v,nlon,nlat,nlon_regional,nlat_regional,.true.) + call fv3_ll_to_h(work_au(:,:,k),u,nlon,nlat,nlon_regional,nlat_regional,grid_reverse_flag) + call fv3_ll_to_h(work_av(:,:,k),v,nlon,nlat,nlon_regional,nlat_regional,grid_reverse_flag) - do i=2,nlon_regional-1 - work_bu_w(i,:,k)=half*(u(i,:)+u(i+1,:)) - work_bv_w(i,:,k)=half*(v(i,:)+v(i+1,:)) + do i=2,nlon_regional + work_bu_w(i,:,k)=half*(u(i-1,:)+u(i,:)) + work_bv_w(i,:,k)=half*(v(i-1,:)+v(i,:)) enddo - work_bu_w(1,:,k)=u(1,:) - work_bv_w(1,:,k)=v(1,:) - work_bu_w(nlon_regional+1,:,k)=u(nlon_regional,:) - work_bv_w(nlon_regional+1,:,k)=v(nlon_regional,:) - - do j=2,nlat_regional-1 - work_bu_s(:,j,k)=half*(u(:,j)+u(:,j+1)) - work_bv_s(:,j,k)=half*(v(:,j)+v(:,j+1)) + work_bu_w(1,:,ilev0+k)=u(1,:) + work_bv_w(1,:,ilev0+k)=v(1,:) + work_bu_w(nlon_regional+1,:,ilev0+k)=u(nlon_regional,:) + work_bv_w(nlon_regional+1,:,ilev0+k)=v(nlon_regional,:) + + do j=2,nlat_regional + work_bu_s(:,j,ilev0+k)=half*(u(:,j-1)+u(:,j)) + work_bv_s(:,j,ilev0+k)=half*(v(:,j-1)+v(:,j)) enddo - work_bu_s(:,1,k)=u(:,1) - work_bv_s(:,1,k)=v(:,1) - work_bu_s(:,nlat_regional+1,k)=u(:,nlat_regional) - work_bv_s(:,nlat_regional+1,k)=v(:,nlat_regional) + work_bu_s(:,1,ilev0+k)=u(:,1) + work_bv_s(:,1,ilev0+k)=v(:,1) + work_bu_s(:,nlat_regional+1,ilev0+k)=u(:,nlat_regional) + work_bv_s(:,nlat_regional+1,ilev0+k)=v(:,nlat_regional) enddo @@ -2120,21 +2216,23 @@ subroutine gsi_fv3ncdf_writeps_v1(filename,varname,var,mype_io,add_saved) allocate( worka2(nlat,nlon)) !!!!!!!! read in guess delp !!!!!!!!!!!!!! call check( nf90_get_var(gfile_loc,VarId,work_b) ) - call fv3_h_to_ll(work_b,worka2,nlon_regional,nlat_regional,nlon,nlat) + call fv3_h_to_ll(work_b,worka2,nlon_regional,nlat_regional,nlon,nlat,grid_reverse_flag) !!!!!!! analysis_inc Psfc: work_a work_a(:,:)=work_a(:,:)-worka2(:,:) - call fv3_ll_to_h(work_a,workb2,nlon,nlat,nlon_regional,nlat_regional,.true.) + call fv3_ll_to_h(work_a,workb2,nlon,nlat,nlon_regional,nlat_regional,grid_reverse_flag) work_b(:,:)=work_b(:,:)+workb2(:,:) else - call fv3_ll_to_h(work_a,work_b,nlon,nlat,nlon_regional,nlat_regional,.true.) + call fv3_ll_to_h(work_a,work_b,nlon,nlat,nlon_regional,nlat_regional,grid_reverse_flag) endif call check( nf90_put_var(gfile_loc,VarId,work_b) ) call check( nf90_close(gfile_loc) ) - deallocate(worka2,workb2) + if (allocated(worka2)) deallocate(worka2) + if ( allocated(workb2)) deallocate(workb2) deallocate(work_b,work_a,work_bi) + end if !mype_io deallocate(work,work_sub) @@ -2227,16 +2325,16 @@ subroutine gsi_fv3ncdf_write(filename,varname,var,mype_io,add_saved) call check( nf90_get_var(gfile_loc,VarId,work_b) ) do k=1,nsig - call fv3_h_to_ll(work_b(:,:,k),worka2,nlon_regional,nlat_regional,nlon,nlat) + call fv3_h_to_ll(work_b(:,:,k),worka2,nlon_regional,nlat_regional,nlon,nlat,grid_reverse_flag) !!!!!!!! analysis_inc: work_a !!!!!!!!!!!!!!!! work_a(:,:,k)=work_a(:,:,k)-worka2(:,:) - call fv3_ll_to_h(work_a(1,1,k),workb2,nlon,nlat,nlon_regional,nlat_regional,.true.) + call fv3_ll_to_h(work_a(1,1,k),workb2,nlon,nlat,nlon_regional,nlat_regional,grid_reverse_flag) work_b(:,:,k)=work_b(:,:,k)+workb2(:,:) enddo deallocate(worka2,workb2) else do k=1,nsig - call fv3_ll_to_h(work_a(1,1,k),work_b(1,1,k),nlon,nlat,nlon_regional,nlat_regional,.true.) + call fv3_ll_to_h(work_a(1,1,k),work_b(1,1,k),nlon,nlat,nlon_regional,nlat_regional,grid_reverse_flag) enddo endif @@ -2249,6 +2347,108 @@ subroutine gsi_fv3ncdf_write(filename,varname,var,mype_io,add_saved) deallocate(work,work_sub) end subroutine gsi_fv3ncdf_write +subroutine gsi_fv3ncdf_write_fv3_dz(filename,varname,varinc,mype_io,add_saved) +!$$$ subprogram documentation block +! . . . . +! subprogram: gsi_nemsio_write_fv3_dz from gsi_nemsio_write +! pgrmmr: lei +! +! abstract: +! +! program history log: +! +! input argument list: +! varin +! add_saved +! mype - mpi task id +! mype_io +! +! output argument list: +! +! attributes: +! language: f90 +! machine: +! +!$$$ end documentation block + + use mpimod, only: mpi_rtype,mpi_comm_world,ierror,npe,mype + use gridmod, only: lat2,lon2,nlon,nlat,lat1,lon1,nsig + use gridmod, only: ijn,displs_g,itotsub,iglobal + use mod_fv3_lola, only: fv3_ll_to_h + use mod_fv3_lola, only: fv3_h_to_ll + use general_commvars_mod, only: ltosi,ltosj + use netcdf, only: nf90_open,nf90_close + use netcdf, only: nf90_write,nf90_inq_varid + use netcdf, only: nf90_put_var,nf90_get_var + implicit none + + real(r_kind) ,intent(in ) :: varinc(lat2,lon2,nsig) + integer(i_kind),intent(in ) :: mype_io + logical ,intent(in ) :: add_saved + character(*) ,intent(in ) :: varname,filename + + integer(i_kind) :: VarId,gfile_loc + integer(i_kind) i,j,mm1,k,kr,ns,n,m + real(r_kind),allocatable,dimension(:):: work + real(r_kind),allocatable,dimension(:,:,:):: work_sub,work_ainc + real(r_kind),allocatable,dimension(:,:,:):: work_b + real(r_kind),allocatable,dimension(:,:):: workb2 + + mm1=mype+1 + + allocate( work(max(iglobal,itotsub)*nsig),work_sub(lat1,lon1,nsig)) +!!!!!!!! reverse z !!!!!!!!!!!!!! + do k=1,nsig + kr=nsig+1-k + do i=1,lon1 + do j=1,lat1 + work_sub(j,i,kr)=varinc(j+1,i+1,k) + end do + end do + enddo + call mpi_gatherv(work_sub,ijnz(mm1),mpi_rtype, & + work,ijnz,displsz_g,mpi_rtype,mype_io,mpi_comm_world,ierror) + + if(mype==mype_io) then + allocate( work_ainc(nlat,nlon,nsig)) + ns=0 + do m=1,npe + do k=1,nsig + do n=displs_g(m)+1,displs_g(m)+ijn(m) + ns=ns+1 + work_ainc(ltosi(n),ltosj(n),k)=work(ns) + end do + enddo + enddo + + allocate( work_b(nlon_regional,nlat_regional,nsig)) + + call check( nf90_open(trim(filename),nf90_write,gfile_loc) ) + call check( nf90_inq_varid(gfile_loc,trim(varname),VarId) ) + + if(.not. add_saved)then + write(6,*)'here the input is increments to be added to the read-in background, & + hence, add_saved has to be true' + endif + allocate( workb2(nlon_regional,nlat_regional)) + call check( nf90_get_var(gfile_loc,VarId,work_b) ) + + do k=1,nsig + call fv3_ll_to_h(work_ainc(1,1,k),workb2(:,:),nlon,nlat,nlon_regional,nlat_regional,.true.) +!!!!!!!! analysis_inc: work_a !!!!!!!!!!!!!!!! + work_b(:,:,k)=workb2(:,:)+work_b(:,:,k) + enddo + deallocate(workb2) + + print *,'write out ',trim(varname),' to ',trim(filename) + call check( nf90_put_var(gfile_loc,VarId,work_b) ) + call check( nf90_close(gfile_loc) ) + deallocate(work_b,work_ainc) + end if !mype_io + + deallocate(work,work_sub) + +end subroutine gsi_fv3ncdf_write_fv3_dz subroutine check(status) use kinds, only: i_kind use netcdf, only: nf90_noerr,nf90_strerror @@ -2259,6 +2459,163 @@ subroutine check(status) stop end if end subroutine check +subroutine gsi_fv3ncdf_write_v1(filename,varname,var,mype_io,add_saved) +!$$$ subprogram documentation block +! . . . . +! subprogram: gsi_nemsio_write +! pgrmmr: wu +! +! abstract: +! +! program history log: +! 2020-03-05 lei modified from gsi_fv3ncdf_write to gsi_fv3ncdf_write_v1 +! input argument list: +! varu,varv +! add_saved +! mype - mpi task id +! mype_io +! +! output argument list: +! +! attributes: +! language: f90 +! machine: +! +!$$$ end documentation block + + use mpimod, only: mpi_rtype,mpi_comm_world,ierror,npe,mype + use gridmod, only: lat2,lon2,nlon,nlat,lat1,lon1,nsig + use gridmod, only: ijn,displs_g,itotsub,iglobal + use mod_fv3_lola, only: fv3_ll_to_h + use mod_fv3_lola, only: fv3_h_to_ll + use general_commvars_mod, only: ltosi,ltosj + use netcdf, only: nf90_open,nf90_close + use netcdf, only: nf90_write,nf90_inq_varid + use netcdf, only: nf90_put_var,nf90_get_var + implicit none + + real(r_kind) ,intent(in ) :: var(lat2,lon2,nsig) + integer(i_kind),intent(in ) :: mype_io + logical ,intent(in ) :: add_saved + character(*) ,intent(in ) :: varname,filename + + integer(i_kind) :: VarId,gfile_loc + integer(i_kind) :: ilev0 + integer(i_kind) i,j,mm1,k,kr,ns,n,m + real(r_kind),allocatable,dimension(:):: work + real(r_kind),allocatable,dimension(:,:,:):: work_sub,work_a + real(r_kind),allocatable,dimension(:,:,:):: work_b + real(r_kind),allocatable,dimension(:,:):: workb2,worka2 + + + mm1=mype+1 + + allocate( work(max(iglobal,itotsub)*nsig),work_sub(lat1,lon1,nsig)) +!!!!!!!! reverse z !!!!!!!!!!!!!! + do k=1,nsig + kr=nsig+1-k + do i=1,lon1 + do j=1,lat1 + work_sub(j,i,kr)=var(j+1,i+1,k) + end do + end do + enddo + call mpi_gatherv(work_sub,ijnz(mm1),mpi_rtype, & + work,ijnz,displsz_g,mpi_rtype,mype_io,mpi_comm_world,ierror) + + if(mype==mype_io) then + allocate( work_a(nlat,nlon,nsig)) + ns=0 + do m=1,npe + do k=1,nsig + do n=displs_g(m)+1,displs_g(m)+ijn(m) + ns=ns+1 + work_a(ltosi(n),ltosj(n),k)=work(ns) + end do + enddo + enddo + + allocate( work_b(nlon_regional,nlat_regional,nsig+1)) + + call check( nf90_open(trim(filename),nf90_write,gfile_loc) ) + call check( nf90_inq_varid(gfile_loc,trim(varname),VarId) ) + call check( nf90_get_var(gfile_loc,VarId,work_b) ) + ilev0=1 + + if(add_saved)then + allocate( workb2(nlon_regional,nlat_regional)) + allocate( worka2(nlat,nlon)) +! for being now only lev between (including ) 2 and nsig+1 of work_b (:,:,lev) +! are updated + do k=1,nsig + call fv3_h_to_ll(work_b(:,:,ilev0+k),worka2,nlon_regional,nlat_regional,nlon,nlat,grid_reverse_flag) +!!!!!!!! analysis_inc: work_a !!!!!!!!!!!!!!!! + work_a(:,:,k)=work_a(:,:,k)-worka2(:,:) + call fv3_ll_to_h(work_a(1,1,k),workb2,nlon,nlat,nlon_regional,nlat_regional,grid_reverse_flag) + work_b(:,:,ilev0+k)=work_b(:,:,ilev0+k)+workb2(:,:) + enddo + deallocate(worka2,workb2) + else + do k=1,nsig + call fv3_ll_to_h(work_a(1,1,k),work_b(1,1,ilev0+k),nlon,nlat,nlon_regional,nlat_regional,grid_reverse_flag) + enddo + endif + + print *,'write out ',trim(varname),' to ',trim(filename) + call check( nf90_put_var(gfile_loc,VarId,work_b) ) + call check( nf90_close(gfile_loc) ) + deallocate(work_b,work_a) + end if !mype_io + + deallocate(work,work_sub) + +end subroutine gsi_fv3ncdf_write_v1 + +subroutine reverse_grid_r(grid,nx,ny,nz) +! +! reverse the first two dimension of the array grid +! + use kinds, only: r_kind,i_kind + + implicit none + integer(i_kind), intent(in ) :: nx,ny,nz + real(r_kind), intent(inout ) :: grid(nx,ny,nz) + real(r_kind) :: tmp_grid(nx,ny) + integer(i_kind) :: i,j,k +! + do k=1,nz + tmp_grid(:,:)=grid(:,:,k) + do j=1,ny + do i=1,nx + grid(i,j,k)=tmp_grid(nx+1-i,ny+1-j) + enddo + enddo + enddo + +end subroutine reverse_grid_r + +subroutine reverse_grid_r_uv(grid,nx,ny,nz) +! +! reverse the first two dimension of the array grid +! + use kinds, only: r_kind,i_kind + + implicit none + integer(i_kind), intent(in ) :: nx,ny,nz + real(r_kind), intent(inout ) :: grid(nx,ny,nz) + real(r_kind) :: tmp_grid(nx,ny) + integer(i_kind) :: i,j,k +! + do k=1,nz + tmp_grid(:,:)=grid(:,:,k) + do j=1,ny + do i=1,nx + grid(i,j,k)=-tmp_grid(nx+1-i,ny+1-j) + enddo + enddo + enddo + +end subroutine reverse_grid_r_uv end module gsi_rfv3io_mod diff --git a/src/gsi/gsimod.F90 b/src/gsi/gsimod.F90 index d13c2e733c..e1cc923f18 100644 --- a/src/gsi/gsimod.F90 +++ b/src/gsi/gsimod.F90 @@ -18,7 +18,7 @@ module gsimod time_window,perturb_obs,perturb_fact,sfcmodel,destroy_obsmod_vars,dsis,& dtbduv_on,time_window_max,offtime_data,init_directories,oberror_tune,ext_sonde, & blacklst,init_obsmod_vars,lobsdiagsave,lobskeep,lobserver,hilbert_curve,& - lread_obs_save,lread_obs_skip,time_window_rad, & + lread_obs_save,lread_obs_skip,time_window_rad,tcp_posmatch,tcp_box, & neutral_stability_windfact_2dvar,use_similarity_2dvar use gsi_dbzOper, only: diag_radardbz @@ -27,7 +27,7 @@ module gsimod rmesh_vr,zmesh_dbz,zmesh_vr,if_vterminal, if_model_dbz,if_vrobs_raw,& minobrangedbz,maxobrangedbz,maxobrangevr,maxtiltvr,missing_to_nopcp,& ntilt_radarfiles,whichradar,& - minobrangevr,maxtiltdbz,mintiltvr,mintiltdbz + minobrangevr,maxtiltdbz,mintiltvr,mintiltdbz,l2rwthin,hurricane_radar use obsmod, only: lwrite_predterms, & lwrite_peakwt,use_limit,lrun_subdirs,l_foreaft_thin,lobsdiag_forenkf,& @@ -47,8 +47,8 @@ module gsimod q_doe_a_136,q_doe_a_137,q_doe_b_136,q_doe_b_137, & t_doe_a_136,t_doe_a_137,t_doe_b_136,t_doe_b_137, & - uv_doe_a_236,uv_doe_a_237,uv_doe_a_292,uv_doe_b_236,uv_doe_b_237,& - uv_doe_b_292 + uv_doe_a_236,uv_doe_a_237,uv_doe_a_213,uv_doe_b_236,uv_doe_b_237,& + uv_doe_b_213 use aircraftinfo, only: init_aircraft,hdist_aircraft,aircraft_t_bc_pof,aircraft_t_bc, & aircraft_t_bc_ext,biaspredt,upd_aircraft,cleanup_tail @@ -95,7 +95,7 @@ module gsimod factql,factqi,factqr,factqs,factqg, & factv,factl,factp,factg,factw10m,facthowv,factcldch,niter,niter_no_qc,biascor,& init_jfunc,qoption,cwoption,switch_on_derivatives,tendsflag,jiterstart,jiterend,R_option,& - bcoption,diurnalbc,print_diag_pcg,tsensible,lgschmidt,diag_precon,step_start,pseudo_q2,& + bcoption,diurnalbc,print_diag_pcg,tsensible,diag_precon,step_start,pseudo_q2,& clip_supersaturation,cnvw_option use state_vectors, only: init_anasv,final_anasv use control_vectors, only: init_anacv,final_anacv,nrf,nvars,nrf_3d,cvars3d,cvars2d,& @@ -122,7 +122,8 @@ module gsimod nlayers,use_gfs_ozone,check_gfs_ozone_date,regional_ozone,jcap,jcap_b,vlevs,& use_gfs_nemsio,sfcnst_comb,use_readin_anl_sfcmask,use_sp_eqspace,final_grid_vars,& jcap_gfs,nlat_gfs,nlon_gfs,jcap_cut,wrf_mass_hybridcord,use_gfs_ncio,write_fv3_incr,& - use_fv3_aero + use_fv3_aero,grid_type_fv3_regional + use gridmod,only: l_reg_update_hydro_delz use guess_grids, only: ifact10,sfcmod_gfs,sfcmod_mm5,use_compress,nsig_ext,gpstop use gsi_io, only: init_io,lendian_in,verbose,print_obs_para use regional_io_mod, only: regional_io_class @@ -131,7 +132,7 @@ module gsimod use fgrid2agrid_mod, only: nord_f2a,init_fgrid2agrid,final_fgrid2agrid,set_fgrid2agrid use smooth_polcarf, only: norsp,init_smooth_polcas use read_l2bufr_mod, only: minnum,del_azimuth,del_elev,del_range,del_time,& - range_max,elev_angle_max,initialize_superob_radar,l2superob_only + range_max,elev_angle_max,initialize_superob_radar,l2superob_only,radar_sites,radar_box,radar_rmesh,radar_zmesh use m_berror_stats,only : berror_stats ! filename if other than "berror_stats" use lag_fields,only : infile_lag,lag_nmax_bal,& &lag_vorcore_stderr_a,lag_vorcore_stderr_b,lag_modini @@ -439,6 +440,8 @@ module gsimod ! model (e.g., HWRF) aircraft recon dynamic ! observation error (DOE) specification to ! GSI namelist level (beneath obsmod.F90). +! 09-15-2020 Wu Add option tcp_posmatch to mitigate possibility of erroneous TC initialization +! 2021-01-05 x.zhang/lei - add code for updating delz analysis in regional da ! !EOP !------------------------------------------------------------------------- @@ -532,6 +535,10 @@ module gsimod ! analysis fails if obs file ref time is different from analysis time. ! ! perturb_obs - logical flag to perutrb observation (true=on) +! tcp_posmatch - integer =1 to move TC to guess position, +! =2 set pges to the minimum Psfc +! tcp_box - integer to define the search box size in gridpoints, default =5 +! used with option tcp_posmatch ! oberror_tune - logical flag to tune oberror table (true=on) ! perturb_fact - magnitude factor for observation perturbation ! crtm_coeffs_path - path of directory w/ CRTM coeffs files @@ -539,8 +546,6 @@ module gsimod ! preserve_restart_date - if true, then do not update regional restart file date. ! tsensible - option to use sensible temperature as the analysis variable. works ! only for twodvar_regional=.true. -! lgschmidt - option for re-biorthogonalization of the {gradx} and {grady} sets -! from pcgsoi when twodvar_regional=.true. ! hilbert_curve - option for hilbert-curve based cross-validation. works only ! with twodvar_regional=.true. ! neutral_stability_windfact_2dvar - option to use simple, similarity @@ -661,7 +666,7 @@ module gsimod oneobtest,sfcmodel,dtbduv_on,ifact10,l_foto,offtime_data,& use_pbl,use_compress,nsig_ext,gpstop,& perturb_obs,perturb_fact,oberror_tune,preserve_restart_date, & - crtm_coeffs_path,berror_stats, & + crtm_coeffs_path,berror_stats,tcp_posmatch,tcp_box, & newpc4pred,adp_anglebc,angord,passive_bc,use_edges,emiss_bc,upd_pred,reset_bad_radbc,& ssmis_method, ssmis_precond, gmi_method, amsr2_method, bias_zero_start, & ec_amv_qc, lobsdiagsave, lobsdiag_forenkf, & @@ -672,7 +677,7 @@ module gsimod nwrvecs,iorthomax,ladtest,ladtest_obs, lgrtest,lobskeep,lsensrecompute,jsiga,ltcost, & lobsensfc,lobsensjb,lobsensincr,lobsensadj,lobsensmin,iobsconv, & idmodel,iwrtinc,lwrite4danl,nhr_anal,jiterstart,jiterend,lobserver,lanczosave,llancdone, & - lferrscale,print_diag_pcg,tsensible,lgschmidt,lread_obs_save,lread_obs_skip, & + lferrscale,print_diag_pcg,tsensible,lread_obs_save,lread_obs_skip, & use_gfs_ozone,check_gfs_ozone_date,regional_ozone,lwrite_predterms,& lwrite_peakwt,use_gfs_nemsio,use_gfs_ncio,sfcnst_comb,liauon,use_prepb_satwnd,l4densvar,ens_nstarthr,& use_gfs_stratosphere,pblend0,pblend1,step_start,diag_precon,lrun_subdirs,& @@ -686,7 +691,8 @@ module gsimod minobrangevr, maxtiltdbz, mintiltvr,mintiltdbz,if_vterminal,if_vrobs_raw,& if_model_dbz,imp_physics,lupp,netcdf_diag,binary_diag,l_wcp_cwm,aircraft_recon,diag_version,& write_fv3_incr,incvars_to_zero,incvars_zero_strat,incvars_efold,diag_version,& - cao_check,lcalc_gfdl_cfrac,tau_fcst,efsoi_order,lupdqc,lqcoef,cnvw_option + cao_check,lcalc_gfdl_cfrac,tau_fcst,efsoi_order,lupdqc,lqcoef,cnvw_option,l2rwthin,hurricane_radar,& + l_reg_update_hydro_delz ! GRIDOPTS (grid setup variables,including regional specific variables): ! jcap - spectral resolution @@ -712,6 +718,7 @@ module gsimod ! grid_ratio_nmmb - ratio of analysis grid to nmmb model grid in nmmb model grid units. ! grid_ratio_fv3_regional - ratio of analysis grid to fv3 grid in fv3 grid units. ! grid_ratio_wrfmass - ratio of analysis grid to wrf mass grid in wrf grid units. +! grid_type_fv3_regional - type of fv3 model grid (grid orientation). ! twodvar_regional - logical for regional 2d-var analysis ! filled_grid - logical to fill in puts on WRF-NMM E-grid ! half_grid - logical to use every other row of WRF-NMM E-Grid @@ -730,7 +737,7 @@ module gsimod diagnostic_reg,update_regsfc,netcdf,regional,wrf_nmm_regional,nems_nmmb_regional,fv3_regional,& wrf_mass_regional,twodvar_regional,filled_grid,half_grid,nvege_type,nlayers,cmaq_regional,& nmmb_reference_grid,grid_ratio_nmmb,grid_ratio_fv3_regional,grid_ratio_wrfmass,jcap_gfs,jcap_cut,& - wrf_mass_hybridcord + wrf_mass_hybridcord,grid_type_fv3_regional ! BKGERR (background error related variables): ! vs - scale factor for vertical correlation lengths for background error @@ -908,7 +915,7 @@ module gsimod ! 1/237: Dropsonde observations. -! 292: SFMR observations. +! 213: SFMR observations. ! The following correspond to the specific humidity (q) observations: @@ -928,12 +935,12 @@ module gsimod ! 'b' coefficients for temperature ! observations. -! uv_doe_a_236, uv_doe_a_237, uv_doe_a_292 - wind linear +! uv_doe_a_236, uv_doe_a_237, uv_doe_a_213 - wind linear ! regression derived ! 'a' coefficients for ! wind observations. -! uv_doe_b_236, uv_doe_b_237, uv_doe_b_292 - wind linear +! uv_doe_b_236, uv_doe_b_237, uv_doe_b_213 - wind linear ! regression derived ! 'b' coefficients for ! wind observations. @@ -947,7 +954,7 @@ module gsimod pvis,pcldch,scale_cv,estvisoe,estcldchoe,vis_thres,cldch_thres,cld_det_dec2bin, & q_doe_a_136,q_doe_a_137,q_doe_b_136,q_doe_b_137, & t_doe_a_136,t_doe_a_137,t_doe_b_136,t_doe_b_137, & - uv_doe_a_236,uv_doe_a_237,uv_doe_a_292,uv_doe_b_236,uv_doe_b_237,uv_doe_b_292 + uv_doe_a_236,uv_doe_a_237,uv_doe_a_213,uv_doe_b_236,uv_doe_b_237,uv_doe_b_213 ! OBS_INPUT (controls input data): ! dmesh(max(dthin))- thinning mesh for each group @@ -990,7 +997,7 @@ module gsimod ! files are very large and hard to work with) namelist/superob_radar/del_azimuth,del_elev,del_range,del_time,& - elev_angle_max,minnum,range_max,l2superob_only + elev_angle_max,minnum,range_max,l2superob_only,radar_sites,radar_box,radar_rmesh,radar_zmesh ! LAG_DATA (lagrangian data assimilation related variables): ! lag_accur - Accuracy used to decide whether or not a balloon is on the grid @@ -1431,6 +1438,7 @@ subroutine gsimain_initialize if(mype == 0) write(6,*) ' ltlint = true, so vqc and njqc must be false' end if end if + if (fv3sar_bg_opt /= 0) l_reg_update_hydro_delz=.false. if (anisotropic) then call init_fgrid2agrid(pf2aP1) call init_fgrid2agrid(pf2aP2) @@ -1444,12 +1452,6 @@ subroutine gsimain_initialize call die(myname_,'Options l4dvar and reduce_diag not allowed together',99) end if -! Diagonal preconditioning is necessary for new bias correction - if(newpc4pred .and. .not. diag_precon)then - diag_precon=.true. - step_start=8.e-4_r_kind - end if - if( (.not.l4dvar) .and. (.not.l4densvar) ) ljcdfi=.false. if (l4dvar.and.lsensrecompute) then diff --git a/src/gsi/gsisub.F90 b/src/gsi/gsisub.F90 index f66a261f0e..6aef101f55 100644 --- a/src/gsi/gsisub.F90 +++ b/src/gsi/gsisub.F90 @@ -75,7 +75,7 @@ subroutine gsisub(init_pass,last_pass) ! !$$$ use kinds, only: i_kind - use obsmod, only: iadate,lobserver + use obsmod, only: iadate,lobserver,l2rwthin use observermod, only: observer_init,observer_run,observer_finalize use gridmod, only: twodvar_regional,create_grid_vars,destroy_grid_vars,fv3_regional use gridmod, only: wrf_mass_regional,wrf_nmm_regional,nems_nmmb_regional,cmaq_regional @@ -145,9 +145,8 @@ subroutine gsisub(init_pass,last_pass) ! Process any level 2 bufr format land doppler radar winds and create radar wind superob file if(wrf_nmm_regional.or.wrf_mass_regional.or.nems_nmmb_regional .or. cmaq_regional & .or. fv3_regional) then - if(.not. oneobtest) call radar_bufr_read_all(npe,mype) + if(.not. oneobtest .and. (.not. l2rwthin)) call radar_bufr_read_all(npe,mype) end if -!at some point cmaq will become also an online met/chem model (?) ! Read info files for assimilation of various obs if (init_pass) then diff --git a/src/gsi/guess_grids.F90 b/src/gsi/guess_grids.F90 index 9eee5253fa..2d3d55637f 100644 --- a/src/gsi/guess_grids.F90 +++ b/src/gsi/guess_grids.F90 @@ -141,6 +141,7 @@ module guess_grids public :: sno2,ifilesfc,ifilenst,sfc_rough,fact10,sno,isli,soil_temp,soil_moi,coast_prox public :: nfldsfc,nfldnst,hrdifsig,ges_tsen,sfcmod_mm5,sfcmod_gfs,ifact10,hrdifsfc,hrdifnst public :: geop_hgti,ges_lnprsi,ges_lnprsl,geop_hgtl,pbl_height,ges_geopi + public :: geom_hgti,geom_hgti_bg public :: wgt_lcbas public :: ges_qsat public :: use_compress,nsig_ext,gpstop @@ -249,6 +250,10 @@ module guess_grids real(r_kind),allocatable,dimension(:,:,:,:):: geop_hgtl ! guess geopotential height at mid-layers real(r_kind),allocatable,dimension(:,:,:,:):: geop_hgti ! guess geopotential height at level interfaces + + real(r_kind),allocatable,dimension(:,:,:,:):: geom_hgti ! guess geometricheight at level interfaces + real(r_kind),allocatable,dimension(:,:,:,:):: geom_hgti_bg ! guess geometricheight at level interface for the background + real(r_kind),allocatable,dimension(:,:,:,:):: ges_geopi ! input guess geopotential height at level interfaces real(r_kind),allocatable,dimension(:,:,:):: pbl_height ! GSD PBL height in hPa @@ -415,6 +420,7 @@ subroutine create_ges_grids(switch_on_derivatives,tendsflag) use wrf_vars_mod, only : w_exist use constants,only: zero,one use gridmod, only: lat2,lon2,nsig + use gridmod,only: l_reg_update_hydro_delz implicit none ! !INPUT PARAMETERS: @@ -445,6 +451,7 @@ subroutine create_ges_grids(switch_on_derivatives,tendsflag) ! 2014-06-09 carley/zhu - add wgt_lcbas ! 2019-03-21 Wei/Martin - add capability to read external aerosol file ! 2019-09-10 martin - added new fields to save guess tsen/geop_hgt for writing increment +! 2021-01-05 x.zhang/lei - add code for updating delz analysis in regional da ! ! !REMARKS: ! language: f90 @@ -488,6 +495,11 @@ subroutine create_ges_grids(switch_on_derivatives,tendsflag) tropprs(lat2,lon2),fact_tv(lat2,lon2,nsig),& pbl_height(lat2,lon2,nfldsig),wgt_lcbas(lat2,lon2), & ges_qsat(lat2,lon2,nsig,nfldsig),stat=istatus) + + if(l_reg_update_hydro_delz) then + allocate( geom_hgti(lat2,lon2,nsig+1,nfldsig)) + allocate( geom_hgti_bg(lat2,lon2,nsig+1,nfldsig)) + endif if(w_exist)then allocate(ges_w_btlev(lat2,lon2,2,nfldsig),stat=istatus) @@ -803,6 +815,7 @@ subroutine destroy_ges_grids ! !USES: use wrf_vars_mod, only : w_exist + use gridmod,only: l_reg_update_hydro_delz implicit none @@ -823,6 +836,7 @@ subroutine destroy_ges_grids ! 2007-03-15 todling - merged in da Silva/Cruz ESMF changes ! 2012-05-14 todling - revist cw check to check also on some hyrometeors ! 2019-09-10 martin - added new fields to save guess tsen/geop_hgt for writing increment +! 2021-01-05 x.zhang/lei - add code for updating delz analysis in regional da ! ! !REMARKS: ! language: f90 @@ -843,6 +857,7 @@ subroutine destroy_ges_grids ges_tsen,ges_teta,geop_hgtl,geop_hgti,ges_geopi,ges_prslavg,ges_rho,& ges_tsen1,ges_q1,& tropprs,fact_tv,pbl_height,wgt_lcbas,ges_qsat,stat=istatus) + if(l_reg_update_hydro_delz) deallocate( geom_hgti,geom_hgti_bg) if(w_exist) deallocate(ges_w_btlev,stat=istatus) if (istatus/=0) & write(6,*)'DESTROY_GES_GRIDS(ges_prsi,..): deallocate error, istatus=',& @@ -1375,8 +1390,14 @@ subroutine load_geop_hgt use constants, only: cpf_a0, cpf_a1, cpf_a2, cpf_b0, cpf_b1, cpf_c0, cpf_c1, cpf_d, cpf_e use constants, only: psv_a, psv_b, psv_c, psv_d use constants, only: ef_alpha, ef_beta, ef_gamma + use constants, only: one,two,grav_equator,flattening,semi_major_axis,grav_ratio,somigliana,eccentricity use gridmod, only: lat2, lon2, nsig, twodvar_regional + use gridmod, only: region_lat,region_lon + use gridmod,only: istart,jstart + use gridmod,only: l_reg_update_hydro_delz,nlat,nlon + use mpimod, only: mype + implicit none ! !INPUT PARAMETERS: @@ -1395,6 +1416,7 @@ subroutine load_geop_hgt ! Cucurull's GPS work) ! 2005-05-24 pondeca - add regional surface analysis option ! 2010-08-27 cucurull - add option to compute and use compressibility factors in geopot heights +! 2021-01-05 x.zhang/lei - add code for updating delz analysis in regional da ! ! !REMARKS: ! language: f90 @@ -1416,6 +1438,11 @@ subroutine load_geop_hgt real(r_kind),dimension(:,:,:),pointer::ges_tv=>NULL() real(r_kind),dimension(:,:,:),pointer::ges_q=>NULL() real(r_kind),dimension(:,: ),pointer::ges_z=>NULL() + + real(r_kind) slat,slon + real(r_kind) sin2,termg,termr,termrg + integer (i_kind) iglob,jglob,mm1 + if (twodvar_regional) return @@ -1610,8 +1637,41 @@ subroutine load_geop_hgt end do endif + if (l_reg_update_hydro_delz ) then +! Convert geopotential height at layer midpoints to geometric height using +! equations (17, 20, 23) in MJ Mahoney's note "A discussion of various +! measures of altitude" (2001). Available on the web at +! http://mtp.jpl.nasa.gov/notes/altitude/altitude.html +! +! termg = equation 17 +! termr = equation 21 +! termrg = first term in the denominator of equation 23 +! zges = equation 23 + mm1=mype+1 + do jj=1,nfldsig + do j=1,lon2 + jglob=max(1,min(j+jstart(mm1)-2,nlon)) + do i=1,lat2 + iglob=max(1,min(i+istart(mm1)-2,nlat)) + slat=region_lat(iglob,jglob) + slon=region_lon(iglob,jglob) + + sin2 = sin(slat)*sin(slat) + termg = grav_equator * & + ((one+somigliana*sin2)/sqrt(one-eccentricity*eccentricity*sin2)) + termr = semi_major_axis /(one + flattening + grav_ratio - & + two*flattening*sin2) + termrg = (termg/grav)*termr + do k=1,nsig+1 + geom_hgti(i,j,k,jj) = (termr*geop_hgti(i,j,k,jj))/(termrg-geop_hgti(i,j,k,jj)) ! eq (23) + end do + enddo + enddo + enddo !jj - return + endif + + return end subroutine load_geop_hgt !------------------------------------------------------------------------- diff --git a/src/gsi/hdraobmod.f90 b/src/gsi/hdraobmod.f90 new file mode 100644 index 0000000000..fe96c63ab2 --- /dev/null +++ b/src/gsi/hdraobmod.f90 @@ -0,0 +1,1328 @@ +module hdraobmod +!$$$ module documentation block +! . . . . +! module: obsmod +! prgmmr: derber org: np23 date: 2003-09-25 +! +! abstract: This module contains variables and arrays pertinent for +! observational data. +! +! program history log: +! 2021-03-18 derber +! +! def nhdps - number of high resolution surface pressure stations +! def nhduv - number of high resolution uv stations +! def nhdt - number of high resolution temperature stations +! def nhdq - number of high resolution moisture stations +! def hdpslist - list of high resolution surface pressure stations +! def hduvlist - list of high resolution uv stations +! def hdtlist - list of high resolution temperature stations +! def hdqlist - list of high resolution moisture stations +! +! attributes: +! langauge: f90 +! machine: +! +!$$$ end documentation block + + use kinds, only: i_kind + implicit none + +! set default as private + private +! set subroutines and functions to public + public :: read_hdraob + public :: nhdt,nhdq,nhduv,nhdps + public :: nodet,nodeq,nodeps,nodeuv + public :: hdtlist,hdqlist,hduvlist,hdpslist + + integer(i_kind) :: nhdt,nhdq,nhduv,nhdps + integer(i_kind) :: nodet,nodeq,nodeps,nodeuv + integer(i_kind),allocatable,dimension(:) :: hdpslist,hduvlist,hdtlist,hdqlist + +contains + subroutine read_hdraob(nread,ndata,nodata,infile,obstype,lunout,twindin,sis,& + prsl_full,hgtl_full,nobs,nrec_start) +!$$$ subprogram documentation block +! . . . . +! subprogram: read_hdraob read obs from hdraob file +! prgmmr: derber org: np22 date: 2020-02-12 +! +! abstract: This routine reads high resolution raob data found in the hdraob +! file. Specific observation types read by this routine +! include surface pressure, temperature, winds (components +! and speeds), and moisture. +! +! When running the gsi in regional mode, the code only +! retains those observations that fall within the regional +! domain +! +! program history log: +! 2020-02-24 derber + +! input argument list: +! infile - unit from which to read BUFR data +! obstype - observation type to process +! lunout - unit to which to write data for further processing +! twindin - input group time window (hours) +! prsl_full- 3d pressure on full domain grid +! hgtl_full- 3d height on full domain grid +! nrec_start - number of subsets without useful information + +! +! output argument list: +! nread - number of type "obstype" observations read +! nodata - number of individual "obstype" observations read +! ndata - number of type "obstype" observations retained for further processing +! sis - satellite/instrument/sensor indicator +! nobs - array of observations on each subdomain for each processor +! +! attributes: +! language: f90 +! machine: ibm RS/6000 SP +! +!$$$ + use kinds, only: r_single,r_kind,r_double,i_kind + use constants, only: zero,one_tenth,one,deg2rad,half,& + tiny_r_kind,huge_r_kind,& + r60inv,r10,r100,r2000,eps,omeps + use constants,only: grav + use gridmod, only: diagnostic_reg,regional,nlon,nlat,nsig,& + tll2xy,rotate_wind_ll2xy,rotate_wind_xy2ll,& + rlats,rlons,twodvar_regional,fv3_regional + use convinfo, only: nconvtype,ctwind, & + icuse,ictype,icsubtype,ioctype + + use obsmod, only: iadate,oberrflg,perturb_obs,perturb_fact,ran01dom +! use obsmod, only: blacklst,offtime_data + use obsmod, only: offtime_data + use converr,only: etabl + use converr_ps,only: etabl_ps,isuble_ps,maxsub_ps + use converr_q,only: etabl_q,isuble_q,maxsub_q + use converr_t,only: etabl_t,isuble_t,maxsub_t + use converr_uv,only: etabl_uv,isuble_uv,maxsub_uv + use convb_ps,only: btabl_ps + use convb_q,only: btabl_q + use convb_t,only: btabl_t + use convb_uv,only: btabl_uv + use gsi_4dvar, only: time_4dvar,winlen + use qcmod, only: errormod,errormod_hdraob,njqc + use mpimod, only: mype +! use blacklist, only : blacklist_read,blacklist_destroy + use ndfdgrids,only: adjust_error + use deter_sfc_mod, only: deter_sfc2 + use mpimod, only: npe + use gsi_io, only: verbose + + implicit none + +! Declare passed variables + character(len=*) ,intent(in ) :: infile,obstype + character(len=20) ,intent(in ) :: sis + integer(i_kind) ,intent(in ) :: lunout,nrec_start + integer(i_kind) ,intent(inout) :: nread,ndata,nodata + integer(i_kind),dimension(npe) ,intent(inout) :: nobs + real(r_kind) ,intent(in ) :: twindin + real(r_kind),dimension(nlat,nlon,nsig),intent(in ) :: prsl_full,hgtl_full + +! Declare local parameters + real(r_kind),parameter:: r1_2 = 1.2_r_kind + real(r_kind),parameter:: r50 = 50.0_r_kind + real(r_kind),parameter:: r90 = 90.0_r_kind + real(r_kind),parameter:: r360 = 360.0_r_kind + + integer(i_kind), parameter:: maxlevs=20000 + +! Declare local variables + logical tob,qob,uvob,psob + logical outside + logical,allocatable,dimension(:,:):: lmsg ! set true when convinfo entry id found in a message + + character(80) hdstr,hdstr2,hdstr3,levstr,hdtypestr + character(80) obstr + character(10) date + character(8) subset + character(8) c_station_id,id_station +! character(8) stnid + character(8) stntype + + integer(i_kind) ireadmg,ireadsb + integer(i_kind) lunin,i,maxobs,j,idomsfc,nmsgmax,mxtb + integer(i_kind) kk,klon1,klat1,klonp1,klatp1 + integer(i_kind) nc,nx,ntread,ncsave + integer(i_kind) ihh,idd,idate,iret,im,iy,k,levs + integer(i_kind) kx,nreal,nchanl,ilat,ilon + integer(i_kind) lim_qm + integer(i_kind) iout + integer(i_kind) irec + integer(i_kind) ntest,nvtest + integer(i_kind) kl,k1,k2,k1_ps,k1_q,k1_t,k1_uv,k2_q,k2_t,k2_uv,k2_ps + integer(i_kind) itypex,id + integer(i_kind) minobs,minan + integer(i_kind) ntb,ntmatch,ncx + integer(i_kind) nmsg ! message index + integer(i_kind) ncount_ps,ncount_q,ncount_uv,ncount_t + integer(i_kind),dimension(5):: idate5 + integer(i_kind),dimension(nconvtype)::ntxall + integer(i_kind),dimension(nconvtype+1)::ntx + integer(i_kind),allocatable,dimension(:,:):: tab + integer(i_kind) igroup,istation + integer(i_kind) ierr_ps,ierr_q,ierr_t,ierr_uv ! the position of error table collum + integer(i_kind),dimension(maxlevs):: pqm,qqm,tqm,wqm + integer(i_kind) nstations + integer(i_kind),allocatable,dimension(:):: list_stations + real(r_kind) time,timeobs,toff,t4dv,zeps + real(r_kind) qtflg,ediff,usage,ediff_ps,ediff_q,ediff_t,ediff_uv + real(r_kind) u0,v0,uob,vob,dx,dy,dx1,dy1,w00,w10,w01,w11 + real(r_kind) qoe,qobcon,dlnpob,ppb,poe,obheight + real(r_kind) toe,woe,errout,oelev,dlat,dlon,dlat_earth,dlon_earth + real(r_kind) dlat_earth_deg,dlon_earth_deg + real(r_kind) stnelev + real(r_kind) disterr,disterrmax + real(r_kind) vdisterrmax,u00,v00 + real(r_kind) rminobs,rminan,es,dummy + real(r_kind) del,terrmin,werrmin,perrmin,qerrmin,del_ps,del_q,del_t,del_uv + real(r_kind) tsavg,ff10,sfcr,zz,deltat + real(r_kind) time_correction,fact + real(r_kind),dimension(nsig):: presl,hgtl + real(r_kind),dimension(nsig-1):: dpres + real(r_kind),dimension(maxlevs)::plevs + real(r_kind),allocatable,dimension(:,:):: cdata_all,cdata_out + real(r_kind) :: missing + + real(r_double) rstation_id,r_station + real(r_double),dimension(2):: hdr + real(r_double),dimension(8):: hdr2 + real(r_double),dimension(1):: hdr3 + real(r_double),dimension(1):: hdrtype + real(r_double),dimension(2,maxlevs):: levdat + real(r_double),dimension(8,maxlevs):: var_jb,obserr + real(r_double),dimension(8,maxlevs):: obsdat + + logical newstation,toocold + + +! equivalence to handle character names + equivalence(rstation_id,c_station_id) + equivalence(r_station,id_station) + +! data statements + data hdstr /'WMOB WMOS'/ + data hdstr2 /'YEAR MNTH DAYS HOUR MINU SECO CLATH CLONH' / + data hdtypestr /'BUHD' / + data hdstr3 /'HEIT'/ + data obstr /'LTDS LATDH LONDH GP10 WSPD WDIR TMDB TMDP'/ + data levstr /'PRLC GP07'/ + data lunin / 13 / + data missing/1.e8_r_double/ + + logical print_verbose,descend + + print_verbose=.false. + if(verbose) print_verbose=.true. + +! Initialize variables + + tob = obstype == 't' + uvob = obstype == 'uv' + qob = obstype == 'q' + psob = obstype == 'ps' + + nstations=0 + nreal=0 + if(tob)then + nreal=25 + else if(uvob) then + nreal=26 + else if(psob) then + nreal=20 + else if(qob) then + nreal=26 + else + write(6,*) ' illegal obs type in READ_HDRAOB ',obstype + call stop2(94) + end if + + if(perturb_obs .and. (tob .or. psob .or. qob))nreal=nreal+1 + if(perturb_obs .and. uvob )nreal=nreal+2 + + +! if (blacklst) call blacklist_read(obstype) + + lim_qm=3 + terrmin=half + werrmin=one + perrmin=0.3_r_kind + qerrmin=0.05_r_kind +!------------------------------------------------------------------------ + ntread=1 + ntmatch=0 + ntx(ntread)=0 + ntxall=0 + var_jb=zero + + + do nc=1,nconvtype + if(trim(ioctype(nc)) == trim(obstype))then + ntmatch=ntmatch+1 + ntxall(ntmatch)=nc + end if + end do + + irec = 0 +!! get message and subset counts + + call getcount_bufr(infile,nmsgmax,mxtb) + allocate(lmsg(nmsgmax,ntread),tab(mxtb,3)) + + lmsg = .false. + maxobs=0 + tab=0 + nmsg=0 + ntb = 0 + ncount_ps=0;ncount_q=0;ncount_t=0;ncount_uv=0 + +! Open, then read date from bufr data + open(lunin,file=trim(infile),form='unformatted') + call openbf(lunin,'IN',lunin) + call datelen(10) + +! This is the message creating error message + msg_report: do while (ireadmg(lunin,subset,idate) == 0) + irec = irec + 1 + if(irec < nrec_start) cycle msg_report + +! Time offset + if(nmsg == 0) call time_4dvar(idate,toff) + nmsg=nmsg+1 + if (nmsg>nmsgmax) then + write(6,*)'READ_HDRAOB: messages exceed maximum ',nmsgmax + call stop2(50) + endif + loop_report: do while (ireadsb(lunin) == 0) + ntb = ntb+1 + if (ntb>mxtb) then + write(6,*)'READ_HDRAOB: reports exceed maximum ',mxtb + call stop2(50) + endif + + +! igroup=hdr(1) +! istation=hdr(2) +! write(6,*) igroup,istation +! call ufbint(lunin,obsdat,13,maxlevs,levs,obstr) +! Check for blacklisting of station ID +! if (blacklst .and. ibcnt > 0) then +! stnid = transfer(hdr(4),stnid) +! do i = 1,ibcnt +! if( kx == blkkx(i) .and. stnid == blkstns(i) ) then +! write(6,*)'READ_HDRAOB: blacklist station ',stnid, & +! 'for obstype ',trim(obstype),' and kx=',kx +! cycle loop_report +! endif +! enddo +! endif + + call ufbint(lunin,levdat,2,maxlevs,levs,levstr) + if(levs > maxlevs)write(6,*) ' not enough levels increase maxlevs ',levs,maxlevs + call ufbint(lunin,obsdat,8,maxlevs,levs,obstr) + deltat=zero + descend=.false. + if(obsdat(1,1) < missing .and. obsdat(1,levs) < missing)then + deltat=obsdat(1,levs)-obsdat(1,1) + if(deltat < -1._r_kind) descend=.true. + end if +! Extract type information + if(psob .or. tob .or. qob)then + if(.not. descend) then + kx=119 + else + kx=118 + if(psob) cycle loop_report + end if + else if(uvob)then + if(.not. descend) then + if(levdat(1,2) > missing)then + kx=218 + else + kx=219 + end if + else + if(levdat(1,2) > missing)then + cycle loop_report ! should not have descent obs with no pressure + else + kx=217 + end if + end if + end if +! Match ob to proper convinfo type + ncsave=0 + matchloop:do ncx=1,ntmatch + nc=ntxall(ncx) + if (kx == ictype(nc))then + + ncsave=nc + exit matchloop + end if + + end do matchloop + +! write(6,*) ' levs =',levs + maxobs=maxobs+max(1,levs) + nx=ictype(ncsave) + tab(ntb,1)=ncsave + tab(ntb,2)=nx + tab(ntb,3)=levs + + end do loop_report + enddo msg_report + if (nmsg==0) then + call closbf(lunin) + close(lunin) + if(print_verbose)write(6,*)'READ_HDRAOB: no messages/reports ' + return + end if + write(6,*)'READ_HDRAOB: messages/reports = ',nmsg,'/',ntb,' ntread = ',ntread + + + if(qob .and. print_verbose) write(6,*)'READ_HDRAOB: time offset is ',toff,' hours.' +!------------------------------------------------------------------------ + + + allocate(list_stations(ntb)) +! loop over convinfo file entries; operate on matches + + allocate(cdata_all(nreal,maxobs)) + cdata_all=zero + zeps=1.0e-8_r_kind + nread=0 + ntest=0 + nvtest=0 + nchanl=0 + ilon=2 + ilat=3 + loop_convinfo: do nx=1,ntread + + call closbf(lunin) + open(lunin,file=infile,form='unformatted') + call openbf(lunin,'IN',lunin) + call datelen(10) + +! Big loop over hdraob file + + ntb = 0 + nmsg = 0 + disterrmax=-9999.0_r_kind + irec = 0 + loop_msg: do while (ireadmg(lunin,subset,idate)== 0) + irec = irec + 1 + if(irec < nrec_start) cycle loop_msg + + loop_readsb: do while(ireadsb(lunin) == 0) +! use msg lookup table to decide which messages to skip +! use report id lookup table to only process matching reports + ntb = ntb+1 + nc=tab(ntb,1) + kx = ictype(nc) + if(nc <= 0 .or. tab(ntb,2) /= kx) then + if(nc /= 0)write(6,*) obstype,nc,(tab(ntb,i),i=1,3),ntb + cycle loop_readsb + end if + +! Extract type, date, and location information + call ufbint(lunin,hdr,2,1,iret,hdstr) + igroup=hdr(1) + istation=hdr(2) + id=1000*igroup+istation +! write(6,*) id,igroup,istation,hdr(1),hdr(2) + if(igroup < 0 .or. istation < 0 .or. id >= 100000 .or. id <= 0)then + if(print_verbose)write(6,*) ' hdr ',hdr + cycle loop_readsb + end if + write(c_station_id,'(i5,3x)') id + call ufbint(lunin,levdat,2,maxlevs,levs,levstr) + if(levdat(1,2) > 1.e8 .and. (obstype == 'q' .or. obstype == 't'))cycle loop_readsb + call ufbint(lunin,obsdat,8,maxlevs,levs,obstr) + + if(psob)levs=1 + + if(qob)then + call ufbint(lunin,hdrtype,1,1,iret,hdtypestr) + r_station=hdrtype(1) + read(id_station,*) stntype + if(index(stntype,'IUD') /=0 .or. index( stntype,'IUX') /=0)then + if(kx == 119 .or. kx == 219 .or. kx == 218)then + write(6,*) ' inconsistent descent ',kx,id,levs,stntype + end if + else + if(kx == 118 .or. kx == 217)then + write(6,*) ' inconsistent ascent ',kx,id,levs,stntype + end if + end if + end if +! Combine height obs into single array and divide by g + do k=1,levs + levdat(1,k)=.01_r_double*levdat(1,k) + if(levdat(2,k) > missing)then + if(obsdat(4,k) < missing)levdat(2,k)=obsdat(4,k)/grav + else + levdat(2,k)=levdat(2,k)/grav + end if + end do + +!------------------------------------------------------------------------ + + call ufbint(lunin,hdr2,8,1,iret,hdstr2) + dlat_earth_deg=hdr2(7) + dlon_earth_deg=hdr2(8) + if(abs(dlat_earth_deg)>r90 ) then + if(print_verbose)write(6,*) ' invalid lat ',id,dlat_earth_deg + cycle loop_readsb + end if + if(dlon_earth_deg >= r360)dlon_earth_deg=dlon_earth_deg-r360 + if(dlon_earth_deg < zero)dlon_earth_deg=dlon_earth_deg+r360 + dlon_earth=dlon_earth_deg*deg2rad + dlat_earth=dlat_earth_deg*deg2rad + if(regional)then + call tll2xy(dlon_earth,dlat_earth,dlon,dlat,outside) ! convert to rotated coordinate + if(outside) cycle loop_readsb ! check to see if outside regional domain + else + dlat = dlat_earth + dlon = dlon_earth + call grdcrd1(dlat,rlats,nlat,1) + call grdcrd1(dlon,rlons,nlon,1) + endif +! Interpolate guess profile to observation location + klon1= int(dlon); klat1= int(dlat) + dx = dlon-klon1; dy = dlat-klat1 + dx1 = one-dx; dy1 = one-dy + w00=dx1*dy1; w10=dx1*dy; w01=dx*dy1; w11=dx*dy + + klat1=min(max(1,klat1),nlat); klon1=min(max(0,klon1),nlon) + if (klon1==0) klon1=nlon + klatp1=min(nlat,klat1+1); klonp1=klon1+1 + if (klonp1==nlon+1) klonp1=1 + do kk=1,nsig + presl(kk)=w00*prsl_full(klat1 ,klon1 ,kk) + & + w10*prsl_full(klatp1,klon1 ,kk) + & + w01*prsl_full(klat1 ,klonp1,kk) + & + w11*prsl_full(klatp1,klonp1,kk) + end do + pqm=0 + tqm=0 + qqm=0 + wqm=0 + if(levdat(1,2) < missing)then + do k=1,levs + plevs(k)=0.1_r_kind*levdat(1,k) ! convert mb to cb + end do + else +! If pressure is missing get an approximate pressure from guess field. This +! pressure is used for estimating ob error only. +! Note that balloon drift is not included in this calculation. + do kk=1,nsig + hgtl(kk) =w00*hgtl_full(klat1 ,klon1 ,kk) + & + w10*hgtl_full(klatp1,klon1 ,kk) + & + w01*hgtl_full(klat1 ,klonp1,kk) + & + w11*hgtl_full(klatp1,klonp1,kk) + end do + do k=1,levs + obheight=levdat(2,k) + if(obheight < hgtl(1))then + plevs(k)=presl(1) + else if (obheight > hgtl(nsig))then +! Reject ob by making pressure zero + plevs(k) = zero + else + do kk=1,nsig-1 + if(hgtl(kk) <= obheight .and. hgtl(kk+1) > obheight)then + fact=(hgtl(kk+1)-obheight)/(hgtl(kk+1)-hgtl(kk)) + plevs(k)=exp(fact*log(presl(kk))+(one-fact)*log(presl(kk+1))) + wqm(k)=1 + end if + end do + end if + end do + if(uvob .and. kx /= 218 )write(6,*) ' inconsistent kx ',kx + end if +! Compute depth of guess pressure layersat observation location + if (.not.twodvar_regional .and. levs > 1) then + do kk=1,nsig-1 + dpres(kk)=presl(kk)-presl(kk+1) + end do + endif + idate5(1)=iadate(1) + idate5(2)=iadate(2) + idate5(3)=iadate(3) + idate5(4)=iadate(4) + idate5(5)=0 + call w3fs21(idate5,minan) ! analysis ref time in minutes relative to historic date + rminan=minan + + if(offtime_data) then + +! in time correction for observations to account for analysis +! time being different from obs file time. + write(date,'( i10)') idate + read (date,'(i4,3i2)') iy,im,idd,ihh + idate5(1)=iy + idate5(2)=im + idate5(3)=idd + idate5(4)=ihh + idate5(5)=0 + call w3fs21(idate5,minobs) ! obs ref time in minutes relative to historic date +! Add obs reference time, then subtract analysis time to get obs +! time relative to analysis + + time_correction=float(minobs-minan)*r60inv + + else + time_correction=zero + end if + + +! get observation launch time relative to analysis time + idate5(1)=hdr2(1) + idate5(2)=hdr2(2) + idate5(3)=hdr2(3) + idate5(4)=hdr2(4) + idate5(5)=hdr2(5) + call w3fs21(idate5,minobs) ! obs launch time in minutes relative to historic date + rminobs=minobs + if(hdr2(6) < missing)rminobs=rminobs+hdr2(6)*r60inv + + timeobs=(rminobs-rminan)*r60inv + + t4dv=timeobs + toff + if (t4dv -zeps) t4dv=zero + if (t4dv>winlen.and.t4dv 1500._r_kind)then + if(print_verbose)write(6,*) ' invalid pressure ',id,k,levs,levdat(1,k) + cycle LOOP_K_LEVS + end if + end if + if(obsdat(1,k) < zero .or. obsdat(1,k) > 900000._r_kind) then + if(print_verbose)write(6,*) ' invalid change in time ',id,obstype,k,obsdat(1,k) + if(tob) tqm(k)=2 + if(qob) qqm(k)=2 + if(psob) pqm(k)=2 + if(uvob) wqm(k)=2 + obsdat(1,k) = zero + end if + if(abs(obsdat(2,k)) < 10._r_kind .and. abs(obsdat(3,k)) < 10._r_kind) then + dlat_earth_deg=hdr2(7)+obsdat(2,k) + dlon_earth_deg=hdr2(8)+obsdat(3,k) + else + if(print_verbose)write(6,*) ' invalid change in lat/lon ',id,k,obstype,obsdat(2,k),obsdat(3,k) + if(tob) tqm(k)=2 + if(qob) qqm(k)=2 + if(psob) pqm(k)=2 + if(uvob) wqm(k)=2 + dlat_earth_deg=hdr2(7) + dlon_earth_deg=hdr2(8) + end if + if(dlon_earth_deg >= r360)dlon_earth_deg=dlon_earth_deg-r360 + if(dlon_earth_deg < zero)dlon_earth_deg=dlon_earth_deg+r360 + dlon_earth=dlon_earth_deg*deg2rad + dlat_earth=dlat_earth_deg*deg2rad + + if(regional)then + call tll2xy(dlon_earth,dlat_earth,dlon,dlat,outside) ! convert to rotated coordinate + if(outside) cycle loop_readsb ! check to see if outside regional domain + else + dlat = dlat_earth + dlon = dlon_earth + call grdcrd1(dlat,rlats,nlat,1) + call grdcrd1(dlon,rlons,nlon,1) + endif +! Interpolate guess pressure profile to observation location + klon1= int(dlon); klat1= int(dlat) + dx = dlon-klon1; dy = dlat-klat1 + dx1 = one-dx; dy1 = one-dy + w00=dx1*dy1; w10=dx1*dy; w01=dx*dy1; w11=dx*dy + + klat1=min(max(1,klat1),nlat); klon1=min(max(0,klon1),nlon) + if (klon1==0) klon1=nlon + klatp1=min(nlat,klat1+1); klonp1=klon1+1 + if (klonp1==nlon+1) klonp1=1 + + + +! Set usage variable + usage = zero + if(icuse(nc) <= 0)usage=100._r_kind + if(pqm(k) >=lim_qm )usage=102._r_kind + + + if(plevs(k) < 0.0001_r_kind) then + write(*,*) 'warning: obs pressure is too small:',kx,k,plevs(k),id + cycle + endif + dlnpob=log(plevs(k)) ! ln(pressure in cb) + + call deter_sfc2(dlat_earth,dlon_earth,t4dv,idomsfc,tsavg,ff10,sfcr,zz) + +! Extract pressure level and quality marks + +! Temperature + if(tob) then + if(obsdat(7,k) < 100._r_kind .or. obsdat(7,k) > 400._r_kind) then + if(print_verbose)write(6,*)id,'invalid temp',k,levs,obsdat(7,k),plevs(k) + tqm(k)=12 + usage=108._r_kind + cycle loop_k_levs + end if + time=t4dv+obsdat(1,k)*r60inv*r60inv-toff + if(abs(time) > twindin .or. abs(time) > ctwind(nc)) then + if(print_verbose)write(6,*)id,obstype,'outside window',k,time,twindin + tqm(k)=12 + usage=108._r_kind + cycle loop_k_levs + end if + + ndata=ndata+1 + nodata=nodata+1 + iout=ndata + if(ndata > maxobs) then + write(6,*)'READ_HDRAOB: ***WARNING*** ndata > maxobs for ',obstype + ndata = maxobs + end if + ppb=plevs(k)*10._r_kind + if(levs > 100 .or. plevs(1)-plevs(levs) < .01_r_kind)then + + call errormod_hdraob(pqm,tqm,levs,plevs,errout,k,presl,dpres,nsig,lim_qm) + + else + + call errormod(pqm,tqm,levs,plevs,errout,k,presl,dpres,nsig,lim_qm) + end if + toe=obserr(3,k)*errout + if(ppb < r100)toe=toe*r1_2 + cdata_all(1,iout)=toe ! temperature error + cdata_all(2,iout)=dlon ! grid relative longitude + cdata_all(3,iout)=dlat ! grid relative latitude + cdata_all(4,iout)=dlnpob ! ln(pressure in cb) + + cdata_all(5,iout)=obsdat(7,k) ! temperature ob. + cdata_all(6,iout)=rstation_id ! station id + cdata_all(7,iout)=t4dv+obsdat(1,k)*r60inv*r60inv ! time + cdata_all(8,iout)=nc ! type + qtflg=one + cdata_all(9,iout)=qtflg ! qtflg (virtual temperature flag) + cdata_all(10,iout)=tqm(k) ! quality mark + cdata_all(11,iout)=obserr(3,k) ! original obs error + cdata_all(12,iout)=usage ! usage parameter + cdata_all(13,iout)=idomsfc ! dominate surface type + cdata_all(14,iout)=tsavg ! skin temperature + cdata_all(15,iout)=ff10 ! 10 meter wind factor + cdata_all(16,iout)=sfcr ! surface roughness + cdata_all(17,iout)=dlon_earth_deg ! earth relative longitude (degrees) + cdata_all(18,iout)=dlat_earth_deg ! earth relative latitude (degrees) + cdata_all(19,iout)=stnelev ! station elevation (m) + cdata_all(20,iout)=levdat(2,k) ! observation height (m) + cdata_all(21,iout)=zz ! terrain height at ob location + cdata_all(22,iout)='88888888' ! provider name + cdata_all(23,iout)='HDRAOB' ! subprovider name + cdata_all(24,iout)=2 ! cat + cdata_all(25,iout)=var_jb(3,k) ! non linear qc for T + if(perturb_obs)cdata_all(nreal,iout)=ran01dom()*perturb_fact ! t perturbation + if (twodvar_regional) & + call adjust_error(cdata_all(17,iout),cdata_all(18,iout),cdata_all(11,iout),cdata_all(1,iout)) + if(kx == 119)then + if(usage < 100._r_kind)then + newstation=.true. + do i=1,nstations + if(list_stations(i) == id) then + newstation=.false. + exit + end if + end do + if(newstation)then + nstations=nstations+1 + list_stations(nstations)=id + end if + end if + end if + +! Winds + else if(uvob) then + if(obsdat(6,k) < zero .or. obsdat(6,k) > 360._r_kind) then + wqm(k)=12 + usage=108._r_kind + if(print_verbose)write(6,*)id,'invalid dir ', k,levs,obsdat(5,k),obsdat(6,k),plevs(k) + cycle loop_k_levs + end if + if(obsdat(5,k) < zero .or. obsdat(5,k) > 300._r_kind) then + wqm(k)=12 + usage=108._r_kind + if(print_verbose)write(6,*)id,'invalid spd ', k,levs,obsdat(5,k),obsdat(6,k),plevs(k) + cycle loop_k_levs + end if + time=t4dv+obsdat(1,k)*r60inv*r60inv-toff + if(abs(time) > twindin .or. abs(time) > ctwind(nc)) then + if(print_verbose)write(6,*)id,obstype,'outside window',k,time,twindin + tqm(k)=12 + usage=108._r_kind + cycle loop_k_levs + end if + ndata=ndata+1 + nodata=nodata+2 + iout=ndata + if(ndata > maxobs) then + write(6,*)'READ_HDRAOB: ***WARNING*** ndata > maxobs for ',obstype + ndata = maxobs + end if + if(levs > 100 .or. plevs(1)-plevs(levs) < .01_r_kind)then + call errormod_hdraob(pqm,qqm,levs,plevs,errout,k,presl,dpres,nsig,lim_qm) + else + + call errormod(pqm,wqm,levs,plevs,errout,k,presl,dpres,nsig,lim_qm) + end if + woe=obserr(5,k)*errout + if(obsdat(1,k) < r50)woe=woe*r1_2 + oelev=levdat(2,k) + +! Rotate winds to rotated coordinate + uob = -obsdat(5,k)*sin(obsdat(6,k)*deg2rad) ! u-wind component + vob = -obsdat(5,k)*cos(obsdat(6,k)*deg2rad) ! v-wind component + + + if(regional .and. .not. fv3_regional)then + u0=uob + v0=vob + call rotate_wind_ll2xy(u0,v0,uob,vob,dlon_earth,dlon,dlat) + if(diagnostic_reg) then + call rotate_wind_xy2ll(uob,vob,u00,v00,dlon_earth,dlon,dlat) + nvtest=nvtest+1 + disterr=sqrt((u0-u00)**2+(v0-v00)**2) + vdisterrmax=max(vdisterrmax,disterr) + end if + endif + + cdata_all(1,iout)=woe ! wind error + cdata_all(2,iout)=dlon ! grid relative longitude + cdata_all(3,iout)=dlat ! grid relative latitude + cdata_all(4,iout)=dlnpob ! ln(pressure in cb) + cdata_all(5,iout)=oelev ! height of observation + cdata_all(6,iout)=uob ! u obs + cdata_all(7,iout)=vob ! v obs + cdata_all(8,iout)=rstation_id ! station id + cdata_all(9,iout)=t4dv+obsdat(1,k)*r60inv*r60inv ! time + cdata_all(10,iout)=nc ! type + cdata_all(11,iout)=stnelev ! station elevation + cdata_all(12,iout)=wqm(k) ! quality mark + cdata_all(13,iout)=obserr(5,k) ! original obs error + cdata_all(14,iout)=usage ! usage parameter + cdata_all(15,iout)=idomsfc ! dominate surface type + cdata_all(16,iout)=tsavg ! skin temperature + cdata_all(17,iout)=ff10 ! 10 meter wind factor + cdata_all(18,iout)=sfcr ! surface roughness + cdata_all(19,iout)=dlon_earth_deg ! earth relative longitude (degrees) + cdata_all(20,iout)=dlat_earth_deg ! earth relative latitude (degrees) + cdata_all(21,iout)=zz ! terrain height at ob location + cdata_all(22,iout)='88888888' ! provider name + cdata_all(23,iout)='HDRAOB' ! subprovider name + cdata_all(24,iout)=2 ! cat + cdata_all(25,iout)=var_jb(5,k) ! non linear qc parameter + cdata_all(26,iout)=one ! hilbert curve weight, modified later + if(perturb_obs)then + cdata_all(27,iout)=ran01dom()*perturb_fact ! u perturbation + cdata_all(28,iout)=ran01dom()*perturb_fact ! v perturbation + endif +! if(kx == 219 .and. k == 5)write(6,*) k,kx,c_station_id,(cdata_all(i,iout),i=1,25) + if(kx == 219 .or. kx == 218)then + if(usage < 100._r_kind)then + newstation=.true. + do i=1,nstations + if(list_stations(i) == id) then + newstation=.false. + exit + end if + end do + if(newstation)then + nstations=nstations+1 + list_stations(nstations)=id + end if + end if + end if + +! Specific humidity + else if(qob) then + if(obsdat(8,k) < 100._r_kind .or. obsdat(8,k) > 350._r_kind) then + if(print_verbose)write(6,*)id,'invalid td ', k,levs,obsdat(7,k),obsdat(8,k),plevs(k) + qqm(k)=12 + usage=108._r_kind + cycle loop_k_levs + end if + time=t4dv+obsdat(1,k)*r60inv*r60inv-toff + if(abs(time) > twindin .or. abs(time) > ctwind(nc)) then + if(print_verbose)write(6,*)id,obstype,'outside window',k,time,twindin + tqm(k)=12 + usage=108._r_kind + cycle loop_k_levs + end if + ndata=ndata+1 + nodata=nodata+1 + iout=ndata + if(ndata > maxobs) then + write(6,*)'READ_HDRAOB: ***WARNING*** ndata > maxobs for ',obstype + ndata = maxobs + end if + if(levs > 100 .or. plevs(1)-plevs(levs) < .01_r_kind)then + call errormod_hdraob(pqm,qqm,levs,plevs,errout,k,presl,dpres,nsig,lim_qm) + else + + call errormod(pqm,qqm,levs,plevs,errout,k,presl,dpres,nsig,lim_qm) + end if + qoe=obserr(2,k)*errout*one_tenth + if(obsdat(7,k) < 215._r_kind .or. toocold) then + qqm(k)=12 + if(k > 1)toocold=.true. + usage=108._r_kind + end if +! Need to convert from td to q + call fpvsx_ad(obsdat(8,k),es,dummy,dummy,.false.) + qobcon = eps*es/(plevs(k)-omeps*es) + cdata_all(1,iout)=qoe ! q error + cdata_all(2,iout)=dlon ! grid relative longitude + cdata_all(3,iout)=dlat ! grid relative latitude + cdata_all(4,iout)=dlnpob ! ln(pressure in cb) + cdata_all(5,iout)=qobcon ! q ob + cdata_all(6,iout)=rstation_id ! station id + cdata_all(7,iout)=t4dv+obsdat(1,k)*r60inv*r60inv ! time + cdata_all(8,iout)=nc ! type + cdata_all(9,iout)=0.2_r_kind ! q max error + cdata_all(10,iout)=obsdat(7,k) ! dry temperature (obs is tv) + cdata_all(11,iout)=qqm(k) ! quality mark + cdata_all(12,iout)=obserr(2,k)*one_tenth ! original obs error + cdata_all(13,iout)=usage ! usage parameter + cdata_all(14,iout)=idomsfc ! dominate surface type + cdata_all(15,iout)=dlon_earth_deg ! earth relative longitude (degrees) + cdata_all(16,iout)=dlat_earth_deg ! earth relative latitude (degrees) + cdata_all(17,iout)=stnelev ! station elevation (m) + cdata_all(18,iout)=levdat(2,k) ! observation height (m) + cdata_all(19,iout)=zz ! terrain height at ob location + cdata_all(20,iout)='88888888' ! provider name + cdata_all(21,iout)='HDRAOB' ! subprovider name + cdata_all(22,iout)=2 ! cat + cdata_all(23,iout)=var_jb(2,k) ! non linear qc b parameter + if(perturb_obs)cdata_all(24,iout)=ran01dom()*perturb_fact ! q perturbation + if (twodvar_regional) & + call adjust_error(cdata_all(15,iout),cdata_all(16,iout),cdata_all(12,iout),cdata_all(1,iout)) + + if(kx == 119)then + if(usage < 100._r_kind)then + newstation=.true. + do i=1,nstations + if(list_stations(i) == id) then + newstation=.false. + exit + end if + end do + if(newstation)then + nstations=nstations+1 + list_stations(nstations)=id + end if + end if + end if + else if(psob) then + if(obsdat(7,k) > 400._r_kind .or. stnelev > 7000._r_kind) pqm(k)=12 + if(plevs(k) > 200._r_kind .or. plevs(k) < 50._r_kind) pqm(k)=12 + if(obsdat(4,k)/grav > 5000._r_kind)pqm(k)=12 + if(pqm(k) > lim_qm)then + usage=108._r_kind + exit loop_k_levs + end if + time=t4dv-toff + if(abs(time) > twindin .or. abs(time) > ctwind(nc)) then + if(print_verbose)write(6,*)id,obstype,'outside window',k,time,twindin + tqm(k)=12 + usage=108._r_kind + cycle loop_k_levs + end if + ndata=ndata+1 + nodata=nodata+1 + iout=ndata + if(ndata > maxobs) then + write(6,*)'READ_HDRAOB: ***WARNING*** ndata > maxobs for ',obstype + ndata = maxobs + end if + poe=obserr(1,k)*one_tenth ! convert from mb to cb + cdata_all(1,iout)=poe ! surface pressure error (cb) + cdata_all(2,iout)=dlon ! grid relative longitude + cdata_all(3,iout)=dlat ! grid relative latitude + + cdata_all(4,iout)=plevs(k) ! pressure (in cb) + + cdata_all(5,iout)=obsdat(4,k)/grav ! surface height + cdata_all(6,iout)=obsdat(7,k) ! surface temperature + cdata_all(7,iout)=rstation_id ! station id + cdata_all(8,iout)=t4dv ! time + cdata_all(9,iout)=nc ! type + cdata_all(10,iout)=pqm(k) ! quality mark + cdata_all(11,iout)=obserr(1,k)*one_tenth ! original obs error (cb) + cdata_all(12,iout)=usage ! usage parameter + cdata_all(13,iout)=idomsfc ! dominate surface type + cdata_all(14,iout)=dlon_earth_deg ! earth relative longitude (degrees) + cdata_all(15,iout)=dlat_earth_deg ! earth relative latitude (degrees) + cdata_all(16,iout)=stnelev ! station elevation (m) + cdata_all(17,iout)=zz ! terrain height at ob location + cdata_all(18,iout)='88888888' ! provider name + cdata_all(19,iout)='HDRAOB' ! subprovider name + cdata_all(20,iout)=var_jb(1,k) ! non linear qc b parameter + if(perturb_obs)cdata_all(21,iout)=ran01dom()*perturb_fact ! ps perturbation + if (twodvar_regional) & + call adjust_error(cdata_all(14,iout),cdata_all(15,iout),cdata_all(11,iout),cdata_all(1,iout)) + + if(usage < 100._r_kind)then + newstation=.true. + do i=1,nstations + if(list_stations(i) == id) then + newstation=.false. + exit + end if + end do + if(newstation)then + nstations=nstations+1 + list_stations(nstations)=id + end if + end if + end if + +! +! End k loop over levs + end do LOOP_K_LEVS + end do loop_readsb + +! +! End of bufr read loop + enddo loop_msg +! Close unit to bufr file + +! Normal exit + + enddo loop_convinfo! loops over convinfo entry matches + deallocate(lmsg,tab) + call closbf(lunin) + + if(print_verbose)write(6,*)'READ_HDRAOB: closbf(',lunin,')' + + close(lunin) + +! Write header record and data to output file for further processing + allocate(cdata_out(nreal,ndata)) + do i=1,ndata + do k=1,nreal + cdata_out(k,i)=cdata_all(k,i) + end do + end do + deallocate(cdata_all) + + call count_obs(ndata,nreal,ilat,ilon,cdata_out,nobs) + write(lunout) obstype,sis,nreal,nchanl,ilat,ilon,ndata + write(lunout) cdata_out + + + deallocate(cdata_out) + + if(diagnostic_reg .and. ntest>0) write(6,*)'READ_HDRAOB: ',& + 'ntest,disterrmax=',ntest,disterrmax + if(diagnostic_reg .and. nvtest>0) write(6,*)'READ_HDRAOB: ',& + 'nvtest,vdisterrmax=',ntest,vdisterrmax + + if(tob)then + nhdt=nstations + if(nhdt > 0)allocate(hdtlist(nhdt)) + do i=1,nhdt + hdtlist(i)=list_stations(i) + end do + nodet=mype + write(6,*) ' number of high resolution t stations ',nstations + else if(qob)then + nhdq=nstations + if(nhdq > 0)allocate(hdqlist(nhdq)) + do i=1,nhdq + hdqlist(i)=list_stations(i) + end do + nodeq=mype + write(6,*) ' number of high resolution q stations ',nstations + else if(uvob)then + nhduv=nstations + if(nhduv > 0)allocate(hduvlist(nhduv)) + do i=1,nhduv + hduvlist(i)=list_stations(i) + end do + nodeuv=mype + write(6,*) ' number of high resolution uv stations ',nstations + else if(psob)then + nhdps=nstations + if(nhdps > 0)allocate(hdpslist(nhdps)) + do i=1,nhdps + hdpslist(i)=list_stations(i) + end do + nodeps=mype + write(6,*) ' number of high resolution ps stations ',nstations + end if + + deallocate(list_stations) +! End of routine + return + + end subroutine read_hdraob + +end module hdraobmod diff --git a/src/gsi/hybrid_ensemble_isotropic.F90 b/src/gsi/hybrid_ensemble_isotropic.F90 index 9231392f6b..e0a6e3fd1f 100644 --- a/src/gsi/hybrid_ensemble_isotropic.F90 +++ b/src/gsi/hybrid_ensemble_isotropic.F90 @@ -2593,8 +2593,8 @@ subroutine sqrt_beta_s_mult_cvec(grady) call stop2(999) endif -!$omp parallel do schedule(dynamic,1) private(ic3,ic2,k,j,i,ii) ! multiply by sqrt_beta_s +!$omp parallel do schedule(dynamic,1) private(ic3,ic2,k,j,i,ii) do j=1,lon2 do ii=1,nsubwin do ic3=1,nc3d @@ -2691,8 +2691,8 @@ subroutine sqrt_beta_s_mult_bundle(grady) call stop2(999) endif -!$omp parallel do schedule(dynamic,1) private(ic3,ic2,k,j,i) ! multiply by sqrt_beta_s +!$omp parallel do schedule(dynamic,1) private(ic3,ic2,k,j,i) do j=1,lon2 do ic3=1,nc3d ! check for ozone and skip if oz_univ_static = true @@ -2770,8 +2770,8 @@ subroutine sqrt_beta_e_mult_cvec(grady) ! Initialize timer call timer_ini('sqrt_beta_e_mult') -!$omp parallel do schedule(dynamic,1) private(nn,k,j,i,ii) ! multiply by sqrt_beta_e +!$omp parallel do schedule(dynamic,1) private(nn,k,j,i,ii) do j=1,grd_ens%lon2 do ii=1,nsubwin do nn=1,n_ens @@ -2834,8 +2834,8 @@ subroutine sqrt_beta_e_mult_bundle(aens) ! Initialize timer call timer_ini('sqrt_beta_e_mult') -!$omp parallel do schedule(dynamic,1) private(nn,k,j,i) ! multiply by sqrt_beta_e +!$omp parallel do schedule(dynamic,1) private(nn,k,j,i) do j=1,grd_ens%lon2 do nn=1,n_ens do k=1,nsig @@ -3430,7 +3430,7 @@ subroutine get_new_alpha_beta(aspect,ng,fmat_out,fmat0_out) end subroutine get_new_alpha_beta -subroutine bkerror_a_en(gradx,grady) +subroutine bkerror_a_en(grady) !$$$ subprogram documentation block ! . . . . ! subprogram: bkerror_a_en copy of bkerror for hybrid ensemble @@ -3444,10 +3444,10 @@ subroutine bkerror_a_en(gradx,grady) ! 2010-05-20 todling update to use bundle ! ! input argument list: -! gradx - input field +! grady - input field ! ! output -! grady - background structure * gradx +! grady - background structure * grady ! ! attributes: ! language: f90 @@ -3463,11 +3463,10 @@ subroutine bkerror_a_en(gradx,grady) implicit none ! Declare passed variables - type(control_vector),intent(inout) :: gradx type(control_vector),intent(inout) :: grady ! Declare local variables - integer(i_kind) ii,nn,ip,istatus + integer(i_kind) ii,ip,istatus if (lsqrtb) then write(6,*)'bkerror_a_en: not for use with lsqrtb' @@ -3483,12 +3482,6 @@ subroutine bkerror_a_en(gradx,grady) write(6,*)'bkerror_a_en: trouble getting pointer to ensemble CV' call stop2(317) endif -!$omp parallel do schedule(dynamic,1) private(nn,ii) - do nn=1,n_ens - do ii=1,nsubwin - grady%aens(ii,nn)%r3(ip)%q=gradx%aens(ii,nn)%r3(ip)%q - enddo - enddo ! multiply by sqrt_beta_e_mult call sqrt_beta_e_mult(grady) diff --git a/src/gsi/intall.f90 b/src/gsi/intall.f90 index 43c2b9f350..0f8faa89f8 100644 --- a/src/gsi/intall.f90 +++ b/src/gsi/intall.f90 @@ -319,7 +319,6 @@ subroutine intall(sval,sbias,rval,rbias) end do end if if(npclen > 0)then - do i=1,npclen rbias%predp(i)=qpred(nsclen+i) end do diff --git a/src/gsi/intrad.f90 b/src/gsi/intrad.f90 index 6d3f0f3307..77e92d4a54 100644 --- a/src/gsi/intrad.f90 +++ b/src/gsi/intrad.f90 @@ -307,7 +307,7 @@ subroutine intrad_(radhead,rval,sval,rpred,spred) real(r_quad),dimension(npred*jpch_rad),intent(inout) :: rpred ! Declare local variables - integer(i_kind) j1,j2,j3,j4,i1,i2,i3,i4,n,k,ic,ix,nn,mm,ncr1,ncr2 + integer(i_kind) i1,i2,i3,i4,n,k,ic,ix,nn,mm,ncr1,ncr2 integer(i_kind) ier,istatus integer(i_kind),dimension(nsig) :: i1n,i2n,i3n,i4n real(r_kind),allocatable,dimension(:):: val @@ -388,20 +388,16 @@ subroutine intrad_(radhead,rval,sval,rpred,spred) !radptr => radhead radptr => radNode_typecast(radhead) do while (associated(radptr)) - j1=radptr%ij(1) - j2=radptr%ij(2) - j3=radptr%ij(3) - j4=radptr%ij(4) + i1n(1) = radptr%ij(1) + i2n(1) = radptr%ij(2) + i3n(1) = radptr%ij(3) + i4n(1) = radptr%ij(4) w1=radptr%wij(1) w2=radptr%wij(2) w3=radptr%wij(3) w4=radptr%wij(4) ! Begin Forward model ! calculate temperature, q, ozone, sst vector at observation location - i1n(1) = j1 - i2n(1) = j2 - i3n(1) = j3 - i4n(1) = j4 do k=2,nsig i1n(k) = i1n(k-1)+latlon11 i2n(k) = i2n(k-1)+latlon11 @@ -409,6 +405,7 @@ subroutine intrad_(radhead,rval,sval,rpred,spred) i4n(k) = i4n(k-1)+latlon11 enddo +!$omp parallel do schedule(dynamic,1) private(k,i1,i2,i3,i4,mm) do k=1,nsig i1 = i1n(k) i2 = i2n(k) @@ -423,7 +420,7 @@ subroutine intrad_(radhead,rval,sval,rpred,spred) w3* sq(i3)+w4* sq(i4) endif if(luseoz)then - tdir(ioz+k)=w1* soz(i1)+w2* soz(i2)+ & + tdir(ioz+k)=w1* soz(i1)+w2* soz(i2)+ & w3* soz(i3)+w4* soz(i4) end if if(lusecw)then @@ -454,19 +451,21 @@ subroutine intrad_(radhead,rval,sval,rpred,spred) tdir(iqs+k)=w1* sqs(i1)+w2* sqs(i2)+ & w3* sqs(i3)+w4* sqs(i4) end if + if(k == 1)then + if(luseu)then + tdir(ius+1)= w1* su(i1) +w2* su(i2)+ & + w3* su(i3) +w4* su(i4) + endif + if(lusev)then + tdir(ivs+1)= w1* sv(i1) +w2* sv(i2)+ & + w3* sv(i3) +w4* sv(i4) + endif + if(lusesst)then + tdir(isst+1)=w1*sst(i1) +w2*sst(i2)+ & + w3*sst(i3) +w4*sst(i4) + end if + end if end do - if(luseu)then - tdir(ius+1)= w1* su(j1) +w2* su(j2)+ & - w3* su(j3) +w4* su(j4) - endif - if(lusev)then - tdir(ivs+1)= w1* sv(j1) +w2* sv(j2)+ & - w3* sv(j3) +w4* sv(j4) - endif - if(lusesst)then - tdir(isst+1)=w1*sst(j1) +w2*sst(j2)+ & - w3*sst(j3) +w4*sst(j4) - end if @@ -476,6 +475,7 @@ subroutine intrad_(radhead,rval,sval,rpred,spred) if (.not. ladtest_obs) then allocate(biasvect(radptr%nchan)) +!$omp parallel do schedule(dynamic,1) private(nn,n,ic1,ix1,val_quad) do nn=1,radptr%nchan ic1=radptr%icx(nn) ix1=(ic1-1)*npred @@ -486,8 +486,8 @@ subroutine intrad_(radhead,rval,sval,rpred,spred) biasvect(nn) = val_quad end do end if - ncr1=0 +!$omp parallel do schedule(dynamic,1) private(nn,ic,ix,k) do nn=1,radptr%nchan ic=radptr%icx(nn) ix=(ic-1)*npred @@ -499,8 +499,11 @@ subroutine intrad_(radhead,rval,sval,rpred,spred) do k=1,nsigradjac val(nn)=val(nn)+tdir(k)*radptr%dtb_dvar(k,nn) end do + end do + ncr1=0 ! Include contributions from remaining bias correction terms + do nn=1,radptr%nchan if( .not. ladtest_obs) then if(radptr%use_corr_obs)then val_quad = zero_quad @@ -551,7 +554,6 @@ subroutine intrad_(radhead,rval,sval,rpred,spred) if( .not. ladtest_obs) then if (radptr%use_corr_obs) then - ncr2 = 0 ncr1 = 0 do mm=1,radptr%nchan ncr1 = ncr1 + mm @@ -566,17 +568,15 @@ subroutine intrad_(radhead,rval,sval,rpred,spred) if(radptr%luse)then if(radptr%use_corr_obs)then - do mm=1,radptr%nchan - ic1=radptr%icx(mm) - ix1=(ic1-1)*npred + do nn=1,radptr%nchan + ix=(radptr%icx(nn)-1)*npred do n=1,npred - rpred(ix1+n)=rpred(ix1+n)+biasvect(mm)*radptr%pred(n,mm) + rpred(ix+n)=rpred(ix+n)+biasvect(nn)*radptr%pred(n,nn) enddo enddo else do nn=1,radptr%nchan - ic=radptr%icx(nn) - ix=(ic-1)*npred + ix=(radptr%icx(nn)-1)*npred do n=1,npred rpred(ix+n)=rpred(ix+n)+radptr%pred(n,nn)*val(nn) end do @@ -591,6 +591,7 @@ subroutine intrad_(radhead,rval,sval,rpred,spred) ! Begin adjoint if (l_do_adjoint) then +!$omp parallel do schedule(dynamic,1) private(k,nn) do k=1,nsigradjac tval(k)=zero @@ -603,31 +604,34 @@ subroutine intrad_(radhead,rval,sval,rpred,spred) ! Distribute adjoint contributions over surrounding grid points - if(luseu) then - ru(j1)=ru(j1)+w1*tval(ius+1) - ru(j2)=ru(j2)+w2*tval(ius+1) - ru(j3)=ru(j3)+w3*tval(ius+1) - ru(j4)=ru(j4)+w4*tval(ius+1) - endif - if(lusev) then - rv(j1)=rv(j1)+w1*tval(ivs+1) - rv(j2)=rv(j2)+w2*tval(ivs+1) - rv(j3)=rv(j3)+w3*tval(ivs+1) - rv(j4)=rv(j4)+w4*tval(ivs+1) - endif - - if (lusesst) then - rst(j1)=rst(j1)+w1*tval(isst+1) - rst(j2)=rst(j2)+w2*tval(isst+1) - rst(j3)=rst(j3)+w3*tval(isst+1) - rst(j4)=rst(j4)+w4*tval(isst+1) - end if +!$omp parallel do schedule(dynamic,1) private(k,i1,i2,i3,i4,mm) do k=1,nsig i1 = i1n(k) i2 = i2n(k) i3 = i3n(k) i4 = i4n(k) + if(k == 1)then + if(luseu) then + ru(i1)=ru(i1)+w1*tval(ius+1) + ru(i2)=ru(i2)+w2*tval(ius+1) + ru(i3)=ru(i3)+w3*tval(ius+1) + ru(i4)=ru(i4)+w4*tval(ius+1) + endif + if(lusev) then + rv(i1)=rv(i1)+w1*tval(ivs+1) + rv(i2)=rv(i2)+w2*tval(ivs+1) + rv(i3)=rv(i3)+w3*tval(ivs+1) + rv(i4)=rv(i4)+w4*tval(ivs+1) + endif + + if (lusesst) then + rst(i1)=rst(i1)+w1*tval(isst+1) + rst(i2)=rst(i2)+w2*tval(isst+1) + rst(i3)=rst(i3)+w3*tval(isst+1) + rst(i4)=rst(i4)+w4*tval(isst+1) + end if + end if if(luset)then mm=itv+k diff --git a/src/gsi/intw.f90 b/src/gsi/intw.f90 index 06d13cec2e..5f437ac8ef 100644 --- a/src/gsi/intw.f90 +++ b/src/gsi/intw.f90 @@ -114,7 +114,7 @@ subroutine intw_(whead,rval,sval) integer(i_kind) ib,ik ! real(r_kind) penalty real(r_kind) valu,valv,w1,w2,w3,w4,w5,w6,w7,w8 - real(r_kind) gu,gv,wu,wv,ww + real(r_kind) gu,gv,wu,wv,ww,con real(r_kind) cg_w,p0,gradu,gradv,wnotgross,wgross,term,w_pg real(r_kind),pointer,dimension(:) :: su,sv real(r_kind),pointer,dimension(:) :: ru,rv @@ -198,27 +198,29 @@ subroutine intw_(whead,rval,sval) gradu = valu*wptr%raterr2*wptr%err2 gradv = valv*wptr%raterr2*wptr%err2 else if (njqc .and. wptr%jb > tiny_r_kind .and. wptr%jb <10.0_r_kind) then - valu=sqrt(two*wptr%jb)*tanh(sqrt(wptr%err2)*valu/sqrt(two*wptr%jb)) - valv=sqrt(two*wptr%jb)*tanh(sqrt(wptr%err2)*valv/sqrt(two*wptr%jb)) - gradu = valu*wptr%raterr2*sqrt(wptr%err2) - gradv = valv*wptr%raterr2*sqrt(wptr%err2) + con=sqrt(wptr%err2) + valu=sqrt(two*wptr%jb)*tanh(con*valu/sqrt(two*wptr%jb)) + valv=sqrt(two*wptr%jb)*tanh(con*valv/sqrt(two*wptr%jb)) + gradu = valu*wptr%raterr2*con + gradv = valv*wptr%raterr2*con else if (nvqc .and. wptr%ib >0) then ib=wptr%ib ik=wptr%ik - ww=valu*sqrt(wptr%err2) + con=sqrt(wptr%err2) + ww=valu*con if(hub_norm) then call vqch(ib,ik,ww,gu,wu) else call vqcs(ib,ik,ww,gu,wu) endif - gradu =wu*ww*sqrt(wptr%err2)*wptr%raterr2 - ww=valv*sqrt(wptr%err2) + gradu =wu*ww*con*wptr%raterr2 + ww=valv*con if(hub_norm) then call vqch(ib,ik,ww,gv,wv) else call vqcs(ib,ik,ww,gv,wv) endif - gradv =wv*ww*sqrt(wptr%err2)*wptr%raterr2 + gradv =wv*ww*con*wptr%raterr2 else gradu = valu*wptr%raterr2*wptr%err2 gradv = valv*wptr%raterr2*wptr%err2 diff --git a/src/gsi/jfunc.f90 b/src/gsi/jfunc.f90 index 94a2272851..1f1adc5702 100644 --- a/src/gsi/jfunc.f90 +++ b/src/gsi/jfunc.f90 @@ -28,8 +28,6 @@ module jfunc ! - defer GMAO diurnal bias correction changes. ! 2008-12-01 todling - bring in Tremolet's changes ! 2009-06-01 pondeca,sato - add tsensible initialization. used in 2dvar mode only -! 2009-06-01 pondeca - add lgschmidt initalization. this variable controls the B-norm -! re-orthogonalization of the gradx vectors in 2dvar mode ! 2010-02-20 parrish - add change to get correct nval_len when using hybrid ensemble with dual resolution. ! 2010-02-20 zhu - add nrf_levb and nrf_leve ! 2010-03-23 derber - remove rhgues (not used) @@ -56,6 +54,7 @@ module jfunc ! anav_info - control variables information ! sub read_guess_solution - read guess solution ! sub write_guess_solution - write guess solution +! sub strip1 - strip off halo from subdomain arrays for 1 field ! sub strip2 - strip off halo from subdomain arrays ! sub set_pointer - set location indices for components of vectors ! @@ -82,14 +81,12 @@ module jfunc ! def nvals_levs - number of 2d (x/y) state-vector variables ! def nvals_len - number of 2d state-vector variables * subdomain size (with buffer) ! def nval_levs - number of 2d (x/y) control-vector variables +! def nval_levs_ens - number of 2d (x/y) control-vector variables including +! ensembles ! def nval_len - number of 2d control-vector variables * subdomain size (with buffer) ! def print_diag_pcg - option for turning on GMAO diagnostics in pcgsoi ! def tsensible - option to use sensible temperature as the control variable. applicable ! to the 2dvar mode only -! def lgschmidt - option to re-biorthogonalyze the gradx and grady vectors during the -! inner iteration using the modified gram-schmidt method. useful for -! estimating the analysis error via the projection method. -! ! def ntracer - total number of tracer variables ! def nrft - total number of time tendencies for upper level control variables ! def nrft_ - order of time tendencies for 3d control variables @@ -124,6 +121,7 @@ module jfunc public :: destroy_jfunc public :: read_guess_solution public :: write_guess_solution + public :: strip1 public :: strip2 public :: set_pointer public :: set_sqrt_2dsize @@ -131,22 +129,22 @@ module jfunc public :: nrclen,npclen,nsclen,ntclen,qoption,nval_lenz,tendsflag,tsensible,cwoption,varcw public :: switch_on_derivatives,jiterend,jiterstart,jiter,iter,niter,miter public :: diurnalbc,bcoption,biascor,nval2d,xhatsave,first - public :: factqmax,factqmin,clip_supersaturation,last,yhatsave,nvals_len,nval_levs,iout_iter,nclen + public :: factqmax,factqmin,clip_supersaturation,last,yhatsave,nvals_len,nval_levs,nval_levs_ens,iout_iter,nclen public :: factql,factqi,factqr,factqs,factqg - public :: niter_no_qc,print_diag_pcg,lgschmidt,penorig,gnormorig,iguess + public :: niter_no_qc,print_diag_pcg,penorig,gnormorig,iguess public :: factg,factv,factp,factl,R_option,factw10m,facthowv,factcldch,diag_precon,step_start public :: pseudo_q2 public :: varq public :: cnvw_option - logical first,last,switch_on_derivatives,tendsflag,print_diag_pcg,tsensible,lgschmidt,diag_precon + logical first,last,switch_on_derivatives,tendsflag,print_diag_pcg,tsensible,diag_precon logical clip_supersaturation,R_option logical pseudo_q2 logical cnvw_option integer(i_kind) iout_iter,miter,iguess,nclen,qoption,cwoption integer(i_kind) jiter,jiterstart,jiterend,iter integer(i_kind) nvals_len,nvals_levs - integer(i_kind) nval_len,nval_lenz,nval_levs + integer(i_kind) nval_len,nval_lenz,nval_levs,nval_levs_ens integer(i_kind) nclen1,nclen2,nrclen,nsclen,npclen,ntclen integer(i_kind) nval2d,nclenz @@ -198,7 +196,6 @@ subroutine init_jfunc tendsflag=.false. print_diag_pcg=.false. tsensible=.false. - lgschmidt=.false. diag_precon=.false. step_start=1.e-4_r_kind R_option=.false. @@ -358,7 +355,7 @@ subroutine destroy_jfunc return end subroutine destroy_jfunc - subroutine read_guess_solution(dirx,diry,mype) + subroutine read_guess_solution(diry,mype,success) !$$$ subprogram documentation block ! . . . . ! subprogram: read_guess_solution @@ -376,10 +373,11 @@ subroutine read_guess_solution(dirx,diry,mype) ! ! input argument list: ! mype - mpi task id -! dirx,diry - dynamic components, e.g. %values(:), must be already allocated +! diry - dynamic components, e.g. %values(:), must be already allocated ! ! output argument list: -! dirx,diry +! diry +! success - logical flag determining if input file was successfully read ! ! attributes: ! language: f90 @@ -395,16 +393,17 @@ subroutine read_guess_solution(dirx,diry,mype) implicit none integer(i_kind) ,intent(in ) :: mype - type(control_vector),intent(inout) :: dirx,diry + type(control_vector),intent(inout) :: diry + logical ,intent(inout) :: success integer(i_kind) i,k,mm1,myper,kk,i1,i2 - integer(i_kind) nlatg,nlong,nsigg,nrcleng + integer(i_kind) nlatg,nlong,nsigg + integer(i_kind) nxval,nxrclen,nxsclen,nxpclen integer(i_kind),dimension(5):: iadateg - real(r_single),dimension(max(iglobal,itotsub)):: fieldx,fieldy - real(r_single),dimension(nlat,nlon):: xhatsave_g,yhatsave_g - real(r_single),dimension(nclen):: xhatsave_r4,yhatsave_r4 + real(r_single),dimension(max(iglobal,itotsub)):: fieldy + real(r_single),dimension(nlat,nlon):: yhatsave_g + real(r_single),dimension(nclen):: yhatsave_r4 - jiterstart = 1 mm1=mype+1 myper=0 @@ -415,60 +414,62 @@ subroutine read_guess_solution(dirx,diry,mype) nlatg=0 nlong=0 nsigg=0 - nrcleng=0 - read(12,end=1234)iadateg,nlatg,nlong,nsigg,nrcleng + read(12,end=1234)iadateg,nlatg,nlong,nsigg,nxval,nxrclen,nxsclen,nxpclen if(iadate(1) == iadateg(1) .and. iadate(2) == iadate(2) .and. & iadate(3) == iadateg(3) .and. iadate(4) == iadateg(4) .and. & iadate(5) == iadateg(5) .and. nlat == nlatg .and. & + nxval == nval_levs_ens .and. & nlon == nlong .and. nsig == nsigg) then if(mype == 0) write(6,*)'READ_GUESS_SOLUTION: read guess solution for ',& - iadateg,nlatg,nlong,nsigg,nrcleng - jiterstart=0 + iadateg,nlatg,nlong,nsigg,nxval,nxrclen,nxsclen,nxpclen ! Let all tasks read gesfile_in to pick up bias correction (second read) + if(nxsclen+nxpclen > 0)then + if ( nxsclen==nsclen .and. nxpclen == npclen) then + read(12,end=1236) (yhatsave_r4(i),i=nclen1+1,nclen-ntclen) + do i=nclen+1,nclen-ntclen + diry%values(i)=real(yhatsave_r4(i),r_kind) + end do + else + read(12) + if(mype == 0) then + write(6,*) 'READ_GUESS_SOLUTION: INCOMPATABLE RADIANCE COMPONENT in GESFILE, gesfile_in' + write(6,*) 'READ_GUESS_SOLUTION: nrclen: input,current=',nxsclen,nsclen,nxpclen,npclen + write(6,*) 'READ_GUESS_SOLUTION: ignoring previous radiance guess' + endif + endif + else + if(mype == 0) write(6,*) ' No bias correction in restart file ' + endif ! Loop to read input guess fields. After reading in each field & level, ! scatter the grid to the appropriate location in the xhat and yhatsave ! arrays. - do k=1,nval_levs - read(12,end=1236) xhatsave_g,yhatsave_g - do kk=1,itotsub - i1=ltosi_s(kk); i2=ltosj_s(kk) - fieldx(kk)=xhatsave_g(i1,i2) - fieldy(kk)=yhatsave_g(i1,i2) - end do + do k=1,nval_levs_ens + if(mype == myper)then + read(12,end=1236) yhatsave_g + do kk=1,itotsub + i1=ltosi_s(kk); i2=ltosj_s(kk) + fieldy(kk)=yhatsave_g(i1,i2) + end do + end if i=(k-1)*latlon11 + 1 - call mpi_scatterv(fieldx,ijn_s,displs_s,mpi_real4,& - xhatsave_r4(i),ijn_s(mm1),mpi_real4,myper,mpi_comm_world,ierror) call mpi_scatterv(fieldy,ijn_s,displs_s,mpi_real4,& yhatsave_r4(i),ijn_s(mm1),mpi_real4,myper,mpi_comm_world,ierror) - end do !end do over nval_levs + end do !end do over val_levs_ens` -! Read radiance and precipitation bias correction terms - if ( nrcleng==nrclen ) then - read(12,end=1236) (xhatsave_r4(i),i=nclen1+1,nclen),(yhatsave_r4(i),i=nclen1+1,nclen) - else - if(mype == 0) then - write(6,*) 'READ_GUESS_SOLUTION: INCOMPATABLE RADIANCE COMPONENT in GESFILE, gesfile_in' - write(6,*) 'READ_GUESS_SOLUTION: nrclen: input,current=',nrcleng,nrclen - write(6,*) 'READ_GUESS_SOLUTION: ignoring previous radiance guess' - endif - do i=nclen1+1,nclen - xhatsave_r4(i)=zero - yhatsave_r4(i)=zero - end do - endif - do i=1,nclen - dirx%values(i)=real(xhatsave_r4(i),r_kind) + do i=1,nclen1 diry%values(i)=real(yhatsave_r4(i),r_kind) end do + success = .true. else + read(12) if(mype == 0) then write(6,*) 'READ_GUESS_SOLUTION: INCOMPATABLE GUESS FILE, gesfile_in' write(6,*) 'READ_GUESS_SOLUTION: iguess,iadate,iadateg=',iguess,iadate,iadateg write(6,*) 'READ_GUESS_SOLUTION: nlat,nlatg,nlon,nlong,nsig,nsigg=',& - nlat,nlatg,nlon,nlong,nsig,nsigg + nlat,nlatg,nlon,nlong,nsig,nsigg,nval_levs_ens,nxval end if endif close(12) @@ -535,63 +536,118 @@ subroutine write_guess_solution(mype) integer(i_kind),intent(in ) :: mype integer(i_kind) i,j,k,mm1,mypew,kk,i1,i2,ie,is - real(r_single),dimension(lat1,lon1,2):: field - real(r_single),dimension(max(iglobal,itotsub)):: fieldx,fieldy - real(r_single),dimension(nlat,nlon):: xhatsave_g,yhatsave_g - real(r_single),dimension(nrclen):: xhatsave4,yhatsave4 + real(r_single),dimension(lat1,lon1):: field + real(r_single),dimension(max(iglobal,itotsub)):: fieldy + real(r_single),dimension(nlat,nlon):: yhatsave_g + real(r_single),dimension(nrclen):: yhatsave4 + integer :: nxr,nxs,nxp + logical :: writebias mm1=mype+1 mypew=0 + writebias=.false. + if(writebias)then + nxr=nrclen + nxs=nsclen + nxp=npclen + else + nxr=0 + nxs=0 + nxp=0 + end if ! Write header record to output file if (mype==mypew) then open(51,file='gesfile_out',form='unformatted') - write(51) iadate,nlat,nlon,nsig,nrclen + write(51) iadate,nlat,nlon,nsig,nval_levs_ens,nxr,nxs,nxp endif +! Write radiance and precipitation bias correction terms to output file + if (mype==mypew .and. nsclen+npclen > 0 .and. writebias) then + do i=1,nsclen+npclen + yhatsave4(i)=yhatsave%values(nclen1+i) + end do + write(51) (yhatsave4(i),i=1,nsclen+npclen) + end if + ! Loop over levels. Gather guess solution and write to output - do k=1,nval_levs + do k=1,nval_levs_ens ie=(k-1)*latlon11 + 1 is=ie+latlon11 - call strip2(xhatsave%values(ie:is),yhatsave%values(ie:is),field) - call mpi_gatherv(field(1,1,1),ijn(mm1),mpi_real4,& - fieldx,ijn,displs_g,mpi_real4,mypew,& - mpi_comm_world,ierror) - call mpi_gatherv(field(1,1,2),ijn(mm1),mpi_real4,& + call strip1(yhatsave%values(ie:is),field) + call mpi_gatherv(field,ijn(mm1),mpi_real4,& fieldy,ijn,displs_g,mpi_real4,mypew,& mpi_comm_world,ierror) + if(mype == mypew)then ! Transfer to global arrays - do j=1,nlon - do i=1,nlat - xhatsave_g(i,j)=zero - yhatsave_g(i,j)=zero + do j=1,nlon + do i=1,nlat + yhatsave_g(i,j)=zero + end do + end do + do kk=1,iglobal + i1=ltosi(kk); i2=ltosj(kk) + yhatsave_g(i1,i2)=fieldy(kk) end do - end do - do kk=1,iglobal - i1=ltosi(kk); i2=ltosj(kk) - xhatsave_g(i1,i2)=fieldx(kk) - yhatsave_g(i1,i2)=fieldy(kk) - end do ! Write level record - if (mype==mypew) write(51) xhatsave_g,yhatsave_g - end do !end do over nval_levs + write(51) yhatsave_g + end if + end do !end do over nval_levs_ens -! Write radiance and precipitation bias correction terms to output file - if (mype==mypew) then - do i=1,nrclen - xhatsave4(i)=xhatsave%values(nclen1+i) - yhatsave4(i)=yhatsave%values(nclen1+i) - end do - write(51) (xhatsave4(i),i=1,nrclen),(yhatsave4(i),i=1,nrclen) + if(mype==mypew)then close(51) write(6,*)'WRITE_GUESS_SOLUTION: write guess solution for ',& - iadate,nlat,nlon,nsig,nrclen + iadate,nlat,nlon,nsig,nxr,nxs,nxp endif return end subroutine write_guess_solution + subroutine strip1(field_in1,field_out) +!$$$ subprogram documentation block +! . . . . +! subprogram: strip1 +! prgmmr: treadon org: np23 date: 2003-11-24 +! +! abstract: strip off halo from two subdomain arrays & combine into +! single output array +! +! program history log: +! 2003-11-24 treadon +! 2004-05-18 kleist, documentation +! 2008-05-12 safford - rm unused uses +! +! input argument list: +! field_in1 - subdomain field with halo +! +! output argument list: +! field_out - combined subdomain fields with halo stripped +! +! attributes: +! language: f90 +! machine: ibm rs/6000 sp +! +!$$$ + use kinds, only: r_single + use gridmod, only: lat1,lon1,lat2,lon2 + implicit none + + real(r_single),dimension(lat1,lon1),intent( out) :: field_out + real(r_kind) ,dimension(lat2,lon2),intent(in ) :: field_in1 + + integer(i_kind) i,j,jp1 + + + do j=1,lon1 + jp1 = j+1 + do i=1,lat1 + field_out(i,j)=field_in1(i+1,jp1) + end do + end do + + return + end subroutine strip1 subroutine strip2(field_in1,field_in2,field_out) !$$$ subprogram documentation block @@ -691,6 +747,7 @@ subroutine set_pointer nval_len=nval_levs*latlon11 if(l_hyb_ens) then nval_len=nval_len+n_ens*nsig*grd_ens%latlon11 + nval_levs_ens=nval_levs+n_ens*nsig end if nsclen=npred*jpch_rad npclen=npredp*npcptype diff --git a/src/gsi/m_extOzone.F90 b/src/gsi/m_extOzone.F90 index 31cdedbebc..3d4b6783c1 100644 --- a/src/gsi/m_extOzone.F90 +++ b/src/gsi/m_extOzone.F90 @@ -1421,6 +1421,8 @@ subroutine ozlev_bufrread_(dfile,dtype,dsis, ozout,nmrecs,ndata,nodata, & call warn(myname_,' actual retained =',nodata) call warn(myname_,' size(ozout,2) =',maxobs) endif + call closbf(lunin) + close(lunin) ! write(stdout,'(3a,3i8,f8.2)') mprefix('read_ozone'), & ! ' obstype,nmrecs,ndata,nodata,no/ndata = ',dtype,nmrecs,ndata,nodata,real(nodata)/ndata diff --git a/src/gsi/m_gpsrhs.F90 b/src/gsi/m_gpsrhs.F90 index a90a156857..80f0b5b83d 100644 --- a/src/gsi/m_gpsrhs.F90 +++ b/src/gsi/m_gpsrhs.F90 @@ -13,6 +13,7 @@ module m_gpsrhs ! 2010-05-27 j guo - derived from m_rhs.f90 ! 2011-01-04 l cucurull - add nsig_ext in gpsrhs_alloc ! 2012-12-17 l cucurull - remove qcfail_stats_1 and qcfail_stats_2 +! 2020-08-26 H Shao/K Bathmann - add jac_qc for jacobian QC ! ! input argument list: see Fortran 90 style document below ! @@ -70,6 +71,7 @@ module m_gpsrhs public:: qcfail_loc public:: qcfail_high public:: qcfail_gross + public:: qcfail_jac public:: data_ier public:: data_igps @@ -118,6 +120,7 @@ module m_gpsrhs real(r_single ), pointer, dimension( :):: qcfail_loc => null() real(r_single ), pointer, dimension( :):: qcfail_high => null() real(r_single ), pointer, dimension( :):: qcfail_gross=> null() + real(r_single ), pointer, dimension( :):: qcfail_jac=> null() real(r_kind ), pointer, dimension( :):: data_ier => null() real(r_kind ), pointer, dimension( :):: data_igps => null() @@ -149,7 +152,7 @@ module m_gpsrhs character(len=8), pointer, dimension( :), save:: cdiagbuf logical , pointer, dimension( :), save:: qcfail - real(r_single ), pointer, dimension( :), save:: qcfail_loc,qcfail_high,qcfail_gross + real(r_single ), pointer, dimension( :), save:: qcfail_loc,qcfail_high,qcfail_gross,qcfail_jac real(r_kind ), pointer, dimension( :), save:: data_ier real(r_kind ), pointer, dimension( :), save:: data_igps @@ -264,11 +267,13 @@ subroutine gpsrhs_alloc(is,class,nobs,nsig,nreal,grids_dim,nsig_ext) allocate(b%qcfail_loc (nobs)) allocate(b%qcfail_high (nobs)) allocate(b%qcfail_gross (nobs)) + allocate(b%qcfail_jac (nobs)) b%qcfail=.false. b%qcfail_loc =zero b%qcfail_high =zero b%qcfail_gross =zero + b%qcfail_jac =zero allocate(b%data_ier (nobs)) allocate(b%data_igps(nobs)) @@ -345,6 +350,7 @@ subroutine gpsrhs_dealloc(is) deallocate(b%qcfail_loc ) deallocate(b%qcfail_high ) deallocate(b%qcfail_gross ) + deallocate(b%qcfail_jac ) deallocate(b%data_ier ) deallocate(b%data_igps) @@ -402,6 +408,7 @@ subroutine gpsrhs_aliases(is) qcfail_loc => b%qcfail_loc qcfail_high => b%qcfail_high qcfail_gross => b%qcfail_gross + qcfail_jac => b%qcfail_jac data_ier => b%data_ier data_igps => b%data_igps @@ -435,7 +442,7 @@ subroutine gpsrhs_unaliases(is) nullify(rges,gp2gm,prsltmp_o,tges_o) nullify(error,error_adjst,ratio_errors) nullify(rdiagbuf,cdiagbuf) - nullify(qcfail,qcfail_loc,qcfail_gross) + nullify(qcfail,qcfail_loc,qcfail_gross,qcfail_jac) nullify(qcfail_high) nullify(data_ier,data_igps,data_ihgt) _EXIT_(myname_) diff --git a/src/gsi/mod_fv3_lola.f90 b/src/gsi/mod_fv3_lola.f90 index d3b4a10323..0fc1f929f2 100644 --- a/src/gsi/mod_fv3_lola.f90 +++ b/src/gsi/mod_fv3_lola.f90 @@ -671,7 +671,7 @@ subroutine fv3uv2earth(u,v,nx,ny,u_out,v_out) return end subroutine fv3uv2earth -subroutine fv3_h_to_ll(b_in,a,nb,mb,na,ma) +subroutine fv3_h_to_ll(b_in,a,nb,mb,na,ma,rev_flg) !$$$ subprogram documentation block ! . . . . ! subprogram: fv3_h_to_ll @@ -706,21 +706,26 @@ subroutine fv3_h_to_ll(b_in,a,nb,mb,na,ma) integer(i_kind),intent(in ) :: mb,nb,ma,na real(r_kind) ,intent(in ) :: b_in(nb,mb) + logical ,intent(in ) :: rev_flg real(r_kind) ,intent( out) :: a(ma,na) integer(i_kind) i,j,ir,jr,mbp,nbp real(r_kind) b(nb,mb) -!!!!!!!!! reverse E-W and N-S mbp=mb+1 nbp=nb+1 - do j=1,mb - jr=mbp-j - do i=1,nb - ir=nbp-i - b(ir,jr)=b_in(i,j) + if(rev_flg) then +!!!!!!!!! reverse E-W and N-S + do j=1,mb + jr=mbp-j + do i=1,nb + ir=nbp-i + b(ir,jr)=b_in(i,j) + end do end do - end do + else + b(:,:)=b_in(:,:) + endif !!!!!!!!! interpolate to A grid & reverse ij for array a(lat,lon) if(bilinear)then ! bilinear interpolation do j=1,ma @@ -794,10 +799,10 @@ subroutine fv3_ll_to_h(a,b,nxa,nya,nxb,nyb,rev_flg) end do else !!!!!!!!!! output order as input W-E S-N and (i:lat,j:lon) !!!!!!!!!!! - do j=1,nxb - ijr=(j-1)*nyb - do i=1,nyb - b(i+ijr)=a3dy1(i,j)*(a3dx1(i,j)*a(a3jy (i,j),a3ix(i,j))+a3dx(i,j)*a(a3jy (i,j),a3ixp(i,j))) & + do i=1,nyb + ijr=(i-1)*nxb + do j=1,nxb + b(j+ijr)=a3dy1(i,j)*(a3dx1(i,j)*a(a3jy (i,j),a3ix(i,j))+a3dx(i,j)*a(a3jy (i,j),a3ixp(i,j))) & +a3dy (i,j)*(a3dx1(i,j)*a(a3jyp(i,j),a3ix(i,j))+a3dx(i,j)*a(a3jyp(i,j),a3ixp(i,j))) end do end do diff --git a/src/gsi/mod_vtrans.f90 b/src/gsi/mod_vtrans.f90 index 7f72fb858a..3c7d8af8f4 100644 --- a/src/gsi/mod_vtrans.f90 +++ b/src/gsi/mod_vtrans.f90 @@ -243,8 +243,6 @@ subroutine create_vtrans(mype) ! get work pe: - print_verbose=.false. - if(verbose .and. g1%mype==workpe) print_verbose=.true. allocate(numlevs(0:g1%npe-1)) numlevs(0:g1%npe-1)=g1%kend(0:g1%npe-1)-g1%kbegin(0:g1%npe-1)+1 if(g1%mype==0) then @@ -258,6 +256,10 @@ subroutine create_vtrans(mype) call mpi_bcast(workpe,1,mpi_integer,0,mpi_comm_world,ierror) !write(6,*)' mype,workpe=',mype,workpe + print_verbose=.false. + if(verbose .and. g1%mype==workpe) print_verbose=.true. + + ! obtain vertical coordinate constants ahat,bhat,chat if(mype==workpe) call getabc(ahat,bhat,chat) diff --git a/src/gsi/mpimod.F90 b/src/gsi/mpimod.F90 index a249eadeac..7a4e597765 100644 --- a/src/gsi/mpimod.F90 +++ b/src/gsi/mpimod.F90 @@ -37,6 +37,7 @@ module mpimod use mpeu_mpif, only : mpi_real4 use mpeu_mpif, only : mpi_max use mpeu_mpif, only : mpi_min + use mpeu_mpif, only : mpi_character use mpeu_mpif, only : mpi_offset_kind use mpeu_mpif, only : mpi_info_null use mpeu_mpif, only : mpi_mode_rdonly @@ -109,6 +110,7 @@ module mpimod public :: mpi_mode_rdwr,mpi_byte public :: mpi_mode_create public :: mpi_mode_wronly + public :: mpi_character #ifdef HAVE_ESMF integer(i_kind) :: mpi_comm_world diff --git a/src/gsi/obs_para.f90 b/src/gsi/obs_para.f90 index e560fafe1f..530e946be6 100644 --- a/src/gsi/obs_para.f90 +++ b/src/gsi/obs_para.f90 @@ -104,7 +104,7 @@ subroutine obs_para(ndata,mype) if (dtype(is)=='lag') then ! lagrangian data call dislag(ndata(is,1),mm1,lunout,obsfile_all(is),dtype(is),& nobs_s) - nsat1(is)= nobs_sub(mm1,is) + nsat1(is)= nobs_sub(mm1,is) else obproc:do ii=1,npe if(nobs_sub(ii,is) > 0)then diff --git a/src/gsi/obsmod.F90 b/src/gsi/obsmod.F90 index c60eabfab1..8d46a51d2a 100644 --- a/src/gsi/obsmod.F90 +++ b/src/gsi/obsmod.F90 @@ -155,6 +155,7 @@ module obsmod ! model (e.g., HWRF) aircraft recon dynamic ! observation error (DOE) specification to ! GSI namelist level. +! 2020-09-15 Wu - add option tcp_posmatch to mitigate possibility of erroneous TC initialization ! ! Subroutines Included: ! sub init_obsmod_dflts - initialize obs related variables to default values @@ -174,6 +175,9 @@ module obsmod ! Variable Definitions: ! def oberror_tune - namelist logical to tune (=true) oberror ! def perturb_obs - namelist logical to perturb (=true) observations +! def tcp_posmatch - namelist integer =1 to move TC to guess position, +! =2 set pges to the minimum Psfc +! def tcp_box - namelist integer (=5) to define search box size in gridpoints ! def perturb_fact - namelist scaling factor for observation perturbations ! def write_diag - namelist logical array to compute/write (=true) diag files ! def diag_radardbz- namelist logical to compute/write (=true) radar @@ -427,8 +431,8 @@ module obsmod public :: diag_radardbz public :: lsaveobsens public :: iout_cldch, mype_cldch - public :: nprof_gps,time_offset,ianldate - public :: iout_oz,iout_co,dsis,ref_obs,obsfile_all,lobserver,perturb_obs,ditype,dsfcalc,dplat + public :: nprof_gps,time_offset,ianldate,tcp_box + public :: iout_oz,iout_co,dsis,ref_obs,obsfile_all,lobserver,tcp_posmatch,perturb_obs,ditype,dsfcalc,dplat public :: time_window,dval,dtype,dfile,dirname,obs_setup,oberror_tune,offtime_data public :: lobsdiagsave,lobsdiag_forenkf,blacklst,hilbert_curve,lobskeep,time_window_max,sfcmodel,ext_sonde public :: neutral_stability_windfact_2dvar @@ -460,7 +464,7 @@ module obsmod ! ==== DBZ DA === public :: ntilt_radarfiles public :: whichradar - public :: vr_dealisingopt, if_vterminal, if_model_dbz, inflate_obserr, if_vrobs_raw + public :: vr_dealisingopt, if_vterminal, if_model_dbz, inflate_obserr, if_vrobs_raw, l2rwthin public :: doradaroneob,oneoblat,oneoblon public :: oneobddiff,oneobvalue,oneobheight,oneobradid @@ -482,6 +486,7 @@ module obsmod public :: l_wcp_cwm public :: aircraft_recon + public :: hurricane_radar ! The following public variables are the coefficients that describe ! the linear regression fits that are used to define the dynamic @@ -496,7 +501,7 @@ module obsmod ! 1/237: Dropsonde observations. - ! 292: SFMR observations. + ! 213: SFMR observations. ! The following correspond to the specific humidity (q) ! observations: @@ -517,10 +522,10 @@ module obsmod public :: uv_doe_a_236 public :: uv_doe_a_237 - public :: uv_doe_a_292 + public :: uv_doe_a_213 public :: uv_doe_b_236 public :: uv_doe_b_237 - public :: uv_doe_b_292 + public :: uv_doe_b_213 interface obsmod_init_instr_table @@ -595,10 +600,10 @@ module obsmod real(r_kind) ,allocatable,dimension(:):: dval real(r_kind) ,allocatable,dimension(:):: time_window - integer(i_kind) ntilt_radarfiles + integer(i_kind) ntilt_radarfiles,tcp_posmatch,tcp_box logical :: doradaroneob - logical :: vr_dealisingopt, if_vterminal, if_model_dbz, inflate_obserr, if_vrobs_raw + logical :: vr_dealisingopt, if_vterminal, if_model_dbz, inflate_obserr, if_vrobs_raw, l2rwthin character(4) :: whichradar,oneobradid real(r_kind) :: oneoblat,oneoblon,oneobddiff,oneobvalue,oneobheight logical :: radar_no_thinning @@ -634,6 +639,7 @@ module obsmod logical l_wcp_cwm logical aircraft_recon + logical hurricane_radar character(len=*),parameter:: myname='obsmod' @@ -650,7 +656,7 @@ module obsmod ! 1/237: Dropsonde observations. - ! 292: SFMR observations. + ! 213: SFMR observations. ! The following correspond to the specific humidity (q) ! observations: @@ -667,7 +673,7 @@ module obsmod real(r_kind) :: uv_doe_a_236, uv_doe_b_236 real(r_kind) :: uv_doe_a_237, uv_doe_b_237 - real(r_kind) :: uv_doe_a_292, uv_doe_b_292 + real(r_kind) :: uv_doe_a_213, uv_doe_b_213 contains @@ -718,6 +724,7 @@ subroutine init_obsmod_dflts ntilt_radarfiles=1 vr_dealisingopt=.false. if_vterminal=.false. + l2rwthin =.false. if_vrobs_raw=.false. if_model_dbz=.true. inflate_obserr=.false. @@ -751,6 +758,8 @@ subroutine init_obsmod_dflts ! Set logical flag perturb_obs = .false. ! .true. = perturb observations + tcp_posmatch = 0 + tcp_box = 5 oberror_tune = .false. ! .true. = tune oberror perturb_fact = one do i=0,50 @@ -892,6 +901,7 @@ subroutine init_obsmod_dflts l_wcp_cwm = .false. ! .true. = use operator that involves cwm aircraft_recon = .false. ! .true. = use DOE for aircraft data + hurricane_radar = .false. ! .true. = use radar data for hurricane application ! The following variable initializations pertain to the ! coefficients that describe the linear regression fits that are @@ -907,7 +917,7 @@ subroutine init_obsmod_dflts ! 1/237: Dropsonde observations. - ! 292: SFMR observations. + ! 213: SFMR observations. ! The following correspond to the specific humidity (q) ! observations: @@ -930,8 +940,8 @@ subroutine init_obsmod_dflts uv_doe_b_236 = 0.0_r_kind uv_doe_a_237 = 1.0_r_kind uv_doe_b_237 = 0.0_r_kind - uv_doe_a_292 = 1.0_r_kind - uv_doe_b_292 = 0.0_r_kind + uv_doe_a_213 = 1.0_r_kind + uv_doe_b_213 = 0.0_r_kind return end subroutine init_obsmod_dflts @@ -971,7 +981,7 @@ subroutine init_directories(mype) if (lrun_subdirs) then write(pe_name,'(i4.4)') mype dirname = 'dir.'//trim(pe_name)//'/' - command = 'mkdir -m 755 ' // trim(dirname) + command = 'mkdir -p -m 755 ' // trim(dirname) call system(command) else write(pe_name,100) mype diff --git a/src/gsi/pcgsoi.f90 b/src/gsi/pcgsoi.f90 index 31b1c6ac2d..bce3aa0835 100644 --- a/src/gsi/pcgsoi.f90 +++ b/src/gsi/pcgsoi.f90 @@ -127,13 +127,12 @@ subroutine pcgsoi() use obsmod, only: destroyobs,oberror_tune,luse_obsdiag use jfunc, only: iter,jiter,jiterstart,niter,miter,iout_iter,& nclen,penorig,gnormorig,xhatsave,yhatsave,& - iguess,read_guess_solution,diag_precon,step_start, & - niter_no_qc,print_diag_pcg,lgschmidt + iguess,read_guess_solution, & + niter_no_qc,print_diag_pcg use gsi_4dvar, only: nobs_bins, nsubwin, l4dvar, iwrtinc, ladtest, & iorthomax - use gridmod, only: twodvar_regional + use gridmod, only: twodvar_regional,periodic use constants, only: zero,one,tiny_r_kind - use anberror, only: anisotropic use mpimod, only: mype use mpl_allreducemod, only: mpl_allreduce use intallmod, only: intall @@ -145,13 +144,11 @@ subroutine pcgsoi() use state_vectors, only : allocate_state,deallocate_state,& prt_state_norms,inquire_state use bias_predictors, only: allocate_preds,deallocate_preds,predictors,assignment(=) + use anberror, only: anisotropic use bias_predictors, only: update_bias_preds use xhat_vordivmod, only : xhat_vordiv_init, xhat_vordiv_calc, xhat_vordiv_clean use timermod, only: timer_ini,timer_fnl - use projmethod_support, only: init_mgram_schmidt, & - mgram_schmidt,destroy_mgram_schmidt - use hybrid_ensemble_parameters,only : l_hyb_ens,aniso_a_en,ntlevs_ens - use hybrid_ensemble_isotropic, only: bkerror_a_en + use hybrid_ensemble_parameters,only : l_hyb_ens,ntlevs_ens use gsi_bundlemod, only : gsi_bundle use gsi_bundlemod, only : self_add,assignment(=) use gsi_bundlemod, only : gsi_bundleprint @@ -159,8 +156,9 @@ subroutine pcgsoi() use rapidrefresh_cldsurf_mod, only: i_gsdcldanal_type use gsi_io, only: verbose use berror, only: vprecond - use stpjomod, only: stpjo_setup + + implicit none ! Declare passed variables @@ -181,7 +179,7 @@ subroutine pcgsoi() real(r_kind),dimension(3):: gnorm real(r_kind) :: zgini,zfini,fjcost(4),fjcostnew(4),zgend,zfend real(r_kind) :: fjcost_e - type(control_vector) :: xhat,gradx,grady,dirx,diry,ydiff,xdiff + type(control_vector) :: gradx,grady,dirx,diry,ydiff,xdiff type(gsi_bundle) :: sval(nobs_bins), rval(nobs_bins) type(gsi_bundle) :: eval(ntlevs_ens) type(gsi_bundle) :: mval(nsubwin) @@ -191,7 +189,7 @@ subroutine pcgsoi() type(control_vector), allocatable, dimension(:) :: cglworkhat integer(i_kind) :: iortho logical :: print_verbose - logical:: lanlerr + logical :: lanlerr,read_success ! Step size diagnostic strings data step /'good', 'SMALL'/ @@ -208,16 +206,17 @@ subroutine pcgsoi() ! Set constants. Initialize variables. restart=.false. - if (jiter==0 .and. (iguess==1 .or. iguess==2)) restart=.true. + if (jiter==jiterstart .and. (iguess==1 .or. iguess==2)) restart=.true. pennorm=10.e50_r_double iout_6=.true. if (iout_iter==6) iout_6=.false. - stp=step_start - if(diag_precon)stp=one + stp=one small_step=1.e-2_r_kind*stp end_iter=.false. llouter=.false. + gnorm=zero gsave=zero + read_success=.false. ! Convergence criterion needs to be relaxed a bit for anisotropic mode, @@ -234,7 +233,6 @@ subroutine pcgsoi() call init_ if(print_diag_pcg)call prt_guess('guess') - if ( lanlerr .and. lgschmidt ) call init_mgram_schmidt nlnqc_iter=.false. call stpjo_setup(nobs_bins) @@ -250,6 +248,10 @@ subroutine pcgsoi() cglworkhat(ii)=zero END DO end if + do ii=1,nobs_bins + sval(ii)=zero + end do + sbias=zero ! Perform inner iteration inner_iteration: do iter=0,niter(jiter) @@ -264,39 +266,16 @@ subroutine pcgsoi() varqc_iter=one endif end if - +! 1. Calculate gradient do ii=1,nobs_bins rval(ii)=zero end do + rbias=zero gradx=zero - llprt=(mype==0).and.(iter<=1) - -! Convert from control space directly to physical -! space for comparison with obs. - call control2state(xhat,mval,sbias) - if (l4dvar) then - if (l_hyb_ens) then - call ensctl2state(xhat,mval(1),eval) - mval(1)=eval(1) - end if - -! Perform test of AGCM TLM and ADM - call gsi_4dcoupler_grtests(mval,sval,nsubwin,nobs_bins) -! Run TL model to fill sval - call model_tl(mval,sval,llprt) - else - if (l_hyb_ens) then - call ensctl2state(xhat,mval(1),eval) - do ii=1,nobs_bins - sval(ii)=eval(ii) - end do - else - do ii=1,nobs_bins - sval(ii)=mval(1) - end do - end if - end if + llprt=(mype==0).and.(iter<=1) +! Control to state +! call c2s(xhat,sval,sbias,llprt,.true.) if (iter<=1 .and. print_diag_pcg) then do ii=1,nobs_bins @@ -313,35 +292,8 @@ subroutine pcgsoi() enddo endif -! Adjoint of convert control var to physical space - if (l4dvar) then -! Run adjoint model - call model_ad(mval,rval,llprt) - - if (l_hyb_ens) then - eval(1)=mval(1) - call ensctl2state_ad(eval,mval(1),gradx) - end if - else - -! Convert to control space directly from physical space. - if (l_hyb_ens) then - do ii=1,nobs_bins - eval(ii)=rval(ii) - end do - call ensctl2state_ad(eval,mval(1),gradx) - else - mval(1)=rval(1) - if (nobs_bins > 1 ) then - do ii=2,nobs_bins - call self_add(mval(1),rval(ii)) - enddo - end if - end if - - end if - call control2state_ad(mval,rbias,gradx) -! End adjoint of convert control var to physical space +! Adjoint of control to state + call c2s_ad(gradx,rval,rbias,llprt) ! Print initial Jo table if (iter==0 .and. print_diag_pcg .and. luse_obsdiag) then @@ -354,6 +306,7 @@ subroutine pcgsoi() do i=1,nclen gradx%values(i)=gradx%values(i)+yhatsave%values(i) end do +! End of gradient calculation ! Re-orthonormalization if requested if(iorthomax>0) then @@ -368,26 +321,8 @@ subroutine pcgsoi() end if end if -! Multiply by background error - if(anisotropic) then - call anbkerror(gradx,grady) - if(lanlerr .and. lgschmidt) call mgram_schmidt(gradx,grady) - else - call bkerror(gradx,grady) - end if - -! If hybrid ensemble run, then multiply ensemble control variable a_en -! by its localization correlation - if(l_hyb_ens) then - if(aniso_a_en) then - ! call anbkerror_a_en(gradx,grady) ! not available yet - write(6,*)' ANBKERROR_A_EN not written yet, program stops' - stop - else - call bkerror_a_en(gradx,grady) - end if - - end if +! 2. Multiply by background error + call multb(lanlerr,gradx,grady) if(iorthomax>0) then ! save gradients @@ -400,14 +335,11 @@ subroutine pcgsoi() end if end if - if (iter==0 .and. print_diag_pcg) then - call prt_control_norms(grady,'grady') - endif -! Calculate new norm of gradients - if (iter>0) gsave=gnorm(3) +! 3. Calculate new norm of gradients and factors going into b calculation dprod(1) = qdot_prod_sub(gradx,grady) - if(diag_precon)then + if(iter > 0)then + gsave=gnorm(3) if (lanlerr) then ! xdiff used as a temporary array do i=1,nclen @@ -436,99 +368,72 @@ subroutine pcgsoi() gnorm(3)=dprod(4) end if else - if (lanlerr) then - call mpl_allreduce(1,qpvals=dprod) - gnorm(2)=dprod(1) - gnorm(3)=dprod(1) - else - do i=1,nclen - xdiff%values(i)=gradx%values(i)-xdiff%values(i) - ydiff%values(i)=grady%values(i)-ydiff%values(i) - end do - dprod(2) = qdot_prod_sub(xdiff,grady) - dprod(3) = qdot_prod_sub(ydiff,gradx) - call mpl_allreduce(3,qpvals=dprod) -! Two dot products in gnorm(2) should be same, but are slightly -! different due to round off, so use average. - gnorm(2)=0.5_r_quad*(dprod(2)+dprod(3)) - gnorm(3)=dprod(1) - end if +! xdiff used as a temporary array + do i=1,nclen + xdiff%values(i)=vprecond(i)*gradx%values(i) + end do + dprod(2) = qdot_prod_sub(xdiff,grady) + call mpl_allreduce(2,qpvals=dprod) + if(print_diag_pcg) call prt_control_norms(grady,'grady') + gnorm(3)=dprod(2) + end if gnorm(1)=dprod(1) + if(mype == 0)write(iout_iter,*)'Minimization iteration',iter + +! 4. Calculate b and new search direction b=zero - if (gsave>1.e-16_r_kind .and. iter>0) b=gnorm(2)/gsave - if(mype == 0)write(iout_iter,*)'Minimization iteration',iter - if (b7.0_r_kind) then - if (mype==0) then - if (iout_6) write(6,105) gnorm(2),gsave,b - write(iout_iter,105) gnorm(2),gsave,b + if (.not. restart .or. iter > 0) then + if (gsave>1.e-16_r_kind .and. iter>0) b=gnorm(2)/gsave + if (b7.0_r_kind) then + if (mype==0) then + if (iout_6) write(6,105) gnorm(2),gsave,b + write(iout_iter,105) gnorm(2),gsave,b + endif + b=zero endif - b=zero - endif - if (mype==0 .and. print_verbose) write(6,888)'pcgsoi: gnorm(1:3),b=',gnorm,b + if (mype==0 .and. print_verbose) write(6,888)'pcgsoi: gnorm(1:3),b=',gnorm,b + if(read_success .and. iter == 1)b=zero -! Calculate new search direction - if (.not. restart) then - if(.not. lanlerr)then + if (.not. lanlerr) then do i=1,nclen xdiff%values(i)=gradx%values(i) ydiff%values(i)=grady%values(i) end do end if - if(diag_precon)then - do i=1,nclen - dirx%values(i)=-vprecond(i)*grady%values(i)+b*dirx%values(i) - diry%values(i)=-vprecond(i)*gradx%values(i)+b*diry%values(i) - end do - else - do i=1,nclen - dirx%values(i)=-grady%values(i)+b*dirx%values(i) - diry%values(i)=-gradx%values(i)+b*diry%values(i) - end do - end if +! Calculate new search direction + do i=1,nclen + dirx%values(i)=-vprecond(i)*grady%values(i)+b*dirx%values(i) + diry%values(i)=-vprecond(i)*gradx%values(i)+b*diry%values(i) + end do else ! If previous solution available, transfer into local arrays. - if( .not. lanlerr)then - xdiff=zero - ydiff=zero - end if - call read_guess_solution(dirx,diry,mype) - stp=one +! Fill with grady first so that if we read in part of diry there is something + do i=1,nclen + diry%values(i)=-vprecond(i)*gradx%values(i) + end do + call read_guess_solution(diry,mype,read_success) +! Multiply by background error + call multb(lanlerr,diry,dirx) endif +! 5. Calculate stepsize and update solution ! Convert search direction from control space to physical space - call control2state(dirx,mval,rbias) - if (l4dvar) then - if (l_hyb_ens) then - call ensctl2state(dirx,mval(1),eval) - mval(1)=eval(1) - end if - - call model_tl(mval,rval,llprt) - else - - if (l_hyb_ens) then - call ensctl2state(dirx,mval(1),eval) - do ii=1,nobs_bins - rval(ii)=eval(ii) - end do - else - do ii=1,nobs_bins - rval(ii)=mval(1) - end do - end if - - end if + do ii=1,nobs_bins + rval(ii)=zero + end do + rbias=zero + call c2s(dirx,rval,rbias,.false.,.true.) ! Calculate stepsize - call stpcalc(stp,sval,sbias,xhat,dirx,rval,rbias, & + call stpcalc(stp,sval,sbias,dirx,rval,rbias, & diry,penalty,penaltynew,fjcost,fjcostnew,end_iter) if (lanlerr) call writeout_gradients(gradx,grady,niter(jiter),stp,b,mype) -! Diagnostic calculations +! 6. Diagnostic calculations if (iter==0) then if(jiter==jiterstart .or. oberror_tune) then gnormorig=gnorm(1) @@ -570,7 +475,7 @@ subroutine pcgsoi() 9992 format(A,2(1X,I3),4(1X,ES25.18),1x,A6) 9993 format(A,2(1X,I3),2(1X,ES25.18),A1) -! Check for convergence or failure of algorithm +! 7. Check for convergence or failure of algorithm if(gnormx < converge .or. penalty < converge .or. & penx >= pennorm .or. end_iter)then @@ -625,22 +530,11 @@ subroutine pcgsoi() enddo deallocate(cglworkhat) end if - if (lanlerr .and. lgschmidt) call destroy_mgram_schmidt ! Calculate adjusted observation error factor if( oberror_tune .and. (.not.l4dvar) ) then if (mype == 0) write(6,*) 'PCGSOI: call penal for obs perturbation' - call control2state(xhat,mval,sbias) - if (l_hyb_ens) then - call ensctl2state(xhat,mval(1),eval) - do ii=1,nobs_bins - sval(ii)=eval(ii) - end do - else - do ii=1,nobs_bins - sval(ii)=mval(1) - end do - end if +! call c2s(xhat,sval,sbias,.false.,.false.) call penal(sval(1)) xhatsave=zero @@ -654,25 +548,7 @@ subroutine pcgsoi() if (l_tlnmc .and. baldiag_inc) call strong_baldiag_inc(sval,size(sval)) llprt=(mype==0) - call control2state(xhat,mval,sbias) - if (l4dvar) then - if (l_hyb_ens) then - call ensctl2state(xhat,mval(1),eval) - mval(1)=eval(1) - end if - call model_tl(mval,sval,llprt) - else - if (l_hyb_ens) then - call ensctl2state(xhat,mval(1),eval) - do ii=1,nobs_bins - sval(ii)=eval(ii) - end do - else - do ii=1,nobs_bins - sval(ii)=mval(1) - end do - end if - end if +! call c2s(xhat,sval,sbias,llprt,.false.) if(print_diag_pcg)then @@ -684,28 +560,7 @@ subroutine pcgsoi() end do call intall(sval,sbias,rval,rbias) gradx=zero - if (l4dvar) then - call model_ad(mval,rval,llprt) - if (l_hyb_ens) then - eval(1)=mval(1) - call ensctl2state_ad(eval,mval(1),gradx) - end if - else - if (l_hyb_ens) then - do ii=1,nobs_bins - eval(ii)=rval(ii) - end do - call ensctl2state_ad(eval,mval(1),gradx) - else - mval(1)=rval(1) - if (nobs_bins > 1 ) then - do ii=2,nobs_bins - call self_add(mval(1),rval(ii)) - enddo - end if - end if - end if - call control2state_ad(mval,rbias,gradx) + call c2s_ad(gradx,rval,rbias,llprt) ! Add contribution from background term do i=1,nclen @@ -713,24 +568,7 @@ subroutine pcgsoi() end do ! Multiply by background error - if(anisotropic) then - call anbkerror(gradx,grady) - else - call bkerror(gradx,grady) - end if - -! If hybrid ensemble run, then multiply ensemble control variable a_en -! by its localization correlation - if(l_hyb_ens) then - if(aniso_a_en) then - ! call anbkerror_a_en(gradx,grady) ! not available yet - write(6,*)' ANBKERROR_A_EN not written yet, program stops' - stop - else - call bkerror_a_en(gradx,grady) - end if - - end if + call multb(lanlerr,gradx,grady) ! Print final Jo table zgend=dot_product(gradx,grady,r_quad) @@ -804,6 +642,7 @@ subroutine pcgsoi() endif endif + ! Write output analysis files if(.not.l4dvar) call prt_guess('analysis') call prt_state_norms(sval(1),'increment') @@ -863,11 +702,9 @@ subroutine init_ ! !$$$ end documentation block - use jfunc, only: diag_precon implicit none ! Allocate local variables - call allocate_cv(xhat) call allocate_cv(gradx) call allocate_cv(grady) call allocate_cv(dirx) @@ -894,7 +731,6 @@ subroutine init_ diry=zero ydiff=zero xdiff=zero - xhat=zero end subroutine init_ @@ -920,7 +756,6 @@ subroutine clean_ ! !$$$ end documentation block - use jfunc, only: diag_precon use m_obsdiags, only: obsdiags_reset use obsmod, only: destroyobs,lobsdiagsave implicit none @@ -930,7 +765,6 @@ subroutine clean_ if (.not.l4dvar) call obsdiags_reset(obsdiags_keep=lobsdiagsave) ! replacing destroyobs() ! Release state-vector memory - call deallocate_cv(xhat) call deallocate_cv(gradx) call deallocate_cv(grady) call deallocate_cv(dirx) @@ -955,6 +789,241 @@ subroutine clean_ ! call inquire_state end subroutine clean_ + +subroutine periodic_(gradx) +!$$$ subprogram documentation block +! . . . . +! subprogram: periodic_ ensure grad x is periodic +! prgmmr: Todling +! +! abstract: ensure gradx is periodic +! +! program history log: +! 2021-02-02 Derber +! +! input argument list: +! gradx - gradient of x +! +! output argument list: +! gradx - gradient of x +! +! attributes: +! language: f90 +! machine: +! +!$$$ end documentation block + + use gridmod, only: nlat,nlon + use general_commvars_mod, only: s2g_cv + use general_sub2grid_mod, only: general_sub2grid,general_grid2sub + implicit none + + type(control_vector),intent(inout) :: gradx + real(r_kind),dimension(nlat*nlon*s2g_cv%nlevs_alloc)::workcv + +! If dealing with periodic (sub)domain, gather full domain grids, +! account for periodicity, and redistribute to subdomains. This +! only needs to be done when running with a single mpi task and +! then only for array gradx. + do ii=1,nsubwin + call general_sub2grid(s2g_cv,gradx%step(ii)%values,workcv) + call general_grid2sub(s2g_cv,workcv,gradx%step(ii)%values) + end do + + +end subroutine periodic_ + +subroutine multb(lanlerr,vec1,vec2) +!$$$ subprogram documentation block +! . . . . +! subprogram: multb multiply vec1 by background error to equal vec2 +! prgmmr: derber +! +! abstract: multply vec1 by background error +! +! program history log: +! 2021-01-25 derber +! +! input argument list: +! vec1 - input vector +! +! output argument list: +! vec2 - output vector +! +! attributes: +! language: f90 +! machine: +! +!$$$ end documentation block + + use hybrid_ensemble_parameters,only : l_hyb_ens,aniso_a_en + use hybrid_ensemble_isotropic, only: bkerror_a_en + use control_vectors, only: control_vector + implicit none + + type(control_vector),intent(inout) :: vec1 + type(control_vector),intent(inout) :: vec2 + logical ,intent(in ) :: lanlerr + + if(periodic)call periodic_(vec1) +! start by setting vec2=vec1 and then operate on vec2 (unless gram_schmidt) + vec2=vec1 +! Multiply by background error + if(anisotropic) then + call anbkerror(vec2) + else + call bkerror(vec2) + end if + +! If hybrid ensemble run, then multiply ensemble control variable a_en +! by its localization correlation + if(l_hyb_ens) then + if(aniso_a_en) then + ! call anbkerror_a_en(grady) ! not available yet + write(6,*)' ANBKERROR_A_EN not written yet, program stops' + stop + else + call bkerror_a_en(vec2) + end if + + end if + return +end subroutine multb +subroutine c2s(hat,val,bias,llprt,ltest) +!$$$ subprogram documentation block +! . . . . +! subprogram: multb control2state for all options +! prgmmr: derber +! +! abstract: generalized control2state +! +! program history log: +! 2021-01-25 derber +! +! input argument list: +! vec1 - input vector +! +! output argument list: +! vec2 - output vector +! +! attributes: +! language: f90 +! machine: +! +!$$$ end documentation block + + use hybrid_ensemble_parameters,only : l_hyb_ens + use hybrid_ensemble_isotropic, only: bkerror_a_en + use control_vectors, only: control_vector + use bias_predictors, only: predictors + use gsi_bundlemod, only : gsi_bundle,assignment(=) + use gsi_4dvar, only: nobs_bins, nsubwin, l4dvar + use gsi_4dcouplermod, only : gsi_4dcoupler_grtests + implicit none + + type(control_vector) ,intent(inout) :: hat + type(gsi_bundle) ,dimension(nobs_bins),intent(inout) :: val + type(predictors) ,intent(inout) :: bias + logical ,intent(in ) :: llprt,ltest + + +! Convert from control space directly to physical +! space for comparison with obs. + call control2state(hat,mval,bias) + if (l4dvar) then + if (l_hyb_ens) then + call ensctl2state(hat,mval(1),eval) + mval(1)=eval(1) + end if + +! Perform test of AGCM TLM and ADM + if(ltest)call gsi_4dcoupler_grtests(mval,val,nsubwin,nobs_bins) + +! Run TL model to fill val + call model_tl(mval,val,llprt) + else + if (l_hyb_ens) then + call ensctl2state(hat,mval(1),eval) + do ii=1,nobs_bins + val(ii)=eval(ii) + end do + else + do ii=1,nobs_bins + val(ii)=mval(1) + end do + end if + end if + return +end subroutine c2s +subroutine c2s_ad(hat,val,bias,llprt) +!$$$ subprogram documentation block +! . . . . +! subprogram: multb control2state for all options +! prgmmr: derber +! +! abstract: generalized control2state +! +! program history log: +! 2021-01-25 derber +! +! input argument list: +! vec1 - input vector +! +! output argument list: +! vec2 - output vector +! +! attributes: +! language: f90 +! machine: +! +!$$$ end documentation block + + use hybrid_ensemble_parameters,only : l_hyb_ens + use hybrid_ensemble_isotropic, only: bkerror_a_en + use control_vectors, only: control_vector + use bias_predictors, only: predictors + use gsi_bundlemod, only : gsi_bundle,assignment(=) + use gsi_bundlemod, only : self_add + use gsi_4dvar, only: nobs_bins, nsubwin, l4dvar + implicit none + + type(control_vector) ,intent(inout) :: hat + type(gsi_bundle) ,dimension(nobs_bins),intent(inout) :: val + type(predictors) ,intent(inout) :: bias + logical ,intent(in ) :: llprt + + +! Adjoint of convert control var to physical space + if (l4dvar) then +! Run adjoint model + call model_ad(mval,val,llprt) + + if (l_hyb_ens) then + eval(1)=mval(1) + call ensctl2state_ad(eval,mval(1),hat) + end if + else + +! Convert to control space directly from physical space. + if (l_hyb_ens) then + do ii=1,nobs_bins + eval(ii)=val(ii) + end do + call ensctl2state_ad(eval,mval(1),hat) + else + mval(1)=val(1) + if (nobs_bins > 1 ) then + do ii=2,nobs_bins + call self_add(mval(1),val(ii)) + enddo + end if + end if + + end if + call control2state_ad(mval,bias,hat) +! End adjoint of convert control var to physical space + return +end subroutine c2s_ad end subroutine pcgsoi diff --git a/src/gsi/projmethod_support.f90 b/src/gsi/projmethod_support.f90 index 156161dbc8..51b5e78633 100644 --- a/src/gsi/projmethod_support.f90 +++ b/src/gsi/projmethod_support.f90 @@ -1,394 +1,3 @@ -module projmethod_support -!$$$ module documentation block -! . . . . -! module: projmethod_support -! -! abstract: -! -! program history log: -! 2007-10-01 pondeca -! 2010-08-19 lueken - add only to module use -! -! subroutines included: -! sub init_mgram_schmidt -! sub destroy_mgram_schmidt -! sub mgram_schmidt -! -! functions included: -! dplev_mask -! fast_dplev -! dplev5 -! -! variable definition: -! -! attributes: -! language: f90 -! machine: -! -!$$$ end documentation block - -! Uses: - use kinds, only: r_kind - use control_vectors, only: control_vector - - implicit none - -PRIVATE -PUBLIC init_mgram_schmidt, mgram_schmidt, & - destroy_mgram_schmidt - -! Declare local variables - real(r_kind),allocatable,dimension(:,:)::gx,gy - -contains - -subroutine init_mgram_schmidt -!$$$ subprogram documentation block -! . . . . -! subprogram: init_mgram_schmidt -! prgmmr: -! -! abstract: -! -! program history log: -! 2009-09-22 lueken - added subprogram doc block -! -! input argument list: -! -! output argument list: -! -! attributes: -! language: f90 -! machine: -! -!$$$ end documentation block - - use jfunc, only: nclen,jiter,niter - - implicit none - -! Declare passed variables - -! Declare local variables - - allocate(gx(nclen,0:niter(jiter))) - allocate(gy(nclen,0:niter(jiter))) - -end subroutine init_mgram_schmidt - -subroutine destroy_mgram_schmidt -!$$$ subprogram documentation block -! . . . . -! subprogram: destroy_mgram_schmidt -! prgmmr: -! -! abstract: -! -! program history log: -! 2009-09-22 lueken - added subprogram doc block -! -! input argument list: -! -! output argument list: -! -! attributes: -! language: f90 -! machine: -! -!$$$ end documentation block - - implicit none - -! Declare passed variables - - deallocate(gx) - deallocate(gy) - -end subroutine destroy_mgram_schmidt - -subroutine mgram_schmidt(gradx,grady) -!$$$ subprogram documentation block -! . . . . -! subprogram: mgram_schmidt -! prgmmr: pondeca org: np22 date: 2007-08-01 -! -! abstract: apply modified gram-schmidt orthoginalization procedure -! to set of bi-orthogonal vectors -! -! program history log: -! 2007-08-01 pondeca -! -! input argument list: -! gradx - gradient of the cost function w.r.t control variable -! grady - B*(gradx) where B is background error covariance matrix -! -! -! output argument list: -! gradx - modified gradient of the cost function -! grady - modified B*(gradx) -! -! -! remarks: -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ - use kinds, only: i_kind - use jfunc, only: iter,nclen - use constants, only: tiny_r_kind - use mpimod, only: mype - - implicit none - -! Declare passed variables - type(control_vector),intent(inout) :: gradx,grady - -! Declare local variables - integer(i_kind) i,k - real(r_kind) prd0 -!********************************************************************** - - gx(1:nclen,iter)=gradx%values(1:nclen) - gy(1:nclen,iter)=grady%values(1:nclen) - -!==> orthogonalization + renormalization - - do k=1,2 - do i=0,iter-1 - prd0=dplev_mask(gy(1,iter),gx(1,i),mype) - gx(1:nclen,iter)=gx(1:nclen,iter)-gx(1:nclen,i)*prd0 - gy(1:nclen,iter)=gy(1:nclen,iter)-gy(1:nclen,i)*prd0 - enddo - prd0=dplev_mask(gx(1,iter),gy(1,iter),mype) - if (prd0 <= tiny_r_kind) then - if (mype==0) then - print*,'in mgram_schmidt: unable to bi-orthogonalize due to round-off error for iter,k=',iter,k - print*,'in mgram_schmidt: likely to happen when using fast version of inner product' - print*,'in mgram_schmidt: iter,k,prd0=',iter,k,prd0 - endif - return - endif - gx(1:nclen,iter)=gx(1:nclen,iter)/sqrt(prd0) - gy(1:nclen,iter)=gy(1:nclen,iter)/sqrt(prd0) - enddo - -!==> update gradx and grady and put correct B-norm back - - prd0=dplev_mask(gradx%values,grady%values,mype) - gradx%values(1:nclen)=gx(1:nclen,iter)*sqrt(prd0) - grady%values(1:nclen)=gy(1:nclen,iter)*sqrt(prd0) - -contains - -real(r_kind) function dplev_mask(dx,dy,mype) -!$$$ subprogram documentation block -! . . . . -! subprogram: dplev_mask -! prgmmr: -! -! abstract: -! -! program history log: -! 2009-09-22 lueken - added subprogram doc block -! -! input argument list: -! mype -! dx,dy -! -! output argument list: -! -! attributes: -! language: f90 -! machine: -! -!$$$ end documentation block - - use jfunc, only: nval_levs - use gridmod, only: lat2,lon2,twodvar_regional - implicit none - -! Declar passed variables - real(r_kind),dimension(lat2,lon2,nval_levs),intent(in ) :: dx,dy - integer(i_kind) ,intent(in ) :: mype - -! Declare local variables - logical mask(nval_levs) - logical fast - - fast=.false. - mask=.true. -! set fast to .true. for twodvar_regional, -! substantially faster, but no roundoff error reduction and -! results differ for different number of processors. -! if(twodvar_regional) then -!! fast=.true. -! mask(5)=.false. -! mask(6)=.false. -! mask(8)=.false. -! end if - - if(fast) then - dplev_mask=fast_dplev(dx,dy,mask) - else - dplev_mask=dplev5(dx,dy,mype,mask) - end if - -end function dplev_mask - -real(r_kind) function fast_dplev(dx,dy,mask) -!$$$ subprogram documentation block -! . . . . -! subprogram: fast_dplev -! prgmmr: -! -! abstract: -! -! program history log: -! 2009-09-22 lueken - added subprogram doc block -! -! input argument list: -! dx,dy -! mask -! -! output argument list: -! -! attributes: -! language: f90 -! machine: -! -!$$$ end documentation block - - use jfunc, only: nval_levs - use gridmod, only: lat2,lon2 - use mpimod, only: npe,mpi_comm_world,ierror,mpi_rtype - use constants, only: zero - implicit none - -! Declar passed variables - real(r_kind),dimension(lat2,lon2,nval_levs),intent(in ) :: dx,dy - logical ,intent(in ) :: mask(nval_levs) - -! Declare local variables - real(r_kind),dimension(npe):: sumall - - integer(i_kind) i,j,k - real(r_kind) sum - - sum=zero - do k=1,nval_levs - if(.not.mask(k)) cycle - do j=2,lon2-1 - do i=2,lat2-1 - sum=sum+dx(i,j,k)*dy(i,j,k) - end do - end do - end do - - call mpi_allgather(sum,1,mpi_rtype,sumall,1,mpi_rtype,mpi_comm_world,ierror) - fast_dplev=zero - do i=1,npe - fast_dplev=fast_dplev+sumall(i) - end do - -end function fast_dplev - -real(r_kind) function dplev5(dx,dy,mype,mask) -!$$$ subprogram documentation block -! . . . . -! subprogram: dplev calculates dot product for data on subdomain -! prgmmr: derber org: np23 date: 2004-05-13 -! -! abstract: calculates dot product for data on subdomain. Note loops over -! streamfunction, velocity potential, temperature, etc. Also, only -! over interior of subdomain. -! -! program history log: -! 2004-05-13 derber, document -! 2004-07-28 treadon - add only on use declarations; add intent in/out -! 2010-04-01 treadon - move strip to grimod -! 2013-10-25 todling - reposition ltosi and others to commvars -! -! input argument list: -! dx - input vector 1 -! dy - input vector 2 -! mype -! mask -! -! output argument list -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ - - use jfunc, only: nval_levs - use gridmod, only: nlat,nlon,lat2,lon2,lat1,lon1,& - iglobal,ijn,displs_g,strip - use general_commvars_mod, only: ltosi,ltosj - use mpimod, only: mpi_comm_world,ierror,mpi_rtype - use constants, only: zero - implicit none - -! Declare passed variables - real(r_kind),dimension(lat2,lon2,nval_levs),intent(in ) :: dx,dy - integer(i_kind) ,intent(in ) :: mype - logical ,intent(in ) :: mask(nval_levs) - -! Declare local variables - real(r_kind),dimension(lat1*lon1):: zsm - real(r_kind),dimension(iglobal):: work1 - real(r_kind),dimension(lat2,lon2):: sum - real(r_kind),dimension(nlat,nlon):: sumall - - integer(i_kind) i,j,k,mm1 - real(r_kind) e,y,temp - - mm1=mype+1 - sum=zero - do k=1,nval_levs - if(.not.mask(k)) cycle - do j=1,lon2 - do i=1,lat2 - sum(i,j)=sum(i,j)+dx(i,j,k)*dy(i,j,k) - end do - end do - end do - do j=1,lon1*lat1 - zsm(j)=zero - end do - - call strip(sum,zsm) - - call mpi_allgatherv(zsm,ijn(mm1),mpi_rtype,& - work1,ijn,displs_g,mpi_rtype,& - mpi_comm_world,ierror) - - do k=1,iglobal - i=ltosi(k) ; j=ltosj(k) - sumall(i,j)=work1(k) - end do - dplev5=zero - e=zero - do j=1,nlon - do i=1,nlat -! Compensated summation version of sum - temp=dplev5 - y=sumall(i,j)+e - dplev5=temp+y - e=(temp-dplev5)+y -! dplev=dplev+sumall(i,j) - end do - end do - -end function dplev5 - -end subroutine mgram_schmidt - -end module projmethod_support - subroutine writeout_gradients(dx,dy,nv,alpha,gamma,mype) !$$$ subprogram documentation block ! . . . . diff --git a/src/gsi/qcmod.f90 b/src/gsi/qcmod.f90 index 294b6e1443..1b6b8b705a 100644 --- a/src/gsi/qcmod.f90 +++ b/src/gsi/qcmod.f90 @@ -84,6 +84,7 @@ module qcmod ! sub create_qcvars ! sub destroy_qcvars ! sub errormod +! sub errormod_hdraob ! sub errormod_aircraft ! sub setup_tzr_qc - set up QC with Tz retrieval ! sub tz_retrieval - Apply Tz retrieval @@ -162,6 +163,7 @@ module qcmod public :: create_qcvars public :: destroy_qcvars public :: errormod + public :: errormod_hdraob public :: errormod_aircraft public :: setup_tzr_qc public :: qc_ssmi @@ -634,10 +636,10 @@ subroutine errormod(pq,vq,levs,plevs,errout,k,presl,dpres,nsig,lim_qm) implicit none integer(i_kind) ,intent(in ) :: levs,k,nsig,lim_qm - real(r_kind) ,dimension(255) ,intent(in ) :: plevs + real(r_kind) ,dimension(*) ,intent(in ) :: plevs real(r_kind) ,dimension(nsig) ,intent(in ) :: presl real(r_kind) ,dimension(nsig-1) ,intent(in ) :: dpres - integer(i_kind),dimension(255) ,intent(in ) :: pq,vq + integer(i_kind),dimension(*) ,intent(in ) :: pq,vq real(r_kind) ,intent(inout) :: errout integer(i_kind) n,l,ilev @@ -696,6 +698,114 @@ subroutine errormod(pq,vq,levs,plevs,errout,k,presl,dpres,nsig,lim_qm) return end subroutine errormod + subroutine errormod_hdraob(pq,vq,levs,plevs,errout,k,presl,dpres,nsig,lim_qm) +!$$$ subprogram documentation block +! . . . . +! subprogram: errormod +! prgmmr: derber org: np23 date: 2003-09-30 +! +! abstract: adjust observation error for conventional obs +! +! program history log: +! 2003-09-30 derber +! 2004-05-18 kleist, documentation +! 2004-10-26 kleist - add 0.5 half-layer factor +! 2006-02-15 treadon - add (l==levs,1) exit to upprof and dwprof loops +! 2006-12-20 Sienkiewicz multiply tiny_r_kind in errout div-by-zero +! check by expected largest value for numerator +! max(2*vmax) = max(dpres) ~= 5 cb +! 2008-04-23 safford - rm unused vars and uses +! 2008-09-05 lueken - merged ed's changes into q1fy09 code +! +! input argument list: +! pq - pressure quality mark +! vq - observation quality mark (t,q,wind) +! levs - number of levels in profile for observation +! plevs - observation pressures +! errout - observation error +! k - observation level +! presl - model pressure at half sigma levels +! dpres - delta pressure between model pressure levels +! nsig - number of vertical levels +! lim_qm - qc limit +! +! output argument list: +! errout - adjusted observation error +! +! attributes: +! language: f90 +! machine: ibm rs/6000 sp +! +!$$$ + implicit none + + integer(i_kind) ,intent(in ) :: levs,k,nsig,lim_qm + real(r_kind) ,dimension(*) ,intent(in ) :: plevs + real(r_kind) ,dimension(nsig) ,intent(in ) :: presl + real(r_kind) ,dimension(nsig-1) ,intent(in ) :: dpres + integer(i_kind),dimension(*) ,intent(in ) :: pq,vq + real(r_kind) ,intent(inout) :: errout + + integer(i_kind) n,l,ilev + real(r_kind):: vmag,pdiffu,pdiffd + + errout=one + if(levs == 1)return + ilev=1 + do n=2,nsig-1 + if(plevs(k) < presl(n))ilev=n + end do + vmag=abs(dpres(ilev)) + + pdiffu=vmag + pdiffd=vmag + if(pq(k) < lim_qm .and. vq(k) < lim_qm)then +! Move up through the profile. + l=k + +! Array plevs is only defined from l=1 to l=levs. Hence the check below + if (l+1<=levs) then + upprof: do while (abs(plevs(k)-plevs(l+1)) < vmag .and. l <= levs-1) + l=l+1 + if(pq(l) < lim_qm .and. vq(l) < lim_qm)then + pdiffu=abs(plevs(k)-plevs(l)) + exit upprof + end if + if (l==levs) exit upprof + end do upprof + endif + +! Reset the level and move down through the profile + l=k + +! The check (l>=2) ensures that plevs(l-1) is defined + if (l>=2) then + dwprof: do while (abs(plevs(l-1)-plevs(k)) < vmag .and. l >= 2) + l=l-1 + if(pq(l) < lim_qm .and. vq(l) < lim_qm)then + pdiffd=abs(plevs(l)-plevs(k)) + exit dwprof + end if + if (l==1) exit dwprof + end do dwprof + endif + +! Set adjusted error + if(plevs(k) > presl(1))then + errout=errout*(dpres(1)+plevs(k)-presl(1))/dpres(1) + else if(plevs(k) < presl(nsig))then + errout=errout*(dpres(nsig-1)+presl(nsig)-plevs(k))/dpres(nsig-1) + else + errout=sqrt(two*vmag/max(pdiffd+pdiffu,five*tiny_r_kind)) + end if + +! Quality marks indicate bad data. Set error to large value. + else + errout=1.e6_r_kind + end if + + return +end subroutine errormod_hdraob subroutine errormod_aircraft(pq,vq,levs,plevs,errout,k,presl,dpres,nsig,lim_qm,hdr3) !$$$ subprogram documentation block diff --git a/src/gsi/read_NASA_LaRC_cloud.f90 b/src/gsi/read_NASA_LaRC_cloud.f90 index cb6ceac65a..ec3f29e3fa 100644 --- a/src/gsi/read_NASA_LaRC_cloud.f90 +++ b/src/gsi/read_NASA_LaRC_cloud.f90 @@ -298,6 +298,7 @@ subroutine read_NASALaRC_cloud_bufr(satfile,atime,& enddo msg_report write(*,*) 'message/reports num=',nmsg,ntb call closbf(unit_in) + close(unit_in) numobs=ntb write(atime,'(I10)') idate @@ -409,6 +410,7 @@ subroutine read_NASALaRC_cloud_bufr_survey(satfile,east_time, west_time) enddo msg_report write(*,*) 'message/reports num=',nmsg,ntb call closbf(unit_in) + close(unit_in) write(*,'(2x,a10,a10,a11)') 'time_level','subset_num' DO i=1,num_obstime diff --git a/src/gsi/read_abi.f90 b/src/gsi/read_abi.f90 index 3a50f65b51..79db799015 100644 --- a/src/gsi/read_abi.f90 +++ b/src/gsi/read_abi.f90 @@ -169,7 +169,6 @@ subroutine read_abi(mype,val_abi,ithin,rmesh,jsatid,& if (.not.assim) val_abi=zero ! Open bufr file. - call closbf(lnbufr) open(lnbufr,file=trim(infile),form='unformatted') call openbf(lnbufr,'IN',lnbufr) call datelen(10) @@ -232,6 +231,7 @@ subroutine read_abi(mype,val_abi,ithin,rmesh,jsatid,& ! Reopen unit to bufr file call closbf(lnbufr) + close(lnbufr) open(lnbufr,file=infile,form='unformatted') call openbf(lnbufr,'IN',lnbufr) if(jsatid == 'gr' .or. jsatid == 'g16') kidsat = 270 @@ -323,6 +323,7 @@ subroutine read_abi(mype,val_abi,ithin,rmesh,jsatid,& nread=nread+nchanl + rcldfrc=bmiss if(clrsky) then call ufbrep(lnbufr,dataabi1,1,ncld,iret,'NCLDMNT') rclrsky=bmiss @@ -338,7 +339,9 @@ subroutine read_abi(mype,val_abi,ithin,rmesh,jsatid,& rclrsky=dataabi1(1,1) !clear-sky percentage ! rclrsky=dataabi1(1,2) !clear-sky percentage over sea call ufbrep(lnbufr,dataabi,1,4,iret,'CLDMNT') - rcldfrc=dataabi(1,1) !total cloud + if (dataabi(1,1)>= zero .and. dataabi(1,1) <= 100.0_r_kind ) then + rcldfrc=dataabi(1,1) !total cloud + end if end if call ufbrep(lnbufr,dataabi2,1,nbrst,iret,'TMBRST') @@ -491,6 +494,7 @@ subroutine read_abi(mype,val_abi,ithin,rmesh,jsatid,& enddo read_msg call closbf(lnbufr) + close(lnbufr) call combine_radobs(mype_sub,mype_root,npe_sub,mpi_comm_sub,& nele,itxmax,nread,ndata,data_all,score_crit,nrec) diff --git a/src/gsi/read_ahi.f90 b/src/gsi/read_ahi.f90 index 3237f2e6fc..5c234134f3 100644 --- a/src/gsi/read_ahi.f90 +++ b/src/gsi/read_ahi.f90 @@ -193,7 +193,6 @@ subroutine read_ahi(mype,val_img,ithin,rmesh,jsatid,gstime,& ! Open bufr file. - call closbf(lnbufr) open(lnbufr,file=trim(infile),form='unformatted') call openbf(lnbufr,'IN',lnbufr) call datelen(10) @@ -219,6 +218,7 @@ subroutine read_ahi(mype,val_img,ithin,rmesh,jsatid,gstime,& allocate(data_all(nele,itxmax),nrec(itxmax)) call closbf(lnbufr) + close(lnbufr) open(lnbufr,file=trim(infile),form='unformatted') call openbf(lnbufr,'IN',lnbufr) if(jsatid == 'himawari8') kidsat = 173 @@ -504,6 +504,7 @@ subroutine read_ahi(mype,val_img,ithin,rmesh,jsatid,gstime,& enddo read_loop enddo read_msg call closbf(lnbufr) + close(lnbufr) call combine_radobs(mype_sub,mype_root,npe_sub,mpi_comm_sub,& nele,itxmax,nread,ndata,data_all,score_crit,nrec) diff --git a/src/gsi/read_airs.f90 b/src/gsi/read_airs.f90 index 62e4cc2ea6..ab6f770a91 100644 --- a/src/gsi/read_airs.f90 +++ b/src/gsi/read_airs.f90 @@ -855,6 +855,7 @@ subroutine read_airs(mype,val_airs,ithin,isfcalc,rmesh,jsatid,gstime,& enddo read_subset deallocate(allchan, chan_map, bufr_chan_test) call closbf(lnbufr) ! Close bufr file + close(lnbufr) ! If multiple tasks read input bufr file, allow each tasks to write out ! information it retained and then let single task merge files together diff --git a/src/gsi/read_amsr2.f90 b/src/gsi/read_amsr2.f90 index ed0429483b..a7b27abccc 100644 --- a/src/gsi/read_amsr2.f90 +++ b/src/gsi/read_amsr2.f90 @@ -428,6 +428,7 @@ subroutine read_amsr2(mype,val_amsr2,ithin,rmesh,jsatid,gstime,& enddo read_loop enddo call closbf(lnbufr) + close(lnbufr) num_obs=iobs-1 diff --git a/src/gsi/read_amsre.f90 b/src/gsi/read_amsre.f90 index 99a325c6c4..ef0c2ad2bb 100755 --- a/src/gsi/read_amsre.f90 +++ b/src/gsi/read_amsre.f90 @@ -645,6 +645,7 @@ subroutine read_amsre(mype,val_amsre,ithin,isfcalc,rmesh,jsatid,gstime,& enddo read_loop enddo read_msg call closbf(lnbufr) + close(lnbufr) ! If multiple tasks read input bufr file, allow each tasks to write out ! information it retained and then let single task merge files together diff --git a/src/gsi/read_anowbufr.f90 b/src/gsi/read_anowbufr.f90 index 6428e0d02e..e2b744eb6a 100644 --- a/src/gsi/read_anowbufr.f90 +++ b/src/gsi/read_anowbufr.f90 @@ -329,6 +329,7 @@ subroutine read_anowbufr(nread,ndata,nodata,gstime,& 1000 continue call closbf(lunin) + close(lunin) if(diagnostic_reg .and. & ntest > 0) write(6,*)'read_airnow_bufr: ',& diff --git a/src/gsi/read_atms.f90 b/src/gsi/read_atms.f90 index df2612a420..6fc0006c93 100644 --- a/src/gsi/read_atms.f90 +++ b/src/gsi/read_atms.f90 @@ -234,7 +234,7 @@ subroutine read_atms(mype,val_tovs,ithin,isfcalc,& ! Set various variables depending on type of data to be read if (obstype /= 'atms') then - write(*,*) 'READ_ATMS called for obstype '//obstype//': RETURNING' + write(6,*) 'READ_ATMS called for obstype '//obstype//': RETURNING' return end if @@ -266,7 +266,7 @@ subroutine read_atms(mype,val_tovs,ithin,isfcalc,& elseif (jsatid == 'n21') then kidsat = 226 else - write(*,*) 'READ_ATMS: Unrecognized value for jsatid '//jsatid//': RETURNING' + write(6,*) 'READ_ATMS: Unrecognized value for jsatid '//jsatid//': RETURNING' return end if @@ -374,7 +374,6 @@ subroutine read_atms(mype,val_tovs,ithin,isfcalc,& end if ! Reopen unit to satellite bufr file - call closbf(lnbufr) open(lnbufr,file=trim(infile2),form='unformatted',status = 'old', & iostat = ierr) if(ierr /= 0) cycle ears_db_loop @@ -492,13 +491,14 @@ subroutine read_atms(mype,val_tovs,ithin,isfcalc,& end do read_loop end do read_subset call closbf(lnbufr) + close(lnbufr) end do ears_db_loop deallocate(data1b8) num_obs = iob-1 if (num_obs <= 0) then - write(*,*) 'READ_ATMS: No ATMS Data were read in' + write(6,*) 'READ_ATMS: No ATMS Data were read in' return end if @@ -507,14 +507,14 @@ subroutine read_atms(mype,val_tovs,ithin,isfcalc,& ALLOCATE(Relative_Time_In_Seconds(Num_Obs)) ALLOCATE(IScan(Num_Obs)) Relative_Time_In_Seconds = 3600.0_r_kind*T4DV_Save(1:Num_Obs) - write(*,*) 'Calling ATMS_Spatial_Average' + write(6,*) 'Calling ATMS_Spatial_Average' CALL ATMS_Spatial_Average(Num_Obs, NChanl, IFOV_Save(1:Num_Obs), & Relative_Time_In_Seconds, BT_Save(1:nchanl,1:Num_Obs), IScan, IRet) - write(*,*) 'ATMS_Spatial_Average Called with IRet=',IRet + write(6,*) 'ATMS_Spatial_Average Called with IRet=',IRet DEALLOCATE(Relative_Time_In_Seconds) IF (IRet /= 0) THEN - write(*,*) 'Error Calling ATMS_Spatial_Average from READ_ATMS' + write(6,*) 'Error Calling ATMS_Spatial_Average from READ_ATMS' RETURN END IF diff --git a/src/gsi/read_avhrr.f90 b/src/gsi/read_avhrr.f90 index ffc5a82052..8730b8bf13 100755 --- a/src/gsi/read_avhrr.f90 +++ b/src/gsi/read_avhrr.f90 @@ -532,6 +532,7 @@ subroutine read_avhrr(mype,val_avhrr,ithin,rmesh,jsatid,& enddo read_loop enddo read_msg call closbf(lnbufr) + close(lnbufr) call combine_radobs(mype_sub,mype_root,npe_sub,mpi_comm_sub,& nele,itxmax,nread,ndata,data_all,score_crit,nrec) diff --git a/src/gsi/read_avhrr_navy.f90 b/src/gsi/read_avhrr_navy.f90 index 64a5b19907..dd5a64083a 100644 --- a/src/gsi/read_avhrr_navy.f90 +++ b/src/gsi/read_avhrr_navy.f90 @@ -496,6 +496,7 @@ subroutine read_avhrr_navy(mype,val_avhrr,ithin,rmesh,jsatid,& 900 continue call destroygrids call closbf(lnbufr) + close(lnbufr) if(diagnostic_reg.and.ntest>0) write(6,*)'READ_AVHRR_NAVY: ',& 'mype,ntest,disterrmax=',mype,ntest,disterrmax diff --git a/src/gsi/read_bufrtovs.f90 b/src/gsi/read_bufrtovs.f90 index 9e9795b009..cf3e7ea17c 100644 --- a/src/gsi/read_bufrtovs.f90 +++ b/src/gsi/read_bufrtovs.f90 @@ -501,7 +501,6 @@ subroutine read_bufrtovs(mype,val_tovs,ithin,isfcalc,& end if ! Reopen unit to satellite bufr file - call closbf(lnbufr) open(lnbufr,file=trim(infile2),form='unformatted',status = 'old',iostat=ierr) if(ierr /= 0) cycle ears_db_loop @@ -946,6 +945,7 @@ subroutine read_bufrtovs(mype,val_tovs,ithin,isfcalc,& enddo read_loop enddo read_subset call closbf(lnbufr) + close(lnbufr) if(llll > 1 .and. (amsua .or. amsub .or. mhs))then deallocate(data1b8x) diff --git a/src/gsi/read_cris.f90 b/src/gsi/read_cris.f90 index 91bac38c65..29067b3f69 100644 --- a/src/gsi/read_cris.f90 +++ b/src/gsi/read_cris.f90 @@ -404,7 +404,6 @@ subroutine read_cris(mype,val_cris,ithin,isfcalc,rmesh,jsatid,gstime,& end if ! Open BUFR file - call closbf(lnbufr) open(lnbufr,file=trim(infile2),form='unformatted',status='old',iostat=ierr) if(ierr /= 0) cycle ears_db_loop @@ -843,6 +842,7 @@ subroutine read_cris(mype,val_cris,ithin,isfcalc,rmesh,jsatid,gstime,& enddo read_subset call closbf(lnbufr) + close(lnbufr) end do ears_db_loop diff --git a/src/gsi/read_files.f90 b/src/gsi/read_files.f90 index 3b2ad73371..5fa4119c7b 100644 --- a/src/gsi/read_files.f90 +++ b/src/gsi/read_files.f90 @@ -38,6 +38,7 @@ subroutine read_files(mype) ! 2017-09-08 li - add sfcnst_comb to get nfldnst and control when sfc & nst combined ! 2019-03-21 Wei/Martin - add capability to read in aerosol guess from NEMS ! 2019-09-24 martin - add support for use_gfs_ncio +! 2020-07-08 Wei - fix the capability to count external aerosol files ! ! input argument list: ! mype - mpi task id @@ -161,6 +162,7 @@ subroutine read_files(mype) nfldsig=0 nfldsfc=0 nfldnst=0 + nfldaer=0 iamana=0 ! Check for non-zero length atm, sfc, aer, and nst files on single task @@ -220,6 +222,24 @@ subroutine read_files(mype) allocate(time_nst(nfldnst,2)) end if + if(lread_ext_aerosol) then +! Check for aer files with non-zero length + do i=0,max_file-1 + write(filename,'(''aerf'',i2.2)')i + call gsi_inquire(lenbytes,fexist,filename,mype) + if(fexist .and. lenbytes>0) then + nfldaer=nfldaer+1 + irec(nfldaer,4) = i + end if + enddo + if(nfldaer==0) then + write(6,*)'READ_FILES: ***ERROR*** NO aer fields; aborting' + call stop2(170) + end if + + allocate(time_aer(nfldaer,2)) + end if + ! Let a single task query the guess files. ! Convert analysis time to minutes relative to fixed date @@ -491,6 +511,7 @@ subroutine read_files(mype) ! for external aerosol files only ! Check for consistency of times from aer guess files. if ( lread_ext_aerosol ) then + write(6,*) 'READ_FILES: nfldaer ', nfldaer iwan=0 do i=1,nfldaer write(filename,'(''aerf'',i2.2)')irec(i,4) @@ -525,7 +546,7 @@ subroutine read_files(mype) idate5(3)=idateg(3); idate5(4)=idateg(1); idate5(5)=0 call w3fs21(idate5,nmings) nming2=nmings+60*hourg - write(6,*)'READ_FILES: aer guess file, hourg, idateg, nming2 ',hourg,idateg,nming2 + write(6,*)'READ_FILES: aer guess file',filename,hourg,idateg,nming2 t4dv=real((nming2-iwinbgn),r_kind)*r60inv if (l4dvar.or.l4densvar) then if (t4dvwinlen) cycle diff --git a/src/gsi/read_fl_hdob.f90 b/src/gsi/read_fl_hdob.f90 index 93330c925f..e600cb7bae 100644 --- a/src/gsi/read_fl_hdob.f90 +++ b/src/gsi/read_fl_hdob.f90 @@ -23,6 +23,7 @@ subroutine read_fl_hdob(nread,ndata,nodata,infile,obstype,lunout,gstime,twind,si ! linear qc error table and b table ! 2015-10-01 guo - calc ob location once in deg +! 2020-05-04 wu - no rotate_wind for fv3_regional ! ! input argument list: ! infile - unit from which to read BUFR data @@ -50,12 +51,13 @@ subroutine read_fl_hdob(nread,ndata,nodata,infile,obstype,lunout,gstime,twind,si r60inv,r10,r100,r2000,hvap,eps,omeps,rv,grav use gridmod, only: diagnostic_reg,regional,nlon,nlat,nsig,& tll2xy,txy2ll,rotate_wind_ll2xy,rotate_wind_xy2ll,& - rlats,rlons,twodvar_regional + rlats,rlons,twodvar_regional,fv3_regional use convinfo, only: nconvtype, & icuse,ictype,icsubtype,ioctype, & ithin_conv,rmesh_conv,pmesh_conv use obsmod, only: perturb_obs,perturb_fact,ran01dom use obsmod, only: bmiss + use aircraftinfo, only: aircraft_t_bc,aircraft_t_bc_pof,aircraft_t_bc_ext use converr,only: etabl use converr_ps,only: etabl_ps,isuble_ps,maxsub_ps use converr_q,only: etabl_q,isuble_q,maxsub_q @@ -238,6 +240,7 @@ subroutine read_fl_hdob(nread,ndata,nodata,infile,obstype,lunout,gstime,twind,si iecol=0 if (ltob) then nreal = 25 + if (aircraft_t_bc_pof .or. aircraft_t_bc .or.aircraft_t_bc_ext) nreal=nreal+3 iecol = 2 errmin = half ! set lower bound of ob error for T or Tv else if (luvob) then @@ -302,7 +305,7 @@ subroutine read_fl_hdob(nread,ndata,nodata,infile,obstype,lunout,gstime,twind,si do nc = 1, nconvtype if (trim(ioctype(nc)) == trim(obstype))then if (trim(ioctype(nc)) == 'uv' .and. ictype(nc) == 236 .or. & - trim(ioctype(nc)) == 'spd' .and. ictype(nc) == 292 .or. & + trim(ioctype(nc)) == 'spd' .and. ictype(nc) == 213 .or. & trim(ioctype(nc)) == 't' .and. ictype(nc) == 136 .or. & trim(ioctype(nc)) == 'q' .and. ictype(nc) == 136 .or. & trim(ioctype(nc)) == 'ps' .and. ictype(nc) == 136 ) then @@ -355,7 +358,6 @@ subroutine read_fl_hdob(nread,ndata,nodata,infile,obstype,lunout,gstime,twind,si ! Go through the bufr file to find out how mant subsets to process nmsg = 0 maxobs = 0 - call closbf(lunin) open(lunin,file=trim(infile),form='unformatted') call openbf(lunin,'IN',lunin) call datelen(10) @@ -368,6 +370,7 @@ subroutine read_fl_hdob(nread,ndata,nodata,infile,obstype,lunout,gstime,twind,si end do loop_readsb1 end do loop_msg1 call closbf(lunin) + close(lunin) write(6,*) 'READ_FL_HDOB: total number of data found in the bufr file ',maxobs,obstype write(6,*) 'READ_FL_HDOB: time offset is ',toff,' hours' @@ -388,7 +391,6 @@ subroutine read_fl_hdob(nread,ndata,nodata,infile,obstype,lunout,gstime,twind,si ilat = 3 ! Open bufr file again for reading - call closbf(lunin) open(lunin,file=trim(infile),form='unformatted') call openbf(lunin,'IN',lunin) call datelen(10) @@ -533,6 +535,7 @@ subroutine read_fl_hdob(nread,ndata,nodata,infile,obstype,lunout,gstime,twind,si write(6,*) 'READ_FL_HDOB: bad lat/lon values: ', obsloc(1,1),obsloc(2,1) cycle loop_readsb2 endif + if (obsloc(2,1) < 0.0_r_kind) obsloc(2,1) = obsloc(2,1) + 360.0_r_kind dlon_earth_deg = obsloc(2,1) dlat_earth_deg = obsloc(1,1) dlon_earth = obsloc(2,1)*deg2rad ! degree to radian @@ -999,7 +1002,7 @@ subroutine read_fl_hdob(nread,ndata,nodata,infile,obstype,lunout,gstime,twind,si if (pob_mb < r50) woe = woe*r1_2 if (inflate_error) woe = woe*r1_2 if (qcm > lim_qm ) woe = woe*1.0e6_r_kind - if(regional)then + if(regional .and. .not. fv3_regional)then u0 = uob v0 = vob call rotate_wind_ll2xy(u0,v0,uob,vob,dlon_earth,dlon,dlat) @@ -1154,6 +1157,7 @@ subroutine read_fl_hdob(nread,ndata,nodata,infile,obstype,lunout,gstime,twind,si ! Close unit to bufr file call closbf(lunin) + close(lunin) ! Deallocate arrays used for thinning data if (.not.use_all) then deallocate(presl_thin) @@ -1181,13 +1185,11 @@ subroutine read_fl_hdob(nread,ndata,nodata,infile,obstype,lunout,gstime,twind,si 'nvtest,vdisterrmax=',ntest,vdisterrmax if (ndata == 0) then - call closbf(lunin) write(6,*)'READ_FL_HDOB: no data to process' endif write(6,*)'READ_FL_HDOB: nreal=',nreal write(6,*)'READ_FL_HDOB: ntb,nread,ndata,nodata=',ntb,nread,ndata,nodata - close(lunin) ! End of routine return diff --git a/src/gsi/read_gfs_ozone_for_regional.f90 b/src/gsi/read_gfs_ozone_for_regional.f90 index 9cdee423f5..8b2b9ffcb2 100644 --- a/src/gsi/read_gfs_ozone_for_regional.f90 +++ b/src/gsi/read_gfs_ozone_for_regional.f90 @@ -29,6 +29,7 @@ subroutine read_gfs_ozone_for_regional ! 2015-05-13 wu - read in just one GFS for ozone even when nfldsig > 1 ! use the same ges_oz in all time levels ! 2016-12-12 tong - add code to get nemsio meta data, if use_gfs_nemsio=True +! 2012-07-02 bi - add code to get netcdf data, if use_gfs_ncio=.true. ! ! input argument list: ! @@ -41,7 +42,8 @@ subroutine read_gfs_ozone_for_regional !$$$ end documentation block use gridmod, only: nlat,nlon,lat2,lon2,nsig,region_lat,region_lon,check_gfs_ozone_date - use gridmod, only: jcap_gfs,nlat_gfs,nlon_gfs,wrf_nmm_regional,use_gfs_nemsio + use gridmod, only: jcap_gfs,nlat_gfs,nlon_gfs,wrf_nmm_regional,use_gfs_nemsio, & + use_gfs_ncio,ncepgfs_head,ncepgfs_headv use constants,only: zero,half,rd_over_cp,one,h300,r60,r3600 use constants, only: max_varname_length use mpimod, only: mpi_comm_world,ierror,mype,mpi_rtype,mpi_min,mpi_max,npe @@ -64,6 +66,9 @@ subroutine read_gfs_ozone_for_regional use nemsio_module, only: nemsio_init,nemsio_open,nemsio_close use ncepnems_io, only: error_msg use nemsio_module, only: nemsio_gfile,nemsio_getfilehead + use module_fv3gfs_ncio, only: Dataset, Dimension, get_dim, read_vardata,& + open_dataset, close_dataset, read_attribute,& + get_idate_from_time_units implicit none @@ -88,6 +93,7 @@ subroutine read_gfs_ozone_for_regional integer(i_kind) iret,i,j,k,k2,ndim integer(i_kind) it,it_beg,it_end integer(i_kind) istatus + integer(i_kind) kr character(24) filename character(255),allocatable,dimension(:)::infiles logical uv_hyb_ens @@ -106,6 +112,7 @@ subroutine read_gfs_ozone_for_regional real(r_kind),allocatable,dimension(:) :: xspli,yspli,xsplo,ysplo integer(i_kind) iyr,ihourg integer(i_kind),dimension(4):: idate4 + integer(i_kind),dimension(6):: idate6 integer(i_kind),dimension(8) :: ida,jda integer(i_kind),dimension(5) :: iadate_gfs real(r_kind) hourg @@ -124,6 +131,11 @@ subroutine read_gfs_ozone_for_regional real(r_kind),allocatable,dimension(:)::glb_ozmin,glb_ozmax,reg_ozmin,reg_ozmax real(r_kind),allocatable,dimension(:)::glb_ozmin0,glb_ozmax0,reg_ozmin0,reg_ozmax0 real(r_kind),allocatable,dimension(:,:,:,:)::ges_oz + type(Dataset) :: atmges + type(ncepgfs_head):: gfshead + type(ncepgfs_headv):: gfsheadv + type(Dimension) :: ncdim + real(r_kind), allocatable, dimension(:) :: fhour2,aknc,bknc type(gsi_bundle) :: atm_bundle type(gsi_grid) :: atm_grid @@ -171,7 +183,7 @@ subroutine read_gfs_ozone_for_regional filename=infiles(it) if (mype==0) write(6,*)'read_gfs_ozone_for_regional: reading in gfs file:',trim(filename) - if(.not. use_gfs_nemsio)then + if ((.not. use_gfs_nemsio) .and. (.not. use_gfs_ncio))then open(lunges,file=trim(filename),form='unformatted') call sigio_srhead(lunges,sighead,iret) close(lunges) @@ -197,6 +209,71 @@ subroutine read_gfs_ozone_for_regional idate4(2)= sighead%idate(2) idate4(3)= sighead%idate(3) idate4(4)= sighead%idate(4) + +! add netcdf code here + else if (use_gfs_ncio) then + atmges = open_dataset(filename) + ! get dimension sizes + ncdim = get_dim(atmges, 'grid_xt'); gfshead%lonb = ncdim%len + ncdim = get_dim(atmges, 'grid_yt'); gfshead%latb = ncdim%len + ncdim = get_dim(atmges, 'pfull'); gfshead%levs = ncdim%len + nsig_gfs=gfshead%levs + ! hard code jcap,idsl,idvc + gfshead%jcap = -9999 + gfshead%idsl= 1 + gfshead%idvc = 2 + + ! FV3GFS write component does not include JCAP, infer from DIMY-2 + njcap=latb-2 + + nlat_gfs=gfshead%latb+2 + nlon_gfs=gfshead%lonb + nsig_gfs=gfshead%levs + + jcap_gfs=gfshead%latb-2 + + ! get time information + idate6 = get_idate_from_time_units(atmges) + gfshead%idate(1) = idate6(4) !hour + gfshead%idate(2) = idate6(2) !month + gfshead%idate(3) = idate6(3) !day + gfshead%idate(4) = idate6(1) !year + call read_vardata(atmges, 'time', fhour2) ! might need to change this to attribute later + ! depends on model changes from Jeff Whitaker + gfshead%fhour = fhour2(1) + + ! hard code nvcoord to be 2 + gfshead%nvcoord=2 ! ak and bk + if (allocated(gfsheadv%vcoord)) deallocate(gfsheadv%vcoord) + allocate(gfsheadv%vcoord(gfshead%levs+1,gfshead%nvcoord)) + + call read_attribute(atmges, 'ak', aknc) + call read_attribute(atmges, 'bk', bknc) + + do k=1,gfshead%levs+1 + kr = gfshead%levs+2-k + gfsheadv%vcoord(k,1) = aknc(kr) + gfsheadv%vcoord(k,2) = bknc(kr) + end do + deallocate(aknc,bknc) + + call close_dataset(atmges) + + if(mype == 0) then + write(6,*) ' reozone:fhour,idate=',fhour2,idate6 + write(6,*) ' reozone:iadate(y,m,d,hr,min)=',iadate + write(6,*) ' reozone: jcap,levs=',gfshead%levs + write(6,*) ' reozone: latb,lonb=',gfshead%latb,gfshead%lonb + write(6,*) ' reozone: nvcoord=',gfshead%nvcoord + write(6,*) ' reozone: idvc,idsl=',gfshead%idvc,gfshead%idsl + endif + + hourg = fhour2(1) + idate4(1) = idate6(4) + idate4(2) = idate6(2) + idate4(3) = idate6(3) + idate4(4) = idate6(1) + else call nemsio_init(iret=iret) if (iret /= 0) call error_msg(trim(my_name),trim(filename),' ','init',istop,iret) @@ -294,6 +371,7 @@ subroutine read_gfs_ozone_for_regional write(6,*)' in read_gfs_ozone_for_regional, iadate_gfs=',iadate_gfs write(6,*)' in read_gfs_ozone_for_regional, iadate =',iadate end if + if((iadate_gfs(1)/=iadate(1).or.iadate_gfs(2)/=iadate(2).or.iadate_gfs(3)/=iadate(3).or.& iadate_gfs(4)/=iadate(4).or.iadate_gfs(5)/=iadate(5)) .and. .not. wrf_nmm_regional ) then if(mype == 0) write(6,*)' WARNING: GFS OZONE FIELD DATE NOT EQUAL TO ANALYSIS DATE' @@ -310,12 +388,15 @@ subroutine read_gfs_ozone_for_regional allocate(bk5(nsig_gfs+1)) allocate(ck5(nsig_gfs+1)) allocate(tref5(nsig_gfs)) + + idvc=gfshead%idvc + idsl=gfshead%idsl do k=1,nsig_gfs+1 ak5(k)=zero bk5(k)=zero ck5(k)=zero end do - if (.not. use_gfs_nemsio) then + if((.not. use_gfs_nemsio).and.(.not. use_gfs_ncio))then if (sighead%nvcoord == 1) then do k=1,sighead%levs+1 bk5(k) = sighead%vcoord(k,1) @@ -335,6 +416,26 @@ subroutine read_gfs_ozone_for_regional write(6,*)'READ_GFS_OZONE_FOR_REGIONAL: ***ERROR*** INVALID value for nvcoord=',sighead%nvcoord,filename call stop2(85) endif + else if ( use_gfs_ncio ) then + if (gfshead%nvcoord == 1) then + do k=1,nsig_gfs+1 + bk5(k) = gfsheadv%vcoord(k,1) + end do + elseif (gfshead%nvcoord == 2) then + do k = 1,nsig_gfs+1 + ak5(k) = gfsheadv%vcoord(k,1)*zero_001 + bk5(k) = gfsheadv%vcoord(k,2) + end do + elseif (gfshead%nvcoord == 3) then + do k = 1,nsig_gfs+1 + ak5(k) = gfsheadv%vcoord(k,1)*zero_001 + bk5(k) = gfsheadv%vcoord(k,2) + ck5(k) = gfsheadv%vcoord(k,3)*zero_001 + end do + else + write(6,*)'***ERROR*** INVALID value nvcoord=',gfshead%nvcoord + call stop2(85) + endif else if (nvcoord == 1) then do k=1,nsig_gfs+1 @@ -373,7 +474,7 @@ subroutine read_gfs_ozone_for_regional hires=.true. else hires=.false. - if(.not. use_gfs_nemsio)then + if((.not. use_gfs_nemsio).and.(.not. use_gfs_ncio))then jcap_gfs=sighead%jcap nlat_gfs=sighead%latf+2 nlon_gfs=sighead%lonf @@ -399,7 +500,7 @@ subroutine read_gfs_ozone_for_regional deallocate(vector) jcap_gfs_test=jcap_gfs call general_init_spec_vars(sp_gfs,jcap_gfs,jcap_gfs_test,grd_gfs%nlat,grd_gfs%nlon) - if (hires .and. .not. use_gfs_nemsio) then + if (hires .and. .not. use_gfs_nemsio .and. .not. use_gfs_ncio) then call general_init_spec_vars(sp_b,jcap_org,jcap_org,nlat_gfs,nlon_b) end if @@ -426,6 +527,9 @@ subroutine read_gfs_ozone_for_regional if(use_gfs_nemsio)then call general_read_gfsatm_nems(grd_gfst,sp_gfs,filename,uv_hyb_ens,.false.,.false., & atm_bundle,.true.,iret) + else if (use_gfs_ncio) then + call general_read_gfsatm_nc(grd_gfst,sp_gfs,filename,uv_hyb_ens,.false.,.true., & + atm_bundle,.true.,iret) else if (hires) then call general_read_gfsatm(grd_gfst,sp_gfs,sp_b,filename,uv_hyb_ens,.false.,.false., & @@ -623,7 +727,7 @@ subroutine read_gfs_ozone_for_regional end do end if call general_destroy_spec_vars(sp_gfs) - if ( hires .and. .not. use_gfs_nemsio ) call general_destroy_spec_vars(sp_b) + if ( hires .and. .not. use_gfs_nemsio .and. .not. use_gfs_ncio) call general_destroy_spec_vars(sp_b) deallocate(xspli,yspli,xsplo,ysplo,glb_ozmin,glb_ozmax,reg_ozmin,reg_ozmax,& glb_ozmin0,glb_ozmax0,reg_ozmin0,reg_ozmax0) diff --git a/src/gsi/read_gmi.f90 b/src/gsi/read_gmi.f90 index 75b56b0e14..4361e7144a 100644 --- a/src/gsi/read_gmi.f90 +++ b/src/gsi/read_gmi.f90 @@ -501,6 +501,7 @@ subroutine read_gmi(mype,val_gmi,ithin,rmesh,jsatid,gstime,& end do read_subset 690 continue call closbf(lnbufr) + close(lnbufr) num_obs=iobs-1 if( mype_sub==mype_root) write(6,*) 'READ_GMI: do_noise_reduction=', do_noise_reduction diff --git a/src/gsi/read_goesglm.f90 b/src/gsi/read_goesglm.f90 index f72e53623d..e0124abbf2 100644 --- a/src/gsi/read_goesglm.f90 +++ b/src/gsi/read_goesglm.f90 @@ -128,7 +128,6 @@ subroutine read_goesglm(nread,ndata,nodata,infile,obstype,lunout,twindin,sis) ! Open, then read date from BUFR file - call closbf(lunin) open(lunin,file=infile,form='unformatted') call openbf(lunin,'IN',lunin) call datelen(10) @@ -401,15 +400,12 @@ subroutine read_goesglm(nread,ndata,nodata,infile,obstype,lunout,twindin,sis) 'nvtest,vdisterrmax=',ntest,vdisterrmax if (ndata == 0) then - call closbf(lunin) - write(6,*)'READ_GOESGLM: closbf(',lunin,')' + write(6,*)'READ_GOESGLM: closbf(',lunin,') no data' endif close(lunin) - close(55) - ! End of routine return diff --git a/src/gsi/read_goesimg.f90 b/src/gsi/read_goesimg.f90 index e3ceaa7929..bf40a1f163 100644 --- a/src/gsi/read_goesimg.f90 +++ b/src/gsi/read_goesimg.f90 @@ -199,7 +199,6 @@ subroutine read_goesimg(mype,val_img,ithin,rmesh,jsatid,gstime,& ! Open bufr file. - call closbf(lnbufr) open(lnbufr,file=trim(infile),form='unformatted') call openbf(lnbufr,'IN',lnbufr) call datelen(10) @@ -444,6 +443,7 @@ subroutine read_goesimg(mype,val_img,ithin,rmesh,jsatid,gstime,& 900 continue call destroygrids call closbf(lnbufr) + close(lnbufr) if(diagnostic_reg.and.ntest>0) write(6,*)'READ_GOESIMG: ',& 'mype,ntest,disterrmax=',mype,ntest,disterrmax diff --git a/src/gsi/read_goesimgr_skycover.f90 b/src/gsi/read_goesimgr_skycover.f90 index e3c5432d82..dda9aad6f4 100644 --- a/src/gsi/read_goesimgr_skycover.f90 +++ b/src/gsi/read_goesimgr_skycover.f90 @@ -205,11 +205,11 @@ subroutine read_goesimgr_skycover(nread,ndata,nodata,infile,obstype,lunout,gsti ilat=3 ntb=0 - close(lunin) - call closbf(lunin) - open(lunin,file=trim(infile),form='unformatted') - call openbf(lunin,'IN',lunin) - call datelen(10) + call closbf(lunin) + close(lunin) + open(lunin,file=trim(infile),form='unformatted') + call openbf(lunin,'IN',lunin) + call datelen(10) loop_msg: do while (ireadmg(lunin,subset,idate) == 0) loop_readsb: do while (ireadsb(lunin) == 0) @@ -418,7 +418,7 @@ subroutine read_goesimgr_skycover(nread,ndata,nodata,infile,obstype,lunout,gsti deallocate(cdata_out) if (ndata == 0) then - write(6,*)myname,': closbf(',lunin,')' + write(6,*)myname,'no read_goesimgr_skycover data' endif close(lunin) diff --git a/src/gsi/read_goesndr.f90 b/src/gsi/read_goesndr.f90 index 8335b82d93..86fc1f0a5c 100644 --- a/src/gsi/read_goesndr.f90 +++ b/src/gsi/read_goesndr.f90 @@ -513,6 +513,7 @@ subroutine read_goesndr(mype,val_goes,ithin,rmesh,jsatid,infile,& end do read_loop end do read_subset call closbf(lnbufr) + close(lnbufr) ! If multiple tasks read input bufr file, allow each tasks to write out diff --git a/src/gsi/read_gps.f90 b/src/gsi/read_gps.f90 index 860b3e3cfd..3d8379ee3b 100644 --- a/src/gsi/read_gps.f90 +++ b/src/gsi/read_gps.f90 @@ -59,6 +59,8 @@ subroutine read_gps(nread,ndata,nodata,infile,lunout,obstype,twind, & ! 2015-02-23 Rancic/Thomas - add l4densvar to time window logical ! 2015-10-01 guo - consolidate use of ob location (in deg) ! 2017-11-16 dutta - addition of profile quality flags for KOMPSAT5 GPSRO. +! 2019-08-21 Shao - add qc flags input for METOP-C, COSMIC-2 and PAZ +! 2020-05-21 Shao - add qc flags input for commercial GNSSRO data ! ! input argument list: ! infile - unit from which to read BUFR data @@ -256,8 +258,10 @@ subroutine read_gps(nread,ndata,nodata,infile,lunout,obstype,twind, & endif ! Check profile quality flags - if ( ((said > 739).and.(said < 746)).or.(said == 820).or.(said == 786).or.& - ((said > 749).and.(said < 756)).or.(said == 825).or.(said == 44) ) then !CDAAC processing + if ( ((said > 739).and.(said < 746)).or.(said == 820).or.(said == 786).or. & + ((said > 749).and.(said < 756)).or.(said == 825).or.(said == 44) .or. & + (said == 265).or.(said == 266).or.(said == 267).or.(said == 268).or. & + (said == 269)) then !CDAAC processing if(pcc==zero) then ! write(6,*)'READ_GPS: bad profile said=',said,'ptid=',ptid,& ! ' SKIP this report' @@ -456,6 +460,7 @@ subroutine read_gps(nread,ndata,nodata,infile,lunout,obstype,twind, & ! Close unit to input file call closbf(lnbufr) + close(lnbufr) nprof_gps = nmrecs write(6,*)'READ_GPS: # bad or missing data=', notgood diff --git a/src/gsi/read_guess.F90 b/src/gsi/read_guess.F90 index 608bfc56e8..364d4e305b 100644 --- a/src/gsi/read_guess.F90 +++ b/src/gsi/read_guess.F90 @@ -75,6 +75,7 @@ subroutine read_guess(iyear,month,idd,mype) ! 2017-10-10 Wu W - add code for FV3 netcdf guess input ! 2019-09-18 martin - added new fields to save guess tsen, q, geop_hgt for writing increment ! 2019-09-23 martin - add code for FV3 GFS netcdf guess input +! 2021-01-05 x.zhang/lei - add code for updating delz analysis in regional da ! ! input argument list: ! mype - mpi task id @@ -112,6 +113,10 @@ subroutine read_guess(iyear,month,idd,mype) use read_wrf_mass_guess_mod, only: read_wrf_mass_guess_class use read_wrf_nmm_guess_mod, only: read_wrf_nmm_guess_class use gsi_rfv3io_mod, only: read_fv3_netcdf_guess + + use gridmod,only: l_reg_update_hydro_delz + use guess_grids, only:geom_hgti,geom_hgti_bg + use gsi_rfv3io_mod, only: bg_fv3regfilenameg use mpimod, only: mpi_comm_world @@ -260,6 +265,10 @@ subroutine read_guess(iyear,month,idd,mype) ! Compute 3d subdomain geopotential heights from the guess fields call load_geop_hgt + if(l_reg_update_hydro_delz) then + geom_hgti_bg=geom_hgti + endif + ! save guess geopotential height at level interface for use in write_atm ges_geopi=geop_hgti diff --git a/src/gsi/read_iasi.f90 b/src/gsi/read_iasi.f90 index 0079a2c239..b26de400d8 100644 --- a/src/gsi/read_iasi.f90 +++ b/src/gsi/read_iasi.f90 @@ -414,7 +414,6 @@ subroutine read_iasi(mype,val_iasi,ithin,isfcalc,rmesh,jsatid,gstime,& end if ! Open BUFR file - call closbf(lnbufr) open(lnbufr,file=trim(infile2),form='unformatted',status='old',iostat=ierr) if(ierr /= 0) cycle ears_db_loop @@ -808,6 +807,7 @@ subroutine read_iasi(mype,val_iasi,ithin,isfcalc,rmesh,jsatid,gstime,& enddo read_subset call closbf(lnbufr) + close(lnbufr) end do ears_db_loop diff --git a/src/gsi/read_l2bufr_mod.f90 b/src/gsi/read_l2bufr_mod.f90 index 83fec14912..cdcb389ecf 100644 --- a/src/gsi/read_l2bufr_mod.f90 +++ b/src/gsi/read_l2bufr_mod.f90 @@ -20,6 +20,8 @@ module read_l2bufr_mod ! 2009-11-24 parrish change time variable from regional_time (passed from gridmod) to ! iadate (passed from obsmod), to prevent all radar data being tossed. ! 2011-07-04 todling - fixes to run either single or double precision +! 2020-10-23 S.Liu - fix reading l2rw_bufr issue +! 2020-10-14 xu/sippel - Add options to superob the GRO ! ! subroutines included: ! sub initialize_superob_radar - initialize superob parameters to defaults @@ -52,11 +54,11 @@ module read_l2bufr_mod public :: range_max,del_time,l2superob_only,elev_angle_max,del_azimuth public :: minnum,del_range,del_elev - public :: invtllv + public :: invtllv,radar_sites,radar_box,radar_rmesh,radar_zmesh integer(i_kind) minnum - real(r_kind) del_azimuth,del_elev,del_range,del_time,elev_angle_max,range_max - logical l2superob_only + real(r_kind) del_azimuth,del_elev,del_range,del_time,elev_angle_max,range_max,radar_rmesh,radar_zmesh + logical l2superob_only,radar_sites,radar_box contains @@ -92,7 +94,10 @@ subroutine initialize_superob_radar minnum=50 range_max=100000._r_kind ! (100km) l2superob_only=.false. - + radar_sites=.false. + radar_box=.false. + radar_rmesh=10._r_kind + radar_zmesh=500._r_kind end subroutine initialize_superob_radar subroutine radar_bufr_read_all(npe,mype) @@ -133,12 +138,17 @@ subroutine radar_bufr_read_all(npe,mype) use qcmod, only: vadwnd_l2rw_qc use oneobmod, only: lsingleradar,singleradar use mpeu_util, only: IndexSet, IndexSort + use file_utility, only : get_lun + use constants, only: pi,rearth_equator + use mpeu_util, only: gettablesize,gettable + use gridmod, only: txy2ll use gsi_io, only: verbose implicit none integer(i_kind),intent(in):: npe,mype integer(i_kind),parameter:: max_num_radars=150 + integer(i_kind),parameter:: maxobs=2e8 integer(i_kind),parameter:: n_gates_max=4000 real(r_kind),parameter:: four_thirds = 4.0_r_kind / 3.0_r_kind real(r_kind),parameter:: r8 = 8.0_r_kind @@ -163,12 +173,15 @@ subroutine radar_bufr_read_all(npe,mype) integer(i_kind) nsuper,nsuperall integer(i_kind) nthisrad,nthisbins integer(i_kind) idups,idups0 + integer(i_kind) radar_count,radar_true,ntot,nlevz + real(r_kind) dx,dy + real(r_kind) halfpi,twopi,rkm2dg,delat,dgv,rlat_min,rlon_min,dlat_grid,dlon_grid + integer(i_kind) mlat,mlonx,ilev,ilat,ilon integer(i_kind) nradials_in,nradials_fail_angmax,nradials_fail_time,nradials_fail_elb integer(i_kind) nradials_in1,nradials_fail_angmax1,nradials_fail_time1,nradials_fail_elb1 integer(i_kind) nobs_in,nobs_badvr,nobs_badsr,nobs_lrbin,nobs_hrbin,nrange_max,irad integer(i_kind) nobs_in1,nobs_badvr1,nobs_badsr1,nobs_lrbin1,nobs_hrbin1,nrange_max1 integer(i_kind) num_radars_max,num_radars_min - integer(i_kind):: histo_el integer(i_kind) idate5(5) integer(i_kind),allocatable,dimension(:) :: indx,icount integer(i_kind),allocatable,dimension(:,:) :: ibins,ibins2 @@ -227,13 +240,26 @@ subroutine radar_bufr_read_all(npe,mype) equivalence(master_stn_table(1),cmaster_stn_table) equivalence (chdr,hdr(1)) equivalence (chdr2,hdr2(1)) + character(len=*),parameter:: tbname='SUPEROB_RADAR::' logical rite,print_verbose - logical lradar - + logical lradar + character(len=256),allocatable,dimension(:):: rtable + character(4),allocatable,dimension(:):: rsite + integer(i_kind),allocatable,dimension(:):: ruse + print_verbose=.false. if(verbose) print_verbose=.true. - + if (radar_sites) then + open(666,file=trim('gsiparm.anl'),form='formatted') + call gettablesize(tbname,666,ntot,radar_count) + allocate(rtable(radar_count),rsite(radar_count),ruse(radar_count)) + call gettable(tbname,666,ntot,radar_count,rtable) + do i=1,radar_count + read(rtable(i),*) rsite(i),ruse(i) + if (mype==0) write(*,'(A10,X,A4,X,I)'),"Radar sites usage: ",rsite(i),ruse(i) + end do + end if ! define infile if using either option for radial winds. do i=1,ndat if(trim(dtype(i))=='rw'.and.trim(dsis(i))=='l2rw'.and.vadwnd_l2rw_qc)then @@ -263,7 +289,6 @@ subroutine radar_bufr_read_all(npe,mype) rdelaz=one/delaz rdelr =one/delr rdelel=one/delel - num_radars=0 do i=1,max_num_radars stn_id_table(i)='ZZZZ' @@ -278,12 +303,6 @@ subroutine radar_bufr_read_all(npe,mype) ! Open bufr file with openbf to initialize bufr table, etc in bufrlib inbufr=10 open(inbufr,file=infile,form='unformatted') - read(inbufr,iostat=iret)subset - if(iret/=0) then - if(rite) write(6,*)'RADAR_BUFR_READ_ALL: problem opening level 2 bufr file "l2rwbufr"' - close(inbufr) - return - end if rewind inbufr lundx=inbufr call openbf(inbufr,'IN',lundx) @@ -345,6 +364,13 @@ subroutine radar_bufr_read_all(npe,mype) if(abs(t)>del_time) cycle nobs_in=nobs_in+n_gates stn_id=chdr2 + radar_true=0 + if (radar_sites) then + do i=1,radar_count + if (trim(stn_id) .eq. trim(rsite(i)) .and. ruse(i) == 1 ) radar_true=1 + end do + if (radar_true == 0) cycle + end if ibyte=index(cstn_id_table,stn_id) if(ibyte==0) then num_radars=num_radars+1 @@ -369,6 +395,7 @@ subroutine radar_bufr_read_all(npe,mype) if(rite) write(6,*)'RADAR_BUFR_READ_ALL: NO RADARS KEPT IN radar_bufr_read_all, ',& 'continue without level 2 data' call closbf(inbufr) + close(inbufr) return end if call mpi_reduce(num_radars,num_radars_min,1,mpi_integer4,mpi_min,0,mpi_comm_world,ierror) @@ -385,7 +412,6 @@ subroutine radar_bufr_read_all(npe,mype) stn_lon_table_all,max_num_radars,mpi_real8,mpi_comm_world,ierror) call mpi_allgather(stn_hgt_table,max_num_radars,mpi_real8, & stn_hgt_table_all,max_num_radars,mpi_real8,mpi_comm_world,ierror) - ! Create unique master list of all radar names,lats,lons jj=0 do j=1,max_num_radars*npe @@ -452,13 +478,28 @@ subroutine radar_bufr_read_all(npe,mype) nrange_max=0 nthisrad=nrbin*nazbin*nelbin nthisbins=6*nthisrad - + if (radar_box) then + twopi = two*pi + rkm2dg = 360.0_r_kind/(twopi*rearth_equator)*1.e3_r_kind + dlat_grid = 5.0_r_kind + dlon_grid = 5.0_r_kind + halfpi = half*pi + dx=radar_rmesh*rkm2dg + dy=dx + mlat=dlat_grid/dy+half + mlonx=dlon_grid/dx+half + delat=dlat_grid/mlat + dgv=delat*half + mlat=max(2,mlat);mlonx=max(2,mlonx) + nlevz=nint(15000.0_r_kind/radar_zmesh) + nthisrad=(nlevz+1)*mlat*mlonx + nthisbins=6*nthisrad + end if ! reopen and reread the file for data this time - call closbf(inbufr) + close(inbufr) open(inbufr,file=infile,form='unformatted') call openbf(inbufr,'IN',inbufr) - allocate(bins(6,nthisrad,num_radars_0),ibins(nthisrad,num_radars_0)) bins=zero_quad ibins=0 @@ -508,6 +549,15 @@ subroutine radar_bufr_read_all(npe,mype) end if stn_id=chdr ibyte=index(cmaster_stn_table,stn_id) + if (radar_sites) then + radar_true=0 + do i=1,radar_count + if (trim(stn_id) == trim(rsite(i)) .and. ruse(i) == 1) radar_true=1 + end do + if (radar_true == 0) then + cycle + end if + end if if(ibyte==0) then write(6,*) ' index error in radar_bufr_read_all -- program stops -- ',ibyte,stn_id call stop2(99) @@ -539,21 +589,107 @@ subroutine radar_bufr_read_all(npe,mype) nobs_hrbin=nobs_hrbin+1 cycle end if - iloc=nrbin*(nazbin*(ielbin-1)+(iazbin-1))+irbin - bins(1,iloc,krad)=bins(1,iloc,krad)+range - bins(2,iloc,krad)=bins(2,iloc,krad)+stn_az - bins(3,iloc,krad)=bins(3,iloc,krad)+stn_el - bins(4,iloc,krad)=bins(4,iloc,krad)+rwnd(2,i) - bins(5,iloc,krad)=bins(5,iloc,krad)+rwnd(2,i)**2 - bins(6,iloc,krad)=bins(6,iloc,krad)+t - ibins(iloc,krad)=ibins(iloc,krad)+1 + + if (.not.radar_box) then + iloc=nrbin*(nazbin*(ielbin-1)+(iazbin-1))+irbin + bins(1,iloc,krad)=bins(1,iloc,krad)+range + bins(2,iloc,krad)=bins(2,iloc,krad)+stn_az + bins(3,iloc,krad)=bins(3,iloc,krad)+stn_el + bins(4,iloc,krad)=bins(4,iloc,krad)+rwnd(2,i) + bins(5,iloc,krad)=bins(5,iloc,krad)+rwnd(2,i)**2 + bins(6,iloc,krad)=bins(6,iloc,krad)+t + ibins(iloc,krad)=ibins(iloc,krad)+1 + else + this_stalat=master_lat_table(krad) + if(abs(this_stalat)>r89_5) cycle + this_stalon=master_lon_table(krad) + rlon0=deg2rad*this_stalon + this_stalatr=this_stalat*deg2rad + clat0=cos(this_stalatr) ; slat0=sin(this_stalatr) + this_staid=master_stn_table(krad) + this_stahgt=master_hgt_table(krad) + thisrange= range + thisazimuth=stn_az + thistilt=stn_el + thisvr=rwnd(2,i) + + + vrmax = tiny(1.0_r_kind) + vrmin = huge(1.0_r_kind) + + vrmax=max(vrmax,thisvr) + vrmin=min(vrmin,thisvr) + thisvr2=rwnd(2,i)**2 + thiserr=sqrt(abs(thisvr2-thisvr**2)) + + + errmax = tiny(1.0_r_kind) + errmin = huge(1.0_r_kind) + + errmax=max(errmax,thiserr) + errmin=min(errmin,thiserr) + thistime=t + aactual=erad+this_stahgt + a43=four_thirds*aactual + thistiltr=thistilt*deg2rad + selev0=sin(thistiltr) + celev0=cos(thistiltr) + b=thisrange*(thisrange+two*aactual*selev0) + c=sqrt(aactual*aactual+b) + ha=b/(aactual+c) + epsh=(thisrange*thisrange-ha*ha)/(r8*aactual) + h=ha-epsh + thishgt=this_stahgt+h + celev=celev0 + selev=selev0 + + if(thisrange>=one) then + celev=a43*celev0/(a43+h) + selev=(thisrange*thisrange+h*h+two*a43*h)/(two*thisrange*(a43+h)) + end if + + corrected_tilt=atan2(selev,celev)*rad2deg + gamma=half*thisrange*(celev0+celev) +! Get earth lat lon of superob + thisazimuthr=thisazimuth*deg2rad + rlonloc=rad_per_meter*gamma*cos(thisazimuthr) + rlatloc=rad_per_meter*gamma*sin(thisazimuthr) + call invtllv(rlonloc,rlatloc,rlon0,clat0,slat0,rlonglob,rlatglob) + thislat=rlatglob*rad2deg + thislon=rlonglob*rad2deg + + if(abs(thislat)>r89_5) cycle + clat1=cos(rlatglob) + caz0=cos(thisazimuthr) + saz0=sin(thisazimuthr) + cdlon=cos(rlonglob-rlon0) + sdlon=sin(rlonglob-rlon0) + caz1=clat0*caz0/clat1 + saz1=saz0*cdlon-caz0*sdlon*slat0 + corrected_azimuth=atan2(saz1,caz1)*rad2deg + rlat_min=this_stalat-2.5_r_kind + rlon_min=this_stalon-2.5_r_kind + ilev=ceiling(thishgt/radar_zmesh) + ilat=ceiling((thislat-rlat_min)/delat) + ilon=ceiling((thislon-rlon_min)/(dlon_grid/mlonx)) + iloc=mlat*(mlonx*(ilev-1)+ilon)+ilat + bins(1,iloc,krad)=bins(1,iloc,krad)+range + bins(2,iloc,krad)=bins(2,iloc,krad)+stn_az + bins(3,iloc,krad)=bins(3,iloc,krad)+stn_el + bins(4,iloc,krad)=bins(4,iloc,krad)+rwnd(2,i) + bins(5,iloc,krad)=bins(5,iloc,krad)+rwnd(2,i)**2 + bins(6,iloc,krad)=bins(6,iloc,krad)+t + ibins(iloc,krad)=ibins(iloc,krad)+1 + + end if !radar_box end end do - end do ! end do while end do ! loop over blocks call closbf(inbufr) + close(inbufr) + if (.not. allocated(ibins2)) allocate(ibins2(nthisrad,num_radars_0)) - allocate(ibins2(nthisrad,num_radars_0)) + ibins2=0 call mpi_allreduce(ibins,ibins2,nthisrad*num_radars_0,mpi_integer4,mpi_sum,mpi_comm_world,ierror) deallocate(ibins) @@ -604,20 +740,6 @@ subroutine radar_bufr_read_all(npe,mype) write(6,*)' nrange_max=',nrange_max1 end if -! Print out histogram of counts by ielbin to see where angles are - do ielbin=1,nelbin - histo_el=0 - do krad=1,num_radars_0 - do iazbin=1,nazbin - do irbin=1,nrbin - iloc=nrbin*(nazbin*(ielbin-1)+(iazbin-1))+irbin - histo_el=histo_el+ibins2(iloc,krad) - end do - end do - end do - if(rite)write(6,'(" ielbin,histo_el=",i6,i20)')ielbin,histo_el - end do - ! Prepare to create superobs and write out. open(inbufr,file='radar_supobs_from_level2',form='unformatted',iostat=iret) rewind inbufr @@ -669,33 +791,60 @@ subroutine radar_bufr_read_all(npe,mype) if(lsingleradar) then if(this_staid /= singleradar) lradar=.false. end if - if(lradar) then ! Logical for when running single radar exp. if(ibins2(iii,krad) < minnum) cycle thiscount=one_quad/real(ibins2(iii,krad),r_quad) + if (radar_box) then + do i=1,6 + binsx(i)=bins_work(i,iii,1) + end do + do k=2,npe do i=1,6 - binsx(i)=bins_work(i,iii,1) - end do - do k=2,npe - do i=1,6 - binsx(i)=binsx(i)+bins_work(i,iii,k) - end do + binsx(i)=binsx(i)+bins_work(i,iii,k) end do + end do + do i=1,6 + binsx(i)=binsx(i)*thiscount + end do + + thisrange= binsx(1) + thisazimuth=binsx(2) + thistilt=binsx(3) + thisvr=binsx(4) + vrmax=max(vrmax,thisvr) + vrmin=min(vrmin,thisvr) + thisvr2=binsx(5) + thiserr=sqrt(abs(thisvr2-thisvr**2)) + errmax=max(errmax,thiserr) + errmin=min(errmin,thiserr) + thistime=binsx(6) + + else + do i=1,6 + binsx(i)=bins_work(i,iii,1) + end do + do k=2,npe do i=1,6 - binsx(i)=binsx(i)*thiscount + binsx(i)=binsx(i)+bins_work(i,iii,k) end do - thisrange= binsx(1) - thisazimuth=binsx(2) - thistilt=binsx(3) - thisvr=binsx(4) - vrmax=max(vrmax,thisvr) - vrmin=min(vrmin,thisvr) - thisvr2=binsx(5) - thiserr=sqrt(abs(thisvr2-thisvr**2)) - errmax=max(errmax,thiserr) - errmin=min(errmin,thiserr) - thistime=binsx(6) + end do + do i=1,6 + binsx(i)=binsx(i)*thiscount + end do + + thisrange= binsx(1) + thisazimuth=binsx(2) + thistilt=binsx(3) + thisvr=binsx(4) + vrmax=max(vrmax,thisvr) + vrmin=min(vrmin,thisvr) + thisvr2=binsx(5) + thiserr=sqrt(abs(thisvr2-thisvr**2)) + errmax=max(errmax,thiserr) + errmin=min(errmin,thiserr) + thistime=binsx(6) + end if ! Compute obs height here ! Use 4/3rds rule to get elevation of radar beam @@ -735,7 +884,6 @@ subroutine radar_bufr_read_all(npe,mype) call invtllv(rlonloc,rlatloc,rlon0,clat0,slat0,rlonglob,rlatglob) thislat=rlatglob*rad2deg thislon=rlonglob*rad2deg - ! Keep away from poles, rather than properly deal with polar singularity if(abs(thislat)>r89_5) cycle @@ -753,7 +901,6 @@ subroutine radar_bufr_read_all(npe,mype) abs(corrected_azimuth-thisazimuth ),& abs(corrected_azimuth-thisazimuth+r360),& abs(corrected_azimuth-thisazimuth+r720)),delazmmax) - write(inbufr) this_staid,this_stalat,this_stalon,this_stahgt, & thistime,thislat,thislon,thishgt,thisvr,corrected_azimuth,& thiserr,corrected_tilt,gamma @@ -761,7 +908,7 @@ subroutine radar_bufr_read_all(npe,mype) end if end do if(nsuper > 0)then - write(6,*)' for radar ',this_staid,' nsuper=',nsuper,' delazmmax=',delazmmax + write(6,*)' for radar ',this_staid,' nsuper=',nsuper,' delazmmax=',delazmmax,lradar write(6,*)' vrmin,max=',vrmin,vrmax,' errmin,max=',errmin,errmax write(6,*)' deltiltmin,max=',deltiltmin,deltiltmax,' deldistmin,max=',deldistmin,deldistmax vrminall=min(vrminall,vrmin) @@ -787,12 +934,14 @@ subroutine radar_bufr_read_all(npe,mype) write(6,*)' deldistmin,maxall=',deldistminall,deldistmaxall end if close(inbufr) + close(inbufr) end if deallocate(bins_work,bins,ibins2) if(l2superob_only) then call mpi_finalize(ierror) stop end if + if (radar_sites) deallocate(rtable,rsite,ruse) end subroutine radar_bufr_read_all @@ -895,6 +1044,6 @@ SUBROUTINE invtllv(ALM,APH,TLMO,CTPH0,STPH0,TLM,TPH) DENOM=CTPH0*CC-STPH0*SPH TLM=tlmo+ATAN2(ANUM,DENOM) TPH=ASIN(CTPH0*SPH+STPH0*CC) - + return END SUBROUTINE invtllv end module read_l2bufr_mod diff --git a/src/gsi/read_lidar.f90 b/src/gsi/read_lidar.f90 index 3112606eed..6d74de0802 100644 --- a/src/gsi/read_lidar.f90 +++ b/src/gsi/read_lidar.f90 @@ -305,6 +305,7 @@ subroutine read_lidar(nread,ndata,nodata,infile,obstype,lunout,twind,sis,nobs) ! Close unit to bufr file deallocate(cdata_all) call closbf(lunin) + close(lunin) ! End of routine return diff --git a/src/gsi/read_modsbufr.f90 b/src/gsi/read_modsbufr.f90 index db551844ff..f2fab23a86 100644 --- a/src/gsi/read_modsbufr.f90 +++ b/src/gsi/read_modsbufr.f90 @@ -573,6 +573,7 @@ subroutine read_modsbufr(nread,ndata,nodata,gstime,infile,obstype,lunout, & 1020 continue if (oberrflg) deallocate(etabl) call closbf(lunin) + close(lunin) if(regional)then if(diagnostic_reg.and.ntest > 0) write(6,*)'READ_MODSBUFR: ',& diff --git a/src/gsi/read_nasa_larc.f90 b/src/gsi/read_nasa_larc.f90 index 71c6e939a4..8dbbbb2e68 100644 --- a/src/gsi/read_nasa_larc.f90 +++ b/src/gsi/read_nasa_larc.f90 @@ -199,6 +199,7 @@ subroutine read_nasa_larc(nread,ndata,infile,obstype,lunout,twind,sis,nobs) endif ! call closbf(lunin) + close(lunin) return 200 continue write(6,*) 'read_nasa_larc, Warning : cannot find LaRC data file' diff --git a/src/gsi/read_nsstbufr.f90 b/src/gsi/read_nsstbufr.f90 index 31435280dc..2b8dc239ae 100644 --- a/src/gsi/read_nsstbufr.f90 +++ b/src/gsi/read_nsstbufr.f90 @@ -604,6 +604,7 @@ subroutine read_nsstbufr(nread,ndata,nodata,gstime,infile,obstype,lunout, & 1020 continue if (oberrflg) deallocate(etabl) call closbf(lunin) + close(lunin) if(diagnostic_reg.and.ntest > 0) write(6,*)'READ_NSSTBUFR: ',& 'ntest,disterrmax=',ntest,disterrmax diff --git a/src/gsi/read_obs.F90 b/src/gsi/read_obs.F90 index c8a520146e..076149c3fe 100644 --- a/src/gsi/read_obs.F90 +++ b/src/gsi/read_obs.F90 @@ -60,6 +60,7 @@ subroutine gsi_inquire (lbytes,lexist,filename,mype) ! machine: Linux-cluster ! !$$$ end documentation block +! use kinds, only: i_kind,i_llong @@ -134,7 +135,8 @@ subroutine read_obs_check (lexist,filename,jsatid,dtype,minuse,nread) ! 2017-11-16 dutta - adding KOMPSAT5 bufr i.d for reading the data. ! 2019-03-27 h. liu - add abi ! 2019-09-20 X.Su -add read new variational qc table -! +! 2019-08-21 H. Shao - add METOPC-C, COSMIC-2 and PAZ to the GPS check list +! 2020-05-21 H. Shao - add commercial GNSSRO (Spire, PlanetIQ, GeoOptics) and other existing missions to the check list ! ! input argument list: ! lexist - file status @@ -325,6 +327,7 @@ subroutine read_obs_check (lexist,filename,jsatid,dtype,minuse,nread) end if call closbf(lnbufr) + close(lnbufr) open(lnbufr,file=trim(filename),form='unformatted',status ='unknown') call openbf(lnbufr,'IN',lnbufr) call datelen(10) @@ -379,12 +382,14 @@ subroutine read_obs_check (lexist,filename,jsatid,dtype,minuse,nread) end if said=nint(satid) - if(((said > 739) .and.(said < 746)).or.(said == 820).or. & - (said == 825).or. (said == 786).or.(said == 4) .or. & - (said == 3) .or. (said == 421).or.(said == 440).or. & - (said == 821).or. ((said > 749) .and.(said < 756)).or. & - (said == 44) .or. (said == 5) .or. & - ( GMAO_READ .and. said == 5) ) then + if(((said > 739) .and.(said < 746)).or. (said == 820) .or. & + (said == 825).or. (said == 786).or. (said == 4) .or. & + (said == 3) .or. (said == 421).or. (said == 440) .or. & + (said == 821).or. ((said > 749).and.(said < 756)) .or. & + (said == 44) .or. (said == 5) .or. (said == 41) .or. & + (said == 42) .or. (said == 43) .or. (said == 722) .or. & + (said == 723).or. (said == 265).or. (said == 266) .or. & + (said == 267).or. (said == 268).or. (said == 269)) then lexist=.true. exit gpsloop end if @@ -433,7 +438,11 @@ subroutine read_obs_check (lexist,filename,jsatid,dtype,minuse,nread) trim(subset) == 'NC005065' .or. trim(subset) == 'NC005066' .or.& trim(subset) == 'NC005030' .or. trim(subset) == 'NC005031' .or.& trim(subset) == 'NC005032' .or. trim(subset) == 'NC005034' .or.& - trim(subset) == 'NC005039' .or. trim(subset) == 'NC005091') then + trim(subset) == 'NC005039' .or. & + trim(subset) == 'NC005090' .or. trim(subset) == 'NC005091' .or.& + trim(subset) == 'NC005067' .or. trim(subset) == 'NC005068' .or. trim(subset) == 'NC005069' .or.& + trim(subset) == 'NC005081' .or. & + trim(subset) == 'NC005072' ) then lexist = .true. exit loop endif @@ -544,6 +553,7 @@ subroutine read_obs_check (lexist,filename,jsatid,dtype,minuse,nread) end if call closbf(lnbufr) + close(lnbufr) end if if(lexist)then write(6,*)'read_obs_check: bufr file date is ',idate,trim(filename),' ',dtype,jsatid @@ -694,15 +704,16 @@ subroutine read_obs(ndata,mype) use obsmod, only: iadate,ndat,time_window,dplat,dsfcalc,dfile,dthin, & dtype,dval,dmesh,obsfile_all,ref_obs,nprof_gps,dsis,ditype,& perturb_obs,lobserver,lread_obs_save,obs_input_common, & - reduce_diag,nobs_sub,dval_use + reduce_diag,nobs_sub,dval_use,hurricane_radar,l2rwthin use gsi_nstcouplermod, only: nst_gsi ! use gsi_nstcouplermod, only: gsi_nstcoupler_set + use hdraobmod, only: read_hdraob,nhdt,nhdq,nhduv,nhdps,hdtlist,hdqlist,hduvlist,hdpslist,nodet,nodeq,nodeuv,nodeps use qcmod, only: njqc,vadwnd_l2rw_qc,nvqc use gsi_4dvar, only: l4dvar use satthin, only: super_val,super_val1,superp,makegvals,getsfc,destroy_sfc - use mpimod, only: ierror,mpi_comm_world,mpi_sum,mpi_rtype,mpi_integer,npe,& + use mpimod, only: ierror,mpi_comm_world,mpi_sum,mpi_max,mpi_rtype,mpi_integer,npe,& setcomm - use constants, only: one,zero + use constants, only: one,zero,izero use converr, only: converr_read use converr_ps, only: converr_ps_read use converr_q, only: converr_q_read @@ -760,6 +771,7 @@ subroutine read_obs(ndata,mype) integer(i_kind):: npetot,npeextra,mmdat,nodata integer(i_kind):: iworld,iworld_group,next_mype,mm1,iix integer(i_kind):: mype_root + integer(i_kind),dimension(8):: nhd,nhd1 integer(i_kind):: minuse,lunsave,maxproc,minproc integer(i_kind),dimension(ndat):: npe_sub,npe_sub3,mpi_comm_sub,mype_root_sub,npe_order integer(i_kind),dimension(ndat):: ntasks1,ntasks @@ -829,7 +841,15 @@ subroutine read_obs(ndata,mype) deallocate(nrnd) endif - +! Set number of high definition stations to zero + nhdt=izero + nhdq=izero + nhduv=izero + nhdps=izero + nodet=izero + nodeq=izero + nodeuv=izero + nodeps=izero ! Set data class and number of reader tasks. Set logical flag to indicate ! type type of GPS data (if present) @@ -1245,10 +1265,15 @@ subroutine read_obs(ndata,mype) end if end do end if - if(obstype == 'rw')then + if(dfile(i) == 'uprair')then + use_prsl_full=.true. + use_hgtl_full = .true. + if(belong(i))use_hgtl_full_proc=.true. + if(belong(i))use_prsl_full_proc=.true. + else if(obstype == 'rw')then use_hgtl_full=.true. if(belong(i))use_hgtl_full_proc=.true. - else if(obstype == 'dbz')then + else if(obstype == 'dbz')then use_hgtl_full=.true. if(belong(i))use_hgtl_full_proc=.true. end if @@ -1382,6 +1407,10 @@ subroutine read_obs(ndata,mype) call read_fl_hdob(nread,npuse,nouse,infile,obstype,lunout,gstime,twind,sis,& prsl_full,nobs_sub1(1,i)) string='READ_FL_HDOB' + else if (index(infile,'uprair') /=0)then + call read_hdraob(nread,npuse,nouse,infile,obstype,lunout,twind,sis,& + prsl_full,hgtl_full,nobs_sub1(1,i),read_rec(i)) + string='READ_UPRAIR' else call read_prepbufr(nread,npuse,nouse,infile,obstype,lunout,twind,sis,& prsl_full,nobs_sub1(1,i),read_rec(i)) @@ -1445,6 +1474,11 @@ subroutine read_obs(ndata,mype) call read_satwnd(nread,npuse,nouse,infile,obstype,lunout,gstime,twind,sis,& prsl_full,nobs_sub1(1,i)) string='READ_SATWND' +! Process high resolution radiosonde data + else if (index(infile,'uprair') /=0)then + call read_hdraob(nread,npuse,nouse,infile,obstype,lunout,twind,sis,& + prsl_full,hgtl_full,nobs_sub1(1,i),read_rec(i)) + string='READ_UPRAIR' ! Process oscat winds which seperate from prepbufr elseif ( index(infile,'oscatbufr') /=0 ) then call read_sfcwnd(nread,npuse,nouse,infile,obstype,lunout,gstime,twind,sis,& @@ -1459,6 +1493,10 @@ subroutine read_obs(ndata,mype) call read_fl_hdob(nread,npuse,nouse,infile,obstype,lunout,gstime,twind,sis,& prsl_full,nobs_sub1(1,i)) string='READ_FL_HDOB' + else if (index(infile,'uprair') /=0)then + call read_hdraob(nread,npuse,nouse,infile,obstype,lunout,twind,sis,& + prsl_full,hgtl_full,nobs_sub1(1,i),read_rec(i)) + string='READ_UPRAIR' else call read_prepbufr(nread,npuse,nouse,infile,obstype,lunout,twind,sis,& prsl_full,nobs_sub1(1,i),read_rec(i)) @@ -1523,20 +1561,35 @@ subroutine read_obs(ndata,mype) if( trim(infile) == 'vr_vol' )then call read_radar_wind_ascii(nread,npuse,nouse,infile,lunout,obstype,sis,& hgtl_full,nobs_sub1(1,i)) + string='READ_RADAR_WIND' + else if (hurricane_radar) then + if (sis == 'rw' ) then + write(6,*)'READ_OBS: radial wind,read_radar,dfile=',infile,',dsis=',sis + call read_radar(nread,npuse,nouse,infile,lunout,obstype,twind,sis,& + hgtl_full,nobs_sub1(1,i)) + string='READ_RADAR' + else if (sis == 'l2rw') then + if (l2rwthin)then + call read_radar_l2rw(npuse,nouse,lunout,obstype,sis,nobs_sub1(1,i),hgtl_full) + string='READ_RADAR_L2RW_NOVADQC' + else + write(6,*)'READ_OBS: radial wind,read_radar_l2rw_novadqc,dfile=',infile,',dsis=',sis + call read_radar_l2rw_novadqc(npuse,nouse,lunout,obstype,sis,nobs_sub1(1,i)) + string='READ_RADAR_L2RW_NOVADQC' + end if + end if else - if (vadwnd_l2rw_qc) then + if (vadwnd_l2rw_qc) then write(6,*)'READ_OBS: radial wind,read_radar,dfile=',infile,',dsis=',sis call read_radar(nread,npuse,nouse,infile,lunout,obstype,twind,sis,& hgtl_full,nobs_sub1(1,i)) string='READ_RADAR' - else if (sis == 'l2rw') then + else if (sis == 'l2rw') then write(6,*)'READ_OBS: radial wind,read_radar_l2rw_novadqc,dfile=',infile,',dsis=',sis call read_radar_l2rw_novadqc(npuse,nouse,lunout,obstype,sis,nobs_sub1(1,i)) string='READ_RADAR_L2RW_NOVADQC' - end if + end if end if - string='READ_RADAR_WIND' - ! Process radar reflectivity from MRMS else if (obstype == 'dbz' ) then print *, "calling read_dbz" @@ -1815,8 +1868,6 @@ subroutine read_obs(ndata,mype) end if ditype_select -! Close unit to data file - ! Accumulate data counts on "root" task if (mype_sub(mm1,i)==mype_root) then close(lunout) @@ -1833,12 +1884,9 @@ subroutine read_obs(ndata,mype) call warn('read_obs',' string =',trim(string)) endif - write(6,8000) adjustl(string),infile,obstype,sis,nread,ithin,& - rmesh,isfcalc,nouse,npe_sub(i) -8000 format(1x,a22,': file=',a15,& - ' type=',a10, ' sis=',a20, ' nread=',i10,& - ' ithin=',i2, ' rmesh=',f11.6,' isfcalc=',i2,& - ' nkeep=',i10,' ntask=',i3) + write(6, '(a,'': file='',a,'' type='',a,'' sis='',a,'' nread='',i10,& + '' ithin='',i2,'' rmesh='',f11.6,'' isfcalc='',i2,'' nkeep='',i10,& + '' ntask='',i3)') endif endif task_belongs @@ -1872,6 +1920,43 @@ subroutine read_obs(ndata,mype) end if super_val1(0)=one deallocate(super_val) + nhd(1)=nhdt + nhd(2)=nhdq + nhd(3)=nhduv + nhd(4)=nhdps + nhd(5)=nodet + nhd(6)=nodeq + nhd(7)=nodeuv + nhd(8)=nodeps +! get number of high resolution stations on every processor + call mpi_allreduce(nhd,nhd1,8,mpi_integer,mpi_max,mpi_comm_world,ierror) + nhdt=nhd1(1) + nhdq=nhd1(2) + nhduv=nhd1(3) + nhdps=nhd1(4) + nodet=nhd1(5) + nodeq=nhd1(6) + nodeuv=nhd1(7) + nodeps=nhd1(8) + if(nhdt > 0)then + if(.not. allocated(hdtlist))allocate(hdtlist(nhdt)) + call mpi_bcast(hdtlist,nhdt,mpi_integer,nodet,mpi_comm_world,ierror) + end if + if(nhdq > 0) then + if(.not. allocated(hdqlist))allocate(hdqlist(nhdq)) + call mpi_bcast(hdqlist,nhdq,mpi_integer,nodeq,mpi_comm_world,ierror) + end if + if(nhduv > 0) then + if(.not. allocated(hduvlist))allocate(hduvlist(nhduv)) + call mpi_bcast(hduvlist,nhduv,mpi_integer,nodeuv,mpi_comm_world,ierror) + end if + if(nhdps > 0)then + if(.not. allocated(hdpslist))allocate(hdpslist(nhduv)) + call mpi_bcast(hdpslist,nhdps,mpi_integer,nodeps,mpi_comm_world,ierror) + end if + + if(mype == 0)write(6,*)'number of HD stations',nhdt,nhdq,nhduv,nhdps + if(mype == 0)write(6,*)'processors ',nodet,nodeq,nodeuv,nodeps ! Collect number of gps profiles (needed later for qc) call mpi_allreduce(nprof_gps1,nprof_gps,1,mpi_integer,mpi_sum,mpi_comm_world,ierror) diff --git a/src/gsi/read_ozone.f90 b/src/gsi/read_ozone.f90 index 74c95e09db..9e1cd94168 100644 --- a/src/gsi/read_ozone.f90 +++ b/src/gsi/read_ozone.f90 @@ -424,6 +424,8 @@ subroutine read_ozone(nread,ndata,nodata,jsatid,infile,gstime,lunout, & ! Loop back to read next profile end do read_loop1 + call closbf(lunin) + close(lunin) ! End of bufr ozone block ! Process GOME-2 data @@ -583,6 +585,8 @@ subroutine read_ozone(nread,ndata,nodata,jsatid,infile,gstime,lunout, & end do obsloop + call closbf(lunin) + close(lunin) ! End of GOME bufr block @@ -753,6 +757,8 @@ subroutine read_ozone(nread,ndata,nodata,jsatid,infile,gstime,lunout, & ! End of loop over observations end do read_loop2 + call closbf(lunin) + close(lunin) ! End of OMI/OMPS-NM(or TC8) block @@ -862,6 +868,7 @@ subroutine read_ozone(nread,ndata,nodata,jsatid,infile,gstime,lunout, & ! Reopen unit to bufr file call closbf(lunin) + close(lunin) open(lunin,file=trim(infile),form='unformatted') call openbf(lunin,'IN',lunin) call datelen(10) @@ -1056,6 +1063,8 @@ subroutine read_ozone(nread,ndata,nodata,jsatid,infile,gstime,lunout, & end do read_loop4 + call closbf(lunin) + close(lunin) ! End of MLS bufr loop !Process OMPS LP data @@ -1222,6 +1231,8 @@ subroutine read_ozone(nread,ndata,nodata,jsatid,infile,gstime,lunout, & enddo enddo read_loop5 + call closbf(lunin) + close(lunin) ! end of OMPS LP bufr loop endif @@ -1270,10 +1281,6 @@ subroutine read_ozone(nread,ndata,nodata,jsatid,infile,gstime,lunout, & if(allocated(usage1))deallocate(usage1) endif -! Close unit to input data file - call closbf(lunin) - close(lunin) - ! Deallocate satthin arrays if (obstype == 'omi' .or. obstype == 'gome' .or. obstype=='ompsnm' .or. obstype == 'ompstc8' )call destroygrids diff --git a/src/gsi/read_pblh.f90 b/src/gsi/read_pblh.f90 index ff7d2f220b..a7b7c066a2 100644 --- a/src/gsi/read_pblh.f90 +++ b/src/gsi/read_pblh.f90 @@ -99,7 +99,7 @@ subroutine read_pblh(nread,ndata,nodata,infile,obstype,lunout,twindin,& ntest=0 nrtmax=0 ! # rpts to print per msg type (0=all) - call closbf(lunin) +! call closbf(lunin) open(lunin,file=trim(infile),form='unformatted') call mesgbc(lunin,msgt,icomp) call openbf(lunin,'IN',lunin) @@ -157,6 +157,7 @@ subroutine read_pblh(nread,ndata,nodata,infile,obstype,lunout,twindin,& ilon=2 ilat=3 call closbf(lunin) + close(lunin) open(lunin,file=trim(infile),form='unformatted') call mesgbc(lunin,msgt,icomp) call openbf(lunin,'IN',lunin) @@ -477,6 +478,7 @@ subroutine read_pblh(nread,ndata,nodata,infile,obstype,lunout,twindin,& write(*,*) ! closing linefeed, debug? call closbf(lunin) + close(lunin) ! Normal exit ! Write observation to scratch file @@ -486,9 +488,7 @@ subroutine read_pblh(nread,ndata,nodata,infile,obstype,lunout,twindin,& deallocate(cdata_all) if (ndata == 0) then - call closbf(lunin) - write(6,*)'READ_PREPFITS: closbf(',lunin,')' + write(6,*)'READ_PREPFITS no data' endif - close(lunin) end subroutine read_pblh diff --git a/src/gsi/read_pcp.f90 b/src/gsi/read_pcp.f90 index 929a608ee7..5c15899466 100644 --- a/src/gsi/read_pcp.f90 +++ b/src/gsi/read_pcp.f90 @@ -147,7 +147,6 @@ subroutine read_pcp(nread,ndata,nodata,gstime,infile,lunout,obstype, & ! Open and read the bufr data - call closbf(lnbufr) open(lnbufr,file=trim(infile),form='unformatted') call openbf(lnbufr,'IN',lnbufr) call datelen(10) @@ -354,6 +353,7 @@ subroutine read_pcp(nread,ndata,nodata,gstime,infile,lunout,obstype, & ! Jump here if there is a problem opening the bufr file 110 continue call closbf(lnbufr) + close(lnbufr) ! End of routine return diff --git a/src/gsi/read_prepbufr.f90 b/src/gsi/read_prepbufr.f90 index 8e8a08b970..87cf808777 100644 --- a/src/gsi/read_prepbufr.f90 +++ b/src/gsi/read_prepbufr.f90 @@ -146,6 +146,8 @@ subroutine read_prepbufr(nread,ndata,nodata,infile,obstype,lunout,twindin,sis,& ! 2019-09-27 Su - add hilbert curve application to aircraft winds ! 2019-12-05 mmorris - Update adjust_goescldobs to reject ALL clear cloud obs at night ! +! 2020-05-04 wu - no rotate_wind for fv3_regional + ! input argument list: ! infile - unit from which to read BUFR data ! obstype - observation type to process @@ -173,7 +175,7 @@ subroutine read_prepbufr(nread,ndata,nodata,infile,obstype,lunout,twindin,sis,& use constants,only: rearth,stndrd_atmos_ps,rd,grav use gridmod, only: diagnostic_reg,regional,nlon,nlat,nsig,& tll2xy,txy2ll,rotate_wind_ll2xy,rotate_wind_xy2ll,& - rlats,rlons,twodvar_regional + rlats,rlons,twodvar_regional,fv3_regional use convinfo, only: nconvtype,ctwind, & ncmiter,ncgroup,ncnumgrp,icuse,ictype,icsubtype,ioctype, & ithin_conv,rmesh_conv,pmesh_conv,pmot_conv,ptime_conv, & @@ -613,7 +615,6 @@ subroutine read_prepbufr(nread,ndata,nodata,infile,obstype,lunout,twindin,sis,& ncount_ps=0;ncount_q=0;ncount_t=0;ncount_uv=0;ncount_pw=0 ! Open, then read date from bufr data - call closbf(lunin) open(lunin,file=trim(infile),form='unformatted') call openbf(lunin,'IN',lunin) call datelen(10) @@ -908,6 +909,7 @@ subroutine read_prepbufr(nread,ndata,nodata,infile,obstype,lunout,twindin,sis,& call closbf(lunin) + close(lunin) open(lunin,file=infile,form='unformatted') call openbf(lunin,'IN',lunin) call datelen(10) @@ -1106,6 +1108,12 @@ subroutine read_prepbufr(nread,ndata,nodata,infile,obstype,lunout,twindin,sis,& if (sfctype) then call ufbint(lunin,r_prvstg,1,1,iret,prvstr) call ufbint(lunin,r_sprvstg,1,1,iret,sprvstr) + else if(kx == 120 .and. tob .or. qob .or. psob)then + c_prvstg=cspval + c_sprvstg='PREP' + else if(kx == 220 .and. uvob)then + c_prvstg=cspval + c_sprvstg='PREP' else c_prvstg=cspval c_sprvstg=cspval @@ -2185,7 +2193,7 @@ subroutine read_prepbufr(nread,ndata,nodata,infile,obstype,lunout,twindin,sis,& if(sqrt(uob**2+vob**2)>60.0_r_kind)cycle LOOP_readsb end if - if(regional)then + if(regional .and. .not. fv3_regional)then u0=uob v0=vob call rotate_wind_ll2xy(u0,v0,uob,vob,dlon_earth,dlon,dlat) @@ -2341,7 +2349,7 @@ subroutine read_prepbufr(nread,ndata,nodata,infile,obstype,lunout,twindin,sis,& if(perturb_obs)cdata_all(24,iout)=ran01dom()*perturb_fact ! q perturbation if (twodvar_regional) & call adjust_error(cdata_all(15,iout),cdata_all(16,iout),cdata_all(12,iout),cdata_all(1,iout)) - + ! Total precipitable water (ssm/i) else if(pwob) then @@ -2906,8 +2914,6 @@ subroutine read_prepbufr(nread,ndata,nodata,infile,obstype,lunout,twindin,sis,& ! ! End of bufr read loop enddo loop_msg -! Close unit to bufr file - call closbf(lunin) ! Deallocate arrays used for thinning data if (.not.use_all) then @@ -2924,6 +2930,9 @@ subroutine read_prepbufr(nread,ndata,nodata,infile,obstype,lunout,twindin,sis,& enddo loop_convinfo! loops over convinfo entry matches deallocate(lmsg,tab,nrep) +! Close unit to bufr file + call closbf(lunin) + close(lunin) ! Apply hilbert curve for cross validation if requested @@ -3150,10 +3159,8 @@ subroutine read_prepbufr(nread,ndata,nodata,infile,obstype,lunout,twindin,sis,& if(diagnostic_reg .and. nvtest>0) write(6,*)'READ_PREPBUFR: ',& 'nvtest,vdisterrmax=',ntest,vdisterrmax - call closbf(lunin) if(print_verbose)write(6,*)'READ_PREPBUFR: closbf(',lunin,')' - close(lunin) ! End of routine return diff --git a/src/gsi/read_radar.f90 b/src/gsi/read_radar.f90 index 11521f5bf0..2d7c039995 100644 --- a/src/gsi/read_radar.f90 +++ b/src/gsi/read_radar.f90 @@ -60,6 +60,7 @@ subroutine read_radar(nread,ndata,nodata,infile,lunout,obstype,twind,sis,hgtl_fu ! to help fix a multiple data read bug (when l2rwbufr and radarbufr were both ! listed in the OBS_INPUT table) and for added flexibility for experimental setups. ! 2018-02-15 wu - add code for fv3_regional option +! 2020-05-04 wu - no rotate_wind for fv3_regional ! ! ! input argument list: @@ -89,7 +90,8 @@ subroutine read_radar(nread,ndata,nodata,infile,lunout,obstype,twind,sis,hgtl_fu use qcmod, only: erradar_inflate,vadfile,newvad use obsmod, only: iadate,ianldate,l_foreaft_thin use gsi_4dvar, only: l4dvar,l4densvar,iwinbgn,winlen,time_4dvar,thin4d - use gridmod, only: regional,nlat,nlon,tll2xy,rlats,rlons,rotate_wind_ll2xy,nsig + use gridmod, only: regional,nlat,nlon,tll2xy,rlats,rlons,rotate_wind_ll2xy,nsig,& + fv3_regional use gridmod, only: wrf_nmm_regional,nems_nmmb_regional,cmaq_regional,wrf_mass_regional use gridmod, only: fv3_regional use convinfo, only: nconvtype,ctwind, & @@ -260,7 +262,7 @@ subroutine read_radar(nread,ndata,nodata,infile,lunout,obstype,twind,sis,hgtl_fu if (.not.lexist1 .and. .not.lexist2) return eradkm=rearth*0.001_r_kind - maxobs=2e6 + maxobs=2e8 nreal=maxdat nchanl=0 ilon=2 @@ -342,6 +344,7 @@ subroutine read_radar(nread,ndata,nodata,infile,lunout,obstype,twind,sis,hgtl_fu end do loop0 call closbf(lnbufr) + close(lnbufr) ! enddo msg_report @@ -469,6 +472,7 @@ subroutine read_radar(nread,ndata,nodata,infile,lunout,obstype,twind,sis,hgtl_fu ! Normal exit end if call closbf(lnbufr) + close(lnbufr) ! Print vadwnd table @@ -680,7 +684,7 @@ subroutine read_radar(nread,ndata,nodata,infile,lunout,obstype,twind,sis,hgtl_fu height= thishgt rwnd = thisvr azm_earth = corrected_azimuth - if(regional) then + if(regional .and. .not. fv3_regional) then cosazm_earth=cos(azm_earth*deg2rad) sinazm_earth=sin(azm_earth*deg2rad) call rotate_wind_ll2xy(cosazm_earth,sinazm_earth,cosazm,sinazm,dlon_earth,dlon,dlat) @@ -811,7 +815,7 @@ subroutine read_radar(nread,ndata,nodata,infile,lunout,obstype,twind,sis,hgtl_fu end do - close(lnbufr) ! A simple unformatted fortran file should not be mixed with a bufr I/O + close(lnbufr) ! A simple unformatted fortran file should not be mixed with a bufr I/O LEVEL_TWO_READ_2: if(loop==0 .and. sis=='l2rw') then write(6,*)'READ_RADAR: ',trim(outmessage),' reached eof on 2/2.5/3 superob radar file' @@ -1088,7 +1092,7 @@ subroutine read_radar(nread,ndata,nodata,infile,lunout,obstype,twind,sis,hgtl_fu height= radar_obs(4,k) rwnd = radar_obs(5,k) azm_earth = r90-radar_obs(6,k) - if(regional) then + if(regional .and. .not. fv3_regional) then cosazm_earth=cos(azm_earth*deg2rad) sinazm_earth=sin(azm_earth*deg2rad) call rotate_wind_ll2xy(cosazm_earth,sinazm_earth,cosazm,sinazm,dlon_earth,dlon,dlat) @@ -1247,6 +1251,7 @@ subroutine read_radar(nread,ndata,nodata,infile,lunout,obstype,twind,sis,hgtl_fu ! Close unit to bufr file call closbf(lnbufr) + close(lnbufr) write(6,*)'READ_RADAR: ',trim(outmessage),' reached eof on 2.5/3 superob radar file.' @@ -1522,7 +1527,7 @@ subroutine read_radar(nread,ndata,nodata,infile,lunout,obstype,twind,sis,hgtl_fu height= z(ii) rwnd = thisvr azm_earth = glob_azimuth8(ii) - if(regional) then + if(regional .and. .not. fv3_regional) then cosazm_earth=cos(azm_earth*deg2rad) sinazm_earth=sin(azm_earth*deg2rad) call rotate_wind_ll2xy(cosazm_earth,sinazm_earth,cosazm,sinazm,dlon_earth,dlon,dlat) @@ -1686,6 +1691,7 @@ subroutine read_radar(nread,ndata,nodata,infile,lunout,obstype,twind,sis,hgtl_fu close(25) end do ! end of loop, reading TDR so data files + close(lnbufr) else @@ -2041,7 +2047,7 @@ subroutine read_radar(nread,ndata,nodata,infile,lunout,obstype,twind,sis,hgtl_fu height= z(i) rwnd = dopbin(i) azm_earth = glob_azimuth8(i) - if(regional) then + if(regional .and. .not. fv3_regional) then cosazm_earth=cos(azm_earth*deg2rad) sinazm_earth=sin(azm_earth*deg2rad) call rotate_wind_ll2xy(cosazm_earth,sinazm_earth,cosazm,sinazm,dlon_earth,dlon,dlat) @@ -2401,7 +2407,8 @@ subroutine read_radar_l2rw_novadqc(ndata,nodata,lunout,obstype,sis,nobs) use qcmod, only: erradar_inflate use oneobmod, only: oneobtest,learthrel_rw use gsi_4dvar, only: l4dvar,l4densvar,winlen,time_4dvar - use gridmod, only: regional,nlat,nlon,tll2xy,rlats,rlons,rotate_wind_ll2xy + use gridmod, only: regional,nlat,nlon,tll2xy,rlats,rlons,rotate_wind_ll2xy,& + fv3_regional use convinfo, only: nconvtype,ncmiter,ncgroup,ncnumgrp,icuse,ioctype use deter_sfc_mod, only: deter_sfc2 use mpimod, only: npe @@ -2504,7 +2511,7 @@ subroutine read_radar_l2rw_novadqc(ndata,nodata,lunout,obstype,sis,nobs) ! Initialize variables xscale=1000._r_kind xscalei=one/xscale - max_rrr=nint(100000.0_r_kind*xscalei) + max_rrr=nint(200000.0_r_kind*xscalei) nboxmax=1 kx0=22500 @@ -2630,7 +2637,7 @@ subroutine read_radar_l2rw_novadqc(ndata,nodata,lunout,obstype,sis,nobs) rwnd = thisvr azm_earth = corrected_azimuth - if(regional) then + if(regional .and. .not. fv3_regional) then if(oneobtest .and. learthrel_rw) then ! for non rotated winds!!! cosazm=cos(azm_earth*deg2rad) sinazm=sin(azm_earth*deg2rad) @@ -2767,3 +2774,608 @@ subroutine read_radar_l2rw_novadqc(ndata,nodata,lunout,obstype,sis,nobs) end subroutine read_radar_l2rw_novadqc +!!!!!!!!!!!!!!! Added for l2rw thinning !!!!!!!!!!!!!!! +subroutine read_radar_l2rw(ndata,nodata,lunout,obstype,sis,nobs,hgtl_full) + use kinds, only: r_kind,r_single,r_double,i_kind,i_byte + use constants, only: zero,half,one,two,deg2rad,rearth,rad2deg,r1000,r100,r400 + use qcmod, only: erradar_inflate + use oneobmod, only: oneobtest,learthrel_rw + use gsi_4dvar, only: l4dvar,l4densvar,winlen,time_4dvar + use gridmod, only: regional,nlat,nlon,tll2xy,rlats,rlons,rotate_wind_ll2xy,nsig + use obsmod, only: doradaroneob,oneobradid,time_offset + use mpeu_util, only: gettablesize,gettable + use convinfo, only: nconvtype,icuse,ioctype + use deter_sfc_mod, only: deter_sfc2 + use mpimod, only: npe + use read_l2bufr_mod, only: radar_sites,radar_rmesh,radar_zmesh,elev_angle_max,del_time,range_max + use constants, only: eccentricity,somigliana,grav_ratio,grav,semi_major_axis,flattening,grav_equator + use obsmod,only: radar_no_thinning,iadate + use convthin, only: make3grids,map3grids + + implicit none + +! Declare passed variables + character(len=*),intent(in ) :: obstype + character(len=20),intent(in ) :: sis + integer(i_kind) ,intent(in ) :: lunout + integer(i_kind) ,intent(inout) :: ndata,nodata + integer(i_kind),dimension(npe) ,intent(inout) :: nobs + real(r_kind),dimension(nlat,nlon,nsig),intent(in):: hgtl_full + +! Declare local parameters + integer(i_kind),parameter:: maxlevs=1500 + integer(i_kind),parameter:: maxdat=22 + real(r_kind),parameter:: r4_r_kind = 4.0_r_kind + + + real(r_kind),parameter:: r6 = 6.0_r_kind + real(r_kind),parameter:: r8 = 8.0_r_kind + real(r_kind),parameter:: r90 = 90.0_r_kind + real(r_kind),parameter:: r200 = 200.0_r_kind + real(r_kind),parameter:: r150 = 150.0_r_kind + real(r_kind),parameter:: r360 = 360.0_r_kind + real(r_kind),parameter:: r50000 = 50000.0_r_kind + real(r_kind),parameter:: r89_5 = 89.5_r_kind + real(r_kind),parameter:: four_thirds = 4.0_r_kind / 3.0_r_kind + integer(i_kind),parameter:: n_gates_max=4000 + real(r_double),parameter:: r1e5_double = 1.0e5_r_double + real(r_kind),parameter:: rinv60 = 1.0_r_kind/60.0_r_kind + logical good,outside,good0 + + character(30) outmessage + integer(i_kind) lnbufr,i,k,maxobs + integer(i_kind) nmrecs,ibadazm,ibadwnd,ibaddist,ibadheight,kthin + integer(i_kind) ibadstaheight,ibaderror,notgood,iheightbelowsta,ibadfit + integer(i_kind) notgood0 + integer(i_kind) iret,kx0 + integer(i_kind) nreal,nchanl,ilat,ilon,ikx + integer(i_kind) idomsfc + real(r_kind) usage,ff10,sfcr,skint,t4dvo,toff + real(r_kind) eradkm,dlat_earth,dlon_earth + real(r_kind) dlat,dlon,staheight,tiltangle,clon,slon,clat,slat + real(r_kind) timeo,clonh,slonh,clath,slath,cdist,dist + real(r_kind) rwnd,azm,height,error + real(r_kind) azm_earth,cosazm_earth,sinazm_earth,cosazm,sinazm + real(r_kind):: zsges + + real(r_kind),dimension(maxdat):: cdata + real(r_kind),allocatable,dimension(:,:):: cdata_all + + real(r_double) rstation_id + character(8) cstaid + character(4) this_staid + equivalence (this_staid,cstaid) + equivalence (cstaid,rstation_id) + + + integer(i_kind) loop + real(r_kind) timemax,timemin,errmax,errmin + real(r_kind) dlatmax,dlonmax,dlatmin,dlonmin + real(r_kind) xscale,xscalei + integer(i_kind) max_rrr,nboxmax + integer(i_kind) irrr,iaaa,iaaamax,iaaamin + real(r_kind) this_stalat,this_stalon,this_stahgt,thistime,thislat,thislon + real(r_kind) thishgt,thisvr,corrected_azimuth,thiserr,corrected_tilt + integer(i_kind) nsuper2_in,nsuper2_kept + real(r_kind) errzmax + character(len=*),parameter:: tbname='SUPEROB_RADAR::' + integer(i_kind) ntot,radar_true,radar_count,inbufr,lundx,idups,idate,n_gates,levs + integer(i_kind) idate5(5) + integer(i_kind) nminref,nminthis,nrange_max + integer(i_kind) nobs_in,nradials_in,nradials_fail_angmax,nradials_fail_time,nradials_fail_elb,ireadmg,ireadsb + + integer(i_kind) nobs_badvr,nobs_badsr,j + real(r_kind) rlon0,clat0,slat0,this_stalatr,thisrange,thisazimuth,thistilt,thisvr2 + real(r_kind) rad_per_meter,erad,ddiffmin,distfact + character(len=256),allocatable,dimension(:):: rtable + character(4),allocatable,dimension(:):: rsite + integer(i_kind),allocatable,dimension(:):: ruse + character(8) chdr2,subset + real(r_double) rdisttest(n_gates_max),hdr(10),hdr2(12),rwnd0(3,n_gates_max) + character(4) stn_id + equivalence (chdr2,hdr2(1)) + real(r_kind) stn_lat,stn_lon,stn_hgt,stn_az,stn_el,t,range,vrmax,vrmin,aactual,a43,b,c,selev0,celev0,thistiltr,epsh,h,ha,rlonloc,rlatloc + + real(r_kind) celev,selev,gamma,thisazimuthr,rlonglob,rlatglob,clat1,caz0,saz0,cdlon,sdlon,caz1,saz1 + real(r_kind):: relm,srlm,crlm,sph,cph,cc,anum,denom + real(r_kind) :: rmesh,xmesh,zmesh,dx,dy,dx1,dy1,w00,w01,w10,w11 + real(r_kind), allocatable, dimension(:) :: zl_thin + integer(i_kind) :: ithin,zflag,nlevz,icntpnt,klon1,klat1,kk,klatp1,klonp1 + real(r_kind),dimension(nsig):: hges,zges + real(r_kind) sin2,termg,termr,termrg,zobs + integer(i_kind) ntmp,iout,iiout,ntdrvr_thin2 + real(r_kind) crit1,timedif + integer(i_kind) maxout,maxdata + logical :: luse + integer(i_kind) iyref,imref,idref,ihref,nout + + integer(i_kind),allocatable,dimension(:):: isort + +! following variables are for fore/aft separation + integer(i_kind) irec + + data lnbufr/10/ + if (radar_sites) then + open(666,file=trim('gsiparm.anl'),form='formatted') + call gettablesize(tbname,666,ntot,radar_count) + allocate(rtable(radar_count),rsite(radar_count),ruse(radar_count)) + call gettable(tbname,666,ntot,radar_count,rtable) + do i=1,radar_count + read(rtable(i),*) rsite(i),ruse(i) + write(*,'(A10,X,A4,X,I)'),"Radar Sites: ",rsite(i),ruse(i) + end do + end if + rad_per_meter= one/rearth + erad = rearth + + eradkm=rearth*0.001_r_kind + maxobs=2e7 + nreal=maxdat + nchanl=0 + ilon=2 + ilat=3 + ikx=0 + do j=1,nconvtype + if(trim(ioctype(j)) == trim(obstype))ikx = j + end do + iaaamax=-huge(iaaamax) + iaaamin=huge(iaaamin) + dlatmax=-huge(dlatmax) + dlonmax=-huge(dlonmax) + dlatmin=huge(dlatmin) + dlonmin=huge(dlonmin) + allocate(cdata_all(maxdat,maxobs),isort(maxobs)) + + isort = 0 + cdata_all=zero + xscale=1000._r_kind + xscalei=one/xscale + max_rrr=nint(1000000.0_r_kind*xscalei) + nboxmax=1 + kx0=22500 + nmrecs=0 + irec=0 + errzmax=zero + + timemax=-huge(timemax) + timemin=huge(timemin) + errmax=-huge(errmax) + errmin=huge(errmin) + loop=0 + + ibadazm=0 + ibadwnd=0 + ibaddist=0 + ibadheight=0 + ibadstaheight=0 + iheightbelowsta=0 + iheightbelowsta=0 + ibaderror=0 + ibadfit=0 + kthin=0 + notgood=0 + notgood0=0 + nsuper2_in=0 + nsuper2_kept=0 + ntdrvr_thin2=0 + maxout=0 + maxdata=0 + isort=0 + icntpnt=0 + nout=0 + if(loop==0) outmessage='level 2 superobs:' + rmesh=radar_rmesh + zmesh=radar_zmesh + nlevz=nint(16000._r_kind/zmesh) + xmesh=rmesh + call make3grids(xmesh,nlevz) + allocate(zl_thin(nlevz)) + zflag=1 + if (zflag == 1) then + do k=1,nlevz + zl_thin(k)=k*zmesh + enddo + endif + inbufr=10 + open(inbufr,file="l2rwbufr",form='unformatted') + rewind inbufr + lundx=inbufr + call openbf(inbufr,'IN',lundx) + call datelen(10) + iyref=iadate(1) + imref=iadate(2) + idref=iadate(3) + ihref=iadate(4) + idate5(1)=iyref + idate5(2)=imref + idate5(3)=idref + idate5(4)=ihref + idate5(5)=0 ! minutes + call w3fs21(idate5,nminref) + idups=0 + nobs_in=0 + nradials_in=0 + nradials_fail_angmax=0 + nradials_fail_time=0 + nradials_fail_elb=0 + ddiffmin=huge(ddiffmin) + do while(ireadmg(inbufr,subset,idate)>=0) + do while (ireadsb(inbufr)==0) + call ufbint(inbufr,rdisttest,1,n_gates_max,n_gates,'DIST125M') + if(n_gates>1) then + do i=1,n_gates-1 + if(nint(abs(rdisttest(i+1)-rdisttest(i)))==0) then + idups=idups+1 + else + ddiffmin=min(abs(rdisttest(i+1)-rdisttest(i)),ddiffmin) + end if + end do + end if + distfact=zero + if(nint(ddiffmin)==1) distfact=250._r_kind + if(nint(ddiffmin)==2) distfact=125._r_kind + if(distfact==zero) then + write(6,*)'RADAR_BUFR_READ_ALL: problem with level 2 bufr file, gate distance scale factor undetermined, going with 125' + distfact=125._r_kind + end if + call ufbint(inbufr,hdr2,12,1,levs,'SSTN CLAT CLON HSMSL HSALG ANEL YEAR MNTH DAYS HOUR MINU SECO') + if(hdr2(6)>elev_angle_max) then + nradials_fail_angmax=nradials_fail_angmax+1 + cycle + end if + idate5(1)=nint(hdr2(7)) ; idate5(2)=nint(hdr2(8)) ; idate5(3)=nint(hdr2(9)) + idate5(4)=nint(hdr2(10)) ; idate5(5)=nint(hdr2(11)) + call w3fs21(idate5,nminthis) + t=(real(nminthis-nminref,r_kind)+real(nint(hdr2(12)),r_kind)*rinv60)*rinv60 + timemax=max(t,timemax) + timemin=min(t,timemin) + if(abs(t)>del_time) then + nradials_fail_time=nradials_fail_time+1 + cycle + end if + nobs_in=nobs_in+n_gates + stn_id=chdr2 + radar_true=0 + if (radar_sites) then + do i=1,radar_count + if (trim(stn_id) .eq. trim(rsite(i)) .and. ruse(i) .eq. 1 ) radar_true=1 + end do + if (radar_true .eq. 0) cycle + end if + stn_lat=hdr2(2) + stn_lon=hdr2(3) + stn_hgt=hdr2(4)+hdr2(5) + call ufbint(inbufr,hdr,10,1,levs, & + 'SSTN YEAR MNTH DAYS HOUR MINU SECO ANAZ ANEL QCRW') + nradials_in=nradials_in+1 + stn_az=r90-hdr(8) + stn_el=hdr(9) + call ufbint(inbufr,rwnd0,3,n_gates_max,n_gates,'DIST125M DMVR DVSW') + do i=1,n_gates + range=distfact*rwnd0(1,i) + if(range>range_max) then + nrange_max=nrange_max+1 + cycle + end if + if(rwnd0(2,i)>r1e5_double) then + nobs_badvr=nobs_badvr+1 + cycle + end if + if(rwnd0(3,i)>r1e5_double) then + nobs_badsr=nobs_badsr+1 + cycle + end if + this_stalat=stn_lat + if(abs(this_stalat)>r89_5) cycle + this_stalon=stn_lon + rlon0=deg2rad*this_stalon + this_stalatr=this_stalat*deg2rad + clat0=cos(this_stalatr) ; slat0=sin(this_stalatr) + this_staid=stn_id + this_stahgt=stn_hgt + thisrange= range + thisazimuth=stn_az + thistilt=stn_el + thisvr=rwnd0(2,i) + vrmax=max(vrmax,thisvr) + vrmin=min(vrmin,thisvr) + thisvr2=rwnd0(2,i)**2 + thiserr=5.0_r_kind + errmax=max(errmax,thiserr) + errmin=min(errmin,thiserr) + thistime=t + aactual=erad+this_stahgt + a43=four_thirds*aactual + thistiltr=thistilt*deg2rad + selev0=sin(thistiltr) + celev0=cos(thistiltr) + b=thisrange*(thisrange+two*aactual*selev0) + c=sqrt(aactual*aactual+b) + ha=b/(aactual+c) + epsh=(thisrange*thisrange-ha*ha)/(r8*aactual) + h=ha-epsh + thishgt=this_stahgt+h + celev=celev0 + selev=selev0 + if(thisrange>=one) then + celev=a43*celev0/(a43+h) + selev=(thisrange*thisrange+h*h+two*a43*h)/(two*thisrange*(a43+h)) + end if + corrected_tilt=atan2(selev,celev)*rad2deg + gamma=half*thisrange*(celev0+celev) +! Get earth lat lon of superob + thisazimuthr=thisazimuth*deg2rad + rlonloc=rad_per_meter*gamma*cos(thisazimuthr) + rlatloc=rad_per_meter*gamma*sin(thisazimuthr) + RELM=rlonloc + SRLM=SIN(RELM) + CRLM=COS(RELM) + SPH=SIN(rlatloc) + CPH=COS(rlatloc) + CC=CPH*CRLM + ANUM=CPH*SRLM + DENOM=clat0*CC-slat0*SPH + rlonglob=rlon0+ATAN2(ANUM,DENOM) + rlatglob=ASIN(clat0*SPH+slat0*CC) + thislat=rlatglob*rad2deg + thislon=rlonglob*rad2deg + if(abs(thislat)>r89_5) cycle + clat1=cos(rlatglob) + caz0=cos(thisazimuthr) + saz0=sin(thisazimuthr) + cdlon=cos(rlonglob-rlon0) + sdlon=sin(rlonglob-rlon0) + caz1=clat0*caz0/clat1 + saz1=saz0*cdlon-caz0*sdlon*slat0 + corrected_azimuth=atan2(saz1,caz1)*rad2deg + + if (doradaroneob .and. (oneobradid /= this_staid)) cycle + if(iret/=0) exit + nsuper2_in=nsuper2_in+1 + dlat_earth=this_stalat !station lat (degrees) + dlon_earth=this_stalon !station lon (degrees) + if (dlon_earth>=r360) dlon_earth=dlon_earth-r360 + if (dlon_earthwinlen) cycle + else + timeo=thistime + if(abs(timeo)>half ) cycle + endif +! Get observation (lon,lat). Compute distance from radar. + dlat_earth=thislat + dlon_earth=thislon + if(dlon_earth>=r360) dlon_earth=dlon_earth-r360 + if(dlon_earthmax_rrr) cycle + end if +! Extract radial wind data + height= thishgt + rwnd = thisvr + azm_earth = corrected_azimuth + if(regional) then + if(oneobtest .and. learthrel_rw) then ! for non rotated winds!!! + cosazm=cos(azm_earth*deg2rad) + sinazm=sin(azm_earth*deg2rad) + azm=atan2(sinazm,cosazm)*rad2deg + else + cosazm_earth=cos(azm_earth*deg2rad) + sinazm_earth=sin(azm_earth*deg2rad) + call rotate_wind_ll2xy(cosazm_earth,sinazm_earth,cosazm,sinazm,dlon_earth,dlon,dlat) + azm=atan2(sinazm,cosazm)*rad2deg + end if + else + azm=azm_earth + end if +!#################### Data thinning ################### + icntpnt=icntpnt+1 + ithin=1 !number of obs to keep per grid box + if(radar_no_thinning) then + ithin=-1 + endif + if(ithin > 0)then + if(zflag == 0)then + klon1= int(dlon); klat1= int(dlat) + dx = dlon-klon1; dy = dlat-klat1 + dx1 = one-dx; dy1 = one-dy + w00=dx1*dy1; w10=dx1*dy; w01=dx*dy1; w11=dx*dy + + klat1=min(max(1,klat1),nlat); klon1=min(max(0,klon1),nlon) + if (klon1==0) klon1=nlon + klatp1=min(nlat,klat1+1); klonp1=klon1+1 + if (klonp1==nlon+1) klonp1=1 + do kk=1,nsig + hges(kk)=w00*hgtl_full(klat1 ,klon1 ,kk) + & + w10*hgtl_full(klatp1,klon1 ,kk) + & + w01*hgtl_full(klat1 ,klonp1,kk) + & + w11*hgtl_full(klatp1,klonp1,kk) + end do + sin2 = sin(thislat)*sin(thislat) + termg = grav_equator * & + ((one+somigliana*sin2)/sqrt(one-eccentricity*eccentricity*sin2)) + termr = semi_major_axis /(one + flattening + grav_ratio - & + two*flattening*sin2) + termrg = (termg/grav)*termr + do kk=1,nsig + zges(kk) = (termr*hges(kk)) / (termrg-hges(kk)) + zl_thin(kk)=zges(kk) + end do + endif + zobs = height + ntmp=ndata ! counting moved to map3gridS + if (l4dvar) then + timedif = zero + else + timedif=abs(t4dvo-toff) + endif + crit1 = timedif/r6+half + call map3grids(1,zflag,zl_thin,nlevz,dlat_earth,dlon_earth,& + zobs,crit1,ndata,iout,icntpnt,iiout,luse, .false., .false.) + maxout=max(maxout,iout) + maxdata=max(maxdata,ndata) + if (.not. luse) then + ntdrvr_thin2=ntdrvr_thin2+1 + cycle + endif + if(iiout > 0) isort(iiout)=0 + if (ndata > ntmp) then + nodata=nodata+1 + endif + isort(icntpnt)=iout + else + ndata =ndata+1 + nodata=nodata+1 + iout=ndata + isort(icntpnt)=iout + endif +!#################### Data thinning ################### + if(.not. oneobtest) then + iaaa=azm/(r360/(r8*irrr)) + iaaa=mod(iaaa,8*irrr) + if(iaaa<0) iaaa=iaaa+8*irrr + iaaa=iaaa+1 + iaaamax=max(iaaamax,iaaa) + iaaamin=min(iaaamin,iaaa) + end if + error = erradar_inflate*thiserr + errmax=max(error,errmax) + if(thiserr>zero) errmin=min(error,errmin) +! Perform limited qc based on azimuth angle, radial wind +! speed, distance from radar site, elevation of radar, +! height of observation, and observation error + good0=.true. + if(abs(azm)>r400) then + ibadazm=ibadazm+1; good0=.false. + end if + if(abs(rwnd)>r200) then + ibadwnd=ibadwnd+1; good0=.false. + end if + if(dist>r400) then + ibaddist=ibaddist+1; good0=.false. + end if + if(staheight<-r1000.or.staheight>r50000) then + ibadstaheight=ibadstaheight+1; good0=.false. + end if + if(height<-r1000.or.height>r50000) then + ibadheight=ibadheight+1; good0=.false. + end if + if(heightr6 .or. thiserr<=zero) then + ibaderror=ibaderror+1; good0=.false. + end if + good=.true. + if(.not.good0) then + notgood0=notgood0+1 + cycle + end if + +! If data is good, load into output array + if(good) then + + usage = zero + if(icuse(ikx) < 0)usage=r100 + + nsuper2_kept=nsuper2_kept+1 + cdata(1) = error ! wind obs error (m/s) + cdata(2) = dlon ! grid relative longitude + cdata(3) = dlat ! grid relative latitude + cdata(4) = height ! obs absolute height (m) + cdata(5) = rwnd ! wind obs (m/s) + cdata(6) = azm*deg2rad ! azimuth angle (radians) + cdata(7) = t4dvo+time_offset ! obs time (hour) + cdata(8) = ikx ! type + cdata(9) = tiltangle ! tilt angle (radians) + cdata(10)= staheight ! station elevation (m) + cdata(11)= rstation_id ! station id + cdata(12)= usage ! usage parameter + cdata(13)= idomsfc ! dominate surface type + cdata(14)= skint ! skin temperature + cdata(15)= ff10 ! 10 meter wind factor + cdata(16)= sfcr ! surface roughness + cdata(17)=dlon_earth*rad2deg ! earth relative longitude (degrees) + cdata(18)=dlat_earth*rad2deg ! earth relative latitude (degrees) + cdata(19)=dist ! range from radar in km (used to estimatebeam spread) + cdata(20)=zsges ! model elevation at radar site + cdata(21)=thiserr + cdata(22)=two + do j=1,maxdat + cdata_all(j,iout)=cdata(j) + end do + else + notgood = notgood + 1 + end if + end do + end do + end do + close(lnbufr) ! A simple unformatted fortran file should not be mixed with bufr I/O + write(6,*)'READ_RADAR_L2RW_NOVADQC: ',trim(outmessage),' reached eof on 2 superob radar file' + write(6,*)'READ_RADAR_L2RW_NOVADQC: nsuper2_in,nsuper2_kept=',nsuper2_in,nsuper2_kept + write(6,*)'READ_RADAR_L2RW_NOVADQC: # bad winds =',ibadwnd,nobs_badvr,nobs_badsr + write(6,*)'READ_RADAR_L2RW_NOVADQC: # num thinned =',kthin,ntdrvr_thin2 + write(6,*)'READ_RADAR_L2RW_NOVADQC: timemin,max =',timemin,timemax + write(6,*)'READ_RADAR_L2RW_NOVADQC: errmin,max =',errmin,errmax + write(6,*)'READ_RADAR_L2RW_NOVADQC: dlatmin,max,dlonmin,max=',dlatmin,dlatmax,dlonmin,dlonmax + +! Write observation to scratch file + call count_obs(ndata,maxdat,ilat,ilon,cdata_all,nobs) + write(lunout) obstype,sis,nreal,nchanl,ilat,ilon + write(6,*) shape(cdata_all) + write(lunout) ((cdata_all(k,i),k=1,maxdat),i=1,ndata) + deallocate(cdata_all) + if (radar_sites) deallocate(rtable,rsite,ruse) + deallocate(zl_thin) + deallocate(isort) + return + +end subroutine read_radar_l2rw +!!!!!!!!!!!!!!! End added for l2rw thinning !!!!!!!!!!!!!!! + diff --git a/src/gsi/read_radar_wind_ascii.f90 b/src/gsi/read_radar_wind_ascii.f90 index 02200a9d76..2e1b06a50c 100644 --- a/src/gsi/read_radar_wind_ascii.f90 +++ b/src/gsi/read_radar_wind_ascii.f90 @@ -13,6 +13,7 @@ subroutine read_radar_wind_ascii(nread,ndata,nodata,infile,lunout,obstype,sis,hg ! 2011-08-12 carley - fix ob error to 2 m/s ! 2011-08-23 carley - use deter_sfc_mod ! 2011-12-08 carley - add wind rotation (earth to grid) +! 2020-05-04 wu - no rotate_wind for fv3_regional ! ! input argument list: ! infile - file from which to read data @@ -116,7 +117,8 @@ subroutine read_radar_wind_ascii(nread,ndata,nodata,infile,lunout,obstype,sis,hg use constants, only: zero,half,one,two,deg2rad,rearth,rad2deg, & one_tenth,r1000,r60,r60inv,r100,r400,grav_equator, & eccentricity,somigliana,grav_ratio,grav,semi_major_axis,flattening - use gridmod, only: regional,tll2xy,rotate_wind_ll2xy,nsig,nlat,nlon + use gridmod, only: regional,tll2xy,rotate_wind_ll2xy,nsig,nlat,nlon,& + fv3_regional use obsmod, only: iadate, & mintiltvr,maxtiltvr,minobrangevr,maxobrangevr, rmesh_vr,zmesh_vr,& doradaroneob,oneoblat,oneoblon,oneobheight,oneobradid @@ -464,7 +466,7 @@ subroutine read_radar_wind_ascii(nread,ndata,nodata,infile,lunout,obstype,sis,hg ! Domain could be rectangular, so ob may be out of ! range at one end, but not the other. - if(regional) then + if(regional .and. .not. fv3_regional) then cosazm_earth=cos(thisazimuthr) sinazm_earth=sin(thisazimuthr) call rotate_wind_ll2xy(cosazm_earth,sinazm_earth,cosazm,sinazm,thislon,dlon,dlat) diff --git a/src/gsi/read_radarref_mosaic.f90 b/src/gsi/read_radarref_mosaic.f90 index 55e141d8b3..dab4da6e83 100644 --- a/src/gsi/read_radarref_mosaic.f90 +++ b/src/gsi/read_radarref_mosaic.f90 @@ -212,6 +212,7 @@ subroutine read_radarref_mosaic(nread,ndata,infile,obstype,lunout,twind,sis,nobs endif call closbf(lunin) + close(lunin) return 200 continue write(6,*) 'read_radarref_mosaic, Warning : cannot find radar data file' diff --git a/src/gsi/read_rapidscat.f90 b/src/gsi/read_rapidscat.f90 index fa909d9ca9..c952383df0 100644 --- a/src/gsi/read_rapidscat.f90 +++ b/src/gsi/read_rapidscat.f90 @@ -16,6 +16,7 @@ subroutine read_rapidscat(nread,ndata,nodata,infile,obstype,lunout,gstime,twind, ! 2015-04-03 Ling Liu ! 2015-09-17 Thomas - add l4densvar and thin4d to data selection procedure ! 2016-03-11 j. guo - Fixed {dlat,dlon}_earth_deg in the obs data stream +! 2020-05-04 wu - no rotate_wind for fv3_regional ! ! input argument list: ! ithin - flag to thin data @@ -41,7 +42,7 @@ subroutine read_rapidscat(nread,ndata,nodata,infile,obstype,lunout,gstime,twind, use kinds, only: r_kind,r_double,i_kind,r_single use gridmod, only: diagnostic_reg,regional,nlon,nlat,nsig,& tll2xy,txy2ll,rotate_wind_ll2xy,rotate_wind_xy2ll,& - rlats,rlons + rlats,rlons,fv3_regional use qcmod, only: errormod,noiqc use convthin, only: make3grids,map3grids,del3grids,use_all use constants, only: deg2rad,zero,rad2deg,one_tenth,& @@ -243,7 +244,6 @@ subroutine read_rapidscat(nread,ndata,nodata,infile,obstype,lunout,gstime,twind, !! go through the satedump to find out how many subset to process !** Open and read data from bufr data file - call closbf(lunin) open(lunin,file=trim(infile),form='unformatted') call openbf(lunin,'IN',lunin) call datelen(10) @@ -388,6 +388,7 @@ subroutine read_rapidscat(nread,ndata,nodata,infile,obstype,lunout,gstime,twind, endif call closbf(lunin) + close(lunin) open(lunin,file=infile,form='unformatted') call openbf(lunin,'IN',lunin) call datelen(10) @@ -620,7 +621,7 @@ subroutine read_rapidscat(nread,ndata,nodata,infile,obstype,lunout,gstime,twind, woe=obserr oelev=r10 - if(regional)then + if(regional .and. .not. fv3_regional)then u0=uob v0=vob call rotate_wind_ll2xy(u0,v0,uob,vob,dlon_earth,dlon,dlat) @@ -662,8 +663,6 @@ subroutine read_rapidscat(nread,ndata,nodata,infile,obstype,lunout,gstime,twind, enddo loop_readsb enddo loop_msg -! Close unit to bufr file - call closbf(lunin) ! Deallocate arrays used for thinning data if (.not.use_all) then deallocate(presl_thin) @@ -673,6 +672,7 @@ subroutine read_rapidscat(nread,ndata,nodata,infile,obstype,lunout,gstime,twind, enddo loop_convinfo! loops over convinfo entry matches deallocate(lmsg,tab,nrep) + call closbf(lunin) ! Write header record and data to output file for further processing allocate(iloc(ndata)) @@ -709,10 +709,7 @@ subroutine read_rapidscat(nread,ndata,nodata,infile,obstype,lunout,gstime,twind, if(diagnostic_reg .and. nvtest>0) write(6,*)'READ_RAPIDSCAT: ',& 'nvtest,vdisterrmax=',ntest,vdisterrmax - if (ndata == 0) then - call closbf(lunin) - write(6,*)'READ_RAPIDSCAT: closbf(',lunin,')' - endif + write(6,*)'READ_RAPIDSCAT: closbf(',lunin,')' write(6,*) 'READ_RAPIDSCAT,nread,ndata,nreal,nodata=',nread,ndata,nreal,nodata diff --git a/src/gsi/read_saphir.f90 b/src/gsi/read_saphir.f90 index e4d7c55bde..3547f2cf5c 100644 --- a/src/gsi/read_saphir.f90 +++ b/src/gsi/read_saphir.f90 @@ -283,7 +283,6 @@ subroutine read_saphir(mype,val_tovs,ithin,isfcalc,& ! Reopen unit to satellite bufr file iob=1 - call closbf(lnbufr) open(lnbufr,file=trim(infile),form='unformatted',status = 'old',err = 500) call openbf(lnbufr,'IN',lnbufr) @@ -388,6 +387,7 @@ subroutine read_saphir(mype,val_tovs,ithin,isfcalc,& end do read_loop end do read_subset call closbf(lnbufr) + close(lnbufr) deallocate(data1b8) num_obs = iob-1 diff --git a/src/gsi/read_satmar.f90 b/src/gsi/read_satmar.f90 index 3a7f349c2b..673872e308 100644 --- a/src/gsi/read_satmar.f90 +++ b/src/gsi/read_satmar.f90 @@ -217,7 +217,6 @@ subroutine read_satmar (nread, ndata, nodata, & endif ! ! *#* Main - Start *#*! - call closbf(lun11) open(lun11,file=trim(infile),action='read',form='unformatted', iostat=ierr) if (ierr/=0) then print*, myname,' : ERROR : File ', trim(infile),' not existing. ' @@ -234,6 +233,7 @@ subroutine read_satmar (nread, ndata, nodata, & end do end do call closbf(lun11) + close(lun11) ! ! Allocate Arrays for all the data allocate (data_all (nreal, cnt),isort(cnt)) @@ -491,7 +491,7 @@ subroutine read_satmar (nread, ndata, nodata, & deallocate(data_out) if (ndata == 0) then - write(6,*)myname,': closbf(',lun11,')' + write(6,*)myname,': closbf(',lun11,') no data' endif close(lun11) ! diff --git a/src/gsi/read_satwnd.f90 b/src/gsi/read_satwnd.f90 index c3fcf290cf..c47fd4ceea 100644 --- a/src/gsi/read_satwnd.f90 +++ b/src/gsi/read_satwnd.f90 @@ -72,6 +72,8 @@ subroutine read_satwnd(nread,ndata,nodata,infile,obstype,lunout,gstime,twind,sis ! 2019-9-25 Su - modified ithin value criteria to distinguash thinning ! or hilber curve downweighting ! +! 2020-05-04 wu - no rotate_wind for fv3_regional +! ! ! ! input argument list: @@ -98,7 +100,7 @@ subroutine read_satwnd(nread,ndata,nodata,infile,obstype,lunout,gstime,twind,sis use kinds, only: r_kind,r_double,i_kind,r_single use gridmod, only: diagnostic_reg,regional,nlon,nlat,nsig,& tll2xy,txy2ll,rotate_wind_ll2xy,rotate_wind_xy2ll,& - rlats,rlons,twodvar_regional,wrf_nmm_regional + rlats,rlons,twodvar_regional,wrf_nmm_regional,fv3_regional use qcmod, only: errormod,njqc use convthin, only: make3grids,map3grids,map3grids_m,del3grids,use_all use convthin_time, only: make3grids_tm,map3grids_tm,map3grids_m_tm,del3grids_tm,use_all_tm @@ -302,7 +304,6 @@ subroutine read_satwnd(nread,ndata,nodata,infile,obstype,lunout,gstime,twind,sis nmsg=0 nrep=0 ntb =0 - call closbf(lunin) open(lunin,file=trim(infile),form='unformatted') call openbf(lunin,'IN',lunin) call datelen(10) @@ -327,7 +328,7 @@ subroutine read_satwnd(nread,ndata,nodata,infile,obstype,lunout,gstime,twind,sis endif - call ufbint(lunin,hdrdat,13,1,iret,hdrtr_v1) + call ufbint(lunin,hdrdat,13,1,iret,hdrtr_v1) ! SWQM doesn't exist for GOES-R/new BUFR/ hence hdrdat(13)=MISSING. ! qm=2, instead of using hdrdat(13)(2015-07-16, Genkova) @@ -344,7 +345,20 @@ subroutine read_satwnd(nread,ndata,nodata,infile,obstype,lunout,gstime,twind,sis else if(hdrdat(9) == three) then ! WV cloud top itype=254 else if(hdrdat(9) >= four) then ! WV deep layer, monitored - itype=254 + itype=254 + endif + endif + else if(trim(subset) == 'NC005067' .or. trim(subset) == 'NC005068' .or.& + trim(subset) == 'NC005069') then ! read new EUM BURF + if( hdrdat(1) = r50) then !the range of EUMETSAT satellite IDS + if(hdrdat(9) == one) then ! IR winds + itype=253 + else if(hdrdat(9) == two) then ! visible winds + itype=243 + else if(hdrdat(9) == three) then ! WV cloud top + itype=254 + else if(hdrdat(9) >= four) then ! WV deep layer, monitored + itype=254 endif endif else if(trim(subset) == 'NC005044' .or. trim(subset) == 'NC005045' .or. & @@ -396,12 +410,27 @@ subroutine read_satwnd(nread,ndata,nodata,infile,obstype,lunout,gstime,twind,sis write(6,*) 'READ_SATWND: wrong derived method value' endif endif + else if( trim(subset) == 'NC005081') then + if( hdrdat(1) <10.0_r_kind .or. (hdrdat(1) >= 200.0_r_kind .and. & + hdrdat(1) <=223.0_r_kind) ) then ! the range of EUMETSAT and NOAA polar orbit satellite IDs + if(hdrdat(9) == one) then ! IR winds + itype=244 + else + write(6,*) 'READ_SATWND: wrong derived method value' + endif + endif else if( trim(subset) == 'NC005019') then ! GOES shortwave winds if(hdrdat(1) >=r250 .and. hdrdat(1) <=r299 ) then ! The range of NESDIS satellite IDS if(hdrdat(9) == one) then ! short wave IR winds itype=240 endif endif + else if( trim(subset) == 'NC005072') then ! LEOGEO (LeoGeo) winds + if(hdrdat(1) == 854 ) then ! LeoGeo satellite ID + if(hdrdat(9) == one) then ! LEOGEO IRwinds + itype=255 + endif + endif else if( trim(subset) == 'NC005090') then ! VIIRS winds if(hdrdat(1) >=r200 .and. hdrdat(1) <=r250 ) then ! The range of satellite IDS if(hdrdat(9) == one) then ! VIIRS IR winds @@ -417,9 +446,9 @@ subroutine read_satwnd(nread,ndata,nodata,infile,obstype,lunout,gstime,twind,sis ! itype=260 ! endif !Temporary solution replacing the commented code above - if(trim(subset) == 'NC005091') then ! IR LW winds - itype=260 - endif + if(trim(subset) == 'NC005091') then ! IR LW winds + itype=260 + endif !GOES-R section of the 'if' statement over 'subsets' @@ -442,19 +471,22 @@ subroutine read_satwnd(nread,ndata,nodata,infile,obstype,lunout,gstime,twind,sis ! endif !Temporary solution replacing the commented code above - if(trim(subset) == 'NC005030') then ! IR LW winds - itype=245 - else if(trim(subset) == 'NC005039') then ! IR SW winds - itype=240 - else if(trim(subset) == 'NC005032') then ! VIS winds - itype=251 - else if(trim(subset) == 'NC005034') then ! WV cloud top - itype=246 - else if(trim(subset) == 'NC005031') then ! WV clear sky/deep layer - itype=247 - endif + if(trim(subset) == 'NC005030') then ! IR LW winds + itype=245 + else if(trim(subset) == 'NC005039') then ! IR SW winds + itype=240 + else if(trim(subset) == 'NC005032') then ! VIS winds + itype=251 + else if(trim(subset) == 'NC005034') then ! WV cloud top + itype=246 + else if(trim(subset) == 'NC005031') then ! WV clear sky/deep layer + itype=247 + endif + else ! wind is not recognised and itype is not assigned + cycle loop_report + endif - endif + if ( itype == -1 ) cycle loop_report ! unassigned itype ! Match ob to proper convinfo type ncsave=0 @@ -556,6 +588,7 @@ subroutine read_satwnd(nread,ndata,nodata,infile,obstype,lunout,gstime,twind,sis endif call closbf(lunin) + close(lunin) open(lunin,file=trim(infile),form='unformatted') call openbf(lunin,'IN',lunin) call datelen(10) @@ -592,13 +625,13 @@ subroutine read_satwnd(nread,ndata,nodata,infile,obstype,lunout,gstime,twind,sis ! Test for BUFR version using lat/lon mnemonics call ufbint(lunin,hdrdat_test,2,1,iret, 'CLAT CLON') - if ( hdrdat_test(1) > 100000000.0_r_kind .and. hdrdat_test(2) > 100000000.0_r_kind ) then - call ufbint(lunin,hdrdat,13,1,iret,hdrtr_v2) - call ufbint(lunin,obsdat,4,1,iret,obstr_v2) - else - call ufbint(lunin,hdrdat,13,1,iret,hdrtr_v1) - call ufbint(lunin,obsdat,4,1,iret,obstr_v1) - endif + if ( hdrdat_test(1) > 100000000.0_r_kind .and. hdrdat_test(2) > 100000000.0_r_kind ) then + call ufbint(lunin,hdrdat,13,1,iret,hdrtr_v2) + call ufbint(lunin,obsdat,4,1,iret,obstr_v2) + else + call ufbint(lunin,hdrdat,13,1,iret,hdrtr_v1) + call ufbint(lunin,obsdat,4,1,iret,obstr_v1) + endif ppb=obsdat(2) if (ppb > 100000000.0_r_kind .or. & @@ -676,7 +709,7 @@ subroutine read_satwnd(nread,ndata,nodata,infile,obstype,lunout,gstime,twind,sis enddo if(qifn <85.0_r_kind ) then ! qifn, QI without forecast qm=15 - endif + endif endif else if(trim(subset) == 'NC005044' .or. trim(subset) == 'NC005045' .or. & ! JMA trim(subset) == 'NC005046') then @@ -712,13 +745,13 @@ subroutine read_satwnd(nread,ndata,nodata,infile,obstype,lunout,gstime,twind,sis qifn=qcdat(3,j) else if(qcdat(2,j) == 103.0_r_kind .and. ee >r105) then ee=qcdat(3,j) - endif + endif endif - enddo - + enddo + if(qifn <85.0_r_kind ) then ! qifn: QI value without forecast qm=15 - endif + endif endif else if(trim(subset) == 'NC005010' .or. trim(subset) == 'NC005011' .or. & ! NESDIS GOES trim(subset) == 'NC005012' ) then @@ -744,7 +777,7 @@ subroutine read_satwnd(nread,ndata,nodata,infile,obstype,lunout,gstime,twind,sis c_station_id='WV'//stationid c_sprvstg='WV' else if(hdrdat(9) >= four) then ! WV deep layer.mornitored set in convinfo file - itype=247 + itype=247 c_station_id='WV'//stationid c_sprvstg='WV' endif @@ -759,7 +792,7 @@ subroutine read_satwnd(nread,ndata,nodata,infile,obstype,lunout,gstime,twind,sis qify=qcdat(3,j) else if( qcdat(2,j) == four .and. ee >r105) then ee=qcdat(3,j) - endif + endif endif enddo !QI not applied to CAWV for now - may in the future @@ -812,7 +845,7 @@ subroutine read_satwnd(nread,ndata,nodata,infile,obstype,lunout,gstime,twind,sis qify=qcdat(3,j) else if( qcdat(2,j) == four .and. ee >r105 ) then ee=qcdat(3,j) - endif + endif endif enddo endif @@ -836,7 +869,7 @@ subroutine read_satwnd(nread,ndata,nodata,infile,obstype,lunout,gstime,twind,sis qify=qcdat(3,j) else if( qcdat(2,j) == four .and. ee >r105) then ee=qcdat(3,j) - endif + endif endif enddo endif @@ -868,8 +901,35 @@ subroutine read_satwnd(nread,ndata,nodata,infile,obstype,lunout,gstime,twind,sis if(itype == 240 .and. ppb < 700.0_r_kind) qm=15 endif endif + else if( trim(subset) == 'NC005072') then ! LEOGEO (LeoGeo) winds + if(hdrdat(1) ==854 ) then ! LEOGEO satellite ID + c_prvstg='LEOGEO' + if(hdrdat(9) == one) then !LEOGEO IR winds + itype=255 + c_station_id='IR'//stationid + c_sprvstg='IR' + endif +! get quality information + call ufbrep(lunin,qcdat,3,8,iret,qcstr) + !!! Rethink this strategy!!! + qifn=qcdat(3,1) + qify=qcdat(3,2) + ee =qcdat(3,3) + !do j=1,6 + !if( qify <=r105 .and. qifn r105) then + ! qifn=qcdat(3,j) + ! else if(qcdat(2,j) == three .and. qify >r105) then + ! qify=qcdat(3,j) + ! else if( qcdat(2,j) == four .and. ee >r105) then + ! ee=qcdat(3,j) + ! endif + !endif + !enddo + endif else if( trim(subset) == 'NC005090') then ! VIIRS IR winds - if(hdrdat(1) >=r200 .and. hdrdat(1) <=r250 ) then ! The range of satellite IDS + if(hdrdat(1) >=r200 .and. hdrdat(1) <=r250 ) then ! The range of satellite IDS c_prvstg='VIIRS' if(hdrdat(9) == one) then ! VIIRS IR winds itype=260 @@ -890,10 +950,79 @@ subroutine read_satwnd(nread,ndata,nodata,infile,obstype,lunout,gstime,twind,sis endif endif enddo - endif + endif +! Extra block for new EUMETSAT BUFR: Start + if(qifn <85.0_r_kind ) then ! qifn, QI without forecast + qm=15 + endif + else if(trim(subset) == 'NC005067' .or. trim(subset) == 'NC005068' .or. & + trim(subset) == 'NC005069') then ! read new EUM BURF + if( hdrdat(1) = r50 ) then ! The range of satellite IDs + c_prvstg='EUMETSAT' + if(hdrdat(10) >68.0_r_kind) cycle loop_readsb ! reject data zenith angle >68.0 degree + if(hdrdat(9) == one) then ! IR winds + itype=253 + c_station_id='IR'//stationid + c_sprvstg='IR' + else if(hdrdat(9) == two) then ! visible winds + itype=243 + c_station_id='VI'//stationid + c_sprvstg='VI' + else if(hdrdat(9) == three) then ! WV cloud top, try to assimilate + itype=254 + c_station_id='WV'//stationid + c_sprvstg='WV' + else if(hdrdat(9) >= four) then ! WV deep layer,monitoring + itype=254 + qm=9 ! quality mark as 9, means the observation error needed to be set + c_station_id='WV'//stationid + c_sprvstg='WV' + endif +! get quality information THIS SECTION NEEDS TO BE TESTED!!! + call ufbint(lunin,rep_array,1,1,iret, '{AMVIVR}') + irep_array = int(rep_array) + allocate( amvivr(2,irep_array)) + call ufbrep(lunin,amvivr,2,irep_array,iret, 'TCOV CVWD') + pct1 = amvivr(2,1) ! use of pct1 (a new variable in the BUFR) is introduced by Nebuda/Genkova + deallocate( amvivr ) + + call ufbseq(lunin,amvqic,2,4,iret, 'AMVQIC') ! AMVQIC:: GNAPS PCCF + qifn = amvqic(2,2) ! QI w/ fcst does not exist in this BUFR + ee = amvqic(2,4) ! NOTE: GOES-R's ee is in [m/s] + if(qifn <85.0_r_kind ) then ! qifn, QI without forecast + qm=15 + endif + endif +! Extra block for new EUMETSAT BUFR: End +! Extra block for new Metop/AVHRR BUFR: Start + else if(trim(subset) == 'NC005081') then ! Metop/AVHRR from NESDIS + if( hdrdat(1) <10.0_r_kind .or. (hdrdat(1) >= 200.0_r_kind .and. & + hdrdat(1) <=223.0_r_kind) ) then ! The range of satellite IDs + c_prvstg='AVHRR' + if(hdrdat(9) == one) then ! IRwinds + itype=244 + c_station_id='IR'//stationid + c_sprvstg='IR' + else + write(6,*) 'READ_SATWND: wrong derived method value' + endif + + call ufbint(lunin,rep_array,1,1,iret, '{AMVIVR}') + irep_array = int(rep_array) + allocate( amvivr(2,irep_array)) + call ufbrep(lunin,amvivr,2,irep_array,iret, 'TCOV CVWD') + pct1 = amvivr(2,1) ! use of pct1 is limited to GOES-16/17) as introduced by Nebuda/Genkova + deallocate( amvivr ) + + call ufbseq(lunin,amvqic,2,4,iret, 'AMVQIC') ! AMVQIC:: GNAPS PCCF + qifn = amvqic(2,2) ! QI w/ fcst does not exist in this BUFR + ee = amvqic(2,4) ! NOTE: GOES-R's ee is in [m/s] + endif +! Extra block for new Metop/AVHRR BUFR: End + ! Extra block for VIIRS NOAA-20: Start else if(trim(subset) == 'NC005091') then - if(hdrdat(1) >=r250 .and. hdrdat(1) <=r299 ) then ! The range of satellite IDs + if( hdrdat(1) >=r200 .and. hdrdat(1) <=r250 ) then ! Use this range in v16.* c_prvstg='VIIRS' if(trim(subset) == 'NC005091') then ! IR LW winds itype=260 @@ -1029,35 +1158,39 @@ subroutine read_satwnd(nread,ndata,nodata,infile,obstype,lunout,gstime,twind,sis if(itype==240 .or. itype==245 .or. itype==246 .or. itype==251) then ! types 245 and 246 have been used to determine the acceptable pct1 range, but that pct1 range is applied to all GOES-R winds if (pct1 < 0.04_r_kind) qm=15 - if (pct1 > 0.50_r_kind) qm=15 - endif + if (pct1 > 0.50_r_kind) qm=15 + endif endif ! GOES-16 additional QC addopting ECMWF's approach(Katie Lean,14IWW)-start - if (EC_AMV_QC) then - if (qifn < 90_r_kind .or. qifn > r100 ) qm=15 ! stricter QI - if (ppb < 150.0_r_kind) qm=15 ! all high level - if (itype==251 .and. ppb < 700.0_r_kind) qm=15 ! VIS - if (itype==246 .and. ppb > 300.0_r_kind) qm=15 ! WVCA - dlon_earth=hdrdat(3)*deg2rad - dlat_earth=hdrdat(2)*deg2rad - call deter_sfc_type(dlat_earth,dlon_earth,t4dv,isflg,tsavg) - if (isflg == 1 .and. ppb > 850.0_r_kind) qm=15 ! low over land - endif - - ! winds rejected by qc dont get used - if (qm == 15) usage=r100 - if (qm == 3 .or. qm ==7) woe=woe*r1_2 - ! set strings for diagnostic output - if(itype==240 ) then; c_prvstg='GOESR' ; c_sprvstg='IRSW' ; endif - if(itype==245 ) then; c_prvstg='GOESR' ; c_sprvstg='IR' ; endif - if(itype==246 ) then; c_prvstg='GOESR' ; c_sprvstg='WVCT' ; endif - if(itype==247 ) then; c_prvstg='GOESR' ; c_sprvstg='WVCS' ; endif - if(itype==251 ) then; c_prvstg='GOESR' ; c_sprvstg='VIS' ; endif + if (EC_AMV_QC) then + if (qifn < 90_r_kind .or. qifn > r100 ) qm=15 ! stricter QI + if (ppb < 150.0_r_kind) qm=15 ! all high level + if (itype==251 .and. ppb < 700.0_r_kind) qm=15 ! VIS + if (itype==246 .and. ppb > 300.0_r_kind) qm=15 ! WVCA + dlon_earth=hdrdat(3)*deg2rad + dlat_earth=hdrdat(2)*deg2rad + call deter_sfc_type(dlat_earth,dlon_earth,t4dv,isflg,tsavg) + if (isflg == 1 .and. ppb > 850.0_r_kind) qm=15 ! low over land + endif + + ! winds rejected by qc dont get used + if (qm == 15) usage=r100 + if (qm == 3 .or. qm ==7) woe=woe*r1_2 + ! set strings for diagnostic output + if(itype==240 ) then; c_prvstg='GOESR' ; c_sprvstg='IRSW' ; endif + if(itype==245 ) then; c_prvstg='GOESR' ; c_sprvstg='IR' ; endif + if(itype==246 ) then; c_prvstg='GOESR' ; c_sprvstg='WVCT' ; endif + if(itype==247 ) then; c_prvstg='GOESR' ; c_sprvstg='WVCS' ; endif + if(itype==251 ) then; c_prvstg='GOESR' ; c_sprvstg='VIS' ; endif endif ! Extra block for GOES-R winds: End - + else ! wind is not recognised and itype is not assigned + cycle loop_readsb endif + + if ( itype == -1 ) cycle loop_readsb ! unassigned itype + ! assign types and get quality info : end if ( qify == zero) qify=r110 @@ -1107,7 +1240,7 @@ subroutine read_satwnd(nread,ndata,nodata,infile,obstype,lunout,gstime,twind,sis endif endif endif - + !! convert from wind direction and speed to u,v component uob=-obsdat(4)*sin(obsdat(3)*deg2rad) vob=-obsdat(4)*cos(obsdat(3)*deg2rad) @@ -1147,7 +1280,7 @@ subroutine read_satwnd(nread,ndata,nodata,infile,obstype,lunout,gstime,twind,sis endif enddo if (ncount ==1) then - write(6,*) 'READ_SATWND,WARNING cannot find subtyep in the error table,& + write(6,*) 'READ_SATWND,WARNING cannot find subtype in the error table,& itype,iobsub=',itypey,icsubtype(nc) write(6,*) 'read error table at colomn subtype as 0,error table column=',ierr endif @@ -1217,19 +1350,19 @@ subroutine read_satwnd(nread,ndata,nodata,infile,obstype,lunout,gstime,twind,sis ree=0.2_r_kind endif if( ppb >= 800.0_r_kind .and. ree >0.55_r_kind) then - qm=15 + qm=15 else if (ree >0.8_r_kind) then - qm=15 + qm=15 endif endif ! Reduce OE for the GOES-R winds by half following Sharon Nebuda's work ! GOES-R wind are identified/recognised here by subset, but it could be done by itype or SAID ! After completing the evaluation of GOES-R winds, REVISE this section!!! - if(trim(subset) == 'NC005030' .or. trim(subset) == 'NC005031' .or. trim(subset) == 'NC005032' .or. & + if(trim(subset) == 'NC005030' .or. trim(subset) == 'NC005031' .or. trim(subset) == 'NC005032' .or. & trim(subset) == 'NC005034' .or. trim(subset) == 'NC005039' ) then - obserr=obserr/two - endif + obserr=obserr/two + endif ! Set usage variable usage = 0 @@ -1247,10 +1380,11 @@ subroutine read_satwnd(nread,ndata,nodata,infile,obstype,lunout,gstime,twind,sis ! if(itype==252) then; c_prvstg='JMA' ; c_sprvstg='IR' ; endif ! if(itype==253) then; c_prvstg='EUMETSAT' ; c_sprvstg='IR' ; endif ! if(itype==254) then; c_prvstg='EUMETSAT' ; c_sprvstg='WV' ; endif +! if(itype==255) then; c_prvstg='LEOGEO' ; c_sprvstg='IR' ; endif ! if(itype==257) then; c_prvstg='MODIS' ; c_sprvstg='IR' ; endif ! if(itype==258) then; c_prvstg='MODIS' ; c_sprvstg='WVCTOP' ; endif ! if(itype==259) then; c_prvstg='MODIS' ; c_sprvstg='WVDLAYER' ; endif -! +! if(itype==260) then; c_prvstg='VIIRS' ; c_sprvstg='IR' ; endif ! c_station_id='SATWND' ! Get information from surface file necessary for conventional data here @@ -1365,7 +1499,7 @@ subroutine read_satwnd(nread,ndata,nodata,infile,obstype,lunout,gstime,twind,sis if (qm==3 .or. qm==7) inflate_error=.true. woe=obserr if (inflate_error) woe=woe*r1_2 - if(regional)then + if(regional .and. .not. fv3_regional)then u0=uob v0=vob call rotate_wind_ll2xy(u0,v0,uob,vob,dlon_earth,dlon,dlat) @@ -1410,15 +1544,13 @@ subroutine read_satwnd(nread,ndata,nodata,infile,obstype,lunout,gstime,twind,sis enddo loop_readsb ! End of bufr read loop enddo loop_msg -! Close unit to bufr file - call closbf(lunin) ! Deallocate arrays used for thinning data if (.not.use_all) then deallocate(presl_thin) call del3grids endif if (.not.use_all_tm) then - deallocate(presl_thin) + deallocate(presl_thin) call del3grids_tm endif @@ -1426,6 +1558,8 @@ subroutine read_satwnd(nread,ndata,nodata,infile,obstype,lunout,gstime,twind,sis enddo loop_convinfo! loops over convinfo entry matches deallocate(lmsg,tab,nrep) +! Close unit to bufr file + call closbf(lunin) ! Write header record and data to output file for further processing @@ -1466,10 +1600,7 @@ subroutine read_satwnd(nread,ndata,nodata,infile,obstype,lunout,gstime,twind,sis if(diagnostic_reg .and. nvtest>0) write(6,*)'READ_SATWND: ',& 'nvtest,vdisterrmax=',ntest,vdisterrmax - - if (ndata == 0) then - call closbf(lunin) write(6,*)'READ_SATWND: closbf(',lunin,')' endif diff --git a/src/gsi/read_seviri.f90 b/src/gsi/read_seviri.f90 index 9b01d3df04..485ac4723a 100644 --- a/src/gsi/read_seviri.f90 +++ b/src/gsi/read_seviri.f90 @@ -190,7 +190,6 @@ subroutine read_seviri(mype,val_sev,ithin,rmesh,jsatid,& endif ! Open bufr file. - call closbf(lnbufr) open(lnbufr,file=trim(infile),form='unformatted') call openbf(lnbufr,'IN',lnbufr) call datelen(10) @@ -219,15 +218,13 @@ subroutine read_seviri(mype,val_sev,ithin,rmesh,jsatid,& call makegrids(rmesh,ithin,n_tbin=n_tbin) ! Set BUFR string based on seviri data set + hdrsevi='SAID YEAR MNTH DAYS HOUR MINU SECO CLATH CLONH SAZA SOZA' + nhdr=11 if (clrsky) then - hdrsevi='SAID YEAR MNTH DAYS HOUR MINU SECO CLATH CLONH SAZA SOZA' - nhdr=11 nchn=12 ncld=nchn nbrst=nchn else if (allsky) then - hdrsevi='SAID YEAR MNTH DAYS HOUR MINU SECO CLATH CLONH' - nhdr=9 nchn=11 ncld=2 nbrst=nchn*6 ! channel dependent: all, clear, cloudy, low, middle and high clouds @@ -249,13 +246,14 @@ subroutine read_seviri(mype,val_sev,ithin,rmesh,jsatid,& ! Reopen unit to bufr file call closbf(lnbufr) + close(lnbufr) if(jsatid == 'm08') kidsat = 55 if(jsatid == 'm09') kidsat = 56 if(jsatid == 'm10') kidsat = 57 if(jsatid == 'm11') kidsat = 70 if( ithin_time == 5) then call read_subset_nnsb - endif + endif open(lnbufr,file=infile,form='unformatted') call openbf(lnbufr,'IN',lnbufr) @@ -286,10 +284,9 @@ subroutine read_seviri(mype,val_sev,ithin,rmesh,jsatid,& ! Read through each record call ufbint(lnbufr,hdr,nhdr,1,iret,hdrsevi) if(nint(hdr(1)) /= kidsat) cycle read_loop - if (clrsky) then ! asr bufr has no sza -! remove the obs whose satellite zenith angles larger than 65 degree - if ( hdr(ilzah) > r65 ) cycle read_loop - end if +! if (clrsky) then ! asr bufr has no sza, asr bufr has sza since 2017.07 + if ( hdr(ilzah) > r65 ) cycle read_loop +! end if ! Convert obs location from degrees to radians @@ -358,10 +355,10 @@ subroutine read_seviri(mype,val_sev,ithin,rmesh,jsatid,& nread=nread+nchanl - rcldfrc=zero + rcldfrc=bmiss if(clrsky) then - call ufbrep(lnbufr,datasev1,1,ncld,iret,'NCLDMNT') - rclrsky=bmiss + call ufbrep(lnbufr,datasev1,1,ncld,iret,'NCLDMNT') + rclrsky=bmiss ! datasev1(1,5) is high-peaking water vapor channel ! for SEVIRI CSR, clear-sky percentage are different between the high-peaking WV channel and other channels if(datasev1(1,5)>= zero .and. datasev1(1,5) <= 100.0_r_kind ) then @@ -380,22 +377,35 @@ subroutine read_seviri(mype,val_sev,ithin,rmesh,jsatid,& call ufbrep(lnbufr,datasev2,1,nbrst,iret,'TMBRST') call ufbrep(lnbufr,datasev3,1,nbrst,iret,'SDTB') - allchnmiss=.true. - do n=4,11 - if(datasev2(1,n)<500.) then - allchnmiss=.false. - end if - end do - if(allchnmiss) cycle read_loop - -! toss data if SDTB>1.3 - do i=4,11 - if(i==5 .or. i==6) then ! 2 water-vapor channels - if(datasev3(1,i)>1.3_r_kind) then - cycle read_loop + if(clrsky) then + allchnmiss=.true. + do n=4,11 + if( datasev2(1,n)>zero .and. datasev2(1,n)<500.0_r_kind) then + allchnmiss=.false. end if - end if - end do + end do + if(allchnmiss) cycle read_loop + +! toss data if SDTB>1.3 + do i=4,11 + if(i==5 .or. i==6) then ! 2 water-vapor channels + if(datasev3(1,i)>1.3_r_kind) then + cycle read_loop + end if + end if + end do + end if + + if(allsky) then + allchnmiss=.true. + do k=1,nchanl + jj=(k+2)*6+1 + if( datasev2(1,jj)>zero .and. datasev2(1,jj)<500._r_kind) then + allchnmiss=.false. + end if + end do + if(allchnmiss) cycle read_loop + end if ! Locate the observation on the analysis grid. Get sst and land/sea/ice ! mask. @@ -420,9 +430,9 @@ subroutine read_seviri(mype,val_sev,ithin,rmesh,jsatid,& if(clrsky) then ! use NCLDMNT from chn9 (10.8 micron) as a QC predictor ! add SDTB from chn9 as QC predictor - pred=10-datasev1(1,9)/10.0_r_kind+datasev3(1,9)*10.0_r_kind + pred=10-datasev1(1,9)/10.0_r_kind+datasev3(1,9)*10.0_r_kind else - pred=zero + pred=zero end if ! Compute "score" for observation. All scores>=0.0. Lowest score is "best" @@ -482,10 +492,10 @@ subroutine read_seviri(mype,val_sev,ithin,rmesh,jsatid,& data_all(32,itx) = rcldfrc ! total cloud fraction from SEVASR do k=1,nchanl if(clrsky) then - data_all(32+k,itx) = datasev3(1,k+3) ! BT standard deviation from SEVCSR + data_all(32+k,itx) = datasev3(1,k+3) ! BT standard deviation from SEVCSR else if(allsky) then - jj=(k+2)*6+1 - data_all(32+k,itx) = datasev3(1,jj) ! BT standard deviation from SEVASR + jj=(k+2)*6+1 + data_all(32+k,itx) = datasev3(1,jj) ! BT standard deviation from SEVASR end if end do @@ -516,6 +526,7 @@ subroutine read_seviri(mype,val_sev,ithin,rmesh,jsatid,& if(allocated(rd_tdiffs)) deallocate(rd_tdiffs) enddo read_msg call closbf(lnbufr) + close(lnbufr) call combine_radobs(mype_sub,mype_root,npe_sub,mpi_comm_sub,& nele,itxmax,nread,ndata,data_all,score_crit,nrec) @@ -524,24 +535,24 @@ subroutine read_seviri(mype,val_sev,ithin,rmesh,jsatid,& ! and write out data to scratch file for further processing. if (mype_sub==mype_root.and.ndata>0) then - do n=1,ndata - do k=1,nchanl - if(data_all(k+nreal,n) > tbmin .and. & - data_all(k+nreal,n) < tbmax)nodata=nodata+1 - end do - end do - if(dval_use .and. assim)then - do n=1,ndata - itt=nint(data_all(maxinfo,n)) - super_val(itt)=super_val(itt)+val_sev - end do - end if - -! Write retained data to local file - call count_obs(ndata,nele,ilat,ilon,data_all,nobs) - write(lunout) obstype,sis,nreal,nchanl,ilat,ilon - write(lunout) ((data_all(k,n),k=1,nele),n=1,ndata) - + do n=1,ndata + do k=1,nchanl + if(data_all(k+nreal,n) > tbmin .and. & + data_all(k+nreal,n) < tbmax)nodata=nodata+1 + end do + end do + if(dval_use .and. assim)then + do n=1,ndata + itt=nint(data_all(maxinfo,n)) + super_val(itt)=super_val(itt)+val_sev + end do + end if + +! Write retained data to local file + call count_obs(ndata,nele,ilat,ilon,data_all,nobs) + write(lunout) obstype,sis,nreal,nchanl,ilat,ilon + write(lunout) ((data_all(k,n),k=1,nele),n=1,ndata) + endif ! Deallocate local arrays @@ -611,6 +622,7 @@ subroutine read_subset_nnsb subset_num(nnmsg)=nnsb enddo read_msg2 call closbf(lnbufr) + close(lnbufr) if (npe_sub > 1 ) then call mpi_allreduce(subset_num, subset_nnsb, nnmsg,mpi_itype,mpi_sum,mpi_comm_sub,ierror) else diff --git a/src/gsi/read_sfcwnd.f90 b/src/gsi/read_sfcwnd.f90 index 06fa9f0207..05c96b21fc 100644 --- a/src/gsi/read_sfcwnd.f90 +++ b/src/gsi/read_sfcwnd.f90 @@ -21,6 +21,7 @@ subroutine read_sfcwnd(nread,ndata,nodata,infile,obstype,lunout,gstime,twind,sis ! 2015-10-01 guo - consolidate use of ob location (in deg) ! 2016-03-15 Su - modified the code so that the program won't stop when ! no subtype is found in non linear qc error table and b table +! 2020-05-04 wu - no rotate_wind for fv3_regional ! ! input argument list: ! ithin - flag to thin data @@ -46,7 +47,7 @@ subroutine read_sfcwnd(nread,ndata,nodata,infile,obstype,lunout,gstime,twind,sis use kinds, only: r_kind,r_double,i_kind,r_single use gridmod, only: diagnostic_reg,regional,nlon,nlat,nsig,& tll2xy,txy2ll,rotate_wind_ll2xy,rotate_wind_xy2ll,& - rlats,rlons + rlats,rlons,fv3_regional use qcmod, only: errormod,noiqc,njqc use convthin, only: make3grids,map3grids,del3grids,use_all @@ -230,7 +231,6 @@ subroutine read_sfcwnd(nread,ndata,nodata,infile,obstype,lunout,gstime,twind,sis !! go through the satedump to find out how many subset to process !** Open and read data from bufr data file - call closbf(lunin) open(lunin,file=trim(infile),form='unformatted') call openbf(lunin,'IN',lunin) call datelen(10) @@ -378,6 +378,7 @@ subroutine read_sfcwnd(nread,ndata,nodata,infile,obstype,lunout,gstime,twind,sis endif call closbf(lunin) + close(lunin) open(lunin,file=trim(infile),form='unformatted') call openbf(lunin,'IN',lunin) call datelen(10) @@ -678,7 +679,7 @@ subroutine read_sfcwnd(nread,ndata,nodata,infile,obstype,lunout,gstime,twind,sis woe=obserr oelev=r10 - if(regional)then + if(regional .and. .not. fv3_regional)then u0=uob v0=vob call rotate_wind_ll2xy(u0,v0,uob,vob,dlon_earth,dlon,dlat) @@ -723,7 +724,6 @@ subroutine read_sfcwnd(nread,ndata,nodata,infile,obstype,lunout,gstime,twind,sis enddo loop_msg ! Close unit to bufr file - call closbf(lunin) ! Deallocate arrays used for thinning data if (.not.use_all) then deallocate(presl_thin) @@ -732,6 +732,7 @@ subroutine read_sfcwnd(nread,ndata,nodata,infile,obstype,lunout,gstime,twind,sis ! Normal exit enddo loop_convinfo! loops over convinfo entry matches + call closbf(lunin) deallocate(lmsg,nrep,tab) @@ -771,8 +772,7 @@ subroutine read_sfcwnd(nread,ndata,nodata,infile,obstype,lunout,gstime,twind,sis 'nvtest,vdisterrmax=',ntest,vdisterrmax if (ndata == 0) then - call closbf(lunin) - write(6,*)'READ_SFCWND: closbf(',lunin,')' + write(6,*)'READ_SFCWND: closbf(',lunin,') no data' endif write(6,*) 'READ_SFCWND,nread,ndata,nreal,nodata=',nread,ndata,nreal,nodata diff --git a/src/gsi/read_ssmi.f90 b/src/gsi/read_ssmi.f90 index 82c7c39ae5..3e47ee79b5 100755 --- a/src/gsi/read_ssmi.f90 +++ b/src/gsi/read_ssmi.f90 @@ -511,6 +511,7 @@ subroutine read_ssmi(mype,val_ssmi,ithin,rmesh,jsatid,gstime,& end do read_loop end do read_subset call closbf(lnbufr) + close(lnbufr) ! If multiple tasks read input bufr file, allow each tasks to write out ! information it retained and then let single task merge files together diff --git a/src/gsi/read_ssmis.f90 b/src/gsi/read_ssmis.f90 index faaec0cece..c6a1af2263 100755 --- a/src/gsi/read_ssmis.f90 +++ b/src/gsi/read_ssmis.f90 @@ -390,7 +390,6 @@ subroutine read_ssmis(mype,val_ssmis,ithin,isfcalc,rmesh,jsatid,gstime,& ! Read in data from bufr into arrays first ! Open unit to satellite bufr file iobs=1 - call closbf(lnbufr) open(lnbufr,file=trim(infile),form='unformatted',status='old',err=500) call openbf(lnbufr,'IN',lnbufr) call datelen(10) @@ -516,6 +515,7 @@ subroutine read_ssmis(mype,val_ssmis,ithin,isfcalc,rmesh,jsatid,gstime,& end do read_loop end do read_subset call closbf(lnbufr) + close(lnbufr) num_obs = iobs-1 diff --git a/src/gsi/read_wcpbufr.f90 b/src/gsi/read_wcpbufr.f90 index 7d94e7bd1a..41dc36f3f6 100644 --- a/src/gsi/read_wcpbufr.f90 +++ b/src/gsi/read_wcpbufr.f90 @@ -208,7 +208,6 @@ subroutine read_wcpbufr(nread,ndata,nodata,infile,obstype,lunout,twindin,sis,& irec = 0 ! Open, then read date from bufr data - call closbf(lunin) open(lunin,file=trim(infile),form='unformatted') call openbf(lunin,'IN',lunin) call datelen(10) @@ -342,6 +341,7 @@ subroutine read_wcpbufr(nread,ndata,nodata,infile,obstype,lunout,twindin,sis,& call closbf(lunin) + close(lunin) open(lunin,file=infile,form='unformatted') call openbf(lunin,'IN',lunin) call datelen(10) @@ -664,8 +664,6 @@ subroutine read_wcpbufr(nread,ndata,nodata,infile,obstype,lunout,twindin,sis,& end do loop_readsb ! End of bufr read loop enddo loop_msg -! Close unit to bufr file - call closbf(lunin) ! Deallocate arrays used for thinning data if (.not.use_all) then @@ -676,6 +674,9 @@ subroutine read_wcpbufr(nread,ndata,nodata,infile,obstype,lunout,twindin,sis,& ! Normal exit enddo loop_convinfo! loops over convinfo entry matches +! Close unit to bufr file + call closbf(lunin) + close(lunin) deallocate(lmsg,tab,nrep) ! Write header record and data to output file for further processing @@ -713,8 +714,7 @@ subroutine read_wcpbufr(nread,ndata,nodata,infile,obstype,lunout,twindin,sis,& 'nvtest,vdisterrmax=',ntest,vdisterrmax if (ndata == 0) then - call closbf(lunin) - write(6,*)'READ_WCPBUFR: closbf(',lunin,')' + write(6,*)'READ_WCPBUFR: closbf(',lunin,') no data' endif close(lunin) diff --git a/src/gsi/setupbend.f90 b/src/gsi/setupbend.f90 index 9a83034428..2fe97bc072 100644 --- a/src/gsi/setupbend.f90 +++ b/src/gsi/setupbend.f90 @@ -97,6 +97,11 @@ subroutine setupbend(obsLL,odiagLL, & ! 2016-11-29 shlyaeva - save linearized H(x) for EnKF ! 2017-02-09 guo - Remove m_alloc, n_alloc. ! . Remove my_node with corrected typecast(). +! 2019-08-21 Shao - add COSMIC-2, metop-c and Paz +! 2020-03-18 Shao - update observation error for COSMIC-2 +! 2020-04-13 Shao - update the statistis QC for COSMIC-2 +! 2020-05-21 Shao - add comments to include commercial data ID information +! 2020-08-26 Shao/Bathmann - add Jacobian QC ! ! input argument list: ! lunin - unit from which to read observations @@ -156,7 +161,7 @@ subroutine setupbend(obsLL,odiagLL, & use m_gpsrhs, only: ratio_errors use m_gpsrhs, only: rdiagbuf,cdiagbuf use m_gpsrhs, only: qcfail - use m_gpsrhs, only: qcfail_loc,qcfail_high,qcfail_gross + use m_gpsrhs, only: qcfail_loc,qcfail_high,qcfail_gross,qcfail_jac use m_gpsrhs, only: data_ier,data_igps,data_ihgt use m_gpsrhs, only: gpsrhs_alloc use m_gpsrhs, only: gpsrhs_dealloc @@ -281,6 +286,11 @@ subroutine setupbend(obsLL,odiagLL, & !724-729 => COSMIC-2 Polar !825 => KOMPSAT-5 !5 => MetOpC +!265 => GeoOptics CICERO OP1 +!266 => GeoOptics CICERO OP2 +!267 => PlanetiQ GNOMES-A +!268 => PlanetiQ GNOMES-B +!269 => Spire Lemur 3U CubeSat ! Check to see if required guess fields are available call check_vars_(proceed) @@ -329,33 +339,33 @@ subroutine setupbend(obsLL,odiagLL, & nreal=mreal if (lobsdiagsave) nreal=nreal+4*miter+1 if (save_jacobian) then - nnz = nsig * 3 ! number of non-zero elements in dH(x)/dx profile - nind = 3 ! number of dense subarrays - call new(dhx_dx, nnz, nind) - nreal = nreal + size(dhx_dx) + nnz = nsig * 3 ! number of non-zero elements in dH(x)/dx profile + nind = 3 ! number of dense subarrays + call new(dhx_dx, nnz, nind) + nreal = nreal + size(dhx_dx) ! jacobian sparse array indices are the same for all obs and can be filled ! in once here: - t_ind = getindex(svars3d, 'tv') - if (t_ind < 0) then - print *, 'Error: no variable tv in state vector. Exiting.' - call stop2(1300) - endif - q_ind = getindex(svars3d, 'q') - if (q_ind < 0) then - print *, 'Error: no variable q in state vector. Exiting.' - call stop2(1300) - endif - p_ind = getindex(svars3d, 'prse') - if (p_ind < 0) then - print *, 'Error: no variable prse in state vector. Exiting.' - call stop2(1300) - endif - dhx_dx%st_ind(1) = sum(levels(1:t_ind-1)) + 1 - dhx_dx%end_ind(1) = sum(levels(1:t_ind-1)) + nsig - dhx_dx%st_ind(2) = sum(levels(1:q_ind-1)) + 1 - dhx_dx%end_ind(2) = sum(levels(1:q_ind-1)) + nsig - dhx_dx%st_ind(3) = sum(levels(1:p_ind-1)) + 1 - dhx_dx%end_ind(3) = sum(levels(1:p_ind-1)) + nsig + t_ind = getindex(svars3d, 'tv') + if (t_ind < 0) then + print *, 'Error: no variable tv in state vector. Exiting.' + call stop2(1300) + endif + q_ind = getindex(svars3d, 'q') + if (q_ind < 0) then + print *, 'Error: no variable q in state vector. Exiting.' + call stop2(1300) + endif + p_ind = getindex(svars3d, 'prse') + if (p_ind < 0) then + print *, 'Error: no variable prse in state vector. Exiting.' + call stop2(1300) + endif + dhx_dx%st_ind(1) = sum(levels(1:t_ind-1)) + 1 + dhx_dx%end_ind(1) = sum(levels(1:t_ind-1)) + nsig + dhx_dx%st_ind(2) = sum(levels(1:q_ind-1)) + 1 + dhx_dx%end_ind(2) = sum(levels(1:q_ind-1)) + nsig + dhx_dx%st_ind(3) = sum(levels(1:p_ind-1)) + 1 + dhx_dx%end_ind(3) = sum(levels(1:p_ind-1)) + nsig endif if(init_pass) call gpsrhs_alloc(is,'bend',nobs,nsig,nreal,grids_dim,nsig_ext) call gpsrhs_aliases(is) @@ -379,6 +389,7 @@ subroutine setupbend(obsLL,odiagLL, & qcfail=.false. qcfail_loc=zero;qcfail_gross=zero qcfail_high=zero + qcfail_jac=zero toss_gps_sub=zero dbend_loc=zero @@ -517,8 +528,8 @@ subroutine setupbend(obsLL,odiagLL, & bot_layer_SR=top_layer_SR endif endif - end do - endif + end do + endif ! locate observation in model vertical grid hob=tpdpres(i) @@ -568,253 +579,290 @@ subroutine setupbend(obsLL,odiagLL, & if(ratio_errors(i) > tiny_r_kind) then ! obs inside model grid - if (alt <= six) then - if (top_layer_SR >= 1) then ! SR exists for at least one layer. Check if obs is inside - if (tpdpres(i)==ref_rad(top_layer_SR+1)) then !obs inside model SR layer - qcfail(i)=.true. - elseif (tpdpres(i) < ref_rad(top_layer_SR+1)) then !obs below model close-to-SR layer - qcfail(i)=.true. - elseif (tpdpres(i) >= ref_rad(top_layer_SR+1) .and. tpdpres(i) <= ref_rad(top_layer_SR+2)) then !source too close - qcfail(i)=.true. - else !above - endif - endif - -! check for SR in obs, will be updated in genstats. - if ( data(igps,i) >= 0.03 .and. qc_layer_SR) then - kprof = data(iprof,i) - toss_gps_sub(kprof) = max (toss_gps_sub(kprof),data(igps,i)) - endif - endif - -! get pressure (in mb), temperature and moisture at obs location - call tintrp31(ges_lnprsi(:,:,1:nsig,:),dpressure,dlat,dlon,hob,& + if (alt <= six) then + if (top_layer_SR >= 1) then ! SR exists for at least one layer. Check if obs is inside + if (tpdpres(i)==ref_rad(top_layer_SR+1)) then !obs inside model SR layer + qcfail(i)=.true. + elseif (tpdpres(i) < ref_rad(top_layer_SR+1)) then !obs below model close-to-SR layer + qcfail(i)=.true. + elseif (tpdpres(i) >= ref_rad(top_layer_SR+1) .and. tpdpres(i) <= ref_rad(top_layer_SR+2)) then !source too close + qcfail(i)=.true. + else !above + endif + endif + +! check for SR in obs, will be updated in genstats. + if ( data(igps,i) >= 0.03 .and. qc_layer_SR) then + kprof = data(iprof,i) + toss_gps_sub(kprof) = max (toss_gps_sub(kprof),data(igps,i)) + endif + endif + +! get pressure (in mb), temperature and moisture at obs location + call tintrp31(ges_lnprsi(:,:,1:nsig,:),dpressure,dlat,dlon,hob,& dtime,hrdifsig,mype,nfldsig) - ihob=hob - k1=min(max(1,ihob),nsig) - k2=max(1,min(ihob+1,nsig)) - delz=hob-float(k1) - delz=max(zero,min(delz,one)) - trefges=tges_o(k1,i)*(one-delz)+tges_o(k2,i)*delz - qrefges=qges_o(k1)*(one-delz)+qges_o(k2)*delz !Lidia - - rdiagbuf( 6,i) = ten*exp(dpressure) ! pressure at obs location (hPa) if monotone grid - rdiagbuf(18,i) = trefges ! temperature at obs location (Kelvin) if monotone grid - rdiagbuf(21,i) = qrefges ! specific humidity at obs location (kg/kg) if monotone grid - - if (.not. qcfail(i)) then ! not SR - -! Modify error to account for representativeness error. - repe_gps=one - -! UKMET-type processing - if((data(isatid,i)==41) .or.(data(isatid,i)==722).or. & - (data(isatid,i)==723).or.(data(isatid,i)==4) .or. & - (data(isatid,i)==42) .or.(data(isatid,i)==3) .or. & - (data(isatid,i)==821).or.(data(isatid,i)==421).or. & - (data(isatid,i)==440).or.(data(isatid,i)==43) .or. & - (data(isatid,i)==5)) then + ihob=hob + k1=min(max(1,ihob),nsig) + k2=max(1,min(ihob+1,nsig)) + delz=hob-float(k1) + delz=max(zero,min(delz,one)) + trefges=tges_o(k1,i)*(one-delz)+tges_o(k2,i)*delz + qrefges=qges_o(k1)*(one-delz)+qges_o(k2)*delz !Lidia + + rdiagbuf( 6,i) = ten*exp(dpressure) ! pressure at obs location (hPa) if monotone grid + rdiagbuf(18,i) = trefges ! temperature at obs location (Kelvin) if monotone grid + rdiagbuf(21,i) = qrefges ! specific humidity at obs location (kg/kg) if monotone grid + + if (.not. qcfail(i)) then ! not SR + +! Modify error to account for representativeness error. + repe_gps=one + +! UKMET-type processing + if((data(isatid,i)==41) .or.(data(isatid,i)==722).or. & + (data(isatid,i)==723).or.(data(isatid,i)==4) .or. & + (data(isatid,i)==42) .or.(data(isatid,i)==3) .or. & + (data(isatid,i)==821).or.(data(isatid,i)==421).or. & + (data(isatid,i)==440).or.(data(isatid,i)==43) .or. & + (data(isatid,i)==5)) then - if((data(ilate,i)> r40).or.(data(ilate,i)< -r40)) then - if(alt>r12) then - repe_gps=0.19032_r_kind+0.287535_r_kind*alt-0.00260813_r_kind*alt**2 + if((data(ilate,i)> r40).or.(data(ilate,i)< -r40)) then + if(alt>r12) then + repe_gps=0.19032_r_kind+0.287535_r_kind*alt-0.00260813_r_kind*alt**2 + else + repe_gps=-3.20978_r_kind+1.26964_r_kind*alt-0.0622538_r_kind*alt**2 + endif else - repe_gps=-3.20978_r_kind+1.26964_r_kind*alt-0.0622538_r_kind*alt**2 + if(alt>r18) then + repe_gps=-1.87788_r_kind+0.354718_r_kind*alt-0.00313189_r_kind*alt**2 + else + repe_gps=-2.41024_r_kind+0.806594_r_kind*alt-0.027257_r_kind*alt**2 + endif endif - else - if(alt>r18) then - repe_gps=-1.87788_r_kind+0.354718_r_kind*alt-0.00313189_r_kind*alt**2 + else +! CDAAC-type processing + if ((data(isatid,i) > 749).and.(data(isatid,i) < 756)) then + if ((data(ilate,i)> r40).or.(data(ilate,i)< -r40)) then + if (alt <= 8.0_r_kind) then + repe_gps=-1.0304261_r_kind+0.3203316_r_kind*alt+0.0141337_r_kind*alt**2 + elseif (alt > 8.0_r_kind.and.alt <= r12) then + repe_gps=2.1750271_r_kind+0.0431177_r_kind*alt-0.0008567_r_kind*alt**2 + else + repe_gps=-0.3447429_r_kind+0.2829981_r_kind*alt-0.0028545_r_kind*alt**2 + endif + else + if (alt <= 4.0_r_kind) then + repe_gps=0.7285212_r_kind-1.1138755_r_kind*alt+0.2311123_r_kind*alt**2 + elseif (alt <= r18.and.alt > 4.0_r_kind) then + repe_gps=-3.3878629_r_kind+0.8691249_r_kind*alt-0.0297196_r_kind*alt**2 + else + repe_gps=-2.3875749_r_kind+0.3667211_r_kind*alt-0.0037542_r_kind*alt**2 + endif + endif else - repe_gps=-2.41024_r_kind+0.806594_r_kind*alt-0.027257_r_kind*alt**2 + if((data(ilate,i)> r40).or.(data(ilate,i)< -r40)) then + if(alt>r12) then + repe_gps=-0.685627_r_kind+0.377174_r_kind*alt-0.00421934_r_kind*alt**2 + else + repe_gps=-3.27737_r_kind+1.20003_r_kind*alt-0.0558024_r_kind*alt**2 + endif + else + if(alt>r18) then + repe_gps=-2.73867_r_kind+0.447663_r_kind*alt-0.00475603_r_kind*alt**2 + else + repe_gps=-3.45303_r_kind+0.908216_r_kind*alt-0.0293331_r_kind*alt**2 + endif + endif endif + endif - else -! CDAAC-type processing - if((data(ilate,i)> r40).or.(data(ilate,i)< -r40)) then - if(alt>r12) then - repe_gps=-0.685627_r_kind+0.377174_r_kind*alt-0.00421934_r_kind*alt**2 - else - repe_gps=-3.27737_r_kind+1.20003_r_kind*alt-0.0558024_r_kind*alt**2 - endif - else - if(alt>r18) then - repe_gps=-2.73867_r_kind+0.447663_r_kind*alt-0.00475603_r_kind*alt**2 + + repe_gps=exp(repe_gps) ! one/modified error in (rad-1*1E3) + repe_gps= r1em3*(one/abs(repe_gps)) ! modified error in rad + ratio_errors(i) = data(ier,i)/abs(repe_gps) + + error(i)=one/data(ier,i) ! one/original error + data(ier,i)=one/data(ier,i) ! one/original error + error_adjst(i)= ratio_errors(i)* data(ier,i) !one/adjusted error + +! Extending atmosphere above interface level nsig + d_ref_rad=ref_rad(nsig)-ref_rad(nsig-1) + do k=1,nsig_ext + ref_rad(nsig+k)=ref_rad(nsig)+ k*d_ref_rad ! extended x_i + nrefges(nsig+k,i)=nrefges(nsig+k-1,i)**2/nrefges(nsig+k-2,i) ! exended N_i + end do + +! Lagrange coefficients + ref_rad(0)=ref_rad(3) + ref_rad(nsig_up+1)=ref_rad(nsig_up-2) + do k=1,nsig_up + call setq(q_w(:,k),ref_rad(k-1:k+1),3) + enddo + + muse(i)=nint(data(iuse,i)) <= jiter + +! Get refractivity index-radius and [d(ln(n))/dx] in new grid. + intloop: do j=1,grids_dim + ref_rad_s(j)=sqrt(grid_s(j)*grid_s(j)+tpdpres(i)*tpdpres(i)) !x_j + xj(j,i)=ref_rad_s(j) + hob_s=ref_rad_s(j) + call grdcrd1(hob_s,ref_rad(1),nsig_up,1) + dbend_loc(j,i)=hob_s !location of x_j with respect to extended x_i + + + if (hob_s < rsig_up) then !obs inside the new grid + ihob=hob_s + +! Compute refractivity and derivative at target points +! using Lagrange interpolators + call slagdw(ref_rad(ihob-1:ihob+2),ref_rad_s(j),& + q_w(:,ihob),q_w(:,ihob+1),& + w4,dw4,4) + if(ihob==1) then + w4(4)=w4(4)+w4(1); w4(1:3)=w4(2:4);w4(4)=zero + dw4(4)=dw4(4)+dw4(1);dw4(1:3)=dw4(2:4);dw4(4)=zero + ihob=ihob+1 + endif + if(ihob==nsig_up-1) then + w4(1)=w4(1)+w4(4); w4(2:4)=w4(1:3);w4(1)=zero + dw4(1)=dw4(1)+dw4(4); dw4(2:4)=dw4(1:3);dw4(1)=zero + ihob=ihob-1 + endif + ddnj(j)=dot_product(dw4,nrefges(ihob-1:ihob+2,i))!derivative (dN/dx)_j + ddnj(j)=max(zero,abs(ddnj(j))) else - repe_gps=-3.45303_r_kind+0.908216_r_kind*alt-0.0293331_r_kind*alt**2 - endif - endif - endif + obs_check=.true. + if (obs_check) then ! only once per obs here + nobs_out=nobs_out+1 + d_ref_rad=ref_rad(nsig)-ref_rad(nsig-1) + do kk=1,20 + ref_rad_out(nsig_up+kk)=ref_rad(nsig_up)+ kk*d_ref_rad ! extended x_i + end do + do kk=1,nsig_up + ref_rad_out(kk)=ref_rad(kk) + enddo + endif + hob_s=ref_rad_s(j) + call grdcrd1(hob_s,ref_rad_out,nsig_up+20,1) + hob_s_top=max(hob_s,hob_s_top) + endif !obs in new grid + end do intloop + + if (obs_check) then ! reject observation + qcfail(i)=.true. + data(ier,i) = zero + ratio_errors(i) = zero + muse(i)=.false. + cycle loopoverobs1 + endif - repe_gps=exp(repe_gps) ! one/modified error in (rad-1*1E3) - repe_gps= r1em3*(one/abs(repe_gps)) ! modified error in rad - ratio_errors(i) = data(ier,i)/abs(repe_gps) - - error(i)=one/data(ier,i) ! one/original error - data(ier,i)=one/data(ier,i) ! one/original error - error_adjst(i)= ratio_errors(i)* data(ier,i) !one/adjusted error - -! Extending atmosphere above interface level nsig - d_ref_rad=ref_rad(nsig)-ref_rad(nsig-1) - do k=1,nsig_ext - ref_rad(nsig+k)=ref_rad(nsig)+ k*d_ref_rad ! extended x_i - nrefges(nsig+k,i)=nrefges(nsig+k-1,i)**2/nrefges(nsig+k-2,i) ! exended N_i - end do - -! Lagrange coefficients - ref_rad(0)=ref_rad(3) - ref_rad(nsig_up+1)=ref_rad(nsig_up-2) - do k=1,nsig_up - call setq(q_w(:,k),ref_rad(k-1:k+1),3) - enddo - - muse(i)=nint(data(iuse,i)) <= jiter - -! Get refractivity index-radius and [d(ln(n))/dx] in new grid. - intloop: do j=1,grids_dim - ref_rad_s(j)=sqrt(grid_s(j)*grid_s(j)+tpdpres(i)*tpdpres(i)) !x_j - xj(j,i)=ref_rad_s(j) - hob_s=ref_rad_s(j) - call grdcrd1(hob_s,ref_rad(1),nsig_up,1) - dbend_loc(j,i)=hob_s !location of x_j with respect to extended x_i - +! bending angle (radians) + dbend=ds*ddnj(1)/ref_rad_s(1) + do j=2,grids_dim + ddbend=ds*ddnj(j)/ref_rad_s(j) + dbend=dbend+two*ddbend + end do + dbend=r1em6*tpdpres(i)*dbend - if (hob_s < rsig_up) then !obs inside the new grid - ihob=hob_s - -! Compute refractivity and derivative at target points -! using Lagrange interpolators - call slagdw(ref_rad(ihob-1:ihob+2),ref_rad_s(j),& - q_w(:,ihob),q_w(:,ihob+1),& - w4,dw4,4) - if(ihob==1) then - w4(4)=w4(4)+w4(1); w4(1:3)=w4(2:4);w4(4)=zero - dw4(4)=dw4(4)+dw4(1);dw4(1:3)=dw4(2:4);dw4(4)=zero - ihob=ihob+1 - endif - if(ihob==nsig_up-1) then - w4(1)=w4(1)+w4(4); w4(2:4)=w4(1:3);w4(1)=zero - dw4(1)=dw4(1)+dw4(4); dw4(2:4)=dw4(1:3);dw4(1)=zero - ihob=ihob-1 - endif - ddnj(j)=dot_product(dw4,nrefges(ihob-1:ihob+2,i))!derivative (dN/dx)_j - ddnj(j)=max(zero,abs(ddnj(j))) - else - obs_check=.true. - if (obs_check) then ! only once per obs here - nobs_out=nobs_out+1 - d_ref_rad=ref_rad(nsig)-ref_rad(nsig-1) - do kk=1,20 - ref_rad_out(nsig_up+kk)=ref_rad(nsig_up)+ kk*d_ref_rad ! extended x_i - end do - do kk=1,nsig_up - ref_rad_out(kk)=ref_rad(kk) - enddo +! Accumulate diagnostic information + rdiagbuf( 5,i) = (data(igps,i)-dbend)/data(igps,i) ! incremental bending angle (x100 %) + + data(igps,i)=data(igps,i)-dbend !innovation vector + + if (alt <= gpstop) then ! go into qc checks + cgrossuse=cgross(ikx) + cermaxuse=cermax(ikx) + cerminuse=cermin(ikx) + if (alt > five) then + cgrossuse=cgrossuse*r400 + cermaxuse=cermaxuse*r400 + cerminuse=cerminuse*r100 endif - hob_s=ref_rad_s(j) - call grdcrd1(hob_s,ref_rad_out,nsig_up+20,1) - hob_s_top=max(hob_s,hob_s_top) - endif !obs in new grid - end do intloop - - if (obs_check) then ! reject observation - qcfail(i)=.true. - data(ier,i) = zero - ratio_errors(i) = zero - muse(i)=.false. - cycle loopoverobs1 - endif - -! bending angle (radians) - dbend=ds*ddnj(1)/ref_rad_s(1) - do j=2,grids_dim - ddbend=ds*ddnj(j)/ref_rad_s(j) - dbend=dbend+two*ddbend - end do - dbend=r1em6*tpdpres(i)*dbend - -! Accumulate diagnostic information - rdiagbuf( 5,i) = (data(igps,i)-dbend)/data(igps,i) ! incremental bending angle (x100 %) - - data(igps,i)=data(igps,i)-dbend !innovation vector - - if (alt <= gpstop) then ! go into qc checks - cgrossuse=cgross(ikx) - cermaxuse=cermax(ikx) - cerminuse=cermin(ikx) - if (alt > five) then - cgrossuse=cgrossuse*r400 - cermaxuse=cermaxuse*r400 - cerminuse=cerminuse*r100 - endif -! Gross error check - obserror = one/max(ratio_errors(i)*data(ier,i),tiny_r_kind) - obserrlm = max(cerminuse,min(cermaxuse,obserror)) - residual = abs(data(igps,i)) - ratio = residual/obserrlm - - if (ratio > cgrossuse) then - if (luse(i)) then - awork(4) = awork(4)+one - endif - qcfail_gross(i)=one - data(ier,i) = zero - ratio_errors(i) = zero - muse(i)=.false. - else -! Statistics QC check if obs passed gross error check - cutoff=zero - cutoff1=(-4.725_r_kind+0.045_r_kind*alt+0.005_r_kind*alt**2)*two/three - cutoff2=1.5_r_kind+one*cos(data(ilate,i)*deg2rad) - if(trefges<=r240) then - cutoff3=two - else - cutoff3=0.005_r_kind*trefges**2-2.3_r_kind*trefges+266_r_kind - endif - cutoff3=cutoff3*two/three - cutoff4=(four+eight*cos(data(ilate,i)*deg2rad))*two/three - cutoff12=((36_r_kind-alt)/two)*cutoff2+& - ((alt-34_r_kind)/two)*cutoff1 - cutoff23=((eleven-alt)/two)*cutoff3+& - ((alt-nine)/two)*cutoff2 - cutoff34=((six-alt)/two)*cutoff4+& - ((alt-four)/two)*cutoff3 - if(alt>36_r_kind) cutoff=cutoff1 - if((alt<=36_r_kind).and.(alt>34_r_kind)) cutoff=cutoff12 - if((alt<=34_r_kind).and.(alt>eleven)) cutoff=cutoff2 - if((alt<=eleven).and.(alt>nine)) cutoff=cutoff23 - if((alt<=nine).and.(alt>six)) cutoff=cutoff3 - if((alt<=six).and.(alt>four)) cutoff=cutoff34 - if(alt<=four) cutoff=cutoff4 - - cutoff=three*cutoff*r0_01 - - if(abs(rdiagbuf(5,i)) > cutoff) then - qcfail(i)=.true. - data(ier,i) = zero - ratio_errors(i) = zero - muse(i) = .false. - end if - end if ! gross qc check - end if ! qc checks (only below 50km) - -! Remove obs above 50 km - if(alt > gpstop) then - data(ier,i) = zero - ratio_errors(i) = zero - qcfail_high(i)=one - muse(i)=.false. - endif - -! Remove MetOP/GRAS data below 8 km - if( (alt <= eight) .and. & - ((data(isatid,i)==4).or.(data(isatid,i)==3).or.(data(isatid,i)==5))) then - qcfail(i)=.true. - data(ier,i) = zero - ratio_errors(i) = zero - muse(i)=.false. - endif +! Gross error check + obserror = one/max(ratio_errors(i)*data(ier,i),tiny_r_kind) + obserrlm = max(cerminuse,min(cermaxuse,obserror)) + residual = abs(data(igps,i)) + ratio = residual/obserrlm + + if (ratio > cgrossuse) then + if (luse(i)) then + awork(4) = awork(4)+one + endif + qcfail_gross(i)=one + data(ier,i) = zero + ratio_errors(i) = zero + muse(i)=.false. + else +! Statistics QC check if obs passed gross error check + cutoff=zero + if ((data(isatid,i) > 749).and.(data(isatid,i) < 756)) then + cutoff1=(-4.725_r_kind+0.045_r_kind*alt+0.005_r_kind*alt**2)*one/two + else + cutoff1=(-4.725_r_kind+0.045_r_kind*alt+0.005_r_kind*alt**2)*two/three + end if + cutoff2=1.5_r_kind+one*cos(data(ilate,i)*deg2rad) + if(trefges<=r240) then + cutoff3=two + else + cutoff3=0.005_r_kind*trefges**2-2.3_r_kind*trefges+266_r_kind + endif + if ((data(isatid,i) > 749).and.(data(isatid,i) < 756)) then + cutoff3=cutoff3*one/two + else + cutoff3=cutoff3*two/three + end if + if ((data(isatid,i) > 749).and.(data(isatid,i) < 756)) then + cutoff4=(four+eight*cos(data(ilate,i)*deg2rad))*one/two + else + cutoff4=(four+eight*cos(data(ilate,i)*deg2rad))*two/three + end if + cutoff12=((36_r_kind-alt)/two)*cutoff2+& + ((alt-34_r_kind)/two)*cutoff1 + cutoff23=((eleven-alt)/two)*cutoff3+& + ((alt-nine)/two)*cutoff2 + cutoff34=((six-alt)/two)*cutoff4+& + ((alt-four)/two)*cutoff3 + if(alt>36_r_kind) cutoff=cutoff1 + if((alt<=36_r_kind).and.(alt>34_r_kind)) cutoff=cutoff12 + if((alt<=34_r_kind).and.(alt>eleven)) cutoff=cutoff2 + if((alt<=eleven).and.(alt>nine)) cutoff=cutoff23 + if((alt<=nine).and.(alt>six)) cutoff=cutoff3 + if((alt<=six).and.(alt>four)) cutoff=cutoff34 + if(alt<=four) cutoff=cutoff4 + + if ((data(isatid,i) > 749).and.(data(isatid,i) < 756)) then + cutoff=two*cutoff*r0_01 + else + cutoff=three*cutoff*r0_01 + end if + + if(abs(rdiagbuf(5,i)) > cutoff) then + qcfail(i)=.true. + data(ier,i) = zero + ratio_errors(i) = zero + muse(i) = .false. + end if + end if ! gross qc check + end if ! qc checks (only below 50km) + +! Remove obs above 50 km + if(alt > gpstop) then + data(ier,i) = zero + ratio_errors(i) = zero + qcfail_high(i)=one + muse(i)=.false. + endif - end if ! obs above super-refraction and shadow layers +! Remove MetOP/GRAS data below 8 km + if( (alt <= eight) .and. & + ((data(isatid,i)==4).or.(data(isatid,i)==3).or.(data(isatid,i)==5))) then + qcfail(i)=.true. + data(ier,i) = zero + ratio_errors(i) = zero + muse(i)=.false. + endif + + end if ! obs above super-refraction and shadow layers end if ! obs inside the vertical grid end do loopoverobs1 ! end of loop over observations @@ -963,43 +1011,43 @@ subroutine setupbend(obsLL,odiagLL, & ! Fill obs diagnostics structure if (luse_obsdiag) then - call obsdiagNode_set(my_diag,wgtjo=(data(ier,i)*ratio_errors(i))**2, & + call obsdiagNode_set(my_diag,wgtjo=(data(ier,i)*ratio_errors(i))**2, & jiter=jiter,muse=muse(i),nldepart=data(igps,i) ) endif ! Load additional obs diagnostic structure ioff = mreal if (lobsdiagsave) then - associate(odiag => my_diag ) - do jj=1,miter - ioff=ioff+1 - if (odiag%muse(jj)) then - rdiagbuf(ioff,i) = one - else - rdiagbuf(ioff,i) = -one - endif - enddo - do jj=1,miter+1 - ioff=ioff+1 - rdiagbuf(ioff,i) = odiag%nldepart(jj) - enddo - do jj=1,miter - ioff=ioff+1 - rdiagbuf(ioff,i) = odiag%tldepart(jj) - enddo - do jj=1,miter - ioff=ioff+1 - rdiagbuf(ioff,i) = odiag%obssen(jj) - enddo - end associate ! odiag - endif + associate(odiag => my_diag ) + do jj=1,miter + ioff=ioff+1 + if (odiag%muse(jj)) then + rdiagbuf(ioff,i) = one + else + rdiagbuf(ioff,i) = -one + endif + enddo + do jj=1,miter+1 + ioff=ioff+1 + rdiagbuf(ioff,i) = odiag%nldepart(jj) + enddo + do jj=1,miter + ioff=ioff+1 + rdiagbuf(ioff,i) = odiag%tldepart(jj) + enddo + do jj=1,miter + ioff=ioff+1 + rdiagbuf(ioff,i) = odiag%obssen(jj) + enddo + end associate ! odiag + endif - ! if obs is not "acceptable" and jacobian is not computed, fill jacobian - ! with zeros - if (save_jacobian) then - dhx_dx%val = 0._r_kind - call writearray(dhx_dx, rdiagbuf(ioff+1:nreal,i)) - endif + ! if obs is not "acceptable" and jacobian is not computed, fill jacobian + ! with zeros + if (save_jacobian) then + dhx_dx%val = 0._r_kind + call writearray(dhx_dx, rdiagbuf(ioff+1:nreal,i)) + endif ! If obs is "acceptable", load array with obs info for use ! in inner loop minimization (int* and stp* routines) @@ -1132,9 +1180,27 @@ subroutine setupbend(obsLL,odiagLL, & my_head%jac_p(k)=my_head%jac_p(k)+dbenddxi(j)*dxidp(j,k)+ & dbenddn(j) * dndp(j,k) end do + + if ((abs(my_head%jac_t(k)) > 0.0016_r_kind).or.(abs(my_head%jac_q(k)) > 7.5_r_kind).or. & + (abs(my_head%jac_p(k)) > 0.004_r_kind)) then + qcfail_jac(i) = one + end if end do my_head%jac_p(nsig+1) = zero + + if (qcfail_jac(i) == one) then + do k=1,nsig + my_head%jac_t(k) = zero + my_head%jac_q(k) = zero + my_head%jac_p(k) = zero + end do + ratio_errors(i) = zero + data(ier,i) = zero + rdiagbuf(12,i) = -one + rdiagbuf(10,i) = six + end if + if (save_jacobian) then ! fill in the jacobian @@ -1167,6 +1233,10 @@ subroutine setupbend(obsLL,odiagLL, & do j=1,nreal gps_alltail(ibin)%head%rdiag(j)= rdiagbuf(j,i) end do + gps_alltail(ibin)%head%ratio_err= ratio_errors(i) + gps_alltail(ibin)%head%obserr = data(ier,i) + gps_alltail(ibin)%head%dataerr = data(ier,i)*data(igps,i) + gps_alltail(ibin)%head%muse = muse(i) ! logical endif ! (last_pass) end do ! i=1,nobs deallocate(ddnj,grid_s,ref_rad_s) @@ -1209,55 +1279,55 @@ subroutine init_vars_ varname='z' call gsi_bundlegetpointer(gsi_metguess_bundle(1),trim(varname),rank2,istatus) if (istatus==0) then - if(allocated(ges_z))then - write(6,*) trim(myname), ': ', trim(varname), ' already incorrectly alloc ' - call stop2(999) - endif - allocate(ges_z(size(rank2,1),size(rank2,2),nfldsig)) - ges_z(:,:,1)=rank2 - do ifld=2,nfldsig - call gsi_bundlegetpointer(gsi_metguess_bundle(ifld),trim(varname),rank2,istatus) - ges_z(:,:,ifld)=rank2 - enddo + if(allocated(ges_z))then + write(6,*) trim(myname), ': ', trim(varname), ' already incorrectly alloc ' + call stop2(999) + endif + allocate(ges_z(size(rank2,1),size(rank2,2),nfldsig)) + ges_z(:,:,1)=rank2 + do ifld=2,nfldsig + call gsi_bundlegetpointer(gsi_metguess_bundle(ifld),trim(varname),rank2,istatus) + ges_z(:,:,ifld)=rank2 + enddo else - write(6,*) trim(myname),': ', trim(varname), ' not found in met bundle, ier= ',istatus - call stop2(999) + write(6,*) trim(myname),': ', trim(varname), ' not found in met bundle, ier= ',istatus + call stop2(999) endif ! get tv ... varname='tv' call gsi_bundlegetpointer(gsi_metguess_bundle(1),trim(varname),rank3,istatus) if (istatus==0) then - if(allocated(ges_tv))then - write(6,*) trim(myname), ': ', trim(varname), ' already incorrectly alloc ' - call stop2(999) - endif - allocate(ges_tv(size(rank3,1),size(rank3,2),size(rank3,3),nfldsig)) - ges_tv(:,:,:,1)=rank3 - do ifld=2,nfldsig - call gsi_bundlegetpointer(gsi_metguess_bundle(ifld),trim(varname),rank3,istatus) - ges_tv(:,:,:,ifld)=rank3 - enddo + if(allocated(ges_tv))then + write(6,*) trim(myname), ': ', trim(varname), ' already incorrectly alloc ' + call stop2(999) + endif + allocate(ges_tv(size(rank3,1),size(rank3,2),size(rank3,3),nfldsig)) + ges_tv(:,:,:,1)=rank3 + do ifld=2,nfldsig + call gsi_bundlegetpointer(gsi_metguess_bundle(ifld),trim(varname),rank3,istatus) + ges_tv(:,:,:,ifld)=rank3 + enddo else - write(6,*) trim(myname),': ', trim(varname), ' not found in met bundle, ier= ',istatus - call stop2(999) + write(6,*) trim(myname),': ', trim(varname), ' not found in met bundle, ier= ',istatus + call stop2(999) endif ! get q ... varname='q' call gsi_bundlegetpointer(gsi_metguess_bundle(1),trim(varname),rank3,istatus) if (istatus==0) then - if(allocated(ges_q))then - write(6,*) trim(myname), ': ', trim(varname), ' already incorrectly alloc ' - call stop2(999) - endif - allocate(ges_q(size(rank3,1),size(rank3,2),size(rank3,3),nfldsig)) - ges_q(:,:,:,1)=rank3 - do ifld=2,nfldsig - call gsi_bundlegetpointer(gsi_metguess_bundle(ifld),trim(varname),rank3,istatus) - ges_q(:,:,:,ifld)=rank3 - enddo + if(allocated(ges_q))then + write(6,*) trim(myname), ': ', trim(varname), ' already incorrectly alloc ' + call stop2(999) + endif + allocate(ges_q(size(rank3,1),size(rank3,2),size(rank3,3),nfldsig)) + ges_q(:,:,:,1)=rank3 + do ifld=2,nfldsig + call gsi_bundlegetpointer(gsi_metguess_bundle(ifld),trim(varname),rank3,istatus) + ges_q(:,:,:,ifld)=rank3 + enddo else - write(6,*) trim(myname),': ', trim(varname), ' not found in met bundle, ier= ',istatus - call stop2(999) + write(6,*) trim(myname),': ', trim(varname), ' not found in met bundle, ier= ',istatus + call stop2(999) endif else write(6,*) trim(myname), ': inconsistent vector sizes (nfldsig,size(metguess_bundle) ',& diff --git a/src/gsi/setupps.f90 b/src/gsi/setupps.f90 index 3851b8d10e..69379f15f7 100644 --- a/src/gsi/setupps.f90 +++ b/src/gsi/setupps.f90 @@ -133,6 +133,7 @@ subroutine setupps(obsLL,odiagLL,lunin,mype,bwork,awork,nele,nobs,is,conv_diagsa use m_dtime, only: dtime_setup, dtime_check + use hdraobmod, only: nhdps,hdpslist use gsi_bundlemod, only : gsi_bundlegetpointer use gsi_metguess_mod, only : gsi_metguess_get,gsi_metguess_bundle use sparsearr, only: sparr2, new, size, writearray, fullarray @@ -180,9 +181,9 @@ subroutine setupps(obsLL,odiagLL,lunin,mype,bwork,awork,nele,nobs,is,conv_diagsa integer(i_kind) ier,ilon,ilat,ipres,ihgt,itemp,id,itime,ikx,iqc,iptrb,ijb integer(i_kind) ier2,iuse,ilate,ilone,istnelv,idomsfc,izz,iprvd,isprvd integer(i_kind) ikxx,nn,ibin,ioff,ioff0 - integer(i_kind) i,nchar,nreal,ii,jj,k,l,mm1 + integer(i_kind) i,j,nchar,nreal,ii,jj,k,l,mm1 integer(i_kind) itype,isubtype - integer(i_kind) ibb,ikk + integer(i_kind) ibb,ikk,idddd logical,dimension(nobs):: luse,muse integer(i_kind),dimension(nobs):: ioid ! initial (pre-distribution) obs ID @@ -268,6 +269,25 @@ subroutine setupps(obsLL,odiagLL,lunin,mype,bwork,awork,nele,nobs,is,conv_diagsa do i=1,nobs muse(i)=nint(data(iuse,i)) <= jiter end do +! If HD raobs available move prepbufr version to monitor + if(nhdps > 0)then + do i=1,nobs + ikx=nint(data(ikxx,i)) + itype=ictype(ikx) + if(itype == 120) then + rstation_id = data(id,i) + read(station_id,'(i5,3x)',err=1200) idddd + stn_loop:do j=1,nhdps + if(idddd == hdpslist(j))then + data(iuse,i)=108._r_kind + muse(i) = .false. + exit stn_loop + end if + end do stn_loop + end if +1200 continue + end do + end if hr_offset=min_offset/60.0_r_kind ! Check for duplicate observations at same location diff --git a/src/gsi/setupq.f90 b/src/gsi/setupq.f90 index c445bba29f..9302b891f2 100644 --- a/src/gsi/setupq.f90 +++ b/src/gsi/setupq.f90 @@ -169,6 +169,7 @@ subroutine setupq(obsLL,odiagLL,lunin,mype,bwork,awork,nele,nobs,is,conv_diagsav use gsi_metguess_mod, only : gsi_metguess_get,gsi_metguess_bundle use sparsearr, only: sparr2, new, size, writearray, fullarray use state_vectors, only: svars3d, levels + use hdraobmod, only: nhdq,hdqlist ! The following variables are the coefficients that describe the ! linear regression fits that are used to define the dynamic @@ -231,15 +232,15 @@ subroutine setupq(obsLL,odiagLL,lunin,mype,bwork,awork,nele,nobs,is,conv_diagsav real(r_single),allocatable,dimension(:,:)::rdiagbufp - integer(i_kind) i,nchar,nreal,ii,l,jj,mm1,itemp,iip + integer(i_kind) i,j,nchar,nreal,ii,l,jj,mm1,itemp,iip integer(i_kind) jsig,itype,k,nn,ikxx,iptrb,ibin,ioff,ioff0,icat,ijb integer(i_kind) ier,ilon,ilat,ipres,iqob,id,itime,ikx,iqmax,iqc integer(i_kind) ier2,iuse,ilate,ilone,istnelv,iobshgt,izz,iprvd,isprvd integer(i_kind) idomsfc,iderivative - integer(i_kind) ibb,ikk + integer(i_kind) ibb,ikk,idddd real(r_kind) :: delz type(sparr2) :: dhx_dx - integer(i_kind) :: iz, q_ind, nind, nnz + integer(i_kind) :: iz, q_ind, nind, nnz,iprev_station character(8) station_id character(8),allocatable,dimension(:):: cdiagbuf,cdiagbufp @@ -317,6 +318,32 @@ subroutine setupq(obsLL,odiagLL,lunin,mype,bwork,awork,nele,nobs,is,conv_diagsav do i=1,nobs muse(i)=nint(data(iuse,i)) <= jiter end do +! If HD raobs available move prepbufr version to monitor + if(nhdq > 0)then + iprev_station=0 + do i=1,nobs + ikx=nint(data(ikxx,i)) + itype=ictype(ikx) + if(itype == 120) then + rstation_id = data(id,i) + read(station_id,'(i5,3x)',err=1200) idddd + if(idddd == iprev_station)then + data(iuse,i)=108._r_kind + muse(i) = .false. + else + stn_loop:do j=1,nhdq + if(idddd == hdqlist(j))then + iprev_station=idddd + data(iuse,i)=108._r_kind + muse(i) = .false. + exit stn_loop + end if + end do stn_loop + end if + end if +1200 continue + end do + end if var_jb=zero @@ -397,12 +424,12 @@ subroutine setupq(obsLL,odiagLL,lunin,mype,bwork,awork,nele,nobs,is,conv_diagsav ! Prepare specific humidity data call dtime_setup() do i=1,nobs + ikx=nint(data(ikxx,i)) + itype=ictype(ikx) dtime=data(itime,i) call dtime_check(dtime, in_curbin, in_anybin) if(.not.in_anybin) cycle - ikx=nint(data(ikxx,i)) - itype=ictype(ikx) ! Flag static conditions to create PBL_pseudo_surfobsq obs. l_pbl_pseudo_itype = l_pbl_pseudo_surfobsq .and. & @@ -415,7 +442,6 @@ subroutine setupq(obsLL,odiagLL,lunin,mype,bwork,awork,nele,nobs,is,conv_diagsav dpres=data(ipres,i) rmaxerr=data(iqmax,i) - rstation_id = data(id,i) error=data(ier2,i) prest=r10*exp(dpres) ! in mb var_jb=data(ijb,i) @@ -1059,6 +1085,7 @@ subroutine init_netcdf_diag_ end subroutine init_netcdf_diag_ subroutine contents_binary_diag_(odiag) type(obs_diag),pointer,intent(in):: odiag + cdiagbuf(ii) = station_id ! station id rdiagbuf(1,ii) = ictype(ikx) ! observation type diff --git a/src/gsi/setuprw.f90 b/src/gsi/setuprw.f90 index 543e767714..7b00caea4f 100644 --- a/src/gsi/setuprw.f90 +++ b/src/gsi/setuprw.f90 @@ -139,6 +139,7 @@ subroutine setuprw(obsLL,odiagLL,lunin,mype,bwork,awork,nele,nobs,is,conv_diagsa use gsi_metguess_mod, only : gsi_metguess_get,gsi_metguess_bundle use setupdbz_lib, only:hx_dart use sparsearr, only: sparr2, new, size, writearray, fullarray + implicit none ! Declare passed variables @@ -647,11 +648,20 @@ subroutine setuprw(obsLL,odiagLL,lunin,mype,bwork,awork,nele,nobs,is,conv_diagsa endif endif -! adjust obs error for TDR data - if(data(iobs_type,i) > three .and. ratio_errors*error > tiny_r_kind & +! adjust obs error for TDR data + if( ratio_errors*error > tiny_r_kind & .and. tdrerr_inflate) then - ratio_errors = data(ier2,i)/abs(data(ier,i) + 1.0e6_r_kind*rhgh + & - r8*rlow + min(max((abs(ddiff)-ten),zero)/ten,one)*data(ier,i)) + if(data(iobs_type,i) > three) then + ratio_errors = data(ier2,i)/abs(data(ier,i) + 1.0e6_r_kind*rhgh + & + r8*rlow + min(max((abs(ddiff)-ten),zero)/ten,one)*data(ier,i)) + end if +! apply same error adjustment for 88D data in HWRF with a 5 m/s +! minimum, which is also the same for TDR. This results in roughly +! 2.5 m/s RMS fit with 10-km thinning + if(data(iobs_type,i) <= three) then + ratio_errors = data(ier2,i)/(5.0_r_kind + abs( 1.0e6_r_kind*rhgh + & + r8*rlow + min(max((abs(ddiff)-ten),zero)/ten,one)*5.0_r_kind)) + end if end if ! Gross error checks diff --git a/src/gsi/setupspd.f90 b/src/gsi/setupspd.f90 index ff01bf5ac6..1e740fdd25 100644 --- a/src/gsi/setupspd.f90 +++ b/src/gsi/setupspd.f90 @@ -141,7 +141,7 @@ subroutine setupspd(obsLL,odiagLL,lunin,mype,bwork,awork,nele,nobs,is,conv_diags ! apply only to the regional forecast models (e.g., HWRF); Henry ! R. Winterbottom (henry.winterbottom@noaa.gov). - use obsmod, only: uv_doe_a_292,uv_doe_b_292 + use obsmod, only: uv_doe_a_213,uv_doe_b_213 implicit none @@ -381,9 +381,9 @@ subroutine setupspd(obsLL,odiagLL,lunin,mype,bwork,awork,nele,nobs,is,conv_diags z_height = .false. ! if ( nty == 260 .or. nty == 261) z_height = .true. -! nty == 292 is temporarily assigned to SFMR retrieved wind speed from recon +! nty == 213 is temporarily assigned to SFMR retrieved wind speed from recon ! and is subjet to change in the future - if ( nty == 260 .or. nty == 261 .or. nty == 292) z_height = .true. + if ( nty == 260 .or. nty == 261 .or. nty == 213) z_height = .true. ! Process observations reported with height differently than those ! reported with pressure. Type 260=nacelle 261=tower wind spd are @@ -528,8 +528,8 @@ subroutine setupspd(obsLL,odiagLL,lunin,mype,bwork,awork,nele,nobs,is,conv_diags ddiff = spdob-spdges if (aircraft_recon) then - if ( nty == 292 ) then - ratio_errors=error/(uv_doe_a_292*abs(ddiff)+uv_doe_b_292) + if ( nty == 213 ) then + ratio_errors=error/(uv_doe_a_213*abs(ddiff)+uv_doe_b_213) if (spdob < 10._r_kind) ratio_errors=zero endif endif diff --git a/src/gsi/setupt.f90 b/src/gsi/setupt.f90 index 960b73897c..d94d1f26dc 100644 --- a/src/gsi/setupt.f90 +++ b/src/gsi/setupt.f90 @@ -79,6 +79,7 @@ subroutine setupt(obsLL,odiagLL,lunin,mype,bwork,awork,nele,nobs,is,conv_diagsav use gsi_bundlemod, only : gsi_bundlegetpointer use gsi_metguess_mod, only : gsi_metguess_get,gsi_metguess_bundle use buddycheck_mod, only: buddy_check_t + use hdraobmod, only: nhdt,hdtlist use sparsearr, only: sparr2, new, size, writearray, fullarray @@ -285,13 +286,13 @@ subroutine setupt(obsLL,odiagLL,lunin,mype,bwork,awork,nele,nobs,is,conv_diagsav integer(i_kind) ier2,iuse,ilate,ilone,ikxx,istnelv,iobshgt,izz,iprvd,isprvd integer(i_kind) regime integer(i_kind) idomsfc,iskint,iff10,isfcr - integer(i_kind) ibb,ikk + integer(i_kind) ibb,ikk,idddd integer(i_kind),dimension(nobs):: buddyuse type(sparr2) :: dhx_dx - integer(i_kind) :: iz, t_ind, nind, nnz + integer(i_kind) :: iz, t_ind, nind, nnz, iprev_station character(8) station_id character(8),allocatable,dimension(:):: cdiagbuf,cdiagbufp character(8),allocatable,dimension(:):: cprvstg,csprvstg @@ -322,7 +323,6 @@ subroutine setupt(obsLL,odiagLL,lunin,mype,bwork,awork,nele,nobs,is,conv_diagsav equivalence(r_sprvstg,c_sprvstg) real(r_kind),allocatable,dimension(:,:,: ) :: ges_ps - real(r_kind),allocatable,dimension(:,:,: ) :: ges_z real(r_kind),allocatable,dimension(:,:,:,:) :: ges_u real(r_kind),allocatable,dimension(:,:,:,:) :: ges_v real(r_kind),allocatable,dimension(:,:,:,:) :: ges_tv @@ -392,6 +392,32 @@ subroutine setupt(obsLL,odiagLL,lunin,mype,bwork,awork,nele,nobs,is,conv_diagsav do i=1,nobs muse(i)=nint(data(iuse,i)) <= jiter end do +! If HD raobs available move prepbufr version to monitor + if(nhdt > 0)then + iprev_station=0 + do i=1,nobs + ikx=nint(data(ikxx,i)) + itype=ictype(ikx) + if(itype == 120) then + rstation_id = data(id,i) + read(station_id,'(i5,3x)',err=1200) idddd + if(idddd == iprev_station)then + data(iuse,i)=108._r_kind + muse(i) = .false. + else + stn_loop:do j=1,nhdt + if(idddd == hdtlist(j))then + iprev_station=idddd + data(iuse,i)=108._r_kind + muse(i) = .false. + exit stn_loop + end if + end do stn_loop + end if + end if +1200 continue + end do + end if var_jb=zero ! handle multiple reported data at a station @@ -1008,6 +1034,7 @@ subroutine setupt(obsLL,odiagLL,lunin,mype,bwork,awork,nele,nobs,is,conv_diagsav endif my_head%luse = luse(i) my_head%tv_ob = iqtflg + my_head%idx = 0 if (aircraft_t_bc_pof .or. aircraft_t_bc) then effective=upd_pred_t*pof_idx @@ -1284,7 +1311,7 @@ subroutine init_vars_ varname='ps' call gsi_bundlegetpointer(gsi_metguess_bundle(1),trim(varname),rank2,istatus) if (istatus==0) then - if(allocated(ges_z))then + if(allocated(ges_ps))then write(6,*) trim(myname), ': ', trim(varname), ' already incorrectly alloc ' call stop2(999) endif @@ -1375,7 +1402,7 @@ subroutine init_vars_ varname='th2m' call gsi_bundlegetpointer(gsi_metguess_bundle(1),trim(varname),rank2,istatus) if (istatus==0) then - if(allocated(ges_z))then + if(allocated(ges_th2))then write(6,*) trim(myname), ': ', trim(varname), ' already incorrectly alloc ' call stop2(999) endif @@ -1393,7 +1420,7 @@ subroutine init_vars_ varname='q2m' call gsi_bundlegetpointer(gsi_metguess_bundle(1),trim(varname),rank2,istatus) if (istatus==0) then - if(allocated(ges_z))then + if(allocated(ges_q2))then write(6,*) trim(myname), ': ', trim(varname), ' already incorrectly alloc ' call stop2(999) endif @@ -1620,6 +1647,7 @@ subroutine contents_netcdf_diag_(odiag) call nc_diag_metadata("Obs_Minus_Forecast_unadjusted", sngl(tob-tges) ) if (aircraft_t_bc_pof .or. aircraft_t_bc .or. aircraft_t_bc_ext) then call nc_diag_metadata("Data_Pof", sngl(data(ipof,i)) ) + call nc_diag_metadata("Data_Vertical_Velocity", sngl(data(ivvlc,i)) ) if (npredt .gt. one) then call nc_diag_data2d("Bias_Correction_Terms", sngl(predbias) ) else if (npredt .eq. one) then @@ -1627,6 +1655,7 @@ subroutine contents_netcdf_diag_(odiag) endif else call nc_diag_metadata("Data_Pof", missing ) + call nc_diag_metadata("Data_Vertical_Velocity", missing ) if (npredt .gt. one) then do j=1,npredt predbias(j) = missing @@ -1715,6 +1744,8 @@ subroutine final_vars_ if(allocated(ges_v )) deallocate(ges_v ) if(allocated(ges_u )) deallocate(ges_u ) if(allocated(ges_ps)) deallocate(ges_ps) + if(allocated(ges_q2)) deallocate(ges_q2) + if(allocated(ges_th2)) deallocate(ges_th2) end subroutine final_vars_ end subroutine setupt diff --git a/src/gsi/setuptcp.f90 b/src/gsi/setuptcp.f90 index a63d7a590d..cfef05d06c 100644 --- a/src/gsi/setuptcp.f90 +++ b/src/gsi/setuptcp.f90 @@ -30,6 +30,7 @@ subroutine setuptcp(obsLL,odiagLL,lunin,mype,bwork,awork,nele,nobs,is,conv_diags ! 2016-11-29 shlyaeva - save linearized H(x) for EnKF ! 2017-02-09 guo - Remove m_alloc, n_alloc. ! . Remove my_node with corrected typecast(). +! 2020-09-15 wu - add option tcp_posmatch ! ! input argument list: ! @@ -52,7 +53,7 @@ subroutine setuptcp(obsLL,odiagLL,lunin,mype,bwork,awork,nele,nobs,is,conv_diags use m_obsdiagNode, only: obsdiagNode_assert use obsmod, only: & - nobskeep,lobsdiag_allocated,oberror_tune,perturb_obs, & + nobskeep,lobsdiag_allocated,oberror_tune,perturb_obs,tcp_posmatch,tcp_box, & time_offset,rmiss_single,lobsdiagsave,lobsdiag_forenkf,ianldate use obsmod, only: netcdf_diag, binary_diag, dirname use nc_diag_write_mod, only: nc_diag_init, nc_diag_header, nc_diag_metadata, & @@ -135,10 +136,12 @@ subroutine setuptcp(obsLL,odiagLL,lunin,mype,bwork,awork,nele,nobs,is,conv_diags character(8),allocatable,dimension(:):: cdiagbuf real(r_single),allocatable,dimension(:,:)::rdiagbuf integer(i_kind) nchar,nreal,ii + integer(i_kind)imin,jmin,j,l,jb,je,lb,le real(r_kind),allocatable,dimension(:,:,: ) :: ges_ps real(r_kind),allocatable,dimension(:,:,: ) :: ges_z real(r_kind),allocatable,dimension(:,:,:,:) :: ges_tv + real(r_kind)lj,li,pmin type(obsLList),pointer,dimension(:):: tcphead tcphead => obsLL(:) @@ -242,6 +245,32 @@ subroutine setuptcp(obsLL,odiagLL,lunin,mype,bwork,awork,nele,nobs,is,conv_diags if(.not.in_curbin) cycle +! use option when TC relocation is not done +! tcp_posmatch=1 to move TC to guess position, +! tcp_posmatch=2 set pges to the minimum Psfc + if(tcp_posmatch > 0 )then + pmin=150._r_kind + jb=dlon-tcp_box ! search (+5,-5)dx/dy for ges TC center + je=dlon+tcp_box ! modify (5 gridpoints to larger number?) when resolution increased + lb=dlat-tcp_box + le=dlat+tcp_box + do j=jb,je + lj=float(j) + do l=lb,le + li=float(l) + call tintrp2a11(ges_ps,psges,li,lj,dtime,hrdifsig,mype,nfldsig) + if(pmin>psges)then + imin=l + jmin=j + pmin=psges + endif + enddo + enddo + if(tcp_posmatch==1 .and. pmin< 150._r_kind)then + dlat=imin + dlon=jmin + endif + endif ! Get guess sfc hght at obs location call intrp2a11(ges_z(1,1,ntguessig),zsges,dlat,dlon,mype) @@ -285,6 +314,9 @@ subroutine setuptcp(obsLL,odiagLL,lunin,mype,bwork,awork,nele,nobs,is,conv_diags ! Adjust guess hydrostatically rdp = g_over_rd*rdelz/tges +! Set minimum Psfc as pgesorig if tcp_posmatch= 2 + if(tcp_posmatch==2 .and. pmin< 150._r_kind )pgesorig=pmin + ! Subtract off dlnp correction, then convert to pressure (cb) pges = exp(log(pgesorig) - rdp) diff --git a/src/gsi/setupuwnd10m.f90 b/src/gsi/setupuwnd10m.f90 index 15a3f386ca..4552a7e81a 100644 --- a/src/gsi/setupuwnd10m.f90 +++ b/src/gsi/setupuwnd10m.f90 @@ -31,6 +31,7 @@ subroutine setupuwnd10m(obsLL,odiagLL,lunin,mype,bwork,awork,nele,nobs,is,conv_d ! 2017-09-28 todling - add netcdf_diag capability; hidden as contained code ! 2018-01-08 pondeca - addd option l_closeobs to use closest obs to analysis ! time in analysis +! 2020-05-04 wu - no rotate_wind for fv3_regional ! ! input argument list: ! lunin - unit from which to read observations @@ -74,7 +75,8 @@ subroutine setupuwnd10m(obsLL,odiagLL,lunin,mype,bwork,awork,nele,nobs,is,conv_d use oneobmod, only: magoberr,maginnov,oneobtest use gridmod, only: nsig - use gridmod, only: get_ij,twodvar_regional,regional,rotate_wind_xy2ll,pt_ll + use gridmod, only: get_ij,twodvar_regional,regional,rotate_wind_xy2ll,pt_ll,& + fv3_regional use constants, only: zero,tiny_r_kind,one,one_tenth,half,wgtlim,rd,grav,& two,cg_term,three,four,five,ten,huge_single,r1000,r3600,& grav_ratio,flattening,grav,deg2rad,grav_equator,somigliana, & @@ -900,7 +902,7 @@ subroutine contents_binary_diag_(odiag) rdiagbuf(21,ii) = dvdiff ! vob-ges (ms**-1) rdiagbuf(22,ii) = data(ivob,i)-vgesin! vob-ges w/o bias correction (ms**-1) (future slot) - if(regional) then + if(regional .and. .not. fv3_regional) then ! replace positions 17-22 with earth relative wind component information @@ -995,7 +997,7 @@ subroutine contents_netcdf_diag_(odiag) call nc_diag_metadata("v_Obs_Minus_Forecast_adjusted", dvdiff ) call nc_diag_metadata("v_Obs_Minus_Forecast_unadjusted", data(ivob,i)-vgesin) - if(regional) then + if(regional .and. .not. fv3_regional) then ! replace positions 17-22 with earth relative wind component information diff --git a/src/gsi/setupvwnd10m.f90 b/src/gsi/setupvwnd10m.f90 index 7ebcb1c042..0c601e716b 100644 --- a/src/gsi/setupvwnd10m.f90 +++ b/src/gsi/setupvwnd10m.f90 @@ -31,6 +31,7 @@ subroutine setupvwnd10m(obsLL,odiagLL,lunin,mype,bwork,awork,nele,nobs,is,conv_d ! 2017-09-28 todling - add netcdf_diag capability; hidden as contained code ! 2018-01-08 pondeca - addd option l_closeobs to use closest obs to analysis ! time in analysis +! 2020-05-04 wu - no rotate_wind for fv3_regional ! ! input argument list: ! lunin - unit from which to read observations @@ -74,7 +75,8 @@ subroutine setupvwnd10m(obsLL,odiagLL,lunin,mype,bwork,awork,nele,nobs,is,conv_d use oneobmod, only: magoberr,maginnov,oneobtest use gridmod, only: nsig - use gridmod, only: get_ij,twodvar_regional,regional,rotate_wind_xy2ll,pt_ll + use gridmod, only: get_ij,twodvar_regional,regional,rotate_wind_xy2ll,pt_ll,& + fv3_regional use constants, only: zero,tiny_r_kind,one,one_tenth,half,wgtlim,rd,grav,& two,cg_term,three,four,five,ten,huge_single,r1000,r3600,& grav_ratio,flattening,grav,deg2rad,grav_equator,somigliana, & @@ -900,7 +902,7 @@ subroutine contents_binary_diag_(odiag) rdiagbuf(21,ii) = dudiff ! uob-ges (ms**-1) rdiagbuf(22,ii) = data(iuob,i)-ugesin! uob-ges w/o bias correction (ms**-1) (future slot) - if(regional) then + if(regional .and. .not. fv3_regional) then ! replace positions 17-22 with earth relative wind component information @@ -995,7 +997,7 @@ subroutine contents_netcdf_diag_(odiag) call nc_diag_metadata("v_Obs_Minus_Forecast_adjusted", dudiff ) call nc_diag_metadata("v_Obs_Minus_Forecast_unadjusted", data(iuob,i)-ugesin) - if(regional) then + if(regional .and. .not. fv3_regional) then ! replace positions 17-22 with earth relative wind component information diff --git a/src/gsi/setupw.f90 b/src/gsi/setupw.f90 index 546ef9d051..aa6fe55094 100644 --- a/src/gsi/setupw.f90 +++ b/src/gsi/setupw.f90 @@ -50,7 +50,7 @@ subroutine setupw(obsLL,odiagLL,lunin,mype,bwork,awork,nele,nobs,is,conv_diagsav use qcmod, only: nvqc use oneobmod, only: oneobtest,oneob_type,magoberr,maginnov use gridmod, only: get_ijk,nsig,twodvar_regional,regional,wrf_nmm_regional,& - rotate_wind_xy2ll,pt_ll + rotate_wind_xy2ll,pt_ll,fv3_regional use guess_grids, only: nfldsig,hrdifsig,geop_hgtl,sfcmod_gfs use guess_grids, only: tropprs,sfcmod_mm5 use guess_grids, only: ges_lnprsl,comp_fact10,pbl_height @@ -69,10 +69,12 @@ subroutine setupw(obsLL,odiagLL,lunin,mype,bwork,awork,nele,nobs,is,conv_diagsav use m_dtime, only: dtime_setup, dtime_check use gsi_bundlemod, only : gsi_bundlegetpointer + use hdraobmod, only: nhduv,hduvlist use gsi_metguess_mod, only : gsi_metguess_get,gsi_metguess_bundle use sparsearr, only: sparr2, new, size, writearray, fullarray use aux2dvarflds, only: rtma_comp_fact10 + ! The following variables are the coefficients that describe the ! linear regression fits that are used to define the dynamic ! observation error (DOE) specifications for all reconnissance @@ -215,7 +217,7 @@ subroutine setupw(obsLL,odiagLL,lunin,mype,bwork,awork,nele,nobs,is,conv_diagsav ! error (DOE) calculation to the namelist ! level; they are now loaded by ! aircraftinfo. -! +! 2020-05-04 wu - no rotate_wind for fv3_regional ! ! REMARKS: ! language: f90 @@ -285,9 +287,9 @@ subroutine setupw(obsLL,odiagLL,lunin,mype,bwork,awork,nele,nobs,is,conv_diagsav integer(i_kind) ihgt,ier2,iuse,ilate,ilone integer(i_kind) izz,iprvd,isprvd integer(i_kind) idomsfc,isfcr,iskint,iff10 - integer(i_kind) ibb,ikk,ihil + integer(i_kind) ibb,ikk,ihil,idddd - integer(i_kind) num_bad_ikx + integer(i_kind) num_bad_ikx,iprev_station character(8) station_id character(8),allocatable,dimension(:):: cdiagbuf @@ -409,9 +411,41 @@ subroutine setupw(obsLL,odiagLL,lunin,mype,bwork,awork,nele,nobs,is,conv_diagsav if (netcdf_diag) call init_netcdf_diag_ end if + num_bad_ikx=0 do i=1,nobs muse(i)=nint(data(iuse,i)) <= jiter + ikx=nint(data(ikxx,i)) + if(ikx < 1 .or. ikx > nconvtype) then + num_bad_ikx=num_bad_ikx+1 + if(num_bad_ikx<=10) write(6,*)' in setupw ',ikx,i,nconvtype,mype + end if end do +! If HD raobs available move prepbufr version to monitor + if(nhduv > 0)then + iprev_station=0 + do i=1,nobs + ikx=nint(data(ikxx,i)) + itype=ictype(ikx) + if(itype == 220 .or. itype == 221) then + rstation_id = data(id,i) + read(station_id,'(i5,3x)',err=1200) idddd + if(idddd == iprev_station)then + data(iuse,i)=108._r_kind + muse(i) = .false. + else + stn_loop:do j=1,nhduv + if(idddd == hduvlist(j))then + iprev_station=idddd + data(iuse,i)=108._r_kind + muse(i) = .false. + exit stn_loop + end if + end do stn_loop + end if + end if +1200 continue + end do + end if ! handle multiple-report observations at a station hr_offset=min_offset/60.0_r_kind @@ -468,7 +502,7 @@ subroutine setupw(obsLL,odiagLL,lunin,mype,bwork,awork,nele,nobs,is,conv_diagsav var_jb=data(ijb,i) if(ikx < 1 .or. ikx > nconvtype) then num_bad_ikx=num_bad_ikx+1 - if(num_bad_ikx<=10) write(6,*)' in setupw, bad ikx, ikx,i,nconvtype=',ikx,i,nconvtype + if(num_bad_ikx<=10) write(6,*)' in setupw, bad ikx, ikx,i,nconvtype=',ikx,i,nconvtype,mype cycle end if isli = data(idomsfc,i) @@ -552,6 +586,7 @@ subroutine setupw(obsLL,odiagLL,lunin,mype,bwork,awork,nele,nobs,is,conv_diagsav z_height = .false. if ((itype>=221 .and. itype <= 229) .and. (data(ihgt,i)=223 .and. itype<=228) .or. sfc_data) .and. .not.twodvar_regional) then + if (((itype>=223 .and. itype<=228) .or. itype == 218 .or. sfc_data) .and. .not.twodvar_regional) then ! Convert geopotential height at layer midpoints to geometric ! height using equations (17, 20, 23) in MJ Mahoney's note ! "A discussion of various measures of altitude" (2001). @@ -1656,7 +1691,7 @@ subroutine contents_binary_diag_(udiag,vdiag) rdiagbuf(21,ii) = dvdiff ! v obs-ges used in analysis (m/s) rdiagbuf(22,ii) = vob-vgesin ! v obs-ges w/o bias correction (m/s) (future slot) - if(regional) then + if(regional .and. .not. fv3_regional) then ! replace positions 17-22 with earth relative wind component information @@ -1752,6 +1787,7 @@ subroutine contents_netcdf_diag_(udiag,vdiag) call nc_diag_metadata("Prep_QC_Mark", sngl(data(iqc,i)) ) ! call nc_diag_metadata("Setup_QC_Mark", rmiss_single ) call nc_diag_metadata("Setup_QC_Mark", sngl(bmiss) ) + call nc_diag_metadata("Nonlinear_QC_Var_Jb", sngl(var_jb) ) call nc_diag_metadata("Prep_Use_Flag", sngl(data(iuse,i)) ) if(muse(i)) then call nc_diag_metadata("Analysis_Use_Flag", sngl(one) ) @@ -1766,7 +1802,7 @@ subroutine contents_netcdf_diag_(udiag,vdiag) call nc_diag_metadata("Wind_Reduction_Factor_at_10m", sngl(factw) ) - if (.not. regional) then + if (.not. regional .or. fv3_regional) then call nc_diag_metadata("u_Observation", sngl(data(iuob,i)) ) call nc_diag_metadata("u_Obs_Minus_Forecast_adjusted", sngl(dudiff) ) call nc_diag_metadata("u_Obs_Minus_Forecast_unadjusted", sngl(uob-ugesin) ) diff --git a/src/gsi/smoothrf.f90 b/src/gsi/smoothrf.f90 index 455ed29636..ec5931db4a 100644 --- a/src/gsi/smoothrf.f90 +++ b/src/gsi/smoothrf.f90 @@ -1171,7 +1171,7 @@ subroutine sqrt_smoothrf(z,work,nlevs) else do j=1,nhscrf - totwgt(j)=sqrt(hswgt(j)*hzscl(j)*hzscl(j)) + totwgt(j)=sqrt(hswgt(j))*hzscl(j) end do ! zero output array @@ -1330,7 +1330,7 @@ subroutine sqrt_smoothrf_ad(z,work,nlevs) if(nrf_var(nvar_id(k))=='sf'.or.nrf_var(nvar_id(k))=='vp')then totwgt(3)=sqrt(half)*totwgt(3) end if - + call sqrt_rfxyyx_ad(zloc,work(1,1,k),ny,nx,ii(1,1,1,k),& jj(1,1,1,k),slw(1,k),totwgt) @@ -1348,7 +1348,7 @@ subroutine sqrt_smoothrf_ad(z,work,nlevs) else do j=1,nhscrf - totwgt(j)=sqrt(hswgt(j)*hzscl(j)*hzscl(j)) + totwgt(j)=sqrt(hswgt(j))*hzscl(j) end do diff --git a/src/gsi/sst_retrieval.f90 b/src/gsi/sst_retrieval.f90 index bf530b29cb..97f1073a50 100644 --- a/src/gsi/sst_retrieval.f90 +++ b/src/gsi/sst_retrieval.f90 @@ -468,6 +468,7 @@ subroutine finish_sst_retrieval implicit none call closbf(lnbufr) + close(lnbufr) return end subroutine finish_sst_retrieval diff --git a/src/gsi/statsconv.f90 b/src/gsi/statsconv.f90 index cd11ad4d5a..b5df653759 100644 --- a/src/gsi/statsconv.f90 +++ b/src/gsi/statsconv.f90 @@ -1462,8 +1462,8 @@ subroutine statsconv(mype,& ! Format statements used above 111 format('obs lev num rms bias sumges sumobs cpen') -240 format(' num(',A1,') = ',i6,' at lev ',i4,' pen,qcpen,cpen,cqcpen = ',6(g12.5,1x)) -241 format(' num(',A1,') = ',i6,' at lev ',i4,' upen,vpen,cupen,cvpen = ',6(g12.5,1x)) +240 format(' num(',A1,') = ',i7,' at lev ',i4,' pen,qcpen,cpen,cqcpen = ',6(g12.5,1x)) +241 format(' num(',A1,') = ',i7,' at lev ',i4,' upen,vpen,cupen,cvpen = ',6(g12.5,1x)) 900 format(' number of ',a5,' obs extrapolated above',& ' top sigma layer=',i8,/,10x,' number extrapolated below',& ' bottom sigma layer=',i8) @@ -1472,7 +1472,7 @@ subroutine statsconv(mype,& 920 format(a44,i7) 924 format(a50) 925 format(' number of ',a5,' obs that failed gross test = ',I5,' nonlin qc test = ',I5) -949 format(' number of ',a5,' obs = ',i6,' pen= ',e25.18,' cpen= ',g13.6) +949 format(' number of ',a5,' obs = ',i7,' pen= ',e25.18,' cpen= ',g13.6) 950 format(' type ',a7,' jiter ',i3,' nread ',i9,' nkeep ',i7,' num ',i7) 951 format(' type ',a7,' pen= ',e25.18,' qcpen= ',e25.18,' r= ',g13.6,' qcr= ',g13.6) 952 format(t5,'it',t13,'sat',t21,'# read',t32,'# keep',t42,'# assim',& diff --git a/src/gsi/statslight.f90 b/src/gsi/statslight.f90 index ef0e633f94..ffcdef6a0a 100644 --- a/src/gsi/statslight.f90 +++ b/src/gsi/statslight.f90 @@ -126,7 +126,7 @@ subroutine statslight(mype,i_light,bwork,awork,i_ref,ndata) 920 format(a44,i7) 924 format(a50) 925 format(' number of ',a5,' obs that failed gross test = ',I5,' nonlin qc test = ',I5) -949 format(' number of ',a5,' obs = ',i6,' pen= ',e25.18,' cpen= ',g13.6) +949 format(' number of ',a5,' obs = ',i7,' pen= ',e25.18,' cpen= ',g13.6) 950 format(' type ',a7,' jiter ',i3,' nread ',i7,' nkeep ',i7,' num ',i7) 951 format(' type ',a7,' pen= ',e25.18,' qcpen= ',e25.18,' r= ',g13.6,' qcr= ',g13.6) 952 format(t5,'it',t13,'sat',t21,'# read',t32,'# keep',t42,'# assim',& diff --git a/src/gsi/stpcalc.f90 b/src/gsi/stpcalc.f90 index a3ea5e67bd..8b67e35742 100644 --- a/src/gsi/stpcalc.f90 +++ b/src/gsi/stpcalc.f90 @@ -40,7 +40,7 @@ module stpcalcmod contains -subroutine stpcalc(stpinout,sval,sbias,xhat,dirx,dval,dbias, & +subroutine stpcalc(stpinout,sval,sbias,dirx,dval,dbias, & diry,penalty,penaltynew,pjcost,pjcostnew,end_iter) !$$$ subprogram documentation block @@ -188,7 +188,6 @@ subroutine stpcalc(stpinout,sval,sbias,xhat,dirx,dval,dbias, & ! input argument list: ! stpinout - guess stepsize ! sval - current solution -! xhat - current solution ! dirx - search direction for x ! diry - search direction for y (B-1 dirx) ! end_iter - end iteration flag @@ -196,7 +195,6 @@ subroutine stpcalc(stpinout,sval,sbias,xhat,dirx,dval,dbias, & ! sbias,dbias ! ! output argument list: -! xhat ! stpinout - final estimate of stepsize ! penalty - penalty current solution ! penaltynew - estimate of penalty for new solution @@ -222,7 +220,7 @@ subroutine stpcalc(stpinout,sval,sbias,xhat,dirx,dval,dbias, & use constants, only: zero,one_quad,zero_quad use gsi_4dvar, only: nobs_bins,ltlint,ibin_anl use jfunc, only: iout_iter,nclen,xhatsave,yhatsave,& - iter + iter,nrclen use jcmod, only: ljcpdry,ljc4tlevs,ljcdfi,ljclimqc use gsi_obOperTypeManager, only: nobs_type => obOper_count use stpjcmod, only: stplimq,stplimg,stplimv,stplimp,stplimw10m,& @@ -247,11 +245,11 @@ subroutine stpcalc(stpinout,sval,sbias,xhat,dirx,dval,dbias, & real(r_kind) ,intent( out) :: penalty,penaltynew real(r_kind) ,intent( out) :: pjcost(4),pjcostnew(4) - type(control_vector),intent(inout) :: xhat type(control_vector),intent(in ) :: dirx,diry - type(gsi_bundle) ,intent(in ) :: sval(nobs_bins) + type(gsi_bundle) ,intent(inout) :: sval(nobs_bins) type(gsi_bundle) ,intent(in ) :: dval(nobs_bins) - type(predictors) ,intent(in ) :: sbias,dbias + type(predictors) ,intent(inout) :: sbias + type(predictors) ,intent(in ) :: dbias ! Declare local parameters @@ -923,9 +921,17 @@ subroutine stpcalc(stpinout,sval,sbias,xhat,dirx,dval,dbias, & endif ! Update solution + do i=1,nrclen + sbias%values(i)=sbias%values(i)+stpinout*dbias%values(i) + end do +!$omp parallel do schedule(dynamic,1) private(i,ii) + do ii=1,nobs_bins + do i=1,sval(ii)%ndim + sval(ii)%values(i)=sval(ii)%values(i)+stpinout*dval(ii)%values(i) + end do + end do !DIR$ IVDEP do i=1,nclen - xhat%values(i)=xhat%values(i)+stpinout*dirx%values(i) xhatsave%values(i)=xhatsave%values(i)+stpinout*dirx%values(i) yhatsave%values(i)=yhatsave%values(i)+stpinout*diry%values(i) end do diff --git a/src/gsi/stpt.f90 b/src/gsi/stpt.f90 index f793c6a214..27f5385ac1 100644 --- a/src/gsi/stpt.f90 +++ b/src/gsi/stpt.f90 @@ -193,10 +193,10 @@ subroutine stpt(thead,dval,xval,out,sges,nstep,rpred,spred) val2=w1*stv(j1)+w2*stv(j2)+w3*stv(j3)+w4*stv(j4)+ & w5*stv(j5)+w6*stv(j6)+w7*stv(j7)+w8*stv(j8) else - val= w1* rt(j1)+w2* rt(j2)+w3* rt(j3)+w4* rt(j4)+ & - w5* rt(j5)+w6* rt(j6)+w7* rt(j7)+w8* rt(j8) - val2=w1* st(j1)+w2* st(j2)+w3* st(j3)+w4* st(j4)+ & - w5* st(j5)+w6* st(j6)+w7* st(j7)+w8* st(j8) + val= w1* rt(j1)+w2* rt(j2)+w3* rt(j3)+w4* rt(j4)+ & + w5* rt(j5)+w6* rt(j6)+w7* rt(j7)+w8* rt(j8) + val2=w1* st(j1)+w2* st(j2)+w3* st(j3)+w4* st(j4)+ & + w5* st(j5)+w6* st(j6)+w7* st(j7)+w8* st(j8) end if ! contribution from bias correction @@ -233,9 +233,9 @@ subroutine stpt(thead,dval,xval,out,sges,nstep,rpred,spred) ts_prime=tt(kk) tg_prime=valsst2+sges(kk)*valsst qs_prime=valq2+sges(kk)*valq - us_prime=valu2+sges(kk)*val - vs_prime=valv2+sges(kk)*val - psfc_prime=val2+sges(1)*val + us_prime=valu2+sges(kk)*valu + vs_prime=valv2+sges(kk)*valv + psfc_prime=valp2+sges(1)*valp tt(kk)=psfc_prime*tptr%tlm_tsfc(1) + tg_prime*tptr%tlm_tsfc(2) + & ts_prime *tptr%tlm_tsfc(3) + qs_prime*tptr%tlm_tsfc(4) + & diff --git a/src/gsi/tcv_mod.f90 b/src/gsi/tcv_mod.f90 index dfec6e05b5..ab3e8c6372 100644 --- a/src/gsi/tcv_mod.f90 +++ b/src/gsi/tcv_mod.f90 @@ -148,7 +148,7 @@ subroutine get_storminfo(lunin) iret = 0 return else - write(6,*)'GET_STORMINFO: ***ERROR*** num storms to be processed <= 0' + write(6,*)'GET_STORMINFO: ***WARNING*** num storms to be processed <= 0' write(6,*)'GET_STORMINFO: Check file assigned to unit lucard=',lucard iret = 99 return @@ -255,7 +255,7 @@ subroutine read_tcv_card(nums,storm,lucard,stswitch,slonfg,slatfg,centerid,stid, iret = 0 return else - write(6,*)'READ_TCV_CARD: ***ERROR*** num storms to be processed <=0 ' + write(6,*)'READ_TCV_CARD: ***WARNING*** num storms to be processed <=0 ' write(6,*)'READ_TCV_CARD: Check file assigned to unit lucard=',lucard iret = 99 return diff --git a/src/gsi/update_guess.f90 b/src/gsi/update_guess.f90 index e567ebdc92..6ce95e5a62 100644 --- a/src/gsi/update_guess.f90 +++ b/src/gsi/update_guess.f90 @@ -88,6 +88,7 @@ subroutine update_guess(sval,sbias) ! 2016-06-23 lippi - Add update for vertical velocity (w). ! 2018-05-01 yang - modify the constrains to C and V in g-space, or using NLTF transfermation to C/V ! 2019-06-17 mmorris - Enforce consistency b/w ceiling and sky cover fields +! 2021-01-05 x.zhang/lei - add code for updating delz analysis in regional da ! ! input argument list: ! sval @@ -110,9 +111,11 @@ subroutine update_guess(sval,sbias) r100,one_tenth,tiny_r_kind use jfunc, only: iout_iter,bcoption,tsensible,clip_supersaturation use gridmod, only: lat2,lon2,nsig,& - regional,twodvar_regional,regional_ozone + regional,twodvar_regional,regional_ozone,& + l_reg_update_hydro_delz use guess_grids, only: ges_tsen,ges_qsat,& - nfldsig,hrdifsig,hrdifsfc,nfldsfc,dsfct + nfldsig,hrdifsig,hrdifsfc,nfldsfc,dsfct,& + load_geop_hgt use state_vectors, only: svars3d,svars2d use xhat_vordivmod, only: xhat_vor,xhat_div use gsi_4dvar, only: nobs_bins, hr_obsbin @@ -478,6 +481,10 @@ subroutine update_guess(sval,sbias) endif endif + if(l_reg_update_hydro_delz) then + call load_geop_hgt + endif + ! If requested, update background bias correction if (abs(bcoption)>0) then diff --git a/src/ncdiag/CMakeLists.txt b/src/ncdiag/CMakeLists.txt index 154a098ed9..b47de6949a 100644 --- a/src/ncdiag/CMakeLists.txt +++ b/src/ncdiag/CMakeLists.txt @@ -6,7 +6,7 @@ if(BUILD_NCDIAG) set(Fortran_MODULE_DIRECTORY "${PROJECT_BINARY_DIR}/include") # NetCDF-4 library - include_directories( ${NETCDF_INCLUDES} ${NCDIAG_INCS} ) + include_directories( ${NETCDF_INCLUDE_DIRS} ${NCDIAG_INCS} ) # 32-bit reals, for now add_definitions(-D_REAL4_ -DUSE_MPI) @@ -16,11 +16,11 @@ if(BUILD_NCDIAG) LIST(REMOVE_ITEM NCDIAG_SRC ${CMAKE_CURRENT_SOURCE_DIR}/nc_diag_cat.F90 ) add_library(ncdiag STATIC ${NCDIAG_SRC}) add_executable(test_nc_unlimdims.x ${CMAKE_CURRENT_SOURCE_DIR}/test_nc_unlimdims.F90 ) - add_executable(nc_diag_cat.x ${CMAKE_CURRENT_SOURCE_DIR}/nc_diag_cat.F90 ) - target_link_libraries(nc_diag_cat.x ncdiag ${NETCDF_LIBRARIES} ${HDF5_Fortran_HL_LIBRARIES} ${HDF5_LIBRARIES} ${ZLIB_LIBRARIES} ${MPI_Fortran_LIBRARIES}) - target_link_libraries(test_nc_unlimdims.x ncdiag ${NETCDF_LIBRARIES} ${HDF5_Fortran_HL_LIBRARIES} ${HDF5_LIBRARIES} ${ZLIB_LIBRARIES} ${MPI_Fortran_LIBRARIES}) + add_executable(ncdiag_cat_mpi.x ${CMAKE_CURRENT_SOURCE_DIR}/nc_diag_cat.F90 ) + target_link_libraries(ncdiag_cat_mpi.x ncdiag ${NETCDF_Fortran_LIBRARIES} ${NETCDF_C_LIBRARIES} ${MPI_Fortran_LIBRARIES}) + target_link_libraries(test_nc_unlimdims.x ncdiag ${NETCDF_Fortran_LIBRARIES} ${NETCDF_C_LIBRARIES} ${MPI_Fortran_LIBRARIES}) # set_target_properties(test_nc_unlimdims.x PROPERTIES Fortran_MODULE_DIRECTORY ${NCDIAG_INCS} ) -# set_target_properties(nc_diag_cat.x PROPERTIES Fortran_MODULE_DIRECTORY ${NCDIAG_INCS} ${MPI_Fortran_INCLUDE_PATH}) +# set_target_properties(ncdiag_cat_mpi.x PROPERTIES Fortran_MODULE_DIRECTORY ${NCDIAG_INCS} ${MPI_Fortran_INCLUDE_PATH}) endif(BUILD_NCDIAG) diff --git a/src/ncdiag/ncdw_chaninfo.F90 b/src/ncdiag/ncdw_chaninfo.F90 index ec28f1d65a..843a23162a 100644 --- a/src/ncdiag/ncdw_chaninfo.F90 +++ b/src/ncdiag/ncdw_chaninfo.F90 @@ -706,7 +706,7 @@ subroutine nc_diag_chaninfo_load_def call nclayer_error("NetCDF4 type invalid!") end if - print *, trim(tmp_var_name), "rel index", rel_index +! print *, trim(tmp_var_name), "rel index", rel_index ! Now add a relative position... based on the next position! diff --git a/src/ncdiag/ncdw_data2d.F90 b/src/ncdiag/ncdw_data2d.F90 index 80aea43182..8e5efc458d 100644 --- a/src/ncdiag/ncdw_data2d.F90 +++ b/src/ncdiag/ncdw_data2d.F90 @@ -365,7 +365,7 @@ subroutine nc_diag_data2d_load_def diag_data2d_store%max_lens(diag_data2d_store%total) = tmp_var_dim_sizes(1) end if - print *, trim(tmp_var_name), "rel index", rel_index +! print *, trim(tmp_var_name), "rel index", rel_index ! Now add a relative position... based on the next position! diff --git a/src/ncdiag/serial/CMakeLists.txt b/src/ncdiag/serial/CMakeLists.txt index 6f6de2348e..8d991fb3b3 100644 --- a/src/ncdiag/serial/CMakeLists.txt +++ b/src/ncdiag/serial/CMakeLists.txt @@ -7,7 +7,7 @@ if(BUILD_NCDIAG) # NetCDF-4 library set(NCDIAG_SERIAL_INCS "${PROJECT_BINARY_DIR}/include/ncdiag_serial") - include_directories( ${NETCDF_INCLUDES} ${NCDIAG_SERIAL_INCS} ) + include_directories( ${NETCDF_INCLUDE_DIRS} ${NCDIAG_SERIAL_INCS} ) # 32-bit reals, for now add_definitions(-D_REAL4_) @@ -19,10 +19,10 @@ if(BUILD_NCDIAG) LIST(REMOVE_ITEM NCDIAG_SRC ${CMAKE_CURRENT_SOURCE_DIR}/nc_diag_cat.F90 ) add_library(ncdiag_serial STATIC ${NCDIAG_SRC}) set_target_properties( ncdiag_serial PROPERTIES Fortran_MODULE_DIRECTORY ${NCDIAG_SERIAL_MODULE_DIR} ) - add_executable(nc_diag_cat_serial.x ${CMAKE_CURRENT_SOURCE_DIR}/../nc_diag_cat.F90 ) - set_target_properties( nc_diag_cat_serial.x PROPERTIES COMPILE_FLAGS ${NCDIAG_Fortran_FLAGS} ) - set_target_properties( nc_diag_cat_serial.x PROPERTIES Fortran_MODULE_DIRECTORY ${NCDIAG_SERIAL_MODULE_DIR} ) - target_link_libraries(nc_diag_cat_serial.x ncdiag_serial ${NETCDF_LIBRARIES} ${HDF5_Fortran_HL_LIBRARIES} ${HDF5_LIBRARIES} ${ZLIB_LIBRARIES} ${MPI_Fortran_LIBRARIES} ) + add_executable(ncdiag_cat.x ${CMAKE_CURRENT_SOURCE_DIR}/../nc_diag_cat.F90 ) + set_target_properties( ncdiag_cat.x PROPERTIES COMPILE_FLAGS ${NCDIAG_Fortran_FLAGS} ) + set_target_properties( ncdiag_cat.x PROPERTIES Fortran_MODULE_DIRECTORY ${NCDIAG_SERIAL_MODULE_DIR} ) + target_link_libraries(ncdiag_cat.x ncdiag_serial ${NETCDF_Fortran_LIBRARIES} ${NETCDF_C_LIBRARIES} ${MPI_Fortran_LIBRARIES}) endif(BUILD_NCDIAG_SERIAL) endif( NOT USE_BASELIBS ) endif(BUILD_NCDIAG) diff --git a/unit-tests/CMakeLists.txt b/unit-tests/CMakeLists.txt index a778f19514..3fc9e5d458 100644 --- a/unit-tests/CMakeLists.txt +++ b/unit-tests/CMakeLists.txt @@ -41,8 +41,8 @@ foreach(_test ${UNIT_TEST_LIST}) ${PFUNIT_DIR}/lib/libpfunit.a gsilib_global${debug_suffix} gsilib_shrd${debug_suffix} gsilib_global${debug_suffix} gsilib_shrd${debug_suffix} gsilib_global${debug_suffix} ${FRAMEPACK} ${FRAMEMODULE} - ${NETCDF_LIBRARIES_F90} ${NETCDF_LIBRARIES} ${HDF5_Fortran_HL_LIBRARIES} ${MPI_Fortran_LIBRARIES} - ${LAPACK_LIBRARIES} -L./ ${EXTRA_LINKER_FLAGS} ${HDF5_LIBRARIES} ${CURL_LIBRARIES} ${CORE_LIBRARIES} + ${MPI_Fortran_LIBRARIES} + ${LAPACK_LIBRARIES} -L./ ${EXTRA_LINKER_FLAGS} ${CORE_LIBRARIES} ${IOINT_LIB} ${WRFNETCDF_LIB} ) target_include_directories( ${_test}.x PUBLIC ${PROJECT_BINARY_DIR}/generated/${_test}) add_test(NAME ${_test} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/unit-tests/data COMMAND diff --git a/ush/EnKF/drive_gfs b/ush/EnKF/drive_gfs index beb25ae25f..27c9347271 100755 --- a/ush/EnKF/drive_gfs +++ b/ush/EnKF/drive_gfs @@ -35,7 +35,7 @@ export NET=$RUN # SENDCOM - Copy Files From TMPDIR to $DATOUT # SENDDBN - Issue DBNet Client Calls # RERUN - Rerun fcst from beginning (default no) -# VERBOSE - Specify Verbose Output in exglobal_fcst.sh.sms +# VERBOSE - Specify Verbose Output in exglobal_fcst.sh #################################### export SENDSMS=YES export SENDCOM=YES diff --git a/ush/EnKF/drive_gsi b/ush/EnKF/drive_gsi index 8b83434c13..ade5ccff6f 100755 --- a/ush/EnKF/drive_gsi +++ b/ush/EnKF/drive_gsi @@ -56,7 +56,7 @@ export pgmerr=$logdir/errfile # SENDSMS - Flag Events on SMS # SENDCOM - Copy Files From TMPDIR to $COMOUT # SENDDBN - Issue DBNet Client Calls -# VERBOSE - Specify Verbose Output in exglobal_fcst.sh.sms +# VERBOSE - Specify Verbose Output in exglobal_fcst.sh #################################### export SENDSMS=YES export SENDCOM=YES @@ -325,7 +325,7 @@ sh ${homedir}/run_gsi #poe rm /tmp/mplog* ########## -# NOTES: 1) script exglobal_analysis.sh.sms compresses the contents of +# NOTES: 1) script exglobal_analysis.sh compresses the contents of # RADSTAT, PCPSTAT, OZNSTAT, and CNVSTAT. These stat files # files are tarballs of compressed files. # 2) SFCANL, SIGANL are input to the GFS forecast following the analysis diff --git a/ush/build.comgsi b/ush/build.comgsi index 2188f015af..891c70dce9 100755 --- a/ush/build.comgsi +++ b/ush/build.comgsi @@ -5,9 +5,9 @@ # Cheyenne: source /glade/p/ral/jntp/gge/modulefiles/modulefile.cheyenne.GSI_UPP_WRF # # build commands: -# cmake -DENKF_MODE=WRF -DBUILD_CORELIBS=ON -DBUILD_GSDCLOUD_ARW=ON path_to_GSI -# cmake -DENKF_MODE=WRF -DBUILD_CORELIBS=ON -DBUILD_GSDCLOUD_ARW=ON -DBUILD_UTIL_COM=ON -DBUILD_ENKF_PREPROCESS_ARW=ON path_to_GSI" -# (for global: cmake -D-DENKF_MODE=GFS -DBUILD_CORELIBS=ON path_to_GSI) +# cmake -DCOMGSI=ON -DENKF_MODE=WRF -DBUILD_GSDCLOUD_ARW=ON path_to_GSI +# cmake -DCOMGSI=ON -DENKF_MODE=WRF -DBUILD_GSDCLOUD_ARW=ON -DBUILD_UTIL_COM=ON -DBUILD_ENKF_PREPROCESS_ARW=ON path_to_GSI" +# (for global: cmake -DCOMGSI=ON -DENKF_MODE=GFS path_to_GSI) # make -j8 # @@ -16,80 +16,118 @@ dir_root=$(pwd) ################# Hera #################### if [[ "`grep -i "hera" /etc/hosts | head -n1`" != "" ]] ; then source /etc/profile.d/modules.sh - modulefile="/home/rtrr/PARM_EXEC/modulefiles/modulefile.hera.GSI_UPP_WRF" - NCEPLIBS="/scratch1/BMC/comgsi/precompiled/NCEPLIBS/b_intel18.0.5.274_impi2018.0.4/install" - GSILIBS="/scratch1/BMC/comgsi/precompiled/GSILIBS/b_intel18.0.5.274_impi2018.0.4" + module purge + module load cmake/3.20.1 + module use /scratch2/NCEPDEV/nwprod/hpc-stack/libs/hpc-stack/modulefiles/stack + module load hpc/1.1.0 + module load hpc-intel/18.0.5.274 + module load hpc-impi/2018.0.4 + module load bufr/11.4.0 + module load ip/3.3.3 + module load nemsio/2.5.2 + module load sfcio/1.4.1 + module load sigio/2.3.2 + module load sp/2.3.3 + module load w3nco/2.4.1 + module load w3emc/2.7.3 + module load bacio/2.4.1 + module load crtm/2.3.0 + module load netcdf/4.7.0 + module use /scratch1/BMC/comgsi/hpc-stacks/modulefiles/gsiwrfio + module load gsiwrfio/1.0.0 ################# Jet #################### elif [[ -d /jetmon ]] ; then source /etc/profile.d/modules.sh - modulefile="/home/rtrr/PARM_EXEC/modulefiles/modulefile.jet.GSI_UPP_WRF" - NCEPLIBS="/lfs4/BMC/wrfruc/gge/precompiled/NCEPLIBS/b_intel18.0.5.274_impi2018.4.274/install" - GSILIBS="/lfs4/BMC/wrfruc/gge/precompiled/GSILIBS/b_intel18.0.5.274_impi2018.4.274" + module purge + module load cmake/3.16.1 + module load intel/18.0.5.274 + module load impi/2018.4.274 + + module use /lfs4/HFIP/hfv3gfs/nwprod/hpc-stack/libs/modulefiles/stack + module load hpc/1.1.0 + module load hpc-intel/18.0.5.274 + module load hpc-impi/2018.4.274 + + module load netcdf/4.7.0 #don't load netcdf/4.7.4 from hpc-stack, GSI does not compile with it. + module load bufr/11.4.0 + module load bacio/2.4.1 + module load crtm/2.3.0 + module load ip/3.3.3 + module load nemsio/2.5.2 + module load sp/2.3.3 + module load w3emc/2.7.3 + module load w3nco/2.4.1 + module load sfcio/1.4.1 + module load sigio/2.3.2 + + module use /mnt/lfs4/BMC/wrfruc/gge/hpc-stacks/modulefiles/gsiwrfio + module load gsiwrfio/1.0.0 ################# Cheyenne #################### elif [[ -d /glade ]] ; then source /etc/profile.d/modules.sh - modulefile="/glade/p/ral/jntp/gge/modulefiles/modulefile.cheyenne.GSI_UPP_WRF" - NCEPLIBS="/glade/p/ral/jntp/gge/precompiled/NCEPLIBS/b_intel18.0.5_impi2018.4.274/install" - GSILIBS="/glade/p/ral/jntp/gge/precompiled/GSILIBS/b_intel18.0.5_impi2018.4.274" - #modulefile="/glade/p/ral/jntp/gge/precompiled/NCEPLIBS/modulefile.cheyenne.GSI_UPP_WRF.gnu" - #NCEPLIBS="/glade/p/ral/jntp/gge/precompiled/NCEPLIBS/b_gnu8.3.0_openmpi3.1.4/install" - #GSILIBS="/glade/p/ral/jntp/gge/precompiled/GSILIBS/b_gnu8.3.0_openmpi3.1.4/" + module purge + module use /glade/p/ral/jntp/gge/hpc-stacks/modulefiles/stack + module load intel/18.0.5 ncarenv ncarcompilers + module load impi/2018.4.274 + module load mkl/2018.0.5 + module load netcdf/4.7.4 + module load hpc/1.1.0 + module load hpc-intel/18.0.5 + module load hpc-impi/2018.4.274 + module load bufr/11.4.0 + module load ip/3.3.3 + module load nemsio/2.5.2 + module load sfcio/1.4.1 + module load sigio/2.3.2 + module load sp/2.3.3 + module load w3nco/2.4.1 + module load w3emc/2.7.3 + module load bacio/2.4.1 + module load crtm/2.3.0 + module load gsiwrfio/1.0.0 + module load cmake/3.18.2 ################# Orion #################### elif [[ -d /work/noaa ]] ; then ### orion - modulefile="/home/gge/modulefiles/modulefile.orion.GSI_UPP_WRF" - NCEPLIBS="/work/noaa/wrfruc/gge/precompiled/NCEPLIBS/b_intel2018.4_impi2018.4/install" - GSILIBS="/work/noaa/wrfruc/gge/precompiled/GSILIBS/b_intel2018.4_impi2018.4" + module purge + module use /work/noaa/wrfruc/gge/hpc-stacks/modulefiles/stack + module load intel/2018.4 + module load impi/2018.4 + module load netcdf/4.7.2 + module load hpc/1.1.0 + module load hpc-intel/2018.4 + module load hpc-impi/2018.4 + module load bufr/11.4.0 + module load ip/3.3.3 + module load nemsio/2.5.2 + module load sfcio/1.4.1 + module load sigio/2.3.2 + module load sp/2.3.3 + module load w3nco/2.4.1 + module load w3emc/2.7.3 + module load bacio/2.4.1 + module load crtm/2.3.0 + module load gsiwrfio/1.0.0 + module load cmake #any version as long as it is later than v3.16 ################# Generic #################### else echo -e "\nunknown machine" echo "Please modify build.comgsi at this location" - echo "to load required modules and setup NCEPLIBS and GSILIBS" + echo "to load required modules" ##follow the above examples and delete the following "exit 9" to go forward exit 9 source /etc/profile.d/modules.sh - modulefile="/my/modulefile.me.GSI_UPP_WRF" - NCEPLIBS="/my/NCEPLIBS/b_intel18.0.5_impi2018.4.274/install" - GSILIBS="/my/GSILIBS/b_intel18.0.5_impi2018.4.274/" + #load modules from the NOAA hpc-stack fi -if [ ! -f $modulefile ]; then - echo "modulefiles $modulefile does not exist" - exit 10 -fi -source $modulefile - ## if NETCDF4 is set to 0 or 1, unset it if [[ "$NETCDF4" == "1" ]] || [[ "$NETCDF4" == "0" ]]; then unset NETCDF4 fi -export BACIO_LIB4=${NCEPLIBS}/lib/libbacio_4.a -#export BUFR_LIBd=${NCEPLIBS}/lib/libbufr_d.a - export BUFR_LIBd=${GSILIBS}/lib/libbufr_v.a - export GSIWRF_LIB=${GSILIBS}/lib/libWRFLIB.a -export CRTM_LIB=${NCEPLIBS}/lib/libcrtm.a -export CRTM_INC=${NCEPLIBS}/include -export NEMSIO_LIB=${NCEPLIBS}/lib/libnemsio.a -export NEMSIO_INC=${NCEPLIBS}/include -export SFCIO_LIB4=${NCEPLIBS}/lib/libsfcio_4.a -export SFCIO_INC4=${NCEPLIBS}/include_4 -export SIGIO_LIB4=${NCEPLIBS}/lib/libsigio_4.a -export SIGIO_INC4=${NCEPLIBS}/include_4 -export SP_LIBd=${NCEPLIBS}/lib/libsp_d.a -export SP_LIB4=${NCEPLIBS}/lib/libsp_4.a -export W3EMC_LIBd=${NCEPLIBS}/lib/libw3emc_d.a -export W3EMC_LIB4=${NCEPLIBS}/lib/libw3emc_4.a -export W3EMC_INCd=${NCEPLIBS}/include_d -export W3EMC_INC4=${NCEPLIBS}/include_4 -export W3NCO_LIBd=${NCEPLIBS}/lib/libw3nco_d.a -export W3NCO_LIB4=${NCEPLIBS}/lib/libw3nco_4.a -export IP_LIBd=${NCEPLIBS}/lib/libip_d.a -export IP_LIB4=${NCEPLIBS}/lib/libip_4.a - set -x rm -rf $dir_root/build mkdir -p $dir_root/build @@ -107,12 +145,12 @@ git log -1 | head -n1 >> output.log echo -e "\ngit status:" >> output.log git status >> output.log echo -e "\nCompiling commands:" >> output.log -echo " cmake -DENKF_MODE=WRF -DBUILD_CORELIBS=ON -DBUILD_GSDCLOUD_ARW=ON -DBUILD_ENKF_PREPROCESS_ARW=ON -DBUILD_UTIL_COM=ON -Wno-dev .." >> output.log +echo " cmake -DCOMGSI=ON -DENKF_MODE=WRF -DBUILD_GSDCLOUD_ARW=ON -DBUILD_ENKF_PREPROCESS_ARW=ON -DBUILD_UTIL_COM=ON .." >> output.log echo " make -j8" >> output.log cat output.log -cmake -DENKF_MODE=WRF -DBUILD_CORELIBS=ON -DBUILD_GSDCLOUD_ARW=ON -DBUILD_ENKF_PREPROCESS_ARW=ON -DBUILD_UTIL_COM=ON -Wno-dev .. 2>&1 | tee output.cmake +cmake -DCOMGSI=ON -DENKF_MODE=WRF -DBUILD_GSDCLOUD_ARW=ON -DBUILD_ENKF_PREPROCESS_ARW=ON -DBUILD_UTIL_COM=ON .. 2>&1 | tee output.cmake make -j 8 2>&1 | tee output.compile ###aftermath diff --git a/ush/build_all_cmake.sh b/ush/build_all_cmake.sh index ceaf91d9c7..02f46cf7b5 100755 --- a/ush/build_all_cmake.sh +++ b/ush/build_all_cmake.sh @@ -66,7 +66,11 @@ if [ $target = wcoss_d ]; then elif [ $target = wcoss -o $target = gaea ]; then module purge module load $dir_modules/modulefile.ProdGSI.$target -elif [ $target = hera -o $target = cheyenne -o $target = orion ]; then +elif [ $target = hera -o $target = orion ]; then + module purge + module use $dir_modules + module load modulefile.ProdGSI.$target +elif [ $target = cheyenne ]; then module purge source $dir_modules/modulefile.ProdGSI.$target elif [ $target = wcoss_c ]; then @@ -85,6 +89,6 @@ else cmake .. fi -make -j 8 +make -j 8 exit diff --git a/ush/calcanl_gfs.py b/ush/calcanl_gfs.py index 2dac8928ed..79c29efda0 100755 --- a/ush/calcanl_gfs.py +++ b/ush/calcanl_gfs.py @@ -12,367 +12,340 @@ from collections import OrderedDict import datetime + # function to calculate analysis from a given increment file and background -def calcanl_gfs(DoIAU, l4DEnsVar, Write4Danl, ComOut, APrefix, ASuffix, - FixDir, atmges_ens_mean, RunDir, NThreads, NEMSGet, IAUHrs, - ExecCMD, ExecCMDMPI, ExecAnl, ExecChgresGes, ExecChgresInc, Cdump): - print('calcanl_gfs beginning at: ',datetime.datetime.utcnow()) +def calcanl_gfs(DoIAU, l4DEnsVar, Write4Danl, ComOut, APrefix, ASuffix, + ComIn_Ges, GPrefix, GSuffix, + FixDir, atmges_ens_mean, RunDir, NThreads, NEMSGet, IAUHrs, + ExecCMD, ExecCMDMPI, ExecAnl, ExecChgresInc, Cdump): + print('calcanl_gfs beginning at: ',datetime.datetime.utcnow()) - IAUHH = IAUHrs - if Cdump == "gfs": - IAUHH = list(map(int,'6')) - else: IAUHH = IAUHrs - - ######## copy and link files - if DoIAU and l4DEnsVar and Write4Danl: - for fh in IAUHH: - if fh == 6: + if Cdump == "gfs": + IAUHH = list(map(int,'6')) + else: + IAUHH = IAUHrs + + ######## copy and link files + if DoIAU and l4DEnsVar and Write4Danl: + for fh in IAUHH: + if fh == 6: + # for full res analysis + CalcAnlDir = RunDir+'/calcanl_'+format(fh, '02') + if not os.path.exists(CalcAnlDir): + gsi_utils.make_dir(CalcAnlDir) + gsi_utils.copy_file(ExecAnl, CalcAnlDir+'/calc_anl.x') + gsi_utils.link_file(RunDir+'/siginc.nc', CalcAnlDir+'/siginc.nc.06') + gsi_utils.link_file(RunDir+'/sigf06', CalcAnlDir+'/ges.06') + gsi_utils.link_file(RunDir+'/siganl', CalcAnlDir+'/anl.06') + gsi_utils.copy_file(ExecChgresInc, CalcAnlDir+'/chgres_inc.x') + # for ensemble res analysis + if Cdump == "gdas": + CalcAnlDir = RunDir+'/calcanl_ensres_'+format(fh, '02') + if not os.path.exists(CalcAnlDir): + gsi_utils.make_dir(CalcAnlDir) + gsi_utils.copy_file(ExecAnl, CalcAnlDir+'/calc_anl.x') + gsi_utils.link_file(RunDir+'/siginc.nc', CalcAnlDir+'/siginc.nc.06') + gsi_utils.link_file(ComOut+'/'+APrefix+'atmanl.ensres'+ASuffix, CalcAnlDir+'/anl.ensres.06') + gsi_utils.link_file(ComIn_Ges+'/'+GPrefix+'atmf006.ensres'+GSuffix, CalcAnlDir+'/ges.ensres.06') + gsi_utils.link_file(RunDir+'/sigf06', CalcAnlDir+'/ges.06') + else: + if os.path.isfile('sigi'+format(fh, '02')+'.nc'): + # for full res analysis + CalcAnlDir = RunDir+'/calcanl_'+format(fh, '02') + CalcAnlDir6 = RunDir+'/calcanl_'+format(6, '02') + if not os.path.exists(CalcAnlDir): + gsi_utils.make_dir(CalcAnlDir) + if not os.path.exists(CalcAnlDir6): + gsi_utils.make_dir(CalcAnlDir6) + gsi_utils.link_file(ComOut+'/'+APrefix+'atma'+format(fh, '03')+ASuffix, + CalcAnlDir6+'/anl.'+format(fh, '02')) + gsi_utils.link_file(RunDir+'/siga'+format(fh, '02'), + CalcAnlDir6+'/anl.'+format(fh, '02')) + gsi_utils.link_file(RunDir+'/sigi'+format(fh, '02')+'.nc', + CalcAnlDir+'/siginc.nc.'+format(fh, '02')) + gsi_utils.link_file(CalcAnlDir6+'/inc.fullres.'+format(fh, '02'), + CalcAnlDir+'/inc.fullres.'+format(fh, '02')) + gsi_utils.link_file(RunDir+'/sigf'+format(fh, '02'), + CalcAnlDir6+'/ges.'+format(fh, '02')) + gsi_utils.link_file(RunDir+'/sigf'+format(fh, '02'), + CalcAnlDir+'/ges.'+format(fh, '02')) + gsi_utils.copy_file(ExecChgresInc, CalcAnlDir+'/chgres_inc.x') + # for ensemble res analysis + CalcAnlDir = RunDir+'/calcanl_ensres_'+format(fh, '02') + CalcAnlDir6 = RunDir+'/calcanl_ensres_'+format(6, '02') + if not os.path.exists(CalcAnlDir): + gsi_utils.make_dir(CalcAnlDir) + if not os.path.exists(CalcAnlDir6): + gsi_utils.make_dir(CalcAnlDir6) + gsi_utils.link_file(ComOut+'/'+APrefix+'atma'+format(fh, '03')+'.ensres'+ASuffix, + CalcAnlDir6+'/anl.ensres.'+format(fh, '02')) + gsi_utils.link_file(RunDir+'/sigi'+format(fh, '02')+'.nc', + CalcAnlDir6+'/siginc.nc.'+format(fh, '02')) + gsi_utils.link_file(ComIn_Ges+'/'+GPrefix+'atmf'+format(fh, '03')+'.ensres'+GSuffix, + CalcAnlDir6+'/ges.ensres.'+format(fh, '02')) + + + else: # for full res analysis - CalcAnlDir = RunDir+'/calcanl_'+format(fh, '02') + CalcAnlDir = RunDir+'/calcanl_'+format(6, '02') if not os.path.exists(CalcAnlDir): - os.makedirs(CalcAnlDir) - shutil.copy(ExecAnl, CalcAnlDir+'/calc_anl.x') + gsi_utils.make_dir(CalcAnlDir) + gsi_utils.copy_file(ExecAnl, CalcAnlDir+'/calc_anl.x') gsi_utils.link_file(RunDir+'/siginc.nc', CalcAnlDir+'/siginc.nc.06') gsi_utils.link_file(RunDir+'/sigf06', CalcAnlDir+'/ges.06') gsi_utils.link_file(RunDir+'/siganl', CalcAnlDir+'/anl.06') - shutil.copy(ExecChgresInc, CalcAnlDir+'/chgres_inc.x') + gsi_utils.copy_file(ExecChgresInc, CalcAnlDir+'/chgres_inc.x') # for ensemble res analysis - CalcAnlDir = RunDir+'/calcanl_ensres_'+format(fh, '02') + CalcAnlDir = RunDir+'/calcanl_ensres_'+format(6, '02') if not os.path.exists(CalcAnlDir): - os.makedirs(CalcAnlDir) - shutil.copy(ExecAnl, CalcAnlDir+'/calc_anl.x') + gsi_utils.make_dir(CalcAnlDir) + gsi_utils.copy_file(ExecAnl, CalcAnlDir+'/calc_anl.x') gsi_utils.link_file(RunDir+'/siginc.nc', CalcAnlDir+'/siginc.nc.06') gsi_utils.link_file(ComOut+'/'+APrefix+'atmanl.ensres'+ASuffix, CalcAnlDir+'/anl.ensres.06') - gsi_utils.link_file(RunDir+'/sigf06', CalcAnlDir+'/ges.06') - shutil.copy(ExecChgresGes, CalcAnlDir+'/chgres_ges.x') - - else: - if os.path.isfile('sigi'+format(fh, '02')+'.nc'): - # for full res analysis - CalcAnlDir = RunDir+'/calcanl_'+format(fh, '02') - CalcAnlDir6 = RunDir+'/calcanl_'+format(6, '02') - if not os.path.exists(CalcAnlDir): - os.makedirs(CalcAnlDir) - if not os.path.exists(CalcAnlDir6): - os.makedirs(CalcAnlDir6) - gsi_utils.link_file(ComOut+'/'+APrefix+'atma'+format(fh, '03')+ASuffix, CalcAnlDir6+'/anl.'+format(fh, '02')) - gsi_utils.link_file(RunDir+'/siga'+format(fh, '02'), CalcAnlDir6+'/anl.'+format(fh, '02')) - gsi_utils.link_file(RunDir+'/sigi'+format(fh, '02')+'.nc', CalcAnlDir+'/siginc.nc.'+format(fh, '02')) - gsi_utils.link_file(CalcAnlDir6+'/inc.fullres.'+format(fh, '02'),CalcAnlDir+'/inc.fullres.'+format(fh, '02')) - gsi_utils.link_file(RunDir+'/sigf'+format(fh, '02'), CalcAnlDir6+'/ges.'+format(fh, '02')) - shutil.copy(ExecChgresInc, CalcAnlDir+'/chgres_inc.x') - # for ensemble res analysis - CalcAnlDir = RunDir+'/calcanl_ensres_'+format(fh, '02') - CalcAnlDir6 = RunDir+'/calcanl_ensres_'+format(6, '02') - if not os.path.exists(CalcAnlDir): - os.makedirs(CalcAnlDir) - if not os.path.exists(CalcAnlDir6): - os.makedirs(CalcAnlDir6) - gsi_utils.link_file(ComOut+'/'+APrefix+'atma'+format(fh, '03')+'.ensres'+ASuffix, CalcAnlDir6+'/anl.ensres.'+format(fh, '02')) - gsi_utils.link_file(RunDir+'/sigi'+format(fh, '02')+'.nc', CalcAnlDir6+'/siginc.nc.'+format(fh, '02')) - gsi_utils.link_file(RunDir+'/sigf'+format(fh, '02'), CalcAnlDir+'/ges.'+format(fh, '02')) - gsi_utils.link_file(CalcAnlDir6+'/ges.ensres.'+format(fh, '02'),CalcAnlDir+'/ges.ensres.'+format(fh, '02')) - shutil.copy(ExecChgresGes, CalcAnlDir+'/chgres_ges.x') - - - else: - # for full res analysis - CalcAnlDir = RunDir+'/calcanl_'+format(6, '02') - if not os.path.exists(CalcAnlDir): - os.makedirs(CalcAnlDir) - shutil.copy(ExecAnl, CalcAnlDir+'/calc_anl.x') - gsi_utils.link_file(RunDir+'/siginc.nc', CalcAnlDir+'/siginc.nc.06') - gsi_utils.link_file(RunDir+'/sigf06', CalcAnlDir+'/ges.06') - gsi_utils.link_file(RunDir+'/siganl', CalcAnlDir+'/anl.06') - shutil.copy(ExecChgresInc, CalcAnlDir+'/chgres_inc.x') - # for ensemble res analysis - CalcAnlDir = RunDir+'/calcanl_ensres_'+format(6, '02') - if not os.path.exists(CalcAnlDir): - os.makedirs(CalcAnlDir) - shutil.copy(ExecAnl, CalcAnlDir+'/calc_anl.x') - gsi_utils.link_file(RunDir+'/siginc.nc', CalcAnlDir+'/siginc.nc.06') - gsi_utils.link_file(ComOut+'/'+APrefix+'atmanl.ensres'+ASuffix, CalcAnlDir+'/anl.ensres.06') - gsi_utils.link_file(RunDir+'/sigf06', CalcAnlDir+'/ges.06') - shutil.copy(ExecChgresGes, CalcAnlDir+'/chgres_ges.x') + gsi_utils.link_file(ComIn_Ges+'/'+GPrefix+'atmf006.ensres'+GSuffix, CalcAnlDir+'/ges.ensres.06') - # determine if the analysis is to be written in netCDF or NEMSIO - if ASuffix == ".nc": - nemsanl = ".false." - else: - nemsanl = ".true." + ######## get dimension information from background and increment files + AnlDims = gsi_utils.get_ncdims('siginc.nc') + if ASuffix == ".nc": + GesDims = gsi_utils.get_ncdims('sigf06') + else: + GesDims = gsi_utils.get_nemsdims('sigf06',NEMSGet) - ######## get dimension information from background and increment files - AnlDims = gsi_utils.get_ncdims('siginc.nc') - if ASuffix == ".nc": - GesDims = gsi_utils.get_ncdims('sigf06') - else: - GesDims = gsi_utils.get_nemsdims('sigf06',NEMSGet) + levs = AnlDims['lev'] + LonA = AnlDims['lon'] + LatA = AnlDims['lat'] + LonB = GesDims['grid_xt'] + LatB = GesDims['grid_yt'] - levs = AnlDims['lev'] - LonA = AnlDims['lon'] - LatA = AnlDims['lat'] - LonB = GesDims['grid_xt'] - LatB = GesDims['grid_yt'] + # vertical coordinate info + levs2 = levs + 1 + siglevel = FixDir+'/global_hyblev.l'+str(levs2)+'.txt' - # vertical coordinate info - levs2 = levs + 1 - siglevel = FixDir+'/global_hyblev.l'+str(levs2)+'.txt' + ####### determine how many forecast hours to process + nFH=0 + for fh in IAUHH: + # first check to see if increment file exists + CalcAnlDir = RunDir+'/calcanl_'+format(fh, '02') + if (os.path.isfile(CalcAnlDir+'/siginc.nc.'+format(fh, '02'))): + print('will process increment file: '+CalcAnlDir+'/siginc.nc.'+format(fh, '02')) + nFH+=1 + else: + print('Increment file: '+CalcAnlDir+'/siginc.nc.'+format(fh, '02')+' does not exist. Skipping.') - ####### determine how many forecast hours to process - nFH=0 - for fh in IAUHH: - # first check to see if increment file exists - CalcAnlDir = RunDir+'/calcanl_'+format(fh, '02') - if (os.path.isfile(CalcAnlDir+'/siginc.nc.'+format(fh, '02'))): - print('will process increment file: '+CalcAnlDir+'/siginc.nc.'+format(fh, '02')) - nFH+=1 - else: - print('Increment file: '+CalcAnlDir+'/siginc.nc.'+format(fh, '02')+' does not exist. Skipping.') - - sys.stdout.flush() - ######## need to gather information about runtime environment - ExecCMD = ExecCMD.replace("$ncmd","1") - os.environ['OMP_NUM_THREADS'] = str(NThreads) - os.environ['ncmd'] = str(nFH) - ExecCMDMPI1 = ExecCMDMPI.replace("$ncmd",str(1)) - ExecCMDMPI = ExecCMDMPI.replace("$ncmd",str(nFH)) - ExecCMDLevs = ExecCMDMPI.replace("$ncmd",str(levs)) - ExecCMDMPI10 = ExecCMDMPI.replace("$ncmd",str(10)) + sys.stdout.flush() + ######## need to gather information about runtime environment + ExecCMD = ExecCMD.replace("$ncmd","1") + os.environ['OMP_NUM_THREADS'] = str(NThreads) + os.environ['ncmd'] = str(nFH) + ExecCMDMPI1 = ExecCMDMPI.replace("$ncmd",str(1)) + ExecCMDMPI = ExecCMDMPI.replace("$ncmd",str(nFH)) + ExecCMDLevs = ExecCMDMPI.replace("$ncmd",str(levs)) + ExecCMDMPI10 = ExecCMDMPI.replace("$ncmd",str(10)) - # are we using mpirun with lsf, srun, or aprun with Cray? - launcher = ExecCMDMPI.split(' ')[0] - if launcher == 'mpirun': - hostfile = os.getenv('LSB_DJOB_HOSTFILE','') - with open(hostfile) as f: - hosts_tmp = f.readlines() - hosts_tmp = [x.strip() for x in hosts_tmp] - hosts = [] - [hosts.append(x) for x in hosts_tmp if x not in hosts] - nhosts = len(hosts) - ExecCMDMPI_host = 'mpirun -np '+str(nFH)+' --hostfile hosts' - tasks = int(os.getenv('LSB_DJOB_NUMPROC',1)) - if levs > tasks: - ExecCMDMPILevs_host = 'mpirun -np '+str(tasks)+' --hostfile hosts' - ExecCMDMPILevs_nohost = 'mpirun -np '+str(tasks) - else: - ExecCMDMPILevs_host = 'mpirun -np '+str(levs)+' --hostfile hosts' - ExecCMDMPILevs_nohost = 'mpirun -np '+str(levs) - ExecCMDMPI1_host = 'mpirun -np 1 --hostfile hosts' - ExecCMDMPI10_host = 'mpirun -np 10 --hostfile hosts' - elif launcher == 'srun': - nodes = os.getenv('SLURM_JOB_NODELIST','') - hosts_tmp = subprocess.check_output('scontrol show hostnames '+nodes, shell=True) - if (sys.version_info > (3, 0)): - hosts_tmp = hosts_tmp.decode('utf-8') - hosts_tmp = str(hosts_tmp).splitlines() + # are we using mpirun with lsf, srun, or aprun with Cray? + launcher = ExecCMDMPI.split(' ')[0] + if launcher == 'mpirun': + hostfile = os.getenv('LSB_DJOB_HOSTFILE','') + with open(hostfile) as f: + hosts_tmp = f.readlines() hosts_tmp = [x.strip() for x in hosts_tmp] - else: - hosts_tmp = hosts_tmp.strip() - hosts_tmp = str(hosts_tmp).splitlines() + hosts = [] + [hosts.append(x) for x in hosts_tmp if x not in hosts] + nhosts = len(hosts) + ExecCMDMPI_host = 'mpirun -np '+str(nFH)+' --hostfile hosts' + tasks = int(os.getenv('LSB_DJOB_NUMPROC',1)) + if levs > tasks: + ExecCMDMPILevs_host = 'mpirun -np '+str(tasks)+' --hostfile hosts' + ExecCMDMPILevs_nohost = 'mpirun -np '+str(tasks) + else: + ExecCMDMPILevs_host = 'mpirun -np '+str(levs)+' --hostfile hosts' + ExecCMDMPILevs_nohost = 'mpirun -np '+str(levs) + ExecCMDMPI1_host = 'mpirun -np 1 --hostfile hosts' + ExecCMDMPI10_host = 'mpirun -np 10 --hostfile hosts' + elif launcher == 'srun': + nodes = os.getenv('SLURM_JOB_NODELIST','') + hosts_tmp = subprocess.check_output('scontrol show hostnames '+nodes, shell=True) + if (sys.version_info > (3, 0)): + hosts_tmp = hosts_tmp.decode('utf-8') + hosts_tmp = str(hosts_tmp).splitlines() + hosts_tmp = [x.strip() for x in hosts_tmp] + else: + hosts_tmp = hosts_tmp.strip() + hosts_tmp = str(hosts_tmp).splitlines() + hosts_tmp = [x.strip() for x in hosts_tmp] + hosts = [] + [hosts.append(x) for x in hosts_tmp if x not in hosts] + nhosts = len(hosts) + ExecCMDMPI_host = 'srun -n '+str(nFH)+' --verbose --export=ALL -c 1 --distribution=arbitrary --cpu-bind=cores' + # need to account for when fewer than LEVS tasks are available + tasks = int(os.getenv('SLURM_NPROCS',1)) + if levs > tasks: + ExecCMDMPILevs_host = 'srun -n '+str(tasks)+' --verbose --export=ALL -c 1 --distribution=arbitrary --cpu-bind=cores' + ExecCMDMPILevs_nohost = 'srun -n '+str(tasks)+' --verbose --export=ALL' + else: + ExecCMDMPILevs_host = 'srun -n '+str(levs)+' --verbose --export=ALL -c 1 --distribution=arbitrary --cpu-bind=cores' + ExecCMDMPILevs_nohost = 'srun -n '+str(levs)+' --verbose --export=ALL' + ExecCMDMPI1_host = 'srun -n 1 --verbose --export=ALL -c 1 --distribution=arbitrary --cpu-bind=cores' + ExecCMDMPI10_host = 'srun -n 10 --verbose --export=ALL -c 1 --distribution=arbitrary --cpu-bind=cores' + elif launcher == 'aprun': + hostfile = os.getenv('LSB_DJOB_HOSTFILE','') + with open(hostfile) as f: + hosts_tmp = f.readlines() hosts_tmp = [x.strip() for x in hosts_tmp] - hosts = [] - [hosts.append(x) for x in hosts_tmp if x not in hosts] - nhosts = len(hosts) - ExecCMDMPI_host = 'srun -n '+str(nFH)+' --verbose --export=ALL -c 1 --distribution=arbitrary --cpu-bind=cores' - # need to account for when fewer than LEVS tasks are available - tasks = int(os.getenv('SLURM_NPROCS',1)) - if levs > tasks: - ExecCMDMPILevs_host = 'srun -n '+str(tasks)+' --verbose --export=ALL -c 1 --distribution=arbitrary --cpu-bind=cores' - ExecCMDMPILevs_nohost = 'srun -n '+str(tasks)+' --verbose --export=ALL' + hosts = [] + [hosts.append(x) for x in hosts_tmp if x not in hosts] + nhosts = len(hosts) + ExecCMDMPI_host = 'aprun -l hosts -d '+str(NThreads)+' -n '+str(nFH) + ExecCMDMPILevs_host = 'aprun -l hosts -d '+str(NThreads)+' -n '+str(levs) + ExecCMDMPILevs_nohost = 'aprun -d '+str(NThreads)+' -n '+str(levs) + ExecCMDMPI1_host = 'aprun -l hosts -d '+str(NThreads)+' -n 1' + ExecCMDMPI10_host = 'aprun -l hosts -d '+str(NThreads)+' -n 10' else: - ExecCMDMPILevs_host = 'srun -n '+str(levs)+' --verbose --export=ALL -c 1 --distribution=arbitrary --cpu-bind=cores' - ExecCMDMPILevs_nohost = 'srun -n '+str(levs)+' --verbose --export=ALL' - ExecCMDMPI1_host = 'srun -n 1 --verbose --export=ALL -c 1 --distribution=arbitrary --cpu-bind=cores' - ExecCMDMPI10_host = 'srun -n 10 --verbose --export=ALL -c 1 --distribution=arbitrary --cpu-bind=cores' - elif launcher == 'aprun': - hostfile = os.getenv('LSB_DJOB_HOSTFILE','') - with open(hostfile) as f: - hosts_tmp = f.readlines() - hosts_tmp = [x.strip() for x in hosts_tmp] - hosts = [] - [hosts.append(x) for x in hosts_tmp if x not in hosts] - nhosts = len(hosts) - ExecCMDMPI_host = 'aprun -l hosts -d '+str(NThreads)+' -n '+str(nFH) - ExecCMDMPILevs_host = 'aprun -l hosts -d '+str(NThreads)+' -n '+str(levs) - ExecCMDMPILevs_nohost = 'aprun -d '+str(NThreads)+' -n '+str(levs) - ExecCMDMPI1_host = 'aprun -l hosts -d '+str(NThreads)+' -n 1' - ExecCMDMPI10_host = 'aprun -l hosts -d '+str(NThreads)+' -n 10' - else: - print('unknown MPI launcher. Failure.') - sys.exit(1) - - ####### generate the full resolution analysis - interp_jobs = [] - ihost = 0 - ### interpolate increment to full background resolution - for fh in IAUHH: - # first check to see if increment file exists - CalcAnlDir = RunDir+'/calcanl_'+format(fh, '02') - if (os.path.isfile(CalcAnlDir+'/siginc.nc.'+format(fh, '02'))): - # set up the namelist - namelist = OrderedDict() - namelist["setup"] = {"lon_out": LonB, - "lat_out": LatB, - "lev": levs, - "infile": "'siginc.nc."+format(fh, '02')+"'", - "outfile": "'inc.fullres."+format(fh, '02')+"'", - } - gsi_utils.write_nml(namelist, CalcAnlDir+'/fort.43') - - if ihost >= nhosts: - ihost = 0 - with open(CalcAnlDir+'/hosts', 'w') as hostfile: - hostfile.write(hosts[ihost]+'\n') - if launcher == 'srun': # need to write host per task not per node for slurm - for a in range(0,9): # need 9 more of the same host for the 10 tasks for chgres_inc - hostfile.write(hosts[ihost]+'\n') - if launcher == 'srun': - os.environ['SLURM_HOSTFILE'] = CalcAnlDir+'/hosts' - print('interp_inc', fh, namelist) - job = subprocess.Popen(ExecCMDMPI10_host+' '+CalcAnlDir+'/chgres_inc.x', shell=True, cwd=CalcAnlDir) - interp_jobs.append(job) - print(ExecCMDMPI10_host+' '+CalcAnlDir+'/chgres_inc.x submitted on '+hosts[ihost]) - ihost+=1 - - sys.stdout.flush() - exit_codes = [p.wait() for p in interp_jobs] - for ec in exit_codes: - if ec != 0: - print('Error with chgres_inc.x, exit code='+str(ec)) - print(locals()) - sys.exit(ec) + print('unknown MPI launcher. Failure.') + sys.exit(1) - #### generate analysis from interpolated increment - CalcAnlDir6 = RunDir+'/calcanl_'+format(6, '02') - # set up the namelist - namelist = OrderedDict() - namelist["setup"] = {"datapath": "'./'", - "analysis_filename": "'anl'", - "firstguess_filename": "'ges'", - "increment_filename": "'inc.fullres'", - "fhr": 6, - } - - gsi_utils.write_nml(namelist, CalcAnlDir6+'/calc_analysis.nml') - - # run the executable - if ihost >= nhosts-1: + ####### generate the full resolution analysis + interp_jobs = [] ihost = 0 - if launcher == 'srun': - del os.environ['SLURM_HOSTFILE'] - print('fullres_calc_anl', namelist) - fullres_anl_job = subprocess.Popen(ExecCMDMPILevs_nohost+' '+CalcAnlDir6+'/calc_anl.x', shell=True, cwd=CalcAnlDir6) - print(ExecCMDMPILevs_nohost+' '+CalcAnlDir6+'/calc_anl.x submitted') - - sys.stdout.flush() - exit_fullres = fullres_anl_job.wait() - sys.stdout.flush() - if exit_fullres != 0: - print('Error with calc_analysis.x for deterministic resolution, exit code='+str(exit_fullres)) - print(locals()) - sys.exit(exit_fullres) - - - ######## run chgres to get background on ensemble resolution - if Cdump == "gdas": - chgres_jobs = [] + ### interpolate increment to full background resolution for fh in IAUHH: - # first check to see if guess file exists - CalcAnlDir = RunDir+'/calcanl_ensres_'+format(fh, '02') - if (os.path.isfile(CalcAnlDir+'/ges.'+format(fh, '02'))): - # set up the namelist - namelist = OrderedDict() - namelist["chgres_setup"] = {"i_output": str(LonA), - "j_output": str(LatA), - "input_file": "'ges."+format(fh, '02')+"'", - "output_file": "'ges.ensres."+format(fh, '02')+"'", - "terrain_file": "'"+atmges_ens_mean+"'", - "vcoord_file": "'"+siglevel+"'", - } - - gsi_utils.write_nml(namelist, CalcAnlDir+'/chgres_nc_gauss.nml') - - # run the executable - if ihost >= nhosts-1: - ihost = 0 - with open(CalcAnlDir+'/hosts', 'w') as hostfile: - hostfile.write(hosts[ihost]+'\n') - if launcher == 'srun': - os.environ['SLURM_HOSTFILE'] = CalcAnlDir+'/hosts' - print('chgres_nc_gauss', fh, namelist) - job = subprocess.Popen(ExecCMDMPI1_host+' '+CalcAnlDir+'/chgres_ges.x', shell=True, cwd=CalcAnlDir) - chgres_jobs.append(job) - print(ExecCMDMPI1_host+' '+CalcAnlDir+'/chgres_ges.x submitted on '+hosts[ihost]) - ihost+=1 + # first check to see if increment file exists + CalcAnlDir = RunDir+'/calcanl_'+format(fh, '02') + if (os.path.isfile(CalcAnlDir+'/siginc.nc.'+format(fh, '02'))): + print('Interpolating increment for f'+format(fh, '03')) + # set up the namelist + namelist = OrderedDict() + namelist["setup"] = {"lon_out": LonB, + "lat_out": LatB, + "lev": levs, + "infile": "'siginc.nc."+format(fh, '02')+"'", + "outfile": "'inc.fullres."+format(fh, '02')+"'", + } + gsi_utils.write_nml(namelist, CalcAnlDir+'/fort.43') + if ihost >= nhosts: + ihost = 0 + with open(CalcAnlDir+'/hosts', 'w') as hostfile: + hostfile.write(hosts[ihost]+'\n') + if launcher == 'srun': # need to write host per task not per node for slurm + for a in range(0,9): # need 9 more of the same host for the 10 tasks for chgres_inc + hostfile.write(hosts[ihost]+'\n') + if launcher == 'srun': + os.environ['SLURM_HOSTFILE'] = CalcAnlDir+'/hosts' + print('interp_inc', fh, namelist) + job = subprocess.Popen(ExecCMDMPI10_host+' '+CalcAnlDir+'/chgres_inc.x', shell=True, cwd=CalcAnlDir) + interp_jobs.append(job) + print(ExecCMDMPI10_host+' '+CalcAnlDir+'/chgres_inc.x submitted on '+hosts[ihost]) + ihost+=1 + else: + print('f'+format(fh, '03')+' is in $IAUFHRS but increment file is missing. Skipping.') sys.stdout.flush() - exit_codes = [p.wait() for p in chgres_jobs] + exit_codes = [p.wait() for p in interp_jobs] for ec in exit_codes: - if ec != 0: - print('Error with chgres_ges.x, exit code='+str(ec)) - print(locals()) - sys.exit(ec) + if ec != 0: + print('Error with chgres_inc.x, exit code='+str(ec)) + print(locals()) + sys.exit(ec) - sys.stdout.flush() - ######## generate ensres analysis from interpolated background - if launcher == 'srun': - del os.environ['SLURM_HOSTFILE'] - for fh in IAUHH: - CalcAnlDir6 = RunDir+'/calcanl_ensres_'+format(6, '02') - # set up the namelist - namelist = OrderedDict() - namelist["setup"] = {"datapath": "'./'", - "analysis_filename": "'anl.ensres'", - "firstguess_filename": "'ges.ensres'", - "increment_filename": "'siginc.nc'", - "fhr": fh, + #### generate analysis from interpolated increment + CalcAnlDir6 = RunDir+'/calcanl_'+format(6, '02') + # set up the namelist + namelist = OrderedDict() + namelist["setup"] = {"datapath": "'./'", + "analysis_filename": "'anl'", + "firstguess_filename": "'ges'", + "increment_filename": "'inc.fullres'", + "fhr": 6, } - - gsi_utils.write_nml(namelist, CalcAnlDir6+'/calc_analysis.nml') + gsi_utils.write_nml(namelist, CalcAnlDir6+'/calc_analysis.nml') - # run the executable - if ihost > nhosts-1: + # run the executable + if ihost >= nhosts-1: ihost = 0 - print('ensres_calc_anl', namelist) - ensres_anl_job = subprocess.Popen(ExecCMDMPILevs_nohost+' '+CalcAnlDir6+'/calc_anl.x', shell=True, cwd=CalcAnlDir6) - print(ExecCMDMPILevs_nohost+' '+CalcAnlDir6+'/calc_anl.x submitted') + if launcher == 'srun': + del os.environ['SLURM_HOSTFILE'] + print('fullres_calc_anl', namelist) + fullres_anl_job = subprocess.Popen(ExecCMDMPILevs_nohost+' '+CalcAnlDir6+'/calc_anl.x', shell=True, cwd=CalcAnlDir6) + print(ExecCMDMPILevs_nohost+' '+CalcAnlDir6+'/calc_anl.x submitted') - sys.stdout.flush() - ####### check on analysis steps - exit_ensres = ensres_anl_job.wait() - if exit_ensres != 0: - print('Error with calc_analysis.x for ensemble resolution, exit code='+str(exit_ensres)) + sys.stdout.flush() + exit_fullres = fullres_anl_job.wait() + sys.stdout.flush() + if exit_fullres != 0: + print('Error with calc_analysis.x for deterministic resolution, exit code='+str(exit_fullres)) print(locals()) - sys.exit(exit_ensres) + sys.exit(exit_fullres) + + + ######## compute determinstic analysis on ensemble resolution + if Cdump == "gdas": + chgres_jobs = [] + for fh in IAUHH: + # first check to see if guess file exists + CalcAnlDir6 = RunDir+'/calcanl_ensres_06' + print(CalcAnlDir6+'/ges.ensres.'+format(fh, '02')) + if (os.path.isfile(CalcAnlDir6+'/ges.ensres.'+format(fh, '02'))): + print('Calculating analysis on ensemble resolution for f'+format(fh, '03')) + ######## generate ensres analysis from interpolated background + # set up the namelist + namelist = OrderedDict() + namelist["setup"] = {"datapath": "'./'", + "analysis_filename": "'anl.ensres'", + "firstguess_filename": "'ges.ensres'", + "increment_filename": "'siginc.nc'", + "fhr": fh, + } - print('calcanl_gfs successfully completed at: ',datetime.datetime.utcnow()) - print(locals()) + gsi_utils.write_nml(namelist, CalcAnlDir6+'/calc_analysis.nml') + + # run the executable + if ihost > nhosts-1: + ihost = 0 + print('ensres_calc_anl', namelist) + ensres_anl_job = subprocess.Popen(ExecCMDMPILevs_nohost+' '+CalcAnlDir6+'/calc_anl.x', shell=True, cwd=CalcAnlDir6) + print(ExecCMDMPILevs_nohost+' '+CalcAnlDir6+'/calc_anl.x submitted') + + sys.stdout.flush() + ####### check on analysis steps + exit_ensres = ensres_anl_job.wait() + if exit_ensres != 0: + print('Error with calc_analysis.x for ensemble resolution, exit code='+str(exit_ensres)) + print(locals()) + sys.exit(exit_ensres) + else: + print('f'+format(fh, '03')+' is in $IAUFHRS but ensemble resolution guess file is missing. Skipping.') + + print('calcanl_gfs successfully completed at: ',datetime.datetime.utcnow()) + print(locals()) # run the function if this script is called from the command line if __name__ == '__main__': - DoIAU = gsi_utils.isTrue(os.getenv('DOIAU', 'NO')) - l4DEnsVar = gsi_utils.isTrue(os.getenv('l4densvar', 'NO')) - Write4Danl = gsi_utils.isTrue(os.getenv('lwrite4danl', 'NO')) - ComOut = os.getenv('COMOUT', './') - APrefix = os.getenv('APREFIX', '') - ASuffix= os.getenv('ASUFFIX', '') - NThreads = os.getenv('NTHREADS_CHGRES', 1) - FixDir = os.getenv('FIXgsm', './') - atmges_ens_mean = os.getenv('ATMGES_ENSMEAN', './atmges_ensmean') - RunDir = os.getenv('DATA', './') - ExecCMD = os.getenv('APRUN_CALCANL', '') - ExecCMDMPI = os.getenv('APRUN_CALCINC', '') - ExecAnl = os.getenv('CALCANLEXEC', './calc_analysis.x') - ExecChgresGes = os.getenv('CHGRESNCEXEC', './chgres_nc_gauss.exe') - ExecChgresInc = os.getenv('CHGRESINCEXEC', './chgres_increment.exe') - NEMSGet = os.getenv('NEMSIOGET','nemsio_get') - IAUHrs = list(map(int,os.getenv('IAUFHRS','6').split(','))) - Cdump = os.getenv('CDUMP', 'gdas') + DoIAU = gsi_utils.isTrue(os.getenv('DOIAU', 'NO')) + l4DEnsVar = gsi_utils.isTrue(os.getenv('l4densvar', 'NO')) + Write4Danl = gsi_utils.isTrue(os.getenv('lwrite4danl', 'NO')) + ComIn_Ges = os.getenv('COMIN_GES', './') + GPrefix = os.getenv('GPREFIX', './') + GSuffix = os.getenv('GSUFFIX', './') + ComOut = os.getenv('COMOUT', './') + APrefix = os.getenv('APREFIX', '') + ASuffix= os.getenv('ASUFFIX', '') + NThreads = os.getenv('NTHREADS_CHGRES', 1) + FixDir = os.getenv('FIXgsm', './') + atmges_ens_mean = os.getenv('ATMGES_ENSMEAN', './atmges_ensmean') + RunDir = os.getenv('DATA', './') + ExecCMD = os.getenv('APRUN_CALCANL', '') + ExecCMDMPI = os.getenv('APRUN_CALCINC', '') + ExecAnl = os.getenv('CALCANLEXEC', './calc_analysis.x') + ExecChgresInc = os.getenv('CHGRESINCEXEC', './interp_inc.x') + NEMSGet = os.getenv('NEMSIOGET','nemsio_get') + IAUHrs = list(map(int,os.getenv('IAUFHRS','6').split(','))) + Cdump = os.getenv('CDUMP', 'gdas') - print(locals()) - calcanl_gfs(DoIAU, l4DEnsVar, Write4Danl, ComOut, APrefix, ASuffix, - FixDir, atmges_ens_mean, RunDir, NThreads, NEMSGet, IAUHrs, - ExecCMD, ExecCMDMPI, ExecAnl, ExecChgresGes, ExecChgresInc, - Cdump) + print(locals()) + calcanl_gfs(DoIAU, l4DEnsVar, Write4Danl, ComOut, APrefix, ASuffix, + ComIn_Ges, GPrefix, GSuffix, + FixDir, atmges_ens_mean, RunDir, NThreads, NEMSGet, IAUHrs, + ExecCMD, ExecCMDMPI, ExecAnl, ExecChgresInc, + Cdump) diff --git a/ush/gsi_utils.py b/ush/gsi_utils.py index 4916f1ed5c..79c6e627e0 100644 --- a/ush/gsi_utils.py +++ b/ush/gsi_utils.py @@ -1,123 +1,138 @@ ### gsi_utils.py ### a collection of functions, classes, etc. -### used for the GSI global analysis +### used for the GSI global analysis def isTrue(str_in): - """ isTrue(str_in) - - function to translate shell variables to python logical variables + """ isTrue(str_in) + - function to translate shell variables to python logical variables - input: str_in - string (should be like 'YES', 'TRUE', etc.) - returns: status (logical True or False) + input: str_in - string (should be like 'YES', 'TRUE', etc.) + returns: status (logical True or False) - """ - str_in = str_in.upper() - if str_in in ['YES','.TRUE.']: - status = True - else: - status = False - return status + """ + str_in = str_in.upper() + if str_in in ['YES','.TRUE.']: + status = True + else: + status = False + return status def link_file(from_file, to_file): - """ link_file(from_file, to_file) - - function to check if a path exists, and if not, make a symlink - input: from_file - string path - to_file - string path - """ - import os - if not os.path.exists(to_file): - if not os.path.islink(to_file): - os.symlink(from_file, to_file) + """ link_file(from_file, to_file) + - function to check if a path exists, and if not, make a symlink + input: from_file - string path + to_file - string path + """ + import os + if not os.path.exists(to_file): + if not os.path.islink(to_file): + os.symlink(from_file, to_file) + else: + print(to_file+" exists, unlinking.") + os.unlink(to_file) + os.symlink(from_file, to_file) + print("ln -s "+from_file+" "+to_file) + +def copy_file(from_file, to_file): + import shutil + shutil.copy(from_file, to_file) + print("cp "+from_file+" "+to_file) + +def make_dir(directory): + import os + os.makedirs(directory) + print("mkdir -p "+directory) def write_nml(nml_dict, nml_file): - """ write_nml(nml_dict, nml_file) - - function to write out namelist dictionary nml_dict to file nml_file - input: nml_dict - dictionary of dictionaries - first dictionary is &nml, second is nmlvar='value' - NOTE: this shoudl be an OrderedDict or else it might fail - nml_file - string path to write namelist file to - """ - nfile = open(nml_file, 'w') + """ write_nml(nml_dict, nml_file) + - function to write out namelist dictionary nml_dict to file nml_file + input: nml_dict - dictionary of dictionaries + first dictionary is &nml, second is nmlvar='value' + NOTE: this shoudl be an OrderedDict or else it might fail + nml_file - string path to write namelist file to + """ + nfile = open(nml_file, 'w') - for nml, nmlvars in nml_dict.items(): - nfile.write('&'+nml+'\n') - for var, val in nmlvars.items(): - nfile.write(' '+str(var)+' = '+str(val)+'\n') - nfile.write('/\n\n') - nfile.close() + for nml, nmlvars in nml_dict.items(): + nfile.write('&'+nml+'\n') + for var, val in nmlvars.items(): + nfile.write(' '+str(var)+' = '+str(val)+'\n') + nfile.write('/\n\n') + nfile.close() def get_ncdims(ncfile): - """ get_ncdims(ncfile) - - function to return dictionary of netCDF file dimensions and their lengths - input: ncfile - string to path to netCDF file - output: ncdims - dictionary where key is the name of a dimension and the - value is the length of that dimension + """ get_ncdims(ncfile) + - function to return dictionary of netCDF file dimensions and their lengths + input: ncfile - string to path to netCDF file + output: ncdims - dictionary where key is the name of a dimension and the + value is the length of that dimension + + ex: ncdims['pfull'] = 127 + """ + try: + import netCDF4 as nc + except ImportError: + print("Python Error!") + print("netCDF4 Python module not available. Do you have the proper Python available in your environment?") + print("Hera: module use -a /contrib/modulefiles && module load anaconda/2.3.0") + print("Dell: module load python/3.6.3") + print(" ") + ncf = nc.Dataset(ncfile) + ncdims = {} + for d in ncf.dimensions.keys(): + ncdims[d] = int(len(ncf.dimensions[d])) + ncf.close() - ex: ncdims['pfull'] = 127 - """ - try: - import netCDF4 as nc - except ImportError: - print("Python Error!") - print("netCDF4 Python module not available. Do you have the proper Python available in your environment?") - print("Hera: module use -a /contrib/modulefiles && module load anaconda/2.3.0") - print("Dell: module load python/3.6.3") - print(" ") - ncf = nc.Dataset(ncfile) - ncdims = {} - for d in ncf.dimensions.keys(): - ncdims[d] = int(len(ncf.dimensions[d])) - ncf.close() - - return ncdims + return ncdims def get_nemsdims(nemsfile,nemsexe): - """ get_nemsdims(nemsfile,nemsexe) - - function to return dictionary of NEMSIO file dimensions for use - input: nemsfile - string to path nemsio file - nemsexe - string to path nemsio_get executable - output: nemsdims - dictionary where key is the name of a dimension and the - value is the length of that dimension - ex: nemsdims['pfull'] = 127 - """ - import subprocess - ncdims = { - 'dimx': 'grid_xt', - 'dimy': 'grid_yt', - 'dimz': 'pfull', - } - nemsdims = {} - for dim in ['dimx','dimy','dimz']: - out = subprocess.Popen([nemsexe,nemsfile,dim],stdout=subprocess.PIPE,stderr=subprocess.STDOUT) - stdout, stderr = out.communicate() - nemsdims[ncdims[dim]] = int(stdout.split(' ')[-1].rstrip()) - return nemsdims + """ get_nemsdims(nemsfile,nemsexe) + - function to return dictionary of NEMSIO file dimensions for use + input: nemsfile - string to path nemsio file + nemsexe - string to path nemsio_get executable + output: nemsdims - dictionary where key is the name of a dimension and the + value is the length of that dimension + ex: nemsdims['pfull'] = 127 + """ + import subprocess + ncdims = { + 'dimx': 'grid_xt', + 'dimy': 'grid_yt', + 'dimz': 'pfull', + } + nemsdims = {} + for dim in ['dimx','dimy','dimz']: + out = subprocess.Popen([nemsexe,nemsfile,dim],stdout=subprocess.PIPE,stderr=subprocess.STDOUT) + stdout, stderr = out.communicate() + nemsdims[ncdims[dim]] = int(stdout.split(' ')[-1].rstrip()) + return nemsdims def get_timeinfo(ncfile): - """ get_timeinfo(ncfile) - - function to return datetime objects of initialized time and valid time - input: ncfile - string to path to netCDF file - returns: inittime, validtime - datetime objects - nfhour - integer forecast hour - """ - try: - import netCDF4 as nc - except ImportError: - print("Python Error!") - print("netCDF4 Python module not available. Do you have the proper Python available in your environment?") - print("Hera: module use -a /contrib/modulefiles && module load anaconda/2.3.0") - print("Dell: module load python/3.6.3") - print(" ") - import datetime as dt - import re - ncf = nc.Dataset(ncfile) - time_units = ncf['time'].units - date_str = time_units.split('since ')[1] - date_str = re.sub("[^0-9]", "", date_str) - initstr = date_str[0:10] - inittime = dt.datetime.strptime(initstr,"%Y%m%d%H") - nfhour = int(ncf['time'][0]) - validtime = inittime + dt.timedelta(hours=nfhour) - ncf.close() + """ get_timeinfo(ncfile) + - function to return datetime objects of initialized time and valid time + input: ncfile - string to path to netCDF file + returns: inittime, validtime - datetime objects + nfhour - integer forecast hour + """ + try: + import netCDF4 as nc + except ImportError: + print("Python Error!") + print("netCDF4 Python module not available. Do you have the proper Python available in your environment?") + print("Hera: module use -a /contrib/modulefiles && module load anaconda/2.3.0") + print("Dell: module load python/3.6.3") + print(" ") + import datetime as dt + import re + ncf = nc.Dataset(ncfile) + time_units = ncf['time'].units + date_str = time_units.split('since ')[1] + date_str = re.sub("[^0-9]", "", date_str) + initstr = date_str[0:10] + inittime = dt.datetime.strptime(initstr,"%Y%m%d%H") + nfhour = int(ncf['time'][0]) + validtime = inittime + dt.timedelta(hours=nfhour) + ncf.close() - return inittime, validtime, nfhour + return inittime, validtime, nfhour diff --git a/ush/refactor_4nco_global.sh b/ush/refactor_4nco_global.sh index e57e2eb237..90bf44dc8d 100644 --- a/ush/refactor_4nco_global.sh +++ b/ush/refactor_4nco_global.sh @@ -78,11 +78,11 @@ done # Create and populate gdas scripts $svnmkdirp $target_gdas/scripts -flist="exglobal_enkf_innovate_obs.sh.ecf" +flist="exglobal_enkf_innovate_obs.sh" for file in $flist; do $svncopy $source_path/scripts/$file $target_gdas/scripts/ done -flist="exglobal_enkf_fcst.sh.ecf exglobal_enkf_inflate_recenter.sh.ecf exglobal_enkf_post.sh.ecf exglobal_enkf_update.sh.ecf" +flist="exglobal_enkf_fcst.sh exglobal_enkf_inflate_recenter.sh exglobal_enkf_post.sh exglobal_enkf_update.sh" for file in $flist; do $svncopy $source_path/scripts/EnKF/scripts_ncep/$file $target_gdas/scripts/ done @@ -138,7 +138,7 @@ done # Create and populate global_shared scripts $svnmkdirp $target_shared/scripts -flist="exglobal_analysis.sh.ecf" +flist="exglobal_analysis.sh" for file in $flist; do $svncopy $source_path/scripts/$file $target_shared/scripts/ done diff --git a/util/AeroDA/calc_increment_ens.fd/CMakeLists.txt b/util/AeroDA/calc_increment_ens.fd/CMakeLists.txt index 7a11c1fd16..c01e2529a7 100644 --- a/util/AeroDA/calc_increment_ens.fd/CMakeLists.txt +++ b/util/AeroDA/calc_increment_ens.fd/CMakeLists.txt @@ -9,6 +9,6 @@ if(BUILD_UTIL_COM) set_target_properties( calc_increment_ens_aero.x PROPERTIES COMPILE_FLAGS ${UTIL_Fortran_FLAGS} ) set_target_properties( calc_increment_ens_aero.x PROPERTIES Fortran_MODULE_DIRECTORY ${Util_MODULE_DIRECTORY} ) SET( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_Fortran_FLAGS}" ) - include_directories( ${UTIL_INC} ${NEMSIOINC} ${NETCDF_INCLUDES} ${MPI_Fortran_INCLUDE_PATH} ) - target_link_libraries( calc_increment_ens_aero.x ${NEMSIO_LIBRARY} ${BACIO_LIBRARY} ${W3NCO_4_LIBRARY} ${NETCDF_LIBRARIES_F90} ${NETCDF_LIBRARIES} ${MPI_Fortran_LIBRARIES} ${HDF5_Fortran_HL_LIBRARIES} ${HDF5_LIBRARIES} ${ZLIB_LIBRARIES} ${CURL_LIBRARIES} ) + include_directories( ${UTIL_INC} ${NEMSIOINC} ${NETCDF_INCLUDE_DIRS} ${MPI_Fortran_INCLUDE_PATH} ) + target_link_libraries( calc_increment_ens_aero.x ${NEMSIO_LIBRARY} ${BACIO_LIBRARY} ${W3NCO_4_LIBRARY} ${NETCDF_Fortran_LIBRARIES} ${NETCDF_C_LIBRARIES} ${MPI_Fortran_LIBRARIES}) endif() diff --git a/util/Conventional_Monitor/CMakeLists.txt b/util/Conventional_Monitor/CMakeLists.txt new file mode 100644 index 0000000000..d4392dc80e --- /dev/null +++ b/util/Conventional_Monitor/CMakeLists.txt @@ -0,0 +1,105 @@ +cmake_minimum_required(VERSION 2.8) +if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) + # I am top-level project. + if( NOT DEFINED ENV{CC} ) + find_path( crayComp "ftn" ) + find_path( wcossIntel "mpfort" ) + find_path( intelComp "ifort" ) + find_path( pgiComp "pgf90" ) + if( crayComp ) + message("Setting CrayLinuxEnvironment") + set(CMAKE_SYSTEM_NAME "CrayLinuxEnvironment") + set(CMAKE_C_COMPILER "${crayComp}/cc") + set(CMAKE_CXX_COMPILER "${crayComp}/CC") + set(CMAKE_Fortran_COMPILER "${crayComp}/ftn") + endif() + if( intelComp ) + set(ENV{CC} "icc") + set(ENV{CXX} "icpc") + set(ENV{FC} "ifort") + endif() + if( wcossIntel ) + message("Setting env for wcoss intel") + set(ENV{CC} "mpcc") + set(ENV{CXX} "mpCC") + set(ENV{FC} "mpfort") + endif() + if( pgiComp ) + set(ENV{CC} "pgcc") + set(ENV{CXX} "pgCC") + set(ENV{FC} "pgf90") + endif() + endif() + project(COV_Calc) + enable_language (Fortran) + set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/../../cmake/Modules/") + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib") + include(${CMAKE_SOURCE_DIR}/../../cmake/Modules/setPlatformVariables.cmake) + include(${CMAKE_SOURCE_DIR}/../../cmake/Modules/setIntelFlags.cmake) + include(${CMAKE_SOURCE_DIR}/../../cmake/Modules/setGNUFlags.cmake) + include(${CMAKE_SOURCE_DIR}/../../cmake/Modules/setPGIFlags.cmake) + include(${CMAKE_SOURCE_DIR}/../../cmake/Modules/setHOST.cmake) + include(${CMAKE_SOURCE_DIR}/../../cmake/Modules/platforms/Cheyenne.cmake) + include(${CMAKE_SOURCE_DIR}/../../cmake/Modules/platforms/Discover.cmake) + include(${CMAKE_SOURCE_DIR}/../../cmake/Modules/platforms/Generic.cmake) + include(${CMAKE_SOURCE_DIR}/../../cmake/Modules/platforms/Gaea.cmake) + include(${CMAKE_SOURCE_DIR}/../../cmake/Modules/platforms/Jet.cmake) + include(${CMAKE_SOURCE_DIR}/../../cmake/Modules/platforms/S4.cmake) + include(${CMAKE_SOURCE_DIR}/../../cmake/Modules/platforms/Hera.cmake) + include(${CMAKE_SOURCE_DIR}/../../cmake/Modules/platforms/WCOSS-C.cmake) + include(${CMAKE_SOURCE_DIR}/../../cmake/Modules/platforms/WCOSS-D.cmake) + include(${CMAKE_SOURCE_DIR}/../../cmake/Modules/platforms/WCOSS.cmake) + if (NOT CMAKE_BUILD_TYPE) + set (CMAKE_BUILD_TYPE RELEASE CACHE STRING + "Choose the type of build, options are: PRODUCTION Debug Release." + FORCE) + endif (NOT CMAKE_BUILD_TYPE) + if (CMAKE_CXX_COMPILER_ID MATCHES "GNU*") + message("Setting GNU flags") + setGNU() + elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel") + message("Setting Intel flags") + setIntel() + elseif(CMAKE_C_COMPILER MATCHES "pgc*") + message("Setting PGI flags") + setPGI() + endif() + + cmake_policy(SET CMP0009 NEW) + cmake_policy(SET CMP0054 NEW) + find_package(OpenMP) + message("found openmp with flag ${OPENMP_Fortran_FLAGS}") + +# Set Host specific flags and options + setHOST() + + find_package( NetCDF COMPONENTS C Fortran REQUIRED) + find_package(MPI REQUIRED) + message("MPI version is ${MPI_Fortran_VERSION}") + message("MPI f90 version is ${MPI_Fortran_HAVE_F90_MODULE}") + message("MPI f08 version is ${MPI_Fortran_HAVE_F08_MODULE}") + + add_definitions(${MPI_Fortran_COMPILE_FLAGS}) + include_directories(${MPI_Fortran_INCLUDE_DIRS} ${MPI_INCLUDE_PATH} "./" ${CMAKE_INCLUDE_OUTPUT_DIRECTORY}) + link_directories(${MPI_Fortran_LIBRARIES} ${ARCHIVE_OUTPUT_PATH} ) + find_package( W3NCO ) + + set (CMAKE_Fortran_INC_FLAGS "-I ./ -I ${CORE_INCS} -I ${NETCDF_INCLUDE_DIRS} ") + set(BUILD_NCDIAG ON) + set(NCDIAG_INCS "${PROJECT_BINARY_DIR}/libsrc/ncdiag") + add_subdirectory(${PROJECT_SOURCE_DIR}/../../src/ncdiag ${PROJECT_BINARY_DIR}/libsrc/ncdiag) + set(NCDIAG_LIBRARIES ncdiag ) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) +endif() + +add_subdirectory(nwprod/conmon_shared/sorc/conmon_grads_lev.fd) +add_subdirectory(nwprod/conmon_shared/sorc/conmon_grads_mandlev.fd) +add_subdirectory(nwprod/conmon_shared/sorc/conmon_grads_sfc.fd) +add_subdirectory(nwprod/conmon_shared/sorc/conmon_grads_sfctime.fd) +add_subdirectory(nwprod/conmon_shared/sorc/conmon_grads_sig.fd) +add_subdirectory(nwprod/conmon_shared/sorc/conmon_time.fd) +add_subdirectory(image_gen/sorc/conmon_read_ps_IG.fd) +add_subdirectory(image_gen/sorc/conmon_read_pw_IG.fd) +add_subdirectory(image_gen/sorc/conmon_read_q_IG.fd) +add_subdirectory(image_gen/sorc/conmon_read_t_IG.fd) +add_subdirectory(image_gen/sorc/conmon_read_uv_IG.fd) diff --git a/util/Conventional_Monitor/ConMon_install.pl b/util/Conventional_Monitor/ConMon_install.pl index ab5c88e2e6..2b1ebd4f9c 100755 --- a/util/Conventional_Monitor/ConMon_install.pl +++ b/util/Conventional_Monitor/ConMon_install.pl @@ -1,6 +1,7 @@ #! /usr/bin/perl #------------------------------------------------------------------- +# # ConMon_install.pl # # This script makes sets all necessary configuration definitions @@ -13,10 +14,12 @@ use File::Copy qw(move); print "--> ConMon_install.sh\n"; + my $machine = `/usr/bin/perl ./get_hostname.pl`; my $my_machine="export MY_MACHINE=$machine"; - if( $machine ne "theia" && $machine ne "wcoss" && $machine ne "cray" ) { + if( $machine ne "hera" && $machine ne "wcoss" && + $machine ne "wcoss_c" && $machine ne "wcoss_d" ) { die( "ERROR --- Unrecognized machine hostname, $machine. Exiting now...\n" ); } else { @@ -24,6 +27,7 @@ } #--------------------------------------------------------------------------------- + # # All 3 currently supported platforms are little endian machines and linux OSes. # I'm keeping these switches though because that will surely change at some # point and I'll just have to re-introduce the same switches. @@ -34,38 +38,44 @@ my $my_os = "export MY_OS=$os"; + #--------------------------------------------------------------- # # Idenfity basedir location of package # print "\n"; print "locating and saving ConMon package location\n"; - my $cmondir; - $cmondir = `dirname $0`; - $cmondir =~ s/^\s+|\s+$//g; + my $conmon_dir; + $conmon_dir = `dirname $0`; + $conmon_dir =~ s/^\s+|\s+$//g; - if( $cmondir eq "." ) { - $cmondir = `pwd`; - $cmondir =~ s/^\s+|\s+$//g; + if( $conmon_dir eq "." ) { + $conmon_dir = `pwd`; + $conmon_dir =~ s/^\s+|\s+$//g; } - my $my_cmon = "export MY_CMON=$cmondir"; - print "my_cmon = $my_cmon \n"; + my $my_conmon = "export MY_CONMON=$conmon_dir"; + print "my_conmon = $my_conmon \n"; print"\n\n"; sleep( 1 ); + #--------------------------------------------------------------- # # TANKDIR location # my $user_name = $ENV{ 'USER' }; - if( $machine eq "theia" ) { - $tankdir = "/scratch4/NCEPDEV/da/save/$user_name/nbns"; + + if( $machine eq "hera" ) { + $tankdir = "/scratch1/NCEPDEV/da/$user_name/save/nbns"; } elsif( $machine eq "wcoss" ) { $tankdir = "/global/save/$user_name/nbns"; } - elsif( $machine eq "cray" ) { + elsif( $machine eq "wcoss_c" ) { $tankdir = "/gpfs/hps/emc/da/noscrub/$user_name" } + elsif( $machine eq "wcoss_d" ) { + $tankdir = "/gpfs/dell2/emc/modeling/noscrub/$user_name/nbns"; + } print "Please specify TANKDIR location for storage of data and image files.\n"; print " Return to accept default location or enter new location now.\n"; @@ -78,12 +88,13 @@ if( length($new_tankdir ) > 0 ) { $tankdir = $new_tankdir; } - my $my_tankdir="export CMON_TANKDIR=$tankdir"; + my $my_tankdir="export CONMON_TANKDIR=$tankdir"; print "my_tankdir = $my_tankdir\n"; print "\n\n"; sleep( 1 ); + #--------------------------------------------------------------- # # Web sever name # @@ -104,6 +115,7 @@ sleep( 1 ); + #--------------------------------------------------------------- # # Web server user name # @@ -124,11 +136,11 @@ sleep( 1 ); + #--------------------------------------------------------------- # # Web directory # - my $webdir = "/home/people/emc/www/htdocs/gmb/gdas/radiance/${webuser}"; - my $webdir = "/home/people/emc/www/htdocs/gmb/gdas"; + my $webdir = "/home/people/emc/www/htdocs/gmb/gdas/es_conv"; print "Please specify the top level web site directory $server.\n"; print " Return to accept default directory location or enter new location.\n"; print " \n"; @@ -145,7 +157,7 @@ sleep( 1 ); - # + #---------------------------------------------------- # Set up ptmp and stmp locations according to $arch. # my $ptmp = "/ptmpd1"; @@ -153,15 +165,24 @@ my $my_ptmp = "export C_PTMP=\${C_PTMP:-$ptmp}"; my $my_stmp = "export C_STMP=\${C_STMP:-$stmp}"; - if( $machine eq "theia" ) { - $my_ptmp="export C_PTMP=\${C_PTMP:-/scratch4/NCEPDEV/stmp4}"; - $my_stmp="export C_STMP=\${C_STMP:-/scratch4/NCEPDEV/stmp3}"; + if( $machine eq "hera" ) { + $my_ptmp="export C_PTMP=\${C_PTMP:-/scratch2/NCEPDEV/stmp3}"; + $my_stmp="export C_STMP=\${C_STMP:-/scratch2/NCEPDEV/stmp1}"; } - elsif( $machine eq "cray" ) { - $my_ptmp="export C_PTMP=\${C_PTMP:-/gpfs/hps/ptmp/$user_name}"; - $my_stmp="export C_STMP=\${C_STMP:-/gpfs/hps/stmp/$user_name}"; + elsif( $machine eq "wcoss_c" ) { + $my_ptmp="export C_PTMP=\${C_PTMP:-/gpfs/hps/ptmp}"; + $my_stmp="export C_STMP=\${C_STMP:-/gpfs/hps/stmp}"; } - else { + elsif( $machine eq "wcoss_d" ) { + $my_ptmp="export C_PTMP=\${C_PTMP:-/gpfs/dell2/ptmp}"; + $my_stmp="export C_STMP=\${C_STMP:-/gpfs/dell2/stmp}"; + } + + #--------------------------------------- + # + # wcoss has several options available: + # + else { print "Please specify PTMP location. This is used for temporary work space.\n"; print " Available options are: \n"; print " /ptmpd1 (default)\n"; @@ -215,25 +236,27 @@ my $account = "export ACCOUNT=\${ACCOUNT:-fv3-cpu}"; - if( $machine ne "theia" ) { + if( $machine ne "hera" ) { $account = "export ACCOUNT=\${ACCOUNT:-}"; } + + #------------------------------------------------------------ # - # Update the conv_conf with the configuration information + # Update the config file with the configuration information # - my $conv_conf = "parm/ConMon_config"; - open my $in, '<', $conv_conf or die "Can't read $conv_conf: $!"; - open my $out, '>', "$conv_conf.new" or die "Can't write $conv_conf.new: $!"; + my $config = "parm/ConMon_config"; + open my $in, '<', $config or die "Can't read $config $!"; + open my $out, '>', "$config.new" or die "Can't write $config.new: $!"; while( <$in> ) { - if( $_ =~ "MY_CMON=" ) { - print $out "$my_cmon\n"; + if( $_ =~ "MY_CONMON=" ) { + print $out "$my_conmon\n"; } elsif( $_ =~ "ACCOUNT=" ) { print $out "$account\n"; } - elsif( $_ =~ "CMON_TANKDIR=" ) { + elsif( $_ =~ "CONMON_TANKDIR=" ) { print $out "$my_tankdir\n"; } elsif( $_ =~ "WEBSVR=" ) { @@ -266,25 +289,12 @@ } close $out; close $in; - move "$conv_conf.new", $conv_conf; + + move "$config.new", $config; + print "building executables\n"; - `./makeall.sh clean`; - `./makeall.sh`; - - # - # Update the default account settings in the data_map.xml file. - # -# print "updating defaults in data_map.xml \n"; -# my $glbl_account = "GDAS-MTN"; -# if( $machine eq "zeus" ) { -# $glbl_account = "ada"; -# } -# elsif( $machine eq "wcoss" ) { -# $glbl_account = "dev"; -# } - -# `/usr/bin/perl ./scripts/update_data_map.pl ./parm/data_map.xml global_default account $glbl_account`; + `./build_ConMon_cmake.sh`; print "<-- ConMon_install.sh\n"; diff --git a/util/Conventional_Monitor/build_ConMon_cmake.sh b/util/Conventional_Monitor/build_ConMon_cmake.sh new file mode 100755 index 0000000000..f7b6dbe2e1 --- /dev/null +++ b/util/Conventional_Monitor/build_ConMon_cmake.sh @@ -0,0 +1,139 @@ +#! /bin/bash + +#------------------------------------------------------------------ +# build_ConMon_cmake.sh +# +# This script builds all of the executables in the +# nwprod/conmon_shared/exec, data_extract/exec, and image_gen/exec +# subdirectories. +# +# The operational ConMon executables (in nwprod/conmon_shared/exec) +# may also be built as part of the whole GSI package. To do this +# ensure BUILD_UTIL=ON when running cmake or use the +# ProdGSI/ush/build_all_cmake.sh script. +#------------------------------------------------------------------ +set -ax + +mode=${1:-} +MY_CONMON=${2:-} + +top_level=${PWD} +echo "top_level = ${top_level}" + +export MY_CONMON=${MY_CONMON:-$top_level} +echo "MY_CONMON = ${MY_CONMON}" + +if [[ -d /dcom && -d /hwrf ]] ; then + . /usrx/local/Modules/3.2.10/init/sh + target=wcoss + . $MODULESHOME/init/sh +elif [[ -d /cm ]] ; then + . $MODULESHOME/init/sh + target=wcoss_c +elif [[ -d /ioddev_dell ]]; then + . $MODULESHOME/init/sh + target=wcoss_d +elif [[ -d /scratch1 ]] ; then + . /apps/lmod/lmod/init/sh + target=hera +elif [[ -d /work ]]; then + . $MODULESHOME/init/sh + target=orion +else + echo "unknown target = $target" + exit 9 +fi + +GSI_Pkg=${top_level}/../.. +echo "GSI_Pkg = ${GSI_Pkg}" + +echo "target = $target" + +dir_modules=${GSI_Pkg}/modulefiles +if [ ! -d $dir_modules ]; then + echo "modulefiles does not exist in $dir_modules" + exit 10 +fi + + +#------------------------------ +# source ConMon_config +#------------------------------ +. ${top_level}/parm/ConMon_config + + +#--------------------------------------------------- +# Verify this is a supported machine +#--------------------------------------------------- + +if [[ ${target} = "hera" || ${target} = "wcoss_c" \ + || ${target} = "wcoss_d" || ${target} = "orion" ]]; then + echo Building nwprod executables on ${target} + echo + + + #------------------------------------- + # load modules + #------------------------------------- + if [ $target = wcoss_d ]; then + module purge + module use -a $dir_modules + module load modulefile.ProdGSI.$target + elif [ $target = wcoss -o $target = gaea ]; then + module purge + module load $dir_modules/modulefile.ProdGSI.$target + elif [ $target = hera -o $target = orion ]; then + module purge + module use $dir_modules + module load modulefile.ProdGSI.$target + elif [ $target = cheyenne ]; then + module purge + source $dir_modules/modulefile.ProdGSI.$target + elif [ $target = wcoss_c ]; then + module purge + module load $dir_modules/modulefile.ProdGSI.$target + fi + + + #------------------------------------- + # use cmake to build the executables + #------------------------------------- + if [[ -d ./build ]]; then + rm -rf ./build + fi + mkdir build + cd ./build + + cmake .. + make -j8 + + cd bin + + #------------------------------------------------------- + # move the executables to the correct exec directories + #------------------------------------------------------- + + file_list1=" conmon_grads_lev.x conmon_grads_sfc.x + conmon_grads_sig.x conmon_time.x + conmon_grads_mandlev.x conmon_grads_sfctime.x" + + + for file in $file_list1; do + cp $file $HOMEconmon_shared/exec/. + done + + + file_list_ig="conmon_read_uv_IG.x conmon_read_q_IG.x conmon_read_t_IG.x + conmon_read_ps_IG.x conmon_read_pw_IG.x" + for file in $file_list_ig; do + cp $file $C_IG_EXEC/. + done + +else + echo ${machine} is not supported +fi + + +set +x + +exit diff --git a/util/Conventional_Monitor/data_extract/ush/ConMon_DE.sh b/util/Conventional_Monitor/data_extract/ush/ConMon_DE.sh index d386e0ccd0..c60237570e 100755 --- a/util/Conventional_Monitor/data_extract/ush/ConMon_DE.sh +++ b/util/Conventional_Monitor/data_extract/ush/ConMon_DE.sh @@ -1,93 +1,107 @@ -#!/bin/sh +#!/bin/sh -l #-------------------------------------------------------------------- # # ConMon_DE.sh # -# This is the top level data extractionscript for the Conventional +# This is the top level data extraction script for the Conventional # Data Monitor (ConMon) package. # # C_DATDIR and C_GDATDIR (source directories for the cnvstat files) # point to the operational data (GDAS). They can be overriden -# either in your interactive shell or in a script in order to point -# to another source. +# to process data from another source. #-------------------------------------------------------------------- #-------------------------------------------------------------------- # usage #-------------------------------------------------------------------- function usage { - echo "Usage: ConMon_DE.sh suffix [pdate]" + echo "Usage: ConMon_DE.sh suffix [-p|--pdate pdate -r|--run gdas|gfs] -c|-cnv /path/to/cnvstat/dir" echo " Suffix is the indentifier for this data source." - echo " Pdate is the full YYYYMMDDHH cycle to run. This - param is optional" + echo " -p | --pdate yyyymmddcc to specify the cycle to be processed" + echo " if unspecified the last available date will be processed" + echo " -r | --run the gdas|gfs run to be processed" + echo " use only if data in TANKdir stores both runs, otherwise" + echo " gdas is assumed." + echo " -c | --cnv location of the cnvstat and other essential files" + echo " " } + #-------------------------------------------------------------------- -# CMon_DE.sh begins here +# ConMon_DE.sh begins here #-------------------------------------------------------------------- +set -ax +echo "Begin ConMon_DE.sh" nargs=$# -if [[ $nargs -lt 1 || $nargs -gt 2 ]]; then +if [[ $nargs -lt 1 || $nargs -gt 7 ]]; then usage exit 1 fi -set -ax -echo "Begin ConMon_DE.sh" -this_file=`basename $0` -this_dir=`dirname $0` +#----------------------------------------------- +# Process command line arguments +# +export RUN=gdas + +while [[ $# -ge 1 ]] +do + key="$1" + echo $key + + case $key in + -p|--pdate) + export PDATE="$2" + shift # past argument + ;; + -r|--run) + export RUN="$2" + shift # past argument + ;; + -c|--cnv) + export CNVSTAT_LOCATION="$2" + shift # past argument + ;; + *) + #any unspecified key is CONMON_SUFFIX + export CONMON_SUFFIX=$key + ;; + esac + + shift +done -export CMON_SUFFIX=$1 -#-------------------------------------------------------------------- -# RUN_ENVIR: can be either "dev" or "para". -#-------------------------------------------------------------------- -#export RUN_ENVIR=$2 -export RUN_ENVIR=${RUN_ENVIR:-"dev"} +this_file=`basename $0` +this_dir=`dirname $0` + #-------------------------------------------------------------------- -# load modules +# RUN_ENVIR: can be "dev", "para", or "prod". #-------------------------------------------------------------------- -#. /usrx/local/Modules/3.2.9/init/ksh -#module use /nwprod2/modulefiles -#module load grib_util -#module load prod_util -#module load util_shared - +export RUN_ENVIR=${RUN_ENVIR:-"prod"} -if [[ $nargs -ge 1 ]]; then - export PDATE=$2; - echo "PDATE set to $PDATE" -fi -echo CMON_SUFFIX = $CMON_SUFFIX +echo CONMON_SUFFIX = $CONMON_SUFFIX echo RUN_ENVIR = $RUN_ENVIR +export NET=${CONMON_SUFFIX} top_parm=${this_dir}/../../parm -cmon_version_file=${cmon_version:-${top_parm}/ConMon.ver} -if [[ -s ${cmon_version_file} ]]; then - . ${cmon_version_file} - echo "able to source ${cmon_version_file}" -else - echo "Unable to source ${cmon_version_file} file" - exit 2 -fi - -cmon_config=${cmon_config:-${top_parm}/ConMon_config} -if [[ -s ${cmon_config} ]]; then - . ${cmon_config} - echo "able to source ${cmon_config}" +conmon_config=${conmon_config:-${top_parm}/ConMon_config} +if [[ -s ${conmon_config} ]]; then + . ${conmon_config} + echo "able to source ${conmon_config}" else - echo "Unable to source ${cmon_config} file" + echo "Unable to source ${conmon_config} file" exit 3 fi -jobname=ConMon_de_${CMON_SUFFIX} +jobname=ConMon_DE_${CONMON_SUFFIX} #-------------------------------------------------------------------- # Create any missing directories @@ -106,28 +120,11 @@ if [[ ! -d ${C_IMGNDIR} ]]; then fi -tmpdir=${WORKverf_cmon}/de_cmon_${CMON_SUFFIX} -rm -rf $tmpdir -mkdir -p $tmpdir -cd $tmpdir - -#-------------------------------------------------------------------- -# Check status of monitoring job. Is it already running? If so, exit -# this script and wait for job to finish. - -if [[ $MY_MACHINE = "wcoss" ]]; then - count=`bjobs -u ${LOGNAME} -p -r -J "${jobname}" | wc -l` - if [[ $count -ne 0 ]] ; then - echo "Previous cmon jobs are still running for ${CMON_SUFFIX}" - exit 5 - fi -fi - #-------------------------------------------------------------------- # Get date of cycle to process and/or previous cycle processed. # if [[ $PDATE = "" ]]; then - GDATE=`${C_DE_SCRIPTS}/find_cycle.pl 1 ${C_TANKDIR}` + GDATE=`${C_DE_SCRIPTS}/find_cycle.pl --cyc 1 --dir ${C_TANKDIR} --run $RUN ` PDATE=`$NDATE +06 $GDATE` else GDATE=`$NDATE -06 $PDATE` @@ -143,45 +140,76 @@ export PDYm6h=`echo $GDATE|cut -c1-8` echo PDYm6h = $PDYm6h -export CNVSTAT_LOCATION=${CNVSTAT_LOCATION:-/gpfs/hps/nco/ops/com/gfs/prod} -export C_DATDIR=${C_DATDIR:-${CNVSTAT_LOCATION}/gdas.$PDY} -export C_GDATDIR=${C_GDATDIR:-${CNVSTAT_LOCATION}/gdas.$PDYm6h} +if [[ $MY_MACHINE == "hera" ]]; then + export CNVSTAT_LOCATION=${CNVSTAT_LOCATION:-/scratch1/NCEPDEV/da/Edward.Safford/noscrub/test_data} +else + export CNVSTAT_LOCATION=${CNVSTAT_LOCATION:-${COMROOTp3}/gfs/${RUN_ENVIR}} +fi + +export COMPONENT=${COMPONENT:-atmos} + +export C_DATDIR=${C_DATDIR:-${CNVSTAT_LOCATION}/${RUN}.${PDY}/${CYC}/${COMPONENT}} +if [[ ! -d ${C_DATDIR} ]]; then + export C_DATDIR=${CNVSTAT_LOCATION}/${RUN}.${PDY}/${CYC} +fi + +export C_GDATDIR=${C_GDATDIR:-${CNVSTAT_LOCATION}/${RUN}.${PDYm6h}/${GCYC}/${COMPONENT}} +if [[ ! -d ${C_GDATDIR} ]]; then + export C_GDATDIR=${CNVSTAT_LOCATION}/${RUN}.${PDYm6h}/${GCYC} +fi export C_COMIN=${C_DATDIR} export C_COMINm6h=${C_GDATDIR} -export DATA_IN=${WORKverf_cmon} -export CMON_WORK_DIR=${CMON_WORK_DIR:-${C_STMP_USER}/cmon_${CMON_SUFFIX}} +export CONMON_WORK_DIR=${CONMON_WORK_DIR:-${C_STMP_USER}/${CONMON_SUFFIX}}/${RUN}/conmon pid=$$ -export jobid=cmon_DE_${CMON_SUFFIX}.${pid} +export jobid=DE_${PDATE}.${pid} -#-------------------------------------------------------------------- -# If data is available, export variables, and submit driver for -# plot jobs. + + +#--------------- +# cnvstat file # -# Modification here is for prhw14 and prhs13 parallels which only -# generate grib2 files for the analysis and forecast files. The -# operational GDAS creates grib and grib2 files. The Cmon package -# was originally designed to use grib files, but it's clear that -# grib2 will be the only standard with the next major release of -# GSI. - -export grib2=${grib2:-0} -export cnvstat="${C_DATDIR}/gdas.t${CYC}z.cnvstat" +export cnvstat="${C_DATDIR}/${CYC}/gdas.t${CYC}z.cnvstat" if [[ ! -s ${cnvstat} ]]; then - export cnvstat=${C_DATDIR}/cnvstat.gdas.${PDATE} + export cnvstat="${C_DATDIR}/gdas.t${CYC}z.cnvstat" fi -export pgrbf00="${C_DATDIR}/gdas.t${CYC}z.pgrbf00" +#--------------- +# analysis file +# +export pgrbf00="${C_DATDIR}/gdas.t${CYC}z.pgrb2.0p25.f000" if [[ ! -s ${pgrbf00} ]]; then - export pgrbf00=${C_DATDIR}/pgbanl.gdas.${PDATE} + export pgrbf00="${C_DATDIR}/gdas.t${CYC}z.pgrb2.1p00.anl" fi -export pgrbf06="${C_GDATDIR}/gdas.t${GCYC}z.pgrbf06" +#--------------- +# guess file +# +export pgrbf06="${C_GDATDIR}/gdas.t${GCYC}z.pgrb2.0p25.f006" if [[ ! -s ${pgrbf06} ]]; then - export pgrbf06=${C_DATDIR}/pgbf06.gdas.${GDATE} + export pgrbf06="${C_GDATDIR}/gdas.t${GCYC}z.pgrb2.1p00.f006" fi +#--------------------------------------------- +# override the default convinfo definition +# if there's a copy in C_TANKDIR/info +# +if [[ -e ${C_TANKDIR}/info/global_convinfo.txt ]]; then + echo " overriding convinfo definition" + export convinfo=${C_TANKDIR}/info/global_convinfo.txt +fi + +#--------------------------------------------- +# override the default conmon_base definition +# if there's a copy in C_TANKDIR/info +# +if [[ -e ${C_TANKDIR}/info/gdas_conmon_base.txt ]]; then + echo " overriding conmon_base definition" + export conmon_base=${C_TANKDIR}/info/gdas_conmon_base.txt +fi + + exit_value=0 if [ -s $cnvstat -a -s $pgrbf00 -a -s $pgrbf06 ]; then #------------------------------------------------------------------ @@ -189,13 +217,26 @@ if [ -s $cnvstat -a -s $pgrbf00 -a -s $pgrbf06 ]; then #------------------------------------------------------------------ if [ -s $pgrbf06 ]; then - if [[ $MY_MACHINE = "wcoss" ]]; then - $SUB -q $JOB_QUEUE -P $PROJECT -o $C_LOGDIR/DE.${PDY}.${CYC}.log -M 500 -R affinity[core] -W 0:25 -J ${jobname} -cwd $PWD ${HOMEgdascmon}/jobs/JGDAS_VCMON + echo "Ok to proceed with DE" + logdir=${C_LOGDIR} + if [[ ! -d ${logdir} ]]; then + mkdir -p ${logdir} + fi + + logfile=${logdir}/DE.${PDY}.${CYC}.log + if [[ -e ${logfile} ]]; then + rm -f ${logfile} + fi - elif [[ $MY_MACHINE = "theia" ]]; then - $SUB -A $ACCOUNT --ntasks=1 --time=00:20:00 \ + if [[ $MY_MACHINE = "wcoss_d" || $MY_MACHINE = "wcoss_c" ]]; then + $SUB -q $JOB_QUEUE -P $PROJECT -o ${logfile} -M 1500 \ + -R affinity[core] -W 0:50 -J ${jobname} \ + -cwd $PWD ${HOMEgdas_conmon}/jobs/JGDAS_ATMOS_CONMON + + elif [[ $MY_MACHINE = "hera" ]]; then + $SUB -A $ACCOUNT --ntasks=1 --time=00:30:00 \ -p service -J ${jobname} -o $C_LOGDIR/DE.${PDY}.${CYC}.log \ - $HOMEgdascmon/jobs/JGDAS_VCMON + ${HOMEgdas_conmon}/jobs/JGDAS_ATMOS_CONMON fi else @@ -208,11 +249,6 @@ else fi -#-------------------------------------------------------------------- -# Clean up and exit -#cd $tmpdir -#cd ../ -#rm -rf $tmpdir echo "End ConMon_DE.sh" exit ${exit_value} diff --git a/util/Conventional_Monitor/data_extract/ush/MkBase.pl b/util/Conventional_Monitor/data_extract/ush/MkBase.pl new file mode 100755 index 0000000000..58a959c19b --- /dev/null +++ b/util/Conventional_Monitor/data_extract/ush/MkBase.pl @@ -0,0 +1,269 @@ +#! /usr/bin/perl + +#----------------------------------------------------------------------- +# MkBase.pl +# +# Arguments: +# --dir : Required string value containing $TANKdir/$NET. +# --net : Identifying name of data source (aka suffix) +# --run : Run name, generally 'gdas' or 'gfs'. +# If not specified 'gdas' will be used. +#----------------------------------------------------------------------- + + use strict; + use warnings; + use Getopt::Long; + use Scalar::Util qw(looks_like_number); + + my %sums; + my %hr_sums; + + #--------------------------------------------------------- + # subroutine trim + # + # strip leading and trailing white space from a string + #--------------------------------------------------------- + sub trim { + my $s = shift; + $s =~ s/^\s+|\s+$//g; + return $s + }; + + + #--------------------------------------------------------- + # subroutine process_nobs_file + # + # Open the input file name and read the contents. + # + # Using $type_$subtype as a key, push the nobs value + # into the %sums hash (a hash of arrays). + #--------------------------------------------------------- + sub process_nobs_file { + + + #----------------------------------- + # check number of arguments passed. + # + my $nargs = scalar(@_); + + if( $nargs <= 0 || $nargs > 1 ){ + print "error: wrong number of args passed \n"; + } + else { + + my $nobs_file = shift; + my $hr = substr($nobs_file, -2); + + open(FH, '<', $nobs_file) or die $!; + + while(){ + my @line = split /,/, $_; + + my $type = trim( $line[0] ); + my $subtype = trim( $line[1] ); + my $count = trim( $line[2] ); + + #------------------------------------------------------- + # insert into hash %sums using $type_$subtype as the key + # + my $key = $type . "_" . $subtype; + + if( exists( $sums{$key} )){ + push @{ $sums{$key} }, $count; + } + else { + my @counts = [ $count ]; + $sums{$key} = \@counts; + } + + if( exists $hr_sums{$hr} && exists $hr_sums{$hr}{$key}) { + push @{ $hr_sums{$hr}{$key}}, $count; + } + else{ + my @hr_counts = [ $count ]; + $hr_sums{$hr}{$key} = \@hr_counts; + } + + } + close(FH); + } + + }; + + #--------------------------------------------------------- + # subroutine calc_avgs + # + # Take each key in the %sums hash and determine the avg + # for the array of counts and dump to new base file. + # + #--------------------------------------------------------- + sub calc_avgs { + + print "--> calc_avgs \n"; + my $dir = shift; + my $net = shift; + my $run = shift; + +# my $key; + + my $filename = "${dir}/${net}/info/${run}_conmon_base.txt"; + print "filename = $filename\n"; + open(FH, '>', $filename) or die $!; + + foreach my $hr (sort keys %hr_sums) { + + foreach my $key (sort keys %{ $hr_sums{$hr} }) { + + my $total = 0; + my $nrecs = 0; + + for my $count (@{ $hr_sums{$hr}{$key}}) { + if( looks_like_number( $count )) { + $nrecs = $nrecs + 1; + $total = $total + $count; + } + } + + my $avg = 0; + + if( $nrecs > 0 ) { + $avg = $total/$nrecs; + } + else { + print " zero count $hr, $key, $nrecs \n"; + } + + my $rounded = sprintf("%.2f", $avg); + print FH "${hr}, ${key}, ${rounded}\n"; + } + } + + close( FH ); + print "<-- calc_avgs \n"; + } + + + + ###------------------------------------------------------------------ + ###------------------------------------------------------------------ + ### + ### begin main + ### + ###------------------------------------------------------------------ + ###------------------------------------------------------------------ + + + my $run = 'gdas'; + my $dir = ''; + my $net = ''; + my $err = 0; + + GetOptions( 'net:s' => \$net, + 'run:s' => \$run, + 'dir=s' => \$dir ); + + if( length($net) == 0 ){ + print "Error: Missing net value \n"; + $err = 1; + exit $err + } + + if( length($dir) == 0 ){ + print "Error: Missing dir value \n"; + $err = 2; + exit $err + } + + print " net = $net\n"; + print " run = $run\n"; + print " dir = $dir\n"; + + my @alldirs; + my $dirpath = $dir . '/' . $net; + print "dirpath = $dirpath\n"; + + #-------------------------------------------------------------------- + # Get list of $run.* directories which contain conmon subdirectories + # + opendir(DIR, $dirpath) or die "Cannot open directory $!"; + while (my $file = readdir(DIR)) { + next unless (-d "$dirpath/$file"); + push( @alldirs, $file ); + } + closedir DIR; + + my @rundirs = grep { /$run/ } @alldirs; + + #----------------------------------------------------------------------- + # If there are no $run.yyyymmdd subdirectories, then exit without + # returning any date string. + # + if( $#rundirs < 0 ) { + print "exiting with 0 rundirs\n"; + $err = 3; + exit $err; + } + + + #----------------------------------------------------------------------- + # Sort the rundirs array and loop through it from end to beginning + # + my @sortrun = sort( @rundirs ); + + + #----------------------------------------------------------------------- + # Access the nobs files backwards starting from the latest cycle. + # + my $idx = $#sortrun + 1; + my $end_ctr = 0; + my @hrs = qw( 00 06 12 18 ); + + + #---------------------------------------------------------------- + # Start with the latest directory and attempt to locate the + # latest 240 (60 days worth of) monitor subdirectories + # containing an nobs.$run.$pdate file. + # + my $exit_flag = 0; + my $found_cycle = 0; + my $cycle_ctr = 0; + + do { + $idx = $idx -1; + my $hr_ctr = $#hrs + 1; + + my @spl = split /\./, ${sortrun[$idx]}; + my $date = ${spl[1]}; + + + #--------------------------------------------- + # use this loop over the hrs array to build + # the $obs_file names + # + do { + + $hr_ctr = $hr_ctr - 1; + + my $cycle = $date . ${hrs[$hr_ctr]}; + + my $obs_file = "${dirpath}/${sortrun[$idx]}/${hrs[$hr_ctr]}/conmon/horz_hist/anl/nobs.anl.$cycle"; + my $comp_obs_file = $obs_file . '.gz'; + + if( -e $comp_obs_file ) { + system( "gunzip", $comp_obs_file ); + } + + if( -e $obs_file ) { + process_nobs_file( $obs_file ); + system( "gzip", $obs_file ); + } + + } while $hr_ctr > 0; + + $cycle_ctr = $cycle_ctr + 1; + + } while $idx > 0 && $cycle_ctr < 240; + + calc_avgs( $dir, $net, $run ); + + exit 0 diff --git a/util/Conventional_Monitor/data_extract/ush/Run_ConMon_DE.sh b/util/Conventional_Monitor/data_extract/ush/Run_ConMon_DE.sh deleted file mode 100755 index 5e640d164a..0000000000 --- a/util/Conventional_Monitor/data_extract/ush/Run_ConMon_DE.sh +++ /dev/null @@ -1,208 +0,0 @@ -#!/bin/sh - -#-------------------------------------------------------------------- -# RunCMonDE.sh -# -# Run the CMon data extract in a loop. -# -# This script will run the data extraction for a given source in a -# loop. The loop can be from the last cycle processed (as -# determined by the contents of $TANKverf) until the available -# cnvstat data is exhausted, from the input start date until -# available data is exhausted, or from the start to the end date. -# -# Calling sequence is Suffix, Area, [start_date], [end_date} -# suffix = identifier for this data source -# start_date = optional starting cycle to process -# end_date = optional ending cycle to process -#-------------------------------------------------------------------- - -function usage { - echo "Usage: RunCMonDE.sh suffix [start_date] [end_date]" - echo " Suffix is the indentifier for this data source." - echo " Start_date is the optional starting cycle to process (YYYYMMDDHH format)." - echo " End_date is the optional ending cycle to process (YYYYMMDDHH format)." -} - -set -ax -echo start RunCMonDE.sh - -nargs=$# -if [[ $nargs -lt 1 ]]; then - usage - exit 1 -fi - -# -# Check for my monitoring use. Abort if running on prod machine. -# - machine=`hostname | cut -c1` - prod=`cat /etc/prod | cut -c1` - - if [[ $machine = $prod ]]; then - exit 10 - fi -# -# End check. - -this_file=`basename $0` -this_dir=`dirname $0` - -CMON_SUFFIX=$1 -START_DATE=$2 -END_DATE=$3 - -#RUN_ENVIR=${RUN_ENVIR:-dev} -#RAD_AREA=${RAD_AREA:-glb} - -echo CMON_SUFFIX = $CMON_SUFFIX -echo START_DATE = $START_DATE -echo END_DATE = $END_DATE - -#-------------------------------------------------------------------- -# Set environment variables -#-------------------------------------------------------------------- -top_parm=${this_dir}/../../parm - -cmon_version_file=${cmon_version:-${top_parm}/CMon.ver} -if [[ -s ${cmon_version_file} ]]; then - . ${cmon_version_file} - echo "able to source ${cmon_version_file}" -else - echo "Unable to source ${cmon_version_file} file" - exit 2 -fi - -cmon_config=${cmon_config:-${top_parm}/CMon_config} -if [[ -s ${cmon_config} ]]; then - . ${cmon_config} - echo "able to source ${cmon_config}" -else - echo "Unable to source ${cmon_config} file" - exit 3 -fi - - -#-------------------------------------------------------------------- -# Check setting of RUN_ONLY_ON_DEV and possible abort if on prod and -# not permitted to run there. -#-------------------------------------------------------------------- - -if [[ RUN_ONLY_ON_DEV -eq 1 ]]; then - is_prod=`${C_DE_SCRIPTS}/onprod.sh` - if [[ $is_prod = 1 ]]; then - exit 10 - fi -fi - - -if [[ ! -d ${LOGSverf_cmon} ]]; then - mkdir -p ${LOGSverf_cmon} -fi - -log_file=${LOGSverf_cmon}/RunCMonDE_${CMON_SUFFIX}.log -err_file=${LOGSverf_cmon}/RunCMonDE_${CMON_SUFFIX}.err - -vrfy_script=CMon_DE.sh - - -#-------------------------------------------------------------------- -# If end date was specified, confirm the start is before end date. -#-------------------------------------------------------------------- -end_len=`echo ${#END_DATE}` -if [[ ${end_len} -gt 0 ]]; then - if [[ $START_DATE -gt $END_DATE ]]; then - echo "ERROR: start date is greater then end date : $START_DATE $END_DATE" - exit 1 - fi -fi - - -#-------------------------------------------------------------------- -# If we don't have a START_DATE the find the last processed cycle, -# and add 6 hrs to it. -#-------------------------------------------------------------------- -start_len=`echo ${#START_DATE}` -if [[ ${start_len} -gt 0 ]]; then - pdate=`${NDATE} -06 $START_DATE` -else - pdate=`${C_DE_SCRIPTS}/find_cycle.pl 1 ${C_TANKDIR}` - pdate_len=`echo ${#pdate}` - START_DATE=`${NDATE} +06 $pdate` -fi - - -#-------------------------------------------------------------------- -# Run in a loop until END_DATE is processed, or an error occurs, or -# we run out of data. -#-------------------------------------------------------------------- -cdate=$START_DATE -done=0 -ctr=0 -jobname=$DATA_EXTRACT_JOBNAME - -while [[ $done -eq 0 ]]; do - - #-------------------------------------------------------------------- - # Check for running jobs - #-------------------------------------------------------------------- - if [[ $MY_MACHINE = "wcoss" ]]; then - running=`bjobs -l | grep CMon_de_${CMON_SUFFIX} | wc -l` - elif [[ $MY_MACHINE = "theia" ]]; then - running=1 - line=`qstat -u ${LOGNAME} | grep ${jobname}` - test=`echo $line | gawk '{print $10}'` - - total=`echo $line | grep ${jobname} | wc -l` - if [[ $test = "C" || $total -le 0 ]]; then - running=0 - fi - - fi - - if [[ $running -ne 0 ]]; then - #---------------------------------------------------- - # sleep or time-out after 30 tries. - #---------------------------------------------------- - ctr=$(( $ctr + 1 )) - if [[ $ctr -le 30 ]]; then - echo sleeping..... - sleep 60 - else - done=1 - fi - else - - #----------------------------------------------------------------- - # Run the verification/extraction script - #----------------------------------------------------------------- - echo Processing ${cdate} - ${C_DE_SCRIPTS}/${vrfy_script} ${CMON_SUFFIX} ${cdate} 1>${log_file} 2>${err_file} - - #----------------------------------------------------------------- - # done is true (1) if the vrfy_script produced an error code, or - # we're at END_DATE - #----------------------------------------------------------------- - rc=`echo $?` - if [[ $rc -ne 0 ]]; then - done=1 - elif [[ $cdate -eq $END_DATE ]]; then - done=1 - else - #-------------------------------------------------------------- - # If not done advance the cdate to the next cycle. - # sleep is for zeus's job queue to catch up. - #-------------------------------------------------------------- - cdate=`${NDATE} +06 $cdate` - ctr=0 - if [[ $MY_MACHINE = "theia" ]]; then - sleep 30 - fi - fi - fi - -done - - -echo "end RunCMonDE.sh" -exit diff --git a/util/Conventional_Monitor/data_extract/ush/find_cycle.pl b/util/Conventional_Monitor/data_extract/ush/find_cycle.pl index b8f2c23dea..6a64d2f340 100755 --- a/util/Conventional_Monitor/data_extract/ush/find_cycle.pl +++ b/util/Conventional_Monitor/data_extract/ush/find_cycle.pl @@ -3,18 +3,37 @@ #----------------------------------------------------------------------- # find_cycle.pl # -# Given a directory containing cmon.YYYYMMDDHH subdirectories, -# determine the first or last cycle for which ieee_d data files -# exist. +# Arguments: +# --dir : Required string value containing $TANKdir/$SUFFIX. +# --cyc : Optional integer value: +# 1 = last cycle (default) +# 0 = first cycle +# --run : Run name, generally 'gdas' or 'gfs'. +# If not specified 'gdas' will be used. # # Return that first/last cycle as a text string in YYYYMMDDHH format, # or return nothing if none of the expected data files are found. +# +# Note that this is designed to be used by a shell script which will +# pick up the returned cycle string. If debug statements are left +# in this perl script then the calling shell script will have +# problems. +# +# Note further: this utility is designed to replace find_cycle.pl, +# which has been intentionally retained. There are older TANKdir +# directory structures in use, which the find_cycle.pl utility can +# support. But integrating support for all types of TANKdir +# structures within a single script was +# more complicated than simply adding a new version of the utility. +# So if TANK_USE_RUN is 1, then this is the script to use because +# it knows to look in $TANKdir/$NET/$run.$pdy/$cyc/conmon. #----------------------------------------------------------------------- - use strict; - use warnings; + use strict; + use warnings; + use Getopt::Long; + use Scalar::Util qw(looks_like_number); - use Scalar::Util qw(looks_like_number); #------------------------------------------------------------------- # @@ -37,17 +56,22 @@ ##------------------------------------------------------------------ ##------------------------------------------------------------------ - if ($#ARGV != 1 ) { - print "usage: find_cycle.pl 0/1 /path_to_directory/containing/cmon.YYYYMMDDHH subdirectories. \n"; - print " 0 = first, 1 = last \n"; - exit; - } - my $target = $ARGV[0]; - my $dirpath = $ARGV[1]; + my $run = 'gdas'; + my $dir = ''; + my $lcm = 'conmon'; + my $cyc = '1'; + + GetOptions( 'cyc:i' => \$cyc, + 'run:s' => \$run, + 'dir=s' => \$dir, + 'lcm:s' => \$lcm ); + + my @alldirs; + my $dirpath = $dir; - - # Get list of cmon.* sub-directories + #-------------------------------------------------------------------- + # Get list of $run.* directories which contain conmon subdirectories # opendir(DIR, $dirpath) or die "Cannot open directory $!"; while (my $file = readdir(DIR)) { @@ -55,123 +79,140 @@ push( @alldirs, $file ); } closedir DIR; - - my @cmondirs = grep { /cmon/ } @alldirs; - - # If there are no cmon.* subdirectories, then exit without + my $search_string; + + if( length($run) == 0 ){ + $search_string = $lcm; + } else { + $search_string = $run; + } + + my @mmdirs = grep { /$search_string/ } @alldirs; + #----------------------------------------------------------------------- + # If there are no $run.yyyymmdd subdirectories, then exit without # returning any date string. # - if( $#cmondirs < 0 ) { - print "exiting with 0 cmondirs\n"; + if( $#mmdirs < 0 ) { + print "exiting with 0 mmdirs\n"; exit; + } + + + #----------------------------------------------------------------------- + # Sort the mmdirs array and loop through it from end to beginning + # + + my @sortmm = sort( @mmdirs ); + + my $ctr; + my $incr; + my $end_ctr; + my @hrs; + + #----------------------------------------------------------------------- + # Arrange the logic here for accessing either the first or last + # cycle. If we're after the first cycle the directories will be + # processed from 0 to max. Note below the cycle hours are processed + # from max to 0, so the cycle order is reversed (18..00) when looking + # for the first cycle. + # + if( $cyc == 0 ){ + $ctr = -1; + $incr = 1; + $end_ctr = $#sortmm; + @hrs = qw( 18 12 06 00 ); + } else { + $ctr = $#sortmm + 1; + $incr = -1; + @hrs = qw( 00 06 12 18 ); + $end_ctr = 0; } - - - # Sort the cmondirs array and loop through it from end to beginning + + + my $found_cycle = 0; + + # Start with the latest directory and attempt to locate monitor + # subdirectories. # - if( $target == 1 ){ # search is for latest date/time - my @sortrad = sort( @cmondirs ); - my $ctr = $#sortrad + 1; + my $exit_flag = 0; + + do { + $ctr = $ctr + $incr; + + # In each subdirectory attempt to locate all *stas* files + # and parse out all unique date values. The latest is the answer + # we're looking for. + # + # If there are no *stas* files, step to the next iteration. + # - my $found_cycle = 0; + my $newdir; + my $hr_ctr = $#hrs + 1; do { - - $ctr--; - - - # In each subdirectory build a list of time.*ieee_d* files - # and parse out all unique date values. The oldest is the answer - # we're looking for. - # - # If there are no time.*ieee_d* files, step to the next iteration. - # - my $newdir = "${dirpath}/${sortrad[$ctr]}/time_vert"; - opendir DIR, $newdir or die "Cannot open the current directory: $!"; - - my @timefiles = grep { /anl_ps_stas/ } readdir DIR; -# my @timefiles = grep { /ieee_d/ } @tfiles; - - if( $#timefiles >= 0 ) { - my @sorttime = sort( @timefiles ); - my @times; - my $idx = 0; - - # Find the first string of 10 digits; that's the date. Use that - # $idx nubmer to process all files. - # -# my @vals = split( '\.', $timefiles[0] ); -# for ( my $ii=$#vals; $ii >= 0; $ii-- ) { -# if( looks_like_number( $vals[$ii] ) && length($vals[$ii] ) == 10 ){ -# $idx = $ii; -# } -# } - for ( my $ii=$#sorttime; $ii >= 0; $ii-- ) { + $hr_ctr = $hr_ctr - 1; + + $newdir = "${dirpath}/${sortmm[$ctr]}/${hrs[$hr_ctr]}/${lcm}/time_vert"; - my @vals = split( '\.', $sorttime[$ii] ); - for( my $jj=$#vals; $jj>=0; $jj-- ) { - if( looks_like_number( $vals[$jj] ) && length($vals[$jj] ) == 10) { - -# push( @times, $values[$idx] ); - push( @times, $vals[$jj] ); + + if( -d $newdir ) { + opendir DIR, $newdir or die "Cannot open the current directory: $!"; + + my @timefiles = grep { /stas/ && !/ctl/ } readdir DIR; + + if( $#timefiles >= 0 ) { + my @sorttime = sort( @timefiles ); + my @times; + my $idx = 0; + + # Find the first string of 10 digits; that's the date. Use that + # $idx number to process all files. + # + my @vals = split( '\.', $timefiles[0] ); + for ( my $ii=$#vals; $ii >= 0; $ii-- ) { + if( looks_like_number( $vals[$ii] ) && length($vals[$ii] ) == 10 ){ + $idx = $ii; } } - } - if ( $#times >= 0 ) { - $found_cycle = 1; - my @utimes = sort( uniq( @times ) ); - print "$utimes[$#utimes]"; - } - } + for ( my $ii=$#sorttime; $ii >= 0; $ii-- ) { + my $teststr = $sorttime[$ii]; - } while $found_cycle == 0 && $ctr > 0; - } - else { # search is for earliest date/time + my @values = split( '\.', $teststr ); + if( length($values[$idx] ) == 10 ){ + push( @times, $values[$idx] ); + } + } - my @sortrad = sort( @cmondirs ); - my $ctr = -1; + if ( $#times >= 0 ) { + my @utimes = sort( uniq( @times ) ); + if( $cyc == 1 ) { + print "$utimes[$#utimes]"; + $found_cycle = 1; + } elsif( $cyc == 2 && $#utimes >= 1 ) { + print "$utimes[$#utimes-1]"; + $found_cycle = 1; + } else { + print "$utimes[0]"; + $found_cycle = 1; + } + } + } - my $found_cycle = 0; - do { - - $ctr++; - - - # In each subdirectory build a list of time.*ieee_d* files - # and parse out all unique date values. The oldest is the answer - # we're looking for. - # - # If there are no time.*ieee_d* files, step to the next iteration. - # - my $newdir = "${dirpath}/${sortrad[$ctr]}"; - opendir DIR, $newdir or die "Cannot open the current directory: $!"; - - my @tfiles = grep { /time/ } readdir DIR; - my @timefiles = grep { /ieee_d/ } @tfiles; - - if( $#timefiles >= 0 ) { - my @sorttime = sort( @timefiles ); - my @times; - - for ( my $ii=0; $ii <= $#sorttime; $ii++ ) { - my $teststr = $sorttime[$ii]; + } + + } while $hr_ctr > 0 && $found_cycle == 0; - my @values = split( '\.', $sorttime[$ii] ); - push( @times, $values[2] ); - } - if ( $#times >= 0 ) { - $found_cycle = 1; - my @utimes = sort( uniq( @times ) ); - print "$utimes[0]"; - } - } + if( $cyc == 0 && $ctr >= $end_ctr ){ + $exit_flag = 1; + } elsif( $cyc == 1 && $ctr <= $end_ctr ){ + $exit_flag = 1; + } + - } while $found_cycle == 0 && $ctr < $#sortrad ; - } + } while $found_cycle == 0 && $exit_flag == 0; - exit; diff --git a/util/Conventional_Monitor/data_extract/ush/onprod.sh b/util/Conventional_Monitor/data_extract/ush/onprod.sh deleted file mode 100755 index 1973d83365..0000000000 --- a/util/Conventional_Monitor/data_extract/ush/onprod.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/sh - -# -# Check to determine if this maching is currently -# the production machine. -# -# Return values: -# 1 = prod -# 0 = dev -# - iamprod=0 - - if [[ $MY_MACHINE = "wcoss" ]]; then - machine=`hostname | cut -c1` - if [[ -e /etc/prod ]]; then - prod=`cat /etc/prod | cut -c1` - - if [[ $machine = $prod ]]; then - iamprod=1 - fi - fi - fi - - echo $iamprod - exit diff --git a/util/Conventional_Monitor/get_hostname.pl b/util/Conventional_Monitor/get_hostname.pl index 43097e52d1..8d89277a21 100755 --- a/util/Conventional_Monitor/get_hostname.pl +++ b/util/Conventional_Monitor/get_hostname.pl @@ -4,8 +4,8 @@ # get_hostname.pl # # This script determines the hostname of the current machine. The -# possiblities are wcoss(ibm), (wcoss)cray, or theia. A null -# string ("") if the host is not one of those three. +# possiblities are wcoss, wcoss_c, wcoss_d, or hera. A null +# string ("") if the machine is not recognized. # # NOTE: shell scripts call this and then read the output string # which is in $machine. So don't leave uncommented debug @@ -13,35 +13,21 @@ #----------------------------------------------------------------------- my $machine = ""; - - #---------------------------------------------------- - # use `hostname` command to determine the platform - # we're on: - # - # - theia login nodes are tfe1-fe8, - # - wcoss(ibm) login nodes are [t|s][14|10]a[1|2] - # - (wcoss)cray login nodes are [s|t]login[1|2] - # - my $host_zeus = 0; - my $host = ""; - $host = ` hostname `; - chomp( $host ); - if( $host =~ /\./ ) { - my @hostnames = split( '\.', $host ); - $host = $hostnames[0]; - } - - if( $host =~ /tfe/ ) { - $machine = "theia"; + if (-d "/dcom" and -d "/hwrf") { + $machine = "wcoss"; } - elsif( $host =~ /llogin/ || $host =~/slogin/ ){ - $machine = "cray"; + elsif( -d "/cm" ) { + $machine = "wcoss_c"; } - elsif( $host =~ /t/ || $host =~ /g/ ){ - $machine = "wcoss"; + elsif( -d "/ioddev_dell" ) { + $machine = "wcoss_d"; } - + elsif( -d "/scratch1" ) { + $machine = "hera"; + } + + print "$machine"; exit 0; diff --git a/util/Conventional_Monitor/image_gen/gscripts/colorbar.gs b/util/Conventional_Monitor/image_gen/gscripts/colorbar.gs new file mode 100644 index 0000000000..1291728d47 --- /dev/null +++ b/util/Conventional_Monitor/image_gen/gscripts/colorbar.gs @@ -0,0 +1,112 @@ +* +* Script to plot a colorbar +* +* The script will assume a colorbar is wanted even if there is +* not room -- it will plot on the side or the bottom if there is +* room in either place, otherwise it will plot along the bottom and +* overlay labels there if any. This can be dealt with via +* the 'set parea' command. In version 2 the default parea will +* be changed, but we want to guarantee upward compatibility in +* sub-releases. +* +function colorbar (args) +* +* Check shading information +* + say '--> colorbar.gs' + 'query shades' + shdinfo = result + say 'shdinfo = 'shdinfo + + if (subwrd(shdinfo,1)='None') + say 'Cannot plot color bar: No shading information' + return + endif +* +* Get plot size info +* + 'query gxinfo' + rec2 = sublin(result,2) + rec3 = sublin(result,3) + rec4 = sublin(result,4) + xsiz = subwrd(rec2,4) + ysiz = subwrd(rec2,6) + ylo = subwrd(rec4,4) + xhi = subwrd(rec3,6) + xd = xsiz - xhi +* +* Decide if horizontal or vertical color bar +* and set up constants. +* + if (ylo<0.6 & xd<1.0) + say "Not enough room in plot for a colorbar" + return + endif + cnum = subwrd(shdinfo,5) + + if (ylo<0.6 | xd>1.5) + xl = xhi + xd/2 - 0.4 + xr = xl + 0.2 + xwid = 0.2 + ywid = 0.5 + if (ywid*cnum > ysiz*0.8) + ywid = ysiz*0.8/cnum + endif + ymid = ysiz/2 + yb = ymid - ywid*cnum/2 + 'set string 0 l 5' + vert = 1 + else + ymid = ylo/2 + yt = ymid + 0.2 + yb = ymid + xmid = xsiz/2 + xwid = 0.8 + if (xwid*cnum > xsiz*0.8) + xwid = xsiz*0.8/cnum + endif + xl = xmid - xwid*cnum/2 + 'set string 0 tc 5' + vert = 0 + endif +* +* Plot colorbar +* + 'set strsiz 0.12 0.13' + num = 0 + say 'cnum = 'cnum + while (num= 0.0 .and. rdiag(imuse,i) <0.0) then - write(6,*) 'check 1' +! write(6,*) 'check 1' if(rdiag(iqc,i) <=7.0) then - write(6,*) 'check 2' +! write(6,*) 'check 2' ncount_gros(1)=ncount_gros(1)+1 - write(6,*) 'check 3' +! write(6,*) 'check 3' if(rdiag(iqc,i) >3.0 .and. rdiag(iqc,i) <=7.0) then - write(6,*) 'check 4' +! write(6,*) 'check 4' ncount_gros(2)=ncount_gros(2)+1 - write(6,*) 'check 5' +! write(6,*) 'check 5' endif else if(rdiag(iqc,i) >=8.0 ) then - write(6,*) 'check 6' +! write(6,*) 'check 6' if(rdiag(ierr,i) >tiny ) then - write(6,*) 'check 7' +! write(6,*) 'check 7' ddf=abs(rdiag(igos,i))*rdiag(ierr,i) - write(6,*) 'check 8' +! write(6,*) 'check 8' if(ddf read_q' + print *, ' ' + print *, ' nreal = ', nreal + print *, ' dtype = ', dtype + print *, ' fname = ', fname + print *, ' fileo = ', fileo + print *, ' gtross = ', gtross + print *, ' rlev = ', rlev + ncount = 0 + rpress = rmiss + ncount_vqc = 0 + ncount_gros = 0 + ntotal = 0 - ntotal=0 open(unit=11,file=fname,form='unformatted') rewind(11) + + read(11) nobs, nreal_in + print *, ' From file ', fname + print *, ' nobs = ', nobs + print *, ' nreal_in = ', nreal_in - read(11) nobs,nreal_in -! print *, 'nobs=',nobs + print *,'nreal_in, nreal = ',nreal_in, nreal if (nreal /= nreal_in) then - print *,'nreal_in,nreal ',nreal_in,nreal stop endif - allocate(rdiag(nreal,nobs)) + allocate( rdiag( nreal,nobs )) read(11) rdiag + close( 11 ) ilat=1 ! lat @@ -131,6 +146,9 @@ subroutine read_q(nreal,dtype,fname,fileo,gtross,rlev) print *, 'vqc-limit,vqc-limite ',vqclmt,vqclmte - call hist(dtype,rpress,3,3000000,ncount,rgtross,gtross,rlev,fileo,ncount_vqc,ncount_gros) + call hist(dtype,rpress,3,3000000,ncount,rgtross,gtross,rlev,fileo,ncount_vqc,ncount_gros, grads_info_file ) + +! print *, ' ' +! print *, '<-- read_q' return end diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_q/read_q_mor.f90 b/util/Conventional_Monitor/image_gen/sorc/conmon_read_q_IG.fd/read_q_mor.f90 similarity index 63% rename from util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_q/read_q_mor.f90 rename to util/Conventional_Monitor/image_gen/sorc/conmon_read_q_IG.fd/read_q_mor.f90 index 6a31566ff7..3dda5701c0 100644 --- a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_q/read_q_mor.f90 +++ b/util/Conventional_Monitor/image_gen/sorc/conmon_read_q_IG.fd/read_q_mor.f90 @@ -3,27 +3,39 @@ ! !---------------------------------------------------------- -subroutine read_q_mor(nreal,dtype,fname,fileo,gtross,rlev) +subroutine read_q_mor( nreal, dtype, fname, fileo, gtross, rlev, grads_info_file ) implicit none + integer, intent( in ) :: nreal + character*15, intent( in ) :: dtype + character*200, intent( in ) :: fname + character*50, intent( in ) :: fileo + real, intent( in ) :: gtross + character*50, intent( in ) :: grads_info_file + + real(4),allocatable,dimension(:,:) :: rdiag real(4),dimension(3,3000000) :: rpress integer,dimension(3) :: ncount,ncount_vqc,ncount_gros - character*200 fname - character*50 fileo - character*15 dtype - - real rgtross,gtross + real(4) :: rgtross - integer nobs,nreal,ntotal,ngross,nreal_in,nlev + integer nobs,ntotal,ngross,nreal_in,nlev integer i,nlat,nlon,npres,ntime,ndup integer ilat,ilon,ipres,itime,iqc,iuse,imuse,iweight,ierr,ierr2,ierr3,iobs,iogs,iqsges real(4) :: rmiss,vqclmt,vqclmte,rlev data rmiss/-999.0/ + print *, '---> read_q_mor' + print *, ' ' + print *, ' nreal = ', nreal + print *, ' dtype = ', dtype + print *, ' fname = ', fname + print *, ' fileo = ', fileo + print *, ' gtross = ', gtross + print *, ' rlev = ', rlev ncount=0 rpress=rmiss @@ -33,17 +45,25 @@ subroutine read_q_mor(nreal,dtype,fname,fileo,gtross,rlev) ntotal=0 open(unit=11,file=fname,form='unformatted') rewind(11) + read(11) nobs,nreal_in -! print *, 'nobs=',nobs + print *, ' From file ', fname + print *, ' nobs = ', nobs + print *, ' nreal = ', nreal + + + print *,'nreal_in, nreal = ', nreal_in, nreal if (nreal /= nreal_in) then - print *,'nreal_in,nreal ',nreal_in,nreal stop endif - allocate(rdiag(nreal,nobs)) + allocate( rdiag( nreal, nobs )) read(11) rdiag + close( 11 ) + + ilat=1 ! lat ilon=2 ! lon ipres=4 ! pressure @@ -75,14 +95,18 @@ subroutine read_q_mor(nreal,dtype,fname,fileo,gtross,rlev) rgtross=-gtross nlev=nint((gtross-rgtross)/rlev) - print *,nlev - print *,gtross, rgtross + print *, 'nlev = ', nlev + print *, 'gtross = ', gtross + print *, 'rgtross = ', rgtross do i=1,3 if(ncount(i) ==0) ncount(i)=1 enddo - call hist(dtype,rpress,3,3000000,ncount,rgtross,gtross,rlev,fileo,ncount_vqc,ncount_gros) + call hist(dtype,rpress,3,3000000,ncount,rgtross,gtross,rlev,fileo,ncount_vqc,ncount_gros, grads_info_file ) + +! print *, ' ' +! print *, '<--- read_q_mor ' - return + return end diff --git a/util/Conventional_Monitor/image_gen/sorc/conmon_read_q_IG.fd/rm_dups.f90 b/util/Conventional_Monitor/image_gen/sorc/conmon_read_q_IG.fd/rm_dups.f90 new file mode 100644 index 0000000000..8746404e8f --- /dev/null +++ b/util/Conventional_Monitor/image_gen/sorc/conmon_read_q_IG.fd/rm_dups.f90 @@ -0,0 +1,51 @@ +!------------------------------------------------------- +! rm_dups +! +! This subroutine removes duplicate data by comparing +! lat, lin, time, and pressure values. Differences +! of < 10.0e-5 are assumed to be matches. +!------------------------------------------------------- + +subroutine rm_dups( duparr, nn, mm, ilat, ilon, ipress, itime, iweight, nndup ) + + implicit none + + !------------- + ! interface + ! + real(4), intent(inout), dimension(mm,nn) :: duparr + integer, intent(in) :: nn, mm, ilat, ilon, ipress + integer, intent(in) :: itime, iweight + integer, intent(out) :: nndup + + !------------- + ! local vars + ! + integer ii, jj + real dlat, dlon, dtime, dpress, match + + data match / 10.0e-5 / + + + nndup=0 + do ii = 1, nn + do jj = ii+1, nn + + dlat = abs( duparr( ilat, ii) - duparr( ilat, jj )) + dlon = abs( duparr( ilon, ii) - duparr( ilon, jj )) + dtime = abs( duparr( itime, ii) - duparr( itime, jj )) + dpress = abs( duparr( ipress, ii) - duparr( ipress, jj )) + + if (dlat < match .and. dlon < match .and. dtime < match & + .and. dpress < match ) then + + duparr( iweight, ii )= -1.0 + nndup = nndup + 1 + + endif + enddo + enddo + + write(*,*) 'num dups found by rm_dups is ', nndup + return +end diff --git a/util/Conventional_Monitor/image_gen/sorc/conmon_read_t_IG.fd/CMakeLists.txt b/util/Conventional_Monitor/image_gen/sorc/conmon_read_t_IG.fd/CMakeLists.txt new file mode 100644 index 0000000000..9ae4052a0a --- /dev/null +++ b/util/Conventional_Monitor/image_gen/sorc/conmon_read_t_IG.fd/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 2.6) + file(GLOB CONMON_READ_T_IG_SRC ${CMAKE_CURRENT_SOURCE_DIR}/*90 ) + set(CONMON_READ_T_IG_Fortran_FLAGS "-fp-model strict -assume byterecl -convert big_endian -O3 -traceback -D_REAL8_ ") + set_source_files_properties( ${CONMON_READ_T_IG_SRC} PROPERTIES COMPILE_FLAGS ${CONMON_READ_T_IG_Fortran_FLAGS} ) + add_executable(conmon_read_t_IG.x ${CONMON_READ_T_IG_SRC} ) + set_target_properties( conmon_read_t_IG.x PROPERTIES COMPILE_FLAGS ${CONMON_READ_T_IG_Fortran_FLAGS} ) + include_directories( ${CORE_INCS} ${NCDIAG_INCS} ) + target_link_libraries( conmon_read_t_IG.x ${W3NCO_4_LIBRARY} ${NCDIAG_LIBRARIES} ${NETCDF_Fortran_LIBRARIES} ) + if(BUILD_W3NCO) + add_dependencies( conmon_read_t_IG.x ${W3NCO_4_LIBRARY} ) + endif() + diff --git a/util/Conventional_Monitor/image_gen/sorc/read_pw/convinfo.f90 b/util/Conventional_Monitor/image_gen/sorc/conmon_read_t_IG.fd/convinfo.f90 similarity index 60% rename from util/Conventional_Monitor/image_gen/sorc/read_pw/convinfo.f90 rename to util/Conventional_Monitor/image_gen/sorc/conmon_read_t_IG.fd/convinfo.f90 index 7824d24877..63a749f7a0 100644 --- a/util/Conventional_Monitor/image_gen/sorc/read_pw/convinfo.f90 +++ b/util/Conventional_Monitor/image_gen/sorc/conmon_read_t_IG.fd/convinfo.f90 @@ -4,23 +4,33 @@ ! This subroutine reads the conventional data (cnvstat) file. !------------------------------------------------------------------ -subroutine convinfo_read(dtype,idtype,insubtype,ituse,ntumgrp,ntgroup,ntmiter,isubtype,& - ttwind2,gtross2,etrmax2,etrmin2,vtar_b2,vtar_pg2) +subroutine convinfo_read( dtype, idtype, insubtype, ituse, ntumgrp, ntgroup, ntmiter, isubtype,& + ttwind2, gtross2, etrmax2, etrmin2, vtar_b2, vtar_pg2) implicit none + !-------------- + ! interface + ! + character(idtype), intent(in) :: dtype + integer, intent(in) :: idtype, insubtype + integer(4), intent(out) :: ituse, ntumgrp, ntgroup, ntmiter, isubtype + real(4), intent(out) :: ttwind2, gtross2, etrmax2, etrmin2, vtar_b2, vtar_pg2 + + + !-------------- + ! local vars + ! character(120):: crecord - character(7) :: obstype1 + character(7) :: obstype1 character(15) :: obstype - character(1) :: cflg - character(7):: iotype - integer idtype,insubtype - character(idtype) :: dtype + character(1) :: cflg + character(7) :: iotype - integer(4):: ittype,ituse,ntumgrp,ntgroup,ntmiter,isubtype + integer(4) :: ittype integer(4) :: lunin,ithin,npred,iflag - real(8) :: ttwind,gtross,etrmax,etrmin,vtar_b,vtar_pg,rmesh,pmesh - real(4) :: ttwind2,gtross2,etrmax2,etrmin2,vtar_b2,vtar_pg2 + real(8) :: ttwind,gtross,etrmax,etrmin,vtar_b,vtar_pg,rmesh,pmesh + lunin=11 @@ -38,7 +48,6 @@ subroutine convinfo_read(dtype,idtype,insubtype,ituse,ntumgrp,ntgroup,ntmiter,is write(obstype1,'(i3)') ittype obstype=trim(iotype)//trim(obstype1) -! print *,'obstype,dtype ',obstype,dtype if( trim(obstype) == trim(dtype) .and. isubtype == insubtype) then ttwind2=ttwind diff --git a/util/Conventional_Monitor/image_gen/sorc/read_t/histgram.f90 b/util/Conventional_Monitor/image_gen/sorc/conmon_read_t_IG.fd/histgram.f90 similarity index 64% rename from util/Conventional_Monitor/image_gen/sorc/read_t/histgram.f90 rename to util/Conventional_Monitor/image_gen/sorc/conmon_read_t_IG.fd/histgram.f90 index 81d429cb4a..8b27750279 100644 --- a/util/Conventional_Monitor/image_gen/sorc/read_t/histgram.f90 +++ b/util/Conventional_Monitor/image_gen/sorc/conmon_read_t_IG.fd/histgram.f90 @@ -4,24 +4,37 @@ ! This subroutine calculates the histogram of each data source. !---------------------------------------------------------------------------- -subroutine hist(mtype,rmodnbc,nchan,nxdata,ndata,rmin,rmax,rlev,fileo,ncount_vqc,ncount_gros) +subroutine hist(mtype,rmodnbc,nchan,nxdata,ndata,rmin,rmax,rlev,fileo,ncount_vqc,ncount_gros, grads_info_file ) implicit none - integer nxdata,nchan,nlev,i,j,k - real rlev,rmin,rmax,sqr2 + !-------------- + ! interface + ! + character*15, intent(in) :: mtype + real,dimension(nchan,nxdata), intent(in) :: rmodnbc + integer, intent(in) :: nchan,nxdata + integer,dimension(nchan), intent(in) :: ndata + real, intent(in) :: rmin,rmax,rlev + character*50, intent(in) :: fileo + integer,dimension(nchan), intent(in) :: ncount_vqc,ncount_gros + character*50, intent(in) :: grads_info_file + + + !-------------- + ! local vars + ! + integer nlev,i,j,k + real sqr2 - real,dimension(nchan,nxdata) :: rmodnbc real,dimension(nchan) :: rmean,rstd - integer,dimension(nchan) :: nmean,nobs,ndata,ncount_vqc,ncount_gros + integer,dimension(nchan) :: nmean,nobs real,dimension(nchan,400) :: ys real,dimension(400) :: xs real,dimension(401) :: xs2 real maxf - character*50 fileo - character*15 mtype sqr2=1.414213562 @@ -108,6 +121,30 @@ subroutine hist(mtype,rmodnbc,nchan,nxdata,ndata,rmin,rmax,rlev,fileo,ncount_vqc 200 format(a12,'no. std mean ') 210 format(3i10,2f10.3) + open( unit = 15, file = grads_info_file, form = 'formatted', status = 'new' ) + write( 15, * ) 'nlev = ', nlev + + write( 15, * ) 'all_ncount = ', nobs(1) + write( 15, * ) 'all_rejqc = ', ncount_vqc(1) + write( 15, * ) 'all_gros = ', ncount_gros(1) + write( 15, 220 ) 'all_std = ', rstd(1) + write( 15, 220 ) 'all_mean = ', rmean(1) + + write( 15, * ) 'ioqc_ncount = ', nobs(2) + write( 15, * ) 'ioqc_rejqc = ', ncount_vqc(2) + write( 15, * ) 'ioqc_gros = ', ncount_gros(2) + write( 15, 220 ) 'ioqc_std = ', rstd(2) + write( 15, 220 ) 'ioqc_mean = ', rmean(2) + + write( 15, * ) 'mon_ncount = ', nobs(3) + write( 15, * ) 'mon_rejqc = ', ncount_vqc(3) + write( 15, * ) 'mon_gros = ', ncount_gros(3) + write( 15, 220 ) 'mon_std = ', rstd(3) + write( 15, 220 ) 'mon_mean = ', rmean(3) +220 format( a14, f6.3 ) + + close( 15 ) + ! write(6,220) (xs(1,i),i=1,100) ! write(6,230) (ys(1,i),i=1,100) ! write(6,230) (f(1,i),i=1,100) diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_t/mainread_t.f90 b/util/Conventional_Monitor/image_gen/sorc/conmon_read_t_IG.fd/mainread_t.f90 similarity index 85% rename from util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_t/mainread_t.f90 rename to util/Conventional_Monitor/image_gen/sorc/conmon_read_t_IG.fd/mainread_t.f90 index 68b5ee4914..7769219a7a 100644 --- a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_t/mainread_t.f90 +++ b/util/Conventional_Monitor/image_gen/sorc/conmon_read_t_IG.fd/mainread_t.f90 @@ -6,7 +6,7 @@ implicit none character*200 fname - character*50 fileo + character*50 fileo, grads_info_file character*15 mtype integer nobs,nreal,ntotal,ngross,nreal_in,insubtype @@ -19,7 +19,7 @@ data rmiss/-999.0/ - namelist /input/nreal,mtype,fname,fileo,rlev,insubtype + namelist /input/nreal,mtype,fname,fileo,rlev,insubtype, grads_info_file read (5,input) @@ -37,8 +37,8 @@ ! print *,'ituse=',ituse,gtross - if (ituse >0) call read_t(nreal,mtype,fname,fileo,gtross,rlev) - if (ituse <0) call read_t_mor(nreal,mtype,fname,fileo,gtross,rlev) + if (ituse >0) call read_t(nreal,mtype,fname,fileo,gtross,rlev, grads_info_file ) + if (ituse <0) call read_t_mor(nreal,mtype,fname,fileo,gtross,rlev, grads_info_file ) stop end diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_t/makefile.read_t b/util/Conventional_Monitor/image_gen/sorc/conmon_read_t_IG.fd/makefile.read_t similarity index 96% rename from util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_t/makefile.read_t rename to util/Conventional_Monitor/image_gen/sorc/conmon_read_t_IG.fd/makefile.read_t index 9878c84897..f9318aed10 100644 --- a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_t/makefile.read_t +++ b/util/Conventional_Monitor/image_gen/sorc/conmon_read_t_IG.fd/makefile.read_t @@ -12,7 +12,7 @@ OBJS= mainread_t.o read_t.o read_t_mor.o histgram.o rm_dups.o convinfo.o -CMD= read_t.x +CMD= conmon_read_t_IG.x all: $(CMD) diff --git a/util/Conventional_Monitor/image_gen/sorc/read_t/read_t.f90 b/util/Conventional_Monitor/image_gen/sorc/conmon_read_t_IG.fd/read_t.f90 similarity index 86% rename from util/Conventional_Monitor/image_gen/sorc/read_t/read_t.f90 rename to util/Conventional_Monitor/image_gen/sorc/conmon_read_t_IG.fd/read_t.f90 index ad0112f131..3d1e0be9f7 100644 --- a/util/Conventional_Monitor/image_gen/sorc/read_t/read_t.f90 +++ b/util/Conventional_Monitor/image_gen/sorc/conmon_read_t_IG.fd/read_t.f90 @@ -2,31 +2,38 @@ ! subroutine read_t ! !-------------------------------------------------------------- -subroutine read_t(nreal,dtype,fname,fileo,gtross,rlev) +subroutine read_t(nreal,dtype,fname,fileo,gtross,rlev, grads_info_file ) implicit none - + + !------------- + ! interface + ! + integer, intent(in) :: nreal + character*4, intent(in) :: dtype + character*200, intent(in) :: fname + character*50, intent(in) :: fileo + real, intent(in) :: gtross, rlev + character*50, intent(in) :: grads_info_file + + + !------------- + ! local vars + ! real(4),allocatable,dimension(:,:) :: rdiag real(4),dimension(3,3000000) :: rpress integer,dimension(3) :: ncount,ncount_vqc,ncount_gros - character*200 fname - character*50 fileo - character*4 dtype - - real*4 tiny,huge,real - integer nobs,nreal,ntotal,ngross,nreal_in,nlev + real*4 tiny,real + integer nobs,ntotal,ngross,nreal_in,nlev integer nint,igos,ioges,i,j,ndup integer ilat,ilon,ipres,itime,iqc,iuse,imuse,iweight,ierr,ierr2,ierr3,iobs,iogs - real rlev,rgtross,gtross,ddf,weight + real rgtross,ddf,weight real(4) :: rmiss,vqclmt,vqclmte data rmiss/-999.0/ data tiny / 1.0e-6 / - data huge / 1.0e6 / - -! print *,'nreal=',nreal ncount=0 rpress=rmiss @@ -129,6 +136,6 @@ subroutine read_t(nreal,dtype,fname,fileo,gtross,rlev) print *, 'vqc-limit,vqc-limite ',vqclmt,vqclmte - call hist(dtype,rpress,3,3000000,ncount,rgtross,gtross,rlev,fileo,ncount_vqc,ncount_gros) + call hist(dtype,rpress,3,3000000,ncount,rgtross,gtross,rlev,fileo,ncount_vqc,ncount_gros, grads_info_file ) return end diff --git a/util/Conventional_Monitor/image_gen/sorc/read_t/read_t_mor.f90 b/util/Conventional_Monitor/image_gen/sorc/conmon_read_t_IG.fd/read_t_mor.f90 similarity index 77% rename from util/Conventional_Monitor/image_gen/sorc/read_t/read_t_mor.f90 rename to util/Conventional_Monitor/image_gen/sorc/conmon_read_t_IG.fd/read_t_mor.f90 index d48b1005b2..e9727b9c49 100644 --- a/util/Conventional_Monitor/image_gen/sorc/read_t/read_t_mor.f90 +++ b/util/Conventional_Monitor/image_gen/sorc/conmon_read_t_IG.fd/read_t_mor.f90 @@ -2,23 +2,34 @@ ! subroutine read_t_mor ! !------------------------------------------------------------- -subroutine read_t_mor(nreal,dtype,fname,fileo,gtross,rlev) +subroutine read_t_mor(nreal,dtype,fname,fileo,gtross,rlev, grads_info_file ) implicit none + + !------------- + ! interface + ! + integer, intent(in) :: nreal + character*15, intent(in) :: dtype + character*200, intent(in) :: fname + character*50, intent(in) :: fileo + real, intent(in) :: gtross + real(4), intent(in) :: rlev + character*50, intent(in) :: grads_info_file + + !------------- + ! local vars + ! real(4),allocatable,dimension(:,:) :: rdiag real(4),dimension(3,3000000) :: rpress integer,dimension(3) :: ncount,ncount_vqc,ncount_gros - character*200 fname - character*50 fileo - character*15 dtype - - integer nobs,nreal,ntotal,ngross,nreal_in,nlev + integer nobs,ntotal,ngross,nreal_in,nlev integer i,ndup,nlat,nlon,npres,ntime integer ilat,ilon,ipres,itime,iqc,iuse,imuse,iweight,ierr,ierr2,ierr3,iobs,iogs - real rgtross,gtross - real(4) :: rmiss,vqclmt,vqclmte,rlev + real rgtross + real(4) :: rmiss,vqclmt,vqclmte data rmiss/-999.0/ @@ -81,7 +92,7 @@ subroutine read_t_mor(nreal,dtype,fname,fileo,gtross,rlev) if(ncount(i) ==0) ncount(i)=1 enddo - call hist(dtype,rpress,3,3000000,ncount,rgtross,gtross,rlev,fileo,ncount_vqc,ncount_gros) + call hist(dtype,rpress,3,3000000,ncount,rgtross,gtross,rlev,fileo,ncount_vqc,ncount_gros, grads_info_file ) return end diff --git a/util/Conventional_Monitor/image_gen/sorc/conmon_read_t_IG.fd/rm_dups.f90 b/util/Conventional_Monitor/image_gen/sorc/conmon_read_t_IG.fd/rm_dups.f90 new file mode 100644 index 0000000000..8746404e8f --- /dev/null +++ b/util/Conventional_Monitor/image_gen/sorc/conmon_read_t_IG.fd/rm_dups.f90 @@ -0,0 +1,51 @@ +!------------------------------------------------------- +! rm_dups +! +! This subroutine removes duplicate data by comparing +! lat, lin, time, and pressure values. Differences +! of < 10.0e-5 are assumed to be matches. +!------------------------------------------------------- + +subroutine rm_dups( duparr, nn, mm, ilat, ilon, ipress, itime, iweight, nndup ) + + implicit none + + !------------- + ! interface + ! + real(4), intent(inout), dimension(mm,nn) :: duparr + integer, intent(in) :: nn, mm, ilat, ilon, ipress + integer, intent(in) :: itime, iweight + integer, intent(out) :: nndup + + !------------- + ! local vars + ! + integer ii, jj + real dlat, dlon, dtime, dpress, match + + data match / 10.0e-5 / + + + nndup=0 + do ii = 1, nn + do jj = ii+1, nn + + dlat = abs( duparr( ilat, ii) - duparr( ilat, jj )) + dlon = abs( duparr( ilon, ii) - duparr( ilon, jj )) + dtime = abs( duparr( itime, ii) - duparr( itime, jj )) + dpress = abs( duparr( ipress, ii) - duparr( ipress, jj )) + + if (dlat < match .and. dlon < match .and. dtime < match & + .and. dpress < match ) then + + duparr( iweight, ii )= -1.0 + nndup = nndup + 1 + + endif + enddo + enddo + + write(*,*) 'num dups found by rm_dups is ', nndup + return +end diff --git a/util/Conventional_Monitor/image_gen/sorc/conmon_read_uv_IG.fd/CMakeLists.txt b/util/Conventional_Monitor/image_gen/sorc/conmon_read_uv_IG.fd/CMakeLists.txt new file mode 100644 index 0000000000..e74138958c --- /dev/null +++ b/util/Conventional_Monitor/image_gen/sorc/conmon_read_uv_IG.fd/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 2.6) + file(GLOB CONMON_READ_UV_IG_SRC ${CMAKE_CURRENT_SOURCE_DIR}/*90 ) + set(CONMON_READ_UV_IG_Fortran_FLAGS "-fp-model strict -assume byterecl -convert big_endian -O3 -traceback -D_REAL8_ ") + set_source_files_properties( ${CONMON_READ_UV_IG_SRC} PROPERTIES COMPILE_FLAGS ${CONMON_READ_UV_IG_Fortran_FLAGS} ) + add_executable(conmon_read_uv_IG.x ${CONMON_READ_UV_IG_SRC} ) + set_target_properties( conmon_read_uv_IG.x PROPERTIES COMPILE_FLAGS ${CONMON_READ_UV_IG_Fortran_FLAGS} ) + include_directories( ${CORE_INCS} ${NCDIAG_INCS} ) + target_link_libraries( conmon_read_uv_IG.x ${W3NCO_4_LIBRARY} ${NCDIAG_LIBRARIES} ${NETCDF_Fortran_LIBRARIES} ) + if(BUILD_W3NCO) + add_dependencies( conmon_read_uv_IG.x ${W3NCO_4_LIBRARY} ) + endif() + diff --git a/util/Conventional_Monitor/image_gen/sorc/conmon_read_uv_IG.fd/convinfo.f90 b/util/Conventional_Monitor/image_gen/sorc/conmon_read_uv_IG.fd/convinfo.f90 new file mode 100644 index 0000000000..63a749f7a0 --- /dev/null +++ b/util/Conventional_Monitor/image_gen/sorc/conmon_read_uv_IG.fd/convinfo.f90 @@ -0,0 +1,67 @@ +!------------------------------------------------------------------ +! convinfo_read +! +! This subroutine reads the conventional data (cnvstat) file. +!------------------------------------------------------------------ + +subroutine convinfo_read( dtype, idtype, insubtype, ituse, ntumgrp, ntgroup, ntmiter, isubtype,& + ttwind2, gtross2, etrmax2, etrmin2, vtar_b2, vtar_pg2) + + implicit none + + !-------------- + ! interface + ! + character(idtype), intent(in) :: dtype + integer, intent(in) :: idtype, insubtype + integer(4), intent(out) :: ituse, ntumgrp, ntgroup, ntmiter, isubtype + real(4), intent(out) :: ttwind2, gtross2, etrmax2, etrmin2, vtar_b2, vtar_pg2 + + + !-------------- + ! local vars + ! + character(120):: crecord + character(7) :: obstype1 + character(15) :: obstype + character(1) :: cflg + character(7) :: iotype + + integer(4) :: ittype + integer(4) :: lunin,ithin,npred,iflag + real(8) :: ttwind,gtross,etrmax,etrmin,vtar_b,vtar_pg,rmesh,pmesh + + + lunin=11 + + open(lunin,file='convinfo',form='formatted') + rewind(lunin) + + loopd: do + read(lunin,1030,IOSTAT=iflag)cflg,iotype,crecord + + if(cflg == '!') cycle + if( iflag /= 0 ) exit loopd + + read(crecord,*)ittype,isubtype,ituse,ttwind,ntumgrp,ntgroup,ntmiter,& + gtross,etrmax,etrmin,vtar_b,vtar_pg,ithin,rmesh,pmesh,npred + write(obstype1,'(i3)') ittype + + obstype=trim(iotype)//trim(obstype1) + + if( trim(obstype) == trim(dtype) .and. isubtype == insubtype) then + ttwind2=ttwind + gtross2=gtross + etrmax2=etrmax + etrmin2=etrmin + vtar_b2=vtar_b + vtar_pg2=vtar_pg + exit + endif + + enddo loopd + +1030 format(a1,a7,2x,a120) + + return +end diff --git a/util/Conventional_Monitor/image_gen/sorc/conmon_read_uv_IG.fd/histgram.f90 b/util/Conventional_Monitor/image_gen/sorc/conmon_read_uv_IG.fd/histgram.f90 new file mode 100644 index 0000000000..bf4bb61e19 --- /dev/null +++ b/util/Conventional_Monitor/image_gen/sorc/conmon_read_uv_IG.fd/histgram.f90 @@ -0,0 +1,160 @@ +!---------------------------------------------------------------------------- +! subroutine hist +! +! This subroutine calculates the histogram of each data source. +!---------------------------------------------------------------------------- + +subroutine hist( mtype, rmodnbc, nchan, nxdata, ndata, rmin, rmax, rlev, & + fileo, ncount_vqc, ncount_gros, grads_info_file ) + + implicit none + + !-------------- + ! interface + ! + character*15, intent(in) :: mtype + real,dimension(nchan,nxdata), intent(in) :: rmodnbc + integer, intent(in) :: nchan,nxdata + integer,dimension(nchan), intent(in) :: ndata + real, intent(in) :: rmin,rmax,rlev + character*50, intent(in) :: fileo + integer,dimension(nchan), intent(in) :: ncount_vqc,ncount_gros + character*50, intent(in) :: grads_info_file + + !-------------- + ! local vars + ! + integer nlev,i,j,k + real sqr2 + + real,dimension(nchan) :: rmean,rstd + integer,dimension(nchan) :: nmean,nobs + + real,dimension(nchan,400) :: ys + real,dimension(400) :: xs + real,dimension(401) :: xs2 + real maxf + + + sqr2=1.414213562 + + nlev=(rmax-rmin)/rlev + + if(nlev >400) then + print *,' too many bins, exceeding 400' + return + endif + + xs(1)=rmin+rlev/2.0 + xs2(1)=rmin + + print *, 'nlev=',nlev + print *, 'nobs=',ndata(1),ndata(2),ndata(3) + + do i=2,nlev + xs(i)=xs(i-1)+rlev + xs2(i)=xs2(i-1)+rlev + end do + + xs2(nlev+1)=xs2(nlev)+rlev + + do i=1,nlev + do j=1,nchan + ys(j,i)=0.0 + enddo + enddo + + do k=1,nchan + if(ndata(k) >1) then + do i=1, ndata(k) + do j=1,nlev + if( rmodnbc(k,i) >=xs2(j) .and. & + rmodnbc(k,i) 1) then + do i=1,ndata(j) + if(rmodnbc(j,i) >=rmin .and. rmodnbc(j,i) <=rmax) then + rmean(j)=rmean(j)+rmodnbc(j,i) + rstd(j)=rstd(j)+rmodnbc(j,i)*rmodnbc(j,i) + nobs(j)=nobs(j)+1 + endif + enddo + endif + enddo + + do j=1,nchan + if(nobs(j) >0) then + if(nobs(j)==1) then + rstd(j)=rstd(j)-rmean(j)*rmean(j)/nobs(j) + rmean(j)=rmean(j)/nobs(j) + rstd(j)=0.0 + else + rstd(j)=rstd(j)-rmean(j)*rmean(j)/nobs(j) + rmean(j)=rmean(j)/nobs(j) + rstd(j)=sqrt(abs(rstd(j))/(nobs(j)-1)) + endif + endif + enddo + + + + write(6,200) mtype + do j=1,nchan + write(6,210) nobs(j),ncount_vqc(j),ncount_gros(j),rstd(j),rmean(j) + enddo + +200 format(a12,'no. std mean ') +210 format(3i10,2f10.3) + + open( unit = 15, file = grads_info_file, form = 'formatted', status = 'new' ) + write( 15, * ) 'nlev = ', nlev + + write( 15, * ) 'all_ncount = ', nobs(1) + write( 15, * ) 'all_rejqc = ', ncount_vqc(1) + write( 15, * ) 'all_gros = ', ncount_gros(1) + write( 15, 220 ) 'all_std = ', rstd(1) + write( 15, 220 ) 'all_mean = ', rmean(1) + + write( 15, * ) 'ioqc_ncount = ', nobs(2) + write( 15, * ) 'ioqc_rejqc = ', ncount_vqc(2) + write( 15, * ) 'ioqc_gros = ', ncount_gros(2) + write( 15, 220 ) 'ioqc_std = ', rstd(2) + write( 15, 220 ) 'ioqc_mean = ', rmean(2) + + write( 15, * ) 'mon_ncount = ', nobs(3) + write( 15, * ) 'mon_rejqc = ', ncount_vqc(3) + write( 15, * ) 'mon_gros = ', ncount_gros(3) + write( 15, 220 ) 'mon_std = ', rstd(3) + write( 15, 220 ) 'mon_mean = ', rmean(3) +220 format( a14, f6.3 ) + + close( 15 ) + + open (10,file=fileo,form='unformatted',access='direct',recl=nlev*4) + + write(10,rec=1) (xs(i),i=1,nlev) + do j=1,nchan + write(10,rec=2+j-1) (ys(j,i),i=1,nlev) + enddo + + close(10) + + + return +end + diff --git a/util/Conventional_Monitor/image_gen/sorc/read_uv/histgramuv.f90 b/util/Conventional_Monitor/image_gen/sorc/conmon_read_uv_IG.fd/histgramuv.f90 similarity index 50% rename from util/Conventional_Monitor/image_gen/sorc/read_uv/histgramuv.f90 rename to util/Conventional_Monitor/image_gen/sorc/conmon_read_uv_IG.fd/histgramuv.f90 index 46390d27a4..cb0b0feaf6 100644 --- a/util/Conventional_Monitor/image_gen/sorc/read_uv/histgramuv.f90 +++ b/util/Conventional_Monitor/image_gen/sorc/conmon_read_uv_IG.fd/histgramuv.f90 @@ -3,27 +3,47 @@ ! !----------------------------------------------------------------- -subroutine histuv(dtype,rmodnbc,nchan,nxdata,ndata,rmin,rmax,rlev,fileo,ncount_vqc,ncount_gros,fileo2) +subroutine histuv( dtype, rmodnbc, nchan, nxdata, ndata, rmin, rmax, & + rlev, fileo, ncount_vqc, ncount_gros, fileo2, wind ) implicit none - real,dimension(nchan,nxdata) :: rmodnbc + !------------- + ! inteface + ! + character*15, intent(in) :: dtype + real,dimension(nchan,nxdata), intent(in) :: rmodnbc + integer, intent(in) :: nchan + integer, intent(in) :: nxdata + real, intent(in) :: rmin, rmax, rlev + character*50, intent(in) :: fileo + integer,dimension(nchan), intent(in) :: ncount_vqc,ncount_gros + character*50, intent(in) :: fileo2 + character*1, intent(in) :: wind ! u or v + + !------------- + ! local vars + ! real,dimension(nchan) :: rmean,rstd - integer,dimension(nchan) :: nmean,nobs,ndata,ncount_vqc,ncount_gros + integer,dimension(nchan) :: nmean,nobs,ndata + integer i,j,k,nlev real,dimension(nchan,400) :: ys real,dimension(400) :: xs real,dimension(401) :: xs2 real maxf,sqr2 - real rmin, rmax,rlev - character*50 fileo - character*50 fileo2 - character*15 dtype + character*20 :: grads_info_file - integer i,j,k,nlev,nxdata,nchan + print *, '--> histuv' + print *, 'dtype = ', dtype + print *, 'fileo = ', fileo + print *, 'fileo2 = ', fileo2 + + grads_info_file='grads_info_' // wind + sqr2=1.414213562 nlev=(rmax-rmin)/rlev @@ -32,9 +52,9 @@ subroutine histuv(dtype,rmodnbc,nchan,nxdata,ndata,rmin,rmax,rlev,fileo,ncount_v open (11,file=fileo2,form='formatted') - write(11,100) nlev - -100 format(i5) + write(11,100) 'nlev=', nlev + +100 format(A,i5) write(11,110) ndata(1),ndata(2),ndata(3) @@ -100,7 +120,6 @@ subroutine histuv(dtype,rmodnbc,nchan,nxdata,ndata,rmin,rmax,rlev,fileo,ncount_v enddo ! the frequency of real curve -! print *, 'data type no. std, mean ,rarea ',dtype,ndata,rstd,rmean,rarea write(11,200) dtype do j=1,nchan write(11,210) nobs(j),ncount_vqc(j),ncount_gros(j),rstd(j),rmean(j) @@ -109,14 +128,41 @@ subroutine histuv(dtype,rmodnbc,nchan,nxdata,ndata,rmin,rmax,rlev,fileo,ncount_v 200 format(a12,'no. std mean ') 210 format(3i10,2f10.3) -! write(6,220) (xs(1,i),i=1,100) -! write(6,230) (ys(1,i),i=1,100) -! write(6,230) (f(1,i),i=1,100) -!220 format(6e12.4) -!230 format(6e12.5) + open( unit = 15, file = grads_info_file, form = 'formatted', status = 'new' ) + write( 15, * ) 'nlev = ', nlev + + write( 15, * ) 'all_ncount = ', nobs(1) + write( 15, * ) 'all_rejqc = ', ncount_vqc(1) + write( 15, * ) 'all_gros = ', ncount_gros(1) + write( 15, 220 ) 'all_std = ', rstd(1) + write( 15, 220 ) 'all_mean = ', rmean(1) + + write( 15, * ) 'ioqc_ncount = ', nobs(2) + write( 15, * ) 'ioqc_rejqc = ', ncount_vqc(2) + write( 15, * ) 'ioqc_gros = ', ncount_gros(2) + write( 15, 220 ) 'ioqc_std = ', rstd(2) + write( 15, 220 ) 'ioqc_mean = ', rmean(2) -! trasform the frequecy so that gaussin distribution became a stright line + write( 15, * ) 'mon_ncount = ', nobs(3) + write( 15, * ) 'mon_rejqc = ', ncount_vqc(3) + write( 15, * ) 'mon_gros = ', ncount_gros(3) + write( 15, 220 ) 'mon_std = ', rstd(3) + write( 15, 220 ) 'mon_mean = ', rmean(3) +220 format( a14, f6.3 ) + + close( 15 ) + + +!!-------------------------------------------------------- +!! NOTE: This section was commented out when +!! I took over maintenance of the ConMon. I'm +!! intentionally leaving this in place in case +!! transforming the frequency becomes desirable +!! at some point. Knowing how to do that might +!! prove useful. +!!-------------------------------------------------------- +! transform the frequecy so that gaussin distribution became a stright line ! print *, 'maxf ',maxf ! do i=1,nlev @@ -129,7 +175,7 @@ subroutine histuv(dtype,rmodnbc,nchan,nxdata,ndata,rmin,rmax,rlev,fileo,ncount_v ! enddo open (10,file=fileo,form='unformatted',access='direct',recl=nlev*4) - + write(10,rec=1) (xs(i),i=1,nlev) do j=1,nchan write(10,rec=2+j-1) (ys(j,i),i=1,nlev) @@ -138,6 +184,7 @@ subroutine histuv(dtype,rmodnbc,nchan,nxdata,ndata,rmin,rmax,rlev,fileo,ncount_v close(10) close(11) + print *, '<-- histuv' return end diff --git a/util/Conventional_Monitor/image_gen/sorc/conmon_read_uv_IG.fd/mainread_uv.f90 b/util/Conventional_Monitor/image_gen/sorc/conmon_read_uv_IG.fd/mainread_uv.f90 new file mode 100644 index 0000000000..cede5a34eb --- /dev/null +++ b/util/Conventional_Monitor/image_gen/sorc/conmon_read_uv_IG.fd/mainread_uv.f90 @@ -0,0 +1,48 @@ +!-------------------------------------------------------------- +! program mainread_uv +! +!-------------------------------------------------------------- + + implicit none + + character*200 fname + character*50 fileo, grads_info_file + character*15 mtype + + real rpress,rlev + + integer nobs,nreal,ntotal,ngross,nreal_in,insubtype + integer(4):: ittype,ituse,ntumgrp,ntgroup,ntmiter,iflag + integer isubtype,ncount,ncount_vgc,ncount_gros + + real(4) :: ttwind,gtross,etrmax,etrmin,vtar_b,vtar_pg + real(4) :: rmiss,vqclmt,vqclmte + + data rmiss/-999.0/ + + namelist /input/ nreal, mtype, fname, fileo, rlev, insubtype, grads_info_file + + read (5,input) + write(6,input) + + ncount=0 + rpress=rmiss + ncount_vgc=0 + ncount_gros=0 + + print *,'mtype, nreal = ', mtype,nreal + + call convinfo_read( mtype, 15, insubtype, ituse, ntumgrp, ntgroup, ntmiter, isubtype,& + ttwind, gtross, etrmax, etrmin, vtar_b, vtar_pg) + + print *, 'ituse, gtross =',ituse,gtross + print *, 'ntumgrp, ntgroup = ', ntumgrp, ntgroup + print *, 'ntmiter = ', ntmiter + print *, 'ttwind = ', ttwind + print *, 'isubtype = ', isubtype + + if (ituse >0) call read_uv( nreal, mtype, fname, fileo, gtross, rlev, grads_info_file ) + if (ituse <0) call read_uv_mor( nreal, mtype, fname, fileo, gtross, rlev, grads_info_file ) + + stop +end diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_uv/makefile.read_uv b/util/Conventional_Monitor/image_gen/sorc/conmon_read_uv_IG.fd/makefile.read_uv similarity index 96% rename from util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_uv/makefile.read_uv rename to util/Conventional_Monitor/image_gen/sorc/conmon_read_uv_IG.fd/makefile.read_uv index 342dd31cc4..56bfb33fce 100755 --- a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_uv/makefile.read_uv +++ b/util/Conventional_Monitor/image_gen/sorc/conmon_read_uv_IG.fd/makefile.read_uv @@ -11,7 +11,7 @@ SRCS= mainread_uv.f90 read_uv.f90 read_uv_mor.f90 histgram.f90 histgramu OBJS= mainread_uv.o read_uv.o read_uv_mor.o histgram.o histgramuv.o rm_dups.o convinfo.o -CMD= read_uv.x +CMD= conmon_read_uv_IG.x all: $(CMD) diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_uv/read_uv.f90 b/util/Conventional_Monitor/image_gen/sorc/conmon_read_uv_IG.fd/read_uv.f90 similarity index 69% rename from util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_uv/read_uv.f90 rename to util/Conventional_Monitor/image_gen/sorc/conmon_read_uv_IG.fd/read_uv.f90 index d954472fd8..80da36ae84 100644 --- a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_uv/read_uv.f90 +++ b/util/Conventional_Monitor/image_gen/sorc/conmon_read_uv_IG.fd/read_uv.f90 @@ -4,24 +4,34 @@ ! read wind files !===================================== -subroutine read_uv(nreal,dtype,fname,fileo,gtross,rlev) +subroutine read_uv( nreal, dtype, fname, fileo, gtross, rlev, grads_info_file ) implicit none - + + !-------------- + ! interface + ! + integer, intent(in) :: nreal + character*15, intent(in) :: dtype + character*200, intent(in) :: fname + character*50, intent(in) :: fileo + real, intent(in) :: gtross, rlev + character*50, intent(in) :: grads_info_file + + !-------------- + ! local vars + ! real(4),allocatable,dimension(:,:) :: rdiag - real(4),dimension(3,3000000) :: rpressu - real(4),dimension(3,3000000) :: rpressv - real(4),dimension(3,3000000) :: rpress - integer,dimension(3) :: ncount,ncount_vqc,ncount_gros - - character*200 fname - character*50 fileo,fileu,filev,fileou2,fileov2 - character*15 dtype + real(4),dimension(3,3000000) :: rpressu + real(4),dimension(3,3000000) :: rpressv + real(4),dimension(3,3000000) :: rpress + integer,dimension(3) :: ncount,ncount_vqc,ncount_gros - real*4 tiny,huge,real - real weight,ddf,rlev,rgtross,gtross + character*50 fileu,filev,fileou2,fileov2 + real*4 tiny + real weight,ddf,rgtross - integer nobs,nreal,ntotal,ngross,nreal_in,nlev + integer nobs,ntotal,ngross,nreal_in,nlev integer i,ndup integer ilat,ilon,ipres,itime,iqc,iuse,imuse,iweight,ierr,ierr2,ierr3,iobu,iogu,iobv,iogv @@ -30,21 +40,16 @@ subroutine read_uv(nreal,dtype,fname,fileo,gtross,rlev) data bmiss/-999.0/ - fileu=trim(fileo)//'_u' - filev=trim(fileo)//'_v' - fileou2='stdout_u' - fileov2='stdout_v' + fileu = 'out_u' + filev = 'out_v' + fileou2 = 'stdout_u' + fileov2 = 'stdout_v' - -! print *,'nreal=',nreal - ncount=0 rpress=bmiss ncount_vqc=0 ncount_gros=0 tiny=1.0e-6 - huge=1.0e6 - ntotal=0 open(unit=11,file=fname,form='unformatted') @@ -60,7 +65,7 @@ subroutine read_uv(nreal,dtype,fname,fileo,gtross,rlev) read(11) rdiag - ilat=1 ! lat + ilat=1 ! lat ilon=2 ! lon ipres=4 ! pressure itime=6 ! relative time @@ -76,8 +81,9 @@ subroutine read_uv(nreal,dtype,fname,fileo,gtross,rlev) iobv=18 ! v obs iogv=19 ! v obs-ges - - call rm_dups( rdiag,nobs,nreal,ilat,ilon,ipres,itime,iweight,ndup ) + + print *, 'nobs, nreal = ', nobs, nreal + call rm_dups( rdiag, nobs, nreal, ilat, ilon, ipres, itime, iweight, ndup ) do i=1,nobs if( rdiag(iweight,i) >= 0.0 .and. rdiag(imuse,i) >0.0 ) then @@ -142,15 +148,14 @@ subroutine read_uv(nreal,dtype,fname,fileo,gtross,rlev) nlev=nint((gtross-rgtross)/rlev) nlev=nlev - print *,nlev - print *, 'rmax,rmin ',gtross,rgtross - print *, 'ncount_gros,',ncount_gros(1),ncount_gros(2),ncount_gros(3) - print *, 'vqc-limit,vqc-limite ',vqclmt,vqclmte - - - call hist(dtype,rpress,3,3000000,ncount,rgtross,gtross,rlev,fileo,ncount_vqc,ncount_gros) - call histuv(dtype,rpressu,3,3000000,ncount,rgtross,gtross,rlev,fileu,ncount_vqc,ncount_gros,fileou2) - call histuv(dtype,rpressv,3,3000000,ncount,rgtross,gtross,rlev,filev,ncount_vqc,ncount_gros,fileov2) + print *, 'nlev = ', nlev + print *, 'gtross, rgtross = ', gtross, rgtross + print *, 'ncount_gros = ', ncount_gros(1), ncount_gros(2), ncount_gros(3) + print *, 'vqclmt, vqclmte = ', vqclmt, vqclmte + + call hist( dtype, rpress, 3, 3000000, ncount, rgtross, gtross, rlev, fileo, ncount_vqc, ncount_gros, grads_info_file ) + call histuv( dtype, rpressu, 3, 3000000, ncount, rgtross, gtross, rlev, fileu, ncount_vqc, ncount_gros, fileou2, 'u' ) + call histuv( dtype, rpressv, 3, 3000000, ncount, rgtross, gtross, rlev, filev, ncount_vqc, ncount_gros, fileov2, 'v' ) return diff --git a/util/Conventional_Monitor/image_gen/sorc/read_uv/read_uv_mor.f90 b/util/Conventional_Monitor/image_gen/sorc/conmon_read_uv_IG.fd/read_uv_mor.f90 similarity index 74% rename from util/Conventional_Monitor/image_gen/sorc/read_uv/read_uv_mor.f90 rename to util/Conventional_Monitor/image_gen/sorc/conmon_read_uv_IG.fd/read_uv_mor.f90 index 7e39bdcd1c..369615b5c0 100644 --- a/util/Conventional_Monitor/image_gen/sorc/read_uv/read_uv_mor.f90 +++ b/util/Conventional_Monitor/image_gen/sorc/conmon_read_uv_IG.fd/read_uv_mor.f90 @@ -2,25 +2,37 @@ ! subroutine read_uv_mor ! !------------------------------------------------------------- -subroutine read_uv_mor(nreal,dtype,fname,fileo,gtross,rlev) +subroutine read_uv_mor( nreal, dtype, fname, fileo, gtross, rlev, grads_info_file ) implicit none + !------------- + ! interface + ! + integer, intent(in) :: nreal + character*15, intent(in) :: dtype + character*200, intent(in) :: fname + character*50, intent(in) :: fileo + real, intent(in) :: gtross + real(4), intent(in) :: rlev + character*50, intent(in) :: grads_info_file + + !------------- + ! local vars + ! real(4),allocatable,dimension(:,:) :: rdiag real(4),dimension(3,3000000) :: rpress real(4),dimension(3,3000000) :: rpressu real(4),dimension(3,3000000) :: rpressv integer,dimension(3) :: ncount,ncount_vqc,ncount_gros - character*200 fname - character*50 fileo,fileu,filev,fileou2,fileov2 - character*15 dtype + character*50 fileu,filev,fileou2,fileov2 - real rgtross,gtross - integer nobs,nreal,ntotal,ngross,nreal_in,nlev + real rgtross + integer nobs,ntotal,ngross,nreal_in,nlev integer i,ndup,nlat,nlon,npres,ntime integer ilat,ilon,ipres,itime,iqc,iuse,imuse,iweight,ierr,ierr2,ierr3,iobu,iogu,iobv,iogv - real(4) :: rmiss,vqclmt,vqclmte,rlev + real(4) :: rmiss,vqclmt,vqclmte data rmiss/-999.0/ @@ -28,17 +40,17 @@ subroutine read_uv_mor(nreal,dtype,fname,fileo,gtross,rlev) rpress=rmiss ncount_vqc=0 ncount_gros=0 - fileu=trim(fileo)//'_u' - filev=trim(fileo)//'_v' - fileou2='stdout_u' - fileov2='stdout_v' + + fileu = 'out_u' + filev = 'out_v' + fileou2 = 'stdout_u' + fileov2 = 'stdout_v' ntotal=0 open(unit=11,file=fname,form='unformatted') rewind(11) read(11) nobs,nreal_in -! print *, 'nobs=',nobs if (nreal /= nreal_in) then print *,'nreal_in,nreal ',nreal_in,nreal @@ -91,9 +103,11 @@ subroutine read_uv_mor(nreal,dtype,fname,fileo,gtross,rlev) if(ncount(i) ==0) ncount(i)=1 enddo - call hist(dtype,rpress,3,3000000,ncount,rgtross,gtross,rlev,fileo,ncount_vqc,ncount_gros) - call histuv(dtype,rpressu,3,3000000,ncount,rgtross,gtross,rlev,fileu,ncount_vqc,ncount_gros,fileou2) - call histuv(dtype,rpressv,3,3000000,ncount,rgtross,gtross,rlev,filev,ncount_vqc,ncount_gros,fileov2) + print *, 'fileu, filev = ', fileu, filev + + call hist(dtype,rpress,3,3000000,ncount,rgtross,gtross,rlev,fileo,ncount_vqc,ncount_gros, grads_info_file ) + call histuv(dtype,rpressu,3,3000000,ncount,rgtross,gtross,rlev,fileu,ncount_vqc,ncount_gros,fileou2, 'u' ) + call histuv(dtype,rpressv,3,3000000,ncount,rgtross,gtross,rlev,filev,ncount_vqc,ncount_gros,fileov2, 'v' ) return end diff --git a/util/Conventional_Monitor/image_gen/sorc/conmon_read_uv_IG.fd/rm_dups.f90 b/util/Conventional_Monitor/image_gen/sorc/conmon_read_uv_IG.fd/rm_dups.f90 new file mode 100644 index 0000000000..8746404e8f --- /dev/null +++ b/util/Conventional_Monitor/image_gen/sorc/conmon_read_uv_IG.fd/rm_dups.f90 @@ -0,0 +1,51 @@ +!------------------------------------------------------- +! rm_dups +! +! This subroutine removes duplicate data by comparing +! lat, lin, time, and pressure values. Differences +! of < 10.0e-5 are assumed to be matches. +!------------------------------------------------------- + +subroutine rm_dups( duparr, nn, mm, ilat, ilon, ipress, itime, iweight, nndup ) + + implicit none + + !------------- + ! interface + ! + real(4), intent(inout), dimension(mm,nn) :: duparr + integer, intent(in) :: nn, mm, ilat, ilon, ipress + integer, intent(in) :: itime, iweight + integer, intent(out) :: nndup + + !------------- + ! local vars + ! + integer ii, jj + real dlat, dlon, dtime, dpress, match + + data match / 10.0e-5 / + + + nndup=0 + do ii = 1, nn + do jj = ii+1, nn + + dlat = abs( duparr( ilat, ii) - duparr( ilat, jj )) + dlon = abs( duparr( ilon, ii) - duparr( ilon, jj )) + dtime = abs( duparr( itime, ii) - duparr( itime, jj )) + dpress = abs( duparr( ipress, ii) - duparr( ipress, jj )) + + if (dlat < match .and. dlon < match .and. dtime < match & + .and. dpress < match ) then + + duparr( iweight, ii )= -1.0 + nndup = nndup + 1 + + endif + enddo + enddo + + write(*,*) 'num dups found by rm_dups is ', nndup + return +end diff --git a/util/Conventional_Monitor/image_gen/sorc/read_ps/mainread_ps.f90 b/util/Conventional_Monitor/image_gen/sorc/read_ps/mainread_ps.f90 deleted file mode 100644 index cb0952bf9a..0000000000 --- a/util/Conventional_Monitor/image_gen/sorc/read_ps/mainread_ps.f90 +++ /dev/null @@ -1,51 +0,0 @@ -!----------------------------------------------------------------------------- -! mainread_ps -! -! This program reads the conventional data and converts it into a GrADS -! data file. -!----------------------------------------------------------------------------- - - - implicit none - - character*200 fname - character*50 fileo - character*15 mtype,dtype - -! real*4 tiny,huge,real - integer nreal,insubtype - - integer(4):: ituse,ntumgrp,ntgroup,ntmiter - integer ncount,ncount_vgc,ncount_gros,isubtype - - real(4) :: ttwind,gtross,etrmax,etrmin,vtar_b,vtar_pg - real rlev,rpress - - real(4) :: rmiss,vqclmt,vqclmte - - data rmiss/-999.0/ - - namelist /input/nreal,mtype,fname,fileo,rlev,insubtype - - - read (5,input) - write(6,input) - - ncount = 0 - rpress = rmiss - ncount_vgc = 0 - ncount_gros = 0 - -! print *,mtype,nreal - - call convinfo_read(mtype,15,insubtype,ituse,ntumgrp,ntgroup,ntmiter,isubtype,& - ttwind,gtross,etrmax,etrmin,vtar_b,vtar_pg) - -! print *,'ituse=',ituse,gtross - write(6, *) 'ituse, gtross = ', ituse, gtross - - if (ituse >0) call read_ps(nreal,mtype,fname,fileo,gtross,rlev) - if (ituse <0) call read_ps_mor(nreal,mtype,fname,fileo,gtross,rlev) - - stop -end diff --git a/util/Conventional_Monitor/image_gen/sorc/read_ps/read_ps.f90 b/util/Conventional_Monitor/image_gen/sorc/read_ps/read_ps.f90 deleted file mode 100644 index 129b73ffce..0000000000 --- a/util/Conventional_Monitor/image_gen/sorc/read_ps/read_ps.f90 +++ /dev/null @@ -1,146 +0,0 @@ -!------------------------------------------------ -! subroutine read_ps -! -!------------------------------------------------ -subroutine read_ps(nreal,mtype,fname,fileo,gtross,rlev) - - implicit none - - real(4),allocatable,dimension(:,:) :: rdiag - real(4),dimension(3,3000000) :: rpress - real rlev,weight,rgtross,gtross,ddf - integer,dimension(3) :: ncount,ncount_vqc,ncount_gros - integer ilat,ilon,ipres,itime,iqc,iuse,imuse,iweight,ierr,ierr2,ierr3,iobs,iogs - integer i,ndup,igos,ioges - - character*200 fname - character*50 fileo - character*15 mtype - -! real*4 tiny,huge - real(4) :: tiny,huge - integer nobs,nreal,ntotal,ngross,nreal_in,nlev - real(4) :: rmiss,vqclmt,vqclmte - - data rmiss/-999.0/ - data tiny / 1.0e-6 / - data huge / 1.0e6 / - - ncount=0 - rpress=rmiss - ncount_vqc=0 - ncount_gros=0 -! tiny=1.0e-6 -! huge=1.0e6 - - ntotal=0 - open(unit=11,file=fname,form='unformatted') - rewind(11) - read(11) nobs,nreal_in -! print *, 'nobs=',nobs - write(6,*) 'nobs = ', nobs - - if (nreal /= nreal_in) then - print *,'nreal_in,nreal ',nreal_in,nreal - stop - endif - - allocate(rdiag(nreal,nobs)) - read(11) rdiag - - - ilat=1 ! lat - ilon=2 ! lon - ipres=4 ! pressure - itime=6 ! relative time - iqc=7 ! qc flag - iuse=9 ! original data usage flag - imuse=10 ! data usage flag in the analsis - iweight=11 ! variational relative weight - ierr=12 ! original error from bufr error table - ierr2=13 ! error from read_bufr - ierr3=14 ! error from final adjusted - iobs=15 ! obs - iogs=16 ! obs-ges - - - !-------------------------- - ! rm duplicate data - ! - call rm_dups( rdiag,nobs,nreal,ilat,ilon,ipres,itime,iweight,ndup ) - - do i=1,nobs - if( rdiag(iweight,i) >= 0.0 .and. rdiag(imuse,i) >0.0 ) then - ncount(1)=ncount(1)+1 - rpress(1,ncount(1))=rdiag(iogs,i)*rdiag(ierr,i) - weight=rdiag(iweight,i) - if(weight <1.0) then - ncount_vqc(1)=ncount_vqc(1)+1 - vqclmt=vqclmt+abs(rdiag(ioges,i))*rdiag(ierr,i) - endif - - if(rdiag(iqc,i) >=4.0) then - ncount(2)=ncount(2)+1 - if(weight <1.0) then - ncount_vqc(2)=ncount_vqc(2)+1 - endif - rpress(2,ncount(2))=rdiag(iogs,i)*rdiag(ierr,i) - endif - - else if(rdiag(iweight,i) >= 0.0 .and. rdiag(imuse,i) <0.0) then - write(6,*) 'check 1' - if(rdiag(iqc,i) <=7.0) then - write(6,*) 'check 2' - ncount_gros(1)=ncount_gros(1)+1 - write(6,*) 'check 3' - - if(rdiag(iqc,i) >3.0 .and. rdiag(iqc,i) <=7.0) then - write(6,*) 'check 4' - ncount_gros(2)=ncount_gros(2)+1 - write(6,*) 'check 5' - endif - - else if(rdiag(iqc,i) >=8.0 ) then - write(6,*) 'check 6' - - if(rdiag(ierr,i) >tiny ) then - write(6,*) 'check 7' - ddf=abs(rdiag(igos,i))*rdiag(ierr,i) - write(6,*) 'check 8' - if(ddf 0) then - vqclmt=vqclmt/ncount_vqc(1) - endif - - ! -------------------------------- - ! calculate the the areacd usr2 - rgtross=-gtross - - nlev=nint((gtross-rgtross)/rlev) -! nlev=nlev - print *,nlev - print *, 'rmax,rmin ',gtross,rgtross - print *, 'ncount_gros,',ncount_gros(1),ncount_gros(2),ncount_gros(3) - print *, 'vqc-limit,vqc-limite ',vqclmt,vqclmte - - call hist(mtype,rpress,3,3000000,ncount,rgtross,gtross,rlev,fileo,ncount_vqc,ncount_gros) - return -end diff --git a/util/Conventional_Monitor/image_gen/sorc/read_ps/read_ps_mor.f90 b/util/Conventional_Monitor/image_gen/sorc/read_ps/read_ps_mor.f90 deleted file mode 100644 index d4130cf770..0000000000 --- a/util/Conventional_Monitor/image_gen/sorc/read_ps/read_ps_mor.f90 +++ /dev/null @@ -1,91 +0,0 @@ -!------------------------------------------------------------ -! subroutine read_ps_mor -! -!------------------------------------------------------------ -subroutine read_ps_mor(nreal,mtype,fname,fileo,gtross,rlev) - - implicit none - - real(4),allocatable,dimension(:,:) :: rdiag - real(4),dimension(3,3000000) :: rpress - integer,dimension(3) :: ncount,ncount_vqc,ncount_gros - - character*200 fname - character*50 fileo - character*15 mtype - - integer nobs,nreal,ntotal,ngross,nreal_in,nlev - integer i,ilat,ilon,ipres,itime,iqc,iuse,imuse,iweight,ierr,ierr2,ierr3,iobs,iogs - integer nlat,nlon,npres,ntime,ndup - real(4) :: bmiss,vqclmt,vqclmte,rlev - real rgtross,gtross - - data bmiss/-999.0/ - - ncount=0 - rpress=bmiss - ncount_vqc=0 - ncount_gros=0 - - ntotal=0 - open(unit=11,file=fname,form='unformatted') - rewind(11) - read(11) nobs,nreal_in -! print *, 'nobs=',nobs - - if (nreal /= nreal_in) then - print *,'nreal_in,nreal ',nreal_in,nreal - stop - endif - - allocate(rdiag(nreal,nobs)) - read(11) rdiag - - - ilat=1 ! lat - ilon=2 ! lon - ipres=4 ! pressure - itime=6 ! relative time - iqc=7 ! qc flag - iuse=9 ! original data usage flag - imuse=10 ! data usage flag in the analsis - iweight=11 ! variational relative weight - ierr=12 ! original error from bufr error table - ierr2=13 ! error from read_bufr - ierr3=14 ! error from final adjusted - iobs=15 ! obs - iogs=16 ! obs-ges - - - call rm_dups( rdiag,nobs,nreal,ilat,ilon,ipres,itime,iweight,ndup ) - - do i=1,nobs - if(rdiag(iweight,i) >0.0) then - ncount(3)=ncount(3)+1 - rpress(3,ncount(3))=rdiag(iogs,i) - endif - enddo - - deallocate(rdiag) - - !--------------------------------- - ! calculate the the areacd usr2 - ! - ! This seems very odd to me. Say gtross is n. That means - ! rgtross = -n - ! gttross - rgtross is n - (-n) or 2n. Always. Really?! - ! I'll have to ask Su about this. - ! - rgtross=-gtross - nlev=nint((gtross-rgtross)/rlev) - print *,nlev - print *,gtross, rgtross - - do i=1,3 - if(ncount(i) ==0) ncount(i)=1 - enddo - - call hist(mtype,rpress,3,3000000,ncount,rgtross,gtross,rlev,fileo,ncount_vqc,ncount_gros) - - return -end diff --git a/util/Conventional_Monitor/image_gen/sorc/read_q/mainread_q.f90 b/util/Conventional_Monitor/image_gen/sorc/read_q/mainread_q.f90 deleted file mode 100644 index 2bc2f6c85e..0000000000 --- a/util/Conventional_Monitor/image_gen/sorc/read_q/mainread_q.f90 +++ /dev/null @@ -1,44 +0,0 @@ -!----------------------------------------------- -! program mainread_q -! -!----------------------------------------------- - - implicit none - - character*200 fname - character*50 fileo - character*15 dtype,mtype - - real rlev,rpress - - integer nobs,nreal,ntotal,ngross,nreal_in,insubtype - integer isubtype,ncount,ncount_vgc,ncount_gros - - integer(4):: ittype,ituse,ntumgrp,ntgroup,ntmiter,iflag - real(4) :: ttwind,gtross,etrmax,etrmin,vtar_b,vtar_pg - real(4) :: rmiss,vqclmt,vqclmte - - data rmiss/-999.0/ - - namelist /input/nreal,mtype,fname,fileo,rlev,insubtype - - read (5,input) -! write(6,input) - - ncount=0 - rpress=rmiss - ncount_vgc=0 - ncount_gros=0 - -! print *,dtype,nreal - - call convinfo_read(mtype,15,insubtype,ituse,ntumgrp,ntgroup,ntmiter,isubtype,& - ttwind,gtross,etrmax,etrmin,vtar_b,vtar_pg) - -! print *,'ituse=',ituse,gtross - - if (ituse >0) call read_q(nreal,mtype,fname,fileo,gtross,rlev) - if (ituse <0) call read_q_mor(nreal,mtype,fname,fileo,gtross,rlev) - - stop -end diff --git a/util/Conventional_Monitor/image_gen/sorc/read_q/makefile.read_q b/util/Conventional_Monitor/image_gen/sorc/read_q/makefile.read_q deleted file mode 100755 index ba80f0ddf8..0000000000 --- a/util/Conventional_Monitor/image_gen/sorc/read_q/makefile.read_q +++ /dev/null @@ -1,44 +0,0 @@ -SHELL=/bin/sh - -#------------------- -# makefile.read_q -#------------------- - -BINDIR = ../../exec - -SRCS= mainread_q.f90 read_q.f90 read_q_mor.f90 histgram.f90 rm_dups.f90 convinfo.f90 - -OBJS= mainread_q.o read_q.o read_q_mor.o histgram.o rm_dups.o convinfo.o - - -CMD= read_q.x - -all: $(CMD) - -clean: - rm -f *.o - rm -f *.mod - rm -f *.x - -check_prereqs: - $(PRE_REQ) $(LIBS) - -install: - cp $(CMD) $(BINDIR)/ - -$(CMD): $(OBJS) - $(FC) -o $(@) $(OBJS) $(FFLAGS) - -mainread_q.o : mainread_q.f90 - $(CF) $(FFLAGS) -c $(*).f90 -read_q.o : read_q.f90 - $(CF) $(FFLAGS) -c $(*).f90 -read_q_mor.o : read_q_mor.f90 - $(CF) $(FFLAGS) -c $(*).f90 -histgram.o : histgram.f90 - $(CF) $(FFLAGS) -c $(*).f90 -rm_dups.o : rm_dups.f90 - $(CF) $(FFLAGS) -c $(*).f90 -convinfo.o : convinfo.f90 - $(CF) $(FFLAGS) -c $(*).f90 - diff --git a/util/Conventional_Monitor/image_gen/sorc/read_q/read_q_mor.f90 b/util/Conventional_Monitor/image_gen/sorc/read_q/read_q_mor.f90 deleted file mode 100644 index 6a31566ff7..0000000000 --- a/util/Conventional_Monitor/image_gen/sorc/read_q/read_q_mor.f90 +++ /dev/null @@ -1,88 +0,0 @@ -!---------------------------------------------------------- -! subroutine read_q_mor -! -!---------------------------------------------------------- - -subroutine read_q_mor(nreal,dtype,fname,fileo,gtross,rlev) - - implicit none - - real(4),allocatable,dimension(:,:) :: rdiag - real(4),dimension(3,3000000) :: rpress - integer,dimension(3) :: ncount,ncount_vqc,ncount_gros - - character*200 fname - character*50 fileo - character*15 dtype - - real rgtross,gtross - - integer nobs,nreal,ntotal,ngross,nreal_in,nlev - integer i,nlat,nlon,npres,ntime,ndup - integer ilat,ilon,ipres,itime,iqc,iuse,imuse,iweight,ierr,ierr2,ierr3,iobs,iogs,iqsges - real(4) :: rmiss,vqclmt,vqclmte,rlev - - data rmiss/-999.0/ - - - ncount=0 - rpress=rmiss - ncount_vqc=0 - ncount_gros=0 - - ntotal=0 - open(unit=11,file=fname,form='unformatted') - rewind(11) - read(11) nobs,nreal_in -! print *, 'nobs=',nobs - - if (nreal /= nreal_in) then - print *,'nreal_in,nreal ',nreal_in,nreal - stop - endif - - allocate(rdiag(nreal,nobs)) - read(11) rdiag - - ilat=1 ! lat - ilon=2 ! lon - ipres=4 ! pressure - itime=6 ! relative time - iqc=7 ! qc flag - iuse=9 ! original data usage flag - imuse=10 ! data usage flag in the analsis - iweight=11 ! variational relative weight - ierr=12 ! original error from bufr error table - ierr2=13 ! error from read_bufr - ierr3=14 ! error from final adjusted - iobs=15 ! obs - iogs=16 ! obs-ges - iqsges=18 ! guess saturation specific humidity - - call rm_dups( rdiag,nobs,nreal,ilat,ilon,ipres,itime,iweight,ndup ) - - do i=1,nobs - if(rdiag(iweight,i) >0.0) then - ncount(3)=ncount(3)+1 - rpress(3,ncount(3))=rdiag(iogs,i)/rdiag(iqsges,i) - endif - enddo - - deallocate(rdiag) - - - ! calculate the the areacd usr2 - - rgtross=-gtross - nlev=nint((gtross-rgtross)/rlev) - print *,nlev - print *,gtross, rgtross - - do i=1,3 - if(ncount(i) ==0) ncount(i)=1 - enddo - - call hist(dtype,rpress,3,3000000,ncount,rgtross,gtross,rlev,fileo,ncount_vqc,ncount_gros) - - return -end diff --git a/util/Conventional_Monitor/image_gen/sorc/read_t/mainread_t.f90 b/util/Conventional_Monitor/image_gen/sorc/read_t/mainread_t.f90 deleted file mode 100644 index 68b5ee4914..0000000000 --- a/util/Conventional_Monitor/image_gen/sorc/read_t/mainread_t.f90 +++ /dev/null @@ -1,44 +0,0 @@ -!------------------------------------------------------- -! program mainread_t -! -!------------------------------------------------------- - - implicit none - - character*200 fname - character*50 fileo - character*15 mtype - - integer nobs,nreal,ntotal,ngross,nreal_in,insubtype - integer isubtype,ncount_gros,ncount_vgc,ncount - integer(4):: ittype,ituse,ntumgrp,ntgroup,ntmiter,iflag - real rpress,rlev - real(4) :: ttwind,gtross,etrmax,etrmin,vtar_b,vtar_pg - - real(4) :: rmiss,vqclmt,vqclmte - - data rmiss/-999.0/ - - namelist /input/nreal,mtype,fname,fileo,rlev,insubtype - - - read (5,input) -! write(6,input) - - ncount=0 - rpress=rmiss - ncount_vgc=0 - ncount_gros=0 - -! print *,mtype,nreal - - call convinfo_read(mtype,15,insubtype,ituse,ntumgrp,ntgroup,ntmiter,isubtype,& - ttwind,gtross,etrmax,etrmin,vtar_b,vtar_pg) - -! print *,'ituse=',ituse,gtross - - if (ituse >0) call read_t(nreal,mtype,fname,fileo,gtross,rlev) - if (ituse <0) call read_t_mor(nreal,mtype,fname,fileo,gtross,rlev) - - stop -end diff --git a/util/Conventional_Monitor/image_gen/sorc/read_t/makefile.read_t b/util/Conventional_Monitor/image_gen/sorc/read_t/makefile.read_t deleted file mode 100644 index 9878c84897..0000000000 --- a/util/Conventional_Monitor/image_gen/sorc/read_t/makefile.read_t +++ /dev/null @@ -1,49 +0,0 @@ -SHELL=/bin/sh - -#------------------ -# makefile.read_t -#------------------ - -BINDIR = ../../exec - -SRCS= mainread_t.f90 read_t.f90 read_t_mor.f90 histgram.f90 rm_dups.f90 convinfo.f90 - -OBJS= mainread_t.o read_t.o read_t_mor.o histgram.o rm_dups.o convinfo.o - - - -CMD= read_t.x - -all: $(CMD) - -clean: - rm -f *.o - rm -f *.mod - rm -f *.x - -check_prereqs: - $(PRE_REQ) $(LIBS) - -install: - cp $(CMD) $(BINDIR)/ - -$(CMD): $(OBJS) - $(FC) -o $(@) $(OBJS) $(FFLAGS) - -mainread_t.o : mainread_t.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -read_t.o : read_t.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -read_t_mor.o : read_t_mor.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -histgram.o : histgram.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -rm_dups.o : rm_dups.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -convinfo.o : convinfo.f90 - $(CF) $(FFLAGS) -c $(*).f90 diff --git a/util/Conventional_Monitor/image_gen/sorc/read_uv/convinfo.f90 b/util/Conventional_Monitor/image_gen/sorc/read_uv/convinfo.f90 deleted file mode 100644 index 7824d24877..0000000000 --- a/util/Conventional_Monitor/image_gen/sorc/read_uv/convinfo.f90 +++ /dev/null @@ -1,58 +0,0 @@ -!------------------------------------------------------------------ -! convinfo_read -! -! This subroutine reads the conventional data (cnvstat) file. -!------------------------------------------------------------------ - -subroutine convinfo_read(dtype,idtype,insubtype,ituse,ntumgrp,ntgroup,ntmiter,isubtype,& - ttwind2,gtross2,etrmax2,etrmin2,vtar_b2,vtar_pg2) - - implicit none - - character(120):: crecord - character(7) :: obstype1 - character(15) :: obstype - character(1) :: cflg - character(7):: iotype - integer idtype,insubtype - character(idtype) :: dtype - - integer(4):: ittype,ituse,ntumgrp,ntgroup,ntmiter,isubtype - integer(4) :: lunin,ithin,npred,iflag - real(8) :: ttwind,gtross,etrmax,etrmin,vtar_b,vtar_pg,rmesh,pmesh - real(4) :: ttwind2,gtross2,etrmax2,etrmin2,vtar_b2,vtar_pg2 - - lunin=11 - - open(lunin,file='convinfo',form='formatted') - rewind(lunin) - - loopd: do - read(lunin,1030,IOSTAT=iflag)cflg,iotype,crecord - - if(cflg == '!') cycle - if( iflag /= 0 ) exit loopd - - read(crecord,*)ittype,isubtype,ituse,ttwind,ntumgrp,ntgroup,ntmiter,& - gtross,etrmax,etrmin,vtar_b,vtar_pg,ithin,rmesh,pmesh,npred - write(obstype1,'(i3)') ittype - - obstype=trim(iotype)//trim(obstype1) -! print *,'obstype,dtype ',obstype,dtype - - if( trim(obstype) == trim(dtype) .and. isubtype == insubtype) then - ttwind2=ttwind - gtross2=gtross - etrmax2=etrmax - etrmin2=etrmin - vtar_b2=vtar_b - vtar_pg2=vtar_pg - exit - endif - - enddo loopd - -1030 format(a1,a7,2x,a120) - - return -end diff --git a/util/Conventional_Monitor/image_gen/sorc/read_uv/histgram.f90 b/util/Conventional_Monitor/image_gen/sorc/read_uv/histgram.f90 deleted file mode 100644 index 81d429cb4a..0000000000 --- a/util/Conventional_Monitor/image_gen/sorc/read_uv/histgram.f90 +++ /dev/null @@ -1,143 +0,0 @@ -!---------------------------------------------------------------------------- -! subroutine hist -! -! This subroutine calculates the histogram of each data source. -!---------------------------------------------------------------------------- - -subroutine hist(mtype,rmodnbc,nchan,nxdata,ndata,rmin,rmax,rlev,fileo,ncount_vqc,ncount_gros) - - implicit none - - integer nxdata,nchan,nlev,i,j,k - real rlev,rmin,rmax,sqr2 - - real,dimension(nchan,nxdata) :: rmodnbc - real,dimension(nchan) :: rmean,rstd - integer,dimension(nchan) :: nmean,nobs,ndata,ncount_vqc,ncount_gros - - real,dimension(nchan,400) :: ys - real,dimension(400) :: xs - real,dimension(401) :: xs2 - real maxf - - character*50 fileo - character*15 mtype - - sqr2=1.414213562 - - nlev=(rmax-rmin)/rlev - - if(nlev >400) then - print *,' too many bins, exceeding 400' - return - endif - - xs(1)=rmin+rlev/2.0 - xs2(1)=rmin - - print *, 'nlev=',nlev - print *, 'nobs=',ndata(1),ndata(2),ndata(3) - - do i=2,nlev - xs(i)=xs(i-1)+rlev - xs2(i)=xs2(i-1)+rlev - end do - - xs2(nlev+1)=xs2(nlev)+rlev - - do i=1,nlev - do j=1,nchan - ys(j,i)=0.0 - enddo - enddo - - do k=1,nchan - if(ndata(k) >1) then - do i=1, ndata(k) - do j=1,nlev - if( rmodnbc(k,i) >=xs2(j) .and. & - rmodnbc(k,i) 1) then - do i=1,ndata(j) - if(rmodnbc(j,i) >=rmin .and. rmodnbc(j,i) <=rmax) then - rmean(j)=rmean(j)+rmodnbc(j,i) - rstd(j)=rstd(j)+rmodnbc(j,i)*rmodnbc(j,i) - nobs(j)=nobs(j)+1 - endif - enddo - endif - enddo - - do j=1,nchan - if(nobs(j) >0) then - if(nobs(j)==1) then - rstd(j)=rstd(j)-rmean(j)*rmean(j)/nobs(j) - rmean(j)=rmean(j)/nobs(j) - rstd(j)=0.0 - else - rstd(j)=rstd(j)-rmean(j)*rmean(j)/nobs(j) - rmean(j)=rmean(j)/nobs(j) - rstd(j)=sqrt(abs(rstd(j))/(nobs(j)-1)) - endif - endif - enddo - - - - write(6,200) mtype - do j=1,nchan - write(6,210) nobs(j),ncount_vqc(j),ncount_gros(j),rstd(j),rmean(j) - enddo - -200 format(a12,'no. std mean ') -210 format(3i10,2f10.3) - -! write(6,220) (xs(1,i),i=1,100) -! write(6,230) (ys(1,i),i=1,100) -! write(6,230) (f(1,i),i=1,100) - -!220 format(6e12.4) -!230 format(6e12.5) - -! trasform the frequecy so that gaussin distribution became a stright line - -! print *, 'maxf ',maxf - -! do i=1,nlev -! if(ys(i) >0.0) then -! ys(i)=sqrt(-2.0*log(ys(i)/maxf)) -! else -! ys(i)=0.0 -! endif -! f(i)=abs((xs(i)-rmean)/rstd) -! enddo - - open (10,file=fileo,form='unformatted',access='direct',recl=nlev*4) - - write(10,rec=1) (xs(i),i=1,nlev) - do j=1,nchan - write(10,rec=2+j-1) (ys(j,i),i=1,nlev) - enddo - - close(10) - - - return -end - diff --git a/util/Conventional_Monitor/image_gen/sorc/read_uv/mainread_uv.f90 b/util/Conventional_Monitor/image_gen/sorc/read_uv/mainread_uv.f90 deleted file mode 100644 index f938defcd9..0000000000 --- a/util/Conventional_Monitor/image_gen/sorc/read_uv/mainread_uv.f90 +++ /dev/null @@ -1,44 +0,0 @@ -!-------------------------------------------------------------- -! program mainread_uv -! -!-------------------------------------------------------------- - - implicit none - - character*200 fname - character*50 fileo - character*15 mtype - - real rpress,rlev - - integer nobs,nreal,ntotal,ngross,nreal_in,insubtype - integer(4):: ittype,ituse,ntumgrp,ntgroup,ntmiter,iflag - integer isubtype,ncount,ncount_vgc,ncount_gros - - real(4) :: ttwind,gtross,etrmax,etrmin,vtar_b,vtar_pg - real(4) :: rmiss,vqclmt,vqclmte - - data rmiss/-999.0/ - - namelist /input/nreal,mtype,fname,fileo,rlev,insubtype - - read (5,input) - write(6,input) - - ncount=0 - rpress=rmiss - ncount_vgc=0 - ncount_gros=0 - -! print *,mtype,nreal - - call convinfo_read(mtype,15,insubtype,ituse,ntumgrp,ntgroup,ntmiter,isubtype,& - ttwind,gtross,etrmax,etrmin,vtar_b,vtar_pg) - -! print *,'ituse=',ituse,gtross - - if (ituse >0) call read_uv(nreal,mtype,fname,fileo,gtross,rlev) - if (ituse <0) call read_uv_mor(nreal,mtype,fname,fileo,gtross,rlev) - - stop -end diff --git a/util/Conventional_Monitor/image_gen/sorc/read_uv/makefile.read_uv b/util/Conventional_Monitor/image_gen/sorc/read_uv/makefile.read_uv deleted file mode 100755 index 342dd31cc4..0000000000 --- a/util/Conventional_Monitor/image_gen/sorc/read_uv/makefile.read_uv +++ /dev/null @@ -1,47 +0,0 @@ -SHELL=/bin/sh - -#---------------------- -# makefile.read_uv -#---------------------- - -BINDIR = ../../exec - -SRCS= mainread_uv.f90 read_uv.f90 read_uv_mor.f90 histgram.f90 histgramuv.f90 rm_dups.f90 convinfo.f90 - -OBJS= mainread_uv.o read_uv.o read_uv_mor.o histgram.o histgramuv.o rm_dups.o convinfo.o - - -CMD= read_uv.x - -all: $(CMD) - -clean: - rm -f *.o - rm -f *.mod - rm -f *.x - -check_prereqs: - $(PRE_REQ) $(LIBS) - -install: - cp $(CMD) $(BINDIR)/ - -$(CMD): $(OBJS) - $(FC) -o $(@) $(OBJS) $(FFLAGS) - - -mainread_uv.o : mainread_uv.f90 - $(CF) $(FFLAGS) -c $(*).f90 -read_uv.o : read_uv.f90 - $(CF) $(FFLAGS) -c $(*).f90 -read_uv_mor.o : read_uv_mor.f90 - $(CF) $(FFLAGS) -c $(*).f90 -histgram.o : histgram.f90 - $(CF) $(FFLAGS) -c $(*).f90 -histgramuv.o : histgramuv.f90 - $(CF) $(FFLAGS) -c $(*).f90 -rm_dups.o : rm_dups.f90 - $(CF) $(FFLAGS) -c $(*).f90 -convinfo.o : convinfo.f90 - $(CF) $(FFLAGS) -c $(*).f90 - diff --git a/util/Conventional_Monitor/image_gen/sorc/read_uv/read_uv.f90 b/util/Conventional_Monitor/image_gen/sorc/read_uv/read_uv.f90 deleted file mode 100644 index d954472fd8..0000000000 --- a/util/Conventional_Monitor/image_gen/sorc/read_uv/read_uv.f90 +++ /dev/null @@ -1,157 +0,0 @@ -!===================================== -! read_uv -! -! read wind files -!===================================== - -subroutine read_uv(nreal,dtype,fname,fileo,gtross,rlev) - - implicit none - - real(4),allocatable,dimension(:,:) :: rdiag - real(4),dimension(3,3000000) :: rpressu - real(4),dimension(3,3000000) :: rpressv - real(4),dimension(3,3000000) :: rpress - integer,dimension(3) :: ncount,ncount_vqc,ncount_gros - - character*200 fname - character*50 fileo,fileu,filev,fileou2,fileov2 - character*15 dtype - - real*4 tiny,huge,real - real weight,ddf,rlev,rgtross,gtross - - integer nobs,nreal,ntotal,ngross,nreal_in,nlev - integer i,ndup - integer ilat,ilon,ipres,itime,iqc,iuse,imuse,iweight,ierr,ierr2,ierr3,iobu,iogu,iobv,iogv - - real(4) :: bmiss,vqclmt,vqclmte - - data bmiss/-999.0/ - - - fileu=trim(fileo)//'_u' - filev=trim(fileo)//'_v' - fileou2='stdout_u' - fileov2='stdout_v' - - -! print *,'nreal=',nreal - - ncount=0 - rpress=bmiss - ncount_vqc=0 - ncount_gros=0 - tiny=1.0e-6 - huge=1.0e6 - - - ntotal=0 - open(unit=11,file=fname,form='unformatted') - rewind(11) - read(11) nobs,nreal_in - print *, 'nobs=',nobs - if (nreal /= nreal_in) then - print *,'nreal_in,nreal ',nreal_in,nreal - stop - endif - - allocate(rdiag(nreal,nobs)) - read(11) rdiag - - - ilat=1 ! lat - ilon=2 ! lon - ipres=4 ! pressure - itime=6 ! relative time - iqc=7 ! qc flag - iuse=9 ! original data usage flag - imuse=10 ! data usage flag in the analsis - iweight=11 ! variational relative weight - ierr=12 ! original error from bufr error table - ierr2=13 ! error from read_bufr - ierr3=14 ! error from final adjusted - iobu=15 ! u obs - iogu=16 ! u obs-ges - iobv=18 ! v obs - iogv=19 ! v obs-ges - - - call rm_dups( rdiag,nobs,nreal,ilat,ilon,ipres,itime,iweight,ndup ) - - do i=1,nobs - if( rdiag(iweight,i) >= 0.0 .and. rdiag(imuse,i) >0.0 ) then - ncount(1)=ncount(1)+1 - - rpressu(1,ncount(1))=rdiag(iogu,i)*rdiag(ierr,i) - rpressv(1,ncount(1))=rdiag(iogv,i)*rdiag(ierr,i) - rpress(1,ncount(1))=sqrt(rdiag(iogu,i)**2+rdiag(iogv,i)**2)*rdiag(ierr,i) - - weight=rdiag(iweight,i) - if(weight <1.0) then - ncount_vqc(1)=ncount_vqc(1)+1 - endif - - if(rdiag(iqc,i) >=4.0) then - ncount(2)=ncount(2)+1 - if(weight <1.0) then - ncount_vqc(2)=ncount_vqc(2)+1 - endif - rpressu(2,ncount(2))=rdiag(iogu,i)*rdiag(ierr,i) - rpressv(2,ncount(2))=rdiag(iogv,i)*rdiag(ierr,i) - rpress(2,ncount(2))=sqrt(rdiag(iogu,i)**2+rdiag(iogv,i)**2)*rdiag(ierr,i) - endif - else if(rdiag(iweight,i) >= 0.0 .and. rdiag(imuse,i) <0.0) then - if(rdiag(iqc,i) <=7.0) then - ncount_gros(1)=ncount_gros(1)+1 - if(rdiag(iqc,i) >3.0 .and. rdiag(iqc,i) <=7.0) then - ncount_gros(2)=ncount_gros(2)+1 - endif - else if(rdiag(iqc,i) >=8.0 ) then - if(rdiag(ierr,i) >tiny ) then - ddf=sqrt(rdiag(iogu,i)**2+rdiag(iogv,i)**2)*rdiag(ierr,i) - if(ddf 0) then - vqclmt=vqclmt/ncount_vqc(1) - endif - -! calculate the the areacd usr2 - rgtross=-gtross - - nlev=nint((gtross-rgtross)/rlev) - - nlev=nlev - print *,nlev - print *, 'rmax,rmin ',gtross,rgtross - print *, 'ncount_gros,',ncount_gros(1),ncount_gros(2),ncount_gros(3) - print *, 'vqc-limit,vqc-limite ',vqclmt,vqclmte - - - call hist(dtype,rpress,3,3000000,ncount,rgtross,gtross,rlev,fileo,ncount_vqc,ncount_gros) - call histuv(dtype,rpressu,3,3000000,ncount,rgtross,gtross,rlev,fileu,ncount_vqc,ncount_gros,fileou2) - call histuv(dtype,rpressv,3,3000000,ncount,rgtross,gtross,rlev,filev,ncount_vqc,ncount_gros,fileov2) - - - return -end diff --git a/util/Conventional_Monitor/image_gen/sorc/read_uv/rm_dups.f90 b/util/Conventional_Monitor/image_gen/sorc/read_uv/rm_dups.f90 deleted file mode 100644 index db4fbdded0..0000000000 --- a/util/Conventional_Monitor/image_gen/sorc/read_uv/rm_dups.f90 +++ /dev/null @@ -1,43 +0,0 @@ -!------------------------------------------------------- -! rm_dups -! -! This subroutine removes duplicate data by comparing -! lat, lin, time, and pressure values. Differences -! of < 10.0e-5 are assumed to be matches. -!------------------------------------------------------- - -subroutine rm_dups(duparr,n,m,ilat,ilon,ipress,itime,iweight,nndup) - - implicit none - - real(4),intent(inout),dimension(m,n) :: duparr - -! integer ihash(2*n) -! integer ifn - integer n,m,ilat,ilon,iweight,nndup,i - integer itime,jj,ipress - real dlat,dlon,dtime,dpress,match - - data match / 10.0e-5 / - - - nndup=0 - do i = 1, n - do jj=i+1,n - dlat=abs(duparr(ilat,i)-duparr(ilat,jj)) - dlon=abs(duparr(ilon,i)-duparr(ilon,jj)) - dtime=abs(duparr(itime,i)-duparr(itime,jj)) - dpress=abs(duparr(ipress,i)-duparr(ipress,jj)) - - if (dlat < match .and. dlon < match .and. dtime < match & - .and. dpress < match ) then - - duparr(iweight,i)=-1.0 - nndup=nndup+1 - endif - enddo - enddo - - write(*,*) 'num dups found by rm_dups is ',nndup - return -end diff --git a/util/Conventional_Monitor/image_gen/ush/ConMon_IG.sh b/util/Conventional_Monitor/image_gen/ush/ConMon_IG.sh index 198341f233..5573d32c51 100755 --- a/util/Conventional_Monitor/image_gen/ush/ConMon_IG.sh +++ b/util/Conventional_Monitor/image_gen/ush/ConMon_IG.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash #-------------------------------------------------------------------- # @@ -14,13 +14,19 @@ #-------------------------------------------------------------------- function usage { echo " " - echo "Usage: ConMon_IG.sh suffix [plot_date]" - echo " Suffix is data source identifier that matches data in " - echo " the $C_TANKDIR/stats directory." - echo " Plot_date, format YYYYMMDDHH is optional. If included the plot" - echo " will be for the specified cycle, provided data files are available." - echo " If not included, the plot cycle will be for the latest cycle found" - echo " for this suffix." + echo " " + echo "Usage: ConMon_IG.sh suffix [-p|--pdate pdate -r|--run gdas|gfs]" + echo " Suffix is the indentifier for this data source." + echo " " + echo " -p | --pdate yyyymmddcc to specify the cycle to be plotted." + echo " If unspecified pdate will be set using the " + echo " C_IMGNDIR/last_plot_time file, and if that doesn't" + echo " exist, then the last available date will be plotted." + echo " " + echo " -r | --run the gdas|gfs run to be processed." + echo " Use only if data in TANKdir stores both runs, gdas" + echo " gdas is the default value." + echo " " } @@ -30,35 +36,54 @@ function usage { echo "Begin ConMon_IG.sh" + nargs=$# -if [[ $nargs -lt 1 || $nargs -gt 2 ]]; then +if [[ $nargs -lt 1 || $nargs -gt 5 ]]; then usage exit 1 fi - set -ax +#----------------------------------------------- +# Process command line arguments +# +export RUN=gdas + +while [[ $# -ge 1 ]] +do + key="$1" + echo $key + + case $key in + -p|--pdate) + export PDATE="$2" + shift # past argument + ;; + -r|--run) + export RUN="$2" + shift # past argument + ;; + *) + #any unspecified key is CONMON_SUFFIX + export CONMON_SUFFIX=$key + ;; + esac + + shift +done + this_file=`basename $0` this_dir=`dirname $0` -export CMON_SUFFIX=$1 -echo "CMON_SUFFIX = $CMON_SUFFIX" - -export NUM_CYCLES=${NUM_CYCLES:-121} # number of cycles in plot -export JOBNAME=${JOBNAME:-CMon_plt_${CMON_SUFFIX}} -export grib2=${grib2:-0} # 1 = grib2 (true), 0 = grib - -export GRADS=/apps/grads/2.0.1a/bin/grads -#-------------------------------------------------------------------- -# Set plot_time if it's included as an argument -#-------------------------------------------------------------------- -plot_time= -if [[ $nargs -eq 2 ]]; then - export plot_time=$2; - echo "use plot_time = $plot_time" -fi +echo "CONMON_SUFFIX = $CONMON_SUFFIX" +echo "PDATE = $PDATE" +echo "RUN = $RUN" +export NUM_CYCLES=${NUM_CYCLES:-121} # number of cycles in plot +export JOBNAME=${JOBNAME:-ConMon_plt_${CONMON_SUFFIX}} +export grib2=${grib2:-1} # 1 = grib2 (true), 0 = grib + # should this move to config? #-------------------------------------------------------------------- # Run config files to load environment variables, @@ -66,37 +91,15 @@ fi #-------------------------------------------------------------------- top_parm=${this_dir}/../../parm -cmon_version_file=${cmon_version:-${top_parm}/ConMon.ver} -if [[ -s ${cmon_version_file} ]]; then - . ${cmon_version_file} - echo "able to source ${cmon_version_file}" +conmon_config=${conmon_config:-${top_parm}/ConMon_config} +if [[ -s ${conmon_config} ]]; then + . ${conmon_config} + echo "able to source ${conmon_config}" else - echo "Unable to source ${cmon_version_file} file" - exit 2 -fi - -cmon_config=${cmon_config:-${top_parm}/ConMon_config} -if [[ -s ${cmon_config} ]]; then - . ${cmon_config} - echo "able to source ${cmon_config}" -else - echo "Unable to source ${cmon_config} file" + echo "Unable to source ${conmon_config} file" exit 3 fi -#-------------------------------------------------------------------- -# Check for my monitoring use. Abort if running on prod machine. -#-------------------------------------------------------------------- - -if [[ RUN_ONLY_ON_DEV -eq 1 ]]; then - is_prod=`${C_IG_SCRIPTS}/onprod.sh` - if [[ $is_prod = 1 ]]; then - exit 10 - fi -fi - -jobname=CMon_ig_${CMON_SUFFIX} - #-------------------------------------------------------------------- # Create LOGdir as needed @@ -107,87 +110,103 @@ fi #-------------------------------------------------------------------- -# Get date of cycle to process. Exit if available data has already -# been plotted ($PDATE -gt $PRODATE). +# Determine cycle to plot. Exit if cycle is > last available +# data ($PDATE -gt $last_cycle). +# +# PDATE can be set one of 3 ways. This is the order of priority: # -# If plot_time has been specified via command line argument, then -# set PDATE to it. Otherwise, determine the last cycle processed -# (into *.ieee_d files) and use that as the PDATE. +# 1. Specified via command line argument +# 2. Read from ${C_IMGNDIR}/last_plot_time file and advanced +# one cycle. +# 3. Using the last available cycle for which there is +# data in ${C_TANKDIR}. +# +# If option 2 has been used the ${C_IMGNDIR}/last_plot_time file +# will be updated with ${PDATE} if the plot is able to run. #-------------------------------------------------------------------- -export PRODATE=`${C_IG_SCRIPTS}/find_cycle.pl 1 ${C_TANKDIR}` - -if [[ $plot_time != "" ]]; then - export PDATE=$plot_time -else - export PDATE=$PRODATE -fi -echo "PRODATE, PDATE = $PRODATE, $PDATE" +echo "C_IG_SCRIPTS = ${C_IG_SCRIPTS}" +echo "C_TANKDIR = ${C_TANKDIR}" +last_cycle=`${C_IG_SCRIPTS}/find_cycle.pl \ + --cyc 1 --dir ${C_TANKDIR} --run ${RUN}` -#-------------------------------------------------------------------- -# Check for running plot jobs and abort if found -#-------------------------------------------------------------------- -if [[ $MY_MACHINE = "wcoss" ]]; then - running=`bjobs -l | grep ${jobname} | wc -l` -else - running=`showq -n -u ${LOGNAME} | grep ${jobname} | wc -l` -fi +if [[ ${PDATE} = "" ]]; then -echo "running = $running" -if [[ $running -ne 0 ]]; then - echo "Plot jobs still running for $CMON_SUFFIX, must exit" - exit 9 + if [[ -e ${C_IMGNDIR}/last_plot_time ]]; then + echo " USING last_plot_time" + last_plot=`cat ${C_IMGNDIR}/last_plot_time` + export PDATE=`$NDATE +6 ${last_plot}` + else + export PDATE=$last_cycle + fi fi -#-------------------------------------------------------------------- -# Create workdir and cd to it -#-------------------------------------------------------------------- - -export C_PLOT_WORKDIR=${C_PLOT_WORKDIR:-${C_STMP_USER}/plot_cmon_${CMON_SUFFIX}} -rm -rf $C_PLOT_WORKDIR -mkdir -p $C_PLOT_WORKDIR -cd $C_PLOT_WORKDIR - - #-------------------------------------------------------------------- # Set the START_DATE for the plot #-------------------------------------------------------------------- ncycles=`expr $NUM_CYCLES - 1` -#hrs=`expr $NUM_CYCLES \\* -6` hrs=`expr $ncycles \\* -6` echo "hrs = $hrs" export START_DATE=`$NDATE ${hrs} $PDATE` -echo "start_date, prodate, pdate = $START_DATE $PRODATE $PDATE" +echo "START_DATE, last_cycle, PDATE = $START_DATE $last_cycle $PDATE" +pdy=`echo ${PDATE}|cut -c1-8` +cyc=`echo ${PDATE}|cut -c9-10` #------------------------------------------------------------------ # Start image plotting jobs. #------------------------------------------------------------------ +if [[ $PDATE -le ${last_cycle} ]]; then + + echo "ABLE to plot ${PDATE}, last processed date is ${last_cycle}" + + #-------------------------------------------------------------------- + # Create workdir and cd to it + #-------------------------------------------------------------------- + export C_PLOT_WORKDIR=${C_PLOT_WORKDIR:-${C_STMP_USER}/${CONMON_SUFFIX}/${RUN}/conmon} + rm -rf $C_PLOT_WORKDIR + mkdir -p $C_PLOT_WORKDIR + cd $C_PLOT_WORKDIR + + #-------------------------------------------------------------------- + # Run the two setup scripts + #-------------------------------------------------------------------- + ${C_IG_SCRIPTS}/mk_horz_hist.sh + + ${C_IG_SCRIPTS}/mk_time_vert.sh + + #-------------------------------------------------------------------- + # Update the last_plot_time file if found + #-------------------------------------------------------------------- + if [[ -e ${C_IMGNDIR}/last_plot_time ]]; then + echo "update last_plot_time file" + echo ${PDATE} > ${C_IMGNDIR}/last_plot_time + fi -${C_IG_SCRIPTS}/mk_horz_hist.sh - -${C_IG_SCRIPTS}/mk_time_vert.sh + #-------------------------------------------------------------------- + # Mail warning reports + #-------------------------------------------------------------------- + if [[ $DO_DATA_RPT = 1 ]]; then + warn_file=${C_TANKDIR}/${RUN}.${pdy}/${cyc}/conmon/horz_hist/ges/err_rpt.ges.${PDATE} + if [[ -e ${warn_file} ]]; then + echo "mailing err_rpt" + /bin/mail -s "ConMon warning" -c "${MAIL_CC}" ${MAIL_TO} < ${warn_file} + fi + fi + ${C_IG_SCRIPTS}/rm_img_files.pl --dir ${C_IMGNDIR}/pngs --nfl ${NUM_IMG_CYCLES} -#------------------------------------------------------------------ -# Run the make_archive.sh script if $DO_ARCHIVE is switched on. -#------------------------------------------------------------------ -#if [[ $DO_ARCHIVE = 1 ]]; then -# ${IG_SCRIPTS}/make_archive.sh -#fi - +else + echo "UNABLE to plot ${PDATE}, last processed date is ${last_cycle}" + exit 4 +fi -#-------------------------------------------------------------------- -# Clean up and exit -#cd $tmpdir -#cd ../ -#rm -rf $tmpdir echo "End ConMon_IG.sh" exit diff --git a/util/Conventional_Monitor/image_gen/ush/Transfer.sh b/util/Conventional_Monitor/image_gen/ush/Transfer.sh index 5c18ed8502..53079bd7ae 100755 --- a/util/Conventional_Monitor/image_gen/ush/Transfer.sh +++ b/util/Conventional_Monitor/image_gen/ush/Transfer.sh @@ -1,21 +1,54 @@ #!/bin/sh +#-------------------------------------------------------------------- +# usage +#-------------------------------------------------------------------- function usage { - echo "Usage: Transfer.sh suffix" - echo " Suffix is data source identifier that matches data in " - echo " the $TANKDIR/stats directory." + echo "Usage: ConMon_IG.sh suffix [-r|--run gdas|gfs]" + echo " Suffix is the indentifier for this data source." + echo " -r | --run the gdas|gfs run to be processed" + echo " use only if data in TANKdir stores both runs, otherwise" + echo " gdas is assumed." + echo " " } + set -ax -echo start Transfer.sh +mybin=`ls ~/bin` +echo "test: $mybin" nargs=$# -if [[ $nargs -ne 1 ]]; then +if [[ $nargs -lt 1 || $nargs -gt 3 ]]; then usage exit 1 fi -CMON_SUFFIX=$1 +#----------------------------------------------- +# Process command line arguments +# +export RUN=gdas + +while [[ $# -ge 1 ]] +do + key="$1" + echo $key + + case $key in + -r|--run) + export RUN="$2" + shift # past argument + ;; + *) + #any unspecified key is CONMON_SUFFIX + export CONMON_SUFFIX=$key + ;; + esac + + shift +done + + +CMON_SUFFIX=$CONMON_SUFFIX this_file=`basename $0` this_dir=`dirname $0` @@ -30,58 +63,30 @@ else exit fi -if [[ -s ${CMON_USER_SETTINGS} ]]; then - . ${CMON_USER_SETTINGS} -else - echo "ERROR: Unable to source ${CMON_USER_SETTINGS}" - exit -fi - -#-------------------------------------------------------------------- -# Get the area (glb/rgn) for this suffix -#-------------------------------------------------------------------- -#area=$RAD_AREA +logfile=${C_LOGDIR}/transfer_${CMON_SUFFIX}.log -#if [[ $area == "glb" ]]; then -# . ${CMON_IMAGE_GEN}/parm/glbl_conf -#elif [[ $area == "rgn" ]]; then -# . ${RADMON_IMAGE_GEN}/parm/rgnl_conf -#else -# echo "ERROR: Unable to determine area for ${CMON_SUFFIX}" -# exit -#fi +export JOB_QUEUE=dev_transfer +WEBDIR=${WEBDIR}/${CMON_SUFFIX}/${RUN} -#-------------------------------------------------------------------- -# Check for my monitoring use. Abort if running on prod machine. -#-------------------------------------------------------------------- +export jobname=transfer_${CMON_SUFFIX}_conmon -if [[ RUN_ONLY_ON_DEV -eq 1 ]]; then - is_prod=`${C_IG_SCRIPTS}/onprod.sh` - if [[ $is_prod = 1 ]]; then - exit 10 - fi +#-------------------------------------------------------- +# Note that transfers from hera are not straightforward, +# and must go through a system that is allowed to access +# emcrzdm. This script will just report that situation +# and leave it to the user to manually transfer files to +# the server. +# +if [[ $MY_MACHINE == "wcoss_d" || $MY_MACHINE == "wcoss_c" ]]; then + $SUB -P $PROJECT -q $JOB_QUEUE -o ${logfile} -M 80 -W 1:30 \ + -R affinity[core] -J ${jobname} -cwd ${PWD} \ + ${C_IG_SCRIPTS}/transfer_imgs.sh +else + echo "Unable to transfer files from $MY_MACHINE to $WEBSVR." + echo "Manual intervention is required." fi -#-------------------------------------------------------------------- - -log_file=${LOGdir}/Transfer_${CMON_SUFFIX}.log -err_file=${LOGdir}/Transfer_${CMON_SUFFIX}.err - -WEBDIR=${WEBDIR}/${CMON_SUFFIX} - -if [[ ${C_IMGNDIR} != "/" ]]; then - echo "C_IMGNDIR = $C_IMGNDIR" - echo "MY_MACHINE = $MY_MACHINE" - echo "WEBUSER = $WEBUSER" - echo "WEBSVR = $WEBSVR" - echo "WEBDIR = $WEBDIR" - - if [[ $MY_MACHINE = "wcoss" || $MY_MACHINE = "cray" ]]; then - /usr/bin/rsync -ave ssh --exclude *.ctl.${Z} ${C_IMGNDIR}/ \ - ${WEBUSER}@${WEBSVR}.ncep.noaa.gov:${WEBDIR}/ - fi -fi echo end Transfer.sh exit diff --git a/util/Conventional_Monitor/image_gen/ush/find_cycle.pl b/util/Conventional_Monitor/image_gen/ush/find_cycle.pl index ba7d4d3da5..0fbd539399 100755 --- a/util/Conventional_Monitor/image_gen/ush/find_cycle.pl +++ b/util/Conventional_Monitor/image_gen/ush/find_cycle.pl @@ -3,18 +3,28 @@ #----------------------------------------------------------------------- # find_cycle.pl # -# Given a directory containing cmon.YYYYMMDDHH subdirectories, -# determine the first or last cycle for which ieee_d data files -# exist. +# Arguments: +# --dir : Required string value containing $TANKdir/$SUFFIX. +# --cyc : Optional integer value: +# 1 = last cycle (default) +# 0 = first cycle +# --run : Run name, generally 'gdas' or 'gfs'. +# If not specified 'gdas' will be used. # # Return that first/last cycle as a text string in YYYYMMDDHH format, # or return nothing if none of the expected data files are found. +# +# Note that this is designed to be used by a shell script which will +# pick up the returned cycle string. If debug statements are left +# in this perl script then the calling shell script will have +# problems. #----------------------------------------------------------------------- - use strict; - use warnings; + use strict; + use warnings; + use Getopt::Long; + use Scalar::Util qw(looks_like_number); - use Scalar::Util qw(looks_like_number); #------------------------------------------------------------------- # @@ -37,17 +47,21 @@ ##------------------------------------------------------------------ ##------------------------------------------------------------------ - if ($#ARGV != 1 ) { - print "usage: find_cycle.pl 0/1 /path_to_directory/containing/cmon.YYYYMMDDHH subdirectories. \n"; - print " 0 = first, 1 = last \n"; - exit; - } - my $target = $ARGV[0]; - my $dirpath = $ARGV[1]; + my $run = 'gdas'; + my $dir = ''; + my $lcm = 'conmon'; + my $cyc = '1'; + + GetOptions( 'cyc:i' => \$cyc, + 'run:s' => \$run, + 'dir=s' => \$dir, + 'lcm:s' => \$lcm ); + my @alldirs; + my $dirpath = $dir; - - # Get list of cmon.* sub-directories + #-------------------------------------------------------------------- + # Get list of $run.* directories which contain conmon subdirectories # opendir(DIR, $dirpath) or die "Cannot open directory $!"; while (my $file = readdir(DIR)) { @@ -55,120 +69,140 @@ push( @alldirs, $file ); } closedir DIR; - - my @cmondirs = grep { /cmon/ } @alldirs; - - # If there are no cmon.* subdirectories, then exit without + my $search_string; + + if( length($run) == 0 ){ + $search_string = $lcm; + } else { + $search_string = $run; + } + + my @mmdirs = grep { /$search_string/ } @alldirs; + #----------------------------------------------------------------------- + # If there are no $run.yyyymmdd subdirectories, then exit without # returning any date string. # - if( $#cmondirs < 0 ) { - print "exiting with 0 cmondirs\n"; + if( $#mmdirs < 0 ) { + print "exiting with 0 mmdirs\n"; exit; + } + + + #----------------------------------------------------------------------- + # Sort the mmdirs array and loop through it from end to beginning + # + + my @sortmm = sort( @mmdirs ); + + my $ctr; + my $incr; + my $end_ctr; + my @hrs; + + #----------------------------------------------------------------------- + # Arrange the logic here for accessing either the first or last + # cycle. If we're after the first cycle the directories will be + # processed from 0 to max. Note below the cycle hours are processed + # from max to 0, so the cycle order is reversed (18..00) when looking + # for the first cycle. + # + if( $cyc == 0 ){ + $ctr = -1; + $incr = 1; + $end_ctr = $#sortmm; + @hrs = qw( 18 12 06 00 ); + } else { + $ctr = $#sortmm + 1; + $incr = -1; + @hrs = qw( 00 06 12 18 ); + $end_ctr = 0; } - - - # Sort the cmondirs array and loop through it from end to beginning + + + my $found_cycle = 0; + + # Start with the latest directory and attempt to locate monitor + # subdirectories. # - if( $target == 1 ){ # search is for latest date/time - my @sortrad = sort( @cmondirs ); - my $ctr = $#sortrad + 1; + my $exit_flag = 0; - my $found_cycle = 0; + do { + $ctr = $ctr + $incr; + + # In each subdirectory attempt to locate all *stas* files + # and parse out all unique date values. The latest is the answer + # we're looking for. + # + # If there are no *stas* files, step to the next iteration. + # + + my $newdir; + my $hr_ctr = $#hrs + 1; do { - - $ctr--; - - - # In each subdirectory build a list of time.*ieee_d* files - # and parse out all unique date values. The oldest is the answer - # we're looking for. - # - # If there are no time.*ieee_d* files, step to the next iteration. - # - my $newdir = "${dirpath}/${sortrad[$ctr]}/time_vert"; - opendir DIR, $newdir or die "Cannot open the current directory: $!"; - - my @timefiles = grep { /anl_ps_stas/ } readdir DIR; -# my @timefiles = grep { /ieee_d/ } @tfiles; - - if( $#timefiles >= 0 ) { - my @sorttime = sort( @timefiles ); - my @times; - my $idx = 0; - - # Find the first string of 10 digits; that's the date. Use that $idx - # number to process all files. - # - my @vals = split( '\.', $timefiles[0] ); - for ( my $ii=$#vals; $ii >= 0; $ii-- ) { - if( looks_like_number( $vals[$ii] ) && length($vals[$ii] ) == 10 ){ + + $hr_ctr = $hr_ctr - 1; + + $newdir = "${dirpath}/${sortmm[$ctr]}/${hrs[$hr_ctr]}/${lcm}/time_vert"; + + + if( -d $newdir ) { + opendir DIR, $newdir or die "Cannot open the current directory: $!"; + + my @timefiles = grep { /stas/ && !/ctl/ } readdir DIR; + + if( $#timefiles >= 0 ) { + my @sorttime = sort( @timefiles ); + my @times; + my $idx = 0; + + # Find the first string of 10 digits; that's the date. Use that + # $idx number to process all files. + # + my @vals = split( '\.', $timefiles[0] ); + for ( my $ii=$#vals; $ii >= 0; $ii-- ) { + if( looks_like_number( $vals[$ii] ) && length($vals[$ii] ) == 10 ){ $idx = $ii; + } } - } - - for ( my $ii=$#sorttime; $ii >= 0; $ii-- ) { - my $teststr = $sorttime[$ii]; - my @values = split( '\.', $teststr ); - if( $values[$idx] ne "ctl" ){ - push( @times, $values[$idx] ); + for ( my $ii=$#sorttime; $ii >= 0; $ii-- ) { + my $teststr = $sorttime[$ii]; + + my @values = split( '\.', $teststr ); + if( length($values[$idx] ) == 10 ){ + push( @times, $values[$idx] ); + } } - } - if ( $#times >= 0 ) { - $found_cycle = 1; - my @utimes = sort( uniq( @times ) ); - print "$utimes[$#utimes]"; + if ( $#times >= 0 ) { + my @utimes = sort( uniq( @times ) ); + if( $cyc == 1 ) { + print "$utimes[$#utimes]"; + $found_cycle = 1; + } elsif( $cyc == 2 && $#utimes >= 1 ) { + print "$utimes[$#utimes-1]"; + $found_cycle = 1; + } else { + print "$utimes[0]"; + $found_cycle = 1; + } + } } - } - } while $found_cycle == 0 && $ctr > 0; - } - else { # search is for earliest date/time + } + + } while $hr_ctr > 0 && $found_cycle == 0; - my @sortrad = sort( @cmondirs ); - my $ctr = -1; - my $found_cycle = 0; - do { - - $ctr++; - - - # In each subdirectory build a list of time.*ieee_d* files - # and parse out all unique date values. The oldest is the answer - # we're looking for. - # - # If there are no time.*ieee_d* files, step to the next iteration. - # - my $newdir = "${dirpath}/${sortrad[$ctr]}"; - opendir DIR, $newdir or die "Cannot open the current directory: $!"; - - my @tfiles = grep { /time/ } readdir DIR; - my @timefiles = grep { /ieee_d/ } @tfiles; - - if( $#timefiles >= 0 ) { - my @sorttime = sort( @timefiles ); - my @times; + if( $cyc == 0 && $ctr >= $end_ctr ){ + $exit_flag = 1; + } elsif( $cyc == 1 && $ctr <= $end_ctr ){ + $exit_flag = 1; + } - for ( my $ii=0; $ii <= $#sorttime; $ii++ ) { - my $teststr = $sorttime[$ii]; - my @values = split( '\.', $sorttime[$ii] ); - push( @times, $values[2] ); - } - - if ( $#times >= 0 ) { - $found_cycle = 1; - my @utimes = sort( uniq( @times ) ); - print "$utimes[0]"; - } - } - - } while $found_cycle == 0 && $ctr < $#sortrad ; - } + } while $found_cycle == 0 && $exit_flag == 0; - exit; diff --git a/util/Conventional_Monitor/image_gen/ush/g2ctl.pl b/util/Conventional_Monitor/image_gen/ush/g2ctl.pl index 7c06d780f2..8bce7bbcc5 100755 --- a/util/Conventional_Monitor/image_gen/ush/g2ctl.pl +++ b/util/Conventional_Monitor/image_gen/ush/g2ctl.pl @@ -1,4 +1,5 @@ #!/usr/bin/perl -w +#------------------------------------------------------------------------------ # makes a GrADS control file for grib2 files # # requires wgrib2 and Perl5 @@ -36,12 +37,10 @@ use POSIX; use Math::Trig qw(deg2rad rad2deg); - -# ***** if wgrib2 is not on path, add it here -#$wgrib2='wgrib2'; -$wgrib2='/nwprod/util/exec/wgrib2'; -# $wgrib2='/export/cpc-lw-webisuzak/wd51we/bin.lnx64/wgrib2'; -# $wgrib2='/export/cpc-lw-webisuzak/wd51we/grib2/wgrib2/wgrib2'; +#------------------------------------------------ +# $WGRIB2 is defined in module grib_util/1.1.1 +# +$wgrib2="$ENV{WGRIB2}"; $wflag=""; $tflag="-VT"; diff --git a/util/Conventional_Monitor/image_gen/ush/grib2ctl.pl b/util/Conventional_Monitor/image_gen/ush/grib2ctl.pl index 984d6d1a18..31f7cf0173 100755 --- a/util/Conventional_Monitor/image_gen/ush/grib2ctl.pl +++ b/util/Conventional_Monitor/image_gen/ush/grib2ctl.pl @@ -38,8 +38,8 @@ # ***** if wgrib is not on path, add it here # $wgrib='/u/wx51we/home/bin/wgrib'; #$wgrib='wgrib'; -$wgrib=(system("wgrib --v > /dev/null 2>&1") == 0) ? 'wgrib' : '/usrx/local/grads/bin/wgrib' ; # NCEP only - +$wgrib=(system("wgrib --v > /dev/null 2>&1") == 0) ? 'wgrib' : '/gpfs/dell1/nco/ops/nwprod/grib_util.v1.1.1/exec/wgrib' ; # NCEP only +print STDERR "*** wgrib = $wgrib \n\n"; # **** directory of interpolation files $pdef_dir='/usr/local/lib/grads'; diff --git a/util/Conventional_Monitor/image_gen/ush/make_timesers_ctl.sh b/util/Conventional_Monitor/image_gen/ush/make_timesers_ctl.sh deleted file mode 100755 index 06716d6dd3..0000000000 --- a/util/Conventional_Monitor/image_gen/ush/make_timesers_ctl.sh +++ /dev/null @@ -1,91 +0,0 @@ -#!/bin/sh -# -# make the control files for the 6 hour gdas quick look -# v1.1 2/99 -set -xa - -bdate=$1 -edate=$2 -disk=$3 -cycle=$4 -type=$5 - -hour=`echo $edate | cut -c9-10` - -date0=$bdate -date1=$edate - -#date0=`find $disk -name "${cycle}_${type}_stas.????????${hour}" -print | sort \ -# | head -n 1 | sed "s/^.*${cycle}_${type}_stas\.//"` -#date1=`find $disk -name "${cycle}_${type}_stas.????????${hour}" -print | sort \ -# | tail -n 1 | sed "s/^.*${cycle}_${type}_stas\.//"` - -[ "$date0" = '' ] && continue - -yr=`echo $date0 | cut -c1-4` -mo=`echo $date0 | cut -c5-6` -da=`echo $date0 | cut -c7-8` - -yr1=`echo $date1 | cut -c1-4` - -date0=`echo $date0 | cut -c1-8` -date1=`echo $date1 | cut -c1-8` - -jday0=`./julian.sh $date0` -jday1=`./julian.sh $date1` - -if [ "$yr" = "$yr1" ];then - -t=`expr $jday1 - $jday0` -else - -leap=`expr $yr % 4` -nbase=${yr1}000 -if [ $leap -eq 0 ]; then -ndays1=${yr}366 -else -ndays1=${yr}365 -fi -t=`expr $jday1 - $nbase` -t=`expr $t + $ndays1` -t=`expr $t - $jday0` -fi - -ndays=`expr $t + 1` - -case $mo in - 01) month=jan;; - 02) month=feb;; - 03) month=mar;; - 04) month=apr;; - 05) month=may;; - 06) month=jun;; - 07) month=jul;; - 08) month=aug;; - 09) month=sep;; - 10) month=oct;; - 11) month=nov;; - 12) month=dec;; - *) echo "month error $mo" - exit 1;; -esac - -gdate="${hour}Z${da}${month}$yr" - -if [ "${type}" = 'u' -o "${type}" = 'v' ]; then -cp uv_stas.ctl ${type}_stas.ctl -fi -# make pgb.ctl and flx.ctl -sed <${type}_stas.ctl -e "s/(date0)/$date0 ${hour}Z/" \ - -e "s/(date1)/$date1 ${hour}Z/" \ - -e "s/tdef.*\$/tdef $ndays linear $gdate 24hr/" \ - > tmp.ctl - -setdir="dset ${disk}/${cycle}_${type}_stas.%y4%m2%d2%h2" -sed -e "s=^dset.*=${setdir}=" tmp.ctl >${type}_stas_${cycle}.ctl - -if [ ! -s ${disk}/${type}_stas_${cycle}.ctl ];then -cp ${type}_stas_${cycle}.ctl ${disk} -fi - -#exit 0 diff --git a/util/Conventional_Monitor/image_gen/ush/mk_horz_hist.sh b/util/Conventional_Monitor/image_gen/ush/mk_horz_hist.sh index 3f91818fdf..63dd2668b9 100755 --- a/util/Conventional_Monitor/image_gen/ush/mk_horz_hist.sh +++ b/util/Conventional_Monitor/image_gen/ush/mk_horz_hist.sh @@ -12,7 +12,7 @@ set -ax rc=0 - echo "CMON_SUFFIX = $CMON_SUFFIX" + echo "CONMON_SUFFIX = $CONMON_SUFFIX" echo "C_TANKDIR = $C_TANKDIR" export PDY=`echo ${PDATE}|cut -c1-8` @@ -39,66 +39,69 @@ set -ax export nreal_uv=${nreal_uv:-21} -#------------------------------ -# submit the plot_hist job -#------------------------------ + #------------------------------ + # submit the plot_hist job + #------------------------------ -jobname="${JOBNAME}_hist" -plot_hist="${C_IG_SCRIPTS}/plot_hist.sh" -logfile="${C_LOGDIR}/plothist_${CMON_SUFFIX}.${PDY}.${CYC}.log" -errfile="${C_LOGDIR}/plothist_${CMON_SUFFIX}.${PDY}.${CYC}.err" -rm -f $logfile -rm -f $errfile + jobname="${JOBNAME}_hist" + plot_hist="${C_IG_SCRIPTS}/plot_hist.sh" + logfile="${C_LOGDIR}/plothist_${CONMON_SUFFIX}.${PDY}.${CYC}.log" + errfile="${C_LOGDIR}/plothist_${CONMON_SUFFIX}.${PDY}.${CYC}.err" + rm -f $logfile + rm -f $errfile -if [[ $MY_MACHINE = "wcoss" ]]; then - $SUB -q $JOB_QUEUE -P $PROJECT -o ${logfile} -M 100 -R affinity[core] -W 0:20 -J ${jobname} -cwd ${PWD} ${plot_hist} + if [[ ${MY_MACHINE} = "wcoss_d" || ${MY_MACHINE} = "wcoss_c" ]]; then + ${SUB} -q ${JOB_QUEUE} -P ${PROJECT} -o ${logfile} -M 100 \ + -R affinity[core] -W 0:20 -J ${jobname} -cwd ${PWD} ${plot_hist} -elif [[ $MY_MACHINE = "theia" ]]; then - ${SUB} -A ${ACCOUNT} --ntasks=1 --time=00:15:00 \ + elif [[ $MY_MACHINE = "hera" ]]; then + ${SUB} -A ${ACCOUNT} --ntasks=1 --time=00:20:00 \ -p service -J ${jobname} -o ${logfile} ${plot_hist} -fi + fi -#------------------------------ -# submit the plot_horz job -#------------------------------ + #------------------------------ + # submit the plot_horz job + #------------------------------ -jobname="${JOBNAME}_horz" -plot_horz="${C_IG_SCRIPTS}/plot_horz.sh" -logfile="${C_LOGDIR}/plothorz_${CMON_SUFFIX}.${PDY}.${CYC}.log" -errfile="${C_LOGDIR}/plothorz_${CMON_SUFFIX}.${PDY}.${CYC}.err" -rm -f $logfile -rm -f $errfile + jobname="${JOBNAME}_horz" + plot_horz="${C_IG_SCRIPTS}/plot_horz.sh" + logfile="${C_LOGDIR}/plothorz_${CONMON_SUFFIX}.${PDY}.${CYC}.log" + errfile="${C_LOGDIR}/plothorz_${CONMON_SUFFIX}.${PDY}.${CYC}.err" + rm -f $logfile + rm -f $errfile -if [[ $MY_MACHINE = "wcoss" ]]; then - $SUB -q $JOB_QUEUE -P $PROJECT -o ${logfile} -M 100 -R affinity[core] -W 0:20 -J ${jobname} -cwd ${PWD} ${plot_horz} + if [[ $MY_MACHINE = "wcoss_d" || ${MY_MACHINE} = "wcoss_c" ]]; then + $SUB -q $JOB_QUEUE -P $PROJECT -o ${logfile} -M 300 \ + -R affinity[core] -W 0:20 -J ${jobname} -cwd ${PWD} ${plot_horz} -elif [[ $MY_MACHINE = "theia" ]]; then - ${SUB} -A ${ACCOUNT} --ntasks=1 --time=00:15:00 \ + elif [[ $MY_MACHINE = "hera" ]]; then + ${SUB} -A ${ACCOUNT} --ntasks=1 --time=00:20:00 \ -p service -J ${jobname} -o ${logfile} ${plot_horz} -fi + fi -#------------------------------ -# submit the plot_horz_uv job -#------------------------------ + #------------------------------ + # submit the plot_horz_uv job + #------------------------------ -jobname="${JOBNAME}_horz_uv" -plot_horz_uv="${C_IG_SCRIPTS}/plot_horz_uv.sh" -logfile="${C_LOGDIR}/plothorz_uv_${CMON_SUFFIX}.${PDY}.${CYC}.log" -errfile="${C_LOGDIR}/plothorz_uv_${CMON_SUFFIX}.${PDY}.${CYC}.err" -rm -f $logfile -rm -f $errfile + jobname="${JOBNAME}_horz_uv" + plot_horz_uv="${C_IG_SCRIPTS}/plot_horz_uv.sh" + logfile="${C_LOGDIR}/plothorz_uv_${CONMON_SUFFIX}.${PDY}.${CYC}.log" + errfile="${C_LOGDIR}/plothorz_uv_${CONMON_SUFFIX}.${PDY}.${CYC}.err" + rm -f $logfile + rm -f $errfile -if [[ $MY_MACHINE = "wcoss" ]]; then - $SUB -q $JOB_QUEUE -P $PROJECT -o ${logfile} -M 100 -R affinity[core] -W 0:20 -J ${jobname} ${plot_horz_uv} + if [[ $MY_MACHINE = "wcoss_d" || $MY_MACHINE = "wcoss_c" ]]; then + $SUB -q $JOB_QUEUE -P $PROJECT -o ${logfile} -M 300 \ + -R affinity[core] -W 0:20 -J ${jobname} ${plot_horz_uv} -elif [[ $MY_MACHINE = "theia" ]]; then - ${SUB} -A ${ACCOUNT} --ntasks=1 --time=00:15:00 \ - -p service -J ${jobname} -o ${logfile} ${plot_horz_uv} -fi + elif [[ $MY_MACHINE = "hera" ]]; then + ${SUB} -A ${ACCOUNT} --ntasks=1 --time=00:20:00 \ + -p service -J ${jobname} -o ${logfile} ${plot_horz_uv} + fi -echo "<-- mk_horz_hist.sh" +echo "<-- mk_horz_hist.sh" exit ${rc} diff --git a/util/Conventional_Monitor/image_gen/ush/mk_time_vert.sh b/util/Conventional_Monitor/image_gen/ush/mk_time_vert.sh index 96cacab2a1..ae2853a7ef 100755 --- a/util/Conventional_Monitor/image_gen/ush/mk_time_vert.sh +++ b/util/Conventional_Monitor/image_gen/ush/mk_time_vert.sh @@ -11,7 +11,7 @@ echo "--> mk_time_vert.sh" export nregion=10 - echo "CMON_SUFFIX = $CMON_SUFFIX" + echo "CONMON_SUFFIX = $CONMON_SUFFIX" echo "C_TANKDIR = $C_TANKDIR" echo "PDATE = $PDATE" @@ -24,40 +24,49 @@ echo "--> mk_time_vert.sh" # submit time ps plots #-------------------------------------------- jobname="${JOBNAME}_time_ps" - logfile="${C_LOGDIR}/plot_time_ps_${CMON_SUFFIX}.${PDY}.${CYC}.log" - errfile="${C_LOGDIR}/plot_time_ps_${CMON_SUFFIX}.${PDY}.${CYC}.err" + logfile="${C_LOGDIR}/plot_time_ps_${CONMON_SUFFIX}.${PDY}.${CYC}.log" + errfile="${C_LOGDIR}/plot_time_ps_${CONMON_SUFFIX}.${PDY}.${CYC}.err" pltfile="${C_IG_SCRIPTS}/plot_time_ps.sh" rm -f $logfile rm -f $errfile - if [[ $MY_MACHINE == "wcoss" ]]; then - $SUB -q $JOB_QUEUE -P $PROJECT -o ${logfile} -R affinity[core] -M 100 -W 0:50 -J $jobname -cwd ${PWD} $pltfile + if [[ $MY_MACHINE == "wcoss_d" || ${MY_MACHINE} = "wcoss_c" ]]; then + $SUB -q ${JOB_QUEUE} -P ${PROJECT} -o ${logfile} -R affinity[core] \ + -M 100 -W 0:50 -J ${jobname} -cwd ${PWD} ${pltfile} - elif [[ $MY_MACHINE == "theia" ]]; then + elif [[ $MY_MACHINE == "hera" ]]; then ${SUB} -A ${ACCOUNT} --ntasks=1 --time=00:15:00 \ -p service -J ${jobname} -o ${logfile} ${pltfile} fi #-------------------------------------------- - # submit time q plots + # submit time plots #-------------------------------------------- - for type in q t uv u v; do + for type in q t uv; do jobname="${JOBNAME}_time_${type}" - logfile="${C_LOGDIR}/plot_time_${type}_${CMON_SUFFIX}.${PDY}.${CYC}.log" - errfile="${C_LOGDIR}/plot_time_${type}_${CMON_SUFFIX}.${PDY}.${CYC}.err" + logfile="${C_LOGDIR}/plot_time_${type}_${CONMON_SUFFIX}.${PDY}.${CYC}.log" + errfile="${C_LOGDIR}/plot_time_${type}_${CONMON_SUFFIX}.${PDY}.${CYC}.err" pltfile="${C_IG_SCRIPTS}/plot_time.sh " export TYPE=${type} rm -f $logfile rm -f $errfile - if [[ $MY_MACHINE == "wcoss" ]]; then - $SUB -q $JOB_QUEUE -P $PROJECT -o ${logfile} -R affinity[core] -M 100 -W 0:50 -J $jobname -cwd ${PWD} $pltfile + if [[ $MY_MACHINE == "wcoss_d" || ${MY_MACHINE} = "wcoss_c" ]]; then + + if [[ ${type} == "uv" || ${type} == "u" || ${type} == "v" ]]; then + walltime="02:30" + else + walltime="00:50" + fi + + $SUB -q ${JOB_QUEUE} -P ${PROJECT} -o ${logfile} -R affinity[core] \ + -M 100 -W ${walltime} -J ${jobname} -cwd ${PWD} ${pltfile} - elif [[ $MY_MACHINE == "theia" ]]; then + elif [[ $MY_MACHINE == "hera" ]]; then if [[ ${type} == "uv" || ${type} == "u" || ${type} == "v" ]]; then - walltime="00:22:00" + walltime="02:30:00" else - walltime="00:10:00" + walltime="00:40:00" fi ${SUB} -A ${ACCOUNT} --ntasks=1 --time=${walltime} \ @@ -71,22 +80,24 @@ echo "--> mk_time_vert.sh" # submit vertical plots #-------------------------------------------- for type in q t uv u v; do + jobname="${JOBNAME}_vert_${type}" - logfile="${C_LOGDIR}/plot_vert_${type}_${CMON_SUFFIX}.${PDY}.${CYC}.log" - errfile="${C_LOGDIR}/plot_vert_${type}_${CMON_SUFFIX}.${PDY}.${CYC}.err" + logfile="${C_LOGDIR}/plot_vert_${type}_${CONMON_SUFFIX}.${PDY}.${CYC}.log" + errfile="${C_LOGDIR}/plot_vert_${type}_${CONMON_SUFFIX}.${PDY}.${CYC}.err" pltfile="${C_IG_SCRIPTS}/plot_vert.sh " export TYPE=${type} rm -f $logfile rm -f $errfile - if [[ $MY_MACHINE == "wcoss" ]]; then - $SUB -q $JOB_QUEUE -P $PROJECT -o ${logfile} -R affinity[core] -M 100 -W 0:50 -J $jobname -cwd ${PWD} $pltfile + if [[ $MY_MACHINE == "wcoss_d" || ${MY_MACHINE} = "wcoss_c" ]]; then + $SUB -q ${JOB_QUEUE} -P ${PROJECT} -o ${logfile} -R affinity[core] \ + -M 100 -W 1:30 -J ${jobname} -cwd ${PWD} ${pltfile} - elif [[ $MY_MACHINE == "theia" ]]; then + elif [[ $MY_MACHINE == "hera" ]]; then if [[ ${type} == "uv" || ${type} == "u" || ${type} == "v" ]]; then - walltime="00:22:00" + walltime="00:50:00" else - walltime="00:10:00" + walltime="00:30:00" fi ${SUB} -A ${ACCOUNT} --ntasks=1 --time=${walltime} \ @@ -96,7 +107,6 @@ echo "--> mk_time_vert.sh" done - echo "<-- mk_time_vert.sh" exit diff --git a/util/Conventional_Monitor/image_gen/ush/onprod.sh b/util/Conventional_Monitor/image_gen/ush/onprod.sh deleted file mode 100755 index 1973d83365..0000000000 --- a/util/Conventional_Monitor/image_gen/ush/onprod.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/sh - -# -# Check to determine if this maching is currently -# the production machine. -# -# Return values: -# 1 = prod -# 0 = dev -# - iamprod=0 - - if [[ $MY_MACHINE = "wcoss" ]]; then - machine=`hostname | cut -c1` - if [[ -e /etc/prod ]]; then - prod=`cat /etc/prod | cut -c1` - - if [[ $machine = $prod ]]; then - iamprod=1 - fi - fi - fi - - echo $iamprod - exit diff --git a/util/Conventional_Monitor/image_gen/ush/plot_hist.sh b/util/Conventional_Monitor/image_gen/ush/plot_hist.sh index db62ba8282..dbe19e4a07 100755 --- a/util/Conventional_Monitor/image_gen/ush/plot_hist.sh +++ b/util/Conventional_Monitor/image_gen/ush/plot_hist.sh @@ -1,215 +1,336 @@ #!/bin/sh set -ax -date -export list=$listvar + + #------------------------------------------------------------ + # Function getField returns the corresponding value for + # a specified field ($2) in the input ($1) grads_info file. + #------------------------------------------------------------ + + getField () { + field='default' + echo "getField $1 $2" + file=$1 + field=$2 + + search_string=`cat ./${file} | grep $field` + out=`echo $search_string | gawk '{print $3}'` + return + } + + #------------------------------------------------------------ + # Function getMonth returns the corresponding GrADS string + # value for the specified numeric month. + #------------------------------------------------------------ + + getMonth () { + mo=$1 + out='' + + case $mo in + 01) out=jan;; + 02) out=feb;; + 03) out=mar;; + 04) out=apr;; + 05) out=may;; + 06) out=jun;; + 07) out=jul;; + 08) out=aug;; + 09) out=sep;; + 10) out=oct;; + 11) out=nov;; + 12) out=dec;; + *) echo "month error $mo" + exit 1;; + esac + + return + } + + #--------------------------------------------------- # # plot_hist.sh # -# plot scater images for temperature +# plot scater image histographs # #--------------------------------------------------- -echo "---> plot_hist.sh" - -export workdir=${C_PLOT_WORKDIR}/plothist - - -export xsize=800 # add standard plot sizes to parms file? -export ysize=600 - -export PDY=`echo $PDATE|cut -c1-8` -export CYC=`echo $PDATE|cut -c9-10` - -### put into local machine to show the results - -rm -rf $workdir -mkdir -p $workdir -cd $workdir - -#echo "C_TANKDIR = $C_TANKDIR" + echo "---> plot_hist.sh" + export workdir=${C_PLOT_WORKDIR}/plothist -for type in ps q t uv; do - eval stype=\${${type}_TYPE} - eval nreal=\${nreal_${type}} - exec=read_${type}.x - - echo "stype, nreal, exec = $stype, $nreal, $exec" - - - for dtype in ${stype}; do - - mtype=`echo ${dtype} | cut -f1 -d_` - subtype=`echo ${dtype} | cut -f2 -d_` - rm -f ./fileout - - - for cycle in ges anl; do + export xsize=800 # add standard plot sizes to parms file? + export ysize=600 + + export PDY=`echo $PDATE|cut -c1-8` + export CYC=`echo $PDATE|cut -c9-10` - ### read scatter data for histgram file - /bin/sh ${C_IG_SCRIPTS}/read_scatter.sh $CMON_SUFFIX $dtype $mtype $subtype $PDATE ${HOMEgdascmon}/fix ${nreal} ${exec} ${type} ${cycle} ${C_TANKDIR}/cmon.${PDY}/horz_hist/${cycle} ${C_IG_EXEC} + rm -rf $workdir + mkdir -p $workdir + cd $workdir + echo "C_TANKDIR = $C_TANKDIR" + hh_tankdir=${C_TANKDIR}/${RUN}.${PDY}/${CYC}/conmon/horz_hist - ### build the control file for the data + $UNCOMPRESS ${hh_tankdir}/anl/*.scater.*${Z} + $UNCOMPRESS ${hh_tankdir}/ges/*.scater.*${Z} - if [ -s $C_TANKDIR/cmon.${PDY}/horz_hist/$cycle/${dtype}.scater.${PDATE} ];then - cp ${C_IG_FIX}/hist_${type}.ctl ./hist_${dtype}.ctl - nlev_str=`cat stdout_${dtype}_${cycle}.${PDATE} | grep nlev` - nlev=`echo $nlev_str | gawk '{print $2}'` - echo "DEBUG: nlev = $nlev" + for type in ps q t uv; do + + eval stype=\${${type}_TYPE} + eval nreal=\${nreal_${type}} + exec=conmon_read_${type}_IG.x - sdir=" dset ^out_${dtype}_${cycle}.${PDATE}" - title="title ${dtype} ${cycle}" - xdef="xdef $nlev linear 1 1 " - sed -e "s/^title.*/${title}/" hist_${dtype}.ctl >tmp.ctl - sed -e "s/^xdef.*/${xdef}/" tmp.ctl >tmp1.ctl + echo "stype, nreal, exec = $stype, $nreal, $exec" - yr=`echo ${PDATE} | cut -c1-4` - mo=`echo ${PDATE} | cut -c5-6` - da=`echo ${PDATE} | cut -c7-8` - hr=`echo ${PDATE} | cut -c9-10` - case $mo in - 01) month=jan;; - 02) month=feb;; - 03) month=mar;; - 04) month=apr;; - 05) month=may;; - 06) month=jun;; - 07) month=jul;; - 08) month=aug;; - 09) month=sep;; - 10) month=oct;; - 11) month=nov;; - 12) month=dec;; - *) echo "month error $mo" - exit 1;; - esac + for dtype in ${stype}; do - tdef="tdef 1 linear ${hr}z${da}${month}${yr} 1hr" - sed -e "s/^tdef.*/${tdef}/" tmp1.ctl >tmp2.ctl + mtype=`echo ${dtype} | cut -f1 -d_` + subtype=`echo ${dtype} | cut -f2 -d_` + rm -f ./fileout - echo $sdir >${cycle}_${dtype}.ctl - cat tmp2.ctl >>${cycle}_${dtype}.ctl - rm -f tmp.ctl - rm -f tmp1.ctl - rm -f tmp2.ctl - - tail -3 stdout_${dtype}_${cycle}.${PDATE} >>fileout - - fi - - done ## done with cycle + tankdir=${C_TANKDIR}/${RUN}.${PDY}/${CYC}/conmon - ### set up plot variables - if [ -s $C_TANKDIR/cmon.${PDY}/horz_hist/$cycle/${dtype}.scater.${PDATE} ];then - - cp ${C_IG_GSCRIPTS}/plot_hist.gs ./plot_hist.gs - cp ${C_IG_GSCRIPTS}/setvpage.gs ./setvpage.gs + #------------------------------------------ + # The GrADS plot scripts for horiz plots + # run in two loops, ges & anl, so the + # out and ctl files for each must be set + # up before plotting. + # + for cycle in ges anl; do + + scater_file=${hh_tankdir}/$cycle/${dtype}.scater.${cycle}.${PDATE} + + if [[ -s ${scater_file} ]]; then + + #------------------------------------------ + # Read scatter data and create a GrADS + # data file for histogram generation. + # + /bin/sh ${C_IG_SCRIPTS}/read_scatter.sh $CONMON_SUFFIX \ + $dtype $mtype $subtype $PDATE ${HOMEgdas_conmon}/fix \ + ${nreal} ${exec} ${type} ${cycle} \ + ${hh_tankdir}/${cycle} ${C_IG_EXEC} + + + #------------------------------------------ + # build the GrADS control file + # + cp ${C_IG_FIX}/hist_${type}.ctl ./hist_${dtype}.ctl + + nlev_str=`cat grads_info_${dtype}_${cycle}.${PDATE} | grep nlev` + nlev=`echo $nlev_str | gawk '{print $3}'` + echo "DEBUG: nlev = $nlev" + + sdir=" dset ^out_${dtype}_${cycle}.${PDATE}" + title="title ${dtype} ${cycle}" + xdef="xdef $nlev linear 1 1 " + sed -e "s/^title.*/${title}/" hist_${dtype}.ctl >tmp.ctl + sed -e "s/^xdef.*/${xdef}/" tmp.ctl >tmp1.ctl + + yr=`echo ${PDATE} | cut -c1-4` + mo=`echo ${PDATE} | cut -c5-6` + da=`echo ${PDATE} | cut -c7-8` + hr=`echo ${PDATE} | cut -c9-10` + + month=''; getMonth ${mo}; month=${out} - sed -e "s/XSIZE/$xsize/" \ - -e "s/YSIZE/$ysize/" \ - -e "s/PLOTFILE/$dtype/" \ - -e "s/SDATE/$PDATE/" \ - plot_hist.gs >plothist_${dtype}.gs + tdef="tdef 1 linear ${hr}z${da}${month}${yr} 1hr" + sed -e "s/^tdef.*/${tdef}/" tmp1.ctl >tmp2.ctl + + echo $sdir >${cycle}_${dtype}.ctl + cat tmp2.ctl >>${cycle}_${dtype}.ctl + rm -f tmp.ctl + rm -f tmp1.ctl + rm -f tmp2.ctl + + #-------------------------------------------- + # Build the fileout.${cycle}.${dtype} file. + # + info_file="grads_info_${dtype}_${cycle}.${PDATE}" + + out=''; getField ${info_file} 'all_ncount'; all_ncount=${out} + out=''; getField ${info_file} 'all_rejqc'; all_rejqc=${out} + out=''; getField ${info_file} 'all_gros'; all_gros=${out} + out=''; getField ${info_file} 'all_std'; all_std=${out} + out=''; getField ${info_file} 'all_mean'; all_mean=${out} + + out=''; getField ${info_file} 'ioqc_ncount'; ioqc_ncount=${out} + out=''; getField ${info_file} 'ioqc_rejqc'; ioqc_rejqc=${out} + out=''; getField ${info_file} 'ioqc_gros'; ioqc_gros=${out} + out=''; getField ${info_file} 'ioqc_std'; ioqc_std=${out} + out=''; getField ${info_file} 'ioqc_mean'; ioqc_mean=${out} + + out=''; getField ${info_file} 'mon_ncount'; mon_ncount=${out} + out=''; getField ${info_file} 'mon_rejqc'; mon_rejqc=${out} + out=''; getField ${info_file} 'mon_gros'; mon_gros=${out} + out=''; getField ${info_file} 'mon_std'; mon_std=${out} + out=''; getField ${info_file} 'mon_mean'; mon_mean=${out} + + outfile=fileout.${cycle}.${dtype} + echo ${all_ncount} ${all_rejqc} ${all_gros} ${all_std} ${all_mean} > ${outfile} + echo ${ioqc_ncount} ${ioqc_rejqc} ${ioqc_gros} ${ioqc_std} ${ioqc_mean} >> ${outfile} + echo ${mon_ncount} ${mon_rejqc} ${mon_gros} ${mon_std} ${mon_mean} >> ${outfile} + + + #----------------------------- + # set up plot variables + # + if [[ ! -e ./plot_hist.gs ]]; then + cp ${C_IG_GSCRIPTS}/plot_hist.gs ./plot_hist.gs + fi + if [[ ! -e ./setvpage.gs ]]; then + cp ${C_IG_GSCRIPTS}/setvpage.gs ./setvpage.gs + fi - echo 'quit' |grads -blc " run plothist_${dtype}.gs" + sed -e "s/XSIZE/$xsize/" \ + -e "s/YSIZE/$ysize/" \ + -e "s/PLOTFILE/$dtype/" \ + -e "s/SDATE/$PDATE/" \ + plot_hist.gs >plothist_${dtype}.gs - if [ "${type}" = 'uv' ]; then + if [[ ! -d ${C_IMGNDIR}/pngs/hist/${CYC} ]]; then + mkdir -p ${C_IMGNDIR}/pngs/hist/${CYC} + fi - for uvtype in u v; do - rm -f fileout - for cycle in ges anl ; do - nlev_str=`cat stdout_${dtype}_${uvtype}_${cycle}.${PDATE} | grep nlev` - if [[ $MY_MACHINE == "ccs" ]]; then - nlev=`echo $nlev_str | sed 's/:/ /g' | gawk '{print $1}'` - elif [[ $MY_MACHINE == "wcoss" ]]; then - nlev=`echo $nlev_str | gawk '{print $2}'` - fi + if [ "${type}" = 'uv' ]; then - sdir=" dset ^out_${dtype}_${uvtype}_${cycle}.${PDATE}" - title="title ${dtype}_${uvtype} ${cycle}" - xdef="xdef $nlev linear 1 1 " - sed -e "s/^title.*/${title}/" hist_${dtype}.ctl >tmp.ctl - sed -e "s/^xdef.*/${xdef}/" tmp.ctl >tmp1.ctl + for uvtype in u v; do - yr=`echo ${PDATE} | cut -c1-4` - mo=`echo ${PDATE} | cut -c5-6` - da=`echo ${PDATE} | cut -c7-8` - hr=`echo ${PDATE} | cut -c9-10` - - case $mo in - 01) month=jan;; - 02) month=feb;; - 03) month=mar;; - 04) month=apr;; - 05) month=may;; - 06) month=jun;; - 07) month=jul;; - 08) month=aug;; - 09) month=sep;; - 10) month=oct;; - 11) month=nov;; - 12) month=dec;; - *) echo "month error $mo" - exit 1;; - esac - - - tdef="tdef 1 linear ${hr}z${da}${month}${yr} 1hr" - sed -e "s/^tdef.*/${tdef}/" tmp1.ctl >tmp2.ctl + nlev_str=`cat stdout_${dtype}_${uvtype}_${cycle}.${PDATE} | grep nlev` + nlev=`echo $nlev_str | gawk '{print $2}'` - echo $sdir >${cycle}_${dtype}_${uvtype}.ctl - cat tmp2.ctl >>${cycle}_${dtype}_${uvtype}.ctl + sdir=" dset ^out_${dtype}_${uvtype}_${cycle}.${PDATE}" + title="title ${dtype}_${uvtype} ${cycle}" + xdef="xdef $nlev linear 1 1 " + sed -e "s/^title.*/${title}/" hist_${dtype}.ctl >tmp.ctl + sed -e "s/^xdef.*/${xdef}/" tmp.ctl >tmp1.ctl + + yr=`echo ${PDATE} | cut -c1-4` + mo=`echo ${PDATE} | cut -c5-6` + da=`echo ${PDATE} | cut -c7-8` + hr=`echo ${PDATE} | cut -c9-10` + + month=''; getMonth ${mo}; month=${out} + + tdef="tdef 1 linear ${hr}z${da}${month}${yr} 1hr" + sed -e "s/^tdef.*/${tdef}/" tmp1.ctl >tmp2.ctl + + echo $sdir >${cycle}_${dtype}_${uvtype}.ctl + cat tmp2.ctl >>${cycle}_${dtype}_${uvtype}.ctl + + rm -f tmp.ctl + rm -f tmp1.ctl + rm -f tmp2.ctl + + #-------------------------------------------- + # Build the fileout.${cycle}.${dtype} file. + # + info_file="grads_info_${dtype}_${uvtype}_${cycle}.${PDATE}" + + out=''; getField ${info_file} 'all_ncount'; all_ncount=${out} + out=''; getField ${info_file} 'all_rejqc'; all_rejqc=${out} + out=''; getField ${info_file} 'all_gros'; all_gros=${out} + out=''; getField ${info_file} 'all_std'; all_std=${out} + out=''; getField ${info_file} 'all_mean'; all_mean=${out} + + out=''; getField ${info_file} 'ioqc_ncount'; ioqc_ncount=${out} + out=''; getField ${info_file} 'ioqc_rejqc'; ioqc_rejqc=${out} + out=''; getField ${info_file} 'ioqc_gros'; ioqc_gros=${out} + out=''; getField ${info_file} 'ioqc_std'; ioqc_std=${out} + out=''; getField ${info_file} 'ioqc_mean'; ioqc_mean=${out} + + out=''; getField ${info_file} 'mon_ncount'; mon_ncount=${out} + out=''; getField ${info_file} 'mon_rejqc'; mon_rejqc=${out} + out=''; getField ${info_file} 'mon_gros'; mon_gros=${out} + out=''; getField ${info_file} 'mon_std'; mon_std=${out} + out=''; getField ${info_file} 'mon_mean'; mon_mean=${out} + + outfile=fileout.${cycle}.${dtype}_${uvtype} + echo ${all_ncount} ${all_rejqc} ${all_gros} ${all_std} ${all_mean} > ${outfile} + echo ${ioqc_ncount} ${ioqc_rejqc} ${ioqc_gros} ${ioqc_std} ${ioqc_mean} >> ${outfile} + echo ${mon_ncount} ${mon_rejqc} ${mon_gros} ${mon_std} ${mon_mean} >> ${outfile} + + #----------------------------- + # set up plot variables + # + if [[ ! -e ./plot_hist.gs ]]; then + cp ${C_IG_GSCRIPTS}/plot_hist.gs ./plot_hist.gs + fi + if [[ ! -e ./setvpage.gs ]]; then + cp ${C_IG_GSCRIPTS}/setvpage.gs ./setvpage.gs + fi + + cat fileout.ges.${dtype}_${uvtype} > fileout + cat fileout.anl.${dtype}_${uvtype} >> fileout + cp fileout fileout_all.${dtype}_${uvtype} + + sed -e "s/XSIZE/$xsize/" \ + -e "s/YSIZE/$ysize/" \ + -e "s/PLOTFILE/${dtype}_${uvtype}/" \ + -e "s/SDATE/$PDATE/" \ + plot_hist.gs > plothist_${dtype}_${uvtype}.gs - rm -f tmp.ctl - rm -f tmp1.ctl - rm -f tmp2.ctl - tail -3 stdout_${dtype}_${uvtype}_${cycle}.${PDATE} >>fileout + #------------------------------------- + # run the GrADS plot script + # + echo 'quit' | grads -blc " run plothist_${dtype}_${uvtype}.gs" - done + done ### uvtype loop + fi - ### set up plot variables - cp $C_IM_GSCRIPTS/plot_hist.gs ./plot_hist.gs + fi ## -s $scater_file + done ## done with cycle - sed -e "s/XSIZE/$xsize/" \ - -e "s/YSIZE/$ysize/" \ - -e "s/PLOTFILE/${dtype}_${uvtype}/" \ - -e "s/SDATE/$PDATE/" \ - plot_hist.gs >plothist_${dtype}_${uvtype}.gs + #------------------------------------- + # run the GrADS plot script + # + cat fileout.ges.${dtype} > fileout + cat fileout.anl.${dtype} >> fileout + cp fileout fileout_all.${dtype} + + echo 'quit' | grads -blc " run plothist_${dtype}.gs" + rm fileout + + img_files=`ls *hist*.png` + for imgf in $img_files; do + newf=`echo $imgf | sed -e "s/\./.${PDATE}./g"` + echo $newf + cp $imgf $newf + mv $newf ${C_IMGNDIR}/pngs/hist/. + done - echo 'quit' |grads -blc " run plothist_${dtype}_${uvtype}.gs" +# if [[ $CONMON_SUFFIX != "v16rt2" ]]; then +# mv -f *hist*.png ${C_IMGNDIR}/pngs/hist/${CYC}/. +# fi + done ### dtype loop - done ### uvtype loop - fi - fi - done ### dtype loop + done ### type loop - mkdir -p ${C_IMGNDIR}/pngs/hist/${CYC} - cp -f *hist*.png ${C_IMGNDIR}/pngs/hist/${CYC}/. + $COMPRESS ${hh_tankdir}/anl/*.scater.* + $COMPRESS ${hh_tankdir}/ges/*.scater.* -# #rm -f *hist*.png -done ### type loop + if [[ ${C_IG_SAVE_WORK} -eq 0 ]]; then + cd $workdir + cd .. + rm -rf $workdir + fi -##cd $workdir -##rm -rf * -##cd .. -##rm -rf $workdir + echo "<--- plot_hist.sh" -echo "<--- plot_hist.sh" exit diff --git a/util/Conventional_Monitor/image_gen/ush/plot_horz.sh b/util/Conventional_Monitor/image_gen/ush/plot_horz.sh index 8444ca9f83..4fd59f880b 100755 --- a/util/Conventional_Monitor/image_gen/ush/plot_horz.sh +++ b/util/Conventional_Monitor/image_gen/ush/plot_horz.sh @@ -5,214 +5,215 @@ # # This produces the horizontal temperature images. #---------------------------------------------------------------------------------------- -## the script to plot scater image for temperature -set -ax -date + set -ax + date -echo "--> plot_horz.sh" + echo "--> plot_horz.sh" -rc=0 -pdy=`echo $PDATE|cut -c1-8` -cyc=`echo $PDATE|cut -c9-10` -hh_tankdir=${C_TANKDIR}/cmon.${pdy}/horz_hist + rc=0 + pdy=`echo $PDATE|cut -c1-8` + cyc=`echo $PDATE|cut -c9-10` + hh_tankdir=${C_TANKDIR}/${RUN}.${PDY}/${CYC}/conmon/horz_hist -export xsize=x800 -export ysize=y600 + export xsize=x800 + export ysize=y600 -export tmpdir_plothorz=${C_PLOT_WORKDIR}/plothorz -rm -rf $tmpdir_plothorz -mkdir -p $tmpdir_plothorz -cd $tmpdir_plothorz + export tmpdir_plothorz=${C_PLOT_WORKDIR}/plothorz + rm -rf $tmpdir_plothorz + mkdir -p $tmpdir_plothorz + cd $tmpdir_plothorz -#---------------------------------------------------------------------- -# Link in the analysis and guess data files -#---------------------------------------------------------------------- -ln -s ${hh_tankdir}/anl/anal.${PDATE} anal.${PDATE} -ln -s ${hh_tankdir}/ges/guess.${PDATE} guess.${PDATE} + #---------------------------------------------------------------------- + # link in the analysis and guess data files + #---------------------------------------------------------------------- + ${UNCOMPRESS} ${hh_tankdir}/anl/anal.${PDATE}.${Z} + ${UNCOMPRESS} ${hh_tankdir}/ges/guess.${PDATE}.${Z} + ln -s ${hh_tankdir}/anl/anal.${PDATE} anal.${PDATE} + ln -s ${hh_tankdir}/ges/guess.${PDATE} guess.${PDATE} -#---------------------------------------------------------------------- -# create the idx and ctl files for ges|anl grib|grib2 files -#---------------------------------------------------------------------- -echo "grib2 = $grib2" -if [[ $grib2 -eq 0 ]]; then # grib files -# `module load wgrib` - echo "handling grib files" - ${C_IG_SCRIPTS}/grib2ctl.pl anal.${PDATE} > anal.ctl - gribmap -i anal.ctl -0 - ${C_IG_SCRIPTS}/grib2ctl.pl -verf guess.${PDATE} > guess.ctl - gribmap -i guess.ctl -else # grib2 -# `module load wgrib2` - echo "handling grib2 files" - ${C_IG_SCRIPTS}/g2ctl.pl -0 anal.$PDATE > anal.ctl - gribmap -0 -i anal.ctl - ${C_IG_SCRIPTS}/g2ctl.pl guess.$PDATE > guess.ctl - gribmap -i guess.ctl -fi + #---------------------------------------------------------------------- + # create the idx and ctl files for ges|anl grib|grib2 files + #---------------------------------------------------------------------- + echo "grib2 = $grib2" -#---------------------------------------------------------------------- -# Link to required grads tools -#---------------------------------------------------------------------- -ln -s ${C_IG_GSCRIPTS}/rgbset2.gs ./rgbset2.gs -ln -s ${C_IG_GSCRIPTS}/page.gs ./page.gs -ln -s ${C_IG_GSCRIPTS}/defint.gs ./defint.gs -ln -s ${C_IG_GSCRIPTS}/setvpage.gs ./setvpage.gs + if [[ $grib2 -eq 0 ]]; then # grib files + echo "handling grib files" + ${C_IG_SCRIPTS}/grib2ctl.pl anal.${PDATE} > anal.ctl + gribmap -i anal.ctl -0 + ${C_IG_SCRIPTS}/grib2ctl.pl -verf guess.${PDATE} > guess.ctl + gribmap -i guess.ctl + else # grib2 + echo "handling grib2 files" + ${C_IG_SCRIPTS}/g2ctl.pl -0 anal.$PDATE > anal.ctl + gribmap -0 -i anal.ctl + ${C_IG_SCRIPTS}/g2ctl.pl guess.$PDATE > guess.ctl + gribmap -i guess.ctl + fi -for type in ps q t; do + #---------------------------------------------------------------------- + # Link to required grads tools + #---------------------------------------------------------------------- + ln -s ${C_IG_GSCRIPTS}/rgbset2.gs ./rgbset2.gs + ln -s ${C_IG_GSCRIPTS}/page.gs ./page.gs + ln -s ${C_IG_GSCRIPTS}/defint.gs ./defint.gs + ln -s ${C_IG_GSCRIPTS}/setvpage.gs ./setvpage.gs + ln -s ${C_IG_GSCRIPTS}/colorbar.gs ./colorbar.gs + ln -s ${C_IG_GSCRIPTS}/cbarnew.gs ./cbarnew.gs - eval stype=\${${type}_TYPE} - eval nreal=\${nreal_${type}} + for type in ps q t; do - for dtype in ${stype}; do - mtype=`echo ${dtype} | cut -f1 -d_` - subtype=`echo ${dtype} | cut -f2 -d_` + eval stype=\${${type}_TYPE} + eval nreal=\${nreal_${type}} - for cycle in ges anl; do - nt=1 - #--------------------------------------- - # build the control file for the data - #--------------------------------------- - if [ "$mtype" = 'ps180' -o "$mtype" = 'ps181' -o "$mtype" = 'ps183' -o "$mtype" = 'ps187' ]; then + for dtype in ${stype}; do + mtype=`echo ${dtype} | cut -f1 -d_` + subtype=`echo ${dtype} | cut -f2 -d_` - cp ${C_IG_FIX}/pstime.ctl ./${dtype}.ctl - cp ${C_IG_GSCRIPTS}/plot_ps_horz.gs ./plot_${dtype}.gs + for cycle in ges anl; do + nt=1 -# if [ -s ${hh_tankdir}/${cycle}/nt_${dtype}.${PDATE} ]; then -# echo "LOCATED nt file" -# nt=`cat ${hh_tankdir}/${cycle}/nt_${dtype}.${PDATE}` -# echo "nt set to $nt" -# fi + #--------------------------------------- + # build the control file for the data + #--------------------------------------- + if [ "$mtype" = 'ps180' -o "$mtype" = 'ps181' -o "$mtype" = 'ps183' -o "$mtype" = 'ps187' ]; then - elif [ "$mtype" = 'ps120' ]; then + cp ${C_IG_FIX}/pstime.ctl ./${dtype}.ctl + cp ${C_IG_GSCRIPTS}/plot_ps_horz.gs ./plot_${dtype}.gs - cp ${C_IG_FIX}/pssfc.ctl ./${dtype}.ctl - cp ${C_IG_GSCRIPTS}/plot_ps_horz.gs ./plot_${dtype}.gs -# nt=1 + elif [ "$mtype" = 'ps120' ]; then - elif [ "$mtype" = 't120' ]; then + cp ${C_IG_FIX}/pssfc.ctl ./${dtype}.ctl + cp ${C_IG_GSCRIPTS}/plot_ps_horz.gs ./plot_${dtype}.gs - cp ${C_IG_FIX}/tmandlev.ctl ./${dtype}.ctl - cp ${C_IG_GSCRIPTS}/plot_tallev_horz.gs ./plot_${dtype}.gs -# nt=1 + elif [ "$mtype" = 't120' ]; then - elif [ "$mtype" = 't180' -o "$mtype" = 't181' -o "$mtype" = 't182' -o "$mtype" = 't183' -o "$mtype" = 't187' ]; then + cp ${C_IG_FIX}/tmandlev.ctl ./${dtype}.ctl + cp ${C_IG_GSCRIPTS}/plot_tallev_horz.gs ./plot_${dtype}.gs - cp ${C_IG_FIX}/tsfc.ctl ./${dtype}.ctl - cp ${C_IG_GSCRIPTS}/plot_tsfc_horz.gs ./plot_${dtype}.gs -# nt=1 + elif [ "$mtype" = 't180' -o "$mtype" = 't181' -o "$mtype" = 't182' -o "$mtype" = 't183' -o "$mtype" = 't187' ]; then - elif [ "$mtype" = 't130' -o "$mtype" = 't131' -o "$mtype" = 't132' -o "$mtype" = 't133' -o "$mtype" = 't134' -o "$mtype" = 't135' ]; then + cp ${C_IG_FIX}/tsfc.ctl ./${dtype}.ctl + cp ${C_IG_GSCRIPTS}/plot_tsfc_horz.gs ./plot_${dtype}.gs + + elif [ "$mtype" = 't130' -o "$mtype" = 't131' -o "$mtype" = 't132' -o "$mtype" = 't133' -o "$mtype" = 't134' -o "$mtype" = 't135' ]; then - cp ${C_IG_FIX}/tallev.ctl ./${dtype}.ctl - cp ${C_IG_GSCRIPTS}/plot_tallev_horz.gs ./plot_${dtype}.gs -# nt=1 + cp ${C_IG_FIX}/tallev.ctl ./${dtype}.ctl + cp ${C_IG_GSCRIPTS}/plot_tallev_horz.gs ./plot_${dtype}.gs + + elif [ "$mtype" = 'q120' ]; then + + cp ${C_IG_FIX}/qmandlev.ctl ./${dtype}.ctl + cp ${C_IG_GSCRIPTS}/plot_qallev_horz.gs ./plot_${dtype}.gs - elif [ "$mtype" = 'q120' ]; then + elif [ "$mtype" = 'q180' -o "$mtype" = 'q181' -o "$mtype" = 'q182' -o "$mtype" = 'q183' -o "$mtype" = 'q187' ];then + cp ${C_IG_FIX}/qsfc.ctl ./${dtype}.ctl + cp ${C_IG_GSCRIPTS}/plot_qsfc_horz.gs ./plot_${dtype}.gs - cp ${C_IG_FIX}/qmandlev.ctl ./${dtype}.ctl - cp ${C_IG_GSCRIPTS}/plot_qallev_horz.gs ./plot_${dtype}.gs -# nt=1 + elif [ "$mtype" = 'q130' -o "$mtype" = 'q131' -o "$mtype" = 'q132' -o "$mtype" = 'q133' -o "$mtype" = 'q134' -o "$mtype" = 'q135' ]; then + cp ${C_IG_FIX}/qallev.ctl ./${dtype}.ctl + cp ${C_IG_GSCRIPTS}/plot_qallev_horz.gs ./plot_${dtype}.gs - elif [ "$mtype" = 'q180' -o "$mtype" = 'q181' -o "$mtype" = 'q183' -o "$mtype" = 'q187' ];then - cp ${C_IG_FIX}/qsfc.ctl ./${dtype}.ctl - cp ${C_IG_GSCRIPTS}/plot_qsfc_horz.gs ./plot_${dtype}.gs -# if [ -s ${hh_tankdir}/${cycle}/nt_${dtype}.${PDATE} ]; then -# echo "LOCATED nt file" -# nt=`cat ${hh_tankdir}/${cycle}/nt_${dtype}.${PDATE}` -# nt=1 -# echo "nt set to $nt" -# fi + elif [ "$mtype" = 'uv220' ]; then + + cp $CTLDIR/uvmandlev.ctl ./${dtype}.ctl + cp $GSCRIPTS/plot_uvallev_horz.gs ./plot_${dtype}.gs - elif [ "$mtype" = 'q130' -o "$mtype" = 'q131' -o "$mtype" = 'q132' -o "$mtype" = 'q133' -o "$mtype" = 't134' ]; then - cp ${C_IG_FIX}/qallev.ctl ./${dtype}.ctl - cp ${C_IG_GSCRIPTS}/plot_qallev_horz.gs ./plot_${dtype}.gs -# nt=1 + elif [ "$mtype" = 'uv223' -o "$mtype" = 'uv224' -o "$mtype" = 'uv228' ]; then - elif [ "$mtype" = 'uv220' ]; then + cp $CTLDIR/uvsig.ctl ./${dtype}.ctl + cp $GSCRIPTS/plot_uvallev_horz.gs ./plot_${dtype}.gs + + elif [ "$mtype" = 'uv221' -o "$mtype" = 'uv230' -o "$mtype" = 'uv231' -o "$mtype" = 'uv232' -o "$mtype" = 'uv233' -o "$mtype" = 'uv234' -o "$mtype" = 'uv235' ]; then - cp $CTLDIR/uvmandlev.ctl ./${dtype}.ctl - cp $GSCRIPTS/plot_uvallev_horz.gs ./plot_${dtype}.gs -# nt=1 + cp $CTLDIR/uvallev.ctl ./${dtype}.ctl + cp $GSCRIPTS/plot_uvallev_horz.gs ./plot_${dtype}.gs - elif [ "$mtype" = 'uv223' -o "$mtype" = 'uv224' -o "$mtype" = 'uv228' ]; then + fi - cp $CTLDIR/uvsig.ctl ./${dtype}.ctl - cp $GSCRIPTS/plot_uvallev_horz.gs ./plot_${dtype}.gs -# nt=1 - elif [ "$mtype" = 'uv221' -o "$mtype" = 'uv230' -o "$mtype" = 'uv231' -o "$mtype" = 'uv232' -o "$mtype" = 'uv233' -o "$mtype" = 'uv234' -o "$mtype" = 'uv235' ]; then + sdir=" dset ${dtype}.grads.${cycle}.${PDATE}" + title="title ${dtype} ${cycle}" + sed -e "s/^title.*/${title}/" ${dtype}.ctl >tmp.ctl + echo $sdir >${dtype}.grads.${cycle}.ctl + cat tmp.ctl >>${dtype}.grads.${cycle}.ctl + rm -f tmp.ctl + rm -f ${dtype}.ctl - cp $CTLDIR/uvallev.ctl ./${dtype}.ctl - cp $GSCRIPTS/plot_uvallev_horz.gs ./plot_${dtype}.gs -# nt=1 - fi + #-------------------------------------------------------------- + # link in the ${dtype}_grads.${PDATE} data file from TANKDIR + #-------------------------------------------------------------- + grads_file=${hh_tankdir}/${cycle}/${dtype}.grads.${cycle}.${PDATE} + if [ -s ${grads_file}.${Z} ]; then + ${UNCOMPRESS} ${grads_file} + ln -s ${grads_file} ${dtype}.grads.${cycle}.${PDATE} + + elif [ -s ${grads_file} ]; then + ln -s ${grads_file} ${dtype}.grads.${cycle}.${PDATE} - sdir=" dset ${dtype}_grads_${cycle}.${PDATE}" - title="title ${dtype} ${cycle}" - sed -e "s/^title.*/${title}/" ${dtype}.ctl >tmp.ctl - echo $sdir >${dtype}_grads_${cycle}.ctl - cat tmp.ctl >>${dtype}_grads_${cycle}.ctl - rm -f tmp.ctl - rm -f ${dtype}.ctl + else + echo "WARNING: unable to locate ${grads_file}" + continue + fi + stnmap -1 -i ${dtype}.grads.${cycle}.ctl - #-------------------------------------------------------------- - # link in the ${dtype}_grads.${PDATE} data file from TANKDIR - #-------------------------------------------------------------- - grads_file=${hh_tankdir}/${cycle}/${dtype}_grads.${PDATE} + done ## done with cycle - if [ -s ${grads_file} ]; then - ln -s ${grads_file} ${dtype}_grads_${cycle}.${PDATE} - else - echo "WARNING: unable to locate ${grads_file}" - continue - fi - stnmap -1 -i ${dtype}_grads_${cycle}.ctl + #--------------------------------------------- + # set plot variables in the GrADS script + #--------------------------------------------- + sed -e "s/XSIZE/$xsize/" \ + -e "s/YSIZE/$ysize/" \ + -e "s/PLOTFILE/$mtype/" \ + -e "s/PLOT2/$dtype/" \ + -e "s/RDATE/$PDATE/" \ + -e "s/HINT/${hint}/" \ + -e "s/NT/$nt/" \ + plot_${dtype}.gs >plothorz_${dtype}.gs - done ## done with cycle + $GRADS -blc "run plothorz_${dtype}.gs" + mkdir -p ${C_IMGNDIR}/pngs/horz/${CYC} - ### set up plot variables -# hint=0 - sed -e "s/XSIZE/$xsize/" \ - -e "s/YSIZE/$ysize/" \ - -e "s/PLOTFILE/$mtype/" \ - -e "s/PLOT2/$dtype/" \ - -e "s/RDATE/$PDATE/" \ - -e "s/HINT/${hint}/" \ - -e "s/NT/$nt/" \ - plot_${dtype}.gs >plothorz_${dtype}.gs + img_files=`ls *.png` + for imgf in $img_files; do + newf=`echo $imgf | sed -e "s/\./.${PDATE}./g"` + cp $imgf $newf + mv $newf ${C_IMGNDIR}/pngs/horz/. + done - $GRADS -blc "run plothorz_${dtype}.gs" +# if [[ $CONMON_SUFFIX != "v16rt2" ]]; then +# mv -f *.png ${C_IMGNDIR}/pngs/horz/${CYC}/. +# fi - mkdir -p ${C_IMGNDIR}/pngs/horz/${CYC} - cp -f *.png ${C_IMGNDIR}/pngs/horz/${CYC}/. -# rm -f *png + done ### dtype loop - done ### dtype loop + done ### type loop -done ### type loop + ${COMPRESS} ${hh_tankdir}/ges/* + ${COMPRESS} ${hh_tankdir}/anl/* -#cd $tmpdir_plothorz -#rm -rf $PDATE -#cd .. -#rm -rf $tmpdir_plothorz + if [[ ${C_IG_SAVE_WORK} -eq 0 ]]; then + cd $workdir + cd .. + rm -rf $workdir + fi -echo "<-- plot_horz.sh" + echo "<-- plot_horz.sh" exit $rc diff --git a/util/Conventional_Monitor/image_gen/ush/plot_horz_uv.sh b/util/Conventional_Monitor/image_gen/ush/plot_horz_uv.sh index 3b266caf40..5cefc700ab 100755 --- a/util/Conventional_Monitor/image_gen/ush/plot_horz_uv.sh +++ b/util/Conventional_Monitor/image_gen/ush/plot_horz_uv.sh @@ -1,178 +1,208 @@ #!/bin/sh set -ax -#--------------------------------------------------------------------- -# -# plot_horz_uv.sh -# -# plot scater image for temperature -#--------------------------------------------------------------------- -echo "--> plot_horz_uv.sh" + #--------------------------------------------------------------------- + # + # plot_horz_uv.sh + # + # plot scater image for temperature + #--------------------------------------------------------------------- + echo "--> plot_horz_uv.sh" -rc=0 -pdy=`echo $PDATE|cut -c1-8` -cyc=`echo $PDATE|cut -c9-10` -hh_tankdir=${C_TANKDIR}/cmon.${pdy}/horz_hist -export savedir=${hh_tankdir} + rc=0 + pdy=`echo $PDATE|cut -c1-8` + cyc=`echo $PDATE|cut -c9-10` + hh_tankdir=${C_TANKDIR}/${RUN}.${PDY}/${CYC}/conmon/horz_hist + export savedir=${hh_tankdir} -export tmpdir_plothorz=${C_PLOT_WORKDIR}/plothorz_uv -rm -rf $tmpdir_plothorz -mkdir -p $tmpdir_plothorz -cd $tmpdir_plothorz + export workdir=${C_PLOT_WORKDIR}/plothorz_uv + rm -rf $workdir + mkdir -p $workdir + cd $workdir -export xsize=x800 -export ysize=y600 -export NCP="cp -f" -#export hint=0 + export xsize=x800 + export ysize=y600 + export NCP="cp -f" -#---------------------------------------------------------------------- -# Link to required data and control files -#---------------------------------------------------------------------- -ln -s ${hh_tankdir}/anl/anal.${PDATE} anal.${PDATE} -ln -s ${hh_tankdir}/ges/guess.${PDATE} guess.${PDATE} + #---------------------------------------------------------------------- + # Link in the analysis and guess data files + #---------------------------------------------------------------------- + ${UNCOMPRESS} ${hh_tankdir}/anl/anal.${PDATE}.${Z} + ${UNCOMPRESS} ${hh_tankdir}/ges/guess.${PDATE}.${Z} + ln -s ${hh_tankdir}/anl/anal.${PDATE} anal.${PDATE} + ln -s ${hh_tankdir}/ges/guess.${PDATE} guess.${PDATE} -#---------------------------------------------------------------------- -# create the idx and ctl files for ges|anl grib|grib2 files -#---------------------------------------------------------------------- -echo "grib2 = $grib2" -if [[ $grib2 -eq 0 ]]; then # grib files -# `module load wgrib` - echo "handling grib files" - ${C_IG_SCRIPTS}/grib2ctl.pl anal.${PDATE} > anal.ctl - gribmap -i anal.ctl -0 - ${C_IG_SCRIPTS}/grib2ctl.pl -verf guess.${PDATE} > guess.ctl - gribmap -i guess.ctl -else # grib2 -# `module load wgrib2` - echo "handling grib2 files" - ${C_IG_SCRIPTS}/g2ctl.pl -0 anal.$PDATE > anal.ctl - gribmap -0 -i anal.ctl - ${C_IG_SCRIPTS}/g2ctl.pl guess.$PDATE > guess.ctl - gribmap -i guess.ctl -fi + #---------------------------------------------------------------------- + # create the idx and ctl files for ges|anl grib|grib2 files + #---------------------------------------------------------------------- + echo "grib2 = $grib2" + if [[ $grib2 -eq 0 ]]; then # grib files + echo "handling grib files" + ${C_IG_SCRIPTS}/grib2ctl.pl anal.${PDATE} > anal.ctl + gribmap -i anal.ctl -0 + ${C_IG_SCRIPTS}/grib2ctl.pl -verf guess.${PDATE} > guess.ctl + gribmap -i guess.ctl + else # grib2 + echo "handling grib2 files" + ${C_IG_SCRIPTS}/g2ctl.pl -0 anal.$PDATE > anal.ctl + gribmap -0 -i anal.ctl + ${C_IG_SCRIPTS}/g2ctl.pl guess.$PDATE > guess.ctl + gribmap -i guess.ctl + fi -#---------------------------------------------------------------------- -# Link to required grads tools -#---------------------------------------------------------------------- -ln -s ${C_IG_GSCRIPTS}/rgbset2.gs ./rgbset2.gs -ln -s ${C_IG_GSCRIPTS}/page.gs ./page.gs -ln -s ${C_IG_GSCRIPTS}/defint.gs ./defint.gs -ln -s ${C_IG_GSCRIPTS}/setvpage.gs ./setvpage.gs + #---------------------------------------------------------------------- + # Link to required grads tools + #---------------------------------------------------------------------- + ln -s ${C_IG_GSCRIPTS}/rgbset2.gs ./rgbset2.gs + ln -s ${C_IG_GSCRIPTS}/page.gs ./page.gs + ln -s ${C_IG_GSCRIPTS}/defint.gs ./defint.gs + ln -s ${C_IG_GSCRIPTS}/setvpage.gs ./setvpage.gs + ln -s ${C_IG_GSCRIPTS}/colorbar.gs ./colorbar.gs -for type in uv; do - eval stype=\${${type}_TYPE} - eval nreal=\${nreal_${type}} -# exec=read_${type} + for type in uv; do - ## decoding the dignostic file + eval stype=\${${type}_TYPE} + eval nreal=\${nreal_${type}} - for dtype in ${stype}; do + ## decoding the dignostic file - mtype=`echo ${dtype} | cut -f1 -d_` - subtype=`echo ${dtype} | cut -f2 -d_` + for dtype in ${stype}; do - for cycle in ges anl; do + mtype=`echo ${dtype} | cut -f1 -d_` + subtype=`echo ${dtype} | cut -f2 -d_` - nt=1 + for cycle in ges anl; do - ### determine what kind data to plotted: 1: all data, 0: assimilated, -1: rejected - ### or not assimilated + nt=1 - if [ "$mtype" = 'uv220' ]; then + ### determine what kind data to plotted: 1: all data, 0: assimilated, -1: rejected + ### or not assimilated - ${NCP} ${C_IG_FIX}/uvmandlev.ctl ./${dtype}.ctl - ${NCP} ${C_IG_GSCRIPTS}/plot_uvallev_horz.gs ./plot_${dtype}.gs + if [ "$mtype" = 'uv220' ]; then - elif [ "$mtype" = 'uv223' -o "$mtype" = 'uv224' -o "$mtype" = 'uv228' ]; then + ${NCP} ${C_IG_FIX}/uvmandlev.ctl ./${dtype}.ctl + ${NCP} ${C_IG_GSCRIPTS}/plot_uvallev_horz.gs ./plot_${dtype}.gs - ${NCP} ${C_IG_FIX}/uvsig.ctl ./${dtype}.ctl - ${NCP} ${C_IG_GSCRIPTS}/plot_uvallev_horz.gs ./plot_${dtype}.gs + elif [ "$mtype" = 'uv223' -o "$mtype" = 'uv224' -o "$mtype" = 'uv228' ]; then - elif [ "$mtype" = 'uv221' -o "$mtype" = 'uv230' -o "$mtype" = 'uv231' -o "$mtype" = 'uv232' -o "$mtype" = 'uv233' -o "$mtype" = 'uv234' -o "$mtype" = 'uv235' ]; then + ${NCP} ${C_IG_FIX}/uvsig.ctl ./${dtype}.ctl + ${NCP} ${C_IG_GSCRIPTS}/plot_uvallev_horz.gs ./plot_${dtype}.gs - ${NCP} ${C_IG_FIX}/uvallev.ctl ./${dtype}.ctl - ${NCP} ${C_IG_GSCRIPTS}/plot_uvallev_horz.gs ./plot_${dtype}.gs + elif [ "$mtype" = 'uv221' -o "$mtype" = 'uv230' -o "$mtype" = 'uv231' -o "$mtype" = 'uv232' -o "$mtype" = 'uv233' -o "$mtype" = 'uv234' -o "$mtype" = 'uv235' ]; then - elif [ "$mtype" = 'uv242' -o "$mtype" = 'uv243' -o "$mtype" = 'uv245' -o "$mtype" = 'uv246' -o "$mtype" = 'uv247' -o "$mtype" = 'uv248' -o "$mtype" = 'uv249' -o "$mtype" = 'uv250' -o "$mtype" = 'uv251' -o "$mtype" = 'uv252' -o "$mtype" = 'uv253' -o "$mtype" = 'uv254' -o "$mtype" = 'uv255' -o "$mtype" = 'uv256' -o "$mtype" = 'uv257' -o "$mtype" = 'uv258' ]; then + ${NCP} ${C_IG_FIX}/uvallev.ctl ./${dtype}.ctl + ${NCP} ${C_IG_GSCRIPTS}/plot_uvallev_horz.gs ./plot_${dtype}.gs - ${NCP} ${C_IG_FIX}/uvallev.ctl ./${dtype}.ctl - ${NCP} ${C_IG_GSCRIPTS}/plot_uvsatwind_horz.gs ./plot_${dtype}.gs + elif [ "$mtype" = 'uv242' -o "$mtype" = 'uv243' -o "$mtype" = 'uv245' -o "$mtype" = 'uv246' -o "$mtype" = 'uv247' -o "$mtype" = 'uv248' -o "$mtype" = 'uv249' -o "$mtype" = 'uv250' -o "$mtype" = 'uv251' -o "$mtype" = 'uv252' -o "$mtype" = 'uv253' -o "$mtype" = 'uv254' -o "$mtype" = 'uv255' -o "$mtype" = 'uv256' -o "$mtype" = 'uv257' -o "$mtype" = 'uv258' ]; then - elif [ "$mtype" = 'uv280' -o "$mtype" = 'uv281' -o "$mtype" = 'uv282' -o "$mtype" = 'uv284' -o "$mtype" = 'uv287' ]; then + ${NCP} ${C_IG_FIX}/uvallev.ctl ./${dtype}.ctl + ${NCP} ${C_IG_GSCRIPTS}/plot_uvsatwind_horz.gs ./plot_${dtype}.gs - ${NCP} ${C_IG_FIX}/uvsfc11.ctl ./${dtype}.ctl - ${NCP} ${C_IG_GSCRIPTS}/plot_uvsfc_horz.gs ./plot_${dtype}.gs - if [ -s ${hh_tankdir}/${cycle}/nt_${dtype}.${PDATE} ]; then - echo "LOCATED nt file" - nt=`cat ${hh_tankdir}/${cycle}/nt_${dtype}.${PDATE}` - echo "nt set to $nt" + elif [ "$mtype" = 'uv280' -o "$mtype" = 'uv281' -o "$mtype" = 'uv282' -o "$mtype" = 'uv284' -o "$mtype" = 'uv287' ]; then + + ${NCP} ${C_IG_FIX}/uvsfc11.ctl ./${dtype}.ctl + ${NCP} ${C_IG_GSCRIPTS}/plot_uvsfc_horz.gs ./plot_${dtype}.gs + if [ -s ${hh_tankdir}/${cycle}/nt_${dtype}.${PDATE} ]; then + echo "LOCATED nt file" + nt=`cat ${hh_tankdir}/${cycle}/nt_${dtype}.${PDATE}` + echo "nt set to $nt" + fi + + elif [ "$mtype" = 'uv229' ]; then + + ${NCP} ${C_IG_FIX}/uvsfc7.ctl ./${dtype}.ctl + ${NCP} ${C_IG_GSCRIPTS}/plot_uvsfc_horz.gs ./plot_${dtype}.gs + if [ -s ${hh_tankdir}/${cycle}/nt_${dtype}.${PDATE} ]; then + echo "LOCATED nt file" + nt=`cat ${hh_tankdir}/${cycle}/nt_${dtype}.${PDATE}` + echo "nt set to $nt" + fi fi - elif [ "$mtype" = 'uv229' ]; then - ${NCP} ${C_IG_FIX}/uvsfc7.ctl ./${dtype}.ctl - ${NCP} ${C_IG_GSCRIPTS}/plot_uvsfc_horz.gs ./plot_${dtype}.gs - if [ -s ${hh_tankdir}/${cycle}/nt_${dtype}.${PDATE} ]; then - echo "LOCATED nt file" - nt=`cat ${hh_tankdir}/${cycle}/nt_${dtype}.${PDATE}` - echo "nt set to $nt" + sdir=" dset ${dtype}.grads.${cycle}.${PDATE}" + title="title ${dtype} ${cycle}" + sed -e "s/^title.*/${title}/" ${dtype}.ctl >tmp.ctl + echo $sdir >${dtype}_grads_${cycle}.ctl + cat tmp.ctl >>${dtype}_grads_${cycle}.ctl + rm -f tmp.ctl + rm -f ${dtype}.ctl + + + #-------------------------------------------------------------- + # link in the ${dtype}_grads.${PDATE} data file from TANKDIR + #-------------------------------------------------------------- + grads_file=${hh_tankdir}/${cycle}/${dtype}.grads.${cycle}.${PDATE} + + if [ -s ${grads_file}.${Z} ]; then + ${UNCOMPRESS} ${grads_file}.${Z} + ln -s ${grads_file} ${dtype}.grads.${cycle}.${PDATE} + + elif [ -s ${grads_file} ]; then + ln -s ${grads_file} ${dtype}.grads.${cycle}.${PDATE} + + else + echo "WARNING: unable to locate ${grads_file}" + continue fi + + stnmap -1 -i ${dtype}_grads_${cycle}.ctl + + done ## done with cycle + + if [ ! -s $savedir/$cycle/${dtype}.grads.${cycle}.${PDATE} ]; then + continue fi - if [ ! -s $savedir/${cycle}/${dtype}_grads.${PDATE} ]; then - echo "BREAKing for want of ${dtype}_grads.${PDATE}" - break - fi - - sdir=" dset $savedir/${cycle}/${dtype}_grads.${PDATE}" - title="title ${dtype} ${cycle}" - sed -e "s/^title.*/${title}/" ${dtype}.ctl >tmp.ctl - echo $sdir >${dtype}_grads_${cycle}.ctl - cat tmp.ctl >>${dtype}_grads_${cycle}.ctl - rm -f tmp.ctl - rm -f ${dtype}.ctl - - done ## done with cycle - - if [ ! -s $savedir/$cycle/${dtype}_grads.${PDATE} ]; then - continue - fi - - stnmap -1 -i ${dtype}_grads_ges.ctl - - ### set up plot variables - - sed -e "s/XSIZE/$xsize/" \ - -e "s/YSIZE/$ysize/" \ - -e "s/PLOTFILE/$mtype/" \ - -e "s/PLOT2/$dtype/" \ - -e "s/RDATE/$PDATE/" \ - -e "s/HINT/${hint}/" \ - -e "s/NT/$nt/" \ - -e "s/DINDEX/$dindex/" \ + #---------------------------------------- + # set plot variables in GrADS script + #---------------------------------------- + sed -e "s/XSIZE/$xsize/" \ + -e "s/YSIZE/$ysize/" \ + -e "s/PLOTFILE/$mtype/" \ + -e "s/PLOT2/$dtype/" \ + -e "s/RDATE/$PDATE/" \ + -e "s/HINT/${hint}/" \ + -e "s/NT/$nt/" \ + -e "s/DINDEX/$dindex/" \ plot_${dtype}.gs >plothorz_${dtype}.gs + ${GRADS} -blc "run plothorz_${dtype}.gs" + + + outdir=${C_IMGNDIR}/pngs/horz/${CYC} + mkdir -p ${outdir} + + img_files=`ls *.png` + for imgf in $img_files; do + newf=`echo $imgf | sed -e "s/\./.${PDATE}./g"` + cp $imgf $newf + mv $newf ${C_IMGNDIR}/pngs/horz/. + done + + if [[ $CONMON_SUFFIX != "v16rt2" ]]; then + mv -f *.png ${outdir}/. + fi - ${GRADS} -blc "run plothorz_${dtype}.gs" + done ### dtype loop + done ### type loop - mkdir -p ${C_IMGNDIR}/pngs/horz/${CYC} - ${NCP} *.png ${C_IMGNDIR}/pngs/horz/${CYC}/. -# rm *.png + ${COMPRESS} ${hh_tankdir}/ges/* + ${COMPRESS} ${hh_tankdir}/anl/* - done ### dtype loop -done ### type loop + if [[ ${C_IG_SAVE_WORK} -eq 0 ]]; then + cd $workdir + cd .. + rm -rf $workdir + fi -#cd $tmpdir_plothorz -#rm -rf $PDATE -#cd .. -#rm -rf $tmpdir_plothorz + echo "<-- plot_horz_uv.sh" -echo "<-- plot_horz_uv.sh" exit $rc diff --git a/util/Conventional_Monitor/image_gen/ush/plot_time.sh b/util/Conventional_Monitor/image_gen/ush/plot_time.sh index 174e0c028d..6632cb8294 100755 --- a/util/Conventional_Monitor/image_gen/ush/plot_time.sh +++ b/util/Conventional_Monitor/image_gen/ush/plot_time.sh @@ -1,28 +1,48 @@ #!/bin/sh +set -ax #---------------------------------------------------------- # # plot_time.sh # #---------------------------------------------------------- -set -ax -type=${TYPE} -echo "--> plot_time.sh, type=${type}" +#---------------------------------------------------------- +# function large_mv() +# +# There are a lot of image files generated for the uv +# types, so many that loading them into a single variable +# exceeds the argument limit on wcoss_d. This function +# gets around that problem. +#---------------------------------------------------------- +function large_mv () { + while read imgf; do + newf=`echo $imgf | sed -e "s/\./.${PDATE}./g"` +# cp $imgf $newf +# mv $newf ${C_IMGNDIR}/pngs/time/. + mv $imgf ${C_IMGNDIR}/pngs/time/$newf + done +} + + + type=${TYPE} + + echo "--> plot_time.sh, type=${type}" -plotdir=${C_PLOT_WORKDIR}/plottime_${type} -rm -rf $plotdir -mkdir -p $plotdir -cd $plotdir + workdir=${C_PLOT_WORKDIR}/plottime_${type} + rm -rf $workdir + mkdir -p $workdir + cd $workdir -rc=0 -pdy=`echo $PDATE|cut -c1-8` -cyc=`echo $PDATE|cut -c9-10` -tv_tankdir=${C_TANKDIR}/cmon.${pdy}/time_vert + rc=0 + pdy=`echo $PDATE|cut -c1-8` + cyc=`echo $PDATE|cut -c9-10` + tv_tankdir=${C_TANKDIR}/${RUN}.${pdy}/${cyc}/conmon/time_vert -export xsize=x800 -export ysize=y600 + + export xsize=x800 + export ysize=y600 #--------------------------------------------------- @@ -34,15 +54,22 @@ export ysize=y600 while [[ $cdate -le $edate ]] ; do day=`echo $cdate | cut -c1-8 ` + dcyc=`echo $cdate |cut -c9-10` + + if [[ -d ${C_TANKDIR}/${RUN}.${day}/${dcyc}/conmon ]]; then - if [[ -d ${C_TANKDIR}/cmon.${day} ]]; then for cycle in ges anl; do - if [[ -s ${C_TANKDIR}/cmon.${day}/time_vert/${cycle}_${type}_stas.${cdate} ]] - then - ln -s ${C_TANKDIR}/cmon.${day}/time_vert/${cycle}_${type}_stas.${cdate} . + data_file=${cycle}_${type}_stas.${cdate} + data_fp=${C_TANKDIR}/${RUN}.${day}/${dcyc}/conmon/time_vert/${data_file} + if [[ -e ${data_fp}.${Z} ]]; then + cp -f ${data_fp}.${Z} ./${data_file}.${Z} + $UNCOMPRESS ${data_file}.${Z} + elif [[ -e ./${data_file_fp} ]]; then + cp -f ${data_fp} ./${data_file} fi + done - echo " ${C_TANKDIR}/cmon.${day} exists" + fi adate=`${NDATE} +6 ${cdate}` @@ -54,7 +81,14 @@ export ysize=y600 #--------------------------------------------------- for cycle in ges anl; do - cp -f ${tv_tankdir}/${cycle}_${type}_stas.ctl tmp.ctl + ctl_file=${tv_tankdir}/${cycle}_${type}_stas.ctl + if [[ -e ${ctl_file}.${Z} ]]; then + cp -f ${ctl_file}.${Z} tmp.ctl.${Z} + ${UNCOMPRESS} tmp.ctl.${Z} + else + cp -f ${ctl_file} tmp.ctl + fi + new_dset="dset ${cycle}_${type}_stas.%y4%m2%d2%h2" tdef=`${C_IG_SCRIPTS}/make_tdef.sh ${START_DATE} ${NUM_CYCLES} 06` @@ -79,7 +113,8 @@ export ysize=y600 # copy plots scripts locally, modify, and run #--------------------------------------------------- - for script in plotstas_time_count.gs plotstas_time_bias.gs plotstas_time_bias2.gs ;do +# for script in plotstas_time_count.gs plotstas_time_bias.gs plotstas_time_bias2.gs ;do + for script in plotstas_time_count.gs plotstas_time_bias.gs ;do plot_script=${C_IG_GSCRIPTS}/${script} if [[ -s ${plot_script} ]]; then @@ -102,17 +137,26 @@ export ysize=y600 # run the plot scripts #------------------------- grads -bpc "run ./${local_plot_script}" - cp -f *.png ${outdir}/. - - num_pngs=`ls -1 *.png | wc -l` - echo "num_pngs = ${num_pngs}" - - rm -f ./*.png + img_files=`ls *.png` + + #------------------------------------------ + # use large_mv function to avoid argument + # list overload + #------------------------------------------ +# if [[ $CONMON_SUFFIX = "v16rt2" ]]; then + ls -1 *.png | large_mv +# else +# mv -f *.png ${outdir}/. +# fi done - #cd .. - #rm -rf $plotdir + if [[ ${C_IG_SAVE_WORK} -eq 0 ]]; then + cd $workdir + cd .. + rm -rf $workdir + fi + echo "<-- plot_time.sh, type=${type}" exit diff --git a/util/Conventional_Monitor/image_gen/ush/plot_time_ps.sh b/util/Conventional_Monitor/image_gen/ush/plot_time_ps.sh index 5483cd2897..71489d2fcd 100755 --- a/util/Conventional_Monitor/image_gen/ush/plot_time_ps.sh +++ b/util/Conventional_Monitor/image_gen/ush/plot_time_ps.sh @@ -5,33 +5,33 @@ set -ax # plot_time_ps.sh #---------------------------------------------------------------------- -echo "---> plot_time_ps.sh" + echo "---> plot_time_ps.sh" -echo "START_DATE = $START_DATE" -echo "NUM_CYCLES = $NUM_CYCLES" -echo "PDATE = $PDATE" -echo "NDATE = $NDATE" + echo "START_DATE = $START_DATE" + echo "NUM_CYCLES = $NUM_CYCLES" + echo "PDATE = $PDATE" + echo "NDATE = $NDATE" -plotdir=${C_PLOT_WORKDIR}/plottime_ps -rm -rf $plotdir -mkdir -p $plotdir -cd $plotdir + workdir=${C_PLOT_WORKDIR}/plottime_ps + rm -rf $workdir + mkdir -p $workdir + cd $workdir -rc=0 -pdy=`echo $PDATE|cut -c1-8` -cyc=`echo $PDATE|cut -c9-10` -tv_tankdir=${C_TANKDIR}/cmon.${pdy}/time_vert + rc=0 + pdy=`echo $PDATE|cut -c1-8` + cyc=`echo $PDATE|cut -c9-10` + tv_tankdir=${C_TANKDIR}/${RUN}.${pdy}/${cyc}/conmon/time_vert -export xsize=x800 -export ysize=y600 + export xsize=x800 + export ysize=y600 -#--------------------------------------------------- -# plot surface pressure time series counts -#--------------------------------------------------- + #--------------------------------------------------- + # plot surface pressure time series counts + #--------------------------------------------------- cp -f ${C_IG_GSCRIPTS}/plotstas_time_count_ps.gs . cp -f ${C_IG_GSCRIPTS}/plotstas_time_bias_ps.gs . - cp -f ${C_IG_GSCRIPTS}/plotstas_time_bias2_ps.gs . +# cp -f ${C_IG_GSCRIPTS}/plotstas_time_bias2_ps.gs . #--------------------------------------------------- # Link in the data files. @@ -42,14 +42,20 @@ export ysize=y600 while [[ $cdate -le $edate ]] ; do day=`echo $cdate | cut -c1-8 ` + dcyc=`echo $cdate | cut -c9-10 ` + + if [[ -d ${C_TANKDIR}/${RUN}.${day}/${dcyc}/conmon ]]; then - if [[ -d ${C_TANKDIR}/cmon.${day} ]]; then for cycle in ges anl; do - if [[ -s ${C_TANKDIR}/cmon.${day}/time_vert/${cycle}_ps_stas.${cdate} ]]; then - ln -s ${C_TANKDIR}/cmon.${day}/time_vert/${cycle}_ps_stas.${cdate} . + stas_file=${C_TANKDIR}/${RUN}.${day}/${dcyc}/conmon/time_vert/${cycle}_ps_stas.${cdate} + if [[ -e ${stas_file}.${Z} ]]; then + ${UNCOMPRESS} ${stas_file}.${Z} + fi + if [[ -s ${stas_file} ]]; then + ln -s ${stas_file} . fi done - echo " ${C_TANKDIR}/cmon.${day} exists" + fi adate=`${NDATE} +6 ${cdate}` @@ -61,9 +67,15 @@ export ysize=y600 #--------------------------------------------------- for cycle in ges anl; do - cp -f ${tv_tankdir}/${cycle}_ps_stas.ctl tmp.ctl - new_dset=" dset ${cycle}_ps_stas.%y4%m2%d2%h2" + ctl_file=${tv_tankdir}/${cycle}_ps_stas.ctl + if [[ -e ${ctl_file}.${Z} ]]; then + cp -f ${ctl_file}.${Z} tmp.ctl.${Z} + ${UNCOMPRESS} tmp.ctl.${Z} + else + cp -f ${ctl_file} tmp.ctl + fi + new_dset=" dset ${cycle}_ps_stas.%y4%m2%d2%h2" tdef=`${C_IG_SCRIPTS}/make_tdef.sh ${START_DATE} ${NUM_CYCLES} 06` echo "tdef = $tdef" @@ -84,17 +96,34 @@ export ysize=y600 #------------------------- # run the plot scripts #------------------------- + grads -bpc "run ./plotstas_time_count_ps.gs" - cp -f *.png ${outdir}/. - rm -f ./*.png +# mv -f *.png ${outdir}/. grads -bpc "run ./plotstas_time_bias_ps.gs" - cp -f *.png ${outdir}/. - rm -f ./*.png +# mv -f *.png ${outdir}/. + +# grads -bpc "run ./plotstas_time_bias2_ps.gs" - grads -bpc "run ./plotstas_time_bias2_ps.gs" - cp -f *.png ${outdir}/. - rm -f ./*.png + img_files=`ls *.png` + for imgf in $img_files; do + newf=`echo $imgf | sed -e "s/\./.${PDATE}./g"` + cp $imgf $newf + mv $newf ${C_IMGNDIR}/pngs/time/. + done + + if [[ $CONMON_SUFFIX != "v16rt2" ]]; then + mv -f *.png ${outdir}/. + fi + + + + + if [[ ${C_IG_SAVE_WORK} -eq 0 ]]; then + cd $workdir + cd .. + rm -rf $workdir + fi echo "<--- plot_time_ps.sh" exit diff --git a/util/Conventional_Monitor/image_gen/ush/plot_vert.sh b/util/Conventional_Monitor/image_gen/ush/plot_vert.sh index a2fdf0916d..10508d1d3b 100755 --- a/util/Conventional_Monitor/image_gen/ush/plot_vert.sh +++ b/util/Conventional_Monitor/image_gen/ush/plot_vert.sh @@ -1,26 +1,27 @@ #!/bin/sh +set -ax + #------------------------------------------------------- # # plot_vert.sh # #------------------------------------------------------- -set -ax -echo "--> plot_vert.sh " + echo "--> plot_vert.sh " type=${TYPE} - plotdir=${C_PLOT_WORKDIR}/plotvert_${type} - rm -rf $plotdir - mkdir -p $plotdir - cd $plotdir + workdir=${C_PLOT_WORKDIR}/plotvert_${type} + rm -rf $workdir + mkdir -p $workdir + cd $workdir rc=0 pdy=`echo ${PDATE}|cut -c1-8` dday=`echo $PDATE|cut -c7-8` cyc=`echo ${PDATE}|cut -c9-10` - tv_tankdir=${C_TANKDIR}/cmon.${pdy}/time_vert + tv_tankdir=${C_TANKDIR}/${RUN}.${pdy}/${cyc}/conmon/time_vert #--------------------------------------------------- @@ -32,15 +33,21 @@ echo "--> plot_vert.sh " while [[ $cdate -le $edate ]] ; do day=`echo $cdate | cut -c1-8 ` + dcyc=`echo $cdate | cut -c9-10 ` - if [[ -d ${C_TANKDIR}/cmon.${day} ]]; then + if [[ -d ${C_TANKDIR}/${RUN}.${day}/${dcyc}/conmon ]]; then + for cycle in ges anl; do - if [[ -s ${C_TANKDIR}/cmon.${day}/time_vert/${cycle}_${type}_stas.${cdate} ]] - then - ln -s ${C_TANKDIR}/cmon.${day}/time_vert/${cycle}_${type}_stas.${cdate} . + stas_file=${C_TANKDIR}/${RUN}.${day}/${dcyc}/conmon/time_vert/${cycle}_${type}_stas.${cdate} + + if [[ -s ${stas_file}.${Z} ]]; then + ${UNCOMPRESS} ${stas_file}.${Z} + fi + if [[ -s ${stas_file} ]]; then + ln -s ${stas_file} . fi done - echo " ${C_TANKDIR}/cmon.${day} exists" + fi adate=`${NDATE} +6 ${cdate}` @@ -53,9 +60,16 @@ echo "--> plot_vert.sh " #--------------------------------------------------- for cycle in ges anl; do - cp -f ${tv_tankdir}/${cycle}_${type}_stas.ctl tmp.ctl + ctl_file=${tv_tankdir}/${cycle}_${type}_stas.ctl + + if [[ -e ${ctl_file}.${Z} ]]; then + cp -f ${ctl_file}.${Z} tmp.ctl.${Z} + ${UNCOMPRESS} tmp.ctl.${Z} + else + cp -f ${ctl_file} tmp.ctl + fi + new_dset=" dset ${cycle}_${type}_stas.%y4%m2%d2%h2" -# num_cycles=`expr ${NUM_CYCLES} + 1` num_cycles=${NUM_CYCLES} tdef=`${C_IG_SCRIPTS}/make_tdef.sh ${START_DATE} ${num_cycles} 06` @@ -91,7 +105,8 @@ echo "--> plot_vert.sh " fi done - for script in plotstas_vert_count.gs plotstas_vert_bias.gs plotstas_vert_bias2.gs ;do +# for script in plotstas_vert_count.gs plotstas_vert_bias.gs plotstas_vert_bias2.gs ;do + for script in plotstas_vert_count.gs plotstas_vert_bias.gs ;do plot_script=${C_IG_GSCRIPTS}/${script} if [[ -s ${plot_script} ]]; then @@ -116,10 +131,26 @@ echo "--> plot_vert.sh " done - cp -f *.png ${outdir}/. - rm -f *.png + img_files=`ls *vert*.png` + for imgf in $img_files; do + newf=`echo $imgf | sed -e "s/\./.${PDATE}./g"` + cp $imgf $newf + mv $newf ${C_IMGNDIR}/pngs/vert/. + done + + if [[ $CONMON_SUFFIX != "v16rt2" ]]; then + mv -f *.png ${outdir}/. + fi + + + if [[ ${C_IG_SAVE_WORK} -eq 0 ]]; then + cd $workdir + cd .. + rm -rf $workdir + fi + + echo "<-- plot_vert.sh " -echo "<-- plot_vert.sh " exit diff --git a/util/Conventional_Monitor/image_gen/ush/query_data_map.pl b/util/Conventional_Monitor/image_gen/ush/query_data_map.pl deleted file mode 100755 index 1f5a13df2b..0000000000 --- a/util/Conventional_Monitor/image_gen/ush/query_data_map.pl +++ /dev/null @@ -1,73 +0,0 @@ -#! /usr/bin/perl - -#------------------------------------------------------------------- -# query_data_map.pl -# -# This script returns a requested field from the data_map.xml file. -# It takes three items as input: -# 1. data_map.xml file name (full or relative path) -# 2. suffix identifying the data source (an element in the -# data_map.xml file) -# 3. requested field, one of the xml child elements of the -# suffix element. -# -# If the xml element associated with the suffix does not have the -# requested field defined, then the default_global or -# default_regional element's corresponding field will be used. The -# default is default_global, but if the suffix contains an area of -# "rgn" then the regional_default element will be used. -# -# The contents of that field are echoed to stdout for the calling -# script to access. If the field is empty or missing nothing -# will be returned. The calling script should verify a value has -# been returned before use. -# -#------------------------------------------------------------------- - use strict; - use warnings; - use XML::LibXML; - - if( $#ARGV < 2 ) { - exit - } - - my $dmfile = $ARGV[0]; - my $source = $ARGV[1]; - my $field = $ARGV[2]; - my $default="global_default"; - use XML::LibXML; - - my $parser = XML::LibXML->new(); - my $doc = $parser->parse_file($dmfile); - -# Print the contents of the field if it's found in source. -# If the field is not found in source then use the default element -# and output it's value for the requested field. - - my @srcs = $doc->findnodes("/opt/$source"); - if( @srcs <= 0 ) { - @srcs = $doc->findnodes("/opt/$default"); - } - - if ( @srcs > 0 ) { - - my $src = $srcs[0]; - my($answer) = $src->findnodes("./$field"); - my($area) = $src->findnodes("./area"); - my $src_area = $area->to_literal; - - if( $answer ) { - print $answer->to_literal; - } - else { - if( $src_area eq "rgn" ) { - $default = "regional_default"; - } - my($def_src) = $src->findnodes("/opt/$default"); - my($def_answer) = $def_src->findnodes("./$field"); - if( $def_answer ) { - print $def_answer->to_literal; - } - } - } - diff --git a/util/Conventional_Monitor/image_gen/ush/read_scatter.sh b/util/Conventional_Monitor/image_gen/ush/read_scatter.sh index e3e86bffba..302cf8e1c5 100755 --- a/util/Conventional_Monitor/image_gen/ush/read_scatter.sh +++ b/util/Conventional_Monitor/image_gen/ush/read_scatter.sh @@ -4,19 +4,13 @@ set -xa # # read_scatter.sh # +# Extract a subset of data from the scater file +# and generate an out_${mtype) data file and +# control file for GrADS. #----------------------------------------------------------------------------------- echo "---> read_scatter.sh" -echo " CMON_SUFFIX = $CMON_SUFFIX" - -##if [ $# -ne 1 ] ; then -## echo "usage: $0 date" -## exit 8 -##fi - - -## Set mydir. Remove and make clean mydir. cd mydir -##???? +echo " CONMON_SUFFIX = $CONMON_SUFFIX" exp=$1 echo "exp set to $exp" @@ -43,26 +37,14 @@ echo "datadir set to $datadir" sorcdir=${12} echo "sorcdir set to $sorcdir" -##exp=copr -## dtype=uv220_00 -## mtype=uv220 -##subtype=00 -## rdate=2007071100 -## fixdir=/nwprod/fix -## nreal=21 -## exec=read_uv.x -## type=uv -## cycle=ges -## datadir=/u/wx20es/nbns/stats/convweb/copr/horz_hist/ges -## sorcdir=/u/wx20es/home/convweb/exec - - ## set up the directory with excutable files fixfile=global_convinfo.txt -cp ${fixdir}/${fixfile} ./convinfo +if [[ ! -e ./convinfo ]]; then + cp ${fixdir}/${fixfile} ./convinfo +fi -fname=$datadir/${dtype}.scater.${rdate} +fname=$datadir/${dtype}.scater.${cycle}.${rdate} #----------------------------------------------------------- @@ -73,28 +55,34 @@ fname=$datadir/${dtype}.scater.${rdate} rm -f input cat << EOF > input &input - nreal=${nreal},mtype='${mtype}',fname='${fname}',fileo='out',rlev=0.1,insubtype=${subtype}, + nreal=${nreal}, + mtype='${mtype}', + fname='${fname}', + fileo='out_${dtype}_${cycle}.${rdate}', + rlev=0.1, + insubtype=${subtype}, + grads_info_file='grads_info_${dtype}_${cycle}.${rdate}' / EOF cp $sorcdir/$exec ./$exec -#cp $CONVINFO_FILE ./convinfo -./$exec stdout 2>&1 +./$exec stdout_${dtype}_${cycle}.${rdate} 2>&1 #rm -f $exec -##rm -f convinfo #rm -f input -#rm -f fname.out -mv out out_${dtype}_${cycle}.${rdate} -mv stdout stdout_${dtype}_${cycle}.${rdate} - -#if [ "${type}" = 'uv' ]; then -#mv out_u out_${dtype}_u_${cycle}.${rdate} -#mv out_v out_${dtype}_v_${cycle}.${rdate} -#mv stdout_u stdout_${dtype}_u_${cycle}.${rdate} -#mv stdout_v stdout_${dtype}_v_${cycle}.${rdate} -#fi + + +if [ "${type}" = 'uv' ]; then + mv out_u out_${dtype}_u_${cycle}.${rdate} + mv out_v out_${dtype}_v_${cycle}.${rdate} + + mv stdout_u stdout_${dtype}_u_${cycle}.${rdate} + mv stdout_v stdout_${dtype}_v_${cycle}.${rdate} + + mv grads_info_u grads_info_${dtype}_u_${cycle}.${rdate} + mv grads_info_v grads_info_${dtype}_v_${cycle}.${rdate} +fi echo "<--- read_scatter.sh" diff --git a/util/Conventional_Monitor/image_gen/ush/rm_img_files.pl b/util/Conventional_Monitor/image_gen/ush/rm_img_files.pl new file mode 100755 index 0000000000..e79736553f --- /dev/null +++ b/util/Conventional_Monitor/image_gen/ush/rm_img_files.pl @@ -0,0 +1,102 @@ +#!/usr/bin/perl +use strict; +use warnings; +use Getopt::Long; +use Scalar::Util qw(looks_like_number); + + +#------------------------------------------------------------------- +# +# Subroutine uniq +# +# Given an input array, return all unique values in an array. +# +#------------------------------------------------------------------- + sub uniq { + my %seen; + return grep { !$seen{$_}++ } @_; + } + + +#-------------------- +# Main begins here +#-------------------- + +print "--> rm_img_files.pl"; + +#-------------------------------- +# load command line argument(s) +#-------------------------------- +my $dir = './'; # directory to be cleaned up (~/nbns/imgn/NET/RUN/monitor/pngs) +my $nfl = 20; # number of files to keep + +GetOptions( 'dir=s' => \$dir, + 'nfl=i' => \$nfl ); + +#----------------------------------- +# get directory $dir/hist contents +#----------------------------------- +opendir my $target_dir, "$dir/hist" or die "Cannot open directory: $!"; +my @files = readdir $target_dir; +closedir $target_dir; + +#----------------------------------------------------- +# Break up file names and get the unique cycle times +# +# Sort the unique list in reverse order so the latest +# cycle time is first. +#----------------------------------------------------- +my @times = (); +foreach my $file ( @files ) { + my @spl = split( '\.', $file ); + if( looks_like_number( $spl[1] ) && length($spl[1] ) == 10 ) { + push( @times, $spl[1] ); + } +} + +my @unique = (); +if ( $#times >= 0 ) { + @unique = sort{ $b <=> $a }( uniq( @times )); +} + + +#------------------------------------- +# Identify cycle times to be removed +#------------------------------------- +my @del_list = (); +my @sdir_list = qw( hist horz time vert ); + +if( $#unique >= $nfl ) { + my $ii = $nfl; + my $end = $#unique; + + foreach my $time ( @unique ) { +# print "$time\n"; + } + + print " ii, end = $ii, $end\n"; + do { +# print "RM $ii, $unique[$ii]\n"; + push( @del_list, $unique[$ii] ); + $ii++; + } while $ii <= $end; + + + #--------------------------------------------- + # step through the del_list and dir_list to + # remove old image files + #--------------------------------------------- + + print "del_list = @del_list\n"; + + foreach my $sdir ( @sdir_list ) { + foreach my $del ( @del_list ) { + my $rm_cmd = "rm -f $dir/$sdir/*$del*"; + print "RM: $rm_cmd\n"; + system( $rm_cmd ) == 0 + or die "system $rm_cmd failed: $?"; + } + } +} + +print "<-- rm_img_files.pl"; diff --git a/util/Conventional_Monitor/image_gen/ush/run_plot_gdas.sh b/util/Conventional_Monitor/image_gen/ush/run_plot_gdas.sh deleted file mode 100755 index a993f5595c..0000000000 --- a/util/Conventional_Monitor/image_gen/ush/run_plot_gdas.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/sh - -package=ProdGSI -idev=`cat /etc/dev | cut -c1` -iprod=`cat /etc/prod | cut -c1` - -scripts=/gpfs/${idev}d2/emc/da/noscrub/${USER}/${package}/util/Conventional_Monitor/image_gen/ush -echo "scripts = $scripts" -suffix=GDAS - -export DO_DATA_RPT=1 -export DO_DIAG_RPT=1 -export NDATE=/nwprod/util/exec/ndate -export DO_ARCHIVE=1 -export JOB_QUEUE=dev_shared -#export NUM_CYCLES=120 -export NUM_CYCLES=30 -#export MAIL_CC="russ.treadon@noaa.gov, john.derber@noaa.gov, andrew.collard@noaa.gov" -export MAIL_CC="edward.c.safford@gmail.com" - -export CYCLE_INTERVAL=6 - -data_map=${scripts}/data_map.xml - -tankdir=/gpfs/${idev}d2/emc/da/noscrub/${USER}/nbns/stats/${suffix} - -imgdate=`${scripts}/query_data_map.pl ${data_map} ${suffix} imgdate` -idate=`$NDATE +${CYCLE_INTERVAL} $imgdate` - -prodate=`${scripts}/find_cycle.pl 1 ${tankdir}` -echo "imgdate, prodate = $imgdate, $prodate" -if [[ $idate -le $prodate ]]; then - - echo " firing ConMon_IG.err" - ${scripts}/ConMon_IG.sh ${suffix} $idate 1>/ptmpp1/${USER}/logs/${suffix}/ConMon/ConMon_IG.log 2>/ptmpp1/${USER}/logs/${suffix}/ConMon/ConMon_IG.err - - rc=`${scripts}/update_data_map.pl ${data_map} ${suffix} imgdate ${idate}` - -fi - - -exit diff --git a/util/Conventional_Monitor/image_gen/ush/run_transfer_gdas.sh b/util/Conventional_Monitor/image_gen/ush/run_transfer_gdas.sh deleted file mode 100755 index b71202658e..0000000000 --- a/util/Conventional_Monitor/image_gen/ush/run_transfer_gdas.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/sh - -package=CMon_486 -idev=`cat /etc/dev | cut -c1` - -scripts=/gpfs/${idev}d2/emc/da/noscrub/${USER}/${package}/util/Conventional_Monitor/image_gen/ush -suffix=GDAS - -export PROJECT=GDAS-T2O -export MY_MACHINE=wcoss - -export logfile=/ptmpp1/${USER}/logs/${suffix}/ConMon/Transfer_CMon.log -export JOB_QUEUE=transfer - -shell=sh -. /usrx/local/Modules/default/init/${shell} -module load lsf -export SUB="bsub" - -export CMON_SUFFIX=${suffix} -export jobname=transfer_${CMON_SUFFIX}_cmon - -if [[ $MY_MACHINE = "wcoss" ]]; then - $SUB -P $PROJECT -q $JOB_QUEUE -o ${logfile} -M 80 -W 0:45 \ - -R affinity[core] -J ${jobname} -cwd ${PWD} \ - ${scripts}/Transfer.sh ${CMON_SUFFIX} -else - - ${scripts}/Transfer.sh ${CMON_SUFFIX} \ - 1>/ptmpp1/${USER}/logs/${suffix}/ConMon/Transfer.log \ - 2>/ptmpp1/${USER}/logs/${suffix}/ConMon/Transfer.err - -fi - -exit diff --git a/util/Conventional_Monitor/image_gen/ush/transfer_imgs.sh b/util/Conventional_Monitor/image_gen/ush/transfer_imgs.sh new file mode 100755 index 0000000000..2107e79575 --- /dev/null +++ b/util/Conventional_Monitor/image_gen/ush/transfer_imgs.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +echo begin transfer_imgs.sh + +if [[ ${C_IMGNDIR} != "/" ]]; then + echo "C_IMGNDIR = $C_IMGNDIR" + echo "MY_MACHINE = $MY_MACHINE" + echo "WEBUSER = $WEBUSER" + echo "WEBSVR = $WEBSVR" + echo "WEBDIR = $WEBDIR" + + if [[ $MY_MACHINE = "wcoss_d" || $MY_MACHINE = "cray" ]]; then + /usr/bin/rsync -ave ssh --exclude *.ctl.${Z} --delete-during ${C_IMGNDIR}/ \ + ${WEBUSER}@${WEBSVR}.ncep.noaa.gov:${WEBDIR}/ + fi +fi + +echo end transfer_imgs.sh +exit diff --git a/util/Conventional_Monitor/image_gen/ush/update_data_map.pl b/util/Conventional_Monitor/image_gen/ush/update_data_map.pl deleted file mode 100755 index 5a28cd309d..0000000000 --- a/util/Conventional_Monitor/image_gen/ush/update_data_map.pl +++ /dev/null @@ -1,59 +0,0 @@ -#! /usr/bin/perl - -#------------------------------------------------------------------- -# update_data_map.pl -# -# This script updates a requested field in the data_map.xml file. If -# the requested field does not exist in but the parent node (suffix) -# is found then the requested field and value are added to the -# data_map.xml file. -# -# Calling sequence: -# >> update_data_map.pl ./path/to/data_map.xml suffix req_field new_val -# -# 1. data_map.xml file (full or relative path) -# 2. suffix identifying the data source (an element in the -# data_map.xml file) -# 3. requested field, one of the xml child elements of the -# suffix element. -# 4. new value for the requested field -# -# Return codes (sent to stdout): -# 0 update was successful -# 1 the suffix and/or field was not found. -# -# Note: Calling scripts generally assign a variable value to -# output from this script. If diagnostic print messages -# are left uncommented then results will become undefined. -#------------------------------------------------------------------- - use strict; - use warnings; - use XML::LibXML; - - my $dmfile = $ARGV[0]; - my $source = $ARGV[1]; - my $field = $ARGV[2]; - my $value = $ARGV[3]; - my $rc = "1"; - - my $parser = XML::LibXML->new(); - my $doc = $parser->parse_file($dmfile); - - my $query = "//$source/$field/text()"; - - my($node) = $doc->findnodes($query); - - if( $node ) { - $node->setData("$value" ); - $doc->toFile( $dmfile ); - $rc = "0"; - } - else { - my $new_query = "//$source"; - my ($src_node) = $doc->findnodes($new_query); - $src_node->appendTextChild( "$field", "$value" ); - $doc->toFile( $dmfile ); - $rc = "0"; - } - - print "$rc"; diff --git a/util/Conventional_Monitor/makeall.sh b/util/Conventional_Monitor/makeall.sh index 535dd0a0b7..b6e803f5bc 100755 --- a/util/Conventional_Monitor/makeall.sh +++ b/util/Conventional_Monitor/makeall.sh @@ -53,12 +53,12 @@ if [[ ${machine} = "wcoss" ]]; then elif [[ ${machine} = "theia" ]]; then echo "loading lmod" . /apps/lmod/6.0.1/init/ksh -elif [[ ${machine} = "cray" ]]; then +elif [[ ${machine} = "wcoss_c" ]]; then . /opt/modules/3.2.6.7/init/ksh fi -if [[ ${machine} = "wcoss" || ${machine} = "theia" || ${machine} = "cray" ]]; then +if [[ ${machine} = "wcoss" || ${machine} = "theia" || ${machine} = "wcoss_c" ]]; then # echo "machine, mod_path = $machine, $mod_path" module use -a ${mod_path} module load CMonBuild diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/conv_time/mainconv_time.f90 b/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/conv_time/mainconv_time.f90 deleted file mode 100644 index c0a6e8e764..0000000000 --- a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/conv_time/mainconv_time.f90 +++ /dev/null @@ -1,102 +0,0 @@ -! intype : the observarion type like t for tem., uv for wind -! stype : the observation sub type, like t120 uv220 - - implicit none - - integer np,mregion,nobs - integer ntype_ps,ntype_q,ntype_t,ntype_uv - - parameter(np=13) - parameter(mregion=10) - real(4),dimension(np) :: ptop,pbot,ptopq,pbotq - integer,dimension(100) :: iotype_ps,iotype_q,iotype_uv,iotype_t - integer,dimension(100) :: iosubtype_ps,iosubtype_q,iosubtype_uv,iosubtype_t - integer,dimension(100) :: ituse_ps,ituse_q,ituse_uv,ituse_t - real(4),dimension(100,2) :: varqc_ps,varqc_q,varqc_uv,varqc_t - character(len=7) dtype_ps,dtype_uv,dtype_t,dtype_q - - character(20) :: filein - character(40),dimension(mregion):: region - - real,dimension(mregion):: rlatmin,rlatmax,rlonmin,rlonmax - integer lunin,lunot,nregion - - data lunin / 11 / - data lunot / 21 / - - namelist /input/filein,nregion,region,rlatmin,rlatmax,rlonmin,rlonmax - - read(5,input) - write(6,*)' User input below' - write(6,input) - - print *,nregion,np - - dtype_ps='ps' - dtype_uv='uv' - dtype_t='t' - dtype_q='q' - - - nobs=0 - ptop(1)= 0.0; pbot(1)= 2000.0 - ptop(2) = 1000.0; pbot(2)= 2000.0 - ptop(3) = 900.0; pbot(3)= 999.9 - ptop(4) = 800.0; pbot(4)= 899.9 - ptop(5) = 600.0; pbot(5)= 799.9 - ptop(6) = 400.0; pbot(6)= 599.9 - ptop(7) = 300.0; pbot(7)= 399.9 - ptop(8) = 250.0; pbot(8)= 299.9 - ptop(9) = 200.0; pbot(9)= 249.9 - ptop(10)= 150.0; pbot(10)= 199.9 - ptop(11)= 100.0; pbot(11)= 149.9 - ptop(12)= 50.0; pbot(12)= 99.9 - ptop(13)= 0.0; pbot(13)= 49.9 - - ptopq(1)= 0.0; pbotq(1)= 2000.0 - ptopq(2)= 1000.0; pbotq(2)= 2000.0 - ptopq(3)= 950.0; pbotq(3)= 999.9 - ptopq(4)= 900.0; pbotq(4)= 949.9 - ptopq(5)= 850.0; pbotq(5)= 899.9 - ptopq(6)= 800.0; pbotq(6)= 849.9 - ptopq(7)= 750.0; pbotq(7)= 799.9 - ptopq(8)= 700.0; pbotq(8)= 749.9 - ptopq(9)= 600.0; pbotq(9)= 699.9 - ptopq(10)= 500.0; pbotq(10)= 599.9 - ptopq(11)= 400.0; pbotq(11)= 499.9 - ptopq(12)= 300.0; pbotq(12)= 399.9 - ptopq(13)= 0.0; pbotq(13)= 299.9 - - - print *,'start to call convinfo' - call convinfo(iotype_ps,iotype_q,iotype_t,iotype_uv,ntype_ps,ntype_q,ntype_t,ntype_uv,& - varqc_ps,varqc_q,varqc_t,varqc_uv,& - ituse_ps,ituse_q,ituse_t,ituse_uv,& - iosubtype_ps,iosubtype_q,iosubtype_t,iosubtype_uv) - - print *,ntype_ps,ntype_q,ntype_t,ntype_uv - print *,'finish to call convinfo' - - print *,'start to call read_conv' - call read_conv(filein,mregion,nregion,np,ptop,pbot,ptopq,pbotq,& - rlatmin,rlatmax,rlonmin,rlonmax,iotype_ps,iotype_q,& - iotype_t,iotype_uv,varqc_ps,varqc_q,varqc_t,varqc_uv,& - ntype_ps,ntype_q,ntype_t,ntype_uv,& - iosubtype_ps,iosubtype_q,iosubtype_t,iosubtype_uv) - - print *,'finish to call read_conv' - - call creatstas_ctl(dtype_ps,iotype_ps,ituse_ps,100,ntype_ps,1,nregion,18,region,& - rlatmin,rlatmax,rlonmin,rlonmax,iosubtype_ps) - call creatstas_ctl(dtype_q,iotype_q,ituse_q,100,ntype_q,np,nregion,18,region,& - rlatmin,rlatmax,rlonmin,rlonmax,iosubtype_q) - call creatstas_ctl(dtype_t,iotype_t,ituse_t,100,ntype_t,np,nregion,18,& - region,rlatmin,rlatmax,rlonmin,rlonmax,iosubtype_t) -! call creatstas_ctl(dtype_u,iotype_uv,ituse_uv,100,ntype_uv,np,nregion,18) -! call creatstas_ctl(dtype_v,iotype_uv,ituse_uv,100,ntype_uv,np,nregion,18) - call creatstas_ctl(dtype_uv,iotype_uv,ituse_uv,100,ntype_uv,np,nregion,18,& - region,rlatmin,rlatmax,rlonmin,rlonmax,iosubtype_uv) - - stop - - end diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/conv_time/read_conv.f90 b/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/conv_time/read_conv.f90 deleted file mode 100644 index 026163bfba..0000000000 --- a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/conv_time/read_conv.f90 +++ /dev/null @@ -1,370 +0,0 @@ -! intype : the observarion type like t for tem., uv for wind -! stype : the observation sub type, like t120 uv220 -! twork : the array to hold statistics for temperature: the first variable of -! array is vertical level, the second variable is the number of data type -! the third variable tatistics variable: 1: the total number -! 2:the number of data rejected by variational qc -! 3:bias,4:rms, 5: penalty,6: variational penalty -! the fourth variable is region, the fifth variable is the data usuage type -! 1, used, 2, rejected, 3, monited - -subroutine read_conv(filein,mregion,nregion,np,ptop,pbot,ptopq,pbotq,& - rlatmin,rlatmax,rlonmin,rlonmax,iotype_ps,iotype_q,& - iotype_t,iotype_uv,varqc_ps,varqc_q,varqc_t,varqc_uv,& - ntype_ps,ntype_q,ntype_t,ntype_uv,& - iosubtype_ps,iosubtype_q,iosubtype_t,iosubtype_uv) - - implicit none - - integer mregion - real(4),allocatable,dimension(:,:) :: rdiag - character(8),allocatable,dimension(:) :: cdiag - real(4),dimension(np) :: ptop,pbot,ptopq,pbotq - real(4),dimension(np,100,6,nregion,3) :: twork,qwork,uwork,vwork,uvwork - real(4),dimension(1,100,6,nregion,3) :: pswork - real,dimension(mregion):: rlatmin,rlatmax,rlonmin,rlonmax - - integer,dimension(100) :: iotype_ps,iotype_q,iotype_t,iotype_uv - integer,dimension(100) :: iosubtype_ps,iosubtype_q,iosubtype_uv,iosubtype_t - real(4),dimension(100,2) :: varqc_ps,varqc_q,varqc_t,varqc_uv - character(20) :: filein - character(3) :: dtype - - integer nchar,nreal,ii,mype,idate,iflag,itype - integer lunin,lunot,nreal1,nreal2,ldtype,intype - integer ilat,ilon,ipress,iqc,iuse,imuse,iwgt,ierr1 - integer ierr2,ierr3,ipsobs,iqobs,ioff02 - integer i,j,k,np,nregion,ltype,iregion,ntype_uv - integer iobg,iobgu,iobgv,ntype_ps,ntype_q,ntype_t - - real(4) :: bmiss - - data lunin / 11 / - data lunot / 21 / - data bmiss /-999.0/ - - - - twork=0.0;qwork=0.0;uwork=0.0;vwork=0.0;uvwork=0.0 - pswork=0.0 - - itype=1;ilat=3;ilon=4;ipress=6;iqc=9;iuse=11;imuse=12 - iwgt=13;ierr1=14;ierr2=15;ierr3=16;iobg=18;iobgu=18;iobgv=21 - - - open(lunin,file=filein,form='unformatted') - rewind(lunin) - - read(lunin) idate - - print *, 'idate=',idate - print *,ptop(1),ptop(5) - print *,pbot(1),pbot(5) - - loopd: do - read(lunin,IOSTAT=iflag) dtype,nchar,nreal,ii,mype,ioff02 - if( iflag /= 0 ) exit loopd -! print *, dtype,nchar,nreal,ii,mype - allocate(cdiag(ii),rdiag(nreal,ii)) - read(lunin,IOSTAT=iflag) cdiag,rdiag - - if( iflag /= 0 ) exit loopd - - if(trim(dtype) == ' ps') then -! print *, dtype,nchar,nreal,ii,mype - call stascal(dtype,rdiag,nreal,ii,iotype_ps,varqc_ps,ntype_ps,& - pswork,uwork,vwork,1,ptop,pbot,nregion,mregion,& - rlatmin,rlatmax,rlonmin,rlonmax,iosubtype_ps) - else if(trim(dtype) == ' q') then - call stascal(dtype,rdiag,nreal,ii,iotype_q,varqc_q,ntype_q,& - qwork,uwork,vwork,np,ptopq,pbotq,nregion,mregion,& - rlatmin,rlatmax,rlonmin,rlonmax,iosubtype_q) - else if(trim(dtype) == ' t') then - call stascal(dtype,rdiag,nreal,ii,iotype_t,varqc_t,ntype_t,& - twork,uwork,vwork,np,ptop,pbot,nregion,mregion,& - rlatmin,rlatmax,rlonmin,rlonmax,iosubtype_t) - else if(trim(dtype) == ' uv') then - call stascal(dtype,rdiag,nreal,ii,iotype_uv,varqc_uv,ntype_uv,& - uvwork,uwork,vwork,np,ptop,pbot,nregion,mregion,& - rlatmin,rlatmax,rlonmin,rlonmax,iosubtype_uv) - endif - - deallocate(cdiag,rdiag) - enddo loopd ! ending read data do loop - print *,'end of loopd' - - - close(lunin) - - - do iregion=1,nregion - do j=1,3 - do ltype=1,ntype_ps - pswork(1,ntype_ps+1,1,iregion,j)= & - pswork(1,ntype_ps+1,1,iregion,j)+pswork(1,ltype,1,iregion,j) - pswork(1,ntype_ps+1,2,iregion,j)= & - pswork(1,ntype_ps+1,2,iregion,j)+pswork(1,ltype,2,iregion,j) - pswork(1,ntype_ps+1,3,iregion,j)= & - pswork(1,ntype_ps+1,3,iregion,j)+pswork(1,ltype,3,iregion,j) - pswork(1,ntype_ps+1,4,iregion,j)= & - pswork(1,ntype_ps+1,4,iregion,j)+pswork(1,ltype,4,iregion,j) - pswork(1,ntype_ps+1,5,iregion,j)= & - pswork(1,ntype_ps+1,5,iregion,j)+pswork(1,ltype,5,iregion,j) - pswork(1,ntype_ps+1,6,iregion,j)= & - pswork(1,ntype_ps+1,6,iregion,j)+pswork(1,ltype,6,iregion,j) - - if(pswork(1,ltype,1,iregion,j) >=1.0) then - pswork(1,ltype,3,iregion,j)= & - pswork(1,ltype,3,iregion,j)/pswork(1,ltype,1,iregion,j) - pswork(1,ltype,4,iregion,j)= & - sqrt(pswork(1,ltype,4,iregion,j)/pswork(1,ltype,1,iregion,j)) - pswork(1,ltype,5,iregion,j)= & - pswork(1,ltype,5,iregion,j)/pswork(1,ltype,1,iregion,j) - pswork(1,ltype,6,iregion,j)= & - pswork(1,ltype,6,iregion,j)/pswork(1,ltype,1,iregion,j) - endif - enddo - - !---------------------------------------------- - !!! for the total surface pressure statistics - if(pswork(1,ntype_ps+1,1,iregion,j) >=1.0) then - pswork(1,ntype_ps+1,3,iregion,j) = pswork(1,ntype_ps+1,3,iregion,j)/& - pswork(1,ntype_ps+1,1,iregion,j) - pswork(1,ntype_ps+1,4,iregion,j) = sqrt(pswork(1,ntype_ps+1,4,iregion,j)& - /pswork(1,ntype_ps+1,1,iregion,j)) - pswork(1,ntype_ps+1,5,iregion,j) = pswork(1,ntype_ps+1,5,iregion,j)/& - pswork(1,ntype_ps+1,1,iregion,j) - pswork(1,ntype_ps+1,6,iregion,j) = pswork(1,ntype_ps+1,6,iregion,j)/& - pswork(1,ntype_ps+1,1,iregion,j) - endif - - do k=1,np - do ltype=1,ntype_q - qwork(k,ntype_q+1,1,iregion,j) = & - qwork(k,ntype_q+1,1,iregion,j)+qwork(k,ltype,1,iregion,j) - qwork(k,ntype_q+1,2,iregion,j) = & - qwork(k,ntype_q+1,2,iregion,j)+qwork(k,ltype,2,iregion,j) - qwork(k,ntype_q+1,3,iregion,j) = & - qwork(k,ntype_q+1,3,iregion,j)+qwork(k,ltype,3,iregion,j) - qwork(k,ntype_q+1,4,iregion,j) = & - qwork(k,ntype_q+1,4,iregion,j)+qwork(k,ltype,4,iregion,j) - qwork(k,ntype_q+1,5,iregion,j) = & - qwork(k,ntype_q+1,5,iregion,j)+qwork(k,ltype,5,iregion,j) - qwork(k,ntype_q+1,6,iregion,j) = & - qwork(k,ntype_q+1,6,iregion,j)+qwork(k,ltype,6,iregion,j) - - if(qwork(k,ltype,1,iregion,j) >=1.0) then - qwork(k,ltype,3,iregion,j) = & - qwork(k,ltype,3,iregion,j)/qwork(k,ltype,1,iregion,j) - qwork(k,ltype,4,iregion,j) = & - sqrt(qwork(k,ltype,4,iregion,j)/qwork(k,ltype,1,iregion,j)) - qwork(k,ltype,5,iregion,j) = & - qwork(k,ltype,5,iregion,j)/qwork(k,ltype,1,iregion,j) - qwork(k,ltype,6,iregion,j) = & - qwork(k,ltype,6,iregion,j)/qwork(k,ltype,1,iregion,j) - endif - enddo - - if(qwork(k,ntype_q+1,1,iregion,j) >=1.0) then - qwork(k,ntype_q+1,3,iregion,j)=qwork(k,ntype_q+1,3,iregion,j)/& - qwork(k,ntype_q+1,1,iregion,j) - qwork(k,ntype_q+1,4,iregion,j)=sqrt(qwork(k,ntype_q+1,4,iregion,j)/& - qwork(k,ntype_q+1,1,iregion,j)) - qwork(k,ntype_q+1,5,iregion,j)=qwork(k,ntype_q+1,5,iregion,j)/& - qwork(k,ntype_q+1,1,iregion,j) - qwork(k,ntype_q+1,6,iregion,j)=qwork(k,ntype_q+1,6,iregion,j)/& - qwork(k,ntype_q+1,1,iregion,j) - endif - - do ltype=1,ntype_t - twork(k,ntype_t+1,1,iregion,j) = & - twork(k,ntype_t+1,1,iregion,j)+twork(k,ltype,1,iregion,j) - twork(k,ntype_t+1,2,iregion,j) = & - twork(k,ntype_t+1,2,iregion,j)+twork(k,ltype,2,iregion,j) - twork(k,ntype_t+1,3,iregion,j) = & - twork(k,ntype_t+1,3,iregion,j)+twork(k,ltype,3,iregion,j) - twork(k,ntype_t+1,4,iregion,j) = & - twork(k,ntype_t+1,4,iregion,j)+twork(k,ltype,4,iregion,j) - -! if(j == 2) then -! write(6,100) k,ltype,iregion,j,twork(k,ntype_t+1,4,iregion,j), & -! twork(k,ltype,4,iregion,j),twork(k,ltype,1,iregion,j),& -! twork(k,ntype_t+1,1,iregion,j) -! 100 format(4i6,4f12.4) -! endif - - twork(k,ntype_t+1,5,iregion,j) = & - twork(k,ntype_t+1,5,iregion,j)+twork(k,ltype,5,iregion,j) - twork(k,ntype_t+1,6,iregion,j) = & - twork(k,ntype_t+1,6,iregion,j)+twork(k,ltype,6,iregion,j) - - if(twork(k,ltype,1,iregion,j) >=1.0) then - twork(k,ltype,3,iregion,j) = & - twork(k,ltype,3,iregion,j)/twork(k,ltype,1,iregion,j) - twork(k,ltype,4,iregion,j) = & - sqrt(twork(k,ltype,4,iregion,j)/twork(k,ltype,1,iregion,j)) - twork(k,ltype,5,iregion,j) = & - twork(k,ltype,5,iregion,j)/twork(k,ltype,1,iregion,j) - twork(k,ltype,6,iregion,j) = & - twork(k,ltype,6,iregion,j)/twork(k,ltype,1,iregion,j) - endif - enddo - - if(twork(k,ntype_t+1,1,iregion,j) >=1.0) then - twork(k,ntype_t+1,3,iregion,j) = twork(k,ntype_t+1,3,iregion,j)/& - twork(k,ntype_t+1,1,iregion,j) - twork(k,ntype_t+1,4,iregion,j)=sqrt(twork(k,ntype_t+1,4,iregion,j)/& - twork(k,ntype_t+1,1,iregion,j)) - twork(k,ntype_t+1,5,iregion,j)=twork(k,ntype_t+1,5,iregion,j)/& - twork(k,ntype_t+1,1,iregion,j) - twork(k,ntype_t+1,6,iregion,j)=twork(k,ntype_t+1,6,iregion,j)/& - twork(k,ntype_t+1,1,iregion,j) - endif - - do ltype=1,ntype_uv - uvwork(k,ntype_uv+1,1,iregion,j) = & - uvwork(k,ntype_uv+1,1,iregion,j)+uvwork(k,ltype,1,iregion,j) - uvwork(k,ntype_uv+1,2,iregion,j) = & - uvwork(k,ntype_uv+1,2,iregion,j)+uvwork(k,ltype,2,iregion,j) - uvwork(k,ntype_uv+1,3,iregion,j) = & - uvwork(k,ntype_uv+1,3,iregion,j)+uvwork(k,ltype,3,iregion,j) - uvwork(k,ntype_uv+1,4,iregion,j) = & - uvwork(k,ntype_uv+1,4,iregion,j)+uvwork(k,ltype,4,iregion,j) - uvwork(k,ntype_uv+1,5,iregion,j) = & - uvwork(k,ntype_uv+1,5,iregion,j)+uvwork(k,ltype,5,iregion,j) - uvwork(k,ntype_uv+1,6,iregion,j) = & - uvwork(k,ntype_uv+1,6,iregion,j)+uvwork(k,ltype,6,iregion,j) - uwork(k,ntype_uv+1,3,iregion,j) = & - uwork(k,ntype_uv+1,3,iregion,j)+uwork(k,ltype,3,iregion,j) - uwork(k,ntype_uv+1,4,iregion,j) = & - uwork(k,ntype_uv+1,4,iregion,j)+uwork(k,ltype,4,iregion,j) - vwork(k,ntype_uv+1,3,iregion,j) = & - vwork(k,ntype_uv+1,3,iregion,j)+vwork(k,ltype,3,iregion,j) - vwork(k,ntype_uv+1,4,iregion,j) = & - vwork(k,ntype_uv+1,4,iregion,j)+vwork(k,ltype,4,iregion,j) - - if(uvwork(k,ltype,1,iregion,j) >=1.0) then - uvwork(k,ltype,3,iregion,j) = & - uvwork(k,ltype,3,iregion,j)/uvwork(k,ltype,1,iregion,j) - uvwork(k,ltype,4,iregion,j) = & - sqrt(uvwork(k,ltype,4,iregion,j)/uvwork(k,ltype,1,iregion,j)) - uvwork(k,ltype,5,iregion,j) = & - uvwork(k,ltype,5,iregion,j)/uvwork(k,ltype,1,iregion,j) - uvwork(k,ltype,6,iregion,j) = & - uvwork(k,ltype,6,iregion,j)/uvwork(k,ltype,1,iregion,j) - uwork(k,ltype,1,iregion,j) = uvwork(k,ltype,1,iregion,j) - vwork(k,ltype,1,iregion,j) = uvwork(k,ltype,1,iregion,j) - uwork(k,ltype,2,iregion,j) = uvwork(k,ltype,2,iregion,j) - vwork(k,ltype,2,iregion,j) = uvwork(k,ltype,2,iregion,j) - uwork(k,ltype,3,iregion,j) = & - uwork(k,ltype,3,iregion,j)/uvwork(k,ltype,1,iregion,j) - uwork(k,ltype,4,iregion,j) = & - sqrt(uwork(k,ltype,4,iregion,j)/uvwork(k,ltype,1,iregion,j)) - vwork(k,ltype,3,iregion,j) = & - vwork(k,ltype,3,iregion,j)/uvwork(k,ltype,1,iregion,j) - vwork(k,ltype,4,iregion,j) = & - sqrt(vwork(k,ltype,4,iregion,j)/uvwork(k,ltype,1,iregion,j)) - endif - enddo - - if(uvwork(k,ntype_uv+1,1,iregion,j) >=1.0) then - uvwork(k,ntype_uv+1,3,iregion,j)=uvwork(k,ntype_uv+1,3,iregion,j)& - /uvwork(k,ntype_uv+1,1,iregion,j) - uvwork(k,ntype_uv+1,4,iregion,j)=sqrt(uvwork(k,ntype_uv+1,4,iregion,j)& - /uvwork(k,ntype_uv+1,1,iregion,j)) - uvwork(k,ntype_uv+1,5,iregion,j)=uvwork(k,ntype_uv+1,5,iregion,j)& - /uvwork(k,ntype_uv+1,1,iregion,j) - uvwork(k,ntype_uv+1,6,iregion,j)=uvwork(k,ntype_uv+1,6,iregion,j)& - /uvwork(k,ntype_uv+1,1,iregion,j) - uwork(k,ntype_uv+1,1,iregion,j)=uvwork(k,ntype_uv+1,1,iregion,j) - uwork(k,ntype_uv+1,2,iregion,j)=uvwork(k,ntype_uv+1,2,iregion,j) - vwork(k,ntype_uv+1,1,iregion,j)=uvwork(k,ntype_uv+1,1,iregion,j) - vwork(k,ntype_uv+1,2,iregion,j)=uvwork(k,ntype_uv+1,2,iregion,j) - - uwork(k,ntype_uv+1,3,iregion,j)=uwork(k,ntype_uv+1,3,iregion,j)& - /uwork(k,ntype_uv+1,1,iregion,j) - uwork(k,ntype_uv+1,4,iregion,j)=sqrt(uwork(k,ntype_uv+1,4,iregion,j)& - /uwork(k,ntype_uv+1,1,iregion,j)) - vwork(k,ntype_uv+1,3,iregion,j)=vwork(k,ntype_uv+1,3,iregion,j)& - /vwork(k,ntype_uv+1,1,iregion,j) - vwork(k,ntype_uv+1,4,iregion,j)=sqrt(vwork(k,ntype_uv+1,4,iregion,j)& - /vwork(k,ntype_uv+1,1,iregion,j)) - endif - - enddo !!! enddo k height - enddo !!! enddo j, j=1 assimilated, j=2 rejected, j=3 monitored - enddo !!! enddo iregion region - - - print *, 'end of diag2grad subroutine' - - - !!! open the grads output files - - !!! for surface pressure files - open(21,file='ps_stas',form='unformatted') - do j=1,3 - do i=1,6 - write(21) ((pswork(1,ltype,i,iregion,j),ltype=1,ntype_ps+1),iregion=1,nregion) - enddo - enddo - - open(31,file='q_stas',form='unformatted') - do j=1,3 - do i=1,6 - do k=1,np - write(31) ((qwork(k,ltype,i,iregion,j),ltype=1,ntype_q+1),iregion=1,nregion) - enddo - enddo - enddo - - open(41,file='t_stas',form='unformatted') - do j=1,3 - do i=1,6 - do k=1,np - write(41) ((twork(k,ltype,i,iregion,j),ltype=1,ntype_t+1),iregion=1,nregion) - enddo - enddo - enddo - - write(6,900) (twork(k,1,1,1,1),k=1,np) - 900 format(13f10.1) - - open(51,file='u_stas',form='unformatted') - do j=1,3 - do i=1,6 - do k=1,np - write(51) ((uwork(k,ltype,i,iregion,j),ltype=1,ntype_uv+1),iregion=1,nregion) - enddo - enddo - enddo - - open(61,file='v_stas',form='unformatted') - do j=1,3 - do i=1,6 - do k=1,np - write(61) ((vwork(k,ltype,i,iregion,j),ltype=1,ntype_uv+1),iregion=1,nregion) - enddo - enddo - enddo - - open(71,file='uv_stas',form='unformatted') - do j=1,3 - do i=1,6 - do k=1,np - write(71) ((uvwork(k,ltype,i,iregion,j),ltype=1,ntype_uv+1), & - iregion=1,nregion) - enddo - enddo - enddo - - - close(21) - close(31) - close(41) - close(51) - close(61) - close(71) - - return -end diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_lev/convinfo.f90 b/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_lev/convinfo.f90 deleted file mode 100644 index 7824d24877..0000000000 --- a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_lev/convinfo.f90 +++ /dev/null @@ -1,58 +0,0 @@ -!------------------------------------------------------------------ -! convinfo_read -! -! This subroutine reads the conventional data (cnvstat) file. -!------------------------------------------------------------------ - -subroutine convinfo_read(dtype,idtype,insubtype,ituse,ntumgrp,ntgroup,ntmiter,isubtype,& - ttwind2,gtross2,etrmax2,etrmin2,vtar_b2,vtar_pg2) - - implicit none - - character(120):: crecord - character(7) :: obstype1 - character(15) :: obstype - character(1) :: cflg - character(7):: iotype - integer idtype,insubtype - character(idtype) :: dtype - - integer(4):: ittype,ituse,ntumgrp,ntgroup,ntmiter,isubtype - integer(4) :: lunin,ithin,npred,iflag - real(8) :: ttwind,gtross,etrmax,etrmin,vtar_b,vtar_pg,rmesh,pmesh - real(4) :: ttwind2,gtross2,etrmax2,etrmin2,vtar_b2,vtar_pg2 - - lunin=11 - - open(lunin,file='convinfo',form='formatted') - rewind(lunin) - - loopd: do - read(lunin,1030,IOSTAT=iflag)cflg,iotype,crecord - - if(cflg == '!') cycle - if( iflag /= 0 ) exit loopd - - read(crecord,*)ittype,isubtype,ituse,ttwind,ntumgrp,ntgroup,ntmiter,& - gtross,etrmax,etrmin,vtar_b,vtar_pg,ithin,rmesh,pmesh,npred - write(obstype1,'(i3)') ittype - - obstype=trim(iotype)//trim(obstype1) -! print *,'obstype,dtype ',obstype,dtype - - if( trim(obstype) == trim(dtype) .and. isubtype == insubtype) then - ttwind2=ttwind - gtross2=gtross - etrmax2=etrmax - etrmin2=etrmin - vtar_b2=vtar_b - vtar_pg2=vtar_pg - exit - endif - - enddo loopd - -1030 format(a1,a7,2x,a120) - - return -end diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_lev/data_mod.f90 b/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_lev/data_mod.f90 deleted file mode 100644 index 2f594e4671..0000000000 --- a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_lev/data_mod.f90 +++ /dev/null @@ -1,53 +0,0 @@ -module data - implicit none - - private - public :: data_t - public :: data_ptr - - integer, parameter,public :: max_rdiag_reals = 25 - - !-------------------------------------------------- - ! index numbers into the rdiagbuf structure - ! (see setupt.f90 for more info) - ! - integer, parameter, public :: idx_obs_type = 1 ! obs type - integer, parameter, public :: idx_obs_subtype = 2 ! obs subtype - integer, parameter, public :: idx_obs_lat = 3 ! obs latitude - integer, parameter, public :: idx_obs_lon = 4 ! obs longitude - integer, parameter, public :: idx_stn_elev = 5 ! stn elevation - integer, parameter, public :: idx_pres = 6 ! obs pressure (hPa) - integer, parameter, public :: idx_hgt = 7 ! obs height (meters) - integer, parameter, public :: idx_time = 8 ! obs time (hrs relative - ! to analysis time) - integer, parameter, public :: idx_iqc = 9 ! prepbufr qc or event mark - integer, parameter, public :: idx_var_jb = 10 ! non-linear qc param - integer, parameter, public :: idx_iuse = 11 ! read_prepbufr data usage flag - integer, parameter, public :: idx_anl_use = 12 ! analysis usage flag - integer, parameter, public :: idx_rwgt = 13 ! non-linear qc relative weight - integer, parameter, public :: idx_err_input = 14 ! prepbufr invers obs error - ! (m/s)**-1 - integer, parameter, public :: idx_errinv = 15 ! read_prepbufr invers obs error - ! (m/s)**-1 - integer, parameter, public :: idx_errinv_fnl = 16 ! final invers obs error (m/s)**-1 - integer, parameter, public :: idx_iuob = 17 ! u wind component observation - integer, parameter, public :: idx_udiff = 18 ! u obs-ges used in analysis (m/s) - integer, parameter, public :: idx_uob_ugesin = 19 ! u obs-ges w/o bias correction - ! (m/s) - integer, parameter, public :: idx_ivob = 20 ! v wind component observation - integer, parameter, public :: idx_vdiff = 21 ! v obs-ges used in analysis (m/s) - integer, parameter, public :: idx_vob_vgesin = 22 ! v obs-ges w/o bias correction - - - ! Data is stored in data_t - type :: data_t - character(8) :: stn_id - real,dimension(25) :: rdiag - end type data_t - - ! A container for storing data_t pointers - type :: data_ptr - type(data_t), pointer :: p - end type data_ptr - -end module data diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_lev/read_conv2grads.f90 b/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_lev/read_conv2grads.f90 deleted file mode 100644 index 3b70156508..0000000000 --- a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_lev/read_conv2grads.f90 +++ /dev/null @@ -1,137 +0,0 @@ -!---------------------------------------------------------------------- -! read_conv2grads -! -! This subroutine reads the diagnostic data from the cnvstat -! file and writes it to the [stype]_[subtype].tmp file. -! -! NOTE: Next step in clean-up is to write directly to the -! GrADS output file rather than to the .tmp file, -! which is then re-read and converted to the GrADS -! output file. Unnecessary I/O. -! Note: -! intype : the observarion type like t for temp, uv for wind -! stype : the observation sub type, like t120 uv220 -!---------------------------------------------------------------------- - -subroutine read_conv2grads(ctype,stype,intype,target_nreal,nobs,isubtype,subtype,list) - - use generic_list - use data - - implicit none - - type(list_node_t), pointer :: list - type(list_node_t), pointer :: next => null() - type(data_ptr) :: ptr - - real(4),allocatable,dimension(:,:) :: rdiag - character(8),allocatable,dimension(:) :: cdiag - - character(3) :: dtype,ctype - character(3) :: subtype - character(10) :: stype,otype - character(15) :: fileo,fileo_subtyp - - integer nchar,file_nreal,i,ii,mype,idate,iflag,itype,iscater,igrads - integer lunin,lunot,target_nreal,ldtype,intype,isubtype,jsubtype - integer nobs,idx,ioff02 - - data lunin / 11 / - - nobs=0 - print *, '--> read_conv2grads' - print *, ' itype, isubtype = ', itype, isubtype - - open(lunin,file='conv_diag',form='unformatted') - rewind(lunin) - - read(lunin) idate - print *, 'idate=',idate - - loopd: do - - read(lunin,IOSTAT=iflag) dtype,nchar,file_nreal,ii,mype,ioff02 -! print *, 'iflag from header read = ', iflag - if( iflag /= 0 ) exit loopd - - if( trim(dtype) == trim(ctype) .and. file_nreal /= target_nreal ) then - print *, 'observation type:',dtype,' file_nreal=', file_nreal - exit - endif - - if(trim(dtype) /= trim(ctype)) then - cycle - endif - - allocate(cdiag(ii),rdiag(file_nreal,ii)) - read(lunin,IOSTAT=iflag) cdiag,rdiag - if( iflag /= 0 ) then -! print *, 'iflag from cdiag,rdiag read = ', iflag - deallocate( cdiag,rdiag ) - exit loopd - end if - - do i=1,ii - itype = int(rdiag(1,i)) - jsubtype = int(rdiag(2,i)) - - if( itype == intype .AND. itype == 245 ) then - print *, 'itype == intype ', itype, intype - print *, 'jsubtype == isubtype ', jsubtype, isubtype - end if - -! if( jsubtype == isubtype ) then -! print *, 'and jsubtype == isubtype ', itype, intype -! end if - - if(itype == intype .AND. jsubtype == isubtype) then -! if( itype == intype ) then - nobs=nobs+1 - - !--------------------------------------------- - ! Allocate a new data element and load - ! -! print *, 'Allocating new data element' - - allocate(ptr%p) - ptr%p%stn_id = cdiag(i) - do idx=1,max_rdiag_reals - if( idx > file_nreal ) then - ptr%p%rdiag( idx ) = 0.00 - else - ptr%p%rdiag( idx ) = rdiag( idx,i ) - end if - end do - - if( nobs == 1 ) then - !------------------------------------------------- - ! Initialize the list with the first data element - ! - call list_init(list, transfer(ptr, list_data)) -! print *, 'Initializing list with data:', ptr%p - next => list - - else - !------------------------------------------------- - ! Insert subsequent nodes into the list - ! -! print *, 'Inserting node with data:', ptr%p - call list_insert(next, transfer(ptr, list_data)) - next => list_next(next) - - end if - - endif - - enddo - - deallocate(cdiag,rdiag) - enddo loopd ! ending read data do loop - - close(lunin) - - print *, 'nobs added to list = ', nobs - print *, '<-- read_conv2grads' - - return -end diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_lev/rm_dups.f90 b/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_lev/rm_dups.f90 deleted file mode 100644 index db4fbdded0..0000000000 --- a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_lev/rm_dups.f90 +++ /dev/null @@ -1,43 +0,0 @@ -!------------------------------------------------------- -! rm_dups -! -! This subroutine removes duplicate data by comparing -! lat, lin, time, and pressure values. Differences -! of < 10.0e-5 are assumed to be matches. -!------------------------------------------------------- - -subroutine rm_dups(duparr,n,m,ilat,ilon,ipress,itime,iweight,nndup) - - implicit none - - real(4),intent(inout),dimension(m,n) :: duparr - -! integer ihash(2*n) -! integer ifn - integer n,m,ilat,ilon,iweight,nndup,i - integer itime,jj,ipress - real dlat,dlon,dtime,dpress,match - - data match / 10.0e-5 / - - - nndup=0 - do i = 1, n - do jj=i+1,n - dlat=abs(duparr(ilat,i)-duparr(ilat,jj)) - dlon=abs(duparr(ilon,i)-duparr(ilon,jj)) - dtime=abs(duparr(itime,i)-duparr(itime,jj)) - dpress=abs(duparr(ipress,i)-duparr(ipress,jj)) - - if (dlat < match .and. dlon < match .and. dtime < match & - .and. dpress < match ) then - - duparr(iweight,i)=-1.0 - nndup=nndup+1 - endif - enddo - enddo - - write(*,*) 'num dups found by rm_dups is ',nndup - return -end diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_mandlev/convinfo.f90 b/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_mandlev/convinfo.f90 deleted file mode 100644 index 7824d24877..0000000000 --- a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_mandlev/convinfo.f90 +++ /dev/null @@ -1,58 +0,0 @@ -!------------------------------------------------------------------ -! convinfo_read -! -! This subroutine reads the conventional data (cnvstat) file. -!------------------------------------------------------------------ - -subroutine convinfo_read(dtype,idtype,insubtype,ituse,ntumgrp,ntgroup,ntmiter,isubtype,& - ttwind2,gtross2,etrmax2,etrmin2,vtar_b2,vtar_pg2) - - implicit none - - character(120):: crecord - character(7) :: obstype1 - character(15) :: obstype - character(1) :: cflg - character(7):: iotype - integer idtype,insubtype - character(idtype) :: dtype - - integer(4):: ittype,ituse,ntumgrp,ntgroup,ntmiter,isubtype - integer(4) :: lunin,ithin,npred,iflag - real(8) :: ttwind,gtross,etrmax,etrmin,vtar_b,vtar_pg,rmesh,pmesh - real(4) :: ttwind2,gtross2,etrmax2,etrmin2,vtar_b2,vtar_pg2 - - lunin=11 - - open(lunin,file='convinfo',form='formatted') - rewind(lunin) - - loopd: do - read(lunin,1030,IOSTAT=iflag)cflg,iotype,crecord - - if(cflg == '!') cycle - if( iflag /= 0 ) exit loopd - - read(crecord,*)ittype,isubtype,ituse,ttwind,ntumgrp,ntgroup,ntmiter,& - gtross,etrmax,etrmin,vtar_b,vtar_pg,ithin,rmesh,pmesh,npred - write(obstype1,'(i3)') ittype - - obstype=trim(iotype)//trim(obstype1) -! print *,'obstype,dtype ',obstype,dtype - - if( trim(obstype) == trim(dtype) .and. isubtype == insubtype) then - ttwind2=ttwind - gtross2=gtross - etrmax2=etrmax - etrmin2=etrmin - vtar_b2=vtar_b - vtar_pg2=vtar_pg - exit - endif - - enddo loopd - -1030 format(a1,a7,2x,a120) - - return -end diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_mandlev/data_mod.f90 b/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_mandlev/data_mod.f90 deleted file mode 100644 index 2f594e4671..0000000000 --- a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_mandlev/data_mod.f90 +++ /dev/null @@ -1,53 +0,0 @@ -module data - implicit none - - private - public :: data_t - public :: data_ptr - - integer, parameter,public :: max_rdiag_reals = 25 - - !-------------------------------------------------- - ! index numbers into the rdiagbuf structure - ! (see setupt.f90 for more info) - ! - integer, parameter, public :: idx_obs_type = 1 ! obs type - integer, parameter, public :: idx_obs_subtype = 2 ! obs subtype - integer, parameter, public :: idx_obs_lat = 3 ! obs latitude - integer, parameter, public :: idx_obs_lon = 4 ! obs longitude - integer, parameter, public :: idx_stn_elev = 5 ! stn elevation - integer, parameter, public :: idx_pres = 6 ! obs pressure (hPa) - integer, parameter, public :: idx_hgt = 7 ! obs height (meters) - integer, parameter, public :: idx_time = 8 ! obs time (hrs relative - ! to analysis time) - integer, parameter, public :: idx_iqc = 9 ! prepbufr qc or event mark - integer, parameter, public :: idx_var_jb = 10 ! non-linear qc param - integer, parameter, public :: idx_iuse = 11 ! read_prepbufr data usage flag - integer, parameter, public :: idx_anl_use = 12 ! analysis usage flag - integer, parameter, public :: idx_rwgt = 13 ! non-linear qc relative weight - integer, parameter, public :: idx_err_input = 14 ! prepbufr invers obs error - ! (m/s)**-1 - integer, parameter, public :: idx_errinv = 15 ! read_prepbufr invers obs error - ! (m/s)**-1 - integer, parameter, public :: idx_errinv_fnl = 16 ! final invers obs error (m/s)**-1 - integer, parameter, public :: idx_iuob = 17 ! u wind component observation - integer, parameter, public :: idx_udiff = 18 ! u obs-ges used in analysis (m/s) - integer, parameter, public :: idx_uob_ugesin = 19 ! u obs-ges w/o bias correction - ! (m/s) - integer, parameter, public :: idx_ivob = 20 ! v wind component observation - integer, parameter, public :: idx_vdiff = 21 ! v obs-ges used in analysis (m/s) - integer, parameter, public :: idx_vob_vgesin = 22 ! v obs-ges w/o bias correction - - - ! Data is stored in data_t - type :: data_t - character(8) :: stn_id - real,dimension(25) :: rdiag - end type data_t - - ! A container for storing data_t pointers - type :: data_ptr - type(data_t), pointer :: p - end type data_ptr - -end module data diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_mandlev/rm_dups.f90 b/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_mandlev/rm_dups.f90 deleted file mode 100644 index db4fbdded0..0000000000 --- a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_mandlev/rm_dups.f90 +++ /dev/null @@ -1,43 +0,0 @@ -!------------------------------------------------------- -! rm_dups -! -! This subroutine removes duplicate data by comparing -! lat, lin, time, and pressure values. Differences -! of < 10.0e-5 are assumed to be matches. -!------------------------------------------------------- - -subroutine rm_dups(duparr,n,m,ilat,ilon,ipress,itime,iweight,nndup) - - implicit none - - real(4),intent(inout),dimension(m,n) :: duparr - -! integer ihash(2*n) -! integer ifn - integer n,m,ilat,ilon,iweight,nndup,i - integer itime,jj,ipress - real dlat,dlon,dtime,dpress,match - - data match / 10.0e-5 / - - - nndup=0 - do i = 1, n - do jj=i+1,n - dlat=abs(duparr(ilat,i)-duparr(ilat,jj)) - dlon=abs(duparr(ilon,i)-duparr(ilon,jj)) - dtime=abs(duparr(itime,i)-duparr(itime,jj)) - dpress=abs(duparr(ipress,i)-duparr(ipress,jj)) - - if (dlat < match .and. dlon < match .and. dtime < match & - .and. dpress < match ) then - - duparr(iweight,i)=-1.0 - nndup=nndup+1 - endif - enddo - enddo - - write(*,*) 'num dups found by rm_dups is ',nndup - return -end diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_sfc/convinfo.f90 b/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_sfc/convinfo.f90 deleted file mode 100644 index 7824d24877..0000000000 --- a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_sfc/convinfo.f90 +++ /dev/null @@ -1,58 +0,0 @@ -!------------------------------------------------------------------ -! convinfo_read -! -! This subroutine reads the conventional data (cnvstat) file. -!------------------------------------------------------------------ - -subroutine convinfo_read(dtype,idtype,insubtype,ituse,ntumgrp,ntgroup,ntmiter,isubtype,& - ttwind2,gtross2,etrmax2,etrmin2,vtar_b2,vtar_pg2) - - implicit none - - character(120):: crecord - character(7) :: obstype1 - character(15) :: obstype - character(1) :: cflg - character(7):: iotype - integer idtype,insubtype - character(idtype) :: dtype - - integer(4):: ittype,ituse,ntumgrp,ntgroup,ntmiter,isubtype - integer(4) :: lunin,ithin,npred,iflag - real(8) :: ttwind,gtross,etrmax,etrmin,vtar_b,vtar_pg,rmesh,pmesh - real(4) :: ttwind2,gtross2,etrmax2,etrmin2,vtar_b2,vtar_pg2 - - lunin=11 - - open(lunin,file='convinfo',form='formatted') - rewind(lunin) - - loopd: do - read(lunin,1030,IOSTAT=iflag)cflg,iotype,crecord - - if(cflg == '!') cycle - if( iflag /= 0 ) exit loopd - - read(crecord,*)ittype,isubtype,ituse,ttwind,ntumgrp,ntgroup,ntmiter,& - gtross,etrmax,etrmin,vtar_b,vtar_pg,ithin,rmesh,pmesh,npred - write(obstype1,'(i3)') ittype - - obstype=trim(iotype)//trim(obstype1) -! print *,'obstype,dtype ',obstype,dtype - - if( trim(obstype) == trim(dtype) .and. isubtype == insubtype) then - ttwind2=ttwind - gtross2=gtross - etrmax2=etrmax - etrmin2=etrmin - vtar_b2=vtar_b - vtar_pg2=vtar_pg - exit - endif - - enddo loopd - -1030 format(a1,a7,2x,a120) - - return -end diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_sfc/data_mod.f90 b/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_sfc/data_mod.f90 deleted file mode 100644 index 2f594e4671..0000000000 --- a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_sfc/data_mod.f90 +++ /dev/null @@ -1,53 +0,0 @@ -module data - implicit none - - private - public :: data_t - public :: data_ptr - - integer, parameter,public :: max_rdiag_reals = 25 - - !-------------------------------------------------- - ! index numbers into the rdiagbuf structure - ! (see setupt.f90 for more info) - ! - integer, parameter, public :: idx_obs_type = 1 ! obs type - integer, parameter, public :: idx_obs_subtype = 2 ! obs subtype - integer, parameter, public :: idx_obs_lat = 3 ! obs latitude - integer, parameter, public :: idx_obs_lon = 4 ! obs longitude - integer, parameter, public :: idx_stn_elev = 5 ! stn elevation - integer, parameter, public :: idx_pres = 6 ! obs pressure (hPa) - integer, parameter, public :: idx_hgt = 7 ! obs height (meters) - integer, parameter, public :: idx_time = 8 ! obs time (hrs relative - ! to analysis time) - integer, parameter, public :: idx_iqc = 9 ! prepbufr qc or event mark - integer, parameter, public :: idx_var_jb = 10 ! non-linear qc param - integer, parameter, public :: idx_iuse = 11 ! read_prepbufr data usage flag - integer, parameter, public :: idx_anl_use = 12 ! analysis usage flag - integer, parameter, public :: idx_rwgt = 13 ! non-linear qc relative weight - integer, parameter, public :: idx_err_input = 14 ! prepbufr invers obs error - ! (m/s)**-1 - integer, parameter, public :: idx_errinv = 15 ! read_prepbufr invers obs error - ! (m/s)**-1 - integer, parameter, public :: idx_errinv_fnl = 16 ! final invers obs error (m/s)**-1 - integer, parameter, public :: idx_iuob = 17 ! u wind component observation - integer, parameter, public :: idx_udiff = 18 ! u obs-ges used in analysis (m/s) - integer, parameter, public :: idx_uob_ugesin = 19 ! u obs-ges w/o bias correction - ! (m/s) - integer, parameter, public :: idx_ivob = 20 ! v wind component observation - integer, parameter, public :: idx_vdiff = 21 ! v obs-ges used in analysis (m/s) - integer, parameter, public :: idx_vob_vgesin = 22 ! v obs-ges w/o bias correction - - - ! Data is stored in data_t - type :: data_t - character(8) :: stn_id - real,dimension(25) :: rdiag - end type data_t - - ! A container for storing data_t pointers - type :: data_ptr - type(data_t), pointer :: p - end type data_ptr - -end module data diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_sfc/read_conv2grads.f90 b/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_sfc/read_conv2grads.f90 deleted file mode 100644 index 8d2bb1d2a1..0000000000 --- a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_sfc/read_conv2grads.f90 +++ /dev/null @@ -1,123 +0,0 @@ -!---------------------------------------------------------------------- -! read_conv2grads -! -! This subroutine reads the diagnostic data from the cnvstat -! file and writes it to the [stype]_[subtype].tmp file. -! -! NOTE: Next step in clean-up is to write directly to the -! GrADS output file rather than to the .tmp file, -! which is then re-read and converted to the GrADS -! output file. Unnecessary I/O. -! Note: -! intype : the observarion type like t for temp, uv for wind -! stype : the observation sub type, like t120 uv220 -!---------------------------------------------------------------------- - -subroutine read_conv2grads(ctype,stype,intype,target_nreal,nobs,isubtype,subtype,list) - - use generic_list - use data - - implicit none - - type(list_node_t), pointer :: list - type(list_node_t), pointer :: next => null() - type(data_ptr) :: ptr - - real(4),allocatable,dimension(:,:) :: rdiag - character(8),allocatable,dimension(:) :: cdiag - - character(3) :: dtype,ctype - character(3) :: subtype - character(10) :: stype,otype - character(15) :: fileo,fileo_subtyp - - integer nchar,file_nreal,i,ii,mype,idate,iflag,itype,iscater,igrads - integer lunin,lunot,target_nreal,ldtype,intype,isubtype,jsubtype - integer nobs,idx,ioff02 - - data lunin / 11 / - - nobs=0 - print *, '--> read_conv2grads' - - open(lunin,file='conv_diag',form='unformatted') - rewind(lunin) - - read(lunin) idate - print *, 'idate=',idate - - loopd: do - - read(lunin,IOSTAT=iflag) dtype,nchar,file_nreal,ii,mype,ioff02 - if( iflag /= 0 ) exit loopd - - if( trim(dtype) == trim(ctype) .and. file_nreal /= target_nreal ) then - print *, 'observation type:',dtype,' file_nreal=', file_nreal - exit - endif - - if(trim(dtype) /= trim(ctype)) then - cycle - endif - - allocate(cdiag(ii),rdiag(file_nreal,ii)) - read(lunin,IOSTAT=iflag) cdiag,rdiag - if( iflag /= 0 ) then - deallocate( cdiag,rdiag ) - exit loopd - end if - - do i=1,ii - itype = int(rdiag(1,i)) - jsubtype = int(rdiag(2,i)) - - if(itype == intype .and. jsubtype ==isubtype) then - nobs=nobs+1 - - !--------------------------------------------- - ! Allocate a new data element and load - ! -! print *, 'Allocating new data element' - allocate(ptr%p) - ptr%p%stn_id = cdiag(i) - do idx=1,max_rdiag_reals - if( idx > file_nreal ) then - ptr%p%rdiag( idx ) = 0.00 - else - ptr%p%rdiag( idx ) = rdiag( idx,i ) - end if - end do - - if( nobs == 1 ) then - !------------------------------------------------- - ! Initialize the list with the first data element - ! - call list_init(list, transfer(ptr, list_data)) -! print *, 'Initializing list with data:', ptr%p - next => list - - else - !------------------------------------------------- - ! Insert subsequent nodes into the list - ! -! print *, 'Inserting node with data:', ptr%p - call list_insert(next, transfer(ptr, list_data)) - next => list_next(next) - - end if - - endif - - enddo - - deallocate(cdiag,rdiag) - enddo loopd ! ending read data do loop - - close(lunin) - - print *, 'nobs added to list = ', nobs - print *, '<-- read_conv2grads' - - return -end diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_sfc/rm_dups.f90 b/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_sfc/rm_dups.f90 deleted file mode 100644 index db4fbdded0..0000000000 --- a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_sfc/rm_dups.f90 +++ /dev/null @@ -1,43 +0,0 @@ -!------------------------------------------------------- -! rm_dups -! -! This subroutine removes duplicate data by comparing -! lat, lin, time, and pressure values. Differences -! of < 10.0e-5 are assumed to be matches. -!------------------------------------------------------- - -subroutine rm_dups(duparr,n,m,ilat,ilon,ipress,itime,iweight,nndup) - - implicit none - - real(4),intent(inout),dimension(m,n) :: duparr - -! integer ihash(2*n) -! integer ifn - integer n,m,ilat,ilon,iweight,nndup,i - integer itime,jj,ipress - real dlat,dlon,dtime,dpress,match - - data match / 10.0e-5 / - - - nndup=0 - do i = 1, n - do jj=i+1,n - dlat=abs(duparr(ilat,i)-duparr(ilat,jj)) - dlon=abs(duparr(ilon,i)-duparr(ilon,jj)) - dtime=abs(duparr(itime,i)-duparr(itime,jj)) - dpress=abs(duparr(ipress,i)-duparr(ipress,jj)) - - if (dlat < match .and. dlon < match .and. dtime < match & - .and. dpress < match ) then - - duparr(iweight,i)=-1.0 - nndup=nndup+1 - endif - enddo - enddo - - write(*,*) 'num dups found by rm_dups is ',nndup - return -end diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_sfctime/convinfo.f90 b/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_sfctime/convinfo.f90 deleted file mode 100644 index 7824d24877..0000000000 --- a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_sfctime/convinfo.f90 +++ /dev/null @@ -1,58 +0,0 @@ -!------------------------------------------------------------------ -! convinfo_read -! -! This subroutine reads the conventional data (cnvstat) file. -!------------------------------------------------------------------ - -subroutine convinfo_read(dtype,idtype,insubtype,ituse,ntumgrp,ntgroup,ntmiter,isubtype,& - ttwind2,gtross2,etrmax2,etrmin2,vtar_b2,vtar_pg2) - - implicit none - - character(120):: crecord - character(7) :: obstype1 - character(15) :: obstype - character(1) :: cflg - character(7):: iotype - integer idtype,insubtype - character(idtype) :: dtype - - integer(4):: ittype,ituse,ntumgrp,ntgroup,ntmiter,isubtype - integer(4) :: lunin,ithin,npred,iflag - real(8) :: ttwind,gtross,etrmax,etrmin,vtar_b,vtar_pg,rmesh,pmesh - real(4) :: ttwind2,gtross2,etrmax2,etrmin2,vtar_b2,vtar_pg2 - - lunin=11 - - open(lunin,file='convinfo',form='formatted') - rewind(lunin) - - loopd: do - read(lunin,1030,IOSTAT=iflag)cflg,iotype,crecord - - if(cflg == '!') cycle - if( iflag /= 0 ) exit loopd - - read(crecord,*)ittype,isubtype,ituse,ttwind,ntumgrp,ntgroup,ntmiter,& - gtross,etrmax,etrmin,vtar_b,vtar_pg,ithin,rmesh,pmesh,npred - write(obstype1,'(i3)') ittype - - obstype=trim(iotype)//trim(obstype1) -! print *,'obstype,dtype ',obstype,dtype - - if( trim(obstype) == trim(dtype) .and. isubtype == insubtype) then - ttwind2=ttwind - gtross2=gtross - etrmax2=etrmax - etrmin2=etrmin - vtar_b2=vtar_b - vtar_pg2=vtar_pg - exit - endif - - enddo loopd - -1030 format(a1,a7,2x,a120) - - return -end diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_sfctime/data_mod.f90 b/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_sfctime/data_mod.f90 deleted file mode 100644 index 2f594e4671..0000000000 --- a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_sfctime/data_mod.f90 +++ /dev/null @@ -1,53 +0,0 @@ -module data - implicit none - - private - public :: data_t - public :: data_ptr - - integer, parameter,public :: max_rdiag_reals = 25 - - !-------------------------------------------------- - ! index numbers into the rdiagbuf structure - ! (see setupt.f90 for more info) - ! - integer, parameter, public :: idx_obs_type = 1 ! obs type - integer, parameter, public :: idx_obs_subtype = 2 ! obs subtype - integer, parameter, public :: idx_obs_lat = 3 ! obs latitude - integer, parameter, public :: idx_obs_lon = 4 ! obs longitude - integer, parameter, public :: idx_stn_elev = 5 ! stn elevation - integer, parameter, public :: idx_pres = 6 ! obs pressure (hPa) - integer, parameter, public :: idx_hgt = 7 ! obs height (meters) - integer, parameter, public :: idx_time = 8 ! obs time (hrs relative - ! to analysis time) - integer, parameter, public :: idx_iqc = 9 ! prepbufr qc or event mark - integer, parameter, public :: idx_var_jb = 10 ! non-linear qc param - integer, parameter, public :: idx_iuse = 11 ! read_prepbufr data usage flag - integer, parameter, public :: idx_anl_use = 12 ! analysis usage flag - integer, parameter, public :: idx_rwgt = 13 ! non-linear qc relative weight - integer, parameter, public :: idx_err_input = 14 ! prepbufr invers obs error - ! (m/s)**-1 - integer, parameter, public :: idx_errinv = 15 ! read_prepbufr invers obs error - ! (m/s)**-1 - integer, parameter, public :: idx_errinv_fnl = 16 ! final invers obs error (m/s)**-1 - integer, parameter, public :: idx_iuob = 17 ! u wind component observation - integer, parameter, public :: idx_udiff = 18 ! u obs-ges used in analysis (m/s) - integer, parameter, public :: idx_uob_ugesin = 19 ! u obs-ges w/o bias correction - ! (m/s) - integer, parameter, public :: idx_ivob = 20 ! v wind component observation - integer, parameter, public :: idx_vdiff = 21 ! v obs-ges used in analysis (m/s) - integer, parameter, public :: idx_vob_vgesin = 22 ! v obs-ges w/o bias correction - - - ! Data is stored in data_t - type :: data_t - character(8) :: stn_id - real,dimension(25) :: rdiag - end type data_t - - ! A container for storing data_t pointers - type :: data_ptr - type(data_t), pointer :: p - end type data_ptr - -end module data diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_sfctime/makefile.grads_sfctime b/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_sfctime/makefile.grads_sfctime deleted file mode 100755 index 615297f668..0000000000 --- a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_sfctime/makefile.grads_sfctime +++ /dev/null @@ -1,47 +0,0 @@ -SHELL=/bin/sh - -#-------------------------- -# makefile.grads_sfctime -#-------------------------- - -BINDIR = ../../exec - -SRCS= data_mod.f90 generic_list.f90 maingrads_sfctime.f90 read_conv2grads.f90 grads_sfctime.f90 rm_dups.f90 convinfo.f90 - -OBJS= data_mod.o generic_list.o maingrads_sfctime.o read_conv2grads.o grads_sfctime.o rm_dups.o convinfo.o - - - -CMD= grads_sfctime.x - -all: $(CMD) - -clean: - rm -f *.o - rm -f *.mod - rm -f *.x - -check_prereqs: - $(PRE_REQ) $(LIBS) - -install: - cp $(CMD) $(BINDIR)/ - - -$(CMD): $(OBJS) - $(FC) -o $(@) $(OBJS) $(FFLAGS) -C - -maingrads_sfctime.o : maingrads_sfctime.f90 - $(CF) $(FFLAGS) -c -C $(*).f90 -read_conv2grads.o : read_conv2grads.f90 - $(CF) $(FFLAGS) -c -C $(*).f90 -grads_sfctime.o : grads_sfctime.f90 - $(CF) $(FFLAGS) -c -C $(*).f90 -rm_dups.o : rm_dups.f90 - $(CF) $(FFLAGS) -c -C $(*).f90 -convinfo.o : convinfo.f90 - $(CF) $(FFLAGS) -c -C $(*).f90 -generic_list.o : generic_list.f90 - $(CF) $(FFLAGS) -c $(*).f90 -data_mod.o : data_mod.f90 - $(CF) $(FFLAGS) -c $(*).f90 diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_sfctime/read_conv2grads.f90 b/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_sfctime/read_conv2grads.f90 deleted file mode 100644 index 8d2bb1d2a1..0000000000 --- a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_sfctime/read_conv2grads.f90 +++ /dev/null @@ -1,123 +0,0 @@ -!---------------------------------------------------------------------- -! read_conv2grads -! -! This subroutine reads the diagnostic data from the cnvstat -! file and writes it to the [stype]_[subtype].tmp file. -! -! NOTE: Next step in clean-up is to write directly to the -! GrADS output file rather than to the .tmp file, -! which is then re-read and converted to the GrADS -! output file. Unnecessary I/O. -! Note: -! intype : the observarion type like t for temp, uv for wind -! stype : the observation sub type, like t120 uv220 -!---------------------------------------------------------------------- - -subroutine read_conv2grads(ctype,stype,intype,target_nreal,nobs,isubtype,subtype,list) - - use generic_list - use data - - implicit none - - type(list_node_t), pointer :: list - type(list_node_t), pointer :: next => null() - type(data_ptr) :: ptr - - real(4),allocatable,dimension(:,:) :: rdiag - character(8),allocatable,dimension(:) :: cdiag - - character(3) :: dtype,ctype - character(3) :: subtype - character(10) :: stype,otype - character(15) :: fileo,fileo_subtyp - - integer nchar,file_nreal,i,ii,mype,idate,iflag,itype,iscater,igrads - integer lunin,lunot,target_nreal,ldtype,intype,isubtype,jsubtype - integer nobs,idx,ioff02 - - data lunin / 11 / - - nobs=0 - print *, '--> read_conv2grads' - - open(lunin,file='conv_diag',form='unformatted') - rewind(lunin) - - read(lunin) idate - print *, 'idate=',idate - - loopd: do - - read(lunin,IOSTAT=iflag) dtype,nchar,file_nreal,ii,mype,ioff02 - if( iflag /= 0 ) exit loopd - - if( trim(dtype) == trim(ctype) .and. file_nreal /= target_nreal ) then - print *, 'observation type:',dtype,' file_nreal=', file_nreal - exit - endif - - if(trim(dtype) /= trim(ctype)) then - cycle - endif - - allocate(cdiag(ii),rdiag(file_nreal,ii)) - read(lunin,IOSTAT=iflag) cdiag,rdiag - if( iflag /= 0 ) then - deallocate( cdiag,rdiag ) - exit loopd - end if - - do i=1,ii - itype = int(rdiag(1,i)) - jsubtype = int(rdiag(2,i)) - - if(itype == intype .and. jsubtype ==isubtype) then - nobs=nobs+1 - - !--------------------------------------------- - ! Allocate a new data element and load - ! -! print *, 'Allocating new data element' - allocate(ptr%p) - ptr%p%stn_id = cdiag(i) - do idx=1,max_rdiag_reals - if( idx > file_nreal ) then - ptr%p%rdiag( idx ) = 0.00 - else - ptr%p%rdiag( idx ) = rdiag( idx,i ) - end if - end do - - if( nobs == 1 ) then - !------------------------------------------------- - ! Initialize the list with the first data element - ! - call list_init(list, transfer(ptr, list_data)) -! print *, 'Initializing list with data:', ptr%p - next => list - - else - !------------------------------------------------- - ! Insert subsequent nodes into the list - ! -! print *, 'Inserting node with data:', ptr%p - call list_insert(next, transfer(ptr, list_data)) - next => list_next(next) - - end if - - endif - - enddo - - deallocate(cdiag,rdiag) - enddo loopd ! ending read data do loop - - close(lunin) - - print *, 'nobs added to list = ', nobs - print *, '<-- read_conv2grads' - - return -end diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_sfctime/rm_dups.f90 b/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_sfctime/rm_dups.f90 deleted file mode 100644 index db4fbdded0..0000000000 --- a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_sfctime/rm_dups.f90 +++ /dev/null @@ -1,43 +0,0 @@ -!------------------------------------------------------- -! rm_dups -! -! This subroutine removes duplicate data by comparing -! lat, lin, time, and pressure values. Differences -! of < 10.0e-5 are assumed to be matches. -!------------------------------------------------------- - -subroutine rm_dups(duparr,n,m,ilat,ilon,ipress,itime,iweight,nndup) - - implicit none - - real(4),intent(inout),dimension(m,n) :: duparr - -! integer ihash(2*n) -! integer ifn - integer n,m,ilat,ilon,iweight,nndup,i - integer itime,jj,ipress - real dlat,dlon,dtime,dpress,match - - data match / 10.0e-5 / - - - nndup=0 - do i = 1, n - do jj=i+1,n - dlat=abs(duparr(ilat,i)-duparr(ilat,jj)) - dlon=abs(duparr(ilon,i)-duparr(ilon,jj)) - dtime=abs(duparr(itime,i)-duparr(itime,jj)) - dpress=abs(duparr(ipress,i)-duparr(ipress,jj)) - - if (dlat < match .and. dlon < match .and. dtime < match & - .and. dpress < match ) then - - duparr(iweight,i)=-1.0 - nndup=nndup+1 - endif - enddo - enddo - - write(*,*) 'num dups found by rm_dups is ',nndup - return -end diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_sig/convinfo.f90 b/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_sig/convinfo.f90 deleted file mode 100644 index 21bc59f990..0000000000 --- a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_sig/convinfo.f90 +++ /dev/null @@ -1,58 +0,0 @@ -!------------------------------------------------------------------ -! convinfo_read -! -! This subroutine reads the conventional data (cnvstat) file. -!------------------------------------------------------------------ - -subroutine convinfo_read(dtype,idtype,insubtype,ituse,ntumgrp,ntgroup,ntmiter,isubtype,& - ttwind2,gtross2,etrmax2,etrmin2,vtar_b2,vtar_pg2) - - implicit none - - character(120) :: crecord - character(7) :: obstype1 - character(15) :: obstype - character(1) :: cflg - character(7) :: iotype - character(idtype) :: dtype - integer idtype,insubtype - - integer(4):: ittype,ituse,ntumgrp,ntgroup,ntmiter,isubtype - integer(4) :: lunin,ithin,npred,iflag - real(8) :: ttwind,gtross,etrmax,etrmin,vtar_b,vtar_pg,rmesh,pmesh - real(4) :: ttwind2,gtross2,etrmax2,etrmin2,vtar_b2,vtar_pg2 - - lunin=11 - - open(lunin,file='convinfo',form='formatted') - rewind(lunin) - - loopd: do - read(lunin,1030,IOSTAT=iflag)cflg,iotype,crecord - - if(cflg == '!') cycle - if( iflag /= 0 ) exit loopd - - read(crecord,*)ittype,isubtype,ituse,ttwind,ntumgrp,ntgroup,ntmiter,& - gtross,etrmax,etrmin,vtar_b,vtar_pg,ithin,rmesh,pmesh,npred - write(obstype1,'(i3)') ittype - - obstype=trim(iotype)//trim(obstype1) -! print *,'obstype,dtype ',obstype,dtype - - if( trim(obstype) == trim(dtype) .and. isubtype == insubtype) then - ttwind2=ttwind - gtross2=gtross - etrmax2=etrmax - etrmin2=etrmin - vtar_b2=vtar_b - vtar_pg2=vtar_pg - exit - endif - - enddo loopd - -1030 format(a1,a7,2x,a120) - - return -end diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_sig/data_mod.f90 b/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_sig/data_mod.f90 deleted file mode 100644 index 2f594e4671..0000000000 --- a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_sig/data_mod.f90 +++ /dev/null @@ -1,53 +0,0 @@ -module data - implicit none - - private - public :: data_t - public :: data_ptr - - integer, parameter,public :: max_rdiag_reals = 25 - - !-------------------------------------------------- - ! index numbers into the rdiagbuf structure - ! (see setupt.f90 for more info) - ! - integer, parameter, public :: idx_obs_type = 1 ! obs type - integer, parameter, public :: idx_obs_subtype = 2 ! obs subtype - integer, parameter, public :: idx_obs_lat = 3 ! obs latitude - integer, parameter, public :: idx_obs_lon = 4 ! obs longitude - integer, parameter, public :: idx_stn_elev = 5 ! stn elevation - integer, parameter, public :: idx_pres = 6 ! obs pressure (hPa) - integer, parameter, public :: idx_hgt = 7 ! obs height (meters) - integer, parameter, public :: idx_time = 8 ! obs time (hrs relative - ! to analysis time) - integer, parameter, public :: idx_iqc = 9 ! prepbufr qc or event mark - integer, parameter, public :: idx_var_jb = 10 ! non-linear qc param - integer, parameter, public :: idx_iuse = 11 ! read_prepbufr data usage flag - integer, parameter, public :: idx_anl_use = 12 ! analysis usage flag - integer, parameter, public :: idx_rwgt = 13 ! non-linear qc relative weight - integer, parameter, public :: idx_err_input = 14 ! prepbufr invers obs error - ! (m/s)**-1 - integer, parameter, public :: idx_errinv = 15 ! read_prepbufr invers obs error - ! (m/s)**-1 - integer, parameter, public :: idx_errinv_fnl = 16 ! final invers obs error (m/s)**-1 - integer, parameter, public :: idx_iuob = 17 ! u wind component observation - integer, parameter, public :: idx_udiff = 18 ! u obs-ges used in analysis (m/s) - integer, parameter, public :: idx_uob_ugesin = 19 ! u obs-ges w/o bias correction - ! (m/s) - integer, parameter, public :: idx_ivob = 20 ! v wind component observation - integer, parameter, public :: idx_vdiff = 21 ! v obs-ges used in analysis (m/s) - integer, parameter, public :: idx_vob_vgesin = 22 ! v obs-ges w/o bias correction - - - ! Data is stored in data_t - type :: data_t - character(8) :: stn_id - real,dimension(25) :: rdiag - end type data_t - - ! A container for storing data_t pointers - type :: data_ptr - type(data_t), pointer :: p - end type data_ptr - -end module data diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_sig/read_conv2grads.f90 b/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_sig/read_conv2grads.f90 deleted file mode 100644 index 8d2bb1d2a1..0000000000 --- a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_sig/read_conv2grads.f90 +++ /dev/null @@ -1,123 +0,0 @@ -!---------------------------------------------------------------------- -! read_conv2grads -! -! This subroutine reads the diagnostic data from the cnvstat -! file and writes it to the [stype]_[subtype].tmp file. -! -! NOTE: Next step in clean-up is to write directly to the -! GrADS output file rather than to the .tmp file, -! which is then re-read and converted to the GrADS -! output file. Unnecessary I/O. -! Note: -! intype : the observarion type like t for temp, uv for wind -! stype : the observation sub type, like t120 uv220 -!---------------------------------------------------------------------- - -subroutine read_conv2grads(ctype,stype,intype,target_nreal,nobs,isubtype,subtype,list) - - use generic_list - use data - - implicit none - - type(list_node_t), pointer :: list - type(list_node_t), pointer :: next => null() - type(data_ptr) :: ptr - - real(4),allocatable,dimension(:,:) :: rdiag - character(8),allocatable,dimension(:) :: cdiag - - character(3) :: dtype,ctype - character(3) :: subtype - character(10) :: stype,otype - character(15) :: fileo,fileo_subtyp - - integer nchar,file_nreal,i,ii,mype,idate,iflag,itype,iscater,igrads - integer lunin,lunot,target_nreal,ldtype,intype,isubtype,jsubtype - integer nobs,idx,ioff02 - - data lunin / 11 / - - nobs=0 - print *, '--> read_conv2grads' - - open(lunin,file='conv_diag',form='unformatted') - rewind(lunin) - - read(lunin) idate - print *, 'idate=',idate - - loopd: do - - read(lunin,IOSTAT=iflag) dtype,nchar,file_nreal,ii,mype,ioff02 - if( iflag /= 0 ) exit loopd - - if( trim(dtype) == trim(ctype) .and. file_nreal /= target_nreal ) then - print *, 'observation type:',dtype,' file_nreal=', file_nreal - exit - endif - - if(trim(dtype) /= trim(ctype)) then - cycle - endif - - allocate(cdiag(ii),rdiag(file_nreal,ii)) - read(lunin,IOSTAT=iflag) cdiag,rdiag - if( iflag /= 0 ) then - deallocate( cdiag,rdiag ) - exit loopd - end if - - do i=1,ii - itype = int(rdiag(1,i)) - jsubtype = int(rdiag(2,i)) - - if(itype == intype .and. jsubtype ==isubtype) then - nobs=nobs+1 - - !--------------------------------------------- - ! Allocate a new data element and load - ! -! print *, 'Allocating new data element' - allocate(ptr%p) - ptr%p%stn_id = cdiag(i) - do idx=1,max_rdiag_reals - if( idx > file_nreal ) then - ptr%p%rdiag( idx ) = 0.00 - else - ptr%p%rdiag( idx ) = rdiag( idx,i ) - end if - end do - - if( nobs == 1 ) then - !------------------------------------------------- - ! Initialize the list with the first data element - ! - call list_init(list, transfer(ptr, list_data)) -! print *, 'Initializing list with data:', ptr%p - next => list - - else - !------------------------------------------------- - ! Insert subsequent nodes into the list - ! -! print *, 'Inserting node with data:', ptr%p - call list_insert(next, transfer(ptr, list_data)) - next => list_next(next) - - end if - - endif - - enddo - - deallocate(cdiag,rdiag) - enddo loopd ! ending read data do loop - - close(lunin) - - print *, 'nobs added to list = ', nobs - print *, '<-- read_conv2grads' - - return -end diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_ps/convinfo.f90 b/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_ps/convinfo.f90 deleted file mode 100644 index 7824d24877..0000000000 --- a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_ps/convinfo.f90 +++ /dev/null @@ -1,58 +0,0 @@ -!------------------------------------------------------------------ -! convinfo_read -! -! This subroutine reads the conventional data (cnvstat) file. -!------------------------------------------------------------------ - -subroutine convinfo_read(dtype,idtype,insubtype,ituse,ntumgrp,ntgroup,ntmiter,isubtype,& - ttwind2,gtross2,etrmax2,etrmin2,vtar_b2,vtar_pg2) - - implicit none - - character(120):: crecord - character(7) :: obstype1 - character(15) :: obstype - character(1) :: cflg - character(7):: iotype - integer idtype,insubtype - character(idtype) :: dtype - - integer(4):: ittype,ituse,ntumgrp,ntgroup,ntmiter,isubtype - integer(4) :: lunin,ithin,npred,iflag - real(8) :: ttwind,gtross,etrmax,etrmin,vtar_b,vtar_pg,rmesh,pmesh - real(4) :: ttwind2,gtross2,etrmax2,etrmin2,vtar_b2,vtar_pg2 - - lunin=11 - - open(lunin,file='convinfo',form='formatted') - rewind(lunin) - - loopd: do - read(lunin,1030,IOSTAT=iflag)cflg,iotype,crecord - - if(cflg == '!') cycle - if( iflag /= 0 ) exit loopd - - read(crecord,*)ittype,isubtype,ituse,ttwind,ntumgrp,ntgroup,ntmiter,& - gtross,etrmax,etrmin,vtar_b,vtar_pg,ithin,rmesh,pmesh,npred - write(obstype1,'(i3)') ittype - - obstype=trim(iotype)//trim(obstype1) -! print *,'obstype,dtype ',obstype,dtype - - if( trim(obstype) == trim(dtype) .and. isubtype == insubtype) then - ttwind2=ttwind - gtross2=gtross - etrmax2=etrmax - etrmin2=etrmin - vtar_b2=vtar_b - vtar_pg2=vtar_pg - exit - endif - - enddo loopd - -1030 format(a1,a7,2x,a120) - - return -end diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_ps/histgram.f90 b/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_ps/histgram.f90 deleted file mode 100644 index 81d429cb4a..0000000000 --- a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_ps/histgram.f90 +++ /dev/null @@ -1,143 +0,0 @@ -!---------------------------------------------------------------------------- -! subroutine hist -! -! This subroutine calculates the histogram of each data source. -!---------------------------------------------------------------------------- - -subroutine hist(mtype,rmodnbc,nchan,nxdata,ndata,rmin,rmax,rlev,fileo,ncount_vqc,ncount_gros) - - implicit none - - integer nxdata,nchan,nlev,i,j,k - real rlev,rmin,rmax,sqr2 - - real,dimension(nchan,nxdata) :: rmodnbc - real,dimension(nchan) :: rmean,rstd - integer,dimension(nchan) :: nmean,nobs,ndata,ncount_vqc,ncount_gros - - real,dimension(nchan,400) :: ys - real,dimension(400) :: xs - real,dimension(401) :: xs2 - real maxf - - character*50 fileo - character*15 mtype - - sqr2=1.414213562 - - nlev=(rmax-rmin)/rlev - - if(nlev >400) then - print *,' too many bins, exceeding 400' - return - endif - - xs(1)=rmin+rlev/2.0 - xs2(1)=rmin - - print *, 'nlev=',nlev - print *, 'nobs=',ndata(1),ndata(2),ndata(3) - - do i=2,nlev - xs(i)=xs(i-1)+rlev - xs2(i)=xs2(i-1)+rlev - end do - - xs2(nlev+1)=xs2(nlev)+rlev - - do i=1,nlev - do j=1,nchan - ys(j,i)=0.0 - enddo - enddo - - do k=1,nchan - if(ndata(k) >1) then - do i=1, ndata(k) - do j=1,nlev - if( rmodnbc(k,i) >=xs2(j) .and. & - rmodnbc(k,i) 1) then - do i=1,ndata(j) - if(rmodnbc(j,i) >=rmin .and. rmodnbc(j,i) <=rmax) then - rmean(j)=rmean(j)+rmodnbc(j,i) - rstd(j)=rstd(j)+rmodnbc(j,i)*rmodnbc(j,i) - nobs(j)=nobs(j)+1 - endif - enddo - endif - enddo - - do j=1,nchan - if(nobs(j) >0) then - if(nobs(j)==1) then - rstd(j)=rstd(j)-rmean(j)*rmean(j)/nobs(j) - rmean(j)=rmean(j)/nobs(j) - rstd(j)=0.0 - else - rstd(j)=rstd(j)-rmean(j)*rmean(j)/nobs(j) - rmean(j)=rmean(j)/nobs(j) - rstd(j)=sqrt(abs(rstd(j))/(nobs(j)-1)) - endif - endif - enddo - - - - write(6,200) mtype - do j=1,nchan - write(6,210) nobs(j),ncount_vqc(j),ncount_gros(j),rstd(j),rmean(j) - enddo - -200 format(a12,'no. std mean ') -210 format(3i10,2f10.3) - -! write(6,220) (xs(1,i),i=1,100) -! write(6,230) (ys(1,i),i=1,100) -! write(6,230) (f(1,i),i=1,100) - -!220 format(6e12.4) -!230 format(6e12.5) - -! trasform the frequecy so that gaussin distribution became a stright line - -! print *, 'maxf ',maxf - -! do i=1,nlev -! if(ys(i) >0.0) then -! ys(i)=sqrt(-2.0*log(ys(i)/maxf)) -! else -! ys(i)=0.0 -! endif -! f(i)=abs((xs(i)-rmean)/rstd) -! enddo - - open (10,file=fileo,form='unformatted',access='direct',recl=nlev*4) - - write(10,rec=1) (xs(i),i=1,nlev) - do j=1,nchan - write(10,rec=2+j-1) (ys(j,i),i=1,nlev) - enddo - - close(10) - - - return -end - diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_ps/makefile.read_ps b/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_ps/makefile.read_ps deleted file mode 100755 index 46e3507619..0000000000 --- a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_ps/makefile.read_ps +++ /dev/null @@ -1,45 +0,0 @@ -SHELL=/bin/sh - -#-------------------- -# makefile.read_ps -#-------------------- - -BINDIR = ../../exec - -SRCS= mainread_ps.f90 read_ps.f90 read_ps_mor.f90 histgram.f90 rm_dups.f90 convinfo.f90 - -OBJS= mainread_ps.o read_ps.o read_ps_mor.o histgram.o rm_dups.o convinfo.o - - - -CMD= read_ps.x - -all: $(CMD) - -clean: - rm -f *.o - rm -f *.mod - rm -f *.x - -check_prereqs: - $(PRE_REQ) $(LIBS) - -install: - cp $(CMD) $(BINDIR)/ - -$(CMD): $(OBJS) - $(FC) -o $(@) $(OBJS) $(FFLAGS) - - -mainread_ps.o : mainread_ps.f90 - $(CF) $(FFLAGS) -c $(*).f90 -read_ps.o : read_ps.f90 - $(CF) $(FFLAGS) -c $(*).f90 -read_ps_mor.o : read_ps_mor.f90 - $(CF) $(FFLAGS) -c $(*).f90 -histgram.o : histgram.f90 - $(CF) $(FFLAGS) -c $(*).f90 -rm_dups.o : rm_dups.f90 - $(CF) $(FFLAGS) -c $(*).f90 -convinfo.o : convinfo.f90 - $(CF) $(FFLAGS) -c $(*).f90 diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_ps/rm_dups.f90 b/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_ps/rm_dups.f90 deleted file mode 100644 index db4fbdded0..0000000000 --- a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_ps/rm_dups.f90 +++ /dev/null @@ -1,43 +0,0 @@ -!------------------------------------------------------- -! rm_dups -! -! This subroutine removes duplicate data by comparing -! lat, lin, time, and pressure values. Differences -! of < 10.0e-5 are assumed to be matches. -!------------------------------------------------------- - -subroutine rm_dups(duparr,n,m,ilat,ilon,ipress,itime,iweight,nndup) - - implicit none - - real(4),intent(inout),dimension(m,n) :: duparr - -! integer ihash(2*n) -! integer ifn - integer n,m,ilat,ilon,iweight,nndup,i - integer itime,jj,ipress - real dlat,dlon,dtime,dpress,match - - data match / 10.0e-5 / - - - nndup=0 - do i = 1, n - do jj=i+1,n - dlat=abs(duparr(ilat,i)-duparr(ilat,jj)) - dlon=abs(duparr(ilon,i)-duparr(ilon,jj)) - dtime=abs(duparr(itime,i)-duparr(itime,jj)) - dpress=abs(duparr(ipress,i)-duparr(ipress,jj)) - - if (dlat < match .and. dlon < match .and. dtime < match & - .and. dpress < match ) then - - duparr(iweight,i)=-1.0 - nndup=nndup+1 - endif - enddo - enddo - - write(*,*) 'num dups found by rm_dups is ',nndup - return -end diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_pw/convinfo.f90 b/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_pw/convinfo.f90 deleted file mode 100644 index 7824d24877..0000000000 --- a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_pw/convinfo.f90 +++ /dev/null @@ -1,58 +0,0 @@ -!------------------------------------------------------------------ -! convinfo_read -! -! This subroutine reads the conventional data (cnvstat) file. -!------------------------------------------------------------------ - -subroutine convinfo_read(dtype,idtype,insubtype,ituse,ntumgrp,ntgroup,ntmiter,isubtype,& - ttwind2,gtross2,etrmax2,etrmin2,vtar_b2,vtar_pg2) - - implicit none - - character(120):: crecord - character(7) :: obstype1 - character(15) :: obstype - character(1) :: cflg - character(7):: iotype - integer idtype,insubtype - character(idtype) :: dtype - - integer(4):: ittype,ituse,ntumgrp,ntgroup,ntmiter,isubtype - integer(4) :: lunin,ithin,npred,iflag - real(8) :: ttwind,gtross,etrmax,etrmin,vtar_b,vtar_pg,rmesh,pmesh - real(4) :: ttwind2,gtross2,etrmax2,etrmin2,vtar_b2,vtar_pg2 - - lunin=11 - - open(lunin,file='convinfo',form='formatted') - rewind(lunin) - - loopd: do - read(lunin,1030,IOSTAT=iflag)cflg,iotype,crecord - - if(cflg == '!') cycle - if( iflag /= 0 ) exit loopd - - read(crecord,*)ittype,isubtype,ituse,ttwind,ntumgrp,ntgroup,ntmiter,& - gtross,etrmax,etrmin,vtar_b,vtar_pg,ithin,rmesh,pmesh,npred - write(obstype1,'(i3)') ittype - - obstype=trim(iotype)//trim(obstype1) -! print *,'obstype,dtype ',obstype,dtype - - if( trim(obstype) == trim(dtype) .and. isubtype == insubtype) then - ttwind2=ttwind - gtross2=gtross - etrmax2=etrmax - etrmin2=etrmin - vtar_b2=vtar_b - vtar_pg2=vtar_pg - exit - endif - - enddo loopd - -1030 format(a1,a7,2x,a120) - - return -end diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_pw/histgram.f90 b/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_pw/histgram.f90 deleted file mode 100644 index 81d429cb4a..0000000000 --- a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_pw/histgram.f90 +++ /dev/null @@ -1,143 +0,0 @@ -!---------------------------------------------------------------------------- -! subroutine hist -! -! This subroutine calculates the histogram of each data source. -!---------------------------------------------------------------------------- - -subroutine hist(mtype,rmodnbc,nchan,nxdata,ndata,rmin,rmax,rlev,fileo,ncount_vqc,ncount_gros) - - implicit none - - integer nxdata,nchan,nlev,i,j,k - real rlev,rmin,rmax,sqr2 - - real,dimension(nchan,nxdata) :: rmodnbc - real,dimension(nchan) :: rmean,rstd - integer,dimension(nchan) :: nmean,nobs,ndata,ncount_vqc,ncount_gros - - real,dimension(nchan,400) :: ys - real,dimension(400) :: xs - real,dimension(401) :: xs2 - real maxf - - character*50 fileo - character*15 mtype - - sqr2=1.414213562 - - nlev=(rmax-rmin)/rlev - - if(nlev >400) then - print *,' too many bins, exceeding 400' - return - endif - - xs(1)=rmin+rlev/2.0 - xs2(1)=rmin - - print *, 'nlev=',nlev - print *, 'nobs=',ndata(1),ndata(2),ndata(3) - - do i=2,nlev - xs(i)=xs(i-1)+rlev - xs2(i)=xs2(i-1)+rlev - end do - - xs2(nlev+1)=xs2(nlev)+rlev - - do i=1,nlev - do j=1,nchan - ys(j,i)=0.0 - enddo - enddo - - do k=1,nchan - if(ndata(k) >1) then - do i=1, ndata(k) - do j=1,nlev - if( rmodnbc(k,i) >=xs2(j) .and. & - rmodnbc(k,i) 1) then - do i=1,ndata(j) - if(rmodnbc(j,i) >=rmin .and. rmodnbc(j,i) <=rmax) then - rmean(j)=rmean(j)+rmodnbc(j,i) - rstd(j)=rstd(j)+rmodnbc(j,i)*rmodnbc(j,i) - nobs(j)=nobs(j)+1 - endif - enddo - endif - enddo - - do j=1,nchan - if(nobs(j) >0) then - if(nobs(j)==1) then - rstd(j)=rstd(j)-rmean(j)*rmean(j)/nobs(j) - rmean(j)=rmean(j)/nobs(j) - rstd(j)=0.0 - else - rstd(j)=rstd(j)-rmean(j)*rmean(j)/nobs(j) - rmean(j)=rmean(j)/nobs(j) - rstd(j)=sqrt(abs(rstd(j))/(nobs(j)-1)) - endif - endif - enddo - - - - write(6,200) mtype - do j=1,nchan - write(6,210) nobs(j),ncount_vqc(j),ncount_gros(j),rstd(j),rmean(j) - enddo - -200 format(a12,'no. std mean ') -210 format(3i10,2f10.3) - -! write(6,220) (xs(1,i),i=1,100) -! write(6,230) (ys(1,i),i=1,100) -! write(6,230) (f(1,i),i=1,100) - -!220 format(6e12.4) -!230 format(6e12.5) - -! trasform the frequecy so that gaussin distribution became a stright line - -! print *, 'maxf ',maxf - -! do i=1,nlev -! if(ys(i) >0.0) then -! ys(i)=sqrt(-2.0*log(ys(i)/maxf)) -! else -! ys(i)=0.0 -! endif -! f(i)=abs((xs(i)-rmean)/rstd) -! enddo - - open (10,file=fileo,form='unformatted',access='direct',recl=nlev*4) - - write(10,rec=1) (xs(i),i=1,nlev) - do j=1,nchan - write(10,rec=2+j-1) (ys(j,i),i=1,nlev) - enddo - - close(10) - - - return -end - diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_pw/mainread_pw.f90 b/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_pw/mainread_pw.f90 deleted file mode 100644 index 4ccbb95d39..0000000000 --- a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_pw/mainread_pw.f90 +++ /dev/null @@ -1,48 +0,0 @@ -!----------------------------------------------------- -! program mainread_pw -! -!----------------------------------------------------- - - implicit none - - character*200 fname - character*50 fileo - character*15 mtype,dtype - - real*4 tiny,huge,real - real rpress,rlev - - integer nobs,nreal,ntotal,ngross,nreal_in,insubtype - integer isubtype,ncount_gros,ncount_vgc,ncount - - integer(4):: ittype,ituse,ntumgrp,ntgroup,ntmiter,iflag - real(4) :: ttwind,gtross,etrmax,etrmin,vtar_b,vtar_pg - - real(4) :: rmiss,vqclmt,vqclmte - - data rmiss/-999.0/ - - - namelist /input/nreal,mtype,fname,fileo,rlev,insubtype - - - read (5,input) -! write(6,input) - - ncount=0 - rpress=rmiss - ncount_vgc=0 - ncount_gros=0 - -! print *,mtype,nreal - - call convinfo_read(mtype,15,insubtype,ituse,ntumgrp,ntgroup,ntmiter,isubtype,& - ttwind,gtross,etrmax,etrmin,vtar_b,vtar_pg) - -! print *,'ituse=',ituse,gtross - - if (ituse >0) call read_pw(nreal,mtype,fname,fileo,gtross,rlev) - if (ituse <0) call read_pw_mor(nreal,mtype,fname,fileo,gtross,rlev) - - stop -end diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_pw/makefile.read_pw b/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_pw/makefile.read_pw deleted file mode 100755 index d2d81942f9..0000000000 --- a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_pw/makefile.read_pw +++ /dev/null @@ -1,46 +0,0 @@ -SHELL=/bin/sh - -#-------------------- -# makefile.read_pw -#-------------------- - -BINDIR = ../../exec - -SRCS= mainread_pw.f90 read_pw.f90 read_pw_mor.f90 histgram.f90 rm_dups.f90 convinfo.f90 - -OBJS= mainread_pw.o read_pw.o read_pw_mor.o histgram.o rm_dups.o convinfo.o - - - -CMD= read_pw.x - -all: $(CMD) - -clean: - rm -f *.o - rm -f *.mod - rm -f *.x - -check_prereqs: - $(PRE_REQ) $(LIBS) - -install: - cp $(CMD) $(BINDIR)/ - -$(CMD): $(OBJS) - $(FC) -o $(@) $(OBJS) $(FFLAGS) - - -mainread_pw.o : mainread_pw.f90 - $(CF) $(FFLAGS) -c $(*).f90 -read_pw.o : read_pw.f90 - $(CF) $(FFLAGS) -c $(*).f90 -read_pw_mor.o : read_pw_mor.f90 - $(CF) $(FFLAGS) -c $(*).f90 -histgram.o : histgram.f90 - $(CF) $(FFLAGS) -c $(*).f90 -rm_dups.o : rm_dups.f90 - $(CF) $(FFLAGS) -c $(*).f90 -convinfo.o : convinfo.f90 - $(CF) $(FFLAGS) -c $(*).f90 - diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_pw/read_pw.f90 b/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_pw/read_pw.f90 deleted file mode 100644 index b409eb8df3..0000000000 --- a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_pw/read_pw.f90 +++ /dev/null @@ -1,135 +0,0 @@ -!----------------------------------------------------------- -! subroutine read_pw -! -!----------------------------------------------------------- -subroutine read_pw(nreal,mtype,fname,fileo,gtross,rlev) - - implicit none - - real(4),allocatable,dimension(:,:) :: rdiag - real(4),dimension(3,3000000) :: rpress - integer,dimension(3) :: ncount,ncount_vqc,ncount_gros - - character*200 fname - character*50 fileo - character*15 mtype - - real(4) :: tiny,huge - real rlev,rgtross,gtross,weight,ddf - - integer nobs,nreal,ntotal,ngross,nreal_in,nlev - integer ilat,ilon,ipres,itime,iqc,iuse,imuse,iweight,ierr,ierr2,ierr3,iobs,iogs - integer i,ndup,ioges,igos - - real(4) :: rmiss,vqclmt,vqclmte - - data rmiss/-999.0/ - data tiny / 1.0e-6 / - data huge / 1.0e6 / - - -! print *,'nreal=',nreal - - ncount=0 - rpress=rmiss - ncount_vqc=0 - ncount_gros=0 - - - ntotal=0 - open(unit=11,file=fname,form='unformatted') - rewind(11) - read(11) nobs,nreal_in -! print *, 'nobs=',nobs - - if (nreal /= nreal_in) then - print *,'nreal_in,nreal ',nreal_in,nreal - stop - endif - - allocate(rdiag(nreal,nobs)) - read(11) rdiag - - ilat=1 ! lat - ilon=2 ! lon - ipres=4 ! pressure - itime=6 ! relative time - iqc=7 ! qc flag - iuse=9 ! original data usage flag - imuse=10 ! data usage flag in the analsis - iweight=11 ! variational relative weight - ierr=12 ! original error from bufr error table - ierr2=13 ! error from read_bufr - ierr3=14 ! error from final adjusted - iobs=15 ! obs - iogs=16 ! obs-ges - - - call rm_dups( rdiag,nobs,nreal,ilat,ilon,ipres,itime,iweight,ndup ) - - do i=1,nobs - if( rdiag(iweight,i) >= 0.0 .and. rdiag(imuse,i) >0.0 ) then - ncount(1)=ncount(1)+1 - rpress(1,ncount(1))=rdiag(iogs,i)*rdiag(ierr,i) - weight=rdiag(iweight,i) - - if(weight <1.0) then - ncount_vqc(1)=ncount_vqc(1)+1 - vqclmt=vqclmt+abs(rdiag(ioges,i))*rdiag(ierr,i) - endif - - if(rdiag(iqc,i) >=4.0) then - ncount(2)=ncount(2)+1 - if(weight <1.0) then - ncount_vqc(2)=ncount_vqc(2)+1 - endif - rpress(2,ncount(2))=rdiag(iogs,i)*rdiag(ierr,i) - endif - - else if(rdiag(iweight,i) >= 0.0 .and. rdiag(imuse,i) <0.0) then - if(rdiag(iqc,i) <=7.0) then - ncount_gros(1)=ncount_gros(1)+1 - if(rdiag(iqc,i) >3.0 .and. rdiag(iqc,i) <=7.0) then - ncount_gros(2)=ncount_gros(2)+1 - endif - else if(rdiag(iqc,i) >=8.0 ) then - if(rdiag(ierr,i) >tiny ) then - ddf=abs(rdiag(igos,i))*rdiag(ierr,i) - if(ddf 0) then - vqclmt=vqclmt/ncount_vqc(1) - endif - - !-------------------------------------------- - ! calculate the the areacd usr2 - ! Isn't gtross-rgtross simply 2*gtross? - rgtross=-gtross - nlev=nint((gtross-rgtross)/rlev) - - nlev=nlev - print *,nlev - print *, 'rmax,rmin ',gtross,rgtross - print *, 'ncount_gros,',ncount_gros(1),ncount_gros(2),ncount_gros(3) - print *, 'vqc-limit,vqc-limite ',vqclmt,vqclmte - - call hist(mtype,rpress,3,3000000,ncount,rgtross,gtross,rlev,fileo,ncount_vqc,ncount_gros) - - return -end diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_pw/read_pw_mor.f90 b/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_pw/read_pw_mor.f90 deleted file mode 100644 index fc720d3c36..0000000000 --- a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_pw/read_pw_mor.f90 +++ /dev/null @@ -1,90 +0,0 @@ -!---------------------------------------------------------------- -! subroutine read_pw_mor -! -!---------------------------------------------------------------- -subroutine read_pw_mor(nreal,mtype,fname,fileo,gtross,rlev) - - implicit none - - real(4),allocatable,dimension(:,:) :: rdiag - real(4),dimension(3,3000000) :: rpress - integer,dimension(3) :: ncount,ncount_vqc,ncount_gros - - character*200 fname - character*50 fileo - character*15 mtype - - real rgtross,gtross - integer nobs,nreal,ntotal,ngross,nreal_in,nlev - integer i,nlat,nlon,npres,ntime,ndup - integer ilat,ilon,ipres,itime,iqc,iuse,imuse,iweight,ierr,ierr2,ierr3,iobs,iogs - - real(4) :: rmiss,vqclmt,vqclmte,rlev - - data rmiss/-999.0/ - - - ncount=0 - rpress=rmiss - ncount_vqc=0 - ncount_gros=0 - - ntotal=0 - open(unit=11,file=fname,form='unformatted') - rewind(11) - read(11) nobs,nreal_in -! print *, 'nobs=',nobs - - if (nreal /= nreal_in) then - print *,'nreal_in,nreal ',nreal_in,nreal - stop - endif - - allocate(rdiag(nreal,nobs)) - read(11) rdiag - - ilat=1 ! lat - ilon=2 ! lon - ipres=4 ! pressure - itime=6 ! relative time - iqc=7 ! qc flag - iuse=9 ! original data usage flag - imuse=10 ! data usage flag in the analsis - iweight=11 ! variational relative weight - ierr=12 ! original error from bufr error table - ierr2=13 ! error from read_bufr - ierr3=14 ! error from final adjusted - iobs=15 ! obs - iogs=16 ! obs-ges - - - call rm_dups( rdiag,nobs,nreal,ilat,ilon,ipres,itime,iweight,ndup ) - - do i=1,nobs - if(rdiag(iweight,i) >0.0) then - ncount(3)=ncount(3)+1 - rpress(3,ncount(3))=rdiag(iogs,i) - endif - enddo - - deallocate(rdiag) - - - !------------------------------------------------------- - ! calculate the the areacd usr2 - ! - ! Isn't gtross-rgtross just 2*gtross in all cases? - ! - rgtross=-gtross - nlev=nint((gtross-rgtross)/rlev) - print *,nlev - print *,gtross, rgtross - - do i=1,3 - if(ncount(i) ==0) ncount(i)=1 - enddo - - call hist(mtype,rpress,3,3000000,ncount,rgtross,gtross,rlev,fileo,ncount_vqc,ncount_gros) - - return -end diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_pw/rm_dups.f90 b/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_pw/rm_dups.f90 deleted file mode 100644 index db4fbdded0..0000000000 --- a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_pw/rm_dups.f90 +++ /dev/null @@ -1,43 +0,0 @@ -!------------------------------------------------------- -! rm_dups -! -! This subroutine removes duplicate data by comparing -! lat, lin, time, and pressure values. Differences -! of < 10.0e-5 are assumed to be matches. -!------------------------------------------------------- - -subroutine rm_dups(duparr,n,m,ilat,ilon,ipress,itime,iweight,nndup) - - implicit none - - real(4),intent(inout),dimension(m,n) :: duparr - -! integer ihash(2*n) -! integer ifn - integer n,m,ilat,ilon,iweight,nndup,i - integer itime,jj,ipress - real dlat,dlon,dtime,dpress,match - - data match / 10.0e-5 / - - - nndup=0 - do i = 1, n - do jj=i+1,n - dlat=abs(duparr(ilat,i)-duparr(ilat,jj)) - dlon=abs(duparr(ilon,i)-duparr(ilon,jj)) - dtime=abs(duparr(itime,i)-duparr(itime,jj)) - dpress=abs(duparr(ipress,i)-duparr(ipress,jj)) - - if (dlat < match .and. dlon < match .and. dtime < match & - .and. dpress < match ) then - - duparr(iweight,i)=-1.0 - nndup=nndup+1 - endif - enddo - enddo - - write(*,*) 'num dups found by rm_dups is ',nndup - return -end diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_q/convinfo.f90 b/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_q/convinfo.f90 deleted file mode 100644 index 7824d24877..0000000000 --- a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_q/convinfo.f90 +++ /dev/null @@ -1,58 +0,0 @@ -!------------------------------------------------------------------ -! convinfo_read -! -! This subroutine reads the conventional data (cnvstat) file. -!------------------------------------------------------------------ - -subroutine convinfo_read(dtype,idtype,insubtype,ituse,ntumgrp,ntgroup,ntmiter,isubtype,& - ttwind2,gtross2,etrmax2,etrmin2,vtar_b2,vtar_pg2) - - implicit none - - character(120):: crecord - character(7) :: obstype1 - character(15) :: obstype - character(1) :: cflg - character(7):: iotype - integer idtype,insubtype - character(idtype) :: dtype - - integer(4):: ittype,ituse,ntumgrp,ntgroup,ntmiter,isubtype - integer(4) :: lunin,ithin,npred,iflag - real(8) :: ttwind,gtross,etrmax,etrmin,vtar_b,vtar_pg,rmesh,pmesh - real(4) :: ttwind2,gtross2,etrmax2,etrmin2,vtar_b2,vtar_pg2 - - lunin=11 - - open(lunin,file='convinfo',form='formatted') - rewind(lunin) - - loopd: do - read(lunin,1030,IOSTAT=iflag)cflg,iotype,crecord - - if(cflg == '!') cycle - if( iflag /= 0 ) exit loopd - - read(crecord,*)ittype,isubtype,ituse,ttwind,ntumgrp,ntgroup,ntmiter,& - gtross,etrmax,etrmin,vtar_b,vtar_pg,ithin,rmesh,pmesh,npred - write(obstype1,'(i3)') ittype - - obstype=trim(iotype)//trim(obstype1) -! print *,'obstype,dtype ',obstype,dtype - - if( trim(obstype) == trim(dtype) .and. isubtype == insubtype) then - ttwind2=ttwind - gtross2=gtross - etrmax2=etrmax - etrmin2=etrmin - vtar_b2=vtar_b - vtar_pg2=vtar_pg - exit - endif - - enddo loopd - -1030 format(a1,a7,2x,a120) - - return -end diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_q/histgram.f90 b/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_q/histgram.f90 deleted file mode 100644 index 81d429cb4a..0000000000 --- a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_q/histgram.f90 +++ /dev/null @@ -1,143 +0,0 @@ -!---------------------------------------------------------------------------- -! subroutine hist -! -! This subroutine calculates the histogram of each data source. -!---------------------------------------------------------------------------- - -subroutine hist(mtype,rmodnbc,nchan,nxdata,ndata,rmin,rmax,rlev,fileo,ncount_vqc,ncount_gros) - - implicit none - - integer nxdata,nchan,nlev,i,j,k - real rlev,rmin,rmax,sqr2 - - real,dimension(nchan,nxdata) :: rmodnbc - real,dimension(nchan) :: rmean,rstd - integer,dimension(nchan) :: nmean,nobs,ndata,ncount_vqc,ncount_gros - - real,dimension(nchan,400) :: ys - real,dimension(400) :: xs - real,dimension(401) :: xs2 - real maxf - - character*50 fileo - character*15 mtype - - sqr2=1.414213562 - - nlev=(rmax-rmin)/rlev - - if(nlev >400) then - print *,' too many bins, exceeding 400' - return - endif - - xs(1)=rmin+rlev/2.0 - xs2(1)=rmin - - print *, 'nlev=',nlev - print *, 'nobs=',ndata(1),ndata(2),ndata(3) - - do i=2,nlev - xs(i)=xs(i-1)+rlev - xs2(i)=xs2(i-1)+rlev - end do - - xs2(nlev+1)=xs2(nlev)+rlev - - do i=1,nlev - do j=1,nchan - ys(j,i)=0.0 - enddo - enddo - - do k=1,nchan - if(ndata(k) >1) then - do i=1, ndata(k) - do j=1,nlev - if( rmodnbc(k,i) >=xs2(j) .and. & - rmodnbc(k,i) 1) then - do i=1,ndata(j) - if(rmodnbc(j,i) >=rmin .and. rmodnbc(j,i) <=rmax) then - rmean(j)=rmean(j)+rmodnbc(j,i) - rstd(j)=rstd(j)+rmodnbc(j,i)*rmodnbc(j,i) - nobs(j)=nobs(j)+1 - endif - enddo - endif - enddo - - do j=1,nchan - if(nobs(j) >0) then - if(nobs(j)==1) then - rstd(j)=rstd(j)-rmean(j)*rmean(j)/nobs(j) - rmean(j)=rmean(j)/nobs(j) - rstd(j)=0.0 - else - rstd(j)=rstd(j)-rmean(j)*rmean(j)/nobs(j) - rmean(j)=rmean(j)/nobs(j) - rstd(j)=sqrt(abs(rstd(j))/(nobs(j)-1)) - endif - endif - enddo - - - - write(6,200) mtype - do j=1,nchan - write(6,210) nobs(j),ncount_vqc(j),ncount_gros(j),rstd(j),rmean(j) - enddo - -200 format(a12,'no. std mean ') -210 format(3i10,2f10.3) - -! write(6,220) (xs(1,i),i=1,100) -! write(6,230) (ys(1,i),i=1,100) -! write(6,230) (f(1,i),i=1,100) - -!220 format(6e12.4) -!230 format(6e12.5) - -! trasform the frequecy so that gaussin distribution became a stright line - -! print *, 'maxf ',maxf - -! do i=1,nlev -! if(ys(i) >0.0) then -! ys(i)=sqrt(-2.0*log(ys(i)/maxf)) -! else -! ys(i)=0.0 -! endif -! f(i)=abs((xs(i)-rmean)/rstd) -! enddo - - open (10,file=fileo,form='unformatted',access='direct',recl=nlev*4) - - write(10,rec=1) (xs(i),i=1,nlev) - do j=1,nchan - write(10,rec=2+j-1) (ys(j,i),i=1,nlev) - enddo - - close(10) - - - return -end - diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_q/read_q.f90 b/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_q/read_q.f90 deleted file mode 100644 index 0fb3db19b6..0000000000 --- a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_q/read_q.f90 +++ /dev/null @@ -1,136 +0,0 @@ -!===================================== -! read_q -! -! read humidity files -!===================================== - -subroutine read_q(nreal,dtype,fname,fileo,gtross,rlev) - - implicit none - - real(4),allocatable,dimension(:,:) :: rdiag - real(4),dimension(3,3000000) :: rpress - integer,dimension(3) :: ncount,ncount_vqc,ncount_gros - - character*200 fname - character*50 fileo - character*15 dtype - - real*4 tiny,huge,real - real rlev,rgtross,gtross,weight,ddf - integer nobs,nreal,ntotal,ngross,nreal_in,nlev - integer ilat,ilon,ipres,itime,iqc,iuse,imuse,iweight,ierr,ierr2,ierr3,iobs,iogs,iqsges - integer i,ndup,ioges,igos - real(4) :: rmiss,vqclmt,vqclmte - - data rmiss / -999.0 / - data huge / 1.0e6 / - data tiny / 1.0e-6 / - - ncount=0 - rpress=rmiss - ncount_vqc=0 - ncount_gros=0 - - - - ntotal=0 - open(unit=11,file=fname,form='unformatted') - rewind(11) - - read(11) nobs,nreal_in -! print *, 'nobs=',nobs - - if (nreal /= nreal_in) then - print *,'nreal_in,nreal ',nreal_in,nreal - stop - endif - - allocate(rdiag(nreal,nobs)) - read(11) rdiag - - - ilat=1 ! lat - ilon=2 ! lon - ipres=4 ! pressure - itime=6 ! relative time - iqc=7 ! qc flag - iuse=9 ! original data usage flag - imuse=10 ! data usage flag in the analsis - iweight=11 ! variational relative weight - ierr=12 ! original error from bufr error table - ierr2=13 ! error from read_bufr - ierr3=14 ! error from final adjusted - iobs=15 ! obs - iogs=16 ! obs-ges - iqsges=18 ! guess saturation specific humidity - - - call rm_dups( rdiag,nobs,nreal,ilat,ilon,ipres,itime,iweight,ndup ) - - do i=1,nobs - if( rdiag(iweight,i) >= 0.0 .and. rdiag(imuse,i) >0.0 ) then - ncount(1)=ncount(1)+1 - rpress(1,ncount(1))=rdiag(iogs,i)*rdiag(ierr,i) - weight=rdiag(iweight,i) - - if(weight <1.0) then - ncount_vqc(1)=ncount_vqc(1)+1 - vqclmt=vqclmt+abs(rdiag(ioges,i))*rdiag(ierr,i) - endif - - if(rdiag(iqc,i) >=4.0) then - ncount(2)=ncount(2)+1 - if(weight <1.0) then - ncount_vqc(2)=ncount_vqc(2)+1 - endif - rpress(2,ncount(2))=rdiag(iogs,i)*rdiag(ierr,i) - endif - - else if(rdiag(iweight,i) >= 0.0 .and. rdiag(imuse,i) <0.0) then - if(rdiag(iqc,i) <=7.0) then - ncount_gros(1)=ncount_gros(1)+1 - if(rdiag(iqc,i) >3.0 .and. rdiag(iqc,i) <=7.0) then - ncount_gros(2)=ncount_gros(2)+1 - endif - - else if(rdiag(iqc,i) >=8.0 ) then - - if(rdiag(ierr,i) >tiny ) then - ddf=abs(rdiag(igos,i))*rdiag(ierr,i) - if(ddf 0) then - vqclmt=vqclmt/ncount_vqc(1) - endif - -! calculate the the areacd usr2 - rgtross=-gtross - nlev=nint((gtross-rgtross)/rlev) - - print *,nlev - print *, 'rmax,rmin ',gtross,rgtross - print *, 'ncount_gros,',ncount_gros(1),ncount_gros(2),ncount_gros(3) - print *, 'vqc-limit,vqc-limite ',vqclmt,vqclmte - - - call hist(dtype,rpress,3,3000000,ncount,rgtross,gtross,rlev,fileo,ncount_vqc,ncount_gros) - return -end diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_q/rm_dups.f90 b/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_q/rm_dups.f90 deleted file mode 100644 index db4fbdded0..0000000000 --- a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_q/rm_dups.f90 +++ /dev/null @@ -1,43 +0,0 @@ -!------------------------------------------------------- -! rm_dups -! -! This subroutine removes duplicate data by comparing -! lat, lin, time, and pressure values. Differences -! of < 10.0e-5 are assumed to be matches. -!------------------------------------------------------- - -subroutine rm_dups(duparr,n,m,ilat,ilon,ipress,itime,iweight,nndup) - - implicit none - - real(4),intent(inout),dimension(m,n) :: duparr - -! integer ihash(2*n) -! integer ifn - integer n,m,ilat,ilon,iweight,nndup,i - integer itime,jj,ipress - real dlat,dlon,dtime,dpress,match - - data match / 10.0e-5 / - - - nndup=0 - do i = 1, n - do jj=i+1,n - dlat=abs(duparr(ilat,i)-duparr(ilat,jj)) - dlon=abs(duparr(ilon,i)-duparr(ilon,jj)) - dtime=abs(duparr(itime,i)-duparr(itime,jj)) - dpress=abs(duparr(ipress,i)-duparr(ipress,jj)) - - if (dlat < match .and. dlon < match .and. dtime < match & - .and. dpress < match ) then - - duparr(iweight,i)=-1.0 - nndup=nndup+1 - endif - enddo - enddo - - write(*,*) 'num dups found by rm_dups is ',nndup - return -end diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_t/convinfo.f90 b/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_t/convinfo.f90 deleted file mode 100644 index 7824d24877..0000000000 --- a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_t/convinfo.f90 +++ /dev/null @@ -1,58 +0,0 @@ -!------------------------------------------------------------------ -! convinfo_read -! -! This subroutine reads the conventional data (cnvstat) file. -!------------------------------------------------------------------ - -subroutine convinfo_read(dtype,idtype,insubtype,ituse,ntumgrp,ntgroup,ntmiter,isubtype,& - ttwind2,gtross2,etrmax2,etrmin2,vtar_b2,vtar_pg2) - - implicit none - - character(120):: crecord - character(7) :: obstype1 - character(15) :: obstype - character(1) :: cflg - character(7):: iotype - integer idtype,insubtype - character(idtype) :: dtype - - integer(4):: ittype,ituse,ntumgrp,ntgroup,ntmiter,isubtype - integer(4) :: lunin,ithin,npred,iflag - real(8) :: ttwind,gtross,etrmax,etrmin,vtar_b,vtar_pg,rmesh,pmesh - real(4) :: ttwind2,gtross2,etrmax2,etrmin2,vtar_b2,vtar_pg2 - - lunin=11 - - open(lunin,file='convinfo',form='formatted') - rewind(lunin) - - loopd: do - read(lunin,1030,IOSTAT=iflag)cflg,iotype,crecord - - if(cflg == '!') cycle - if( iflag /= 0 ) exit loopd - - read(crecord,*)ittype,isubtype,ituse,ttwind,ntumgrp,ntgroup,ntmiter,& - gtross,etrmax,etrmin,vtar_b,vtar_pg,ithin,rmesh,pmesh,npred - write(obstype1,'(i3)') ittype - - obstype=trim(iotype)//trim(obstype1) -! print *,'obstype,dtype ',obstype,dtype - - if( trim(obstype) == trim(dtype) .and. isubtype == insubtype) then - ttwind2=ttwind - gtross2=gtross - etrmax2=etrmax - etrmin2=etrmin - vtar_b2=vtar_b - vtar_pg2=vtar_pg - exit - endif - - enddo loopd - -1030 format(a1,a7,2x,a120) - - return -end diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_t/histgram.f90 b/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_t/histgram.f90 deleted file mode 100644 index 81d429cb4a..0000000000 --- a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_t/histgram.f90 +++ /dev/null @@ -1,143 +0,0 @@ -!---------------------------------------------------------------------------- -! subroutine hist -! -! This subroutine calculates the histogram of each data source. -!---------------------------------------------------------------------------- - -subroutine hist(mtype,rmodnbc,nchan,nxdata,ndata,rmin,rmax,rlev,fileo,ncount_vqc,ncount_gros) - - implicit none - - integer nxdata,nchan,nlev,i,j,k - real rlev,rmin,rmax,sqr2 - - real,dimension(nchan,nxdata) :: rmodnbc - real,dimension(nchan) :: rmean,rstd - integer,dimension(nchan) :: nmean,nobs,ndata,ncount_vqc,ncount_gros - - real,dimension(nchan,400) :: ys - real,dimension(400) :: xs - real,dimension(401) :: xs2 - real maxf - - character*50 fileo - character*15 mtype - - sqr2=1.414213562 - - nlev=(rmax-rmin)/rlev - - if(nlev >400) then - print *,' too many bins, exceeding 400' - return - endif - - xs(1)=rmin+rlev/2.0 - xs2(1)=rmin - - print *, 'nlev=',nlev - print *, 'nobs=',ndata(1),ndata(2),ndata(3) - - do i=2,nlev - xs(i)=xs(i-1)+rlev - xs2(i)=xs2(i-1)+rlev - end do - - xs2(nlev+1)=xs2(nlev)+rlev - - do i=1,nlev - do j=1,nchan - ys(j,i)=0.0 - enddo - enddo - - do k=1,nchan - if(ndata(k) >1) then - do i=1, ndata(k) - do j=1,nlev - if( rmodnbc(k,i) >=xs2(j) .and. & - rmodnbc(k,i) 1) then - do i=1,ndata(j) - if(rmodnbc(j,i) >=rmin .and. rmodnbc(j,i) <=rmax) then - rmean(j)=rmean(j)+rmodnbc(j,i) - rstd(j)=rstd(j)+rmodnbc(j,i)*rmodnbc(j,i) - nobs(j)=nobs(j)+1 - endif - enddo - endif - enddo - - do j=1,nchan - if(nobs(j) >0) then - if(nobs(j)==1) then - rstd(j)=rstd(j)-rmean(j)*rmean(j)/nobs(j) - rmean(j)=rmean(j)/nobs(j) - rstd(j)=0.0 - else - rstd(j)=rstd(j)-rmean(j)*rmean(j)/nobs(j) - rmean(j)=rmean(j)/nobs(j) - rstd(j)=sqrt(abs(rstd(j))/(nobs(j)-1)) - endif - endif - enddo - - - - write(6,200) mtype - do j=1,nchan - write(6,210) nobs(j),ncount_vqc(j),ncount_gros(j),rstd(j),rmean(j) - enddo - -200 format(a12,'no. std mean ') -210 format(3i10,2f10.3) - -! write(6,220) (xs(1,i),i=1,100) -! write(6,230) (ys(1,i),i=1,100) -! write(6,230) (f(1,i),i=1,100) - -!220 format(6e12.4) -!230 format(6e12.5) - -! trasform the frequecy so that gaussin distribution became a stright line - -! print *, 'maxf ',maxf - -! do i=1,nlev -! if(ys(i) >0.0) then -! ys(i)=sqrt(-2.0*log(ys(i)/maxf)) -! else -! ys(i)=0.0 -! endif -! f(i)=abs((xs(i)-rmean)/rstd) -! enddo - - open (10,file=fileo,form='unformatted',access='direct',recl=nlev*4) - - write(10,rec=1) (xs(i),i=1,nlev) - do j=1,nchan - write(10,rec=2+j-1) (ys(j,i),i=1,nlev) - enddo - - close(10) - - - return -end - diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_t/read_t.f90 b/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_t/read_t.f90 deleted file mode 100644 index ad0112f131..0000000000 --- a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_t/read_t.f90 +++ /dev/null @@ -1,134 +0,0 @@ -!-------------------------------------------------------------- -! subroutine read_t -! -!-------------------------------------------------------------- -subroutine read_t(nreal,dtype,fname,fileo,gtross,rlev) - - implicit none - - real(4),allocatable,dimension(:,:) :: rdiag - real(4),dimension(3,3000000) :: rpress - integer,dimension(3) :: ncount,ncount_vqc,ncount_gros - - character*200 fname - character*50 fileo - character*4 dtype - - real*4 tiny,huge,real - integer nobs,nreal,ntotal,ngross,nreal_in,nlev - integer nint,igos,ioges,i,j,ndup - integer ilat,ilon,ipres,itime,iqc,iuse,imuse,iweight,ierr,ierr2,ierr3,iobs,iogs - real rlev,rgtross,gtross,ddf,weight - - real(4) :: rmiss,vqclmt,vqclmte - - data rmiss/-999.0/ - data tiny / 1.0e-6 / - data huge / 1.0e6 / - -! print *,'nreal=',nreal - - ncount=0 - rpress=rmiss - ncount_vqc=0 - ncount_gros=0 - - - ntotal=0 - open(unit=11,file=fname,form='unformatted') - rewind(11) - read(11) nobs,nreal_in -! print *, 'nobs=',nobs - if (nreal /= nreal_in) then - print *,'nreal_in,nreal ',nreal_in,nreal - stop - endif - - allocate(rdiag(nreal,nobs)) - read(11) rdiag - - - ilat=1 ! lat - ilon=2 ! lon - ipres=4 ! pressure - itime=6 ! relative time - iqc=7 ! qc flag - iuse=9 ! original data usage flag - imuse=10 ! data usage flag in the analsis - iweight=11 ! variational relative weight - ierr=12 ! original error from bufr error table - ierr2=13 ! error from read_bufr - ierr3=14 ! error from final adjusted - iobs=15 ! obs - iogs=16 ! obs-ges - - - call rm_dups( rdiag,nobs,nreal,ilat,ilon,ipres,itime,iweight,ndup ) - - do i=1,nobs - if( rdiag(iweight,i) >= 0.0 .and. rdiag(imuse,i) >0.0 ) then - ncount(1)=ncount(1)+1 - rpress(1,ncount(1))=rdiag(iogs,i)*rdiag(ierr,i) - weight=rdiag(iweight,i) - - if(weight <1.0) then - ncount_vqc(1)=ncount_vqc(1)+1 - vqclmt=vqclmt+abs(rdiag(ioges,i))*rdiag(ierr,i) - endif - - if(rdiag(iqc,i) >=4.0) then - ncount(2)=ncount(2)+1 - if(weight <1.0) then - ncount_vqc(2)=ncount_vqc(2)+1 - endif - rpress(2,ncount(2))=rdiag(iogs,i)*rdiag(ierr,i) - endif - - else if(rdiag(iweight,i) >= 0.0 .and. rdiag(imuse,i) <0.0) then - if(rdiag(iqc,i) <=7.0) then - ncount_gros(1)=ncount_gros(1)+1 - - if(rdiag(iqc,i) >3.0 .and. rdiag(iqc,i) <=7.0) then - ncount_gros(2)=ncount_gros(2)+1 - endif - - else if(rdiag(iqc,i) >=8.0 ) then - if(rdiag(ierr,i) >tiny ) then - ddf=abs(rdiag(igos,i))*rdiag(ierr,i) - if(ddf 0) then - vqclmt=vqclmt/ncount_vqc(1) - endif - - ! calculate the the areacd usr2 - rgtross=-gtross - nlev=nint((gtross-rgtross)/rlev) - - nlev=nlev - print *,nlev - print *, 'rmax,rmin ',gtross,rgtross - print *, 'ncount_gros,',ncount_gros(1),ncount_gros(2),ncount_gros(3) - print *, 'vqc-limit,vqc-limite ',vqclmt,vqclmte - - - call hist(dtype,rpress,3,3000000,ncount,rgtross,gtross,rlev,fileo,ncount_vqc,ncount_gros) - return -end diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_t/read_t_mor.f90 b/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_t/read_t_mor.f90 deleted file mode 100644 index d48b1005b2..0000000000 --- a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_t/read_t_mor.f90 +++ /dev/null @@ -1,87 +0,0 @@ -!------------------------------------------------------------- -! subroutine read_t_mor -! -!------------------------------------------------------------- -subroutine read_t_mor(nreal,dtype,fname,fileo,gtross,rlev) - - implicit none - - real(4),allocatable,dimension(:,:) :: rdiag - real(4),dimension(3,3000000) :: rpress - integer,dimension(3) :: ncount,ncount_vqc,ncount_gros - - character*200 fname - character*50 fileo - character*15 dtype - - integer nobs,nreal,ntotal,ngross,nreal_in,nlev - integer i,ndup,nlat,nlon,npres,ntime - integer ilat,ilon,ipres,itime,iqc,iuse,imuse,iweight,ierr,ierr2,ierr3,iobs,iogs - real rgtross,gtross - real(4) :: rmiss,vqclmt,vqclmte,rlev - - data rmiss/-999.0/ - - - ncount=0 - rpress=rmiss - ncount_vqc=0 - ncount_gros=0 - - - ntotal=0 - open(unit=11,file=fname,form='unformatted') - rewind(11) - read(11) nobs,nreal_in -! print *, 'nobs=',nobs - - if (nreal /= nreal_in) then - print *,'nreal_in,nreal ',nreal_in,nreal - stop - endif - - allocate(rdiag(nreal,nobs)) - read(11) rdiag - - - ilat=1 ! lat - ilon=2 ! lon - ipres=4 ! pressure - itime=6 ! relative time - iqc=7 ! qc flag - iuse=9 ! original data usage flag - imuse=10 ! data usage flag in the analsis - iweight=11 ! variational relative weight - ierr=12 ! original error from bufr error table - ierr2=13 ! error from read_bufr - ierr3=14 ! error from final adjusted - iobs=15 ! obs - iogs=16 ! obs-ges - - - call rm_dups( rdiag,nobs,nreal,ilat,ilon,ipres,itime,iweight,ndup ) - - do i=1,nobs - if(rdiag(iweight,i) >0.0) then - ncount(3)=ncount(3)+1 - rpress(3,ncount(3))=rdiag(iogs,i) - endif - enddo - - deallocate(rdiag) - - - ! calculate the the areacd usr2 - rgtross=-gtross - nlev=nint((gtross-rgtross)/rlev) - print *,nlev - print *,gtross, rgtross - - do i=1,3 - if(ncount(i) ==0) ncount(i)=1 - enddo - - call hist(dtype,rpress,3,3000000,ncount,rgtross,gtross,rlev,fileo,ncount_vqc,ncount_gros) - - return -end diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_t/rm_dups.f90 b/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_t/rm_dups.f90 deleted file mode 100644 index db4fbdded0..0000000000 --- a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_t/rm_dups.f90 +++ /dev/null @@ -1,43 +0,0 @@ -!------------------------------------------------------- -! rm_dups -! -! This subroutine removes duplicate data by comparing -! lat, lin, time, and pressure values. Differences -! of < 10.0e-5 are assumed to be matches. -!------------------------------------------------------- - -subroutine rm_dups(duparr,n,m,ilat,ilon,ipress,itime,iweight,nndup) - - implicit none - - real(4),intent(inout),dimension(m,n) :: duparr - -! integer ihash(2*n) -! integer ifn - integer n,m,ilat,ilon,iweight,nndup,i - integer itime,jj,ipress - real dlat,dlon,dtime,dpress,match - - data match / 10.0e-5 / - - - nndup=0 - do i = 1, n - do jj=i+1,n - dlat=abs(duparr(ilat,i)-duparr(ilat,jj)) - dlon=abs(duparr(ilon,i)-duparr(ilon,jj)) - dtime=abs(duparr(itime,i)-duparr(itime,jj)) - dpress=abs(duparr(ipress,i)-duparr(ipress,jj)) - - if (dlat < match .and. dlon < match .and. dtime < match & - .and. dpress < match ) then - - duparr(iweight,i)=-1.0 - nndup=nndup+1 - endif - enddo - enddo - - write(*,*) 'num dups found by rm_dups is ',nndup - return -end diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_uv/convinfo.f90 b/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_uv/convinfo.f90 deleted file mode 100644 index 7824d24877..0000000000 --- a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_uv/convinfo.f90 +++ /dev/null @@ -1,58 +0,0 @@ -!------------------------------------------------------------------ -! convinfo_read -! -! This subroutine reads the conventional data (cnvstat) file. -!------------------------------------------------------------------ - -subroutine convinfo_read(dtype,idtype,insubtype,ituse,ntumgrp,ntgroup,ntmiter,isubtype,& - ttwind2,gtross2,etrmax2,etrmin2,vtar_b2,vtar_pg2) - - implicit none - - character(120):: crecord - character(7) :: obstype1 - character(15) :: obstype - character(1) :: cflg - character(7):: iotype - integer idtype,insubtype - character(idtype) :: dtype - - integer(4):: ittype,ituse,ntumgrp,ntgroup,ntmiter,isubtype - integer(4) :: lunin,ithin,npred,iflag - real(8) :: ttwind,gtross,etrmax,etrmin,vtar_b,vtar_pg,rmesh,pmesh - real(4) :: ttwind2,gtross2,etrmax2,etrmin2,vtar_b2,vtar_pg2 - - lunin=11 - - open(lunin,file='convinfo',form='formatted') - rewind(lunin) - - loopd: do - read(lunin,1030,IOSTAT=iflag)cflg,iotype,crecord - - if(cflg == '!') cycle - if( iflag /= 0 ) exit loopd - - read(crecord,*)ittype,isubtype,ituse,ttwind,ntumgrp,ntgroup,ntmiter,& - gtross,etrmax,etrmin,vtar_b,vtar_pg,ithin,rmesh,pmesh,npred - write(obstype1,'(i3)') ittype - - obstype=trim(iotype)//trim(obstype1) -! print *,'obstype,dtype ',obstype,dtype - - if( trim(obstype) == trim(dtype) .and. isubtype == insubtype) then - ttwind2=ttwind - gtross2=gtross - etrmax2=etrmax - etrmin2=etrmin - vtar_b2=vtar_b - vtar_pg2=vtar_pg - exit - endif - - enddo loopd - -1030 format(a1,a7,2x,a120) - - return -end diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_uv/histgram.f90 b/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_uv/histgram.f90 deleted file mode 100644 index 81d429cb4a..0000000000 --- a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_uv/histgram.f90 +++ /dev/null @@ -1,143 +0,0 @@ -!---------------------------------------------------------------------------- -! subroutine hist -! -! This subroutine calculates the histogram of each data source. -!---------------------------------------------------------------------------- - -subroutine hist(mtype,rmodnbc,nchan,nxdata,ndata,rmin,rmax,rlev,fileo,ncount_vqc,ncount_gros) - - implicit none - - integer nxdata,nchan,nlev,i,j,k - real rlev,rmin,rmax,sqr2 - - real,dimension(nchan,nxdata) :: rmodnbc - real,dimension(nchan) :: rmean,rstd - integer,dimension(nchan) :: nmean,nobs,ndata,ncount_vqc,ncount_gros - - real,dimension(nchan,400) :: ys - real,dimension(400) :: xs - real,dimension(401) :: xs2 - real maxf - - character*50 fileo - character*15 mtype - - sqr2=1.414213562 - - nlev=(rmax-rmin)/rlev - - if(nlev >400) then - print *,' too many bins, exceeding 400' - return - endif - - xs(1)=rmin+rlev/2.0 - xs2(1)=rmin - - print *, 'nlev=',nlev - print *, 'nobs=',ndata(1),ndata(2),ndata(3) - - do i=2,nlev - xs(i)=xs(i-1)+rlev - xs2(i)=xs2(i-1)+rlev - end do - - xs2(nlev+1)=xs2(nlev)+rlev - - do i=1,nlev - do j=1,nchan - ys(j,i)=0.0 - enddo - enddo - - do k=1,nchan - if(ndata(k) >1) then - do i=1, ndata(k) - do j=1,nlev - if( rmodnbc(k,i) >=xs2(j) .and. & - rmodnbc(k,i) 1) then - do i=1,ndata(j) - if(rmodnbc(j,i) >=rmin .and. rmodnbc(j,i) <=rmax) then - rmean(j)=rmean(j)+rmodnbc(j,i) - rstd(j)=rstd(j)+rmodnbc(j,i)*rmodnbc(j,i) - nobs(j)=nobs(j)+1 - endif - enddo - endif - enddo - - do j=1,nchan - if(nobs(j) >0) then - if(nobs(j)==1) then - rstd(j)=rstd(j)-rmean(j)*rmean(j)/nobs(j) - rmean(j)=rmean(j)/nobs(j) - rstd(j)=0.0 - else - rstd(j)=rstd(j)-rmean(j)*rmean(j)/nobs(j) - rmean(j)=rmean(j)/nobs(j) - rstd(j)=sqrt(abs(rstd(j))/(nobs(j)-1)) - endif - endif - enddo - - - - write(6,200) mtype - do j=1,nchan - write(6,210) nobs(j),ncount_vqc(j),ncount_gros(j),rstd(j),rmean(j) - enddo - -200 format(a12,'no. std mean ') -210 format(3i10,2f10.3) - -! write(6,220) (xs(1,i),i=1,100) -! write(6,230) (ys(1,i),i=1,100) -! write(6,230) (f(1,i),i=1,100) - -!220 format(6e12.4) -!230 format(6e12.5) - -! trasform the frequecy so that gaussin distribution became a stright line - -! print *, 'maxf ',maxf - -! do i=1,nlev -! if(ys(i) >0.0) then -! ys(i)=sqrt(-2.0*log(ys(i)/maxf)) -! else -! ys(i)=0.0 -! endif -! f(i)=abs((xs(i)-rmean)/rstd) -! enddo - - open (10,file=fileo,form='unformatted',access='direct',recl=nlev*4) - - write(10,rec=1) (xs(i),i=1,nlev) - do j=1,nchan - write(10,rec=2+j-1) (ys(j,i),i=1,nlev) - enddo - - close(10) - - - return -end - diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_uv/histgramuv.f90 b/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_uv/histgramuv.f90 deleted file mode 100644 index 46390d27a4..0000000000 --- a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_uv/histgramuv.f90 +++ /dev/null @@ -1,143 +0,0 @@ -!----------------------------------------------------------------- -! subroutine histuv -! -!----------------------------------------------------------------- - -subroutine histuv(dtype,rmodnbc,nchan,nxdata,ndata,rmin,rmax,rlev,fileo,ncount_vqc,ncount_gros,fileo2) - - implicit none - - real,dimension(nchan,nxdata) :: rmodnbc - real,dimension(nchan) :: rmean,rstd - integer,dimension(nchan) :: nmean,nobs,ndata,ncount_vqc,ncount_gros - - real,dimension(nchan,400) :: ys - real,dimension(400) :: xs - real,dimension(401) :: xs2 - real maxf,sqr2 - real rmin, rmax,rlev - - character*50 fileo - character*50 fileo2 - character*15 dtype - - integer i,j,k,nlev,nxdata,nchan - - - sqr2=1.414213562 - - nlev=(rmax-rmin)/rlev - xs(1)=rmin+rlev/2.0 - xs2(1)=rmin - - open (11,file=fileo2,form='formatted') - - write(11,100) nlev - -100 format(i5) - - write(11,110) ndata(1),ndata(2),ndata(3) - -110 format(3i5) - - do i=2,nlev - xs(i)=xs(i-1)+rlev - xs2(i)=xs2(i-1)+rlev - end do - - xs2(nlev+1)=xs2(nlev)+rlev - - do i=1,nlev - do j=1,nchan - ys(j,i)=0.0 - enddo - enddo - - do k=1,nchan - if(ndata(k) >1) then - do i=1, ndata(k) - do j=1,nlev - if( rmodnbc(k,i) >=xs2(j) .and. & - rmodnbc(k,i) 1) then - do i=1,ndata(j) - if(rmodnbc(j,i) >=rmin .and. rmodnbc(j,i) <=rmax ) then - rmean(j)=rmean(j)+rmodnbc(j,i) - rstd(j)=rstd(j)+rmodnbc(j,i)*rmodnbc(j,i) - nobs(j)=nobs(j)+1 - endif - enddo - endif - enddo - - do j=1,nchan - if(nobs(j) >0) then - if(nobs(j)==1) then - rstd(j)=rstd(j)-rmean(j)*rmean(j)/nobs(j) - rmean(j)=rmean(j)/nobs(j) - rstd(j)=0.0 - else - rstd(j)=rstd(j)-rmean(j)*rmean(j)/nobs(j) - rmean(j)=rmean(j)/nobs(j) - rstd(j)=sqrt(abs(rstd(j))/(nobs(j)-1)) - endif - endif - enddo - -! the frequency of real curve -! print *, 'data type no. std, mean ,rarea ',dtype,ndata,rstd,rmean,rarea - write(11,200) dtype - do j=1,nchan - write(11,210) nobs(j),ncount_vqc(j),ncount_gros(j),rstd(j),rmean(j) - enddo - -200 format(a12,'no. std mean ') -210 format(3i10,2f10.3) - -! write(6,220) (xs(1,i),i=1,100) -! write(6,230) (ys(1,i),i=1,100) -! write(6,230) (f(1,i),i=1,100) - -!220 format(6e12.4) -!230 format(6e12.5) - -! trasform the frequecy so that gaussin distribution became a stright line - -! print *, 'maxf ',maxf -! do i=1,nlev -! if(ys(i) >0.0) then -! ys(i)=sqrt(-2.0*log(ys(i)/maxf)) -! else -! ys(i)=0.0 -! endif -! f(i)=abs((xs(i)-rmean)/rstd) -! enddo - - open (10,file=fileo,form='unformatted',access='direct',recl=nlev*4) - - write(10,rec=1) (xs(i),i=1,nlev) - do j=1,nchan - write(10,rec=2+j-1) (ys(j,i),i=1,nlev) - enddo - - close(10) - close(11) - - return -end - diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_uv/mainread_uv.f90 b/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_uv/mainread_uv.f90 deleted file mode 100644 index a8bcbbcedf..0000000000 --- a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_uv/mainread_uv.f90 +++ /dev/null @@ -1,44 +0,0 @@ -!-------------------------------------------------------------- -! program mainread_uv -! -!-------------------------------------------------------------- - - implicit none - - character*200 fname - character*50 fileo - character*15 mtype - - real rpress,rlev - - integer nobs,nreal,ntotal,ngross,nreal_in,insubtype - integer(4):: ittype,ituse,ntumgrp,ntgroup,ntmiter,iflag - integer isubtype,ncount,ncount_vgc,ncount_gros - - real(4) :: ttwind,gtross,etrmax,etrmin,vtar_b,vtar_pg - real(4) :: rmiss,vqclmt,vqclmte - - data rmiss/-999.0/ - - namelist /input/nreal,mtype,fname,fileo,rlev,insubtype - - read (5,input) -! write(6,input) - - ncount=0 - rpress=rmiss - ncount_vgc=0 - ncount_gros=0 - -! print *,mtype,nreal - - call convinfo_read(mtype,15,insubtype,ituse,ntumgrp,ntgroup,ntmiter,isubtype,& - ttwind,gtross,etrmax,etrmin,vtar_b,vtar_pg) - -! print *,'ituse=',ituse,gtross - - if (ituse >0) call read_uv(nreal,mtype,fname,fileo,gtross,rlev) - if (ituse <0) call read_uv_mor(nreal,mtype,fname,fileo,gtross,rlev) - - stop -end diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_uv/read_uv_mor.f90 b/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_uv/read_uv_mor.f90 deleted file mode 100644 index 7e39bdcd1c..0000000000 --- a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_uv/read_uv_mor.f90 +++ /dev/null @@ -1,99 +0,0 @@ -!------------------------------------------------------------- -! subroutine read_uv_mor -! -!------------------------------------------------------------- -subroutine read_uv_mor(nreal,dtype,fname,fileo,gtross,rlev) - - implicit none - - real(4),allocatable,dimension(:,:) :: rdiag - real(4),dimension(3,3000000) :: rpress - real(4),dimension(3,3000000) :: rpressu - real(4),dimension(3,3000000) :: rpressv - integer,dimension(3) :: ncount,ncount_vqc,ncount_gros - - character*200 fname - character*50 fileo,fileu,filev,fileou2,fileov2 - character*15 dtype - - real rgtross,gtross - integer nobs,nreal,ntotal,ngross,nreal_in,nlev - integer i,ndup,nlat,nlon,npres,ntime - integer ilat,ilon,ipres,itime,iqc,iuse,imuse,iweight,ierr,ierr2,ierr3,iobu,iogu,iobv,iogv - real(4) :: rmiss,vqclmt,vqclmte,rlev - - data rmiss/-999.0/ - - ncount=0 - rpress=rmiss - ncount_vqc=0 - ncount_gros=0 - fileu=trim(fileo)//'_u' - filev=trim(fileo)//'_v' - fileou2='stdout_u' - fileov2='stdout_v' - - - ntotal=0 - open(unit=11,file=fname,form='unformatted') - rewind(11) - read(11) nobs,nreal_in -! print *, 'nobs=',nobs - - if (nreal /= nreal_in) then - print *,'nreal_in,nreal ',nreal_in,nreal - stop - endif - - allocate(rdiag(nreal,nobs)) - read(11) rdiag - - - ilat=1 ! lat - ilon=2 ! lon - ipres=4 ! pressure - itime=6 ! relative time - iqc=7 ! qc flag - iuse=9 ! original data usage flag - imuse=10 ! data usage flag in the analsis - iweight=11 ! variational relative weight - ierr=12 ! original error from bufr error table - ierr2=13 ! error from read_bufr - ierr3=14 ! error from final adjusted - iobu=15 ! u obs - iogu=16 ! u obs-ges - iobv=18 ! v obs - iogv=19 ! v obs-ges - - - call rm_dups( rdiag,nobs,nreal,ilat,ilon,ipres,itime,iweight,ndup ) - - do i=1,nobs - if(rdiag(iweight,i) >0.0) then - ncount(3)=ncount(3)+1 - rpressu(3,ncount(3))=rdiag(iogu,i) - rpressv(3,ncount(3))=rdiag(iogv,i) - rpress(3,ncount(3))=sqrt(rdiag(iogu,i)**2+rdiag(iogv,i)**2) - endif - enddo - - deallocate(rdiag) - - -! calculate the the areacd usr2 - - rgtross=-gtross - nlev=nint((gtross-rgtross)/rlev) - print *,nlev - print *,gtross, rgtross - - do i=1,3 - if(ncount(i) ==0) ncount(i)=1 - enddo - - call hist(dtype,rpress,3,3000000,ncount,rgtross,gtross,rlev,fileo,ncount_vqc,ncount_gros) - call histuv(dtype,rpressu,3,3000000,ncount,rgtross,gtross,rlev,fileu,ncount_vqc,ncount_gros,fileou2) - call histuv(dtype,rpressv,3,3000000,ncount,rgtross,gtross,rlev,filev,ncount_vqc,ncount_gros,fileov2) - - return -end diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_uv/rm_dups.f90 b/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_uv/rm_dups.f90 deleted file mode 100644 index db4fbdded0..0000000000 --- a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/read_uv/rm_dups.f90 +++ /dev/null @@ -1,43 +0,0 @@ -!------------------------------------------------------- -! rm_dups -! -! This subroutine removes duplicate data by comparing -! lat, lin, time, and pressure values. Differences -! of < 10.0e-5 are assumed to be matches. -!------------------------------------------------------- - -subroutine rm_dups(duparr,n,m,ilat,ilon,ipress,itime,iweight,nndup) - - implicit none - - real(4),intent(inout),dimension(m,n) :: duparr - -! integer ihash(2*n) -! integer ifn - integer n,m,ilat,ilon,iweight,nndup,i - integer itime,jj,ipress - real dlat,dlon,dtime,dpress,match - - data match / 10.0e-5 / - - - nndup=0 - do i = 1, n - do jj=i+1,n - dlat=abs(duparr(ilat,i)-duparr(ilat,jj)) - dlon=abs(duparr(ilon,i)-duparr(ilon,jj)) - dtime=abs(duparr(itime,i)-duparr(itime,jj)) - dpress=abs(duparr(ipress,i)-duparr(ipress,jj)) - - if (dlat < match .and. dlon < match .and. dtime < match & - .and. dpress < match ) then - - duparr(iweight,i)=-1.0 - nndup=nndup+1 - endif - enddo - enddo - - write(*,*) 'num dups found by rm_dups is ',nndup - return -end diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/ush/diag2grad_ps_case.sh b/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/ush/diag2grad_ps_case.sh deleted file mode 100755 index 81275646a5..0000000000 --- a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/ush/diag2grad_ps_case.sh +++ /dev/null @@ -1,82 +0,0 @@ -#!/bin/sh -set -xa - -#------------------------------------------------------- -# -# diag2grad_ps_case.sh -# -#------------------------------------------------------- - -echo "--> diag2grad_ps_case.sh" - - echo "CMON_SUFFIX = $CMON_SUFFIX" - echo "TANKDIR_cmon = $TANKDIR_cmon" - echo "type = $type" - echo "PDATE = $PDATE" - echo "EXECcmon = $EXECcmon" - echo "cycle = $cycle" - echo "nreal = $nreal" - echo "mtype = $mtype (type = $type)" - echo "subtype = $subtype" - echo "hint = $hint" - echo "workdir = $workdir" - - ctype=`echo ${mtype} | cut -c3-5` - nreal_ps=$nreal ### one less than the data items of diagnostic files - nreal2_ps=`expr $nreal - 2` ### the data items in the grads files - - -if [ "$mtype" = 'ps180' -o "$mtype" = 'ps181' -o "$mtype" = 'ps183' -o "$mtype" = 'ps187' ]; then - rm -f diag2grads - cp $EXECcmon/grads_sfctime.x ./diag2grads - rm -f input -cat <input - &input - intype=' ps',stype='${mtype}',itype=$ctype,nreal=$nreal_ps, - iscater=1,igrads=1,timecard='time11',subtype='${subtype}',isubtype=${subtype}, -/ -EOF -elif [ "$mtype" = 'ps120' ]; then - rm -f diag2grads - cp ${EXECcmon}/grads_sfc.x ./diag2grads - rm -f input -cat <input - &input - intype=' ps',stype='${mtype}',itype=$ctype,nreal=$nreal_ps, - iscater=1,igrads=1,subtype='${subtype}',isubtype=${subtype}, -/ -EOF -fi - -./diag2grads stdout 2>&1 - -rm -f ${mtype}_${subtype}.tmp - - -############################################## -# Create the nt file, rename stdout, move nt, -# grads, and scatter files to $TANDIR_cmon -############################################## -ntline=`tail -n1 stdout` -nt=`echo ${ntline} | sed 's/^ *//g' | sed 's/ *$//g'` -if [ ${#nt} = 1 ]; then - ntfile="nt_${mtype}_${subtype}.${PDATE}" - echo ${nt} > ${ntfile} - cp ${ntfile} ${TANKDIR_cmon}/horz_hist/${cycle}/. -fi - -mv stdout stdout_diag2grads_${mtype}_${subtype}.$cycle -dest_dir="${TANKDIR_cmon}/horz_hist/${cycle}" - -for file in ps*grads; do - mv ${file} ${dest_dir}/${file}.${PDATE} -done - -for file in ps*scater; do - mv ${file} ${dest_dir}/${file}.${PDATE} -done - - -echo "<-- diag2grad_ps_case.sh" - -exit diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/ush/diag2grad_q_case.sh b/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/ush/diag2grad_q_case.sh deleted file mode 100755 index cf281f77ee..0000000000 --- a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/ush/diag2grad_q_case.sh +++ /dev/null @@ -1,98 +0,0 @@ -#!/bin/sh -set -xa - -#------------------------------------------------------------ -# -# diag2grad_q_case.sh -# -#------------------------------------------------------------ - -echo "--> diag2grad_q_case.sh" - - echo "CMON_SUFFIX = $CMON_SUFFIX" - echo "TANKDIR_cmon = $TANKDIR_cmon" - echo "type = $type" - echo "PDATE = $PDATE" - echo "EXECcmon = $EXECcmon" - echo "cycle = $cycle" - echo "nreal = $nreal" - echo "mtype = $mtype (type = $type)" - echo "subtype = $subtype" - echo "hint = $hint" - echo "workdir = $workdir" - - nreal_q=$nreal ### one less than the data items of diagnostic files - nreal2_q=`expr $nreal - 2` ### the data items in the grads files - - -# q130_card=alllev -# q132_card=alllev -# q133_card=alllev -# q134_card=alllev -# q135_card=alllev - - ctype=`echo ${mtype} | cut -c2-4` - - if [ "$mtype" = 'q130' -o "$mtype" = 'q131' -o "$mtype" = 'q132' -o "$mtype" = 'q133' -o "$mtype" = 'q134' -o "$mtype" = 'q135' ]; then - rm -f diag2grads - cp ${EXECcmon}/grads_lev.x ./diag2grads -# eval card=\${${mtype}_card} - cat <input - &input - intype=' q',stype='${mtype}',itype=$ctype,nreal=$nreal_q, - iscater=1,igrads=1,levcard='alllev',intv=$hint,subtype='${subtype}',isubtype=${subtype}, -/ -EOF - elif [ "$mtype" = 'q120' ]; then - rm -f diag2grads - cp ${EXECcmon}/grads_mandlev.x ./diag2grads - cat <input - &input - intype=' q',stype='${mtype}',itype=$ctype,nreal=$nreal_q, - iscater=1,igrads=1,subtype='${subtype}',isubtype=${subtype}, -/ -EOF - elif [ "$mtype" = 'q180' -o "$mtype" = 'q181' -o "$mtype" = 'q182' -o "$mtype" = 'q183' -o "$mtype" = 'q187' ]; then - rm -f diag2grads - cp ${EXECcmon}/grads_sfctime.x ./diag2grads - cat <input - &input - intype=' q',stype='${mtype}',itype=$ctype,nreal=$nreal_q, - iscater=1,igrads=1,timecard='time11',subtype='${subtype}',isubtype=${subtype}, -/ -EOF - - fi - - ./diag2grads stdout 2>&1 - - -############################################## -# Create the nt file, rename stdout, move nt, -# grads, and scatter files to $TANDIR_cmon -############################################## -ntline=`tail -n1 stdout` -nt=`echo ${ntline} | sed 's/^ *//g' | sed 's/ *$//g'` -if [ ${#nt} = 1 ]; then - ntfile="nt_${mtype}_${subtype}.${PDATE}" - echo ${nt} > ${ntfile} - cp ${ntfile} ${TANKDIR_cmon}/horz_hist/${cycle}/. -fi - - rm -f *tmp - mv stdout stdout_diag2grads_${mtype}_${subtype}.${cycle} - - dest_dir="${TANKDIR_cmon}/horz_hist/${cycle}" - - for file in q*grads; do - mv ${file} ${dest_dir}/${file}.${PDATE} - done - - for file in q*scater; do - mv ${file} ${dest_dir}/${file}.${PDATE} - done - - -echo "<-- diag2grad_q_case.sh" - -exit diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/ush/diag2grad_uv_case.sh b/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/ush/diag2grad_uv_case.sh deleted file mode 100755 index 5a81a62318..0000000000 --- a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/ush/diag2grad_uv_case.sh +++ /dev/null @@ -1,160 +0,0 @@ -#!/bin/sh -set -xa - -#---------------------------------------------------------- -# -# diag2grad_uv_case.sh -# -#---------------------------------------------------------- - -echo "--> diag2grad_uv_case.sh" - -#uv230_card=alllev -#uv231_card=alllev -#uv232_card=alllev -#uv233_card=alllev -#uv242_card=alllev -#uv243_card=allev -#uv245_card=upair -#uv246_card=upair -#uv252_card=upair -#uv253_card=acft -#uv257_card=acft -#uv258_card=upair -#uv221_card=acft - -card=alllev - -nreal_uv=$nreal -nreal2_uv=`expr $nreal - 2` -echo "nreal2_uv = ", ${nreal2_uv} -echo "mtype = ", ${mtype} - -ctype=`echo ${mtype} | cut -c3-5` - -if [ "$mtype" = 'uv221' -o "$mtype" = 'uv224' -o "$mtype" = 'uv229' -o "$mtype" = 'uv230' -o "$mtype" = 'uv231' -o "$mtype" = 'uv232' -o "$mtype" = 'uv233' -o "$mtype" = 'uv234' -o "$mtype" = 'uv235' -o "$mtype" = 'uv242' -o "$mtype" = 'uv243' -o "$mtype" = 'uv245' -o "$mtype" = 'uv246' -o "$mtype" = 'uv247' -o "$mtype" = 'uv248' -o "$mtype" = 'uv249' -o "$mtype" = 'uv250' -o "$mtype" = 'uv251' -o "$mtype" = 'uv252' -o "$mtype" = 'uv253' -o "$mtype" = 'uv254' -o "$mtype" = 'uv255' -o "$mtype" = 'uv256' -o "$mtype" = 'uv257' -o "$mtype" = 'uv258' ]; then - - echo "IN if condition 1, using GRADS_LEV.X" - rm -f diag2grads - cp ${EXECcmon}/grads_lev.x ./diag2grads - - echo "INPUTS to grads_lev.x = " - echo "intype = uv" - echo "stype = ", ${mtype} - echo "itype = ", ${ctype} - echo "nreal = ", ${nreal_uv} - echo "nreal2 = ", ${nreal2_uv} - echo "iscater = 1" - echo "igrads = 1" - echo "levcard = ", ${card} - echo "intv = ", ${hint} - echo "subtype = ", ${subtype} - echo "isubtype = ", ${subtype} - - rm -f input - cat <input - &input - intype=' uv',stype='${mtype}',itype=$ctype,nreal=$nreal_uv, - iscater=1,igrads=1,levcard='$card',intv=$hint,subtype='${subtype}',isubtype=${subtype}, -/ -EOF - -elif [ "$mtype" = 'uv223' -o "$mtype" = 'uv224' -o "$mtype" = 'uv228' ]; then - echo "IN if condition 2, using GRADS_SIG.X" - - rm -f diag2grads - cp ${EXECcmon}/grads_sig.x ./diag2grads - rm -f input - - echo "9 inputs to grads_sig.x = " - echo "intype = uv" - echo "stype = ", ${mtype} - echo "itype = ", ${ctype} - echo "nreal = ", ${nreal_uv} - echo "nreal2 = ", ${nreal2_uv} - echo "iscater = 1" - echo "igrads = 1" - echo "subtype = ", ${subtype} - echo "isubtype = ", ${subtype} - - cat <input - &input - intype=' uv',stype='${mtype}',itype=$ctype,nreal=$nreal_uv, - iscater=1,igrads=1,subtype='${subtype}',isubtype=${subtype}, -/ -EOF - -elif [ "$mtype" = 'uv220' ]; then - echo "IN if condition 3, using GRADS_MANDLEV.X" - - rm -f diag2grads - cp ${EXECcmon}/grads_mandlev.x ./diag2grads - rm -f input - cat <input - &input - intype=' uv',stype='${mtype}',itype=$ctype,nreal=$nreal_uv, - iscater=1,igrads=1,subtype='${subtype}',isubtype=${subtype}, -/ -EOF - -elif [ "$mtype" = 'uv280' -o "$mtype" = 'uv281' -o "$mtype" = 'uv282' -o "$mtype" = 'uv284' -o "$mtype" = 'uv287' ]; then - echo "IN if condition 4, using GRADS_SFCTIME.X" - - rm -f diag2grads - cp ${EXECcmon}/grads_sfctime.x ./diag2grads - rm -f input - cat <input - &input - intype=' uv',stype='${mtype}',itype=$ctype,nreal=$nreal_uv, - iscater=1,igrads=1,timecard='time11',subtype='${subtype}',isubtype=${subtype}, -/ -EOF - -elif [ "$mtype" = 'uv229' ]; then - echo "IN if condition 5, using GRADS_SFCTIME.X" - rm -f diag2grads - cp ${EXECcmon}/grads_sfctime.x ./diag2grads - rm -f input - cat <input - &input - intype=' uv',stype='${mtype}',itype=$ctype,nreal=$nreal_uv, - iscater=1,igrads=1,timecard='time7',subtype='${subtype}',isubtype=${subtype}, -/ -EOF - - -fi - -./diag2grads stdout 2>&1 - -############################################## -# Create the nt file, rename stdout, move nt, -# grads, and scatter files to $TANDIR_cmon -############################################## -ntline=`tail -n1 stdout` -nt=`echo ${ntline} | sed 's/^ *//g' | sed 's/ *$//g'` -if [ ${#nt} = 1 ]; then - ntfile="nt_${mtype}_${subtype}.${PDATE}" - echo ${nt} > ${ntfile} - cp ${ntfile} ${TANKDIR_cmon}/horz_hist/${cycle}/. -fi - -rm -f *tmp -mv stdout stdout_diag2grads_${mtype}_${subtype}.${cycle} - -dest_dir="${TANKDIR_cmon}/horz_hist/${cycle}" - -grads_list=`ls uv*grads` -for file in $grads_list; do - mv ${file} ${dest_dir}/${file}.${PDATE} -done - -scatter_list=`ls uv*scater` -for file in $scatter_list; do - mv ${file} ${dest_dir}/${file}.${PDATE} -done - - -echo "<-- diag2grad_uv_case.sh" - -exit diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/ush/horz_hist.sh b/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/ush/horz_hist.sh deleted file mode 100755 index 9bc87a2cef..0000000000 --- a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/ush/horz_hist.sh +++ /dev/null @@ -1,86 +0,0 @@ -#!/bin/sh - -#------------------------------------------------------------------ -# -# horz_hist.sh -# -#------------------------------------------------------------------ - - set -ax - - echo "--> horz_hist.sh" - date - rc=0 - - echo "CMON_SUFFIX = $CMON_SUFFIX" - export hint=10 ##(mb) the plot pressure interval press+-hint - - #---------------------------------------------------------- - # The list of data type, based on convinfo.txt file - #---------------------------------------------------------- -# ps_TYPE=" ps120_00 ps180_00 ps181_00 ps183_00 ps187_00 " - ps_TYPE=`${USHcmon}/get_typelist.pl --file $convinfo --type ps --mon` - -# q_TYPE=" q120_00 q130_00 q132_00 q133_00 q134_00 q135_00 q180_00 q181_00 q183_00 q187_00 " - q_TYPE=`${USHcmon}/get_typelist.pl --file $convinfo --type q --mon` - -# t_TYPE=" t120_00 t130_00 t131_00 t132_00 t133_00 t134_00 t135_00 t180_00 t181_00 t183_00 t187_00 " - t_TYPE=`${USHcmon}/get_typelist.pl --file $convinfo --type t --mon` - -# uv_TYPE=" uv220_00 uv221_00 uv223_00 uv224_00 uv228_00 uv229_00 uv230_00 uv231_00 uv232_00 uv233_00 uv234_00 uv235_00 uv242_00 uv243_00 uv243_55 uv243_56 uv245_257 uv245_259 uv245_270 uv246_257 uv246_259 uv246_270 uv247_257 uv247_259 uv247_270 uv248_00 uv249_00 uv250_00 uv251_00 uv252_00 uv253_00 uv253_55 uv253_56 uv254_00 uv254_55 uv254_56 uv255_00 uv256_00 uv257_00 uv258_00 uv280_00 uv281_00 uv282_00 uv284_00 uv287_00" - - uv_TYPE=`${USHcmon}/get_typelist.pl --file $convinfo --type uv --mon` -# echo "uv_TYPE = $uv_TYPE" - - - echo TANKDIR_cmon = $TANKDIR_cmon - - mkdir -p ${TANKDIR_cmon}/horz_hist/ges - mkdir -p ${TANKDIR_cmon}/horz_hist/anl - - export nreal_ps=${nreal_ps:-19} - export nreal_q=${nreal_q:-20} - export nreal_t=${nreal_t:-24} - export nreal_uv=${nreal_uv:-23} - - - for type in ps q t uv; do - - eval stype=\${${type}_TYPE} - eval nreal=\${nreal_${type}} - exec=read_${type} - - #--------------------------------- - # decoding the dignostic file - #--------------------------------- - - for dtype in ${stype}; do - - mtype=`echo ${dtype} | cut -f1 -d_ | xargs` - subtype=`echo ${dtype} | cut -f2 -d_ | xargs` - - if [[ "$VERBOSE" = "YES" ]]; then - echo "DEBUG: dtype = $dtype" - echo "mtype, subtype = $mtype, $subtype" - fi - - for cycle in ges anl; do - cp ./diag_conv_${cycle}.${PDATE} ./conv_diag # this appears to be unneeded? - - if [[ "$VERBOSE" = "YES" ]]; then - echo "cycle = $cycle" - fi - - ${USHcmon}/diag2grad_${type}_case.sh - - done #### done with cycle - - done ### done with dtype - - done ### done with type - - -echo "<-- horz_hist.sh" - -exit ${rc} - diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/ush/time_vert.sh b/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/ush/time_vert.sh deleted file mode 100755 index b92660f1d5..0000000000 --- a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/ush/time_vert.sh +++ /dev/null @@ -1,88 +0,0 @@ -#!/bin/sh -set -xa - -#---------------------------------------------------- -# This script performs the data extraction for the -# the time and vertical profile plots. -# -# time_vert.sh -# -#---------------------------------------------------- - -echo "--> time_vert.sh" - -echo " $CWD" - -rc=0 -export nregion=10 - -#------------------------------------------ -# set up TANKDIR (output) sub-directories -# -echo TANKDIR_cmon = $TANKDIR_cmon -export savedir=$TANKDIR_cmon/time_vert -mkdir -p ${savedir} - - -echo "convinfo = $convinfo" # defined in calling script -cp ${convinfo} ./convinfo - -export execfile=${EXECcmon}/conv_time.x -cp ${execfile} ./execfile - -export CYA=`echo $PDATE | cut -c9-10` - - -hour=`echo $PDATE | cut -c9-10` -dday=`echo $PDATE | cut -c7-8` - - -for cycle in ges anl;do - echo " cycle = $cycle " - - rm -f ./conv_diag - ln -s ./diag_conv_${cycle}.${PDATE} conv_diag - - cat << EOF > input -&input - filein='conv_diag', nregion=${nregion}, - region(1)='GL', rlonmin(1)=-180.0,rlonmax(1)=180.0,rlatmin(1)=-90.0,rlatmax(1)= 90.0, - region(2)='NH',rlonmin(2)=-180.0,rlonmax(2)=180.0,rlatmin(2)= 20.0,rlatmax(2)= 90.0, - region(3)='SH',rlonmin(3)=-180.0,rlonmax(3)=180.0,rlatmin(3)=-90.0,rlatmax(3)=-20.0, - region(4)='TR' rlonmin(4)=-180.0,rlonmax(4)=180.0,rlatmin(4)=-20.0,rlatmax(4)= 20.0, - region(5)='USA' , rlonmin(5)=-125.0,rlonmax(5)=-65.0,rlatmin(5)=25.0,rlatmax(5)=50.0, - region(6)='CAN', rlonmin(6)=-125.0,rlonmax(6)=-65.0,rlatmin(6)= 50.0,rlatmax(6)= 90.0, - region(7)='N&CA',rlonmin(7)=-165.0,rlonmax(7)=-60.0,rlatmin(7)= 0.0,rlatmax(7)=90.0, - region(8)='S&CA',rlonmin(8)=-165.0,rlonmax(8)=-30.0,rlatmin(8)=-90.0, rlatmax(8)=0.0, - region(9)='EU', rlonmin(9)=-10.0, rlonmax(9)=25.0, rlatmin(9)=35.0,rlatmax(9)=70.0, - region(10)='AS', rlonmin(10)=65.0, rlonmax(10)=145.0,rlatmin(10)=5.0,rlatmax(10)=45.0, -/ -EOF - - - ./execfile ${cycle}_stdout 2>&1 - - echo " after execfile completed " - - - cp uv_stas.ctl u_stas.ctl - cp uv_stas.ctl v_stas.ctl - - for type in ps t q uv u v; do - - for file2 in ${type}*stas; do - mv -f $file2 ${savedir}/${cycle}_${file2}.${PDATE} - done - - for file3 in ${type}*stas.ctl; do - mv -f ${file3} ${savedir}/${cycle}_${file3} - done - - done - -done - - -echo "<-- time_vert.sh" - -exit ${rc} diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/exec/.gitignore b/util/Conventional_Monitor/nwprod/conmon_shared/exec/.gitignore similarity index 100% rename from util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/exec/.gitignore rename to util/Conventional_Monitor/nwprod/conmon_shared/exec/.gitignore diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/modulefiles/cray/CMonBuild b/util/Conventional_Monitor/nwprod/conmon_shared/modulefiles/cray/CMonBuild similarity index 100% rename from util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/modulefiles/cray/CMonBuild rename to util/Conventional_Monitor/nwprod/conmon_shared/modulefiles/cray/CMonBuild diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/modulefiles/theia/CMonBuild b/util/Conventional_Monitor/nwprod/conmon_shared/modulefiles/theia/CMonBuild similarity index 100% rename from util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/modulefiles/theia/CMonBuild rename to util/Conventional_Monitor/nwprod/conmon_shared/modulefiles/theia/CMonBuild diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/modulefiles/wcoss/CMonBuild b/util/Conventional_Monitor/nwprod/conmon_shared/modulefiles/wcoss/CMonBuild similarity index 100% rename from util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/modulefiles/wcoss/CMonBuild rename to util/Conventional_Monitor/nwprod/conmon_shared/modulefiles/wcoss/CMonBuild diff --git a/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_lev.fd/CMakeLists.txt b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_lev.fd/CMakeLists.txt new file mode 100644 index 0000000000..4dd79690f4 --- /dev/null +++ b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_lev.fd/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.6) + file(GLOB CONMON_GRADS_LEV_SRC ${CMAKE_CURRENT_SOURCE_DIR}/*90 ) + set(CONMON_GRADS_LEV_Fortran_FLAGS "-fp-model strict -assume byterecl -convert big_endian -O3 -traceback -D_REAL8_ ") + set(Util_MODULE_DIR ${PROJECT_BINARY_DIR}/include/conmon_grads_lev ) + + set_source_files_properties( ${CONMON_GRADS_LEV_SRC} PROPERTIES COMPILE_FLAGS ${CONMON_GRADS_LEV_Fortran_FLAGS} ) + add_executable(conmon_grads_lev.x ${CONMON_GRADS_LEV_SRC} ) + set_target_properties( conmon_grads_lev.x PROPERTIES COMPILE_FLAGS ${CONMON_GRADS_LEV_Fortran_FLAGS} ) + set_target_properties( conmon_grads_lev.x PROPERTIES Fortran_MODULE_DIRECTORY ${Util_MODULE_DIR} ) + + include_directories( ${CORE_INCS} ${NCDIAG_INCS} ) + + target_link_libraries( conmon_grads_lev.x ${W3NCO_4_LIBRARY} ${NCDIAG_LIBRARIES} ${NETCDF_Fortran_LIBRARIES} + ${NETCDF_C_LIBRARIES} ${MPI_Fortran_LIBRARIES} ) + + if(BUILD_W3NCO) + add_dependencies( conmon_grads_lev.x ${W3NCO_4_LIBRARY} ) + endif() + diff --git a/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_lev.fd/cnv_file_info b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_lev.fd/cnv_file_info new file mode 100644 index 0000000000..78b3cc4a03 --- /dev/null +++ b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_lev.fd/cnv_file_info @@ -0,0 +1,35 @@ +netcdf diag_conv_gps_anl.2020040506 { +dimensions: + nobs = UNLIMITED ; // (353443 currently) + Station_ID_maxstrlen = 8 ; + Observation_Class_maxstrlen = 7 ; +variables: + char Station_ID(nobs, Station_ID_maxstrlen) ; + char Observation_Class(nobs, Observation_Class_maxstrlen) ; + int Observation_Type(nobs) ; + int Observation_Subtype(nobs) ; + float Latitude(nobs) ; + float Longitude(nobs) ; + float Incremental_Bending_Angle(nobs) ; + float Pressure(nobs) ; + float Height(nobs) ; + float Time(nobs) ; + float Model_Elevation(nobs) ; + float Setup_QC_Mark(nobs) ; + float Prep_Use_Flag(nobs) ; + float Analysis_Use_Flag(nobs) ; + float Nonlinear_QC_Rel_Wgt(nobs) ; + float Errinv_Input(nobs) ; + float Errinv_Adjust(nobs) ; + float Errinv_Final(nobs) ; + float Observation(nobs) ; + float Obs_Minus_Forecast_adjusted(nobs) ; + float Obs_Minus_Forecast_unadjusted(nobs) ; + float GPS_Type(nobs) ; + float Temperature_at_Obs_Location(nobs) ; + float Specific_Humidity_at_Obs_Location(nobs) ; + +// global attributes: + :date_time = 2020040506 ; +} + diff --git a/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_lev.fd/conmon_read_diag.F90 b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_lev.fd/conmon_read_diag.F90 new file mode 100644 index 0000000000..0b7afcf067 --- /dev/null +++ b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_lev.fd/conmon_read_diag.F90 @@ -0,0 +1,1839 @@ +!---------------------------------------------------------------------- +! conmon_read_diag +! +! This subroutine reads the conventional data assimilation +! diagnostic files (contained in the cnvstat tar file) and returns +! the requested obs that match the input type and subtype in a +! linked list. The diagnostic files may be in either binary or +! NetCDF format. +! +! Note: +! There are problems/mismatches between the contents of binary +! and NetCDF files for types gps and sst. +!---------------------------------------------------------------------- + +module conmon_read_diag + + !--- use ---! + use generic_list + use data + use kinds, only: i_kind,r_single,r_kind + + use nc_diag_read_mod, only: nc_diag_read_init, nc_diag_read_close, & + nc_diag_read_get_dim, nc_diag_read_get_global_attr, & + nc_diag_read_get_var_names, & + nc_diag_read_get_global_attr_names, & + nc_diag_read_get_var, nc_diag_read_get_dim_names + + use ncdr_vars, only: nc_diag_read_check_var + use ncdr_dims, only: nc_diag_read_check_dim + + + !--- implicit ---! + implicit none + + + !--- public & private ---! + private + + public :: set_netcdf_read + public :: conmon_read_diag_file + public :: conmon_return_all_obs + + interface load_nc_var + module procedure load_nc_var_int, load_nc_var_real, load_nc_var_char + end interface + + + !--- common data structures ---! + logical,save :: netcdf = .false. + + integer(i_kind), parameter :: MAX_OPEN_NCDIAG = 2 + integer(i_kind), save :: nopen_ncdiag = 0 + integer(i_kind), dimension(MAX_OPEN_NCDIAG), save :: ncdiag_open_id = (/-1, -1/) + + type ncdiag_status + logical :: nc_read + integer(i_kind) :: cur_ob_idx + integer(i_kind) :: num_records + end type ncdiag_status + + type(ncdiag_status), dimension(MAX_OPEN_NCDIAG), save :: ncdiag_open_status + + + + contains + + + subroutine load_nc_var_int( var_name, ftin, var_storage, ierr ) + character(len=*), intent(in) :: var_name + integer, intent(in) :: ftin + integer, dimension(:), allocatable, intent(out) :: var_storage + integer, intent(out) :: ierr + + if( nc_diag_read_check_var( var_name )) then + call nc_diag_read_get_var( ftin, var_name, var_storage ) + ierr = 0 + else + print *, 'WARNING: unable to read ', trim( var_name ) + ierr = 1 + end if + end subroutine + + + subroutine load_nc_var_real( var_name, ftin, var_storage, ierr ) + character(len=*), intent(in) :: var_name + integer, intent(in) :: ftin + real(r_single), dimension(:), allocatable, intent(out) :: var_storage + integer, intent(out) :: ierr + + if( nc_diag_read_check_var( var_name )) then + call nc_diag_read_get_var( ftin, var_name, var_storage ) + ierr=0 + else + print *, 'WARNING: unable to read ', trim( var_name ) + ierr=1 + end if + end subroutine + + + subroutine load_nc_var_char( var_name, ftin, var_storage, ierr ) + character(len=*), intent(in) :: var_name + integer, intent(in) :: ftin + character(len=:), dimension(:), allocatable, intent(out) :: var_storage + integer, intent(out) :: ierr + + if( nc_diag_read_check_var( var_name )) then + call nc_diag_read_get_var( ftin, var_name, var_storage ) + ierr=0 + else + print *, 'WARNING: unable to read ', trim( var_name ) + ierr=1 + end if + end subroutine + + + + !------------------------------------------------------------ + ! set_netcdf_read + ! + ! set the use_netcdf flag to signal binary (default) or + ! netcdf formatted diagnostic files. + !------------------------------------------------------------ + subroutine set_netcdf_read( use_netcdf ) + logical,intent(in) :: use_netcdf + + netcdf = use_netcdf + + end subroutine set_netcdf_read + + + + !--------------------------------------------------------------- + ! conmon_read_diag_file + ! + ! Public routine to read a conventional diagnostic file + ! + ! Obs in the input_file are returned in the list according + ! to these rules: + ! + ! 1. All obs matching intype and in_subtype are returned. + ! + ! 2. If there are no subtype values in the input_file then + ! all obs matching intype are returned. + ! + !--------------------------------------------------------------- + subroutine conmon_read_diag_file( input_file, ctype, intype, expected_nreal, nobs, in_subtype, list ) + + !--- interface + character(100), intent(in) :: input_file + character(3), intent(in) :: ctype + + !--- note expected_nreal has no meaning for netcdf files + integer, intent(in) :: intype, expected_nreal, in_subtype + integer, intent(out) :: nobs + type(list_node_t), pointer :: list + logical :: return_all = .false. + + write(6,*)'--> conmon_read_diag_file' + + if ( netcdf ) then + write(6,*) ' call nc read subroutine' + call read_diag_file_nc( input_file, return_all, ctype, intype, expected_nreal, nobs, in_subtype, list ) + else + call read_diag_file_bin( input_file,return_all, ctype, intype, expected_nreal,nobs,in_subtype, list ) + end if + + write(6,*)"<-- conmon_read_diag_file" + + end subroutine conmon_read_diag_file + + + + !------------------------------------------------------------------ + ! conmon_return_all_obs + ! + ! Retrieve all obs from a given conventional diagnostic file. + ! Note that the NetCDF formatted diag files always contain only + ! one conventional data type (gps, ps, q, sst, t, uv), while + ! binary formatted diag files contain all types for a single + ! ges or anl run. + ! + ! Note: the ctype parameter only has meaning for NetCDF + ! formatted diag files. + !------------------------------------------------------------------ + subroutine conmon_return_all_obs( input_file, ctype, nobs, list ) + + !--- interface + character(100), intent(in) :: input_file + character(3), intent(in) :: ctype + integer, intent(out) :: nobs + type(list_node_t), pointer :: list + + logical :: return_all = .true. + integer :: intype, expected_nreal, in_subtype + + write(6,*)'--> conmon_return_all_obs' + nobs = 0 + + ! + ! Q: Can I re-use the read_diag_* to do this read, + ! adding extra param(s) to switch on _all_ obs? + ! Those routines are private to this module so + ! that wouldn't pose a complexity problem for + ! accessing the routines. + ! + if ( netcdf ) then + write(6,*) ' call nc retrieve all routine' + call read_diag_file_nc( input_file, return_all, ctype, intype, expected_nreal, nobs, in_subtype, list ) + else + write(6,*) ' call bin retrieve all routine' + call read_diag_file_bin( input_file,return_all, ctype, intype, expected_nreal,nobs,in_subtype, list ) + end if + + write(6,*)'<-- conmon_return_all_obs' + + end subroutine conmon_return_all_obs + + + !------------------------------- + ! read_diag_file_nc + ! + ! NetCDF read routine + !------------------------------- + subroutine read_diag_file_nc( input_file, return_all, ctype, intype, expected_nreal, nobs, in_subtype, list ) + + !--- interface + character(100), intent(in) :: input_file + logical, intent(in) :: return_all + character(3), intent(in) :: ctype + integer, intent(in) :: intype, expected_nreal, in_subtype + integer, intent(out) :: nobs + type(list_node_t), pointer :: list + + !--- local vars + type(list_node_t), pointer :: next => null() + type(data_ptr) :: ptr + integer :: ii, ierr, istatus, ftin, total_obs, id, idx + + data ftin / 11 / + + + print *, ' ' + print *, ' --> read_diag_file_nc' + print *, ' ctype, intype, in_subtype = ', ctype, intype, in_subtype + nobs = 0 + ierr = 0 + + if (nopen_ncdiag >= MAX_OPEN_NCDIAG) then + write(6,*) 'OPEN_RADIAG: ***ERROR*** Cannot open more than ', & + MAX_OPEN_NCDIAG, ' netcdf diag files.' + endif + + call nc_diag_read_init( input_file, ftin ) + istatus=0 + + do ii = 1, MAX_OPEN_NCDIAG + + if( ncdiag_open_id(ii) < 0 ) then + ncdiag_open_id(ii) = ftin + ncdiag_open_status(ii)%nc_read = .false. + + ncdiag_open_status(ii)%cur_ob_idx = -9999 + ncdiag_open_status(ii)%num_records = -9999 + nopen_ncdiag = nopen_ncdiag + 1 + exit + endif + + enddo + + select case ( trim( adjustl( ctype ) ) ) + + case ( 'gps' ) + call read_diag_file_gps_nc( input_file, return_all, ftin, ctype, intype, expected_nreal, nobs, in_subtype, list ) + + case ( 'ps' ) + call read_diag_file_ps_nc( input_file, return_all, ftin, ctype, intype, expected_nreal, nobs, in_subtype, list ) + + case ( 'q' ) + call read_diag_file_q_nc( input_file, return_all, ftin, ctype, intype, expected_nreal, nobs, in_subtype, list ) + + case ( 'sst' ) + call read_diag_file_sst_nc( input_file, return_all, ftin, ctype, intype, expected_nreal, nobs, in_subtype, list ) + + case ( 't' ) + call read_diag_file_t_nc( input_file, return_all, ftin, ctype, intype, expected_nreal, nobs, in_subtype, list ) + + case ( 'uv' ) + call read_diag_file_uv_nc( input_file, return_all, ftin, ctype, intype, expected_nreal, nobs, in_subtype, list ) + + case default + print *, 'ERROR: unmatched ctype :', ctype + + end select + + + id = find_ncdiag_id(ftin) + if (id < 0) then + write(6,*) 'CLOSE_RADIAG: ***ERROR*** ncdiag file ', input_file, & + ' was not opened' + endif + + call nc_diag_read_close( input_file ) + ncdiag_open_id(id) = -1 + + ncdiag_open_status(id)%nc_read = .false. + ncdiag_open_status(id)%cur_ob_idx = -9999 + ncdiag_open_status(id)%num_records = -9999 + + nopen_ncdiag = nopen_ncdiag - 1 + + print *, ' ' + print *, ' <-- read_diag_file_nc, ierr = ', ierr + + + end subroutine read_diag_file_nc + + + !--------------------------------------------------------- + ! netcdf read routine for ps data types in netcdf files + ! + subroutine read_diag_file_ps_nc( input_file, return_all, ftin, ctype, intype,expected_nreal,nobs,in_subtype, list ) + + !--- interface + character(100), intent(in) :: input_file + logical, intent(in) :: return_all + integer, intent(in) :: ftin + character(3), intent(in) :: ctype + integer, intent(in) :: intype, expected_nreal, in_subtype + integer, intent(out) :: nobs + type(list_node_t), pointer :: list + + !--- local vars + type(list_node_t), pointer :: next => null() + type(data_ptr) :: ptr + integer :: ii, ierr, istatus, total_obs, idx + logical :: have_subtype = .true. + logical :: add_obs + + !--- NetCDF file components dimension(s) + ! + character(len=:), dimension(:), allocatable :: Station_ID ! (nobs, Station_ID_maxstrlen) + character(len=:), dimension(:), allocatable :: Observation_Class ! (nobs, Station_Class_maxstrlen) + integer, dimension(:), allocatable :: Observation_Type ! (obs) + integer, dimension(:), allocatable :: Observation_Subtype ! (obs) + real(r_single), dimension(:), allocatable :: Latitude ! (obs) + real(r_single), dimension(:), allocatable :: Longitude ! (obs) + real(r_single), dimension(:), allocatable :: Station_Elevation ! (obs) + real(r_single), dimension(:), allocatable :: Pressure ! (obs) + real(r_single), dimension(:), allocatable :: Height ! (obs) + real(r_single), dimension(:), allocatable :: Time ! (obs) + real(r_single), dimension(:), allocatable :: Prep_QC_Mark ! (obs) + real(r_single), dimension(:), allocatable :: Prep_Use_Flag ! (obs) + real(r_single), dimension(:), allocatable :: Nonlinear_QC_Var_Jb ! (obs) + real(r_single), dimension(:), allocatable :: Nonlinear_QC_Rel_Wgt ! (obs) + real(r_single), dimension(:), allocatable :: Analysis_Use_Flag ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Input ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Adjust ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Final ! (obs) + real(r_single), dimension(:), allocatable :: Observation ! (obs) + real(r_single), dimension(:), allocatable :: Obs_Minus_Forecast_adjusted ! (obs) + real(r_single), dimension(:), allocatable :: Obs_Minus_Forecast_unadjusted ! (obs) + integer(i_kind) :: idate + + print *, ' ' + print *, ' --> read_diag_file_ps_nc' + + + !--- get NetCDF file dimensions + ! + if( nc_diag_read_check_dim( 'nobs' )) then + total_obs = nc_diag_read_get_dim(ftin,'nobs') + ncdiag_open_status(ii)%num_records = total_obs + print *, ' total_obs = ', total_obs + else + print *, 'ERROR: unable to read nobs' + ierr=1 + end if + + + !--- get vars + + call load_nc_var( 'Station_ID', ftin, Station_ID, ierr ) + call load_nc_var( 'Observation_Class', ftin, Observation_Class, ierr ) + call load_nc_var( 'Observation_Type', ftin, Observation_Type, ierr ) + call load_nc_var( 'Observation_Subtype', ftin, Observation_Subtype, ierr ) + if( ierr == 1 ) then + have_subtype = .false. + end if + call load_nc_var( 'Latitude', ftin, Latitude, ierr ) + call load_nc_var( 'Longitude', ftin, Longitude, ierr ) + call load_nc_var( 'Station_Elevation', ftin, Station_Elevation, ierr ) + call load_nc_var( 'Pressure', ftin, Pressure, ierr ) + call load_nc_var( 'Height', ftin, Height, ierr ) + call load_nc_var( 'Time', ftin, Time, ierr ) + call load_nc_var( 'Prep_QC_Mark', ftin, Prep_QC_Mark, ierr ) + call load_nc_var( 'Nonlinear_QC_Var_Jb', ftin, Nonlinear_QC_Var_Jb, ierr ) + call load_nc_var( 'Nonlinear_QC_Rel_Wgt', ftin, Nonlinear_QC_Rel_Wgt, ierr ) + call load_nc_var( 'Prep_Use_Flag', ftin, Prep_Use_Flag, ierr ) + call load_nc_var( 'Analysis_Use_Flag', ftin, Analysis_Use_Flag, ierr ) + call load_nc_var( 'Errinv_Input', ftin, Errinv_Input, ierr ) + call load_nc_var( 'Errinv_Adjust', ftin, Errinv_Adjust, ierr ) + call load_nc_var( 'Errinv_Final', ftin, Errinv_Final, ierr ) + call load_nc_var( 'Observation', ftin, Observation, ierr ) + call load_nc_var( 'Obs_Minus_Forecast_adjusted', ftin, Obs_Minus_Forecast_adjusted, ierr ) + call load_nc_var( 'Obs_Minus_Forecast_unadjusted', ftin, Obs_Minus_Forecast_unadjusted, ierr ) + + + + !--------------------------------------------------------------- + ! Process all obs. If type and subtype match the input values + ! add this obs to the linked list (ptr%p). + ! + nobs = 0 + do ii = 1, total_obs + + + add_obs = .false. + + !------------------------------------------------------------------------ + ! Check on Observation_Class to ctype is a sanity check -- + ! only a single class of obs are in any given NetCDF formatted diag file + ! but, if the ctype and input file don't match, things could get + ! interesting (but not in a good way). + ! + if( adjustl( trim( Observation_Class(ii) )) == adjustl( trim( ctype ))) then + + if( return_all == .true. ) then + add_obs = .true. + + else if( Observation_Type(ii) == intype ) then + + if( have_subtype == .false. ) then + add_obs = .true. + else if( Observation_Subtype(ii) == in_subtype ) then + add_obs = .true. + end if + + end if + end if + + if( add_obs == .true. ) then + + nobs=nobs+1 + + !--------------------------------------------- + ! Allocate a new data element and load + ! + allocate( ptr%p ) + ptr%p%stn_id = Station_ID( ii ) + + do idx=1,max_rdiag_reals + ptr%p%rdiag( idx ) = 0.00 + end do + + if( allocated( Observation_Type )) ptr%p%rdiag( idx_obs_type_ps ) = Observation_Type( ii ) + if( allocated( Observation_Subtype )) ptr%p%rdiag( idx_obs_subtype_ps ) = Observation_Subtype( ii ) + if( allocated( Latitude )) ptr%p%rdiag( idx_obs_lat_ps ) = Latitude( ii ) + if( allocated( Longitude )) ptr%p%rdiag( idx_obs_lon_ps ) = Longitude( ii ) + if( allocated( Station_Elevation )) ptr%p%rdiag( idx_stn_elev_ps ) = Station_Elevation( ii ) + if( allocated( Pressure )) ptr%p%rdiag( idx_pres_ps ) = Pressure( ii ) + if( allocated( Height )) ptr%p%rdiag( idx_hgt_ps ) = Height( ii ) + if( allocated( Time )) ptr%p%rdiag( idx_time_ps ) = Time( ii ) + if( allocated( Prep_QC_Mark )) ptr%p%rdiag( idx_iqc_ps ) = Prep_QC_Mark( ii ) + if( allocated( Nonlinear_QC_Var_Jb )) ptr%p%rdiag( idx_var_jb_ps ) = Nonlinear_QC_Var_Jb( ii ) + if( allocated( Prep_Use_Flag )) ptr%p%rdiag( idx_iuse_ps ) = Prep_Use_Flag( ii ) + if( allocated( Analysis_Use_Flag )) ptr%p%rdiag( idx_anl_use_ps ) = Analysis_Use_Flag( ii ) + if( allocated( Nonlinear_QC_Rel_Wgt )) ptr%p%rdiag( idx_rwgt_ps ) = Nonlinear_QC_Rel_Wgt( ii ) + if( allocated( Errinv_Input )) ptr%p%rdiag( idx_err_input_ps ) = Errinv_Input( ii ) + if( allocated( Errinv_Adjust )) ptr%p%rdiag( idx_errinv_ps ) = Errinv_Adjust( ii ) + if( allocated( Errinv_Final )) ptr%p%rdiag( idx_errinv_fnl_ps ) = Errinv_Final( ii ) + if( allocated( Observation )) ptr%p%rdiag( idx_obs_ps ) = Observation( ii ) + if( allocated( Obs_Minus_Forecast_adjusted )) ptr%p%rdiag( idx_obsmg_adj_ps ) = Obs_Minus_Forecast_adjusted( ii ) + if( allocated( Obs_Minus_Forecast_unadjusted )) ptr%p%rdiag( idx_obsmg_nadj_ps ) = Obs_Minus_Forecast_unadjusted( ii ) + + if( nobs == 1 ) then + !------------------------------------------------- + ! Initialize the list with the first data element + ! + call list_init(list, transfer(ptr, list_data)) + next => list + + else + !------------------------------------------------- + ! Insert subsequent nodes into the list + ! + call list_insert(next, transfer(ptr, list_data)) + next => list_next(next) + end if + + end if + + end do + + + if( allocated( Station_ID )) deallocate( Station_ID ) + if( allocated( Observation_Class )) deallocate( Observation_Class ) + if( allocated( Observation_Type )) deallocate( Observation_Type ) + if( allocated( Observation_Subtype )) deallocate( Observation_Subtype ) + if( allocated( Latitude )) deallocate( Latitude ) + if( allocated( Longitude )) deallocate( Longitude ) + if( allocated( Station_Elevation )) deallocate( Station_Elevation ) + if( allocated( Time )) deallocate( Time ) + if( allocated( Prep_QC_Mark )) deallocate( Prep_QC_Mark ) + if( allocated( Prep_Use_Flag )) deallocate( Prep_Use_Flag ) + if( allocated( Nonlinear_QC_Var_Jb )) deallocate( Nonlinear_QC_Var_Jb ) + if( allocated( Nonlinear_QC_Rel_Wgt )) deallocate( Nonlinear_QC_Rel_Wgt ) + if( allocated( Analysis_Use_Flag )) deallocate( Analysis_Use_Flag ) + if( allocated( Errinv_Input )) deallocate( Errinv_Input ) + if( allocated( Errinv_Adjust )) deallocate( Errinv_Final ) + if( allocated( Errinv_Final )) deallocate( Errinv_Final ) + if( allocated( Observation )) deallocate( Observation ) + if( allocated( Obs_Minus_Forecast_adjusted )) deallocate( Obs_Minus_Forecast_adjusted ) + if( allocated( Obs_Minus_Forecast_unadjusted )) deallocate( Obs_Minus_Forecast_unadjusted ) + + print *, ' ' + print *, ' <-- read_diag_file_ps_nc' + + end subroutine read_diag_file_ps_nc + + + !--------------------------------------------------------- + ! netcdf read routine for q data types in netcdf files + ! + subroutine read_diag_file_q_nc( input_file, return_all, ftin, ctype, intype,expected_nreal,nobs,in_subtype, list ) + + !--- interface + character(100), intent(in) :: input_file + logical, intent(in) :: return_all + integer, intent(in) :: ftin + character(3), intent(in) :: ctype + integer, intent(in) :: intype, expected_nreal, in_subtype + integer, intent(out) :: nobs + type(list_node_t), pointer :: list + + !--- local vars + type(list_node_t), pointer :: next => null() + type(data_ptr) :: ptr + integer :: ii, ierr, istatus, total_obs, idx + logical :: have_subtype = .true. + logical :: add_obs + + !--- NetCDF file components dimension(s) + ! + character(len=:), dimension(:), allocatable :: Station_ID ! (nobs, Station_ID_maxstrlen) + character(len=:), dimension(:), allocatable :: Observation_Class ! (nobs, Station_Class_maxstrlen) + integer, dimension(:), allocatable :: Observation_Type ! (obs) + integer, dimension(:), allocatable :: Observation_Subtype ! (obs) + real(r_single), dimension(:), allocatable :: Latitude ! (obs) + real(r_single), dimension(:), allocatable :: Longitude ! (obs) + real(r_single), dimension(:), allocatable :: Station_Elevation ! (obs) + real(r_single), dimension(:), allocatable :: Pressure ! (obs) + real(r_single), dimension(:), allocatable :: Height ! (obs) + real(r_single), dimension(:), allocatable :: Time ! (obs) + real(r_single), dimension(:), allocatable :: Prep_QC_Mark ! (obs) + real(r_single), dimension(:), allocatable :: Prep_Use_Flag ! (obs) + real(r_single), dimension(:), allocatable :: Nonlinear_QC_Var_Jb ! (obs) + real(r_single), dimension(:), allocatable :: Nonlinear_QC_Rel_Wgt ! (obs) + real(r_single), dimension(:), allocatable :: Analysis_Use_Flag ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Input ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Adjust ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Final ! (obs) + real(r_single), dimension(:), allocatable :: Observation ! (obs) + real(r_single), dimension(:), allocatable :: Obs_Minus_Forecast_adjusted ! (obs) + real(r_single), dimension(:), allocatable :: Obs_Minus_Forecast_unadjusted ! (obs) + real(r_single), dimension(:), allocatable :: Forecast_Saturation_Spec_Hum ! (obs) + integer(i_kind) :: idate + + print *, ' ' + print *, ' --> read_diag_file_q_nc' + + + !--- get NetCDF file dimensions + ! + if( nc_diag_read_check_dim( 'nobs' )) then + total_obs = nc_diag_read_get_dim(ftin,'nobs') + ncdiag_open_status(ii)%num_records = total_obs + print *, ' total_obs = ', total_obs + else + print *, 'ERROR: unable to read nobs' + ierr=1 + end if + + + !--- get vars + + call load_nc_var( 'Station_ID', ftin, Station_ID, ierr ) + call load_nc_var( 'Observation_Class', ftin, Observation_Class, ierr ) + call load_nc_var( 'Observation_Type', ftin, Observation_Type, ierr ) + call load_nc_var( 'Observation_Subtype', ftin, Observation_Subtype, ierr ) + if( ierr == 1 ) then + have_subtype = .false. + end if + call load_nc_var( 'Latitude', ftin, Latitude, ierr ) + call load_nc_var( 'Longitude', ftin, Longitude, ierr ) + call load_nc_var( 'Station_Elevation', ftin, Station_Elevation, ierr ) + call load_nc_var( 'Pressure', ftin, Pressure, ierr ) + call load_nc_var( 'Height', ftin, Height, ierr ) + call load_nc_var( 'Time', ftin, Time, ierr ) + call load_nc_var( 'Prep_QC_Mark', ftin, Prep_QC_Mark, ierr ) + call load_nc_var( 'Nonlinear_QC_Var_Jb', ftin, Nonlinear_QC_Var_Jb, ierr ) + call load_nc_var( 'Nonlinear_QC_Rel_Wgt', ftin, Nonlinear_QC_Rel_Wgt, ierr ) + call load_nc_var( 'Prep_Use_Flag', ftin, Prep_Use_Flag, ierr ) + call load_nc_var( 'Analysis_Use_Flag', ftin, Analysis_Use_Flag, ierr ) + call load_nc_var( 'Errinv_Input', ftin, Errinv_Input, ierr ) + call load_nc_var( 'Errinv_Adjust', ftin, Errinv_Adjust, ierr ) + call load_nc_var( 'Errinv_Final', ftin, Errinv_Final, ierr ) + call load_nc_var( 'Observation', ftin, Observation, ierr ) + call load_nc_var( 'Obs_Minus_Forecast_adjusted', ftin, Obs_Minus_Forecast_adjusted, ierr ) + call load_nc_var( 'Obs_Minus_Forecast_unadjusted', ftin, Obs_Minus_Forecast_unadjusted, ierr ) + call load_nc_var( 'Forecast_Saturation_Spec_Hum', ftin, Forecast_Saturation_Spec_Hum, ierr ) + + + + !--------------------------------------------------------------- + ! Process all obs. If type and subtype match the input values + ! add this obs to the linked list (ptr%p). + ! + nobs = 0 + do ii = 1, total_obs + + add_obs = .false. + + !------------------------------------------------------------------------ + ! Check on Observation_Class to ctype is a sanity check -- + ! only a single class of obs are in any given NetCDF formatted diag file + ! but, if the ctype and input file don't match, things could get + ! interesting (but not in a good way). + ! + if( adjustl( trim( Observation_Class(ii) )) == adjustl( trim( ctype ))) then + + if( return_all == .true. ) then + add_obs = .true. + + else if( Observation_Type(ii) == intype ) then + + if( have_subtype == .false. ) then + add_obs = .true. + else if( Observation_Subtype(ii) == in_subtype ) then + add_obs = .true. + end if + + end if + end if + + + if( add_obs == .true. ) then + + nobs=nobs+1 + + !--------------------------------------------- + ! Allocate a new data element and load + ! + allocate(ptr%p) + ptr%p%stn_id = Station_ID( ii ) + + do idx=1,max_rdiag_reals + ptr%p%rdiag( idx ) = 0.00 + end do + + if( allocated( Observation_Type )) ptr%p%rdiag( idx_obs_type_q ) = Observation_Type( ii ) + if( allocated( Observation_Subtype )) ptr%p%rdiag( idx_obs_subtype_q ) = Observation_Subtype( ii ) + if( allocated( Latitude )) ptr%p%rdiag( idx_obs_lat_q ) = Latitude( ii ) + if( allocated( Longitude )) ptr%p%rdiag( idx_obs_lon_q ) = Longitude( ii ) + if( allocated( Station_Elevation )) ptr%p%rdiag( idx_stn_elev_q ) = Station_Elevation( ii ) + if( allocated( Pressure )) ptr%p%rdiag( idx_pres_q ) = Pressure( ii ) + if( allocated( Height )) ptr%p%rdiag( idx_hgt_q ) = Height( ii ) + if( allocated( Time )) ptr%p%rdiag( idx_time_q ) = Time( ii ) + if( allocated( Prep_QC_Mark )) ptr%p%rdiag( idx_iqc_q ) = Prep_QC_Mark( ii ) + if( allocated( Nonlinear_QC_Var_Jb )) ptr%p%rdiag( idx_var_jb_q ) = Nonlinear_QC_Var_Jb( ii ) + if( allocated( Prep_Use_Flag )) ptr%p%rdiag( idx_iuse_q ) = Prep_Use_Flag( ii ) + if( allocated( Analysis_Use_Flag )) ptr%p%rdiag( idx_anl_use_q ) = Analysis_Use_Flag( ii ) + if( allocated( Nonlinear_QC_Rel_Wgt )) ptr%p%rdiag( idx_rwgt_q ) = Nonlinear_QC_Rel_Wgt( ii ) + if( allocated( Errinv_Input )) ptr%p%rdiag( idx_err_input_q ) = Errinv_Input( ii ) + if( allocated( Errinv_Adjust )) ptr%p%rdiag( idx_errinv_q ) = Errinv_Adjust( ii ) + if( allocated( Errinv_Final )) ptr%p%rdiag( idx_errinv_fnl_q ) = Errinv_Final( ii ) + if( allocated( Observation )) ptr%p%rdiag( idx_obs_q ) = Observation( ii ) + if( allocated( Obs_Minus_Forecast_adjusted )) ptr%p%rdiag( idx_obsmg_adj_q ) = Obs_Minus_Forecast_adjusted( ii ) + if( allocated( Obs_Minus_Forecast_unadjusted )) ptr%p%rdiag( idx_obsmg_nadj_q ) = Obs_Minus_Forecast_unadjusted( ii ) + if( allocated( Forecast_Saturation_Spec_Hum )) ptr%p%rdiag( idx_ges_sat_q ) = Forecast_Saturation_Spec_Hum( ii ) + + + if( nobs == 1 ) then + !------------------------------------------------- + ! Initialize the list with the first data element + ! + call list_init(list, transfer(ptr, list_data)) + next => list + + else + !------------------------------------------------- + ! Insert subsequent nodes into the list + ! + call list_insert(next, transfer(ptr, list_data)) + next => list_next(next) + end if + + end if + + end do + + + if( allocated( Station_ID )) deallocate( Station_ID ) + if( allocated( Observation_Class )) deallocate( Observation_Class ) + if( allocated( Observation_Type )) deallocate( Observation_Type ) + if( allocated( Observation_Subtype )) deallocate( Observation_Subtype ) + if( allocated( Latitude )) deallocate( Latitude ) + if( allocated( Longitude )) deallocate( Longitude ) + if( allocated( Station_Elevation )) deallocate( Station_Elevation ) + if( allocated( Time )) deallocate( Time ) + if( allocated( Prep_QC_Mark )) deallocate( Prep_QC_Mark ) + if( allocated( Prep_Use_Flag )) deallocate( Prep_Use_Flag ) + if( allocated( Nonlinear_QC_Var_Jb )) deallocate( Nonlinear_QC_Var_Jb ) + if( allocated( Nonlinear_QC_Rel_Wgt )) deallocate( Nonlinear_QC_Rel_Wgt ) + if( allocated( Analysis_Use_Flag )) deallocate( Analysis_Use_Flag ) + if( allocated( Errinv_Input )) deallocate( Errinv_Input ) + if( allocated( Errinv_Adjust )) deallocate( Errinv_Final ) + if( allocated( Errinv_Final )) deallocate( Errinv_Final ) + if( allocated( Observation )) deallocate( Observation ) + if( allocated( Obs_Minus_Forecast_adjusted )) deallocate( Obs_Minus_Forecast_adjusted ) + if( allocated( Obs_Minus_Forecast_unadjusted )) deallocate( Obs_Minus_Forecast_unadjusted ) + if( allocated( Forecast_Saturation_Spec_Hum )) deallocate( Forecast_Saturation_Spec_Hum ) + + print *, ' ' + print *, ' <-- read_diag_file_q_nc' + + end subroutine read_diag_file_q_nc + + + + !------------------------------------------------------------- + ! netcdf read routine for ps data types in netcdf files + ! + ! NOTE1: This routine is untested. The ConMon does not + ! currently process sst obs. + ! + ! NOTE2: There are known discrepencies between the contents + ! of sst obs in binary and NetCDF files. + ! + subroutine read_diag_file_sst_nc( input_file, return_all, ftin, ctype, intype,expected_nreal,nobs,in_subtype, list ) + + !--- interface + character(100), intent(in) :: input_file + logical, intent(in) :: return_all + integer, intent(in) :: ftin + character(3), intent(in) :: ctype + integer, intent(in) :: intype, expected_nreal, in_subtype + integer, intent(out) :: nobs + type(list_node_t), pointer :: list + + !--- local vars + type(list_node_t), pointer :: next => null() + type(data_ptr) :: ptr + integer :: ii, ierr, istatus, total_obs, idx + logical :: have_subtype = .true. + logical :: add_obs + + !--- NetCDF file components dimension(s) + ! + character(len=:), dimension(:), allocatable :: Station_ID ! (nobs, Station_ID_maxstrlen) + character(len=:), dimension(:), allocatable :: Observation_Class ! (nobs, Station_Class_maxstrlen) + integer, dimension(:), allocatable :: Observation_Type ! (obs) + integer, dimension(:), allocatable :: Observation_Subtype ! (obs) + real(r_single), dimension(:), allocatable :: Latitude ! (obs) + real(r_single), dimension(:), allocatable :: Longitude ! (obs) + real(r_single), dimension(:), allocatable :: Station_Elevation ! (obs) + real(r_single), dimension(:), allocatable :: Pressure ! (obs) + real(r_single), dimension(:), allocatable :: Height ! (obs) + real(r_single), dimension(:), allocatable :: Time ! (obs) + real(r_single), dimension(:), allocatable :: Prep_QC_Mark ! (obs) + real(r_single), dimension(:), allocatable :: Prep_Use_Flag ! (obs) + real(r_single), dimension(:), allocatable :: Nonlinear_QC_Var_Jb ! (obs) + real(r_single), dimension(:), allocatable :: Nonlinear_QC_Rel_Wgt ! (obs) + real(r_single), dimension(:), allocatable :: Analysis_Use_Flag ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Input ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Adjust ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Final ! (obs) + real(r_single), dimension(:), allocatable :: Observation ! (obs) + real(r_single), dimension(:), allocatable :: Obs_Minus_Forecast_adjusted ! (obs) + real(r_single), dimension(:), allocatable :: Obs_Minus_Forecast_unadjusted ! (obs) + real(r_single), dimension(:), allocatable :: FoundationTempBG ! (obs) + real(r_single), dimension(:), allocatable :: DiurnalWarming_at_zob ! (obs) + real(r_single), dimension(:), allocatable :: SkinLayerCooling_at_zob ! (obs) + real(r_single), dimension(:), allocatable :: Sensitivity_Tzob_Tr ! (obs) + integer(i_kind) :: idate + + print *, ' ' + print *, ' --> read_diag_file_sst_nc' + + + !--- get NetCDF file dimensions + ! + if( nc_diag_read_check_dim( 'nobs' )) then + total_obs = nc_diag_read_get_dim(ftin,'nobs') + ncdiag_open_status(ii)%num_records = total_obs + print *, ' total_obs = ', total_obs + else + print *, 'ERROR: unable to read nobs' + ierr=1 + end if + + + !--- get vars + + call load_nc_var( 'Station_ID', ftin, Station_ID, ierr ) + call load_nc_var( 'Observation_Class', ftin, Station_ID, ierr ) + call load_nc_var( 'Observation_Type', ftin, Observation_Type, ierr ) + call load_nc_var( 'Observation_Subtype', ftin, Observation_Subtype, ierr ) + if( ierr == 1 ) then + have_subtype = .false. + end if + call load_nc_var( 'Latitude', ftin, Latitude, ierr ) + call load_nc_var( 'Longitude', ftin, Longitude, ierr ) + call load_nc_var( 'Station_Elevation', ftin, Station_Elevation, ierr ) + call load_nc_var( 'Pressure', ftin, Pressure, ierr ) + call load_nc_var( 'Height', ftin, Height, ierr ) + call load_nc_var( 'Time', ftin, Time, ierr ) + call load_nc_var( 'Prep_QC_Mark', ftin, Prep_QC_Mark, ierr ) + call load_nc_var( 'Nonlinear_QC_Var_Jb', ftin, Nonlinear_QC_Var_Jb, ierr ) + call load_nc_var( 'Nonlinear_QC_Rel_Wgt', ftin, Nonlinear_QC_Rel_Wgt, ierr ) + call load_nc_var( 'Prep_Use_Flag', ftin, Prep_Use_Flag, ierr ) + call load_nc_var( 'Analysis_Use_Flag', ftin, Analysis_Use_Flag, ierr ) + call load_nc_var( 'Errinv_Input', ftin, Errinv_Input, ierr ) + call load_nc_var( 'Errinv_Adjust', ftin, Errinv_Adjust, ierr ) + call load_nc_var( 'Errinv_Final', ftin, Errinv_Final, ierr ) + call load_nc_var( 'Observation', ftin, Observation, ierr ) + call load_nc_var( 'Obs_Minus_Forecast_adjusted', ftin, Obs_Minus_Forecast_adjusted, ierr ) + call load_nc_var( 'Obs_Minus_Forecast_unadjusted', ftin, Obs_Minus_Forecast_unadjusted, ierr ) + call load_nc_var( 'FoundationTempBG', ftin, FoundationTempBG, ierr ) + call load_nc_var( 'DiurnalWarming_at_zob', ftin, DiurnalWarming_at_zob, ierr ) + call load_nc_var( 'SkinLayerCooling_at_zob', ftin, SkinLayerCooling_at_zob, ierr ) + call load_nc_var( 'Sensitivity_Tzob_Tr', ftin, Sensitivity_Tzob_Tr, ierr ) + + + + !--------------------------------------------------------------- + ! Process all obs. If type and subtype match the input values + ! add this obs to the linked list (ptr%p). + ! + nobs = 0 + do ii = 1, total_obs + + add_obs = .false. + + !------------------------------------------------------------------------ + ! Check on Observation_Class to ctype is a sanity check -- + ! only a single class of obs are in any given NetCDF formatted diag + ! file + ! but, if the ctype and input file don't match, things could get + ! interesting (but not in a good way). + ! + if( adjustl( trim( Observation_Class(ii) )) == adjustl( trim( ctype ))) then + + if( return_all == .true. ) then + add_obs = .true. + + else if( Observation_Type(ii) == intype ) then + + if( have_subtype == .false. ) then + add_obs = .true. + else if( Observation_Subtype(ii) == in_subtype ) then + add_obs = .true. + end if + + end if + end if + + + if( add_obs == .true. ) then + + nobs=nobs+1 + + !--------------------------------------------- + ! Allocate a new data element and load + ! + allocate( ptr%p ) + ptr%p%stn_id = Station_ID( ii ) + + do idx=1,max_rdiag_reals + ptr%p%rdiag( idx ) = 0.00 + end do + + if( allocated( Observation_Type )) ptr%p%rdiag( idx_obs_type_sst ) = Observation_Type( ii ) + if( allocated( Observation_Subtype )) ptr%p%rdiag( idx_obs_subtype_sst ) = Observation_Subtype( ii ) + if( allocated( Latitude )) ptr%p%rdiag( idx_obs_lat_sst ) = Latitude( ii ) + if( allocated( Longitude )) ptr%p%rdiag( idx_obs_lon_sst ) = Longitude( ii ) + if( allocated( Station_Elevation )) ptr%p%rdiag( idx_stn_elev_sst ) = Station_Elevation( ii ) + + if( allocated( Pressure )) ptr%p%rdiag( idx_opn_wtr_tmp_sst ) = Pressure( ii ) ! identified as background open water temperature in setupsst.f90 + + if( allocated( Height )) ptr%p%rdiag( idx_depth_sst ) = Height( ii ) ! identified as observation depth (meters) in setupsst.f90 + + if( allocated( Time )) ptr%p%rdiag( idx_time_sst ) = Time( ii ) + +! if( allocated( )) ptr%p%rdiag( idx_opn_wtr_pct_sst ) = Prep_QC_Mark( ii ) ! identified as open water percentage in setupsst.f90 + + if( allocated( Prep_QC_Mark )) ptr%p%rdiag( idx_setup_qc_sst ) = Prep_QC_Mark( ii ) + if( allocated( Prep_Use_Flag )) ptr%p%rdiag( idx_iuse_sst ) = Prep_Use_Flag( ii ) + if( allocated( Analysis_Use_Flag )) ptr%p%rdiag( idx_anl_use_sst ) = Analysis_Use_Flag( ii ) + if( allocated( Nonlinear_QC_Rel_Wgt )) ptr%p%rdiag( idx_rwgt_sst ) = Nonlinear_QC_Rel_Wgt( ii ) + if( allocated( Errinv_Input )) ptr%p%rdiag( idx_err_input_sst ) = Errinv_Input( ii ) + if( allocated( Errinv_Adjust )) ptr%p%rdiag( idx_errinv_sst ) = Errinv_Adjust( ii ) + if( allocated( Errinv_Final )) ptr%p%rdiag( idx_errinv_fnl_sst ) = Errinv_Final( ii ) + if( allocated( Observation )) ptr%p%rdiag( idx_obs_sst ) = Observation( ii ) + if( allocated( Obs_Minus_Forecast_adjusted )) ptr%p%rdiag( idx_omgbc_sst ) = Obs_Minus_Forecast_adjusted( ii ) + if( allocated( Obs_Minus_Forecast_unadjusted )) ptr%p%rdiag( idx_omgnbc_sst ) = Obs_Minus_Forecast_unadjusted( ii ) + +! if( allocated( )) ptr%p%rdiag( idx_type_sst ) = type of measurement? per setupsst.f90 + + if( allocated( FoundationTempBG )) ptr%p%rdiag( idx_tr_sst ) = FoundationTempBG( ii ) + if( allocated( DiurnalWarming_at_Zob )) ptr%p%rdiag( idx_dt_warm_sst ) = DiurnalWarming_at_zob( ii ) + if( allocated( SkinLayerCooling_at_zob )) ptr%p%rdiag( idx_dt_cool_sst ) = SkinLayerCooling_at_zob( ii ) + if( allocated( Sensitivity_Tzob_Tr )) ptr%p%rdiag( idx_dtz_dtr_sst ) = Sensitivity_Tzob_Tr( ii ) + + + if( nobs == 1 ) then + !------------------------------------------------- + ! Initialize the list with the first data element + ! + call list_init(list, transfer(ptr, list_data)) + next => list + + else + !------------------------------------------------- + ! Insert subsequent nodes into the list + ! + call list_insert(next, transfer(ptr, list_data)) + next => list_next(next) + end if + + end if + + end do + + + if( allocated( Station_ID )) deallocate( Station_ID ) + if( allocated( Observation_Class )) deallocate( Observation_Class ) + if( allocated( Observation_Type )) deallocate( Observation_Type ) + if( allocated( Observation_Subtype )) deallocate( Observation_Subtype ) + if( allocated( Latitude )) deallocate( Latitude ) + if( allocated( Longitude )) deallocate( Longitude ) + if( allocated( Station_Elevation )) deallocate( Station_Elevation ) + if( allocated( Time )) deallocate( Time ) + if( allocated( Prep_QC_Mark )) deallocate( Prep_QC_Mark ) + if( allocated( Prep_Use_Flag )) deallocate( Prep_Use_Flag ) + if( allocated( Nonlinear_QC_Var_Jb )) deallocate( Nonlinear_QC_Var_Jb ) + if( allocated( Nonlinear_QC_Rel_Wgt )) deallocate( Nonlinear_QC_Rel_Wgt ) + if( allocated( Analysis_Use_Flag )) deallocate( Analysis_Use_Flag ) + if( allocated( Errinv_Input )) deallocate( Errinv_Input ) + if( allocated( Errinv_Adjust )) deallocate( Errinv_Final ) + if( allocated( Errinv_Final )) deallocate( Errinv_Final ) + if( allocated( Observation )) deallocate( Observation ) + if( allocated( Obs_Minus_Forecast_adjusted )) deallocate( Obs_Minus_Forecast_adjusted ) + if( allocated( Obs_Minus_Forecast_unadjusted )) deallocate( Obs_Minus_Forecast_unadjusted ) + if( allocated( FoundationTempBG )) deallocate( FoundationTempBG ) + if( allocated( DiurnalWarming_at_zob )) deallocate( DiurnalWarming_at_zob ) + if( allocated( SkinLayerCooling_at_zob )) deallocate( SkinLayerCooling_at_zob ) + if( allocated( Sensitivity_Tzob_Tr )) deallocate( Sensitivity_Tzob_Tr ) + + print *, ' ' + print *, ' <-- read_diag_file_sst_nc' + + end subroutine read_diag_file_sst_nc + + + + !--------------------------------------------------------- + ! netcdf read routine for t data types in netcdf files + ! + subroutine read_diag_file_t_nc( input_file, return_all, ftin, ctype, intype, expected_nreal, nobs, in_subtype, list ) + + !--- interface + character(100), intent(in) :: input_file + logical, intent(in) :: return_all + integer, intent(in) :: ftin + character(3), intent(in) :: ctype + integer, intent(in) :: intype, expected_nreal, in_subtype + integer, intent(out) :: nobs + type(list_node_t), pointer :: list + + !--- local vars + type(list_node_t), pointer :: next => null() + type(data_ptr) :: ptr + integer :: ii, ierr, istatus, total_obs, idx, bcor_terms + logical :: have_subtype = .true. + logical :: add_obs + + !--- NetCDF file components dimension(s) + ! + character(len=:), dimension(:), allocatable :: Station_ID ! (nobs, Station_ID_maxstrlen) + character(len=:), dimension(:), allocatable :: Observation_Class ! (nobs, Station_Class_maxstrlen) + integer, dimension(:), allocatable :: Observation_Type ! (obs) + integer, dimension(:), allocatable :: Observation_Subtype ! (obs) + real(r_single), dimension(:), allocatable :: Latitude ! (obs) + real(r_single), dimension(:), allocatable :: Longitude ! (obs) + real(r_single), dimension(:), allocatable :: Station_Elevation ! (obs) + real(r_single), dimension(:), allocatable :: Pressure ! (obs) + real(r_single), dimension(:), allocatable :: Height ! (obs) + real(r_single), dimension(:), allocatable :: Time ! (obs) + real(r_single), dimension(:), allocatable :: Prep_QC_Mark ! (obs) + real(r_single), dimension(:), allocatable :: Prep_Use_Flag ! (obs) + real(r_single), dimension(:), allocatable :: Nonlinear_QC_Var_Jb ! (obs) + real(r_single), dimension(:), allocatable :: Nonlinear_QC_Rel_Wgt ! (obs) + real(r_single), dimension(:), allocatable :: Analysis_Use_Flag ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Input ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Adjust ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Final ! (obs) + real(r_single), dimension(:), allocatable :: Observation ! (obs) + real(r_single), dimension(:), allocatable :: Obs_Minus_Forecast_adjusted ! (obs) + real(r_single), dimension(:), allocatable :: Obs_Minus_Forecast_unadjusted ! (obs) + real(r_single), dimension(:), allocatable :: Data_Pof ! (obs) + real(r_single), dimension(:), allocatable :: Data_Vertical_Velocity ! (obs) + real(r_single), dimension(:,:), allocatable :: Bias_Correction_Terms ! (nobs, Bias_Correction_Terms_arr_dim) + integer(i_kind) :: idate + integer(i_kind) :: jj + + print *, ' ' + print *, ' --> read_diag_file_t_nc' + + print *, ' input_file = ', input_file + print *, ' ftin = ', ftin + print *, ' ctype = ', ctype + print *, ' intype = ', intype + print *, ' expected_nreal = ', expected_nreal + print *, ' in_subtype = ', in_subtype + + + !--- get NetCDF file dimensions + ! + if( nc_diag_read_check_dim( 'nobs' )) then + total_obs = nc_diag_read_get_dim(ftin,'nobs') + ncdiag_open_status(ii)%num_records = total_obs + else + print *, 'ERROR: unable to read nobs' + ierr=1 + end if + + if( nc_diag_read_check_dim( 'Bias_Correction_Terms_arr_dim' )) then + bcor_terms = nc_diag_read_get_dim(ftin,'Bias_Correction_Terms_arr_dim') + else + print *, 'ERROR: unable to read bcor_terms' + ierr=1 + end if + + + + !--- get vars + + call load_nc_var( 'Station_ID', ftin, Station_ID, ierr ) + call load_nc_var( 'Observation_Class', ftin, Observation_Class, ierr ) + call load_nc_var( 'Observation_Type', ftin, Observation_Type, ierr ) + call load_nc_var( 'Observation_Subtype', ftin, Observation_Subtype, ierr ) + if( ierr == 1 ) then + have_subtype = .false. + end if + + call load_nc_var( 'Latitude', ftin, Latitude, ierr ) + call load_nc_var( 'Longitude', ftin, Longitude, ierr ) + call load_nc_var( 'Station_Elevation', ftin, Station_Elevation, ierr ) + call load_nc_var( 'Pressure', ftin, Pressure, ierr ) + call load_nc_var( 'Height', ftin, Height, ierr ) + call load_nc_var( 'Time', ftin, Time, ierr ) + call load_nc_var( 'Prep_QC_Mark', ftin, Prep_QC_Mark, ierr ) + call load_nc_var( 'Nonlinear_QC_Var_Jb', ftin, Nonlinear_QC_Var_Jb, ierr ) + call load_nc_var( 'Nonlinear_QC_Rel_Wgt', ftin, Nonlinear_QC_Rel_Wgt, ierr ) + call load_nc_var( 'Prep_Use_Flag', ftin, Prep_Use_Flag, ierr ) + call load_nc_var( 'Analysis_Use_Flag', ftin, Analysis_Use_Flag, ierr ) + call load_nc_var( 'Errinv_Input', ftin, Errinv_Input, ierr ) + call load_nc_var( 'Errinv_Adjust', ftin, Errinv_Adjust, ierr ) + call load_nc_var( 'Errinv_Final', ftin, Errinv_Final, ierr ) + call load_nc_var( 'Observation', ftin, Observation, ierr ) + call load_nc_var( 'Obs_Minus_Forecast_adjusted', ftin, Obs_Minus_Forecast_adjusted, ierr ) + call load_nc_var( 'Obs_Minus_Forecast_unadjusted', ftin, Obs_Minus_Forecast_unadjusted, ierr ) + call load_nc_var( 'Data_Pof', ftin, Data_Pof, ierr ) + call load_nc_var( 'Data_Vertical_Velocity', ftin, Data_Vertical_Velocity, ierr ) + + if( nc_diag_read_check_var( 'Bias_Correction_Terms' )) then + call nc_diag_read_get_var( ftin, 'Bias_Correction_Terms', Bias_Correction_Terms ) + ierr = 0 + else + print *, 'ERROR: unable to read Bias_Correction_Terms' + ierr = 25 + end if + + + + !--------------------------------------------------------------- + ! Process all obs. If type and subtype match the input values + ! add this obs to the linked list (ptr%p). + ! + nobs = 0 + do ii = 1, total_obs + + !------------------------------------------------------------------------ + ! Check on Observation_Class to ctype is a sanity check -- + ! only a single class of obs are in any given NetCDF formatted diag file + ! but, if the ctype and input file don't match, things could get + ! interesting (but not in a good way). + ! + add_obs = .false. + + if( adjustl( trim( Observation_Class(ii) )) == adjustl( trim( ctype ))) then + + if( return_all == .true. ) then + add_obs = .true. + + else if( Observation_Type(ii) == intype ) then + + if( have_subtype == .false. ) then + add_obs = .true. + else if( Observation_Subtype(ii) == in_subtype ) then + add_obs = .true. + end if + + end if + end if + + if( add_obs == .true. ) then + + nobs=nobs+1 + + !--------------------------------------------- + ! Allocate a new data element and load + ! + allocate(ptr%p) + ptr%p%stn_id = Station_ID( ii ) + + do idx=1,max_rdiag_reals + ptr%p%rdiag( idx ) = 0.00 + end do + + if( allocated( Observation_Type )) ptr%p%rdiag( idx_obs_type_t ) = Observation_Type( ii ) + if( allocated( Observation_Subtype )) ptr%p%rdiag( idx_obs_subtype_t ) = Observation_Subtype( ii ) + if( allocated( Latitude )) ptr%p%rdiag( idx_obs_lat_t ) = Latitude( ii ) + if( allocated( Longitude )) ptr%p%rdiag( idx_obs_lon_t ) = Longitude( ii ) + if( allocated( Station_Elevation )) ptr%p%rdiag( idx_stn_elev_t ) = Station_Elevation( ii ) + if( allocated( Pressure )) ptr%p%rdiag( idx_pres_t ) = Pressure( ii ) + if( allocated( Height )) ptr%p%rdiag( idx_hgt_t ) = Height( ii ) + if( allocated( Time )) ptr%p%rdiag( idx_time_t ) = Time( ii ) + if( allocated( Prep_QC_Mark )) ptr%p%rdiag( idx_iqc_t ) = Prep_QC_Mark( ii ) + if( allocated( Nonlinear_QC_Var_Jb )) ptr%p%rdiag( idx_setup_qc_t ) = Nonlinear_QC_Var_Jb( ii ) + if( allocated( Prep_Use_Flag )) ptr%p%rdiag( idx_iuse_t ) = Prep_Use_Flag( ii ) + if( allocated( Analysis_Use_Flag )) ptr%p%rdiag( idx_anl_use_t ) = Analysis_Use_Flag( ii ) + if( allocated( Nonlinear_QC_Rel_Wgt )) ptr%p%rdiag( idx_rwgt_t ) = Nonlinear_QC_Rel_Wgt( ii ) + if( allocated( Errinv_Input )) ptr%p%rdiag( idx_err_input_t ) = Errinv_Input( ii ) + if( allocated( Errinv_Adjust )) ptr%p%rdiag( idx_errinv_t ) = Errinv_Adjust( ii ) + if( allocated( Errinv_Final )) ptr%p%rdiag( idx_errinv_fnl_t ) = Errinv_Final( ii ) + if( allocated( Observation )) ptr%p%rdiag( idx_obs_t ) = Observation( ii ) + if( allocated( Obs_Minus_Forecast_adjusted )) ptr%p%rdiag( idx_omgbc_t ) = Obs_Minus_Forecast_adjusted( ii ) + if( allocated( Obs_Minus_Forecast_unadjusted )) ptr%p%rdiag( idx_omgnbc_t ) = Obs_Minus_Forecast_unadjusted( ii ) + if( allocated( Data_Pof )) ptr%p%rdiag( idx_pof_t ) = Data_Pof( ii ) + if( allocated( Data_Vertical_Velocity )) ptr%p%rdiag( idx_vv_t ) = Data_Vertical_Velocity( ii ) + do jj = 1, bcor_terms + if( allocated( Bias_Correction_Terms )) ptr%p%rdiag( idx_vv_t+jj ) = Bias_Correction_Terms( jj,ii ) + end do + + if( nobs == 1 ) then + !------------------------------------------------- + ! Initialize the list with the first data element + ! + call list_init(list, transfer(ptr, list_data)) + next => list + + else + !------------------------------------------------- + ! Insert subsequent nodes into the list + ! + call list_insert(next, transfer(ptr, list_data)) + next => list_next(next) + + end if + + end if + + end do + + + if( allocated( Station_ID )) deallocate( Station_ID ) + if( allocated( Observation_Class )) deallocate( Observation_Class ) + if( allocated( Observation_Type )) deallocate( Observation_Type ) + if( allocated( Observation_Subtype )) deallocate( Observation_Subtype ) + if( allocated( Latitude )) deallocate( Latitude ) + if( allocated( Longitude )) deallocate( Longitude ) + if( allocated( Station_Elevation )) deallocate( Station_Elevation ) + if( allocated( Time )) deallocate( Time ) + if( allocated( Prep_QC_Mark )) deallocate( Prep_QC_Mark ) + if( allocated( Prep_Use_Flag )) deallocate( Prep_Use_Flag ) + if( allocated( Nonlinear_QC_Var_Jb )) deallocate( Nonlinear_QC_Var_Jb ) + if( allocated( Nonlinear_QC_Rel_Wgt )) deallocate( Nonlinear_QC_Rel_Wgt ) + if( allocated( Analysis_Use_Flag )) deallocate( Analysis_Use_Flag ) + if( allocated( Errinv_Input )) deallocate( Errinv_Input ) + if( allocated( Errinv_Adjust )) deallocate( Errinv_Final ) + if( allocated( Errinv_Final )) deallocate( Errinv_Final ) + if( allocated( Observation )) deallocate( Observation ) + if( allocated( Obs_Minus_Forecast_adjusted )) deallocate( Obs_Minus_Forecast_adjusted ) + if( allocated( Obs_Minus_Forecast_unadjusted )) deallocate( Obs_Minus_Forecast_unadjusted ) + + print *, ' ' + print *, ' <-- read_diag_file_t_nc' + + end subroutine read_diag_file_t_nc + + + + !--------------------------------------------------------- + ! netcdf read routine for uv data types in netcdf files + ! + subroutine read_diag_file_uv_nc( input_file, return_all, ftin, ctype, intype, expected_nreal, nobs, in_subtype, list ) + + !--- interface + character(100), intent(in) :: input_file + logical, intent(in) :: return_all + integer, intent(in) :: ftin + character(3), intent(in) :: ctype + integer, intent(in) :: intype, expected_nreal, in_subtype + integer, intent(out) :: nobs + type(list_node_t), pointer :: list + + !--- local vars + type(list_node_t), pointer :: next => null() + type(data_ptr) :: ptr + integer :: ii, ierr, istatus, total_obs, idx + logical :: have_subtype = .true. + logical :: add_obs + + !--- NetCDF file components dimension(s) + ! + character(len=:), dimension(:), allocatable :: Station_ID ! (nobs, Station_ID_maxstrlen) + character(len=:), dimension(:), allocatable :: Observation_Class ! (nobs, Station_Class_maxstrlen) + integer, dimension(:), allocatable :: Observation_Type ! (obs) + integer, dimension(:), allocatable :: Observation_Subtype ! (obs) + real(r_single), dimension(:), allocatable :: Latitude ! (obs) + real(r_single), dimension(:), allocatable :: Longitude ! (obs) + real(r_single), dimension(:), allocatable :: Station_Elevation ! (obs) + real(r_single), dimension(:), allocatable :: Pressure ! (obs) + real(r_single), dimension(:), allocatable :: Height ! (obs) + real(r_single), dimension(:), allocatable :: Time ! (obs) + real(r_single), dimension(:), allocatable :: Prep_QC_Mark ! (obs) + real(r_single), dimension(:), allocatable :: Setup_QC_Mark ! (obs) + real(r_single), dimension(:), allocatable :: Prep_Use_Flag ! (obs) + real(r_single), dimension(:), allocatable :: Nonlinear_QC_Rel_Wgt ! (obs) + real(r_single), dimension(:), allocatable :: Nonlinear_QC_Var_Jb ! (obs) + real(r_single), dimension(:), allocatable :: Analysis_Use_Flag ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Input ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Adjust ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Final ! (obs) + real(r_single), dimension(:), allocatable :: Wind_Reduction_Factor_at_10m ! (obs) + real(r_single), dimension(:), allocatable :: u_Observation ! (obs) + real(r_single), dimension(:), allocatable :: u_Obs_Minus_Forecast_adjusted ! (obs) + real(r_single), dimension(:), allocatable :: u_Obs_Minus_Forecast_unadjusted ! (obs) + real(r_single), dimension(:), allocatable :: v_Observation ! (obs) + real(r_single), dimension(:), allocatable :: v_Obs_Minus_Forecast_adjusted ! (obs) + real(r_single), dimension(:), allocatable :: v_Obs_Minus_Forecast_unadjusted ! (obs) + integer(i_kind) :: idate + + print *, ' ' + print *, ' --> read_diag_file_uv_nc' + + + !--- get NetCDF file dimensions + ! + if( nc_diag_read_check_dim( 'nobs' )) then + total_obs = nc_diag_read_get_dim(ftin,'nobs') + ncdiag_open_status(ii)%num_records = total_obs + print *, ' total_obs = ', total_obs + else + print *, 'ERROR: unable to read nobs' + ierr=1 + end if + + + !--- get vars + + call load_nc_var( 'Station_ID', ftin, Station_ID, ierr ) + call load_nc_var( 'Observation_Class', ftin, Observation_Class, ierr ) + call load_nc_var( 'Observation_Type', ftin, Observation_Type, ierr ) + call load_nc_var( 'Observation_Subtype', ftin, Observation_Subtype, ierr ) + if( ierr == 1 ) then + have_subtype = .false. + end if + call load_nc_var( 'Latitude', ftin, Latitude, ierr ) + call load_nc_var( 'Longitude', ftin, Longitude, ierr ) + call load_nc_var( 'Station_Elevation', ftin, Station_Elevation, ierr ) + call load_nc_var( 'Pressure', ftin, Pressure, ierr ) + call load_nc_var( 'Height', ftin, Height, ierr ) + call load_nc_var( 'Time', ftin, Time, ierr ) + call load_nc_var( 'Prep_QC_Mark', ftin, Prep_QC_Mark, ierr ) + call load_nc_var( 'Setup_QC_Mark', ftin, Setup_QC_Mark, ierr ) + call load_nc_var( 'Nonlinear_QC_Rel_Wgt', ftin, Nonlinear_QC_Rel_Wgt, ierr ) + call load_nc_var( 'Prep_Use_Flag', ftin, Prep_Use_Flag, ierr ) + call load_nc_var( 'Nonlinear_QC_Var_Jb', ftin, Nonlinear_QC_Var_Jb, ierr ) + call load_nc_var( 'Analysis_Use_Flag', ftin, Analysis_Use_Flag, ierr ) + call load_nc_var( 'Errinv_Input', ftin, Errinv_Input, ierr ) + call load_nc_var( 'Errinv_Adjust', ftin, Errinv_Adjust, ierr ) + call load_nc_var( 'Errinv_Final', ftin, Errinv_Final, ierr ) + call load_nc_var( 'Wind_Reduction_Factor_at_10m', ftin, Wind_Reduction_Factor_at_10m, ierr ) + call load_nc_var( 'u_Observation', ftin, u_Observation, ierr ) + call load_nc_var( 'u_Obs_Minus_Forecast_adjusted', ftin, u_Obs_Minus_Forecast_adjusted, ierr ) + call load_nc_var( 'u_Obs_Minus_Forecast_unadjusted', ftin, u_Obs_Minus_Forecast_unadjusted, ierr ) + call load_nc_var( 'v_Observation', ftin, v_Observation, ierr ) + call load_nc_var( 'v_Obs_Minus_Forecast_adjusted', ftin, v_Obs_Minus_Forecast_adjusted, ierr ) + call load_nc_var( 'v_Obs_Minus_Forecast_unadjusted', ftin, v_Obs_Minus_Forecast_unadjusted, ierr ) + + + !--------------------------------------------------------------- + ! Process all obs. If type and subtype match the input values + ! add this obs to the linked list (ptr%p). + ! + nobs = 0 + do ii = 1, total_obs + + + !------------------------------------------------------------------------ + ! Check on Observation_Class to ctype is a sanity check -- + ! only a single class of obs are in any given NetCDF formatted diag file + ! but, if the ctype and input file don't match, things could get + ! interesting (but not in a good way). + ! + add_obs = .false. + + if( adjustl( trim( Observation_Class(ii) )) == adjustl( trim( ctype ))) then + + if( return_all == .true. ) then + add_obs = .true. + + else if( Observation_Type(ii) == intype ) then + + if( have_subtype == .false. ) then + add_obs = .true. + else if( Observation_Subtype(ii) == in_subtype ) then + add_obs = .true. + end if + + end if + end if + + if( add_obs == .true. ) then + + nobs=nobs+1 + + !--------------------------------------------- + ! Allocate a new data element and load + ! + allocate(ptr%p) + ptr%p%stn_id = Station_ID( ii ) + + do idx=1,max_rdiag_reals + ptr%p%rdiag( idx ) = 0.00 + end do + + if( allocated( Observation_Type )) ptr%p%rdiag( idx_obs_type_uv ) = Observation_Type( ii ) + if( allocated( Observation_Subtype )) ptr%p%rdiag( idx_obs_subtype_uv ) = Observation_Subtype( ii ) + if( allocated( Latitude )) ptr%p%rdiag( idx_obs_lat_uv ) = Latitude( ii ) + if( allocated( Longitude )) ptr%p%rdiag( idx_obs_lon_uv ) = Longitude( ii ) + if( allocated( Station_Elevation )) ptr%p%rdiag( idx_stn_elev_uv ) = Station_Elevation( ii ) + if( allocated( Pressure )) ptr%p%rdiag( idx_pres_uv ) = Pressure( ii ) + if( allocated( Height )) ptr%p%rdiag( idx_hgt_uv ) = Height( ii ) + if( allocated( Time )) ptr%p%rdiag( idx_time_uv ) = Time( ii ) + if( allocated( Prep_QC_Mark )) ptr%p%rdiag( idx_iqc_uv ) = Prep_QC_Mark( ii ) + +! if( allocated( Nonlinear_QC_Var_JB )) ptr%p%rdiag( idx_setup_qc_uv ) = Nonlinear_QC_Var_Jb( ii ) ! missing from diagnostic file + + if( allocated( Prep_Use_Flag )) ptr%p%rdiag( idx_iuse_uv ) = Prep_Use_Flag( ii ) + if( allocated( Analysis_Use_Flag )) ptr%p%rdiag( idx_anl_use_uv ) = Analysis_Use_Flag( ii ) + if( allocated( Nonlinear_QC_Rel_Wgt )) ptr%p%rdiag( idx_rwgt_uv ) = Nonlinear_QC_Rel_Wgt( ii ) + if( allocated( Errinv_Input )) ptr%p%rdiag( idx_err_input_uv ) = Errinv_Input( ii ) + if( allocated( Errinv_Adjust )) ptr%p%rdiag( idx_errinv_uv ) = Errinv_Adjust( ii ) + if( allocated( Errinv_Final )) ptr%p%rdiag( idx_errinv_fnl_uv ) = Errinv_Final( ii ) + + if( allocated( u_Observation )) ptr%p%rdiag( idx_u_obs_uv ) = u_Observation( ii ) + if( allocated( u_Obs_Minus_Forecast_adjusted )) ptr%p%rdiag( idx_u_omgbc_uv ) = u_Obs_Minus_Forecast_adjusted( ii ) + if( allocated( u_Obs_Minus_Forecast_unadjusted )) ptr%p%rdiag( idx_u_omgnbc_uv ) = u_Obs_Minus_Forecast_unadjusted( ii ) + if( allocated( v_Observation )) ptr%p%rdiag( idx_v_obs_uv ) = v_Observation( ii ) + if( allocated( v_Obs_Minus_Forecast_adjusted )) ptr%p%rdiag( idx_v_omgbc_uv ) = v_Obs_Minus_Forecast_adjusted( ii ) + if( allocated( v_Obs_Minus_Forecast_unadjusted )) ptr%p%rdiag( idx_v_omgnbc_uv ) = v_Obs_Minus_Forecast_unadjusted( ii ) + + + if( nobs == 1 ) then + !------------------------------------------------- + ! Initialize the list with the first data element + ! + call list_init(list, transfer(ptr, list_data)) + next => list + + else + !------------------------------------------------- + ! Insert subsequent nodes into the list + ! + call list_insert(next, transfer(ptr, list_data)) + next => list_next(next) + end if + + end if + + end do + + + if( allocated( Station_ID )) deallocate( Station_ID ) + if( allocated( Observation_Class )) deallocate( Observation_Class ) + if( allocated( Observation_Type )) deallocate( Observation_Type ) + if( allocated( Observation_Subtype )) deallocate( Observation_Subtype ) + if( allocated( Latitude )) deallocate( Latitude ) + if( allocated( Longitude )) deallocate( Longitude ) + if( allocated( Station_Elevation )) deallocate( Station_Elevation ) + if( allocated( Time )) deallocate( Time ) + if( allocated( Prep_QC_Mark )) deallocate( Prep_QC_Mark ) + if( allocated( Prep_Use_Flag )) deallocate( Prep_Use_Flag ) + if( allocated( Nonlinear_QC_Var_Jb )) deallocate( Nonlinear_QC_Var_Jb ) + if( allocated( Nonlinear_QC_Rel_Wgt )) deallocate( Nonlinear_QC_Rel_Wgt ) + if( allocated( Analysis_Use_Flag )) deallocate( Analysis_Use_Flag ) + if( allocated( Errinv_Input )) deallocate( Errinv_Input ) + if( allocated( Errinv_Adjust )) deallocate( Errinv_Final ) + if( allocated( Errinv_Final )) deallocate( Errinv_Final ) + if( allocated( Wind_Reduction_Factor_at_10m )) deallocate( Wind_Reduction_Factor_at_10m ) + if( allocated( u_Observation )) deallocate( u_Observation ) + if( allocated( u_Obs_Minus_Forecast_adjusted )) deallocate( u_Obs_Minus_Forecast_adjusted ) + if( allocated( u_Obs_Minus_Forecast_unadjusted )) deallocate( u_Obs_Minus_Forecast_unadjusted ) + if( allocated( v_Observation )) deallocate( v_Observation ) + if( allocated( v_Obs_Minus_Forecast_adjusted )) deallocate( v_Obs_Minus_Forecast_adjusted ) + if( allocated( v_Obs_Minus_Forecast_unadjusted )) deallocate( v_Obs_Minus_Forecast_unadjusted ) + + print *, ' ' + print *, ' <-- read_diag_file_uv_nc' + + end subroutine read_diag_file_uv_nc + + + !----------------------------------------------------------- + ! netcdf read routine for gps data types in netcdf files + ! + ! NOTE1: This routine is untested. At present the ConMon + ! does not process gps data. There are plans to + ! change that though. + ! + ! NOTE2: There are known descrepencies between gps obs + ! in binary and NetCDF formatted diag files. See + ! comments below. + ! + subroutine read_diag_file_gps_nc( input_file, return_all, ftin, ctype, intype,expected_nreal,nobs,in_subtype, list ) + + !--- interface + character(100), intent(in) :: input_file + logical, intent(in) :: return_all + integer, intent(in) :: ftin + character(3), intent(in) :: ctype + integer, intent(in) :: intype, expected_nreal, in_subtype + integer, intent(out) :: nobs + type(list_node_t), pointer :: list + + !--- local vars + type(list_node_t), pointer :: next => null() + type(data_ptr) :: ptr + integer :: ii, ierr, istatus, total_obs, idx + logical :: have_subtype = .true. + logical :: add_obs + + !--- NetCDF file components dimension(s) + ! + character(len=:), dimension(:), allocatable :: Station_ID ! (nobs, Station_ID_maxstrlen) + character(len=:), dimension(:), allocatable :: Observation_Class ! (nobs, Station_Class_maxstrlen) + integer, dimension(:), allocatable :: Observation_Type ! (obs) + integer, dimension(:), allocatable :: Observation_Subtype ! (obs) + real(r_single), dimension(:), allocatable :: Latitude ! (obs) + real(r_single), dimension(:), allocatable :: Longitude ! (obs) + real(r_single), dimension(:), allocatable :: Incremental_Bending_Angle ! (obs) + real(r_single), dimension(:), allocatable :: Station_Elevation ! (obs) + real(r_single), dimension(:), allocatable :: Pressure ! (obs) + real(r_single), dimension(:), allocatable :: Height ! (obs) + real(r_single), dimension(:), allocatable :: Time ! (obs) + real(r_single), dimension(:), allocatable :: Model_Elevation ! (obs) + real(r_single), dimension(:), allocatable :: Setup_QC_Mark ! (obs) + real(r_single), dimension(:), allocatable :: Prep_Use_Flag ! (obs) + real(r_single), dimension(:), allocatable :: Nonlinear_QC_Var_Jb ! (obs) + real(r_single), dimension(:), allocatable :: Nonlinear_QC_Rel_Wgt ! (obs) + real(r_single), dimension(:), allocatable :: Analysis_Use_Flag ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Input ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Adjust ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Final ! (obs) + real(r_single), dimension(:), allocatable :: Observation ! (obs) + real(r_single), dimension(:), allocatable :: Obs_Minus_Forecast_adjusted ! (obs) + real(r_single), dimension(:), allocatable :: Obs_Minus_Forecast_unadjusted ! (obs) + real(r_single), dimension(:), allocatable :: GPS_Type ! (obs) + real(r_single), dimension(:), allocatable :: Temperature_at_Obs_Location ! (obs) + real(r_single), dimension(:), allocatable :: Specific_Humidity_at_Obs_Location ! (obs) + + integer(i_kind) :: idate + + + + print *, ' ' + print *, ' --> read_diag_file_gps_nc' + + + !--- get NetCDF file dimensions + ! + if( nc_diag_read_check_dim( 'nobs' )) then + total_obs = nc_diag_read_get_dim(ftin,'nobs') + ncdiag_open_status(ii)%num_records = total_obs + print *, ' total_obs = ', total_obs + else + print *, 'ERROR: unable to read nobs' + ierr=1 + end if + + + !--- get vars + + call load_nc_var( 'Station_ID', ftin, Station_ID, ierr ) + call load_nc_var( 'Observation_Class', ftin, Observation_Class, ierr ) + call load_nc_var( 'Observation_Type', ftin, Observation_Type, ierr ) + call load_nc_var( 'Observation_Subtype', ftin, Observation_Subtype, ierr ) + if( ierr == 1 ) then + have_subtype = .false. + end if + call load_nc_var( 'Latitude', ftin, Latitude, ierr ) + call load_nc_var( 'Longitude', ftin, Longitude, ierr ) + call load_nc_var( 'Incremental_Bending_Angle', ftin, Incremental_Bending_Angle, ierr ) + call load_nc_var( 'Pressure', ftin, Pressure, ierr ) + call load_nc_var( 'Height', ftin, Height, ierr ) + call load_nc_var( 'Time', ftin, Time, ierr ) + call load_nc_var( 'Model_Elevation', ftin, Model_Elevation, ierr ) + call load_nc_var( 'Setup_QC_Mark', ftin, Setup_QC_Mark, ierr ) + call load_nc_var( 'Prep_Use_Flag', ftin, Prep_Use_Flag, ierr ) + call load_nc_var( 'Analysis_Use_Flag', ftin, Analysis_Use_Flag, ierr ) + call load_nc_var( 'Nonlinear_QC_Rel_Wgt', ftin, Nonlinear_QC_Rel_Wgt, ierr ) + call load_nc_var( 'Errinv_Input', ftin, Errinv_Input, ierr ) + call load_nc_var( 'Errinv_Adjust', ftin, Errinv_Adjust, ierr ) + call load_nc_var( 'Errinv_Final', ftin, Errinv_Final, ierr ) + call load_nc_var( 'Observation', ftin, Observation, ierr ) + call load_nc_var( 'Obs_Minus_Forecast_adjusted', ftin, Obs_Minus_Forecast_adjusted, ierr ) + call load_nc_var( 'Obs_Minus_Forecast_unadjusted', ftin, Obs_Minus_Forecast_unadjusted, ierr ) + call load_nc_var( 'GPS_Type', ftin, GPS_Type, ierr ) + call load_nc_var( 'Temperature_at_Obs_Location', ftin, Temperature_at_Obs_Location, ierr ) + call load_nc_var( 'Specific_Humidity_at_Obs_Location', ftin, Specific_Humidity_at_Obs_Location, ierr ) + +! call load_nc_var( 'Nonlinear_QC_Var_Jb', ftin, Nonlinear_QC_Var_Jb, 13, ierr ) + + + + !--------------------------------------------------------------- + ! Process all obs. If type and subtype match the input values + ! add this obs to the linked list (ptr%p). + ! + nobs = 0 + do ii = 1, total_obs + + !------------------------------------------------------------------------ + ! Check on Observation_Class to ctype is a sanity check -- + ! only a single class of obs are in any given NetCDF formatted diag + ! file + ! but, if the ctype and input file don't match, things could get + ! interesting (but not in a good way). + ! + add_obs = .false. + + if( adjustl( trim( Observation_Class(ii) )) == adjustl( trim( ctype ))) then + + if( return_all == .true. ) then + add_obs = .true. + + else if( Observation_Type(ii) == intype ) then + + if( have_subtype == .false. ) then + add_obs = .true. + else if( Observation_Subtype(ii) == in_subtype ) then + add_obs = .true. + end if + + end if + end if + + if( add_obs == .true. ) then + + nobs=nobs+1 + + !--------------------------------------------- + ! Allocate a new data element and load + ! + allocate(ptr%p) + ptr%p%stn_id = Station_ID( ii ) + + do idx=1,max_rdiag_reals + ptr%p%rdiag( idx ) = 0.00 + end do + + if( allocated ( Observation_Type )) ptr%p%rdiag( idx_obs_type_gps ) = Observation_Type( ii ) + if( allocated ( Observation_Subtype )) ptr%p%rdiag( idx_obs_subtype_gps ) = Observation_Subtype( ii ) + if( allocated ( Latitude )) ptr%p%rdiag( idx_obs_lat_gps ) = Latitude( ii ) + if( allocated ( Longitude )) ptr%p%rdiag( idx_obs_lon_gps ) = Longitude( ii ) + if( allocated ( Incremental_Bending_Angle )) ptr%p%rdiag( idx_bend_ang_gps ) = Incremental_Bending_Angle( ii ) + if( allocated ( Pressure )) ptr%p%rdiag( idx_pres_gps ) = Pressure( ii ) + if( allocated ( Height )) ptr%p%rdiag( idx_height_gps ) = Height( ii ) + if( allocated ( Time )) ptr%p%rdiag( idx_time_gps ) = Time( ii ) + if( allocated ( Model_Elevation )) ptr%p%rdiag( idx_zsges_gps ) = Model_Elevation( ii ) + if( allocated ( Setup_QC_Mark )) ptr%p%rdiag( idx_setup_qc_gps ) = Setup_QC_Mark( ii ) + if( allocated ( Prep_Use_Flag )) ptr%p%rdiag( idx_iuse_gps ) = Prep_Use_Flag( ii ) + if( allocated ( Analysis_Use_Flag )) ptr%p%rdiag( idx_anl_use_gps ) = Analysis_Use_Flag( ii ) + if( allocated ( Nonlinear_QC_Rel_Wgt )) ptr%p%rdiag( idx_rwgt_gps ) = Nonlinear_QC_Rel_Wgt( ii ) + if( allocated ( Errinv_input )) ptr%p%rdiag( idx_err_input_gps ) = Errinv_Input( ii ) + if( allocated ( Errinv_Adjust )) ptr%p%rdiag( idx_errinv_gps ) = Errinv_Adjust( ii ) + if( allocated ( Errinv_Final )) ptr%p%rdiag( idx_errinv_fnl_gps ) = Errinv_Final( ii ) + + if( allocated ( Observation )) ptr%p%rdiag( idx_obs_gps ) = Observation( ii ) + if( allocated ( Temperature_at_Obs_Location )) ptr%p%rdiag( idx_tref_gps ) = Temperature_at_Obs_Location( ii ) +! if( allocated ( Obs_Minus_Forecast_unadjusted )) ptr%p%rdiag( idx_hob_gps ) = Obs_Minus_Forecast_unadjusted( ii ) + if( allocated ( GPS_Type )) ptr%p%rdiag( idx_uses_gps ) = GPS_Type( ii ) + if( allocated ( Specific_Humidity_at_Obs_Location )) ptr%p%rdiag( idx_qref_gps ) = Specific_Humidity_at_Obs_Location( ii ) + + + ! This oddity is from genstats_gps.f90 which produces the NetCDF + ! formatted diag file: + ! + ! call nc_diag_metadata("Obs_Minus_Forecast_adjusted", sngl(gps_allptr%rdiag(17))*sngl(gps_allptr%rdiag(5)) ) + ! call nc_diag_metadata("Obs_Minus_Forecast_unadjusted", sngl(gps_allptr%rdiag(17))*sngl(gps_allptr%rdiag(5)) ) + ! call nc_diag_metadata("GPS_Type", sngl(gps_allptr%rdiag(20)) ) + ! call nc_diag_metadata("Temperature_at_Obs_Location", sngl(gps_allptr%rdiag(18)) ) + ! + ! It would seem from this that rdiagbuf(19) is not used? + ! And also Obs_Minus_Forecast_[un|'']adjusted is derived and not stored. + ! + ! This from setupbend.f90: + ! rdiagbuf(18,i) = trefges ! temperature at obs location (Kelvin) if monotone grid + ! rdiagbuf(19,i) = hob ! model vertical grid (interface) if monotone grid + ! rdiagbuf(20,i) = one ! uses gps_ref (one = use of bending angle) + ! + + + if( nobs == 1 ) then + !------------------------------------------------- + ! Initialize the list with the first data element + ! + call list_init(list, transfer(ptr, list_data)) + next => list + + else + !------------------------------------------------- + ! Insert subsequent nodes into the list + ! + call list_insert(next, transfer(ptr, list_data)) + next => list_next(next) + + end if + + end if + + end do + + + if( allocated( Station_ID )) deallocate( Station_ID ) + if( allocated( Observation_Class )) deallocate( Observation_Class ) + if( allocated( Observation_Type )) deallocate( Observation_Type ) + if( allocated( Observation_Subtype )) deallocate( Observation_Subtype ) + if( allocated( Latitude )) deallocate( Latitude ) + if( allocated( Longitude )) deallocate( Longitude ) + if( allocated( Incremental_Bending_Angle )) deallocate( Incremental_Bending_Angle ) + if( allocated( Pressure )) deallocate( Pressure ) + if( allocated( Height )) deallocate( Height ) + if( allocated( Time )) deallocate( Time ) + if( allocated( Model_Elevation )) deallocate( Model_Elevation ) + if( allocated( Setup_QC_Mark )) deallocate( Setup_QC_Mark ) + if( allocated( Prep_Use_Flag )) deallocate( Prep_Use_Flag ) + if( allocated( Analysis_Use_Flag )) deallocate( Analysis_Use_Flag ) + if( allocated( Nonlinear_QC_Rel_Wgt )) deallocate( Nonlinear_QC_Rel_Wgt ) + if( allocated( Errinv_Input )) deallocate( Errinv_Input ) + if( allocated( Errinv_Adjust )) deallocate( Errinv_Final ) + if( allocated( Errinv_Final )) deallocate( Errinv_Final ) + if( allocated( Observation )) deallocate( Observation ) + if( allocated( Obs_Minus_Forecast_adjusted )) deallocate( Obs_Minus_Forecast_adjusted ) + if( allocated( Obs_Minus_Forecast_unadjusted )) deallocate( Obs_Minus_Forecast_unadjusted ) + if( allocated( GPS_Type )) deallocate( GPS_Type ) + if( allocated( Temperature_at_Obs_Location )) deallocate( Temperature_at_Obs_Location ) + if( allocated( Specific_Humidity_at_Obs_Location )) deallocate( Specific_Humidity_at_Obs_Location ) + + print *, ' ' + print *, ' <-- read_diag_file_gps_nc' + + end subroutine read_diag_file_gps_nc + + + + + !--- binary read routine + ! + subroutine read_diag_file_bin( input_file, return_all, ctype, intype,expected_nreal,nobs,in_subtype, list ) + + !--- interface + character(100), intent(in) :: input_file + logical, intent(in) :: return_all + character(3), intent(in) :: ctype + integer, intent(in) :: intype, expected_nreal, in_subtype + integer, intent(out) :: nobs + type(list_node_t), pointer :: list + + + !--- local vars + type(list_node_t), pointer :: next => null() + type(data_ptr) :: ptr + + real(4),allocatable,dimension(:,:) :: rdiag + character(8),allocatable,dimension(:) :: cdiag + + character(3) :: dtype + character(10) :: otype + character(15) :: fileo,fileo_subtyp + + integer nchar,file_nreal,i,ii,mype,idate,iflag,file_itype,iscater,igrads + integer lunin,lunot,ldtype,file_subtype + integer idx,ioff02 + + data lunin / 11 / + + nobs=0 + print *, ' --> read_diag_file_bin' + print *, ' ctype = ', ctype + print *, ' intype, in_subtype = ', intype, in_subtype + print *, ' expected_nreal = ', expected_nreal + + + !--- open diag file + open(lunin, file=input_file, form='unformatted') + rewind(lunin) + + read(lunin) idate + print *, 'idate=',idate + + loopd: do + + !--- read obs header + read(lunin,IOSTAT=iflag) dtype,nchar,file_nreal,ii,mype,ioff02 + + if( iflag /= 0 ) exit loopd + + !----------------------------------------------------- + ! exit loop if the number of reals (nreal) from file + ! doesn't match the target number + ! + if(( return_all == .true. ) .OR. ( trim(dtype) == trim(ctype) .and. file_nreal /= expected_nreal )) then + print *, 'matched observation type:',dtype,' file_nreal=', file_nreal + exit + endif + + !--------------------------------------------- + ! skip to next iteration if types don't match + ! + if(( return_all == .false. ) .AND. ( trim( dtype ) /= trim( ctype ))) then + cycle + endif + + + !--- read diag info + allocate(cdiag(ii),rdiag(file_nreal,ii)) + read(lunin,IOSTAT=iflag) cdiag,rdiag + + !--- exit loop on read error + if( iflag /= 0 ) then + deallocate( cdiag,rdiag ) + exit loopd + end if + + do i=1,ii + file_itype = int(rdiag(1,i)) + file_subtype = int(rdiag(2,i)) + + !------------------------------------------------ + ! if both types and subtypes match + ! then add a new data element + ! + if(( return_all == .true. ) .OR. ( file_itype == intype .AND. file_subtype == in_subtype )) then + + nobs=nobs+1 + + !--------------------------------------------- + ! Allocate a new data element and load + ! + allocate(ptr%p) + ptr%p%stn_id = cdiag(i) + + do idx=1,max_rdiag_reals + if( idx > file_nreal ) then + ptr%p%rdiag( idx ) = 0.00 + else + ptr%p%rdiag( idx ) = rdiag( idx,i ) + end if + end do + + if( nobs == 1 ) then + !------------------------------------------------- + ! Initialize the list with the first data element + ! + call list_init(list, transfer(ptr, list_data)) + next => list + + else + !------------------------------------------------- + ! Insert subsequent nodes into the list + ! + call list_insert(next, transfer(ptr, list_data)) + next => list_next(next) + + end if + + endif + + enddo + + deallocate(cdiag,rdiag) + enddo loopd ! ending read data do loop + + close(lunin) + + print *, 'nobs added to list = ', nobs + print *, ' <-- read_diag_file_bin' + + return + end subroutine read_diag_file_bin + + + + !------------------------------------------------ + ! function find_ncdiag_id + !------------------------------------------------ + integer( i_kind ) function find_ncdiag_id( ftin ) + + integer(i_kind), intent(in) :: ftin + + integer(i_kind) :: i + + find_ncdiag_id = -1 + do i = 1, MAX_OPEN_NCDIAG + if ( ncdiag_open_id(i) == ftin ) then + find_ncdiag_id = i + return + endif + enddo + + return + end function find_ncdiag_id + + +end module conmon_read_diag diff --git a/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_lev.fd/data_mod.f90 b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_lev.fd/data_mod.f90 new file mode 100644 index 0000000000..e611a9782e --- /dev/null +++ b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_lev.fd/data_mod.f90 @@ -0,0 +1,220 @@ +module data + implicit none + + private + public :: data_t + public :: data_ptr + + integer, parameter,public :: max_rdiag_reals = 25 + + !-------------------------------------------------- + ! generic index numbers into the rdiagbuf array + ! for _all_ data types + ! + integer, parameter, public :: idx_obs_type = 1 ! obs type + integer, parameter, public :: idx_obs_subtype = 2 ! obs subtype + integer, parameter, public :: idx_obs_lat = 3 ! obs latitude + integer, parameter, public :: idx_obs_lon = 4 ! obs longitude + integer, parameter, public :: idx_stn_elev = 5 ! stn elevation + integer, parameter, public :: idx_pres = 6 ! obs pressure + integer, parameter, public :: idx_time = 8 ! obs time (hrs relative to analysis time) + integer, parameter, public :: idx_rwgt = 13 ! non-linear qc relative weight + + + + !-------------------------------------------------- + ! index numbers into the rdiagbuf array + ! for type ps obs + ! + ! (see setupps.f90 for more info) + ! + integer, parameter, public :: idx_obs_type_ps = 1 ! obs type + integer, parameter, public :: idx_obs_subtype_ps = 2 ! obs subtype + integer, parameter, public :: idx_obs_lat_ps = 3 ! obs latitude + integer, parameter, public :: idx_obs_lon_ps = 4 ! obs longitude + integer, parameter, public :: idx_stn_elev_ps = 5 ! stn elevation + integer, parameter, public :: idx_pres_ps = 6 ! obs pressure (hPa) + integer, parameter, public :: idx_hgt_ps = 7 ! obs height (meters) + integer, parameter, public :: idx_time_ps = 8 ! obs time (hrs relative to analysis time) + integer, parameter, public :: idx_iqc_ps = 9 ! prepbufr qc or event mark + integer, parameter, public :: idx_var_jb_ps = 10 ! non-linear qc param + integer, parameter, public :: idx_iuse_ps = 11 ! read_prepbufr data usage flag + integer, parameter, public :: idx_anl_use_ps = 12 ! analysis usage flag + integer, parameter, public :: idx_rwgt_ps = 13 ! non-linear qc relative weight + integer, parameter, public :: idx_err_input_ps = 14 ! prepbufr invers obs error (hPa**-1) + integer, parameter, public :: idx_errinv_ps = 15 ! read_prepbufr invers obs error (hPa**-1) + integer, parameter, public :: idx_errinv_fnl_ps = 16 ! final invers obs error (HPa**-1) + integer, parameter, public :: idx_obs_ps = 17 ! surface pressure observation + integer, parameter, public :: idx_obsmg_adj_ps = 18 ! obs-ges used in analysis (coverted to hPa) + integer, parameter, public :: idx_obsmg_nadj_ps = 19 ! obs-ges w/o adjustment to guess surface pressure (hPa) + integer, parameter, public :: idx_spread_ps = 20 ! spread (filled in by EnKF) + + + !-------------------------------------------------- + ! index numbers into the rdiagbuf array + ! for type q obs + ! + ! (see setupq.f90 for more info) + ! + integer, parameter, public :: idx_obs_type_q = 1 ! obs type + integer, parameter, public :: idx_obs_subtype_q = 2 ! obs subtype + integer, parameter, public :: idx_obs_lat_q = 3 ! obs latitude + integer, parameter, public :: idx_obs_lon_q = 4 ! obs longitude + integer, parameter, public :: idx_stn_elev_q = 5 ! stn elevation + integer, parameter, public :: idx_pres_q = 6 ! obs pressure (hPa) + integer, parameter, public :: idx_hgt_q = 7 ! obs height (meters) + integer, parameter, public :: idx_time_q = 8 ! obs time (hrs relative to analysis time) + integer, parameter, public :: idx_iqc_q = 9 ! prepbufr qc or event mark + integer, parameter, public :: idx_var_jb_q = 10 ! non-linear qc param + integer, parameter, public :: idx_iuse_q = 11 ! read_prepbufr data usage flag + integer, parameter, public :: idx_anl_use_q = 12 ! analysis usage flag + integer, parameter, public :: idx_rwgt_q = 13 ! non-linear qc relative weight + integer, parameter, public :: idx_err_input_q = 14 ! prepbufr invers obs error + integer, parameter, public :: idx_errinv_q = 15 ! read_prepbufr invers obs error + integer, parameter, public :: idx_errinv_fnl_q = 16 ! final invers obs error + integer, parameter, public :: idx_obs_q = 17 ! surface pressure observation + integer, parameter, public :: idx_obsmg_adj_q = 18 ! obs-ges used in analysis + integer, parameter, public :: idx_obsmg_nadj_q = 19 ! obs-ges w/o adjustment to guess surface pressure + integer, parameter, public :: idx_ges_sat_q = 20 ! guess saturation specific + integer, parameter, public :: idx_spread_q = 21 ! spread (filled in by EnKF) + + + + !-------------------------------------------------- + ! index numbers into the rdiagbuf array + ! for type t obs + ! + ! (see setupt.f90 for more info) + ! + integer, parameter, public :: idx_obs_type_t = 1 ! obs type + integer, parameter, public :: idx_obs_subtype_t = 2 ! obs subtype + integer, parameter, public :: idx_obs_lat_t = 3 ! obs latitude + integer, parameter, public :: idx_obs_lon_t = 4 ! obs longitude + integer, parameter, public :: idx_stn_elev_t = 5 ! stn elevation + integer, parameter, public :: idx_pres_t = 6 ! obs pressure (hPa) + integer, parameter, public :: idx_hgt_t = 7 ! obs height (meters) + integer, parameter, public :: idx_time_t = 8 ! obs time (hrs relative to analysis time) + integer, parameter, public :: idx_iqc_t = 9 ! prepbufr qc or event mark + integer, parameter, public :: idx_setup_qc_t = 10 ! setup qc or event mark + integer, parameter, public :: idx_iuse_t = 11 ! read_prepbufr data usage flag + integer, parameter, public :: idx_anl_use_t = 12 ! analysis usage flag + integer, parameter, public :: idx_rwgt_t = 13 ! combination of var_jb and rwgt + integer, parameter, public :: idx_err_input_t = 14 ! prepbufr inverse obs error + integer, parameter, public :: idx_errinv_t = 15 ! read_prepbufr inverse obs error + integer, parameter, public :: idx_errinv_fnl_t = 16 ! final inverse obs error + integer, parameter, public :: idx_obs_t = 17 ! temperature obs (K) + integer, parameter, public :: idx_omgbc_t = 18 ! obs-ges used in analysis (K) + integer, parameter, public :: idx_omgnbc_t = 19 ! obs-ges w/o bias correction (K) + integer, parameter, public :: idx_pof_t = 20 ! data pof + integer, parameter, public :: idx_vv_t = 21 ! data vertical velocity + integer, parameter, public :: idx_pbias_one = 22 ! pred bias term 1 + integer, parameter, public :: idx_pbias_two = 23 ! pred bias term 2 + integer, parameter, public :: idx_pbias_three = 24 ! pred bias term 3 + integer, parameter, public :: idx_pbias_four = 25 ! pred bias term 4 + + + !-------------------------------------------------- + ! index numbers into the rdiagbuf array + ! for type uv obs + ! + ! (see setupw.f90 for more info) + ! + integer, parameter, public :: idx_obs_type_uv = 1 ! obs type + integer, parameter, public :: idx_obs_subtype_uv = 2 ! obs subtype + integer, parameter, public :: idx_obs_lat_uv = 3 ! obs latitude + integer, parameter, public :: idx_obs_lon_uv = 4 ! obs longitude + integer, parameter, public :: idx_stn_elev_uv = 5 ! stn elevation + integer, parameter, public :: idx_pres_uv = 6 ! obs pressure (hPa) + integer, parameter, public :: idx_hgt_uv = 7 ! obs height (meters) + integer, parameter, public :: idx_time_uv = 8 ! obs time (hrs relative to analysis time) + integer, parameter, public :: idx_iqc_uv = 9 ! prepbufr qc or event mark + integer, parameter, public :: idx_setup_qc_uv = 10 ! setup qc or event mark + integer, parameter, public :: idx_iuse_uv = 11 ! read_prepbufr data usage flag + integer, parameter, public :: idx_anl_use_uv = 12 ! analysis usage flag + integer, parameter, public :: idx_rwgt_uv = 13 ! combination of var_jb and rwgt + integer, parameter, public :: idx_err_input_uv = 14 ! prepbufr inverse obs error + integer, parameter, public :: idx_errinv_uv = 15 ! read_prepbufr inverse obs error + integer, parameter, public :: idx_errinv_fnl_uv = 16 ! final inverse obs error + integer, parameter, public :: idx_u_obs_uv = 17 ! u wind component observation + integer, parameter, public :: idx_u_omgbc_uv = 18 ! u obs-ges used in analysis (m/s) + integer, parameter, public :: idx_u_omgnbc_uv = 19 ! u obs-ges w/o bias correction (m/s) + integer, parameter, public :: idx_v_obs_uv = 20 ! v wind component observation + integer, parameter, public :: idx_v_omgbc_uv = 21 ! v obs-ges used in analysis (m/s) + integer, parameter, public :: idx_v_omgnbc_uv = 22 ! v obs-ges w/o bias correction (m/s) + + + !-------------------------------------------------- + ! index numbers into the rdiagbuf array + ! for type sst obs + ! + ! (see setupsst.f90 for more info) + ! + integer, parameter, public :: idx_obs_type_sst = 1 ! obs type + integer, parameter, public :: idx_obs_subtype_sst = 2 ! obs subtype + integer, parameter, public :: idx_obs_lat_sst = 3 ! obs latitude + integer, parameter, public :: idx_obs_lon_sst = 4 ! obs longitude + integer, parameter, public :: idx_stn_elev_sst = 5 ! stn elevation + integer, parameter, public :: idx_opn_wtr_tmp_sst = 6 ! background open water temperature + integer, parameter, public :: idx_depth_sst = 7 ! observation depth (meters) + integer, parameter, public :: idx_time_sst = 8 ! obs time (hrs relative to analysis time) + integer, parameter, public :: idx_opn_wtr_pct_sst = 9 ! open water percentage + integer, parameter, public :: idx_setup_qc_sst = 10 ! setup qc or event mark + integer, parameter, public :: idx_iuse_sst = 11 ! read_prepbufr data usage flag + integer, parameter, public :: idx_anl_use_sst = 12 ! analysis usage flag + integer, parameter, public :: idx_rwgt_sst = 13 ! combination of var_jb and rwgt + integer, parameter, public :: idx_err_input_sst = 14 ! prepbufr inverse obs error + integer, parameter, public :: idx_errinv_sst = 15 ! read_prepbufr inverse obs error + integer, parameter, public :: idx_errinv_fnl_sst = 16 ! final inverse obs error + integer, parameter, public :: idx_obs_sst = 17 ! SST observation (K) + integer, parameter, public :: idx_omgbc_sst = 18 ! obs-ges used in analysis (K) + integer, parameter, public :: idx_omgnbc_sst = 19 ! obs-ges w/o bias correction (K) + integer, parameter, public :: idx_type_sst = 20 ! type of measurment + integer, parameter, public :: idx_tr_sst = 21 ! Tr + integer, parameter, public :: idx_dt_warm_sst = 22 ! dt_warm at zob + integer, parameter, public :: idx_dt_cool_sst = 23 ! dt_cool at zob + integer, parameter, public :: idx_dtz_dtr_sst = 23 ! d(tz)/d(Tr) at zob + + + + !-------------------------------------------------- + ! index numbers into the rdiagbuf array + ! for type gps obs + ! + ! (see setupbend.f90 for more info) + ! + integer, parameter, public :: idx_obs_type_gps = 1 ! obs type + integer, parameter, public :: idx_obs_subtype_gps = 2 ! profile identifier + integer, parameter, public :: idx_obs_lat_gps = 3 ! obs latitude + integer, parameter, public :: idx_obs_lon_gps = 4 ! obs longitude + integer, parameter, public :: idx_bend_ang_gps = 5 ! incremental bending angle (x100 %) + integer, parameter, public :: idx_pres_gps = 6 ! pressure at obs location (hPa) + integer, parameter, public :: idx_height_gps = 7 ! impact height in meters + integer, parameter, public :: idx_time_gps = 8 ! obs time (hrs relative to analysis time) + integer, parameter, public :: idx_zsges_gps = 9 ! model terrain (m) + integer, parameter, public :: idx_setup_qc_gps = 10 ! setup qc or event mark + integer, parameter, public :: idx_iuse_gps = 11 ! read_prepbufr data usage flag + integer, parameter, public :: idx_anl_use_gps = 12 ! analysis usage flag + integer, parameter, public :: idx_rwgt_gps = 13 ! combination of var_jb and rwgt + integer, parameter, public :: idx_err_input_gps = 14 ! prepbufr inverse obs error + integer, parameter, public :: idx_errinv_gps = 15 ! read_prepbufr inverse obs error + integer, parameter, public :: idx_errinv_fnl_gps = 16 ! final inverse obs error + integer, parameter, public :: idx_obs_gps = 17 ! bending angle observation (radians) + integer, parameter, public :: idx_tref_gps = 18 ! temperature at obs location (K) + integer, parameter, public :: idx_hob_gps = 19 ! model vertival grid + integer, parameter, public :: idx_uses_gps = 20 ! uses gps_ref + integer, parameter, public :: idx_qref_gps = 21 ! specific humidity at obs location (kg/kg) + integer, parameter, public :: idx_spread_gps = 22 ! spread + + + ! Data is stored in data_t + type :: data_t + character(8) :: stn_id + real,dimension(25) :: rdiag + end type data_t + + ! A container for storing data_t pointers + type :: data_ptr + type(data_t), pointer :: p + end type data_ptr + +end module data diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_lev/generic_list.f90 b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_lev.fd/generic_list.f90 similarity index 100% rename from util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_lev/generic_list.f90 rename to util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_lev.fd/generic_list.f90 diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_lev/grads_lev.f90 b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_lev.fd/grads_lev.f90 similarity index 85% rename from util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_lev/grads_lev.f90 rename to util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_lev.fd/grads_lev.f90 index 19a2277e43..c537af29aa 100644 --- a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_lev/grads_lev.f90 +++ b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_lev.fd/grads_lev.f90 @@ -8,7 +8,7 @@ subroutine grads_lev(fileo,ifileo,nobs,nreal,nlev,plev,iscater,igrads,& - levcard,hint,isubtype,subtype,list) + levcard,hint,isubtype,subtype,list,run) use generic_list use data @@ -26,8 +26,9 @@ subroutine grads_lev(fileo,ifileo,nobs,nreal,nlev,plev,iscater,igrads,& character(8) :: stid character(3) :: subtype character(ifileo) :: fileo + character(3) :: run ! ges or anl - character(30) :: files,filegrad + character(30) :: files, filegrad, file_nobs character(10) :: levcard integer(4):: isubtype @@ -46,9 +47,11 @@ subroutine grads_lev(fileo,ifileo,nobs,nreal,nlev,plev,iscater,igrads,& plev2=plev-hint print *, '--> BEGIN grads_lev.x' - print *, 'nobs=',nobs - print *, 'fileo=',fileo - print *, 'nreal=', nreal + + print *, 'nobs = ',nobs + print *, 'fileo = ',fileo + print *, 'nreal = ', nreal + print *, 'subtype = ', subtype do i=1,nlev print *, 'i, plev2(i) = ', i, plev2(i) @@ -67,13 +70,11 @@ subroutine grads_lev(fileo,ifileo,nobs,nreal,nlev,plev,iscater,igrads,& ! Retrieve data from the linked list and load ! into the cdiag and rdiag_m2 arrays ! -! print *, 'Associated(list) = ', associated( list ) obs_ctr = 0 next => list do while ( associated( next ) == .TRUE. ) ptr = transfer(list_get( next ), ptr) -! print *, 'node data:', ptr%p next => list_next( next ) obs_ctr = obs_ctr + 1 @@ -84,26 +85,23 @@ subroutine grads_lev(fileo,ifileo,nobs,nreal,nlev,plev,iscater,igrads,& end do end do -! print *, 'obs_ctr (list) = ', obs_ctr - filegrad=trim(fileo)//'_'//trim(subtype)//'_grads' + filegrad=trim(fileo)//'_'//trim(subtype)//'.grads.'//trim(run) - print *, 'filegrad = ', filegrad if(iscater ==1) then print *, 'begin writing scatter data file' - files=trim(fileo)//'_'//trim(subtype)//'.scater' + files=trim(fileo)//'_'//trim(subtype)//'.scater.'//trim(run) open(51,file=files,form='unformatted') - write(51) nobs,nreal_m2 + write(51) nobs,nreal-2 write(51) rdiag_m2 close(51) print *, 'end writing scatter data file' endif - if (igrads ==1 .AND. nobs > 0) then ilat = idx_obs_lat -2 ! modified position of lat @@ -118,6 +116,7 @@ subroutine grads_lev(fileo,ifileo,nobs,nreal,nlev,plev,iscater,igrads,& ctr=0 do i=1,nobs + if(rdiag_m2(iweight,i) >0.0 ) then stid=cdiag(i) rlat=rdiag_m2(ilat,i) @@ -136,13 +135,16 @@ subroutine grads_lev(fileo,ifileo,nobs,nreal,nlev,plev,iscater,igrads,& ! the station id info write(31) plev2(k),(rdiag_m2(j,i),j=3,nreal_m2) ctr = ctr + 1 -! else -! print *, 'rdiag_m2(ipres,i), no match: ', rdiag_m2(ipres,i) + else + print *, 'rdiag_m2(ipres,i), no match: ', rdiag_m2(ipres,i) endif + endif + enddo -100 format(6e13.3) + +! 100 format(6e13.3) !============================== ! write the end of file marker @@ -152,6 +154,12 @@ subroutine grads_lev(fileo,ifileo,nobs,nreal,nlev,plev,iscater,igrads,& print *, 'obs written to file = ', ctr + + file_nobs=trim(fileo)//'_'//trim(subtype)//'.nobs.'//trim(run) + open( 32, file=file_nobs, form='formatted', status='new' ) + write(32,*) trim(fileo), ',', trim(subtype), ',', ctr + close( 32 ) + else write(6,*) "No output file generated, nobs, igrads = ", nobs, igrads endif @@ -182,10 +190,9 @@ function getpres(p1,plev,nlevs) real*4 p1 real*4,dimension(nlevs) :: plev - integer getpres,ip,ii,nlevs + integer getpres,ii,nlevs getpres = 0 -! ip = int(p1) do ii=1,nlevs if( p1 >=plev(ii) ) then diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radang.fd/kinds.F90 b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_lev.fd/kinds.F90 similarity index 100% rename from util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radang.fd/kinds.F90 rename to util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_lev.fd/kinds.F90 diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_lev/maingrads_lev.f90 b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_lev.fd/maingrads_lev.f90 similarity index 76% rename from util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_lev/maingrads_lev.f90 rename to util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_lev.fd/maingrads_lev.f90 index 982ad1733a..1c26d213e6 100644 --- a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_lev/maingrads_lev.f90 +++ b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_lev.fd/maingrads_lev.f90 @@ -2,7 +2,7 @@ ! maingrads_lev ! ! This program reads the conventional data and converts it into a GrADS -! data file. +! ready data file. ! ! The data is from a vertical profile having multiple levels. The ! hint value is the vertical level thickness, for example, level 925 @@ -11,26 +11,14 @@ use generic_list use data + use conmon_read_diag implicit none interface - subroutine read_conv2grads(ctype,stype,itype,nreal,nobs,isubtype,subtype,list) - use generic_list - character(3) :: ctype - character(10) :: stype - integer :: itype - integer :: nreal - integer :: nobs - integer :: isubtype - character(3) :: subtype - type(list_node_t),pointer :: list - end subroutine read_conv2grads - - subroutine grads_lev(fileo,ifileo,nobs,nreal,nlev,plev,iscater,igrads, & - levcard,hint,isubtype,subtype,list) + levcard,hint,isubtype,subtype,list,run) use generic_list integer ifileo @@ -41,6 +29,7 @@ subroutine grads_lev(fileo,ifileo,nobs,nreal,nlev,plev,iscater,igrads, & real*4 :: hint character(3) :: subtype type(list_node_t), pointer :: list + character(3) :: run end subroutine grads_lev end interface @@ -61,7 +50,12 @@ end subroutine grads_lev type(list_node_t), pointer :: next => null() type(data_ptr) :: ptr - namelist /input/intype,stype,itype,nreal,iscater,igrads,levcard,intv,subtype,isubtype + !--- namelist with defaults + logical :: netcdf = .false. + character(100) :: input_file = "conv_diag" + character(3) :: run = "ges" + namelist /input/input_file,intype,stype,itype,nreal,iscater,igrads,levcard,intv,subtype,isubtype,netcdf,run + data pacft /700.,600.,500.,400.,300.,100./ data palllev /950.,850.,700.,600.,500.,400.,300.,250.,200.,100./ data plowlev /950.,850.,700./ @@ -74,6 +68,7 @@ end subroutine grads_lev write(6,*) '----> BEGIN maingrads_lev' + write(6,*) ' levcard = ', levcard read(5,input) write(6,*)' User input:' write(6,input) @@ -81,23 +76,24 @@ end subroutine grads_lev lstype=len_trim(stype) hint=real(intv) - call read_conv2grads( intype,stype,itype,nreal,nobs,isubtype,subtype,list ) - - print *, 'AFTER read_conv2grads, nreal =', nreal + write(6,*)'netcdf =', netcdf + call set_netcdf_read( netcdf ) + call conmon_read_diag_file( input_file,intype,itype,nreal,nobs,isubtype,list ) + if( nobs > 0 ) then if(trim(levcard) == 'alllev' ) then call grads_lev(stype,lstype,nobs,nreal,n_alllev,palllev,iscater, & - igrads,levcard,hint,isubtype,subtype,list) + igrads,levcard,hint,isubtype,subtype,list,run) else if (trim(levcard) == 'acft' ) then call grads_lev(stype,lstype,nobs,nreal,n_acft,pacft,iscater,igrads,& - levcard,hint,isubtype,subtype,list) + levcard,hint,isubtype,subtype,list,run) else if(trim(levcard) == 'lowlev' ) then call grads_lev(stype,lstype,nobs,nreal,n_lowlev,plowlev,iscater,& - igrads,levcard,hint,isubtype,subtype,list) + igrads,levcard,hint,isubtype,subtype,list,run) else if(trim(levcard) == 'upair' ) then call grads_lev(stype,lstype,nobs,nreal,n_upair,pupair,iscater,& - igrads,levcard,hint,isubtype,subtype,list) + igrads,levcard,hint,isubtype,subtype,list,run) end if else print *, 'NOBS <= 0, NO OUTPUT GENERATED' diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_lev/makefile.grads_lev b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_lev.fd/makefile.grads_lev similarity index 97% rename from util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_lev/makefile.grads_lev rename to util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_lev.fd/makefile.grads_lev index 2335e12a63..7b5c294147 100755 --- a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_lev/makefile.grads_lev +++ b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_lev.fd/makefile.grads_lev @@ -13,7 +13,7 @@ SRCS= data_mod.f90 generic_list.f90 maingrads_lev.f90 read_conv2grads.f9 OBJS= data_mod.o generic_list.o maingrads_lev.o read_conv2grads.o grads_lev.o rm_dups.o convinfo.o -CMD= grads_lev.x +CMD= conmon_grads_lev.x all: $(CMD) diff --git a/util/Conventional_Monitor/image_gen/sorc/read_ps/rm_dups.f90 b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_lev.fd/rm_dups.f90 similarity index 100% rename from util/Conventional_Monitor/image_gen/sorc/read_ps/rm_dups.f90 rename to util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_lev.fd/rm_dups.f90 diff --git a/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_mandlev.fd/CMakeLists.txt b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_mandlev.fd/CMakeLists.txt new file mode 100644 index 0000000000..5184f30514 --- /dev/null +++ b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_mandlev.fd/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.6) + file(GLOB CONMON_GRADS_MANDLEV_SRC ${CMAKE_CURRENT_SOURCE_DIR}/*90 ) + set(CONMON_GRADS_MANDLEV_Fortran_FLAGS "-fp-model strict -assume byterecl -convert big_endian -O3 -traceback -D_REAL8_ ") + set(Util_MODULE_DIR ${PROJECT_BINARY_DIR}/include/conmon_grads_mandlev ) + + set_source_files_properties( ${CONMON_GRADS_MANDLEV_SRC} PROPERTIES COMPILE_FLAGS ${CONMON_GRADS_MANDLEV_Fortran_FLAGS} ) + add_executable(conmon_grads_mandlev.x ${CONMON_GRADS_MANDLEV_SRC} ) + set_target_properties( conmon_grads_mandlev.x PROPERTIES COMPILE_FLAGS ${CONMON_GRADS_MANDLEV_Fortran_FLAGS} ) + set_target_properties( conmon_grads_mandlev.x PROPERTIES Fortran_MODULE_DIRECTORY ${Util_MODULE_DIR} ) + + include_directories( ${CORE_INCS} ${NCDIAG_INCS} ) + + target_link_libraries( conmon_grads_mandlev.x ${W3NCO_4_LIBRARY} ${NCDIAG_LIBRARIES} ${NETCDF_Fortran_LIBRARIES} + ${NETCDF_C_LIBRARIES} ${MPI_Fortran_LIBRARIES} ) + + if(BUILD_W3NCO) + add_dependencies( conmon_grads_mandlev.x ${W3NCO_4_LIBRARY} ) + endif() + diff --git a/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_mandlev.fd/conmon_read_diag.F90 b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_mandlev.fd/conmon_read_diag.F90 new file mode 100644 index 0000000000..0b7afcf067 --- /dev/null +++ b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_mandlev.fd/conmon_read_diag.F90 @@ -0,0 +1,1839 @@ +!---------------------------------------------------------------------- +! conmon_read_diag +! +! This subroutine reads the conventional data assimilation +! diagnostic files (contained in the cnvstat tar file) and returns +! the requested obs that match the input type and subtype in a +! linked list. The diagnostic files may be in either binary or +! NetCDF format. +! +! Note: +! There are problems/mismatches between the contents of binary +! and NetCDF files for types gps and sst. +!---------------------------------------------------------------------- + +module conmon_read_diag + + !--- use ---! + use generic_list + use data + use kinds, only: i_kind,r_single,r_kind + + use nc_diag_read_mod, only: nc_diag_read_init, nc_diag_read_close, & + nc_diag_read_get_dim, nc_diag_read_get_global_attr, & + nc_diag_read_get_var_names, & + nc_diag_read_get_global_attr_names, & + nc_diag_read_get_var, nc_diag_read_get_dim_names + + use ncdr_vars, only: nc_diag_read_check_var + use ncdr_dims, only: nc_diag_read_check_dim + + + !--- implicit ---! + implicit none + + + !--- public & private ---! + private + + public :: set_netcdf_read + public :: conmon_read_diag_file + public :: conmon_return_all_obs + + interface load_nc_var + module procedure load_nc_var_int, load_nc_var_real, load_nc_var_char + end interface + + + !--- common data structures ---! + logical,save :: netcdf = .false. + + integer(i_kind), parameter :: MAX_OPEN_NCDIAG = 2 + integer(i_kind), save :: nopen_ncdiag = 0 + integer(i_kind), dimension(MAX_OPEN_NCDIAG), save :: ncdiag_open_id = (/-1, -1/) + + type ncdiag_status + logical :: nc_read + integer(i_kind) :: cur_ob_idx + integer(i_kind) :: num_records + end type ncdiag_status + + type(ncdiag_status), dimension(MAX_OPEN_NCDIAG), save :: ncdiag_open_status + + + + contains + + + subroutine load_nc_var_int( var_name, ftin, var_storage, ierr ) + character(len=*), intent(in) :: var_name + integer, intent(in) :: ftin + integer, dimension(:), allocatable, intent(out) :: var_storage + integer, intent(out) :: ierr + + if( nc_diag_read_check_var( var_name )) then + call nc_diag_read_get_var( ftin, var_name, var_storage ) + ierr = 0 + else + print *, 'WARNING: unable to read ', trim( var_name ) + ierr = 1 + end if + end subroutine + + + subroutine load_nc_var_real( var_name, ftin, var_storage, ierr ) + character(len=*), intent(in) :: var_name + integer, intent(in) :: ftin + real(r_single), dimension(:), allocatable, intent(out) :: var_storage + integer, intent(out) :: ierr + + if( nc_diag_read_check_var( var_name )) then + call nc_diag_read_get_var( ftin, var_name, var_storage ) + ierr=0 + else + print *, 'WARNING: unable to read ', trim( var_name ) + ierr=1 + end if + end subroutine + + + subroutine load_nc_var_char( var_name, ftin, var_storage, ierr ) + character(len=*), intent(in) :: var_name + integer, intent(in) :: ftin + character(len=:), dimension(:), allocatable, intent(out) :: var_storage + integer, intent(out) :: ierr + + if( nc_diag_read_check_var( var_name )) then + call nc_diag_read_get_var( ftin, var_name, var_storage ) + ierr=0 + else + print *, 'WARNING: unable to read ', trim( var_name ) + ierr=1 + end if + end subroutine + + + + !------------------------------------------------------------ + ! set_netcdf_read + ! + ! set the use_netcdf flag to signal binary (default) or + ! netcdf formatted diagnostic files. + !------------------------------------------------------------ + subroutine set_netcdf_read( use_netcdf ) + logical,intent(in) :: use_netcdf + + netcdf = use_netcdf + + end subroutine set_netcdf_read + + + + !--------------------------------------------------------------- + ! conmon_read_diag_file + ! + ! Public routine to read a conventional diagnostic file + ! + ! Obs in the input_file are returned in the list according + ! to these rules: + ! + ! 1. All obs matching intype and in_subtype are returned. + ! + ! 2. If there are no subtype values in the input_file then + ! all obs matching intype are returned. + ! + !--------------------------------------------------------------- + subroutine conmon_read_diag_file( input_file, ctype, intype, expected_nreal, nobs, in_subtype, list ) + + !--- interface + character(100), intent(in) :: input_file + character(3), intent(in) :: ctype + + !--- note expected_nreal has no meaning for netcdf files + integer, intent(in) :: intype, expected_nreal, in_subtype + integer, intent(out) :: nobs + type(list_node_t), pointer :: list + logical :: return_all = .false. + + write(6,*)'--> conmon_read_diag_file' + + if ( netcdf ) then + write(6,*) ' call nc read subroutine' + call read_diag_file_nc( input_file, return_all, ctype, intype, expected_nreal, nobs, in_subtype, list ) + else + call read_diag_file_bin( input_file,return_all, ctype, intype, expected_nreal,nobs,in_subtype, list ) + end if + + write(6,*)"<-- conmon_read_diag_file" + + end subroutine conmon_read_diag_file + + + + !------------------------------------------------------------------ + ! conmon_return_all_obs + ! + ! Retrieve all obs from a given conventional diagnostic file. + ! Note that the NetCDF formatted diag files always contain only + ! one conventional data type (gps, ps, q, sst, t, uv), while + ! binary formatted diag files contain all types for a single + ! ges or anl run. + ! + ! Note: the ctype parameter only has meaning for NetCDF + ! formatted diag files. + !------------------------------------------------------------------ + subroutine conmon_return_all_obs( input_file, ctype, nobs, list ) + + !--- interface + character(100), intent(in) :: input_file + character(3), intent(in) :: ctype + integer, intent(out) :: nobs + type(list_node_t), pointer :: list + + logical :: return_all = .true. + integer :: intype, expected_nreal, in_subtype + + write(6,*)'--> conmon_return_all_obs' + nobs = 0 + + ! + ! Q: Can I re-use the read_diag_* to do this read, + ! adding extra param(s) to switch on _all_ obs? + ! Those routines are private to this module so + ! that wouldn't pose a complexity problem for + ! accessing the routines. + ! + if ( netcdf ) then + write(6,*) ' call nc retrieve all routine' + call read_diag_file_nc( input_file, return_all, ctype, intype, expected_nreal, nobs, in_subtype, list ) + else + write(6,*) ' call bin retrieve all routine' + call read_diag_file_bin( input_file,return_all, ctype, intype, expected_nreal,nobs,in_subtype, list ) + end if + + write(6,*)'<-- conmon_return_all_obs' + + end subroutine conmon_return_all_obs + + + !------------------------------- + ! read_diag_file_nc + ! + ! NetCDF read routine + !------------------------------- + subroutine read_diag_file_nc( input_file, return_all, ctype, intype, expected_nreal, nobs, in_subtype, list ) + + !--- interface + character(100), intent(in) :: input_file + logical, intent(in) :: return_all + character(3), intent(in) :: ctype + integer, intent(in) :: intype, expected_nreal, in_subtype + integer, intent(out) :: nobs + type(list_node_t), pointer :: list + + !--- local vars + type(list_node_t), pointer :: next => null() + type(data_ptr) :: ptr + integer :: ii, ierr, istatus, ftin, total_obs, id, idx + + data ftin / 11 / + + + print *, ' ' + print *, ' --> read_diag_file_nc' + print *, ' ctype, intype, in_subtype = ', ctype, intype, in_subtype + nobs = 0 + ierr = 0 + + if (nopen_ncdiag >= MAX_OPEN_NCDIAG) then + write(6,*) 'OPEN_RADIAG: ***ERROR*** Cannot open more than ', & + MAX_OPEN_NCDIAG, ' netcdf diag files.' + endif + + call nc_diag_read_init( input_file, ftin ) + istatus=0 + + do ii = 1, MAX_OPEN_NCDIAG + + if( ncdiag_open_id(ii) < 0 ) then + ncdiag_open_id(ii) = ftin + ncdiag_open_status(ii)%nc_read = .false. + + ncdiag_open_status(ii)%cur_ob_idx = -9999 + ncdiag_open_status(ii)%num_records = -9999 + nopen_ncdiag = nopen_ncdiag + 1 + exit + endif + + enddo + + select case ( trim( adjustl( ctype ) ) ) + + case ( 'gps' ) + call read_diag_file_gps_nc( input_file, return_all, ftin, ctype, intype, expected_nreal, nobs, in_subtype, list ) + + case ( 'ps' ) + call read_diag_file_ps_nc( input_file, return_all, ftin, ctype, intype, expected_nreal, nobs, in_subtype, list ) + + case ( 'q' ) + call read_diag_file_q_nc( input_file, return_all, ftin, ctype, intype, expected_nreal, nobs, in_subtype, list ) + + case ( 'sst' ) + call read_diag_file_sst_nc( input_file, return_all, ftin, ctype, intype, expected_nreal, nobs, in_subtype, list ) + + case ( 't' ) + call read_diag_file_t_nc( input_file, return_all, ftin, ctype, intype, expected_nreal, nobs, in_subtype, list ) + + case ( 'uv' ) + call read_diag_file_uv_nc( input_file, return_all, ftin, ctype, intype, expected_nreal, nobs, in_subtype, list ) + + case default + print *, 'ERROR: unmatched ctype :', ctype + + end select + + + id = find_ncdiag_id(ftin) + if (id < 0) then + write(6,*) 'CLOSE_RADIAG: ***ERROR*** ncdiag file ', input_file, & + ' was not opened' + endif + + call nc_diag_read_close( input_file ) + ncdiag_open_id(id) = -1 + + ncdiag_open_status(id)%nc_read = .false. + ncdiag_open_status(id)%cur_ob_idx = -9999 + ncdiag_open_status(id)%num_records = -9999 + + nopen_ncdiag = nopen_ncdiag - 1 + + print *, ' ' + print *, ' <-- read_diag_file_nc, ierr = ', ierr + + + end subroutine read_diag_file_nc + + + !--------------------------------------------------------- + ! netcdf read routine for ps data types in netcdf files + ! + subroutine read_diag_file_ps_nc( input_file, return_all, ftin, ctype, intype,expected_nreal,nobs,in_subtype, list ) + + !--- interface + character(100), intent(in) :: input_file + logical, intent(in) :: return_all + integer, intent(in) :: ftin + character(3), intent(in) :: ctype + integer, intent(in) :: intype, expected_nreal, in_subtype + integer, intent(out) :: nobs + type(list_node_t), pointer :: list + + !--- local vars + type(list_node_t), pointer :: next => null() + type(data_ptr) :: ptr + integer :: ii, ierr, istatus, total_obs, idx + logical :: have_subtype = .true. + logical :: add_obs + + !--- NetCDF file components dimension(s) + ! + character(len=:), dimension(:), allocatable :: Station_ID ! (nobs, Station_ID_maxstrlen) + character(len=:), dimension(:), allocatable :: Observation_Class ! (nobs, Station_Class_maxstrlen) + integer, dimension(:), allocatable :: Observation_Type ! (obs) + integer, dimension(:), allocatable :: Observation_Subtype ! (obs) + real(r_single), dimension(:), allocatable :: Latitude ! (obs) + real(r_single), dimension(:), allocatable :: Longitude ! (obs) + real(r_single), dimension(:), allocatable :: Station_Elevation ! (obs) + real(r_single), dimension(:), allocatable :: Pressure ! (obs) + real(r_single), dimension(:), allocatable :: Height ! (obs) + real(r_single), dimension(:), allocatable :: Time ! (obs) + real(r_single), dimension(:), allocatable :: Prep_QC_Mark ! (obs) + real(r_single), dimension(:), allocatable :: Prep_Use_Flag ! (obs) + real(r_single), dimension(:), allocatable :: Nonlinear_QC_Var_Jb ! (obs) + real(r_single), dimension(:), allocatable :: Nonlinear_QC_Rel_Wgt ! (obs) + real(r_single), dimension(:), allocatable :: Analysis_Use_Flag ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Input ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Adjust ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Final ! (obs) + real(r_single), dimension(:), allocatable :: Observation ! (obs) + real(r_single), dimension(:), allocatable :: Obs_Minus_Forecast_adjusted ! (obs) + real(r_single), dimension(:), allocatable :: Obs_Minus_Forecast_unadjusted ! (obs) + integer(i_kind) :: idate + + print *, ' ' + print *, ' --> read_diag_file_ps_nc' + + + !--- get NetCDF file dimensions + ! + if( nc_diag_read_check_dim( 'nobs' )) then + total_obs = nc_diag_read_get_dim(ftin,'nobs') + ncdiag_open_status(ii)%num_records = total_obs + print *, ' total_obs = ', total_obs + else + print *, 'ERROR: unable to read nobs' + ierr=1 + end if + + + !--- get vars + + call load_nc_var( 'Station_ID', ftin, Station_ID, ierr ) + call load_nc_var( 'Observation_Class', ftin, Observation_Class, ierr ) + call load_nc_var( 'Observation_Type', ftin, Observation_Type, ierr ) + call load_nc_var( 'Observation_Subtype', ftin, Observation_Subtype, ierr ) + if( ierr == 1 ) then + have_subtype = .false. + end if + call load_nc_var( 'Latitude', ftin, Latitude, ierr ) + call load_nc_var( 'Longitude', ftin, Longitude, ierr ) + call load_nc_var( 'Station_Elevation', ftin, Station_Elevation, ierr ) + call load_nc_var( 'Pressure', ftin, Pressure, ierr ) + call load_nc_var( 'Height', ftin, Height, ierr ) + call load_nc_var( 'Time', ftin, Time, ierr ) + call load_nc_var( 'Prep_QC_Mark', ftin, Prep_QC_Mark, ierr ) + call load_nc_var( 'Nonlinear_QC_Var_Jb', ftin, Nonlinear_QC_Var_Jb, ierr ) + call load_nc_var( 'Nonlinear_QC_Rel_Wgt', ftin, Nonlinear_QC_Rel_Wgt, ierr ) + call load_nc_var( 'Prep_Use_Flag', ftin, Prep_Use_Flag, ierr ) + call load_nc_var( 'Analysis_Use_Flag', ftin, Analysis_Use_Flag, ierr ) + call load_nc_var( 'Errinv_Input', ftin, Errinv_Input, ierr ) + call load_nc_var( 'Errinv_Adjust', ftin, Errinv_Adjust, ierr ) + call load_nc_var( 'Errinv_Final', ftin, Errinv_Final, ierr ) + call load_nc_var( 'Observation', ftin, Observation, ierr ) + call load_nc_var( 'Obs_Minus_Forecast_adjusted', ftin, Obs_Minus_Forecast_adjusted, ierr ) + call load_nc_var( 'Obs_Minus_Forecast_unadjusted', ftin, Obs_Minus_Forecast_unadjusted, ierr ) + + + + !--------------------------------------------------------------- + ! Process all obs. If type and subtype match the input values + ! add this obs to the linked list (ptr%p). + ! + nobs = 0 + do ii = 1, total_obs + + + add_obs = .false. + + !------------------------------------------------------------------------ + ! Check on Observation_Class to ctype is a sanity check -- + ! only a single class of obs are in any given NetCDF formatted diag file + ! but, if the ctype and input file don't match, things could get + ! interesting (but not in a good way). + ! + if( adjustl( trim( Observation_Class(ii) )) == adjustl( trim( ctype ))) then + + if( return_all == .true. ) then + add_obs = .true. + + else if( Observation_Type(ii) == intype ) then + + if( have_subtype == .false. ) then + add_obs = .true. + else if( Observation_Subtype(ii) == in_subtype ) then + add_obs = .true. + end if + + end if + end if + + if( add_obs == .true. ) then + + nobs=nobs+1 + + !--------------------------------------------- + ! Allocate a new data element and load + ! + allocate( ptr%p ) + ptr%p%stn_id = Station_ID( ii ) + + do idx=1,max_rdiag_reals + ptr%p%rdiag( idx ) = 0.00 + end do + + if( allocated( Observation_Type )) ptr%p%rdiag( idx_obs_type_ps ) = Observation_Type( ii ) + if( allocated( Observation_Subtype )) ptr%p%rdiag( idx_obs_subtype_ps ) = Observation_Subtype( ii ) + if( allocated( Latitude )) ptr%p%rdiag( idx_obs_lat_ps ) = Latitude( ii ) + if( allocated( Longitude )) ptr%p%rdiag( idx_obs_lon_ps ) = Longitude( ii ) + if( allocated( Station_Elevation )) ptr%p%rdiag( idx_stn_elev_ps ) = Station_Elevation( ii ) + if( allocated( Pressure )) ptr%p%rdiag( idx_pres_ps ) = Pressure( ii ) + if( allocated( Height )) ptr%p%rdiag( idx_hgt_ps ) = Height( ii ) + if( allocated( Time )) ptr%p%rdiag( idx_time_ps ) = Time( ii ) + if( allocated( Prep_QC_Mark )) ptr%p%rdiag( idx_iqc_ps ) = Prep_QC_Mark( ii ) + if( allocated( Nonlinear_QC_Var_Jb )) ptr%p%rdiag( idx_var_jb_ps ) = Nonlinear_QC_Var_Jb( ii ) + if( allocated( Prep_Use_Flag )) ptr%p%rdiag( idx_iuse_ps ) = Prep_Use_Flag( ii ) + if( allocated( Analysis_Use_Flag )) ptr%p%rdiag( idx_anl_use_ps ) = Analysis_Use_Flag( ii ) + if( allocated( Nonlinear_QC_Rel_Wgt )) ptr%p%rdiag( idx_rwgt_ps ) = Nonlinear_QC_Rel_Wgt( ii ) + if( allocated( Errinv_Input )) ptr%p%rdiag( idx_err_input_ps ) = Errinv_Input( ii ) + if( allocated( Errinv_Adjust )) ptr%p%rdiag( idx_errinv_ps ) = Errinv_Adjust( ii ) + if( allocated( Errinv_Final )) ptr%p%rdiag( idx_errinv_fnl_ps ) = Errinv_Final( ii ) + if( allocated( Observation )) ptr%p%rdiag( idx_obs_ps ) = Observation( ii ) + if( allocated( Obs_Minus_Forecast_adjusted )) ptr%p%rdiag( idx_obsmg_adj_ps ) = Obs_Minus_Forecast_adjusted( ii ) + if( allocated( Obs_Minus_Forecast_unadjusted )) ptr%p%rdiag( idx_obsmg_nadj_ps ) = Obs_Minus_Forecast_unadjusted( ii ) + + if( nobs == 1 ) then + !------------------------------------------------- + ! Initialize the list with the first data element + ! + call list_init(list, transfer(ptr, list_data)) + next => list + + else + !------------------------------------------------- + ! Insert subsequent nodes into the list + ! + call list_insert(next, transfer(ptr, list_data)) + next => list_next(next) + end if + + end if + + end do + + + if( allocated( Station_ID )) deallocate( Station_ID ) + if( allocated( Observation_Class )) deallocate( Observation_Class ) + if( allocated( Observation_Type )) deallocate( Observation_Type ) + if( allocated( Observation_Subtype )) deallocate( Observation_Subtype ) + if( allocated( Latitude )) deallocate( Latitude ) + if( allocated( Longitude )) deallocate( Longitude ) + if( allocated( Station_Elevation )) deallocate( Station_Elevation ) + if( allocated( Time )) deallocate( Time ) + if( allocated( Prep_QC_Mark )) deallocate( Prep_QC_Mark ) + if( allocated( Prep_Use_Flag )) deallocate( Prep_Use_Flag ) + if( allocated( Nonlinear_QC_Var_Jb )) deallocate( Nonlinear_QC_Var_Jb ) + if( allocated( Nonlinear_QC_Rel_Wgt )) deallocate( Nonlinear_QC_Rel_Wgt ) + if( allocated( Analysis_Use_Flag )) deallocate( Analysis_Use_Flag ) + if( allocated( Errinv_Input )) deallocate( Errinv_Input ) + if( allocated( Errinv_Adjust )) deallocate( Errinv_Final ) + if( allocated( Errinv_Final )) deallocate( Errinv_Final ) + if( allocated( Observation )) deallocate( Observation ) + if( allocated( Obs_Minus_Forecast_adjusted )) deallocate( Obs_Minus_Forecast_adjusted ) + if( allocated( Obs_Minus_Forecast_unadjusted )) deallocate( Obs_Minus_Forecast_unadjusted ) + + print *, ' ' + print *, ' <-- read_diag_file_ps_nc' + + end subroutine read_diag_file_ps_nc + + + !--------------------------------------------------------- + ! netcdf read routine for q data types in netcdf files + ! + subroutine read_diag_file_q_nc( input_file, return_all, ftin, ctype, intype,expected_nreal,nobs,in_subtype, list ) + + !--- interface + character(100), intent(in) :: input_file + logical, intent(in) :: return_all + integer, intent(in) :: ftin + character(3), intent(in) :: ctype + integer, intent(in) :: intype, expected_nreal, in_subtype + integer, intent(out) :: nobs + type(list_node_t), pointer :: list + + !--- local vars + type(list_node_t), pointer :: next => null() + type(data_ptr) :: ptr + integer :: ii, ierr, istatus, total_obs, idx + logical :: have_subtype = .true. + logical :: add_obs + + !--- NetCDF file components dimension(s) + ! + character(len=:), dimension(:), allocatable :: Station_ID ! (nobs, Station_ID_maxstrlen) + character(len=:), dimension(:), allocatable :: Observation_Class ! (nobs, Station_Class_maxstrlen) + integer, dimension(:), allocatable :: Observation_Type ! (obs) + integer, dimension(:), allocatable :: Observation_Subtype ! (obs) + real(r_single), dimension(:), allocatable :: Latitude ! (obs) + real(r_single), dimension(:), allocatable :: Longitude ! (obs) + real(r_single), dimension(:), allocatable :: Station_Elevation ! (obs) + real(r_single), dimension(:), allocatable :: Pressure ! (obs) + real(r_single), dimension(:), allocatable :: Height ! (obs) + real(r_single), dimension(:), allocatable :: Time ! (obs) + real(r_single), dimension(:), allocatable :: Prep_QC_Mark ! (obs) + real(r_single), dimension(:), allocatable :: Prep_Use_Flag ! (obs) + real(r_single), dimension(:), allocatable :: Nonlinear_QC_Var_Jb ! (obs) + real(r_single), dimension(:), allocatable :: Nonlinear_QC_Rel_Wgt ! (obs) + real(r_single), dimension(:), allocatable :: Analysis_Use_Flag ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Input ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Adjust ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Final ! (obs) + real(r_single), dimension(:), allocatable :: Observation ! (obs) + real(r_single), dimension(:), allocatable :: Obs_Minus_Forecast_adjusted ! (obs) + real(r_single), dimension(:), allocatable :: Obs_Minus_Forecast_unadjusted ! (obs) + real(r_single), dimension(:), allocatable :: Forecast_Saturation_Spec_Hum ! (obs) + integer(i_kind) :: idate + + print *, ' ' + print *, ' --> read_diag_file_q_nc' + + + !--- get NetCDF file dimensions + ! + if( nc_diag_read_check_dim( 'nobs' )) then + total_obs = nc_diag_read_get_dim(ftin,'nobs') + ncdiag_open_status(ii)%num_records = total_obs + print *, ' total_obs = ', total_obs + else + print *, 'ERROR: unable to read nobs' + ierr=1 + end if + + + !--- get vars + + call load_nc_var( 'Station_ID', ftin, Station_ID, ierr ) + call load_nc_var( 'Observation_Class', ftin, Observation_Class, ierr ) + call load_nc_var( 'Observation_Type', ftin, Observation_Type, ierr ) + call load_nc_var( 'Observation_Subtype', ftin, Observation_Subtype, ierr ) + if( ierr == 1 ) then + have_subtype = .false. + end if + call load_nc_var( 'Latitude', ftin, Latitude, ierr ) + call load_nc_var( 'Longitude', ftin, Longitude, ierr ) + call load_nc_var( 'Station_Elevation', ftin, Station_Elevation, ierr ) + call load_nc_var( 'Pressure', ftin, Pressure, ierr ) + call load_nc_var( 'Height', ftin, Height, ierr ) + call load_nc_var( 'Time', ftin, Time, ierr ) + call load_nc_var( 'Prep_QC_Mark', ftin, Prep_QC_Mark, ierr ) + call load_nc_var( 'Nonlinear_QC_Var_Jb', ftin, Nonlinear_QC_Var_Jb, ierr ) + call load_nc_var( 'Nonlinear_QC_Rel_Wgt', ftin, Nonlinear_QC_Rel_Wgt, ierr ) + call load_nc_var( 'Prep_Use_Flag', ftin, Prep_Use_Flag, ierr ) + call load_nc_var( 'Analysis_Use_Flag', ftin, Analysis_Use_Flag, ierr ) + call load_nc_var( 'Errinv_Input', ftin, Errinv_Input, ierr ) + call load_nc_var( 'Errinv_Adjust', ftin, Errinv_Adjust, ierr ) + call load_nc_var( 'Errinv_Final', ftin, Errinv_Final, ierr ) + call load_nc_var( 'Observation', ftin, Observation, ierr ) + call load_nc_var( 'Obs_Minus_Forecast_adjusted', ftin, Obs_Minus_Forecast_adjusted, ierr ) + call load_nc_var( 'Obs_Minus_Forecast_unadjusted', ftin, Obs_Minus_Forecast_unadjusted, ierr ) + call load_nc_var( 'Forecast_Saturation_Spec_Hum', ftin, Forecast_Saturation_Spec_Hum, ierr ) + + + + !--------------------------------------------------------------- + ! Process all obs. If type and subtype match the input values + ! add this obs to the linked list (ptr%p). + ! + nobs = 0 + do ii = 1, total_obs + + add_obs = .false. + + !------------------------------------------------------------------------ + ! Check on Observation_Class to ctype is a sanity check -- + ! only a single class of obs are in any given NetCDF formatted diag file + ! but, if the ctype and input file don't match, things could get + ! interesting (but not in a good way). + ! + if( adjustl( trim( Observation_Class(ii) )) == adjustl( trim( ctype ))) then + + if( return_all == .true. ) then + add_obs = .true. + + else if( Observation_Type(ii) == intype ) then + + if( have_subtype == .false. ) then + add_obs = .true. + else if( Observation_Subtype(ii) == in_subtype ) then + add_obs = .true. + end if + + end if + end if + + + if( add_obs == .true. ) then + + nobs=nobs+1 + + !--------------------------------------------- + ! Allocate a new data element and load + ! + allocate(ptr%p) + ptr%p%stn_id = Station_ID( ii ) + + do idx=1,max_rdiag_reals + ptr%p%rdiag( idx ) = 0.00 + end do + + if( allocated( Observation_Type )) ptr%p%rdiag( idx_obs_type_q ) = Observation_Type( ii ) + if( allocated( Observation_Subtype )) ptr%p%rdiag( idx_obs_subtype_q ) = Observation_Subtype( ii ) + if( allocated( Latitude )) ptr%p%rdiag( idx_obs_lat_q ) = Latitude( ii ) + if( allocated( Longitude )) ptr%p%rdiag( idx_obs_lon_q ) = Longitude( ii ) + if( allocated( Station_Elevation )) ptr%p%rdiag( idx_stn_elev_q ) = Station_Elevation( ii ) + if( allocated( Pressure )) ptr%p%rdiag( idx_pres_q ) = Pressure( ii ) + if( allocated( Height )) ptr%p%rdiag( idx_hgt_q ) = Height( ii ) + if( allocated( Time )) ptr%p%rdiag( idx_time_q ) = Time( ii ) + if( allocated( Prep_QC_Mark )) ptr%p%rdiag( idx_iqc_q ) = Prep_QC_Mark( ii ) + if( allocated( Nonlinear_QC_Var_Jb )) ptr%p%rdiag( idx_var_jb_q ) = Nonlinear_QC_Var_Jb( ii ) + if( allocated( Prep_Use_Flag )) ptr%p%rdiag( idx_iuse_q ) = Prep_Use_Flag( ii ) + if( allocated( Analysis_Use_Flag )) ptr%p%rdiag( idx_anl_use_q ) = Analysis_Use_Flag( ii ) + if( allocated( Nonlinear_QC_Rel_Wgt )) ptr%p%rdiag( idx_rwgt_q ) = Nonlinear_QC_Rel_Wgt( ii ) + if( allocated( Errinv_Input )) ptr%p%rdiag( idx_err_input_q ) = Errinv_Input( ii ) + if( allocated( Errinv_Adjust )) ptr%p%rdiag( idx_errinv_q ) = Errinv_Adjust( ii ) + if( allocated( Errinv_Final )) ptr%p%rdiag( idx_errinv_fnl_q ) = Errinv_Final( ii ) + if( allocated( Observation )) ptr%p%rdiag( idx_obs_q ) = Observation( ii ) + if( allocated( Obs_Minus_Forecast_adjusted )) ptr%p%rdiag( idx_obsmg_adj_q ) = Obs_Minus_Forecast_adjusted( ii ) + if( allocated( Obs_Minus_Forecast_unadjusted )) ptr%p%rdiag( idx_obsmg_nadj_q ) = Obs_Minus_Forecast_unadjusted( ii ) + if( allocated( Forecast_Saturation_Spec_Hum )) ptr%p%rdiag( idx_ges_sat_q ) = Forecast_Saturation_Spec_Hum( ii ) + + + if( nobs == 1 ) then + !------------------------------------------------- + ! Initialize the list with the first data element + ! + call list_init(list, transfer(ptr, list_data)) + next => list + + else + !------------------------------------------------- + ! Insert subsequent nodes into the list + ! + call list_insert(next, transfer(ptr, list_data)) + next => list_next(next) + end if + + end if + + end do + + + if( allocated( Station_ID )) deallocate( Station_ID ) + if( allocated( Observation_Class )) deallocate( Observation_Class ) + if( allocated( Observation_Type )) deallocate( Observation_Type ) + if( allocated( Observation_Subtype )) deallocate( Observation_Subtype ) + if( allocated( Latitude )) deallocate( Latitude ) + if( allocated( Longitude )) deallocate( Longitude ) + if( allocated( Station_Elevation )) deallocate( Station_Elevation ) + if( allocated( Time )) deallocate( Time ) + if( allocated( Prep_QC_Mark )) deallocate( Prep_QC_Mark ) + if( allocated( Prep_Use_Flag )) deallocate( Prep_Use_Flag ) + if( allocated( Nonlinear_QC_Var_Jb )) deallocate( Nonlinear_QC_Var_Jb ) + if( allocated( Nonlinear_QC_Rel_Wgt )) deallocate( Nonlinear_QC_Rel_Wgt ) + if( allocated( Analysis_Use_Flag )) deallocate( Analysis_Use_Flag ) + if( allocated( Errinv_Input )) deallocate( Errinv_Input ) + if( allocated( Errinv_Adjust )) deallocate( Errinv_Final ) + if( allocated( Errinv_Final )) deallocate( Errinv_Final ) + if( allocated( Observation )) deallocate( Observation ) + if( allocated( Obs_Minus_Forecast_adjusted )) deallocate( Obs_Minus_Forecast_adjusted ) + if( allocated( Obs_Minus_Forecast_unadjusted )) deallocate( Obs_Minus_Forecast_unadjusted ) + if( allocated( Forecast_Saturation_Spec_Hum )) deallocate( Forecast_Saturation_Spec_Hum ) + + print *, ' ' + print *, ' <-- read_diag_file_q_nc' + + end subroutine read_diag_file_q_nc + + + + !------------------------------------------------------------- + ! netcdf read routine for ps data types in netcdf files + ! + ! NOTE1: This routine is untested. The ConMon does not + ! currently process sst obs. + ! + ! NOTE2: There are known discrepencies between the contents + ! of sst obs in binary and NetCDF files. + ! + subroutine read_diag_file_sst_nc( input_file, return_all, ftin, ctype, intype,expected_nreal,nobs,in_subtype, list ) + + !--- interface + character(100), intent(in) :: input_file + logical, intent(in) :: return_all + integer, intent(in) :: ftin + character(3), intent(in) :: ctype + integer, intent(in) :: intype, expected_nreal, in_subtype + integer, intent(out) :: nobs + type(list_node_t), pointer :: list + + !--- local vars + type(list_node_t), pointer :: next => null() + type(data_ptr) :: ptr + integer :: ii, ierr, istatus, total_obs, idx + logical :: have_subtype = .true. + logical :: add_obs + + !--- NetCDF file components dimension(s) + ! + character(len=:), dimension(:), allocatable :: Station_ID ! (nobs, Station_ID_maxstrlen) + character(len=:), dimension(:), allocatable :: Observation_Class ! (nobs, Station_Class_maxstrlen) + integer, dimension(:), allocatable :: Observation_Type ! (obs) + integer, dimension(:), allocatable :: Observation_Subtype ! (obs) + real(r_single), dimension(:), allocatable :: Latitude ! (obs) + real(r_single), dimension(:), allocatable :: Longitude ! (obs) + real(r_single), dimension(:), allocatable :: Station_Elevation ! (obs) + real(r_single), dimension(:), allocatable :: Pressure ! (obs) + real(r_single), dimension(:), allocatable :: Height ! (obs) + real(r_single), dimension(:), allocatable :: Time ! (obs) + real(r_single), dimension(:), allocatable :: Prep_QC_Mark ! (obs) + real(r_single), dimension(:), allocatable :: Prep_Use_Flag ! (obs) + real(r_single), dimension(:), allocatable :: Nonlinear_QC_Var_Jb ! (obs) + real(r_single), dimension(:), allocatable :: Nonlinear_QC_Rel_Wgt ! (obs) + real(r_single), dimension(:), allocatable :: Analysis_Use_Flag ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Input ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Adjust ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Final ! (obs) + real(r_single), dimension(:), allocatable :: Observation ! (obs) + real(r_single), dimension(:), allocatable :: Obs_Minus_Forecast_adjusted ! (obs) + real(r_single), dimension(:), allocatable :: Obs_Minus_Forecast_unadjusted ! (obs) + real(r_single), dimension(:), allocatable :: FoundationTempBG ! (obs) + real(r_single), dimension(:), allocatable :: DiurnalWarming_at_zob ! (obs) + real(r_single), dimension(:), allocatable :: SkinLayerCooling_at_zob ! (obs) + real(r_single), dimension(:), allocatable :: Sensitivity_Tzob_Tr ! (obs) + integer(i_kind) :: idate + + print *, ' ' + print *, ' --> read_diag_file_sst_nc' + + + !--- get NetCDF file dimensions + ! + if( nc_diag_read_check_dim( 'nobs' )) then + total_obs = nc_diag_read_get_dim(ftin,'nobs') + ncdiag_open_status(ii)%num_records = total_obs + print *, ' total_obs = ', total_obs + else + print *, 'ERROR: unable to read nobs' + ierr=1 + end if + + + !--- get vars + + call load_nc_var( 'Station_ID', ftin, Station_ID, ierr ) + call load_nc_var( 'Observation_Class', ftin, Station_ID, ierr ) + call load_nc_var( 'Observation_Type', ftin, Observation_Type, ierr ) + call load_nc_var( 'Observation_Subtype', ftin, Observation_Subtype, ierr ) + if( ierr == 1 ) then + have_subtype = .false. + end if + call load_nc_var( 'Latitude', ftin, Latitude, ierr ) + call load_nc_var( 'Longitude', ftin, Longitude, ierr ) + call load_nc_var( 'Station_Elevation', ftin, Station_Elevation, ierr ) + call load_nc_var( 'Pressure', ftin, Pressure, ierr ) + call load_nc_var( 'Height', ftin, Height, ierr ) + call load_nc_var( 'Time', ftin, Time, ierr ) + call load_nc_var( 'Prep_QC_Mark', ftin, Prep_QC_Mark, ierr ) + call load_nc_var( 'Nonlinear_QC_Var_Jb', ftin, Nonlinear_QC_Var_Jb, ierr ) + call load_nc_var( 'Nonlinear_QC_Rel_Wgt', ftin, Nonlinear_QC_Rel_Wgt, ierr ) + call load_nc_var( 'Prep_Use_Flag', ftin, Prep_Use_Flag, ierr ) + call load_nc_var( 'Analysis_Use_Flag', ftin, Analysis_Use_Flag, ierr ) + call load_nc_var( 'Errinv_Input', ftin, Errinv_Input, ierr ) + call load_nc_var( 'Errinv_Adjust', ftin, Errinv_Adjust, ierr ) + call load_nc_var( 'Errinv_Final', ftin, Errinv_Final, ierr ) + call load_nc_var( 'Observation', ftin, Observation, ierr ) + call load_nc_var( 'Obs_Minus_Forecast_adjusted', ftin, Obs_Minus_Forecast_adjusted, ierr ) + call load_nc_var( 'Obs_Minus_Forecast_unadjusted', ftin, Obs_Minus_Forecast_unadjusted, ierr ) + call load_nc_var( 'FoundationTempBG', ftin, FoundationTempBG, ierr ) + call load_nc_var( 'DiurnalWarming_at_zob', ftin, DiurnalWarming_at_zob, ierr ) + call load_nc_var( 'SkinLayerCooling_at_zob', ftin, SkinLayerCooling_at_zob, ierr ) + call load_nc_var( 'Sensitivity_Tzob_Tr', ftin, Sensitivity_Tzob_Tr, ierr ) + + + + !--------------------------------------------------------------- + ! Process all obs. If type and subtype match the input values + ! add this obs to the linked list (ptr%p). + ! + nobs = 0 + do ii = 1, total_obs + + add_obs = .false. + + !------------------------------------------------------------------------ + ! Check on Observation_Class to ctype is a sanity check -- + ! only a single class of obs are in any given NetCDF formatted diag + ! file + ! but, if the ctype and input file don't match, things could get + ! interesting (but not in a good way). + ! + if( adjustl( trim( Observation_Class(ii) )) == adjustl( trim( ctype ))) then + + if( return_all == .true. ) then + add_obs = .true. + + else if( Observation_Type(ii) == intype ) then + + if( have_subtype == .false. ) then + add_obs = .true. + else if( Observation_Subtype(ii) == in_subtype ) then + add_obs = .true. + end if + + end if + end if + + + if( add_obs == .true. ) then + + nobs=nobs+1 + + !--------------------------------------------- + ! Allocate a new data element and load + ! + allocate( ptr%p ) + ptr%p%stn_id = Station_ID( ii ) + + do idx=1,max_rdiag_reals + ptr%p%rdiag( idx ) = 0.00 + end do + + if( allocated( Observation_Type )) ptr%p%rdiag( idx_obs_type_sst ) = Observation_Type( ii ) + if( allocated( Observation_Subtype )) ptr%p%rdiag( idx_obs_subtype_sst ) = Observation_Subtype( ii ) + if( allocated( Latitude )) ptr%p%rdiag( idx_obs_lat_sst ) = Latitude( ii ) + if( allocated( Longitude )) ptr%p%rdiag( idx_obs_lon_sst ) = Longitude( ii ) + if( allocated( Station_Elevation )) ptr%p%rdiag( idx_stn_elev_sst ) = Station_Elevation( ii ) + + if( allocated( Pressure )) ptr%p%rdiag( idx_opn_wtr_tmp_sst ) = Pressure( ii ) ! identified as background open water temperature in setupsst.f90 + + if( allocated( Height )) ptr%p%rdiag( idx_depth_sst ) = Height( ii ) ! identified as observation depth (meters) in setupsst.f90 + + if( allocated( Time )) ptr%p%rdiag( idx_time_sst ) = Time( ii ) + +! if( allocated( )) ptr%p%rdiag( idx_opn_wtr_pct_sst ) = Prep_QC_Mark( ii ) ! identified as open water percentage in setupsst.f90 + + if( allocated( Prep_QC_Mark )) ptr%p%rdiag( idx_setup_qc_sst ) = Prep_QC_Mark( ii ) + if( allocated( Prep_Use_Flag )) ptr%p%rdiag( idx_iuse_sst ) = Prep_Use_Flag( ii ) + if( allocated( Analysis_Use_Flag )) ptr%p%rdiag( idx_anl_use_sst ) = Analysis_Use_Flag( ii ) + if( allocated( Nonlinear_QC_Rel_Wgt )) ptr%p%rdiag( idx_rwgt_sst ) = Nonlinear_QC_Rel_Wgt( ii ) + if( allocated( Errinv_Input )) ptr%p%rdiag( idx_err_input_sst ) = Errinv_Input( ii ) + if( allocated( Errinv_Adjust )) ptr%p%rdiag( idx_errinv_sst ) = Errinv_Adjust( ii ) + if( allocated( Errinv_Final )) ptr%p%rdiag( idx_errinv_fnl_sst ) = Errinv_Final( ii ) + if( allocated( Observation )) ptr%p%rdiag( idx_obs_sst ) = Observation( ii ) + if( allocated( Obs_Minus_Forecast_adjusted )) ptr%p%rdiag( idx_omgbc_sst ) = Obs_Minus_Forecast_adjusted( ii ) + if( allocated( Obs_Minus_Forecast_unadjusted )) ptr%p%rdiag( idx_omgnbc_sst ) = Obs_Minus_Forecast_unadjusted( ii ) + +! if( allocated( )) ptr%p%rdiag( idx_type_sst ) = type of measurement? per setupsst.f90 + + if( allocated( FoundationTempBG )) ptr%p%rdiag( idx_tr_sst ) = FoundationTempBG( ii ) + if( allocated( DiurnalWarming_at_Zob )) ptr%p%rdiag( idx_dt_warm_sst ) = DiurnalWarming_at_zob( ii ) + if( allocated( SkinLayerCooling_at_zob )) ptr%p%rdiag( idx_dt_cool_sst ) = SkinLayerCooling_at_zob( ii ) + if( allocated( Sensitivity_Tzob_Tr )) ptr%p%rdiag( idx_dtz_dtr_sst ) = Sensitivity_Tzob_Tr( ii ) + + + if( nobs == 1 ) then + !------------------------------------------------- + ! Initialize the list with the first data element + ! + call list_init(list, transfer(ptr, list_data)) + next => list + + else + !------------------------------------------------- + ! Insert subsequent nodes into the list + ! + call list_insert(next, transfer(ptr, list_data)) + next => list_next(next) + end if + + end if + + end do + + + if( allocated( Station_ID )) deallocate( Station_ID ) + if( allocated( Observation_Class )) deallocate( Observation_Class ) + if( allocated( Observation_Type )) deallocate( Observation_Type ) + if( allocated( Observation_Subtype )) deallocate( Observation_Subtype ) + if( allocated( Latitude )) deallocate( Latitude ) + if( allocated( Longitude )) deallocate( Longitude ) + if( allocated( Station_Elevation )) deallocate( Station_Elevation ) + if( allocated( Time )) deallocate( Time ) + if( allocated( Prep_QC_Mark )) deallocate( Prep_QC_Mark ) + if( allocated( Prep_Use_Flag )) deallocate( Prep_Use_Flag ) + if( allocated( Nonlinear_QC_Var_Jb )) deallocate( Nonlinear_QC_Var_Jb ) + if( allocated( Nonlinear_QC_Rel_Wgt )) deallocate( Nonlinear_QC_Rel_Wgt ) + if( allocated( Analysis_Use_Flag )) deallocate( Analysis_Use_Flag ) + if( allocated( Errinv_Input )) deallocate( Errinv_Input ) + if( allocated( Errinv_Adjust )) deallocate( Errinv_Final ) + if( allocated( Errinv_Final )) deallocate( Errinv_Final ) + if( allocated( Observation )) deallocate( Observation ) + if( allocated( Obs_Minus_Forecast_adjusted )) deallocate( Obs_Minus_Forecast_adjusted ) + if( allocated( Obs_Minus_Forecast_unadjusted )) deallocate( Obs_Minus_Forecast_unadjusted ) + if( allocated( FoundationTempBG )) deallocate( FoundationTempBG ) + if( allocated( DiurnalWarming_at_zob )) deallocate( DiurnalWarming_at_zob ) + if( allocated( SkinLayerCooling_at_zob )) deallocate( SkinLayerCooling_at_zob ) + if( allocated( Sensitivity_Tzob_Tr )) deallocate( Sensitivity_Tzob_Tr ) + + print *, ' ' + print *, ' <-- read_diag_file_sst_nc' + + end subroutine read_diag_file_sst_nc + + + + !--------------------------------------------------------- + ! netcdf read routine for t data types in netcdf files + ! + subroutine read_diag_file_t_nc( input_file, return_all, ftin, ctype, intype, expected_nreal, nobs, in_subtype, list ) + + !--- interface + character(100), intent(in) :: input_file + logical, intent(in) :: return_all + integer, intent(in) :: ftin + character(3), intent(in) :: ctype + integer, intent(in) :: intype, expected_nreal, in_subtype + integer, intent(out) :: nobs + type(list_node_t), pointer :: list + + !--- local vars + type(list_node_t), pointer :: next => null() + type(data_ptr) :: ptr + integer :: ii, ierr, istatus, total_obs, idx, bcor_terms + logical :: have_subtype = .true. + logical :: add_obs + + !--- NetCDF file components dimension(s) + ! + character(len=:), dimension(:), allocatable :: Station_ID ! (nobs, Station_ID_maxstrlen) + character(len=:), dimension(:), allocatable :: Observation_Class ! (nobs, Station_Class_maxstrlen) + integer, dimension(:), allocatable :: Observation_Type ! (obs) + integer, dimension(:), allocatable :: Observation_Subtype ! (obs) + real(r_single), dimension(:), allocatable :: Latitude ! (obs) + real(r_single), dimension(:), allocatable :: Longitude ! (obs) + real(r_single), dimension(:), allocatable :: Station_Elevation ! (obs) + real(r_single), dimension(:), allocatable :: Pressure ! (obs) + real(r_single), dimension(:), allocatable :: Height ! (obs) + real(r_single), dimension(:), allocatable :: Time ! (obs) + real(r_single), dimension(:), allocatable :: Prep_QC_Mark ! (obs) + real(r_single), dimension(:), allocatable :: Prep_Use_Flag ! (obs) + real(r_single), dimension(:), allocatable :: Nonlinear_QC_Var_Jb ! (obs) + real(r_single), dimension(:), allocatable :: Nonlinear_QC_Rel_Wgt ! (obs) + real(r_single), dimension(:), allocatable :: Analysis_Use_Flag ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Input ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Adjust ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Final ! (obs) + real(r_single), dimension(:), allocatable :: Observation ! (obs) + real(r_single), dimension(:), allocatable :: Obs_Minus_Forecast_adjusted ! (obs) + real(r_single), dimension(:), allocatable :: Obs_Minus_Forecast_unadjusted ! (obs) + real(r_single), dimension(:), allocatable :: Data_Pof ! (obs) + real(r_single), dimension(:), allocatable :: Data_Vertical_Velocity ! (obs) + real(r_single), dimension(:,:), allocatable :: Bias_Correction_Terms ! (nobs, Bias_Correction_Terms_arr_dim) + integer(i_kind) :: idate + integer(i_kind) :: jj + + print *, ' ' + print *, ' --> read_diag_file_t_nc' + + print *, ' input_file = ', input_file + print *, ' ftin = ', ftin + print *, ' ctype = ', ctype + print *, ' intype = ', intype + print *, ' expected_nreal = ', expected_nreal + print *, ' in_subtype = ', in_subtype + + + !--- get NetCDF file dimensions + ! + if( nc_diag_read_check_dim( 'nobs' )) then + total_obs = nc_diag_read_get_dim(ftin,'nobs') + ncdiag_open_status(ii)%num_records = total_obs + else + print *, 'ERROR: unable to read nobs' + ierr=1 + end if + + if( nc_diag_read_check_dim( 'Bias_Correction_Terms_arr_dim' )) then + bcor_terms = nc_diag_read_get_dim(ftin,'Bias_Correction_Terms_arr_dim') + else + print *, 'ERROR: unable to read bcor_terms' + ierr=1 + end if + + + + !--- get vars + + call load_nc_var( 'Station_ID', ftin, Station_ID, ierr ) + call load_nc_var( 'Observation_Class', ftin, Observation_Class, ierr ) + call load_nc_var( 'Observation_Type', ftin, Observation_Type, ierr ) + call load_nc_var( 'Observation_Subtype', ftin, Observation_Subtype, ierr ) + if( ierr == 1 ) then + have_subtype = .false. + end if + + call load_nc_var( 'Latitude', ftin, Latitude, ierr ) + call load_nc_var( 'Longitude', ftin, Longitude, ierr ) + call load_nc_var( 'Station_Elevation', ftin, Station_Elevation, ierr ) + call load_nc_var( 'Pressure', ftin, Pressure, ierr ) + call load_nc_var( 'Height', ftin, Height, ierr ) + call load_nc_var( 'Time', ftin, Time, ierr ) + call load_nc_var( 'Prep_QC_Mark', ftin, Prep_QC_Mark, ierr ) + call load_nc_var( 'Nonlinear_QC_Var_Jb', ftin, Nonlinear_QC_Var_Jb, ierr ) + call load_nc_var( 'Nonlinear_QC_Rel_Wgt', ftin, Nonlinear_QC_Rel_Wgt, ierr ) + call load_nc_var( 'Prep_Use_Flag', ftin, Prep_Use_Flag, ierr ) + call load_nc_var( 'Analysis_Use_Flag', ftin, Analysis_Use_Flag, ierr ) + call load_nc_var( 'Errinv_Input', ftin, Errinv_Input, ierr ) + call load_nc_var( 'Errinv_Adjust', ftin, Errinv_Adjust, ierr ) + call load_nc_var( 'Errinv_Final', ftin, Errinv_Final, ierr ) + call load_nc_var( 'Observation', ftin, Observation, ierr ) + call load_nc_var( 'Obs_Minus_Forecast_adjusted', ftin, Obs_Minus_Forecast_adjusted, ierr ) + call load_nc_var( 'Obs_Minus_Forecast_unadjusted', ftin, Obs_Minus_Forecast_unadjusted, ierr ) + call load_nc_var( 'Data_Pof', ftin, Data_Pof, ierr ) + call load_nc_var( 'Data_Vertical_Velocity', ftin, Data_Vertical_Velocity, ierr ) + + if( nc_diag_read_check_var( 'Bias_Correction_Terms' )) then + call nc_diag_read_get_var( ftin, 'Bias_Correction_Terms', Bias_Correction_Terms ) + ierr = 0 + else + print *, 'ERROR: unable to read Bias_Correction_Terms' + ierr = 25 + end if + + + + !--------------------------------------------------------------- + ! Process all obs. If type and subtype match the input values + ! add this obs to the linked list (ptr%p). + ! + nobs = 0 + do ii = 1, total_obs + + !------------------------------------------------------------------------ + ! Check on Observation_Class to ctype is a sanity check -- + ! only a single class of obs are in any given NetCDF formatted diag file + ! but, if the ctype and input file don't match, things could get + ! interesting (but not in a good way). + ! + add_obs = .false. + + if( adjustl( trim( Observation_Class(ii) )) == adjustl( trim( ctype ))) then + + if( return_all == .true. ) then + add_obs = .true. + + else if( Observation_Type(ii) == intype ) then + + if( have_subtype == .false. ) then + add_obs = .true. + else if( Observation_Subtype(ii) == in_subtype ) then + add_obs = .true. + end if + + end if + end if + + if( add_obs == .true. ) then + + nobs=nobs+1 + + !--------------------------------------------- + ! Allocate a new data element and load + ! + allocate(ptr%p) + ptr%p%stn_id = Station_ID( ii ) + + do idx=1,max_rdiag_reals + ptr%p%rdiag( idx ) = 0.00 + end do + + if( allocated( Observation_Type )) ptr%p%rdiag( idx_obs_type_t ) = Observation_Type( ii ) + if( allocated( Observation_Subtype )) ptr%p%rdiag( idx_obs_subtype_t ) = Observation_Subtype( ii ) + if( allocated( Latitude )) ptr%p%rdiag( idx_obs_lat_t ) = Latitude( ii ) + if( allocated( Longitude )) ptr%p%rdiag( idx_obs_lon_t ) = Longitude( ii ) + if( allocated( Station_Elevation )) ptr%p%rdiag( idx_stn_elev_t ) = Station_Elevation( ii ) + if( allocated( Pressure )) ptr%p%rdiag( idx_pres_t ) = Pressure( ii ) + if( allocated( Height )) ptr%p%rdiag( idx_hgt_t ) = Height( ii ) + if( allocated( Time )) ptr%p%rdiag( idx_time_t ) = Time( ii ) + if( allocated( Prep_QC_Mark )) ptr%p%rdiag( idx_iqc_t ) = Prep_QC_Mark( ii ) + if( allocated( Nonlinear_QC_Var_Jb )) ptr%p%rdiag( idx_setup_qc_t ) = Nonlinear_QC_Var_Jb( ii ) + if( allocated( Prep_Use_Flag )) ptr%p%rdiag( idx_iuse_t ) = Prep_Use_Flag( ii ) + if( allocated( Analysis_Use_Flag )) ptr%p%rdiag( idx_anl_use_t ) = Analysis_Use_Flag( ii ) + if( allocated( Nonlinear_QC_Rel_Wgt )) ptr%p%rdiag( idx_rwgt_t ) = Nonlinear_QC_Rel_Wgt( ii ) + if( allocated( Errinv_Input )) ptr%p%rdiag( idx_err_input_t ) = Errinv_Input( ii ) + if( allocated( Errinv_Adjust )) ptr%p%rdiag( idx_errinv_t ) = Errinv_Adjust( ii ) + if( allocated( Errinv_Final )) ptr%p%rdiag( idx_errinv_fnl_t ) = Errinv_Final( ii ) + if( allocated( Observation )) ptr%p%rdiag( idx_obs_t ) = Observation( ii ) + if( allocated( Obs_Minus_Forecast_adjusted )) ptr%p%rdiag( idx_omgbc_t ) = Obs_Minus_Forecast_adjusted( ii ) + if( allocated( Obs_Minus_Forecast_unadjusted )) ptr%p%rdiag( idx_omgnbc_t ) = Obs_Minus_Forecast_unadjusted( ii ) + if( allocated( Data_Pof )) ptr%p%rdiag( idx_pof_t ) = Data_Pof( ii ) + if( allocated( Data_Vertical_Velocity )) ptr%p%rdiag( idx_vv_t ) = Data_Vertical_Velocity( ii ) + do jj = 1, bcor_terms + if( allocated( Bias_Correction_Terms )) ptr%p%rdiag( idx_vv_t+jj ) = Bias_Correction_Terms( jj,ii ) + end do + + if( nobs == 1 ) then + !------------------------------------------------- + ! Initialize the list with the first data element + ! + call list_init(list, transfer(ptr, list_data)) + next => list + + else + !------------------------------------------------- + ! Insert subsequent nodes into the list + ! + call list_insert(next, transfer(ptr, list_data)) + next => list_next(next) + + end if + + end if + + end do + + + if( allocated( Station_ID )) deallocate( Station_ID ) + if( allocated( Observation_Class )) deallocate( Observation_Class ) + if( allocated( Observation_Type )) deallocate( Observation_Type ) + if( allocated( Observation_Subtype )) deallocate( Observation_Subtype ) + if( allocated( Latitude )) deallocate( Latitude ) + if( allocated( Longitude )) deallocate( Longitude ) + if( allocated( Station_Elevation )) deallocate( Station_Elevation ) + if( allocated( Time )) deallocate( Time ) + if( allocated( Prep_QC_Mark )) deallocate( Prep_QC_Mark ) + if( allocated( Prep_Use_Flag )) deallocate( Prep_Use_Flag ) + if( allocated( Nonlinear_QC_Var_Jb )) deallocate( Nonlinear_QC_Var_Jb ) + if( allocated( Nonlinear_QC_Rel_Wgt )) deallocate( Nonlinear_QC_Rel_Wgt ) + if( allocated( Analysis_Use_Flag )) deallocate( Analysis_Use_Flag ) + if( allocated( Errinv_Input )) deallocate( Errinv_Input ) + if( allocated( Errinv_Adjust )) deallocate( Errinv_Final ) + if( allocated( Errinv_Final )) deallocate( Errinv_Final ) + if( allocated( Observation )) deallocate( Observation ) + if( allocated( Obs_Minus_Forecast_adjusted )) deallocate( Obs_Minus_Forecast_adjusted ) + if( allocated( Obs_Minus_Forecast_unadjusted )) deallocate( Obs_Minus_Forecast_unadjusted ) + + print *, ' ' + print *, ' <-- read_diag_file_t_nc' + + end subroutine read_diag_file_t_nc + + + + !--------------------------------------------------------- + ! netcdf read routine for uv data types in netcdf files + ! + subroutine read_diag_file_uv_nc( input_file, return_all, ftin, ctype, intype, expected_nreal, nobs, in_subtype, list ) + + !--- interface + character(100), intent(in) :: input_file + logical, intent(in) :: return_all + integer, intent(in) :: ftin + character(3), intent(in) :: ctype + integer, intent(in) :: intype, expected_nreal, in_subtype + integer, intent(out) :: nobs + type(list_node_t), pointer :: list + + !--- local vars + type(list_node_t), pointer :: next => null() + type(data_ptr) :: ptr + integer :: ii, ierr, istatus, total_obs, idx + logical :: have_subtype = .true. + logical :: add_obs + + !--- NetCDF file components dimension(s) + ! + character(len=:), dimension(:), allocatable :: Station_ID ! (nobs, Station_ID_maxstrlen) + character(len=:), dimension(:), allocatable :: Observation_Class ! (nobs, Station_Class_maxstrlen) + integer, dimension(:), allocatable :: Observation_Type ! (obs) + integer, dimension(:), allocatable :: Observation_Subtype ! (obs) + real(r_single), dimension(:), allocatable :: Latitude ! (obs) + real(r_single), dimension(:), allocatable :: Longitude ! (obs) + real(r_single), dimension(:), allocatable :: Station_Elevation ! (obs) + real(r_single), dimension(:), allocatable :: Pressure ! (obs) + real(r_single), dimension(:), allocatable :: Height ! (obs) + real(r_single), dimension(:), allocatable :: Time ! (obs) + real(r_single), dimension(:), allocatable :: Prep_QC_Mark ! (obs) + real(r_single), dimension(:), allocatable :: Setup_QC_Mark ! (obs) + real(r_single), dimension(:), allocatable :: Prep_Use_Flag ! (obs) + real(r_single), dimension(:), allocatable :: Nonlinear_QC_Rel_Wgt ! (obs) + real(r_single), dimension(:), allocatable :: Nonlinear_QC_Var_Jb ! (obs) + real(r_single), dimension(:), allocatable :: Analysis_Use_Flag ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Input ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Adjust ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Final ! (obs) + real(r_single), dimension(:), allocatable :: Wind_Reduction_Factor_at_10m ! (obs) + real(r_single), dimension(:), allocatable :: u_Observation ! (obs) + real(r_single), dimension(:), allocatable :: u_Obs_Minus_Forecast_adjusted ! (obs) + real(r_single), dimension(:), allocatable :: u_Obs_Minus_Forecast_unadjusted ! (obs) + real(r_single), dimension(:), allocatable :: v_Observation ! (obs) + real(r_single), dimension(:), allocatable :: v_Obs_Minus_Forecast_adjusted ! (obs) + real(r_single), dimension(:), allocatable :: v_Obs_Minus_Forecast_unadjusted ! (obs) + integer(i_kind) :: idate + + print *, ' ' + print *, ' --> read_diag_file_uv_nc' + + + !--- get NetCDF file dimensions + ! + if( nc_diag_read_check_dim( 'nobs' )) then + total_obs = nc_diag_read_get_dim(ftin,'nobs') + ncdiag_open_status(ii)%num_records = total_obs + print *, ' total_obs = ', total_obs + else + print *, 'ERROR: unable to read nobs' + ierr=1 + end if + + + !--- get vars + + call load_nc_var( 'Station_ID', ftin, Station_ID, ierr ) + call load_nc_var( 'Observation_Class', ftin, Observation_Class, ierr ) + call load_nc_var( 'Observation_Type', ftin, Observation_Type, ierr ) + call load_nc_var( 'Observation_Subtype', ftin, Observation_Subtype, ierr ) + if( ierr == 1 ) then + have_subtype = .false. + end if + call load_nc_var( 'Latitude', ftin, Latitude, ierr ) + call load_nc_var( 'Longitude', ftin, Longitude, ierr ) + call load_nc_var( 'Station_Elevation', ftin, Station_Elevation, ierr ) + call load_nc_var( 'Pressure', ftin, Pressure, ierr ) + call load_nc_var( 'Height', ftin, Height, ierr ) + call load_nc_var( 'Time', ftin, Time, ierr ) + call load_nc_var( 'Prep_QC_Mark', ftin, Prep_QC_Mark, ierr ) + call load_nc_var( 'Setup_QC_Mark', ftin, Setup_QC_Mark, ierr ) + call load_nc_var( 'Nonlinear_QC_Rel_Wgt', ftin, Nonlinear_QC_Rel_Wgt, ierr ) + call load_nc_var( 'Prep_Use_Flag', ftin, Prep_Use_Flag, ierr ) + call load_nc_var( 'Nonlinear_QC_Var_Jb', ftin, Nonlinear_QC_Var_Jb, ierr ) + call load_nc_var( 'Analysis_Use_Flag', ftin, Analysis_Use_Flag, ierr ) + call load_nc_var( 'Errinv_Input', ftin, Errinv_Input, ierr ) + call load_nc_var( 'Errinv_Adjust', ftin, Errinv_Adjust, ierr ) + call load_nc_var( 'Errinv_Final', ftin, Errinv_Final, ierr ) + call load_nc_var( 'Wind_Reduction_Factor_at_10m', ftin, Wind_Reduction_Factor_at_10m, ierr ) + call load_nc_var( 'u_Observation', ftin, u_Observation, ierr ) + call load_nc_var( 'u_Obs_Minus_Forecast_adjusted', ftin, u_Obs_Minus_Forecast_adjusted, ierr ) + call load_nc_var( 'u_Obs_Minus_Forecast_unadjusted', ftin, u_Obs_Minus_Forecast_unadjusted, ierr ) + call load_nc_var( 'v_Observation', ftin, v_Observation, ierr ) + call load_nc_var( 'v_Obs_Minus_Forecast_adjusted', ftin, v_Obs_Minus_Forecast_adjusted, ierr ) + call load_nc_var( 'v_Obs_Minus_Forecast_unadjusted', ftin, v_Obs_Minus_Forecast_unadjusted, ierr ) + + + !--------------------------------------------------------------- + ! Process all obs. If type and subtype match the input values + ! add this obs to the linked list (ptr%p). + ! + nobs = 0 + do ii = 1, total_obs + + + !------------------------------------------------------------------------ + ! Check on Observation_Class to ctype is a sanity check -- + ! only a single class of obs are in any given NetCDF formatted diag file + ! but, if the ctype and input file don't match, things could get + ! interesting (but not in a good way). + ! + add_obs = .false. + + if( adjustl( trim( Observation_Class(ii) )) == adjustl( trim( ctype ))) then + + if( return_all == .true. ) then + add_obs = .true. + + else if( Observation_Type(ii) == intype ) then + + if( have_subtype == .false. ) then + add_obs = .true. + else if( Observation_Subtype(ii) == in_subtype ) then + add_obs = .true. + end if + + end if + end if + + if( add_obs == .true. ) then + + nobs=nobs+1 + + !--------------------------------------------- + ! Allocate a new data element and load + ! + allocate(ptr%p) + ptr%p%stn_id = Station_ID( ii ) + + do idx=1,max_rdiag_reals + ptr%p%rdiag( idx ) = 0.00 + end do + + if( allocated( Observation_Type )) ptr%p%rdiag( idx_obs_type_uv ) = Observation_Type( ii ) + if( allocated( Observation_Subtype )) ptr%p%rdiag( idx_obs_subtype_uv ) = Observation_Subtype( ii ) + if( allocated( Latitude )) ptr%p%rdiag( idx_obs_lat_uv ) = Latitude( ii ) + if( allocated( Longitude )) ptr%p%rdiag( idx_obs_lon_uv ) = Longitude( ii ) + if( allocated( Station_Elevation )) ptr%p%rdiag( idx_stn_elev_uv ) = Station_Elevation( ii ) + if( allocated( Pressure )) ptr%p%rdiag( idx_pres_uv ) = Pressure( ii ) + if( allocated( Height )) ptr%p%rdiag( idx_hgt_uv ) = Height( ii ) + if( allocated( Time )) ptr%p%rdiag( idx_time_uv ) = Time( ii ) + if( allocated( Prep_QC_Mark )) ptr%p%rdiag( idx_iqc_uv ) = Prep_QC_Mark( ii ) + +! if( allocated( Nonlinear_QC_Var_JB )) ptr%p%rdiag( idx_setup_qc_uv ) = Nonlinear_QC_Var_Jb( ii ) ! missing from diagnostic file + + if( allocated( Prep_Use_Flag )) ptr%p%rdiag( idx_iuse_uv ) = Prep_Use_Flag( ii ) + if( allocated( Analysis_Use_Flag )) ptr%p%rdiag( idx_anl_use_uv ) = Analysis_Use_Flag( ii ) + if( allocated( Nonlinear_QC_Rel_Wgt )) ptr%p%rdiag( idx_rwgt_uv ) = Nonlinear_QC_Rel_Wgt( ii ) + if( allocated( Errinv_Input )) ptr%p%rdiag( idx_err_input_uv ) = Errinv_Input( ii ) + if( allocated( Errinv_Adjust )) ptr%p%rdiag( idx_errinv_uv ) = Errinv_Adjust( ii ) + if( allocated( Errinv_Final )) ptr%p%rdiag( idx_errinv_fnl_uv ) = Errinv_Final( ii ) + + if( allocated( u_Observation )) ptr%p%rdiag( idx_u_obs_uv ) = u_Observation( ii ) + if( allocated( u_Obs_Minus_Forecast_adjusted )) ptr%p%rdiag( idx_u_omgbc_uv ) = u_Obs_Minus_Forecast_adjusted( ii ) + if( allocated( u_Obs_Minus_Forecast_unadjusted )) ptr%p%rdiag( idx_u_omgnbc_uv ) = u_Obs_Minus_Forecast_unadjusted( ii ) + if( allocated( v_Observation )) ptr%p%rdiag( idx_v_obs_uv ) = v_Observation( ii ) + if( allocated( v_Obs_Minus_Forecast_adjusted )) ptr%p%rdiag( idx_v_omgbc_uv ) = v_Obs_Minus_Forecast_adjusted( ii ) + if( allocated( v_Obs_Minus_Forecast_unadjusted )) ptr%p%rdiag( idx_v_omgnbc_uv ) = v_Obs_Minus_Forecast_unadjusted( ii ) + + + if( nobs == 1 ) then + !------------------------------------------------- + ! Initialize the list with the first data element + ! + call list_init(list, transfer(ptr, list_data)) + next => list + + else + !------------------------------------------------- + ! Insert subsequent nodes into the list + ! + call list_insert(next, transfer(ptr, list_data)) + next => list_next(next) + end if + + end if + + end do + + + if( allocated( Station_ID )) deallocate( Station_ID ) + if( allocated( Observation_Class )) deallocate( Observation_Class ) + if( allocated( Observation_Type )) deallocate( Observation_Type ) + if( allocated( Observation_Subtype )) deallocate( Observation_Subtype ) + if( allocated( Latitude )) deallocate( Latitude ) + if( allocated( Longitude )) deallocate( Longitude ) + if( allocated( Station_Elevation )) deallocate( Station_Elevation ) + if( allocated( Time )) deallocate( Time ) + if( allocated( Prep_QC_Mark )) deallocate( Prep_QC_Mark ) + if( allocated( Prep_Use_Flag )) deallocate( Prep_Use_Flag ) + if( allocated( Nonlinear_QC_Var_Jb )) deallocate( Nonlinear_QC_Var_Jb ) + if( allocated( Nonlinear_QC_Rel_Wgt )) deallocate( Nonlinear_QC_Rel_Wgt ) + if( allocated( Analysis_Use_Flag )) deallocate( Analysis_Use_Flag ) + if( allocated( Errinv_Input )) deallocate( Errinv_Input ) + if( allocated( Errinv_Adjust )) deallocate( Errinv_Final ) + if( allocated( Errinv_Final )) deallocate( Errinv_Final ) + if( allocated( Wind_Reduction_Factor_at_10m )) deallocate( Wind_Reduction_Factor_at_10m ) + if( allocated( u_Observation )) deallocate( u_Observation ) + if( allocated( u_Obs_Minus_Forecast_adjusted )) deallocate( u_Obs_Minus_Forecast_adjusted ) + if( allocated( u_Obs_Minus_Forecast_unadjusted )) deallocate( u_Obs_Minus_Forecast_unadjusted ) + if( allocated( v_Observation )) deallocate( v_Observation ) + if( allocated( v_Obs_Minus_Forecast_adjusted )) deallocate( v_Obs_Minus_Forecast_adjusted ) + if( allocated( v_Obs_Minus_Forecast_unadjusted )) deallocate( v_Obs_Minus_Forecast_unadjusted ) + + print *, ' ' + print *, ' <-- read_diag_file_uv_nc' + + end subroutine read_diag_file_uv_nc + + + !----------------------------------------------------------- + ! netcdf read routine for gps data types in netcdf files + ! + ! NOTE1: This routine is untested. At present the ConMon + ! does not process gps data. There are plans to + ! change that though. + ! + ! NOTE2: There are known descrepencies between gps obs + ! in binary and NetCDF formatted diag files. See + ! comments below. + ! + subroutine read_diag_file_gps_nc( input_file, return_all, ftin, ctype, intype,expected_nreal,nobs,in_subtype, list ) + + !--- interface + character(100), intent(in) :: input_file + logical, intent(in) :: return_all + integer, intent(in) :: ftin + character(3), intent(in) :: ctype + integer, intent(in) :: intype, expected_nreal, in_subtype + integer, intent(out) :: nobs + type(list_node_t), pointer :: list + + !--- local vars + type(list_node_t), pointer :: next => null() + type(data_ptr) :: ptr + integer :: ii, ierr, istatus, total_obs, idx + logical :: have_subtype = .true. + logical :: add_obs + + !--- NetCDF file components dimension(s) + ! + character(len=:), dimension(:), allocatable :: Station_ID ! (nobs, Station_ID_maxstrlen) + character(len=:), dimension(:), allocatable :: Observation_Class ! (nobs, Station_Class_maxstrlen) + integer, dimension(:), allocatable :: Observation_Type ! (obs) + integer, dimension(:), allocatable :: Observation_Subtype ! (obs) + real(r_single), dimension(:), allocatable :: Latitude ! (obs) + real(r_single), dimension(:), allocatable :: Longitude ! (obs) + real(r_single), dimension(:), allocatable :: Incremental_Bending_Angle ! (obs) + real(r_single), dimension(:), allocatable :: Station_Elevation ! (obs) + real(r_single), dimension(:), allocatable :: Pressure ! (obs) + real(r_single), dimension(:), allocatable :: Height ! (obs) + real(r_single), dimension(:), allocatable :: Time ! (obs) + real(r_single), dimension(:), allocatable :: Model_Elevation ! (obs) + real(r_single), dimension(:), allocatable :: Setup_QC_Mark ! (obs) + real(r_single), dimension(:), allocatable :: Prep_Use_Flag ! (obs) + real(r_single), dimension(:), allocatable :: Nonlinear_QC_Var_Jb ! (obs) + real(r_single), dimension(:), allocatable :: Nonlinear_QC_Rel_Wgt ! (obs) + real(r_single), dimension(:), allocatable :: Analysis_Use_Flag ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Input ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Adjust ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Final ! (obs) + real(r_single), dimension(:), allocatable :: Observation ! (obs) + real(r_single), dimension(:), allocatable :: Obs_Minus_Forecast_adjusted ! (obs) + real(r_single), dimension(:), allocatable :: Obs_Minus_Forecast_unadjusted ! (obs) + real(r_single), dimension(:), allocatable :: GPS_Type ! (obs) + real(r_single), dimension(:), allocatable :: Temperature_at_Obs_Location ! (obs) + real(r_single), dimension(:), allocatable :: Specific_Humidity_at_Obs_Location ! (obs) + + integer(i_kind) :: idate + + + + print *, ' ' + print *, ' --> read_diag_file_gps_nc' + + + !--- get NetCDF file dimensions + ! + if( nc_diag_read_check_dim( 'nobs' )) then + total_obs = nc_diag_read_get_dim(ftin,'nobs') + ncdiag_open_status(ii)%num_records = total_obs + print *, ' total_obs = ', total_obs + else + print *, 'ERROR: unable to read nobs' + ierr=1 + end if + + + !--- get vars + + call load_nc_var( 'Station_ID', ftin, Station_ID, ierr ) + call load_nc_var( 'Observation_Class', ftin, Observation_Class, ierr ) + call load_nc_var( 'Observation_Type', ftin, Observation_Type, ierr ) + call load_nc_var( 'Observation_Subtype', ftin, Observation_Subtype, ierr ) + if( ierr == 1 ) then + have_subtype = .false. + end if + call load_nc_var( 'Latitude', ftin, Latitude, ierr ) + call load_nc_var( 'Longitude', ftin, Longitude, ierr ) + call load_nc_var( 'Incremental_Bending_Angle', ftin, Incremental_Bending_Angle, ierr ) + call load_nc_var( 'Pressure', ftin, Pressure, ierr ) + call load_nc_var( 'Height', ftin, Height, ierr ) + call load_nc_var( 'Time', ftin, Time, ierr ) + call load_nc_var( 'Model_Elevation', ftin, Model_Elevation, ierr ) + call load_nc_var( 'Setup_QC_Mark', ftin, Setup_QC_Mark, ierr ) + call load_nc_var( 'Prep_Use_Flag', ftin, Prep_Use_Flag, ierr ) + call load_nc_var( 'Analysis_Use_Flag', ftin, Analysis_Use_Flag, ierr ) + call load_nc_var( 'Nonlinear_QC_Rel_Wgt', ftin, Nonlinear_QC_Rel_Wgt, ierr ) + call load_nc_var( 'Errinv_Input', ftin, Errinv_Input, ierr ) + call load_nc_var( 'Errinv_Adjust', ftin, Errinv_Adjust, ierr ) + call load_nc_var( 'Errinv_Final', ftin, Errinv_Final, ierr ) + call load_nc_var( 'Observation', ftin, Observation, ierr ) + call load_nc_var( 'Obs_Minus_Forecast_adjusted', ftin, Obs_Minus_Forecast_adjusted, ierr ) + call load_nc_var( 'Obs_Minus_Forecast_unadjusted', ftin, Obs_Minus_Forecast_unadjusted, ierr ) + call load_nc_var( 'GPS_Type', ftin, GPS_Type, ierr ) + call load_nc_var( 'Temperature_at_Obs_Location', ftin, Temperature_at_Obs_Location, ierr ) + call load_nc_var( 'Specific_Humidity_at_Obs_Location', ftin, Specific_Humidity_at_Obs_Location, ierr ) + +! call load_nc_var( 'Nonlinear_QC_Var_Jb', ftin, Nonlinear_QC_Var_Jb, 13, ierr ) + + + + !--------------------------------------------------------------- + ! Process all obs. If type and subtype match the input values + ! add this obs to the linked list (ptr%p). + ! + nobs = 0 + do ii = 1, total_obs + + !------------------------------------------------------------------------ + ! Check on Observation_Class to ctype is a sanity check -- + ! only a single class of obs are in any given NetCDF formatted diag + ! file + ! but, if the ctype and input file don't match, things could get + ! interesting (but not in a good way). + ! + add_obs = .false. + + if( adjustl( trim( Observation_Class(ii) )) == adjustl( trim( ctype ))) then + + if( return_all == .true. ) then + add_obs = .true. + + else if( Observation_Type(ii) == intype ) then + + if( have_subtype == .false. ) then + add_obs = .true. + else if( Observation_Subtype(ii) == in_subtype ) then + add_obs = .true. + end if + + end if + end if + + if( add_obs == .true. ) then + + nobs=nobs+1 + + !--------------------------------------------- + ! Allocate a new data element and load + ! + allocate(ptr%p) + ptr%p%stn_id = Station_ID( ii ) + + do idx=1,max_rdiag_reals + ptr%p%rdiag( idx ) = 0.00 + end do + + if( allocated ( Observation_Type )) ptr%p%rdiag( idx_obs_type_gps ) = Observation_Type( ii ) + if( allocated ( Observation_Subtype )) ptr%p%rdiag( idx_obs_subtype_gps ) = Observation_Subtype( ii ) + if( allocated ( Latitude )) ptr%p%rdiag( idx_obs_lat_gps ) = Latitude( ii ) + if( allocated ( Longitude )) ptr%p%rdiag( idx_obs_lon_gps ) = Longitude( ii ) + if( allocated ( Incremental_Bending_Angle )) ptr%p%rdiag( idx_bend_ang_gps ) = Incremental_Bending_Angle( ii ) + if( allocated ( Pressure )) ptr%p%rdiag( idx_pres_gps ) = Pressure( ii ) + if( allocated ( Height )) ptr%p%rdiag( idx_height_gps ) = Height( ii ) + if( allocated ( Time )) ptr%p%rdiag( idx_time_gps ) = Time( ii ) + if( allocated ( Model_Elevation )) ptr%p%rdiag( idx_zsges_gps ) = Model_Elevation( ii ) + if( allocated ( Setup_QC_Mark )) ptr%p%rdiag( idx_setup_qc_gps ) = Setup_QC_Mark( ii ) + if( allocated ( Prep_Use_Flag )) ptr%p%rdiag( idx_iuse_gps ) = Prep_Use_Flag( ii ) + if( allocated ( Analysis_Use_Flag )) ptr%p%rdiag( idx_anl_use_gps ) = Analysis_Use_Flag( ii ) + if( allocated ( Nonlinear_QC_Rel_Wgt )) ptr%p%rdiag( idx_rwgt_gps ) = Nonlinear_QC_Rel_Wgt( ii ) + if( allocated ( Errinv_input )) ptr%p%rdiag( idx_err_input_gps ) = Errinv_Input( ii ) + if( allocated ( Errinv_Adjust )) ptr%p%rdiag( idx_errinv_gps ) = Errinv_Adjust( ii ) + if( allocated ( Errinv_Final )) ptr%p%rdiag( idx_errinv_fnl_gps ) = Errinv_Final( ii ) + + if( allocated ( Observation )) ptr%p%rdiag( idx_obs_gps ) = Observation( ii ) + if( allocated ( Temperature_at_Obs_Location )) ptr%p%rdiag( idx_tref_gps ) = Temperature_at_Obs_Location( ii ) +! if( allocated ( Obs_Minus_Forecast_unadjusted )) ptr%p%rdiag( idx_hob_gps ) = Obs_Minus_Forecast_unadjusted( ii ) + if( allocated ( GPS_Type )) ptr%p%rdiag( idx_uses_gps ) = GPS_Type( ii ) + if( allocated ( Specific_Humidity_at_Obs_Location )) ptr%p%rdiag( idx_qref_gps ) = Specific_Humidity_at_Obs_Location( ii ) + + + ! This oddity is from genstats_gps.f90 which produces the NetCDF + ! formatted diag file: + ! + ! call nc_diag_metadata("Obs_Minus_Forecast_adjusted", sngl(gps_allptr%rdiag(17))*sngl(gps_allptr%rdiag(5)) ) + ! call nc_diag_metadata("Obs_Minus_Forecast_unadjusted", sngl(gps_allptr%rdiag(17))*sngl(gps_allptr%rdiag(5)) ) + ! call nc_diag_metadata("GPS_Type", sngl(gps_allptr%rdiag(20)) ) + ! call nc_diag_metadata("Temperature_at_Obs_Location", sngl(gps_allptr%rdiag(18)) ) + ! + ! It would seem from this that rdiagbuf(19) is not used? + ! And also Obs_Minus_Forecast_[un|'']adjusted is derived and not stored. + ! + ! This from setupbend.f90: + ! rdiagbuf(18,i) = trefges ! temperature at obs location (Kelvin) if monotone grid + ! rdiagbuf(19,i) = hob ! model vertical grid (interface) if monotone grid + ! rdiagbuf(20,i) = one ! uses gps_ref (one = use of bending angle) + ! + + + if( nobs == 1 ) then + !------------------------------------------------- + ! Initialize the list with the first data element + ! + call list_init(list, transfer(ptr, list_data)) + next => list + + else + !------------------------------------------------- + ! Insert subsequent nodes into the list + ! + call list_insert(next, transfer(ptr, list_data)) + next => list_next(next) + + end if + + end if + + end do + + + if( allocated( Station_ID )) deallocate( Station_ID ) + if( allocated( Observation_Class )) deallocate( Observation_Class ) + if( allocated( Observation_Type )) deallocate( Observation_Type ) + if( allocated( Observation_Subtype )) deallocate( Observation_Subtype ) + if( allocated( Latitude )) deallocate( Latitude ) + if( allocated( Longitude )) deallocate( Longitude ) + if( allocated( Incremental_Bending_Angle )) deallocate( Incremental_Bending_Angle ) + if( allocated( Pressure )) deallocate( Pressure ) + if( allocated( Height )) deallocate( Height ) + if( allocated( Time )) deallocate( Time ) + if( allocated( Model_Elevation )) deallocate( Model_Elevation ) + if( allocated( Setup_QC_Mark )) deallocate( Setup_QC_Mark ) + if( allocated( Prep_Use_Flag )) deallocate( Prep_Use_Flag ) + if( allocated( Analysis_Use_Flag )) deallocate( Analysis_Use_Flag ) + if( allocated( Nonlinear_QC_Rel_Wgt )) deallocate( Nonlinear_QC_Rel_Wgt ) + if( allocated( Errinv_Input )) deallocate( Errinv_Input ) + if( allocated( Errinv_Adjust )) deallocate( Errinv_Final ) + if( allocated( Errinv_Final )) deallocate( Errinv_Final ) + if( allocated( Observation )) deallocate( Observation ) + if( allocated( Obs_Minus_Forecast_adjusted )) deallocate( Obs_Minus_Forecast_adjusted ) + if( allocated( Obs_Minus_Forecast_unadjusted )) deallocate( Obs_Minus_Forecast_unadjusted ) + if( allocated( GPS_Type )) deallocate( GPS_Type ) + if( allocated( Temperature_at_Obs_Location )) deallocate( Temperature_at_Obs_Location ) + if( allocated( Specific_Humidity_at_Obs_Location )) deallocate( Specific_Humidity_at_Obs_Location ) + + print *, ' ' + print *, ' <-- read_diag_file_gps_nc' + + end subroutine read_diag_file_gps_nc + + + + + !--- binary read routine + ! + subroutine read_diag_file_bin( input_file, return_all, ctype, intype,expected_nreal,nobs,in_subtype, list ) + + !--- interface + character(100), intent(in) :: input_file + logical, intent(in) :: return_all + character(3), intent(in) :: ctype + integer, intent(in) :: intype, expected_nreal, in_subtype + integer, intent(out) :: nobs + type(list_node_t), pointer :: list + + + !--- local vars + type(list_node_t), pointer :: next => null() + type(data_ptr) :: ptr + + real(4),allocatable,dimension(:,:) :: rdiag + character(8),allocatable,dimension(:) :: cdiag + + character(3) :: dtype + character(10) :: otype + character(15) :: fileo,fileo_subtyp + + integer nchar,file_nreal,i,ii,mype,idate,iflag,file_itype,iscater,igrads + integer lunin,lunot,ldtype,file_subtype + integer idx,ioff02 + + data lunin / 11 / + + nobs=0 + print *, ' --> read_diag_file_bin' + print *, ' ctype = ', ctype + print *, ' intype, in_subtype = ', intype, in_subtype + print *, ' expected_nreal = ', expected_nreal + + + !--- open diag file + open(lunin, file=input_file, form='unformatted') + rewind(lunin) + + read(lunin) idate + print *, 'idate=',idate + + loopd: do + + !--- read obs header + read(lunin,IOSTAT=iflag) dtype,nchar,file_nreal,ii,mype,ioff02 + + if( iflag /= 0 ) exit loopd + + !----------------------------------------------------- + ! exit loop if the number of reals (nreal) from file + ! doesn't match the target number + ! + if(( return_all == .true. ) .OR. ( trim(dtype) == trim(ctype) .and. file_nreal /= expected_nreal )) then + print *, 'matched observation type:',dtype,' file_nreal=', file_nreal + exit + endif + + !--------------------------------------------- + ! skip to next iteration if types don't match + ! + if(( return_all == .false. ) .AND. ( trim( dtype ) /= trim( ctype ))) then + cycle + endif + + + !--- read diag info + allocate(cdiag(ii),rdiag(file_nreal,ii)) + read(lunin,IOSTAT=iflag) cdiag,rdiag + + !--- exit loop on read error + if( iflag /= 0 ) then + deallocate( cdiag,rdiag ) + exit loopd + end if + + do i=1,ii + file_itype = int(rdiag(1,i)) + file_subtype = int(rdiag(2,i)) + + !------------------------------------------------ + ! if both types and subtypes match + ! then add a new data element + ! + if(( return_all == .true. ) .OR. ( file_itype == intype .AND. file_subtype == in_subtype )) then + + nobs=nobs+1 + + !--------------------------------------------- + ! Allocate a new data element and load + ! + allocate(ptr%p) + ptr%p%stn_id = cdiag(i) + + do idx=1,max_rdiag_reals + if( idx > file_nreal ) then + ptr%p%rdiag( idx ) = 0.00 + else + ptr%p%rdiag( idx ) = rdiag( idx,i ) + end if + end do + + if( nobs == 1 ) then + !------------------------------------------------- + ! Initialize the list with the first data element + ! + call list_init(list, transfer(ptr, list_data)) + next => list + + else + !------------------------------------------------- + ! Insert subsequent nodes into the list + ! + call list_insert(next, transfer(ptr, list_data)) + next => list_next(next) + + end if + + endif + + enddo + + deallocate(cdiag,rdiag) + enddo loopd ! ending read data do loop + + close(lunin) + + print *, 'nobs added to list = ', nobs + print *, ' <-- read_diag_file_bin' + + return + end subroutine read_diag_file_bin + + + + !------------------------------------------------ + ! function find_ncdiag_id + !------------------------------------------------ + integer( i_kind ) function find_ncdiag_id( ftin ) + + integer(i_kind), intent(in) :: ftin + + integer(i_kind) :: i + + find_ncdiag_id = -1 + do i = 1, MAX_OPEN_NCDIAG + if ( ncdiag_open_id(i) == ftin ) then + find_ncdiag_id = i + return + endif + enddo + + return + end function find_ncdiag_id + + +end module conmon_read_diag diff --git a/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_mandlev.fd/data_mod.f90 b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_mandlev.fd/data_mod.f90 new file mode 100644 index 0000000000..e611a9782e --- /dev/null +++ b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_mandlev.fd/data_mod.f90 @@ -0,0 +1,220 @@ +module data + implicit none + + private + public :: data_t + public :: data_ptr + + integer, parameter,public :: max_rdiag_reals = 25 + + !-------------------------------------------------- + ! generic index numbers into the rdiagbuf array + ! for _all_ data types + ! + integer, parameter, public :: idx_obs_type = 1 ! obs type + integer, parameter, public :: idx_obs_subtype = 2 ! obs subtype + integer, parameter, public :: idx_obs_lat = 3 ! obs latitude + integer, parameter, public :: idx_obs_lon = 4 ! obs longitude + integer, parameter, public :: idx_stn_elev = 5 ! stn elevation + integer, parameter, public :: idx_pres = 6 ! obs pressure + integer, parameter, public :: idx_time = 8 ! obs time (hrs relative to analysis time) + integer, parameter, public :: idx_rwgt = 13 ! non-linear qc relative weight + + + + !-------------------------------------------------- + ! index numbers into the rdiagbuf array + ! for type ps obs + ! + ! (see setupps.f90 for more info) + ! + integer, parameter, public :: idx_obs_type_ps = 1 ! obs type + integer, parameter, public :: idx_obs_subtype_ps = 2 ! obs subtype + integer, parameter, public :: idx_obs_lat_ps = 3 ! obs latitude + integer, parameter, public :: idx_obs_lon_ps = 4 ! obs longitude + integer, parameter, public :: idx_stn_elev_ps = 5 ! stn elevation + integer, parameter, public :: idx_pres_ps = 6 ! obs pressure (hPa) + integer, parameter, public :: idx_hgt_ps = 7 ! obs height (meters) + integer, parameter, public :: idx_time_ps = 8 ! obs time (hrs relative to analysis time) + integer, parameter, public :: idx_iqc_ps = 9 ! prepbufr qc or event mark + integer, parameter, public :: idx_var_jb_ps = 10 ! non-linear qc param + integer, parameter, public :: idx_iuse_ps = 11 ! read_prepbufr data usage flag + integer, parameter, public :: idx_anl_use_ps = 12 ! analysis usage flag + integer, parameter, public :: idx_rwgt_ps = 13 ! non-linear qc relative weight + integer, parameter, public :: idx_err_input_ps = 14 ! prepbufr invers obs error (hPa**-1) + integer, parameter, public :: idx_errinv_ps = 15 ! read_prepbufr invers obs error (hPa**-1) + integer, parameter, public :: idx_errinv_fnl_ps = 16 ! final invers obs error (HPa**-1) + integer, parameter, public :: idx_obs_ps = 17 ! surface pressure observation + integer, parameter, public :: idx_obsmg_adj_ps = 18 ! obs-ges used in analysis (coverted to hPa) + integer, parameter, public :: idx_obsmg_nadj_ps = 19 ! obs-ges w/o adjustment to guess surface pressure (hPa) + integer, parameter, public :: idx_spread_ps = 20 ! spread (filled in by EnKF) + + + !-------------------------------------------------- + ! index numbers into the rdiagbuf array + ! for type q obs + ! + ! (see setupq.f90 for more info) + ! + integer, parameter, public :: idx_obs_type_q = 1 ! obs type + integer, parameter, public :: idx_obs_subtype_q = 2 ! obs subtype + integer, parameter, public :: idx_obs_lat_q = 3 ! obs latitude + integer, parameter, public :: idx_obs_lon_q = 4 ! obs longitude + integer, parameter, public :: idx_stn_elev_q = 5 ! stn elevation + integer, parameter, public :: idx_pres_q = 6 ! obs pressure (hPa) + integer, parameter, public :: idx_hgt_q = 7 ! obs height (meters) + integer, parameter, public :: idx_time_q = 8 ! obs time (hrs relative to analysis time) + integer, parameter, public :: idx_iqc_q = 9 ! prepbufr qc or event mark + integer, parameter, public :: idx_var_jb_q = 10 ! non-linear qc param + integer, parameter, public :: idx_iuse_q = 11 ! read_prepbufr data usage flag + integer, parameter, public :: idx_anl_use_q = 12 ! analysis usage flag + integer, parameter, public :: idx_rwgt_q = 13 ! non-linear qc relative weight + integer, parameter, public :: idx_err_input_q = 14 ! prepbufr invers obs error + integer, parameter, public :: idx_errinv_q = 15 ! read_prepbufr invers obs error + integer, parameter, public :: idx_errinv_fnl_q = 16 ! final invers obs error + integer, parameter, public :: idx_obs_q = 17 ! surface pressure observation + integer, parameter, public :: idx_obsmg_adj_q = 18 ! obs-ges used in analysis + integer, parameter, public :: idx_obsmg_nadj_q = 19 ! obs-ges w/o adjustment to guess surface pressure + integer, parameter, public :: idx_ges_sat_q = 20 ! guess saturation specific + integer, parameter, public :: idx_spread_q = 21 ! spread (filled in by EnKF) + + + + !-------------------------------------------------- + ! index numbers into the rdiagbuf array + ! for type t obs + ! + ! (see setupt.f90 for more info) + ! + integer, parameter, public :: idx_obs_type_t = 1 ! obs type + integer, parameter, public :: idx_obs_subtype_t = 2 ! obs subtype + integer, parameter, public :: idx_obs_lat_t = 3 ! obs latitude + integer, parameter, public :: idx_obs_lon_t = 4 ! obs longitude + integer, parameter, public :: idx_stn_elev_t = 5 ! stn elevation + integer, parameter, public :: idx_pres_t = 6 ! obs pressure (hPa) + integer, parameter, public :: idx_hgt_t = 7 ! obs height (meters) + integer, parameter, public :: idx_time_t = 8 ! obs time (hrs relative to analysis time) + integer, parameter, public :: idx_iqc_t = 9 ! prepbufr qc or event mark + integer, parameter, public :: idx_setup_qc_t = 10 ! setup qc or event mark + integer, parameter, public :: idx_iuse_t = 11 ! read_prepbufr data usage flag + integer, parameter, public :: idx_anl_use_t = 12 ! analysis usage flag + integer, parameter, public :: idx_rwgt_t = 13 ! combination of var_jb and rwgt + integer, parameter, public :: idx_err_input_t = 14 ! prepbufr inverse obs error + integer, parameter, public :: idx_errinv_t = 15 ! read_prepbufr inverse obs error + integer, parameter, public :: idx_errinv_fnl_t = 16 ! final inverse obs error + integer, parameter, public :: idx_obs_t = 17 ! temperature obs (K) + integer, parameter, public :: idx_omgbc_t = 18 ! obs-ges used in analysis (K) + integer, parameter, public :: idx_omgnbc_t = 19 ! obs-ges w/o bias correction (K) + integer, parameter, public :: idx_pof_t = 20 ! data pof + integer, parameter, public :: idx_vv_t = 21 ! data vertical velocity + integer, parameter, public :: idx_pbias_one = 22 ! pred bias term 1 + integer, parameter, public :: idx_pbias_two = 23 ! pred bias term 2 + integer, parameter, public :: idx_pbias_three = 24 ! pred bias term 3 + integer, parameter, public :: idx_pbias_four = 25 ! pred bias term 4 + + + !-------------------------------------------------- + ! index numbers into the rdiagbuf array + ! for type uv obs + ! + ! (see setupw.f90 for more info) + ! + integer, parameter, public :: idx_obs_type_uv = 1 ! obs type + integer, parameter, public :: idx_obs_subtype_uv = 2 ! obs subtype + integer, parameter, public :: idx_obs_lat_uv = 3 ! obs latitude + integer, parameter, public :: idx_obs_lon_uv = 4 ! obs longitude + integer, parameter, public :: idx_stn_elev_uv = 5 ! stn elevation + integer, parameter, public :: idx_pres_uv = 6 ! obs pressure (hPa) + integer, parameter, public :: idx_hgt_uv = 7 ! obs height (meters) + integer, parameter, public :: idx_time_uv = 8 ! obs time (hrs relative to analysis time) + integer, parameter, public :: idx_iqc_uv = 9 ! prepbufr qc or event mark + integer, parameter, public :: idx_setup_qc_uv = 10 ! setup qc or event mark + integer, parameter, public :: idx_iuse_uv = 11 ! read_prepbufr data usage flag + integer, parameter, public :: idx_anl_use_uv = 12 ! analysis usage flag + integer, parameter, public :: idx_rwgt_uv = 13 ! combination of var_jb and rwgt + integer, parameter, public :: idx_err_input_uv = 14 ! prepbufr inverse obs error + integer, parameter, public :: idx_errinv_uv = 15 ! read_prepbufr inverse obs error + integer, parameter, public :: idx_errinv_fnl_uv = 16 ! final inverse obs error + integer, parameter, public :: idx_u_obs_uv = 17 ! u wind component observation + integer, parameter, public :: idx_u_omgbc_uv = 18 ! u obs-ges used in analysis (m/s) + integer, parameter, public :: idx_u_omgnbc_uv = 19 ! u obs-ges w/o bias correction (m/s) + integer, parameter, public :: idx_v_obs_uv = 20 ! v wind component observation + integer, parameter, public :: idx_v_omgbc_uv = 21 ! v obs-ges used in analysis (m/s) + integer, parameter, public :: idx_v_omgnbc_uv = 22 ! v obs-ges w/o bias correction (m/s) + + + !-------------------------------------------------- + ! index numbers into the rdiagbuf array + ! for type sst obs + ! + ! (see setupsst.f90 for more info) + ! + integer, parameter, public :: idx_obs_type_sst = 1 ! obs type + integer, parameter, public :: idx_obs_subtype_sst = 2 ! obs subtype + integer, parameter, public :: idx_obs_lat_sst = 3 ! obs latitude + integer, parameter, public :: idx_obs_lon_sst = 4 ! obs longitude + integer, parameter, public :: idx_stn_elev_sst = 5 ! stn elevation + integer, parameter, public :: idx_opn_wtr_tmp_sst = 6 ! background open water temperature + integer, parameter, public :: idx_depth_sst = 7 ! observation depth (meters) + integer, parameter, public :: idx_time_sst = 8 ! obs time (hrs relative to analysis time) + integer, parameter, public :: idx_opn_wtr_pct_sst = 9 ! open water percentage + integer, parameter, public :: idx_setup_qc_sst = 10 ! setup qc or event mark + integer, parameter, public :: idx_iuse_sst = 11 ! read_prepbufr data usage flag + integer, parameter, public :: idx_anl_use_sst = 12 ! analysis usage flag + integer, parameter, public :: idx_rwgt_sst = 13 ! combination of var_jb and rwgt + integer, parameter, public :: idx_err_input_sst = 14 ! prepbufr inverse obs error + integer, parameter, public :: idx_errinv_sst = 15 ! read_prepbufr inverse obs error + integer, parameter, public :: idx_errinv_fnl_sst = 16 ! final inverse obs error + integer, parameter, public :: idx_obs_sst = 17 ! SST observation (K) + integer, parameter, public :: idx_omgbc_sst = 18 ! obs-ges used in analysis (K) + integer, parameter, public :: idx_omgnbc_sst = 19 ! obs-ges w/o bias correction (K) + integer, parameter, public :: idx_type_sst = 20 ! type of measurment + integer, parameter, public :: idx_tr_sst = 21 ! Tr + integer, parameter, public :: idx_dt_warm_sst = 22 ! dt_warm at zob + integer, parameter, public :: idx_dt_cool_sst = 23 ! dt_cool at zob + integer, parameter, public :: idx_dtz_dtr_sst = 23 ! d(tz)/d(Tr) at zob + + + + !-------------------------------------------------- + ! index numbers into the rdiagbuf array + ! for type gps obs + ! + ! (see setupbend.f90 for more info) + ! + integer, parameter, public :: idx_obs_type_gps = 1 ! obs type + integer, parameter, public :: idx_obs_subtype_gps = 2 ! profile identifier + integer, parameter, public :: idx_obs_lat_gps = 3 ! obs latitude + integer, parameter, public :: idx_obs_lon_gps = 4 ! obs longitude + integer, parameter, public :: idx_bend_ang_gps = 5 ! incremental bending angle (x100 %) + integer, parameter, public :: idx_pres_gps = 6 ! pressure at obs location (hPa) + integer, parameter, public :: idx_height_gps = 7 ! impact height in meters + integer, parameter, public :: idx_time_gps = 8 ! obs time (hrs relative to analysis time) + integer, parameter, public :: idx_zsges_gps = 9 ! model terrain (m) + integer, parameter, public :: idx_setup_qc_gps = 10 ! setup qc or event mark + integer, parameter, public :: idx_iuse_gps = 11 ! read_prepbufr data usage flag + integer, parameter, public :: idx_anl_use_gps = 12 ! analysis usage flag + integer, parameter, public :: idx_rwgt_gps = 13 ! combination of var_jb and rwgt + integer, parameter, public :: idx_err_input_gps = 14 ! prepbufr inverse obs error + integer, parameter, public :: idx_errinv_gps = 15 ! read_prepbufr inverse obs error + integer, parameter, public :: idx_errinv_fnl_gps = 16 ! final inverse obs error + integer, parameter, public :: idx_obs_gps = 17 ! bending angle observation (radians) + integer, parameter, public :: idx_tref_gps = 18 ! temperature at obs location (K) + integer, parameter, public :: idx_hob_gps = 19 ! model vertival grid + integer, parameter, public :: idx_uses_gps = 20 ! uses gps_ref + integer, parameter, public :: idx_qref_gps = 21 ! specific humidity at obs location (kg/kg) + integer, parameter, public :: idx_spread_gps = 22 ! spread + + + ! Data is stored in data_t + type :: data_t + character(8) :: stn_id + real,dimension(25) :: rdiag + end type data_t + + ! A container for storing data_t pointers + type :: data_ptr + type(data_t), pointer :: p + end type data_ptr + +end module data diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_mandlev/generic_list.f90 b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_mandlev.fd/generic_list.f90 similarity index 100% rename from util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_mandlev/generic_list.f90 rename to util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_mandlev.fd/generic_list.f90 diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_mandlev/grads_mandlev.f90 b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_mandlev.fd/grads_mandlev.f90 similarity index 90% rename from util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_mandlev/grads_mandlev.f90 rename to util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_mandlev.fd/grads_mandlev.f90 index 169411a257..00542bd878 100644 --- a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_mandlev/grads_mandlev.f90 +++ b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_mandlev.fd/grads_mandlev.f90 @@ -7,7 +7,7 @@ !------------------------------------------------------------- subroutine grads_mandlev(fileo,ifileo,nobs,nreal,nlev,plev,iscater,igrads,& - isubtype,subtype,list) + isubtype,subtype,list,run) use generic_list use data @@ -26,14 +26,14 @@ subroutine grads_mandlev(fileo,ifileo,nobs,nreal,nlev,plev,iscater,igrads,& real(4),dimension(nlev) :: plev real(4) rlat,rlon,rp - character(3) subtype + character(3) subtype,run character(8) stid character(ifileo) :: fileo character(30) :: files,filegrads character(8) :: stidend integer nobs,nreal,nlfag,nflag0,nlev,nlev0,getlev,iscater,igrads,nflg0 real*4 :: rtim,xlat0,xlon0 - character(30) :: filein + character(30) :: filein, file_nobs integer :: ifileo,i,j,ii,k,nreal_m2,ctr,obs_ctr integer :: ilat,ilon,ipres,itime,iweight,ndup @@ -63,13 +63,11 @@ subroutine grads_mandlev(fileo,ifileo,nobs,nreal,nlev,plev,iscater,igrads,& ! Retrieve data from the linked list and load ! into the cdiag and rdiag_m2 arrays ! -! print *, 'Associated(list) = ', associated( list ) obs_ctr = 0 next => list do while ( associated( next ) == .TRUE. ) ptr = transfer(list_get( next ), ptr) -! print *, 'node data:', ptr%p next => list_next( next ) obs_ctr = obs_ctr + 1 @@ -83,7 +81,7 @@ subroutine grads_mandlev(fileo,ifileo,nobs,nreal,nlev,plev,iscater,igrads,& if(iscater ==1) then - files=trim(fileo)//'_'//trim(subtype)//'.scater' + files=trim(fileo)//'_'//trim(subtype)//'.scater.'//trim(run) open(51,file=files,form='unformatted') write(51) nobs,nreal_m2 write(51) rdiag_m2 @@ -91,7 +89,7 @@ subroutine grads_mandlev(fileo,ifileo,nobs,nreal,nlev,plev,iscater,igrads,& endif if (igrads ==1) then - filegrads=trim(fileo)//'_'//trim(subtype)//'_grads' + filegrads=trim(fileo)//'_'//trim(subtype)//'.grads.'//trim(run) open(21,file=filegrads,form='unformatted') @@ -124,7 +122,6 @@ subroutine grads_mandlev(fileo,ifileo,nobs,nreal,nlev,plev,iscater,igrads,& write(21) stid,rlat,rlon,rtim,1,0 write(21) plev(k),(rdiag_m2(j,i),j=3,nreal_m2) -! print *, 'added obs to level plev(k) ', plev(k) ctr = ctr + 1 endif @@ -137,6 +134,11 @@ subroutine grads_mandlev(fileo,ifileo,nobs,nreal,nlev,plev,iscater,igrads,& print *, 'num recs written to GrADS file = ', ctr + file_nobs=trim(fileo)//'_'//trim(subtype)//'.nobs.'//trim(run) + open( 32, file=file_nobs, form='formatted', status='new' ) + write(32,*) trim(fileo), ',', trim(subtype), ',', ctr + close( 32 ) + endif deallocate(rdiag_m2,cdiag) diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radang.fd/kinds.F90 b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_mandlev.fd/kinds.F90 similarity index 100% rename from util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radang.fd/kinds.F90 rename to util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_mandlev.fd/kinds.F90 diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_mandlev/maingrads_mandlev.f90 b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_mandlev.fd/maingrads_mandlev.f90 similarity index 73% rename from util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_mandlev/maingrads_mandlev.f90 rename to util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_mandlev.fd/maingrads_mandlev.f90 index ebaac17d15..d87b8c40c0 100644 --- a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_mandlev/maingrads_mandlev.f90 +++ b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_mandlev.fd/maingrads_mandlev.f90 @@ -9,26 +9,14 @@ program maingrads_mandlev use generic_list use data + use conmon_read_diag implicit none interface - subroutine read_conv2grads(ctype,stype,itype,nreal,nobs,isubtype,subtype,list) - use generic_list - character(3) :: ctype - character(10) :: stype - integer :: itype - integer :: nreal - integer :: nobs - integer :: isubtype - character(3) :: subtype - type(list_node_t),pointer :: list - end subroutine read_conv2grads - - subroutine grads_mandlev(fileo,ifileo,nobs,nreal,nlev,plev,iscater,igrads,& - isubtype,subtype,list) + isubtype,subtype,list,run) use generic_list @@ -39,6 +27,7 @@ subroutine grads_mandlev(fileo,ifileo,nobs,nreal,nlev,plev,iscater,igrads,& real(4),dimension(nlev) :: plev character(3) :: subtype type(list_node_t), pointer :: list + character(3) :: run end subroutine grads_mandlev end interface @@ -55,10 +44,13 @@ end subroutine grads_mandlev type(list_node_t), pointer :: next => null() type(data_ptr) :: ptr + !--- namelist with defaults + logical :: netcdf = .false. + character(100) :: input_file = "conv_diag" + character(3) :: run = "ges" + namelist /input/input_file,intype,stype,itype,nreal,iscater,igrads,subtype,isubtype,netcdf,run - namelist /input/intype,stype,itype,nreal,iscater,igrads,subtype,isubtype integer n_mand - data n_mand / 13 / data pmand /1000.,925.,850.,700.,500.,400.,300.,250.,200.,150.,100.,& 70.,50./ @@ -68,6 +60,7 @@ end subroutine grads_mandlev write(6,*)' User input :' write(6,input) + print *, 'input_file = ', input_file print *, 'intype = ', intype print *, 'stype = ', stype print *, 'itype = ', itype @@ -76,15 +69,19 @@ end subroutine grads_mandlev print *, 'igrads = ', igrads print *, 'subtype = ', subtype print *, 'isubtype = ', isubtype + print *, 'netcdf = ', netcdf lstype=len_trim(stype) - call read_conv2grads( intype,stype,itype,nreal,nobs,isubtype,subtype,list ) + write(6,*)'netcdf =', netcdf + call set_netcdf_read( netcdf ) + + call conmon_read_diag_file( input_file,intype,itype,nreal,nobs,isubtype,list ) if( nobs > 0 ) then call grads_mandlev(stype,lstype,nobs,nreal,n_mand,pmand,iscater,igrads,& - isubtype,subtype,list) + isubtype,subtype,list,run) else print *, 'NOBS <= 0, NO OUTPUT GENERATED' end if diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_mandlev/makefile.grads_mandlev b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_mandlev.fd/makefile.grads_mandlev similarity index 96% rename from util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_mandlev/makefile.grads_mandlev rename to util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_mandlev.fd/makefile.grads_mandlev index 6b6b72671a..f555b4ba6f 100755 --- a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_mandlev/makefile.grads_mandlev +++ b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_mandlev.fd/makefile.grads_mandlev @@ -11,7 +11,7 @@ SRCS= data_mod.f90 generic_list.f90 maingrads_mandlev.f90 read_conv2grads.f90 g OBJS= data_mod.o generic_list.o maingrads_mandlev.o read_conv2grads.o grads_mandlev.o rm_dups.o convinfo.o -CMD= grads_mandlev.x +CMD= conmon_grads_mandlev.x all: $(CMD) diff --git a/util/Conventional_Monitor/image_gen/sorc/read_pw/rm_dups.f90 b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_mandlev.fd/rm_dups.f90 similarity index 100% rename from util/Conventional_Monitor/image_gen/sorc/read_pw/rm_dups.f90 rename to util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_mandlev.fd/rm_dups.f90 diff --git a/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_sfc.fd/CMakeLists.txt b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_sfc.fd/CMakeLists.txt new file mode 100644 index 0000000000..40641e359a --- /dev/null +++ b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_sfc.fd/CMakeLists.txt @@ -0,0 +1,17 @@ +cmake_minimum_required(VERSION 2.6) + file(GLOB CONMON_GRADS_SFC_SRC ${CMAKE_CURRENT_SOURCE_DIR}/*90 ) + set(CONMON_GRADS_SFC_Fortran_FLAGS "-fp-model strict -assume byterecl -convert big_endian -O3 -traceback -D_REAL8_ ") + set(Util_MODULE_DIR ${PROJECT_BINARY_DIR}/include/conmon_grads_sfc ) + + set_source_files_properties( ${CONMON_GRADS_SFC_SRC} PROPERTIES COMPILE_FLAGS ${CONMON_GRADS_SFC_Fortran_FLAGS} ) + add_executable(conmon_grads_sfc.x ${CONMON_GRADS_SFC_SRC} ) + set_target_properties( conmon_grads_sfc.x PROPERTIES COMPILE_FLAGS ${CONMON_GRADS_SFC_Fortran_FLAGS} ) + set_target_properties( conmon_grads_sfc.x PROPERTIES Fortran_MODULE_DIRECTORY ${Util_MODULE_DIR} ) + + include_directories( ${CORE_INCS} ${NCDIAG_INCS} ) + target_link_libraries( conmon_grads_sfc.x ${W3NCO_4_LIBRARY} ${NCDIAG_LIBRARIES} ${NETCDF_Fortran_LIBRARIES} + ${NETCDF_C_LIBRARIES} ${MPI_Fortran_LIBRARIES} ) + if(BUILD_W3NCO) + add_dependencies( conmon_grads_sfc.x ${W3NCO_4_LIBRARY} ) + endif() + diff --git a/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_sfc.fd/conmon_read_diag.F90 b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_sfc.fd/conmon_read_diag.F90 new file mode 100644 index 0000000000..0b7afcf067 --- /dev/null +++ b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_sfc.fd/conmon_read_diag.F90 @@ -0,0 +1,1839 @@ +!---------------------------------------------------------------------- +! conmon_read_diag +! +! This subroutine reads the conventional data assimilation +! diagnostic files (contained in the cnvstat tar file) and returns +! the requested obs that match the input type and subtype in a +! linked list. The diagnostic files may be in either binary or +! NetCDF format. +! +! Note: +! There are problems/mismatches between the contents of binary +! and NetCDF files for types gps and sst. +!---------------------------------------------------------------------- + +module conmon_read_diag + + !--- use ---! + use generic_list + use data + use kinds, only: i_kind,r_single,r_kind + + use nc_diag_read_mod, only: nc_diag_read_init, nc_diag_read_close, & + nc_diag_read_get_dim, nc_diag_read_get_global_attr, & + nc_diag_read_get_var_names, & + nc_diag_read_get_global_attr_names, & + nc_diag_read_get_var, nc_diag_read_get_dim_names + + use ncdr_vars, only: nc_diag_read_check_var + use ncdr_dims, only: nc_diag_read_check_dim + + + !--- implicit ---! + implicit none + + + !--- public & private ---! + private + + public :: set_netcdf_read + public :: conmon_read_diag_file + public :: conmon_return_all_obs + + interface load_nc_var + module procedure load_nc_var_int, load_nc_var_real, load_nc_var_char + end interface + + + !--- common data structures ---! + logical,save :: netcdf = .false. + + integer(i_kind), parameter :: MAX_OPEN_NCDIAG = 2 + integer(i_kind), save :: nopen_ncdiag = 0 + integer(i_kind), dimension(MAX_OPEN_NCDIAG), save :: ncdiag_open_id = (/-1, -1/) + + type ncdiag_status + logical :: nc_read + integer(i_kind) :: cur_ob_idx + integer(i_kind) :: num_records + end type ncdiag_status + + type(ncdiag_status), dimension(MAX_OPEN_NCDIAG), save :: ncdiag_open_status + + + + contains + + + subroutine load_nc_var_int( var_name, ftin, var_storage, ierr ) + character(len=*), intent(in) :: var_name + integer, intent(in) :: ftin + integer, dimension(:), allocatable, intent(out) :: var_storage + integer, intent(out) :: ierr + + if( nc_diag_read_check_var( var_name )) then + call nc_diag_read_get_var( ftin, var_name, var_storage ) + ierr = 0 + else + print *, 'WARNING: unable to read ', trim( var_name ) + ierr = 1 + end if + end subroutine + + + subroutine load_nc_var_real( var_name, ftin, var_storage, ierr ) + character(len=*), intent(in) :: var_name + integer, intent(in) :: ftin + real(r_single), dimension(:), allocatable, intent(out) :: var_storage + integer, intent(out) :: ierr + + if( nc_diag_read_check_var( var_name )) then + call nc_diag_read_get_var( ftin, var_name, var_storage ) + ierr=0 + else + print *, 'WARNING: unable to read ', trim( var_name ) + ierr=1 + end if + end subroutine + + + subroutine load_nc_var_char( var_name, ftin, var_storage, ierr ) + character(len=*), intent(in) :: var_name + integer, intent(in) :: ftin + character(len=:), dimension(:), allocatable, intent(out) :: var_storage + integer, intent(out) :: ierr + + if( nc_diag_read_check_var( var_name )) then + call nc_diag_read_get_var( ftin, var_name, var_storage ) + ierr=0 + else + print *, 'WARNING: unable to read ', trim( var_name ) + ierr=1 + end if + end subroutine + + + + !------------------------------------------------------------ + ! set_netcdf_read + ! + ! set the use_netcdf flag to signal binary (default) or + ! netcdf formatted diagnostic files. + !------------------------------------------------------------ + subroutine set_netcdf_read( use_netcdf ) + logical,intent(in) :: use_netcdf + + netcdf = use_netcdf + + end subroutine set_netcdf_read + + + + !--------------------------------------------------------------- + ! conmon_read_diag_file + ! + ! Public routine to read a conventional diagnostic file + ! + ! Obs in the input_file are returned in the list according + ! to these rules: + ! + ! 1. All obs matching intype and in_subtype are returned. + ! + ! 2. If there are no subtype values in the input_file then + ! all obs matching intype are returned. + ! + !--------------------------------------------------------------- + subroutine conmon_read_diag_file( input_file, ctype, intype, expected_nreal, nobs, in_subtype, list ) + + !--- interface + character(100), intent(in) :: input_file + character(3), intent(in) :: ctype + + !--- note expected_nreal has no meaning for netcdf files + integer, intent(in) :: intype, expected_nreal, in_subtype + integer, intent(out) :: nobs + type(list_node_t), pointer :: list + logical :: return_all = .false. + + write(6,*)'--> conmon_read_diag_file' + + if ( netcdf ) then + write(6,*) ' call nc read subroutine' + call read_diag_file_nc( input_file, return_all, ctype, intype, expected_nreal, nobs, in_subtype, list ) + else + call read_diag_file_bin( input_file,return_all, ctype, intype, expected_nreal,nobs,in_subtype, list ) + end if + + write(6,*)"<-- conmon_read_diag_file" + + end subroutine conmon_read_diag_file + + + + !------------------------------------------------------------------ + ! conmon_return_all_obs + ! + ! Retrieve all obs from a given conventional diagnostic file. + ! Note that the NetCDF formatted diag files always contain only + ! one conventional data type (gps, ps, q, sst, t, uv), while + ! binary formatted diag files contain all types for a single + ! ges or anl run. + ! + ! Note: the ctype parameter only has meaning for NetCDF + ! formatted diag files. + !------------------------------------------------------------------ + subroutine conmon_return_all_obs( input_file, ctype, nobs, list ) + + !--- interface + character(100), intent(in) :: input_file + character(3), intent(in) :: ctype + integer, intent(out) :: nobs + type(list_node_t), pointer :: list + + logical :: return_all = .true. + integer :: intype, expected_nreal, in_subtype + + write(6,*)'--> conmon_return_all_obs' + nobs = 0 + + ! + ! Q: Can I re-use the read_diag_* to do this read, + ! adding extra param(s) to switch on _all_ obs? + ! Those routines are private to this module so + ! that wouldn't pose a complexity problem for + ! accessing the routines. + ! + if ( netcdf ) then + write(6,*) ' call nc retrieve all routine' + call read_diag_file_nc( input_file, return_all, ctype, intype, expected_nreal, nobs, in_subtype, list ) + else + write(6,*) ' call bin retrieve all routine' + call read_diag_file_bin( input_file,return_all, ctype, intype, expected_nreal,nobs,in_subtype, list ) + end if + + write(6,*)'<-- conmon_return_all_obs' + + end subroutine conmon_return_all_obs + + + !------------------------------- + ! read_diag_file_nc + ! + ! NetCDF read routine + !------------------------------- + subroutine read_diag_file_nc( input_file, return_all, ctype, intype, expected_nreal, nobs, in_subtype, list ) + + !--- interface + character(100), intent(in) :: input_file + logical, intent(in) :: return_all + character(3), intent(in) :: ctype + integer, intent(in) :: intype, expected_nreal, in_subtype + integer, intent(out) :: nobs + type(list_node_t), pointer :: list + + !--- local vars + type(list_node_t), pointer :: next => null() + type(data_ptr) :: ptr + integer :: ii, ierr, istatus, ftin, total_obs, id, idx + + data ftin / 11 / + + + print *, ' ' + print *, ' --> read_diag_file_nc' + print *, ' ctype, intype, in_subtype = ', ctype, intype, in_subtype + nobs = 0 + ierr = 0 + + if (nopen_ncdiag >= MAX_OPEN_NCDIAG) then + write(6,*) 'OPEN_RADIAG: ***ERROR*** Cannot open more than ', & + MAX_OPEN_NCDIAG, ' netcdf diag files.' + endif + + call nc_diag_read_init( input_file, ftin ) + istatus=0 + + do ii = 1, MAX_OPEN_NCDIAG + + if( ncdiag_open_id(ii) < 0 ) then + ncdiag_open_id(ii) = ftin + ncdiag_open_status(ii)%nc_read = .false. + + ncdiag_open_status(ii)%cur_ob_idx = -9999 + ncdiag_open_status(ii)%num_records = -9999 + nopen_ncdiag = nopen_ncdiag + 1 + exit + endif + + enddo + + select case ( trim( adjustl( ctype ) ) ) + + case ( 'gps' ) + call read_diag_file_gps_nc( input_file, return_all, ftin, ctype, intype, expected_nreal, nobs, in_subtype, list ) + + case ( 'ps' ) + call read_diag_file_ps_nc( input_file, return_all, ftin, ctype, intype, expected_nreal, nobs, in_subtype, list ) + + case ( 'q' ) + call read_diag_file_q_nc( input_file, return_all, ftin, ctype, intype, expected_nreal, nobs, in_subtype, list ) + + case ( 'sst' ) + call read_diag_file_sst_nc( input_file, return_all, ftin, ctype, intype, expected_nreal, nobs, in_subtype, list ) + + case ( 't' ) + call read_diag_file_t_nc( input_file, return_all, ftin, ctype, intype, expected_nreal, nobs, in_subtype, list ) + + case ( 'uv' ) + call read_diag_file_uv_nc( input_file, return_all, ftin, ctype, intype, expected_nreal, nobs, in_subtype, list ) + + case default + print *, 'ERROR: unmatched ctype :', ctype + + end select + + + id = find_ncdiag_id(ftin) + if (id < 0) then + write(6,*) 'CLOSE_RADIAG: ***ERROR*** ncdiag file ', input_file, & + ' was not opened' + endif + + call nc_diag_read_close( input_file ) + ncdiag_open_id(id) = -1 + + ncdiag_open_status(id)%nc_read = .false. + ncdiag_open_status(id)%cur_ob_idx = -9999 + ncdiag_open_status(id)%num_records = -9999 + + nopen_ncdiag = nopen_ncdiag - 1 + + print *, ' ' + print *, ' <-- read_diag_file_nc, ierr = ', ierr + + + end subroutine read_diag_file_nc + + + !--------------------------------------------------------- + ! netcdf read routine for ps data types in netcdf files + ! + subroutine read_diag_file_ps_nc( input_file, return_all, ftin, ctype, intype,expected_nreal,nobs,in_subtype, list ) + + !--- interface + character(100), intent(in) :: input_file + logical, intent(in) :: return_all + integer, intent(in) :: ftin + character(3), intent(in) :: ctype + integer, intent(in) :: intype, expected_nreal, in_subtype + integer, intent(out) :: nobs + type(list_node_t), pointer :: list + + !--- local vars + type(list_node_t), pointer :: next => null() + type(data_ptr) :: ptr + integer :: ii, ierr, istatus, total_obs, idx + logical :: have_subtype = .true. + logical :: add_obs + + !--- NetCDF file components dimension(s) + ! + character(len=:), dimension(:), allocatable :: Station_ID ! (nobs, Station_ID_maxstrlen) + character(len=:), dimension(:), allocatable :: Observation_Class ! (nobs, Station_Class_maxstrlen) + integer, dimension(:), allocatable :: Observation_Type ! (obs) + integer, dimension(:), allocatable :: Observation_Subtype ! (obs) + real(r_single), dimension(:), allocatable :: Latitude ! (obs) + real(r_single), dimension(:), allocatable :: Longitude ! (obs) + real(r_single), dimension(:), allocatable :: Station_Elevation ! (obs) + real(r_single), dimension(:), allocatable :: Pressure ! (obs) + real(r_single), dimension(:), allocatable :: Height ! (obs) + real(r_single), dimension(:), allocatable :: Time ! (obs) + real(r_single), dimension(:), allocatable :: Prep_QC_Mark ! (obs) + real(r_single), dimension(:), allocatable :: Prep_Use_Flag ! (obs) + real(r_single), dimension(:), allocatable :: Nonlinear_QC_Var_Jb ! (obs) + real(r_single), dimension(:), allocatable :: Nonlinear_QC_Rel_Wgt ! (obs) + real(r_single), dimension(:), allocatable :: Analysis_Use_Flag ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Input ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Adjust ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Final ! (obs) + real(r_single), dimension(:), allocatable :: Observation ! (obs) + real(r_single), dimension(:), allocatable :: Obs_Minus_Forecast_adjusted ! (obs) + real(r_single), dimension(:), allocatable :: Obs_Minus_Forecast_unadjusted ! (obs) + integer(i_kind) :: idate + + print *, ' ' + print *, ' --> read_diag_file_ps_nc' + + + !--- get NetCDF file dimensions + ! + if( nc_diag_read_check_dim( 'nobs' )) then + total_obs = nc_diag_read_get_dim(ftin,'nobs') + ncdiag_open_status(ii)%num_records = total_obs + print *, ' total_obs = ', total_obs + else + print *, 'ERROR: unable to read nobs' + ierr=1 + end if + + + !--- get vars + + call load_nc_var( 'Station_ID', ftin, Station_ID, ierr ) + call load_nc_var( 'Observation_Class', ftin, Observation_Class, ierr ) + call load_nc_var( 'Observation_Type', ftin, Observation_Type, ierr ) + call load_nc_var( 'Observation_Subtype', ftin, Observation_Subtype, ierr ) + if( ierr == 1 ) then + have_subtype = .false. + end if + call load_nc_var( 'Latitude', ftin, Latitude, ierr ) + call load_nc_var( 'Longitude', ftin, Longitude, ierr ) + call load_nc_var( 'Station_Elevation', ftin, Station_Elevation, ierr ) + call load_nc_var( 'Pressure', ftin, Pressure, ierr ) + call load_nc_var( 'Height', ftin, Height, ierr ) + call load_nc_var( 'Time', ftin, Time, ierr ) + call load_nc_var( 'Prep_QC_Mark', ftin, Prep_QC_Mark, ierr ) + call load_nc_var( 'Nonlinear_QC_Var_Jb', ftin, Nonlinear_QC_Var_Jb, ierr ) + call load_nc_var( 'Nonlinear_QC_Rel_Wgt', ftin, Nonlinear_QC_Rel_Wgt, ierr ) + call load_nc_var( 'Prep_Use_Flag', ftin, Prep_Use_Flag, ierr ) + call load_nc_var( 'Analysis_Use_Flag', ftin, Analysis_Use_Flag, ierr ) + call load_nc_var( 'Errinv_Input', ftin, Errinv_Input, ierr ) + call load_nc_var( 'Errinv_Adjust', ftin, Errinv_Adjust, ierr ) + call load_nc_var( 'Errinv_Final', ftin, Errinv_Final, ierr ) + call load_nc_var( 'Observation', ftin, Observation, ierr ) + call load_nc_var( 'Obs_Minus_Forecast_adjusted', ftin, Obs_Minus_Forecast_adjusted, ierr ) + call load_nc_var( 'Obs_Minus_Forecast_unadjusted', ftin, Obs_Minus_Forecast_unadjusted, ierr ) + + + + !--------------------------------------------------------------- + ! Process all obs. If type and subtype match the input values + ! add this obs to the linked list (ptr%p). + ! + nobs = 0 + do ii = 1, total_obs + + + add_obs = .false. + + !------------------------------------------------------------------------ + ! Check on Observation_Class to ctype is a sanity check -- + ! only a single class of obs are in any given NetCDF formatted diag file + ! but, if the ctype and input file don't match, things could get + ! interesting (but not in a good way). + ! + if( adjustl( trim( Observation_Class(ii) )) == adjustl( trim( ctype ))) then + + if( return_all == .true. ) then + add_obs = .true. + + else if( Observation_Type(ii) == intype ) then + + if( have_subtype == .false. ) then + add_obs = .true. + else if( Observation_Subtype(ii) == in_subtype ) then + add_obs = .true. + end if + + end if + end if + + if( add_obs == .true. ) then + + nobs=nobs+1 + + !--------------------------------------------- + ! Allocate a new data element and load + ! + allocate( ptr%p ) + ptr%p%stn_id = Station_ID( ii ) + + do idx=1,max_rdiag_reals + ptr%p%rdiag( idx ) = 0.00 + end do + + if( allocated( Observation_Type )) ptr%p%rdiag( idx_obs_type_ps ) = Observation_Type( ii ) + if( allocated( Observation_Subtype )) ptr%p%rdiag( idx_obs_subtype_ps ) = Observation_Subtype( ii ) + if( allocated( Latitude )) ptr%p%rdiag( idx_obs_lat_ps ) = Latitude( ii ) + if( allocated( Longitude )) ptr%p%rdiag( idx_obs_lon_ps ) = Longitude( ii ) + if( allocated( Station_Elevation )) ptr%p%rdiag( idx_stn_elev_ps ) = Station_Elevation( ii ) + if( allocated( Pressure )) ptr%p%rdiag( idx_pres_ps ) = Pressure( ii ) + if( allocated( Height )) ptr%p%rdiag( idx_hgt_ps ) = Height( ii ) + if( allocated( Time )) ptr%p%rdiag( idx_time_ps ) = Time( ii ) + if( allocated( Prep_QC_Mark )) ptr%p%rdiag( idx_iqc_ps ) = Prep_QC_Mark( ii ) + if( allocated( Nonlinear_QC_Var_Jb )) ptr%p%rdiag( idx_var_jb_ps ) = Nonlinear_QC_Var_Jb( ii ) + if( allocated( Prep_Use_Flag )) ptr%p%rdiag( idx_iuse_ps ) = Prep_Use_Flag( ii ) + if( allocated( Analysis_Use_Flag )) ptr%p%rdiag( idx_anl_use_ps ) = Analysis_Use_Flag( ii ) + if( allocated( Nonlinear_QC_Rel_Wgt )) ptr%p%rdiag( idx_rwgt_ps ) = Nonlinear_QC_Rel_Wgt( ii ) + if( allocated( Errinv_Input )) ptr%p%rdiag( idx_err_input_ps ) = Errinv_Input( ii ) + if( allocated( Errinv_Adjust )) ptr%p%rdiag( idx_errinv_ps ) = Errinv_Adjust( ii ) + if( allocated( Errinv_Final )) ptr%p%rdiag( idx_errinv_fnl_ps ) = Errinv_Final( ii ) + if( allocated( Observation )) ptr%p%rdiag( idx_obs_ps ) = Observation( ii ) + if( allocated( Obs_Minus_Forecast_adjusted )) ptr%p%rdiag( idx_obsmg_adj_ps ) = Obs_Minus_Forecast_adjusted( ii ) + if( allocated( Obs_Minus_Forecast_unadjusted )) ptr%p%rdiag( idx_obsmg_nadj_ps ) = Obs_Minus_Forecast_unadjusted( ii ) + + if( nobs == 1 ) then + !------------------------------------------------- + ! Initialize the list with the first data element + ! + call list_init(list, transfer(ptr, list_data)) + next => list + + else + !------------------------------------------------- + ! Insert subsequent nodes into the list + ! + call list_insert(next, transfer(ptr, list_data)) + next => list_next(next) + end if + + end if + + end do + + + if( allocated( Station_ID )) deallocate( Station_ID ) + if( allocated( Observation_Class )) deallocate( Observation_Class ) + if( allocated( Observation_Type )) deallocate( Observation_Type ) + if( allocated( Observation_Subtype )) deallocate( Observation_Subtype ) + if( allocated( Latitude )) deallocate( Latitude ) + if( allocated( Longitude )) deallocate( Longitude ) + if( allocated( Station_Elevation )) deallocate( Station_Elevation ) + if( allocated( Time )) deallocate( Time ) + if( allocated( Prep_QC_Mark )) deallocate( Prep_QC_Mark ) + if( allocated( Prep_Use_Flag )) deallocate( Prep_Use_Flag ) + if( allocated( Nonlinear_QC_Var_Jb )) deallocate( Nonlinear_QC_Var_Jb ) + if( allocated( Nonlinear_QC_Rel_Wgt )) deallocate( Nonlinear_QC_Rel_Wgt ) + if( allocated( Analysis_Use_Flag )) deallocate( Analysis_Use_Flag ) + if( allocated( Errinv_Input )) deallocate( Errinv_Input ) + if( allocated( Errinv_Adjust )) deallocate( Errinv_Final ) + if( allocated( Errinv_Final )) deallocate( Errinv_Final ) + if( allocated( Observation )) deallocate( Observation ) + if( allocated( Obs_Minus_Forecast_adjusted )) deallocate( Obs_Minus_Forecast_adjusted ) + if( allocated( Obs_Minus_Forecast_unadjusted )) deallocate( Obs_Minus_Forecast_unadjusted ) + + print *, ' ' + print *, ' <-- read_diag_file_ps_nc' + + end subroutine read_diag_file_ps_nc + + + !--------------------------------------------------------- + ! netcdf read routine for q data types in netcdf files + ! + subroutine read_diag_file_q_nc( input_file, return_all, ftin, ctype, intype,expected_nreal,nobs,in_subtype, list ) + + !--- interface + character(100), intent(in) :: input_file + logical, intent(in) :: return_all + integer, intent(in) :: ftin + character(3), intent(in) :: ctype + integer, intent(in) :: intype, expected_nreal, in_subtype + integer, intent(out) :: nobs + type(list_node_t), pointer :: list + + !--- local vars + type(list_node_t), pointer :: next => null() + type(data_ptr) :: ptr + integer :: ii, ierr, istatus, total_obs, idx + logical :: have_subtype = .true. + logical :: add_obs + + !--- NetCDF file components dimension(s) + ! + character(len=:), dimension(:), allocatable :: Station_ID ! (nobs, Station_ID_maxstrlen) + character(len=:), dimension(:), allocatable :: Observation_Class ! (nobs, Station_Class_maxstrlen) + integer, dimension(:), allocatable :: Observation_Type ! (obs) + integer, dimension(:), allocatable :: Observation_Subtype ! (obs) + real(r_single), dimension(:), allocatable :: Latitude ! (obs) + real(r_single), dimension(:), allocatable :: Longitude ! (obs) + real(r_single), dimension(:), allocatable :: Station_Elevation ! (obs) + real(r_single), dimension(:), allocatable :: Pressure ! (obs) + real(r_single), dimension(:), allocatable :: Height ! (obs) + real(r_single), dimension(:), allocatable :: Time ! (obs) + real(r_single), dimension(:), allocatable :: Prep_QC_Mark ! (obs) + real(r_single), dimension(:), allocatable :: Prep_Use_Flag ! (obs) + real(r_single), dimension(:), allocatable :: Nonlinear_QC_Var_Jb ! (obs) + real(r_single), dimension(:), allocatable :: Nonlinear_QC_Rel_Wgt ! (obs) + real(r_single), dimension(:), allocatable :: Analysis_Use_Flag ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Input ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Adjust ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Final ! (obs) + real(r_single), dimension(:), allocatable :: Observation ! (obs) + real(r_single), dimension(:), allocatable :: Obs_Minus_Forecast_adjusted ! (obs) + real(r_single), dimension(:), allocatable :: Obs_Minus_Forecast_unadjusted ! (obs) + real(r_single), dimension(:), allocatable :: Forecast_Saturation_Spec_Hum ! (obs) + integer(i_kind) :: idate + + print *, ' ' + print *, ' --> read_diag_file_q_nc' + + + !--- get NetCDF file dimensions + ! + if( nc_diag_read_check_dim( 'nobs' )) then + total_obs = nc_diag_read_get_dim(ftin,'nobs') + ncdiag_open_status(ii)%num_records = total_obs + print *, ' total_obs = ', total_obs + else + print *, 'ERROR: unable to read nobs' + ierr=1 + end if + + + !--- get vars + + call load_nc_var( 'Station_ID', ftin, Station_ID, ierr ) + call load_nc_var( 'Observation_Class', ftin, Observation_Class, ierr ) + call load_nc_var( 'Observation_Type', ftin, Observation_Type, ierr ) + call load_nc_var( 'Observation_Subtype', ftin, Observation_Subtype, ierr ) + if( ierr == 1 ) then + have_subtype = .false. + end if + call load_nc_var( 'Latitude', ftin, Latitude, ierr ) + call load_nc_var( 'Longitude', ftin, Longitude, ierr ) + call load_nc_var( 'Station_Elevation', ftin, Station_Elevation, ierr ) + call load_nc_var( 'Pressure', ftin, Pressure, ierr ) + call load_nc_var( 'Height', ftin, Height, ierr ) + call load_nc_var( 'Time', ftin, Time, ierr ) + call load_nc_var( 'Prep_QC_Mark', ftin, Prep_QC_Mark, ierr ) + call load_nc_var( 'Nonlinear_QC_Var_Jb', ftin, Nonlinear_QC_Var_Jb, ierr ) + call load_nc_var( 'Nonlinear_QC_Rel_Wgt', ftin, Nonlinear_QC_Rel_Wgt, ierr ) + call load_nc_var( 'Prep_Use_Flag', ftin, Prep_Use_Flag, ierr ) + call load_nc_var( 'Analysis_Use_Flag', ftin, Analysis_Use_Flag, ierr ) + call load_nc_var( 'Errinv_Input', ftin, Errinv_Input, ierr ) + call load_nc_var( 'Errinv_Adjust', ftin, Errinv_Adjust, ierr ) + call load_nc_var( 'Errinv_Final', ftin, Errinv_Final, ierr ) + call load_nc_var( 'Observation', ftin, Observation, ierr ) + call load_nc_var( 'Obs_Minus_Forecast_adjusted', ftin, Obs_Minus_Forecast_adjusted, ierr ) + call load_nc_var( 'Obs_Minus_Forecast_unadjusted', ftin, Obs_Minus_Forecast_unadjusted, ierr ) + call load_nc_var( 'Forecast_Saturation_Spec_Hum', ftin, Forecast_Saturation_Spec_Hum, ierr ) + + + + !--------------------------------------------------------------- + ! Process all obs. If type and subtype match the input values + ! add this obs to the linked list (ptr%p). + ! + nobs = 0 + do ii = 1, total_obs + + add_obs = .false. + + !------------------------------------------------------------------------ + ! Check on Observation_Class to ctype is a sanity check -- + ! only a single class of obs are in any given NetCDF formatted diag file + ! but, if the ctype and input file don't match, things could get + ! interesting (but not in a good way). + ! + if( adjustl( trim( Observation_Class(ii) )) == adjustl( trim( ctype ))) then + + if( return_all == .true. ) then + add_obs = .true. + + else if( Observation_Type(ii) == intype ) then + + if( have_subtype == .false. ) then + add_obs = .true. + else if( Observation_Subtype(ii) == in_subtype ) then + add_obs = .true. + end if + + end if + end if + + + if( add_obs == .true. ) then + + nobs=nobs+1 + + !--------------------------------------------- + ! Allocate a new data element and load + ! + allocate(ptr%p) + ptr%p%stn_id = Station_ID( ii ) + + do idx=1,max_rdiag_reals + ptr%p%rdiag( idx ) = 0.00 + end do + + if( allocated( Observation_Type )) ptr%p%rdiag( idx_obs_type_q ) = Observation_Type( ii ) + if( allocated( Observation_Subtype )) ptr%p%rdiag( idx_obs_subtype_q ) = Observation_Subtype( ii ) + if( allocated( Latitude )) ptr%p%rdiag( idx_obs_lat_q ) = Latitude( ii ) + if( allocated( Longitude )) ptr%p%rdiag( idx_obs_lon_q ) = Longitude( ii ) + if( allocated( Station_Elevation )) ptr%p%rdiag( idx_stn_elev_q ) = Station_Elevation( ii ) + if( allocated( Pressure )) ptr%p%rdiag( idx_pres_q ) = Pressure( ii ) + if( allocated( Height )) ptr%p%rdiag( idx_hgt_q ) = Height( ii ) + if( allocated( Time )) ptr%p%rdiag( idx_time_q ) = Time( ii ) + if( allocated( Prep_QC_Mark )) ptr%p%rdiag( idx_iqc_q ) = Prep_QC_Mark( ii ) + if( allocated( Nonlinear_QC_Var_Jb )) ptr%p%rdiag( idx_var_jb_q ) = Nonlinear_QC_Var_Jb( ii ) + if( allocated( Prep_Use_Flag )) ptr%p%rdiag( idx_iuse_q ) = Prep_Use_Flag( ii ) + if( allocated( Analysis_Use_Flag )) ptr%p%rdiag( idx_anl_use_q ) = Analysis_Use_Flag( ii ) + if( allocated( Nonlinear_QC_Rel_Wgt )) ptr%p%rdiag( idx_rwgt_q ) = Nonlinear_QC_Rel_Wgt( ii ) + if( allocated( Errinv_Input )) ptr%p%rdiag( idx_err_input_q ) = Errinv_Input( ii ) + if( allocated( Errinv_Adjust )) ptr%p%rdiag( idx_errinv_q ) = Errinv_Adjust( ii ) + if( allocated( Errinv_Final )) ptr%p%rdiag( idx_errinv_fnl_q ) = Errinv_Final( ii ) + if( allocated( Observation )) ptr%p%rdiag( idx_obs_q ) = Observation( ii ) + if( allocated( Obs_Minus_Forecast_adjusted )) ptr%p%rdiag( idx_obsmg_adj_q ) = Obs_Minus_Forecast_adjusted( ii ) + if( allocated( Obs_Minus_Forecast_unadjusted )) ptr%p%rdiag( idx_obsmg_nadj_q ) = Obs_Minus_Forecast_unadjusted( ii ) + if( allocated( Forecast_Saturation_Spec_Hum )) ptr%p%rdiag( idx_ges_sat_q ) = Forecast_Saturation_Spec_Hum( ii ) + + + if( nobs == 1 ) then + !------------------------------------------------- + ! Initialize the list with the first data element + ! + call list_init(list, transfer(ptr, list_data)) + next => list + + else + !------------------------------------------------- + ! Insert subsequent nodes into the list + ! + call list_insert(next, transfer(ptr, list_data)) + next => list_next(next) + end if + + end if + + end do + + + if( allocated( Station_ID )) deallocate( Station_ID ) + if( allocated( Observation_Class )) deallocate( Observation_Class ) + if( allocated( Observation_Type )) deallocate( Observation_Type ) + if( allocated( Observation_Subtype )) deallocate( Observation_Subtype ) + if( allocated( Latitude )) deallocate( Latitude ) + if( allocated( Longitude )) deallocate( Longitude ) + if( allocated( Station_Elevation )) deallocate( Station_Elevation ) + if( allocated( Time )) deallocate( Time ) + if( allocated( Prep_QC_Mark )) deallocate( Prep_QC_Mark ) + if( allocated( Prep_Use_Flag )) deallocate( Prep_Use_Flag ) + if( allocated( Nonlinear_QC_Var_Jb )) deallocate( Nonlinear_QC_Var_Jb ) + if( allocated( Nonlinear_QC_Rel_Wgt )) deallocate( Nonlinear_QC_Rel_Wgt ) + if( allocated( Analysis_Use_Flag )) deallocate( Analysis_Use_Flag ) + if( allocated( Errinv_Input )) deallocate( Errinv_Input ) + if( allocated( Errinv_Adjust )) deallocate( Errinv_Final ) + if( allocated( Errinv_Final )) deallocate( Errinv_Final ) + if( allocated( Observation )) deallocate( Observation ) + if( allocated( Obs_Minus_Forecast_adjusted )) deallocate( Obs_Minus_Forecast_adjusted ) + if( allocated( Obs_Minus_Forecast_unadjusted )) deallocate( Obs_Minus_Forecast_unadjusted ) + if( allocated( Forecast_Saturation_Spec_Hum )) deallocate( Forecast_Saturation_Spec_Hum ) + + print *, ' ' + print *, ' <-- read_diag_file_q_nc' + + end subroutine read_diag_file_q_nc + + + + !------------------------------------------------------------- + ! netcdf read routine for ps data types in netcdf files + ! + ! NOTE1: This routine is untested. The ConMon does not + ! currently process sst obs. + ! + ! NOTE2: There are known discrepencies between the contents + ! of sst obs in binary and NetCDF files. + ! + subroutine read_diag_file_sst_nc( input_file, return_all, ftin, ctype, intype,expected_nreal,nobs,in_subtype, list ) + + !--- interface + character(100), intent(in) :: input_file + logical, intent(in) :: return_all + integer, intent(in) :: ftin + character(3), intent(in) :: ctype + integer, intent(in) :: intype, expected_nreal, in_subtype + integer, intent(out) :: nobs + type(list_node_t), pointer :: list + + !--- local vars + type(list_node_t), pointer :: next => null() + type(data_ptr) :: ptr + integer :: ii, ierr, istatus, total_obs, idx + logical :: have_subtype = .true. + logical :: add_obs + + !--- NetCDF file components dimension(s) + ! + character(len=:), dimension(:), allocatable :: Station_ID ! (nobs, Station_ID_maxstrlen) + character(len=:), dimension(:), allocatable :: Observation_Class ! (nobs, Station_Class_maxstrlen) + integer, dimension(:), allocatable :: Observation_Type ! (obs) + integer, dimension(:), allocatable :: Observation_Subtype ! (obs) + real(r_single), dimension(:), allocatable :: Latitude ! (obs) + real(r_single), dimension(:), allocatable :: Longitude ! (obs) + real(r_single), dimension(:), allocatable :: Station_Elevation ! (obs) + real(r_single), dimension(:), allocatable :: Pressure ! (obs) + real(r_single), dimension(:), allocatable :: Height ! (obs) + real(r_single), dimension(:), allocatable :: Time ! (obs) + real(r_single), dimension(:), allocatable :: Prep_QC_Mark ! (obs) + real(r_single), dimension(:), allocatable :: Prep_Use_Flag ! (obs) + real(r_single), dimension(:), allocatable :: Nonlinear_QC_Var_Jb ! (obs) + real(r_single), dimension(:), allocatable :: Nonlinear_QC_Rel_Wgt ! (obs) + real(r_single), dimension(:), allocatable :: Analysis_Use_Flag ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Input ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Adjust ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Final ! (obs) + real(r_single), dimension(:), allocatable :: Observation ! (obs) + real(r_single), dimension(:), allocatable :: Obs_Minus_Forecast_adjusted ! (obs) + real(r_single), dimension(:), allocatable :: Obs_Minus_Forecast_unadjusted ! (obs) + real(r_single), dimension(:), allocatable :: FoundationTempBG ! (obs) + real(r_single), dimension(:), allocatable :: DiurnalWarming_at_zob ! (obs) + real(r_single), dimension(:), allocatable :: SkinLayerCooling_at_zob ! (obs) + real(r_single), dimension(:), allocatable :: Sensitivity_Tzob_Tr ! (obs) + integer(i_kind) :: idate + + print *, ' ' + print *, ' --> read_diag_file_sst_nc' + + + !--- get NetCDF file dimensions + ! + if( nc_diag_read_check_dim( 'nobs' )) then + total_obs = nc_diag_read_get_dim(ftin,'nobs') + ncdiag_open_status(ii)%num_records = total_obs + print *, ' total_obs = ', total_obs + else + print *, 'ERROR: unable to read nobs' + ierr=1 + end if + + + !--- get vars + + call load_nc_var( 'Station_ID', ftin, Station_ID, ierr ) + call load_nc_var( 'Observation_Class', ftin, Station_ID, ierr ) + call load_nc_var( 'Observation_Type', ftin, Observation_Type, ierr ) + call load_nc_var( 'Observation_Subtype', ftin, Observation_Subtype, ierr ) + if( ierr == 1 ) then + have_subtype = .false. + end if + call load_nc_var( 'Latitude', ftin, Latitude, ierr ) + call load_nc_var( 'Longitude', ftin, Longitude, ierr ) + call load_nc_var( 'Station_Elevation', ftin, Station_Elevation, ierr ) + call load_nc_var( 'Pressure', ftin, Pressure, ierr ) + call load_nc_var( 'Height', ftin, Height, ierr ) + call load_nc_var( 'Time', ftin, Time, ierr ) + call load_nc_var( 'Prep_QC_Mark', ftin, Prep_QC_Mark, ierr ) + call load_nc_var( 'Nonlinear_QC_Var_Jb', ftin, Nonlinear_QC_Var_Jb, ierr ) + call load_nc_var( 'Nonlinear_QC_Rel_Wgt', ftin, Nonlinear_QC_Rel_Wgt, ierr ) + call load_nc_var( 'Prep_Use_Flag', ftin, Prep_Use_Flag, ierr ) + call load_nc_var( 'Analysis_Use_Flag', ftin, Analysis_Use_Flag, ierr ) + call load_nc_var( 'Errinv_Input', ftin, Errinv_Input, ierr ) + call load_nc_var( 'Errinv_Adjust', ftin, Errinv_Adjust, ierr ) + call load_nc_var( 'Errinv_Final', ftin, Errinv_Final, ierr ) + call load_nc_var( 'Observation', ftin, Observation, ierr ) + call load_nc_var( 'Obs_Minus_Forecast_adjusted', ftin, Obs_Minus_Forecast_adjusted, ierr ) + call load_nc_var( 'Obs_Minus_Forecast_unadjusted', ftin, Obs_Minus_Forecast_unadjusted, ierr ) + call load_nc_var( 'FoundationTempBG', ftin, FoundationTempBG, ierr ) + call load_nc_var( 'DiurnalWarming_at_zob', ftin, DiurnalWarming_at_zob, ierr ) + call load_nc_var( 'SkinLayerCooling_at_zob', ftin, SkinLayerCooling_at_zob, ierr ) + call load_nc_var( 'Sensitivity_Tzob_Tr', ftin, Sensitivity_Tzob_Tr, ierr ) + + + + !--------------------------------------------------------------- + ! Process all obs. If type and subtype match the input values + ! add this obs to the linked list (ptr%p). + ! + nobs = 0 + do ii = 1, total_obs + + add_obs = .false. + + !------------------------------------------------------------------------ + ! Check on Observation_Class to ctype is a sanity check -- + ! only a single class of obs are in any given NetCDF formatted diag + ! file + ! but, if the ctype and input file don't match, things could get + ! interesting (but not in a good way). + ! + if( adjustl( trim( Observation_Class(ii) )) == adjustl( trim( ctype ))) then + + if( return_all == .true. ) then + add_obs = .true. + + else if( Observation_Type(ii) == intype ) then + + if( have_subtype == .false. ) then + add_obs = .true. + else if( Observation_Subtype(ii) == in_subtype ) then + add_obs = .true. + end if + + end if + end if + + + if( add_obs == .true. ) then + + nobs=nobs+1 + + !--------------------------------------------- + ! Allocate a new data element and load + ! + allocate( ptr%p ) + ptr%p%stn_id = Station_ID( ii ) + + do idx=1,max_rdiag_reals + ptr%p%rdiag( idx ) = 0.00 + end do + + if( allocated( Observation_Type )) ptr%p%rdiag( idx_obs_type_sst ) = Observation_Type( ii ) + if( allocated( Observation_Subtype )) ptr%p%rdiag( idx_obs_subtype_sst ) = Observation_Subtype( ii ) + if( allocated( Latitude )) ptr%p%rdiag( idx_obs_lat_sst ) = Latitude( ii ) + if( allocated( Longitude )) ptr%p%rdiag( idx_obs_lon_sst ) = Longitude( ii ) + if( allocated( Station_Elevation )) ptr%p%rdiag( idx_stn_elev_sst ) = Station_Elevation( ii ) + + if( allocated( Pressure )) ptr%p%rdiag( idx_opn_wtr_tmp_sst ) = Pressure( ii ) ! identified as background open water temperature in setupsst.f90 + + if( allocated( Height )) ptr%p%rdiag( idx_depth_sst ) = Height( ii ) ! identified as observation depth (meters) in setupsst.f90 + + if( allocated( Time )) ptr%p%rdiag( idx_time_sst ) = Time( ii ) + +! if( allocated( )) ptr%p%rdiag( idx_opn_wtr_pct_sst ) = Prep_QC_Mark( ii ) ! identified as open water percentage in setupsst.f90 + + if( allocated( Prep_QC_Mark )) ptr%p%rdiag( idx_setup_qc_sst ) = Prep_QC_Mark( ii ) + if( allocated( Prep_Use_Flag )) ptr%p%rdiag( idx_iuse_sst ) = Prep_Use_Flag( ii ) + if( allocated( Analysis_Use_Flag )) ptr%p%rdiag( idx_anl_use_sst ) = Analysis_Use_Flag( ii ) + if( allocated( Nonlinear_QC_Rel_Wgt )) ptr%p%rdiag( idx_rwgt_sst ) = Nonlinear_QC_Rel_Wgt( ii ) + if( allocated( Errinv_Input )) ptr%p%rdiag( idx_err_input_sst ) = Errinv_Input( ii ) + if( allocated( Errinv_Adjust )) ptr%p%rdiag( idx_errinv_sst ) = Errinv_Adjust( ii ) + if( allocated( Errinv_Final )) ptr%p%rdiag( idx_errinv_fnl_sst ) = Errinv_Final( ii ) + if( allocated( Observation )) ptr%p%rdiag( idx_obs_sst ) = Observation( ii ) + if( allocated( Obs_Minus_Forecast_adjusted )) ptr%p%rdiag( idx_omgbc_sst ) = Obs_Minus_Forecast_adjusted( ii ) + if( allocated( Obs_Minus_Forecast_unadjusted )) ptr%p%rdiag( idx_omgnbc_sst ) = Obs_Minus_Forecast_unadjusted( ii ) + +! if( allocated( )) ptr%p%rdiag( idx_type_sst ) = type of measurement? per setupsst.f90 + + if( allocated( FoundationTempBG )) ptr%p%rdiag( idx_tr_sst ) = FoundationTempBG( ii ) + if( allocated( DiurnalWarming_at_Zob )) ptr%p%rdiag( idx_dt_warm_sst ) = DiurnalWarming_at_zob( ii ) + if( allocated( SkinLayerCooling_at_zob )) ptr%p%rdiag( idx_dt_cool_sst ) = SkinLayerCooling_at_zob( ii ) + if( allocated( Sensitivity_Tzob_Tr )) ptr%p%rdiag( idx_dtz_dtr_sst ) = Sensitivity_Tzob_Tr( ii ) + + + if( nobs == 1 ) then + !------------------------------------------------- + ! Initialize the list with the first data element + ! + call list_init(list, transfer(ptr, list_data)) + next => list + + else + !------------------------------------------------- + ! Insert subsequent nodes into the list + ! + call list_insert(next, transfer(ptr, list_data)) + next => list_next(next) + end if + + end if + + end do + + + if( allocated( Station_ID )) deallocate( Station_ID ) + if( allocated( Observation_Class )) deallocate( Observation_Class ) + if( allocated( Observation_Type )) deallocate( Observation_Type ) + if( allocated( Observation_Subtype )) deallocate( Observation_Subtype ) + if( allocated( Latitude )) deallocate( Latitude ) + if( allocated( Longitude )) deallocate( Longitude ) + if( allocated( Station_Elevation )) deallocate( Station_Elevation ) + if( allocated( Time )) deallocate( Time ) + if( allocated( Prep_QC_Mark )) deallocate( Prep_QC_Mark ) + if( allocated( Prep_Use_Flag )) deallocate( Prep_Use_Flag ) + if( allocated( Nonlinear_QC_Var_Jb )) deallocate( Nonlinear_QC_Var_Jb ) + if( allocated( Nonlinear_QC_Rel_Wgt )) deallocate( Nonlinear_QC_Rel_Wgt ) + if( allocated( Analysis_Use_Flag )) deallocate( Analysis_Use_Flag ) + if( allocated( Errinv_Input )) deallocate( Errinv_Input ) + if( allocated( Errinv_Adjust )) deallocate( Errinv_Final ) + if( allocated( Errinv_Final )) deallocate( Errinv_Final ) + if( allocated( Observation )) deallocate( Observation ) + if( allocated( Obs_Minus_Forecast_adjusted )) deallocate( Obs_Minus_Forecast_adjusted ) + if( allocated( Obs_Minus_Forecast_unadjusted )) deallocate( Obs_Minus_Forecast_unadjusted ) + if( allocated( FoundationTempBG )) deallocate( FoundationTempBG ) + if( allocated( DiurnalWarming_at_zob )) deallocate( DiurnalWarming_at_zob ) + if( allocated( SkinLayerCooling_at_zob )) deallocate( SkinLayerCooling_at_zob ) + if( allocated( Sensitivity_Tzob_Tr )) deallocate( Sensitivity_Tzob_Tr ) + + print *, ' ' + print *, ' <-- read_diag_file_sst_nc' + + end subroutine read_diag_file_sst_nc + + + + !--------------------------------------------------------- + ! netcdf read routine for t data types in netcdf files + ! + subroutine read_diag_file_t_nc( input_file, return_all, ftin, ctype, intype, expected_nreal, nobs, in_subtype, list ) + + !--- interface + character(100), intent(in) :: input_file + logical, intent(in) :: return_all + integer, intent(in) :: ftin + character(3), intent(in) :: ctype + integer, intent(in) :: intype, expected_nreal, in_subtype + integer, intent(out) :: nobs + type(list_node_t), pointer :: list + + !--- local vars + type(list_node_t), pointer :: next => null() + type(data_ptr) :: ptr + integer :: ii, ierr, istatus, total_obs, idx, bcor_terms + logical :: have_subtype = .true. + logical :: add_obs + + !--- NetCDF file components dimension(s) + ! + character(len=:), dimension(:), allocatable :: Station_ID ! (nobs, Station_ID_maxstrlen) + character(len=:), dimension(:), allocatable :: Observation_Class ! (nobs, Station_Class_maxstrlen) + integer, dimension(:), allocatable :: Observation_Type ! (obs) + integer, dimension(:), allocatable :: Observation_Subtype ! (obs) + real(r_single), dimension(:), allocatable :: Latitude ! (obs) + real(r_single), dimension(:), allocatable :: Longitude ! (obs) + real(r_single), dimension(:), allocatable :: Station_Elevation ! (obs) + real(r_single), dimension(:), allocatable :: Pressure ! (obs) + real(r_single), dimension(:), allocatable :: Height ! (obs) + real(r_single), dimension(:), allocatable :: Time ! (obs) + real(r_single), dimension(:), allocatable :: Prep_QC_Mark ! (obs) + real(r_single), dimension(:), allocatable :: Prep_Use_Flag ! (obs) + real(r_single), dimension(:), allocatable :: Nonlinear_QC_Var_Jb ! (obs) + real(r_single), dimension(:), allocatable :: Nonlinear_QC_Rel_Wgt ! (obs) + real(r_single), dimension(:), allocatable :: Analysis_Use_Flag ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Input ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Adjust ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Final ! (obs) + real(r_single), dimension(:), allocatable :: Observation ! (obs) + real(r_single), dimension(:), allocatable :: Obs_Minus_Forecast_adjusted ! (obs) + real(r_single), dimension(:), allocatable :: Obs_Minus_Forecast_unadjusted ! (obs) + real(r_single), dimension(:), allocatable :: Data_Pof ! (obs) + real(r_single), dimension(:), allocatable :: Data_Vertical_Velocity ! (obs) + real(r_single), dimension(:,:), allocatable :: Bias_Correction_Terms ! (nobs, Bias_Correction_Terms_arr_dim) + integer(i_kind) :: idate + integer(i_kind) :: jj + + print *, ' ' + print *, ' --> read_diag_file_t_nc' + + print *, ' input_file = ', input_file + print *, ' ftin = ', ftin + print *, ' ctype = ', ctype + print *, ' intype = ', intype + print *, ' expected_nreal = ', expected_nreal + print *, ' in_subtype = ', in_subtype + + + !--- get NetCDF file dimensions + ! + if( nc_diag_read_check_dim( 'nobs' )) then + total_obs = nc_diag_read_get_dim(ftin,'nobs') + ncdiag_open_status(ii)%num_records = total_obs + else + print *, 'ERROR: unable to read nobs' + ierr=1 + end if + + if( nc_diag_read_check_dim( 'Bias_Correction_Terms_arr_dim' )) then + bcor_terms = nc_diag_read_get_dim(ftin,'Bias_Correction_Terms_arr_dim') + else + print *, 'ERROR: unable to read bcor_terms' + ierr=1 + end if + + + + !--- get vars + + call load_nc_var( 'Station_ID', ftin, Station_ID, ierr ) + call load_nc_var( 'Observation_Class', ftin, Observation_Class, ierr ) + call load_nc_var( 'Observation_Type', ftin, Observation_Type, ierr ) + call load_nc_var( 'Observation_Subtype', ftin, Observation_Subtype, ierr ) + if( ierr == 1 ) then + have_subtype = .false. + end if + + call load_nc_var( 'Latitude', ftin, Latitude, ierr ) + call load_nc_var( 'Longitude', ftin, Longitude, ierr ) + call load_nc_var( 'Station_Elevation', ftin, Station_Elevation, ierr ) + call load_nc_var( 'Pressure', ftin, Pressure, ierr ) + call load_nc_var( 'Height', ftin, Height, ierr ) + call load_nc_var( 'Time', ftin, Time, ierr ) + call load_nc_var( 'Prep_QC_Mark', ftin, Prep_QC_Mark, ierr ) + call load_nc_var( 'Nonlinear_QC_Var_Jb', ftin, Nonlinear_QC_Var_Jb, ierr ) + call load_nc_var( 'Nonlinear_QC_Rel_Wgt', ftin, Nonlinear_QC_Rel_Wgt, ierr ) + call load_nc_var( 'Prep_Use_Flag', ftin, Prep_Use_Flag, ierr ) + call load_nc_var( 'Analysis_Use_Flag', ftin, Analysis_Use_Flag, ierr ) + call load_nc_var( 'Errinv_Input', ftin, Errinv_Input, ierr ) + call load_nc_var( 'Errinv_Adjust', ftin, Errinv_Adjust, ierr ) + call load_nc_var( 'Errinv_Final', ftin, Errinv_Final, ierr ) + call load_nc_var( 'Observation', ftin, Observation, ierr ) + call load_nc_var( 'Obs_Minus_Forecast_adjusted', ftin, Obs_Minus_Forecast_adjusted, ierr ) + call load_nc_var( 'Obs_Minus_Forecast_unadjusted', ftin, Obs_Minus_Forecast_unadjusted, ierr ) + call load_nc_var( 'Data_Pof', ftin, Data_Pof, ierr ) + call load_nc_var( 'Data_Vertical_Velocity', ftin, Data_Vertical_Velocity, ierr ) + + if( nc_diag_read_check_var( 'Bias_Correction_Terms' )) then + call nc_diag_read_get_var( ftin, 'Bias_Correction_Terms', Bias_Correction_Terms ) + ierr = 0 + else + print *, 'ERROR: unable to read Bias_Correction_Terms' + ierr = 25 + end if + + + + !--------------------------------------------------------------- + ! Process all obs. If type and subtype match the input values + ! add this obs to the linked list (ptr%p). + ! + nobs = 0 + do ii = 1, total_obs + + !------------------------------------------------------------------------ + ! Check on Observation_Class to ctype is a sanity check -- + ! only a single class of obs are in any given NetCDF formatted diag file + ! but, if the ctype and input file don't match, things could get + ! interesting (but not in a good way). + ! + add_obs = .false. + + if( adjustl( trim( Observation_Class(ii) )) == adjustl( trim( ctype ))) then + + if( return_all == .true. ) then + add_obs = .true. + + else if( Observation_Type(ii) == intype ) then + + if( have_subtype == .false. ) then + add_obs = .true. + else if( Observation_Subtype(ii) == in_subtype ) then + add_obs = .true. + end if + + end if + end if + + if( add_obs == .true. ) then + + nobs=nobs+1 + + !--------------------------------------------- + ! Allocate a new data element and load + ! + allocate(ptr%p) + ptr%p%stn_id = Station_ID( ii ) + + do idx=1,max_rdiag_reals + ptr%p%rdiag( idx ) = 0.00 + end do + + if( allocated( Observation_Type )) ptr%p%rdiag( idx_obs_type_t ) = Observation_Type( ii ) + if( allocated( Observation_Subtype )) ptr%p%rdiag( idx_obs_subtype_t ) = Observation_Subtype( ii ) + if( allocated( Latitude )) ptr%p%rdiag( idx_obs_lat_t ) = Latitude( ii ) + if( allocated( Longitude )) ptr%p%rdiag( idx_obs_lon_t ) = Longitude( ii ) + if( allocated( Station_Elevation )) ptr%p%rdiag( idx_stn_elev_t ) = Station_Elevation( ii ) + if( allocated( Pressure )) ptr%p%rdiag( idx_pres_t ) = Pressure( ii ) + if( allocated( Height )) ptr%p%rdiag( idx_hgt_t ) = Height( ii ) + if( allocated( Time )) ptr%p%rdiag( idx_time_t ) = Time( ii ) + if( allocated( Prep_QC_Mark )) ptr%p%rdiag( idx_iqc_t ) = Prep_QC_Mark( ii ) + if( allocated( Nonlinear_QC_Var_Jb )) ptr%p%rdiag( idx_setup_qc_t ) = Nonlinear_QC_Var_Jb( ii ) + if( allocated( Prep_Use_Flag )) ptr%p%rdiag( idx_iuse_t ) = Prep_Use_Flag( ii ) + if( allocated( Analysis_Use_Flag )) ptr%p%rdiag( idx_anl_use_t ) = Analysis_Use_Flag( ii ) + if( allocated( Nonlinear_QC_Rel_Wgt )) ptr%p%rdiag( idx_rwgt_t ) = Nonlinear_QC_Rel_Wgt( ii ) + if( allocated( Errinv_Input )) ptr%p%rdiag( idx_err_input_t ) = Errinv_Input( ii ) + if( allocated( Errinv_Adjust )) ptr%p%rdiag( idx_errinv_t ) = Errinv_Adjust( ii ) + if( allocated( Errinv_Final )) ptr%p%rdiag( idx_errinv_fnl_t ) = Errinv_Final( ii ) + if( allocated( Observation )) ptr%p%rdiag( idx_obs_t ) = Observation( ii ) + if( allocated( Obs_Minus_Forecast_adjusted )) ptr%p%rdiag( idx_omgbc_t ) = Obs_Minus_Forecast_adjusted( ii ) + if( allocated( Obs_Minus_Forecast_unadjusted )) ptr%p%rdiag( idx_omgnbc_t ) = Obs_Minus_Forecast_unadjusted( ii ) + if( allocated( Data_Pof )) ptr%p%rdiag( idx_pof_t ) = Data_Pof( ii ) + if( allocated( Data_Vertical_Velocity )) ptr%p%rdiag( idx_vv_t ) = Data_Vertical_Velocity( ii ) + do jj = 1, bcor_terms + if( allocated( Bias_Correction_Terms )) ptr%p%rdiag( idx_vv_t+jj ) = Bias_Correction_Terms( jj,ii ) + end do + + if( nobs == 1 ) then + !------------------------------------------------- + ! Initialize the list with the first data element + ! + call list_init(list, transfer(ptr, list_data)) + next => list + + else + !------------------------------------------------- + ! Insert subsequent nodes into the list + ! + call list_insert(next, transfer(ptr, list_data)) + next => list_next(next) + + end if + + end if + + end do + + + if( allocated( Station_ID )) deallocate( Station_ID ) + if( allocated( Observation_Class )) deallocate( Observation_Class ) + if( allocated( Observation_Type )) deallocate( Observation_Type ) + if( allocated( Observation_Subtype )) deallocate( Observation_Subtype ) + if( allocated( Latitude )) deallocate( Latitude ) + if( allocated( Longitude )) deallocate( Longitude ) + if( allocated( Station_Elevation )) deallocate( Station_Elevation ) + if( allocated( Time )) deallocate( Time ) + if( allocated( Prep_QC_Mark )) deallocate( Prep_QC_Mark ) + if( allocated( Prep_Use_Flag )) deallocate( Prep_Use_Flag ) + if( allocated( Nonlinear_QC_Var_Jb )) deallocate( Nonlinear_QC_Var_Jb ) + if( allocated( Nonlinear_QC_Rel_Wgt )) deallocate( Nonlinear_QC_Rel_Wgt ) + if( allocated( Analysis_Use_Flag )) deallocate( Analysis_Use_Flag ) + if( allocated( Errinv_Input )) deallocate( Errinv_Input ) + if( allocated( Errinv_Adjust )) deallocate( Errinv_Final ) + if( allocated( Errinv_Final )) deallocate( Errinv_Final ) + if( allocated( Observation )) deallocate( Observation ) + if( allocated( Obs_Minus_Forecast_adjusted )) deallocate( Obs_Minus_Forecast_adjusted ) + if( allocated( Obs_Minus_Forecast_unadjusted )) deallocate( Obs_Minus_Forecast_unadjusted ) + + print *, ' ' + print *, ' <-- read_diag_file_t_nc' + + end subroutine read_diag_file_t_nc + + + + !--------------------------------------------------------- + ! netcdf read routine for uv data types in netcdf files + ! + subroutine read_diag_file_uv_nc( input_file, return_all, ftin, ctype, intype, expected_nreal, nobs, in_subtype, list ) + + !--- interface + character(100), intent(in) :: input_file + logical, intent(in) :: return_all + integer, intent(in) :: ftin + character(3), intent(in) :: ctype + integer, intent(in) :: intype, expected_nreal, in_subtype + integer, intent(out) :: nobs + type(list_node_t), pointer :: list + + !--- local vars + type(list_node_t), pointer :: next => null() + type(data_ptr) :: ptr + integer :: ii, ierr, istatus, total_obs, idx + logical :: have_subtype = .true. + logical :: add_obs + + !--- NetCDF file components dimension(s) + ! + character(len=:), dimension(:), allocatable :: Station_ID ! (nobs, Station_ID_maxstrlen) + character(len=:), dimension(:), allocatable :: Observation_Class ! (nobs, Station_Class_maxstrlen) + integer, dimension(:), allocatable :: Observation_Type ! (obs) + integer, dimension(:), allocatable :: Observation_Subtype ! (obs) + real(r_single), dimension(:), allocatable :: Latitude ! (obs) + real(r_single), dimension(:), allocatable :: Longitude ! (obs) + real(r_single), dimension(:), allocatable :: Station_Elevation ! (obs) + real(r_single), dimension(:), allocatable :: Pressure ! (obs) + real(r_single), dimension(:), allocatable :: Height ! (obs) + real(r_single), dimension(:), allocatable :: Time ! (obs) + real(r_single), dimension(:), allocatable :: Prep_QC_Mark ! (obs) + real(r_single), dimension(:), allocatable :: Setup_QC_Mark ! (obs) + real(r_single), dimension(:), allocatable :: Prep_Use_Flag ! (obs) + real(r_single), dimension(:), allocatable :: Nonlinear_QC_Rel_Wgt ! (obs) + real(r_single), dimension(:), allocatable :: Nonlinear_QC_Var_Jb ! (obs) + real(r_single), dimension(:), allocatable :: Analysis_Use_Flag ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Input ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Adjust ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Final ! (obs) + real(r_single), dimension(:), allocatable :: Wind_Reduction_Factor_at_10m ! (obs) + real(r_single), dimension(:), allocatable :: u_Observation ! (obs) + real(r_single), dimension(:), allocatable :: u_Obs_Minus_Forecast_adjusted ! (obs) + real(r_single), dimension(:), allocatable :: u_Obs_Minus_Forecast_unadjusted ! (obs) + real(r_single), dimension(:), allocatable :: v_Observation ! (obs) + real(r_single), dimension(:), allocatable :: v_Obs_Minus_Forecast_adjusted ! (obs) + real(r_single), dimension(:), allocatable :: v_Obs_Minus_Forecast_unadjusted ! (obs) + integer(i_kind) :: idate + + print *, ' ' + print *, ' --> read_diag_file_uv_nc' + + + !--- get NetCDF file dimensions + ! + if( nc_diag_read_check_dim( 'nobs' )) then + total_obs = nc_diag_read_get_dim(ftin,'nobs') + ncdiag_open_status(ii)%num_records = total_obs + print *, ' total_obs = ', total_obs + else + print *, 'ERROR: unable to read nobs' + ierr=1 + end if + + + !--- get vars + + call load_nc_var( 'Station_ID', ftin, Station_ID, ierr ) + call load_nc_var( 'Observation_Class', ftin, Observation_Class, ierr ) + call load_nc_var( 'Observation_Type', ftin, Observation_Type, ierr ) + call load_nc_var( 'Observation_Subtype', ftin, Observation_Subtype, ierr ) + if( ierr == 1 ) then + have_subtype = .false. + end if + call load_nc_var( 'Latitude', ftin, Latitude, ierr ) + call load_nc_var( 'Longitude', ftin, Longitude, ierr ) + call load_nc_var( 'Station_Elevation', ftin, Station_Elevation, ierr ) + call load_nc_var( 'Pressure', ftin, Pressure, ierr ) + call load_nc_var( 'Height', ftin, Height, ierr ) + call load_nc_var( 'Time', ftin, Time, ierr ) + call load_nc_var( 'Prep_QC_Mark', ftin, Prep_QC_Mark, ierr ) + call load_nc_var( 'Setup_QC_Mark', ftin, Setup_QC_Mark, ierr ) + call load_nc_var( 'Nonlinear_QC_Rel_Wgt', ftin, Nonlinear_QC_Rel_Wgt, ierr ) + call load_nc_var( 'Prep_Use_Flag', ftin, Prep_Use_Flag, ierr ) + call load_nc_var( 'Nonlinear_QC_Var_Jb', ftin, Nonlinear_QC_Var_Jb, ierr ) + call load_nc_var( 'Analysis_Use_Flag', ftin, Analysis_Use_Flag, ierr ) + call load_nc_var( 'Errinv_Input', ftin, Errinv_Input, ierr ) + call load_nc_var( 'Errinv_Adjust', ftin, Errinv_Adjust, ierr ) + call load_nc_var( 'Errinv_Final', ftin, Errinv_Final, ierr ) + call load_nc_var( 'Wind_Reduction_Factor_at_10m', ftin, Wind_Reduction_Factor_at_10m, ierr ) + call load_nc_var( 'u_Observation', ftin, u_Observation, ierr ) + call load_nc_var( 'u_Obs_Minus_Forecast_adjusted', ftin, u_Obs_Minus_Forecast_adjusted, ierr ) + call load_nc_var( 'u_Obs_Minus_Forecast_unadjusted', ftin, u_Obs_Minus_Forecast_unadjusted, ierr ) + call load_nc_var( 'v_Observation', ftin, v_Observation, ierr ) + call load_nc_var( 'v_Obs_Minus_Forecast_adjusted', ftin, v_Obs_Minus_Forecast_adjusted, ierr ) + call load_nc_var( 'v_Obs_Minus_Forecast_unadjusted', ftin, v_Obs_Minus_Forecast_unadjusted, ierr ) + + + !--------------------------------------------------------------- + ! Process all obs. If type and subtype match the input values + ! add this obs to the linked list (ptr%p). + ! + nobs = 0 + do ii = 1, total_obs + + + !------------------------------------------------------------------------ + ! Check on Observation_Class to ctype is a sanity check -- + ! only a single class of obs are in any given NetCDF formatted diag file + ! but, if the ctype and input file don't match, things could get + ! interesting (but not in a good way). + ! + add_obs = .false. + + if( adjustl( trim( Observation_Class(ii) )) == adjustl( trim( ctype ))) then + + if( return_all == .true. ) then + add_obs = .true. + + else if( Observation_Type(ii) == intype ) then + + if( have_subtype == .false. ) then + add_obs = .true. + else if( Observation_Subtype(ii) == in_subtype ) then + add_obs = .true. + end if + + end if + end if + + if( add_obs == .true. ) then + + nobs=nobs+1 + + !--------------------------------------------- + ! Allocate a new data element and load + ! + allocate(ptr%p) + ptr%p%stn_id = Station_ID( ii ) + + do idx=1,max_rdiag_reals + ptr%p%rdiag( idx ) = 0.00 + end do + + if( allocated( Observation_Type )) ptr%p%rdiag( idx_obs_type_uv ) = Observation_Type( ii ) + if( allocated( Observation_Subtype )) ptr%p%rdiag( idx_obs_subtype_uv ) = Observation_Subtype( ii ) + if( allocated( Latitude )) ptr%p%rdiag( idx_obs_lat_uv ) = Latitude( ii ) + if( allocated( Longitude )) ptr%p%rdiag( idx_obs_lon_uv ) = Longitude( ii ) + if( allocated( Station_Elevation )) ptr%p%rdiag( idx_stn_elev_uv ) = Station_Elevation( ii ) + if( allocated( Pressure )) ptr%p%rdiag( idx_pres_uv ) = Pressure( ii ) + if( allocated( Height )) ptr%p%rdiag( idx_hgt_uv ) = Height( ii ) + if( allocated( Time )) ptr%p%rdiag( idx_time_uv ) = Time( ii ) + if( allocated( Prep_QC_Mark )) ptr%p%rdiag( idx_iqc_uv ) = Prep_QC_Mark( ii ) + +! if( allocated( Nonlinear_QC_Var_JB )) ptr%p%rdiag( idx_setup_qc_uv ) = Nonlinear_QC_Var_Jb( ii ) ! missing from diagnostic file + + if( allocated( Prep_Use_Flag )) ptr%p%rdiag( idx_iuse_uv ) = Prep_Use_Flag( ii ) + if( allocated( Analysis_Use_Flag )) ptr%p%rdiag( idx_anl_use_uv ) = Analysis_Use_Flag( ii ) + if( allocated( Nonlinear_QC_Rel_Wgt )) ptr%p%rdiag( idx_rwgt_uv ) = Nonlinear_QC_Rel_Wgt( ii ) + if( allocated( Errinv_Input )) ptr%p%rdiag( idx_err_input_uv ) = Errinv_Input( ii ) + if( allocated( Errinv_Adjust )) ptr%p%rdiag( idx_errinv_uv ) = Errinv_Adjust( ii ) + if( allocated( Errinv_Final )) ptr%p%rdiag( idx_errinv_fnl_uv ) = Errinv_Final( ii ) + + if( allocated( u_Observation )) ptr%p%rdiag( idx_u_obs_uv ) = u_Observation( ii ) + if( allocated( u_Obs_Minus_Forecast_adjusted )) ptr%p%rdiag( idx_u_omgbc_uv ) = u_Obs_Minus_Forecast_adjusted( ii ) + if( allocated( u_Obs_Minus_Forecast_unadjusted )) ptr%p%rdiag( idx_u_omgnbc_uv ) = u_Obs_Minus_Forecast_unadjusted( ii ) + if( allocated( v_Observation )) ptr%p%rdiag( idx_v_obs_uv ) = v_Observation( ii ) + if( allocated( v_Obs_Minus_Forecast_adjusted )) ptr%p%rdiag( idx_v_omgbc_uv ) = v_Obs_Minus_Forecast_adjusted( ii ) + if( allocated( v_Obs_Minus_Forecast_unadjusted )) ptr%p%rdiag( idx_v_omgnbc_uv ) = v_Obs_Minus_Forecast_unadjusted( ii ) + + + if( nobs == 1 ) then + !------------------------------------------------- + ! Initialize the list with the first data element + ! + call list_init(list, transfer(ptr, list_data)) + next => list + + else + !------------------------------------------------- + ! Insert subsequent nodes into the list + ! + call list_insert(next, transfer(ptr, list_data)) + next => list_next(next) + end if + + end if + + end do + + + if( allocated( Station_ID )) deallocate( Station_ID ) + if( allocated( Observation_Class )) deallocate( Observation_Class ) + if( allocated( Observation_Type )) deallocate( Observation_Type ) + if( allocated( Observation_Subtype )) deallocate( Observation_Subtype ) + if( allocated( Latitude )) deallocate( Latitude ) + if( allocated( Longitude )) deallocate( Longitude ) + if( allocated( Station_Elevation )) deallocate( Station_Elevation ) + if( allocated( Time )) deallocate( Time ) + if( allocated( Prep_QC_Mark )) deallocate( Prep_QC_Mark ) + if( allocated( Prep_Use_Flag )) deallocate( Prep_Use_Flag ) + if( allocated( Nonlinear_QC_Var_Jb )) deallocate( Nonlinear_QC_Var_Jb ) + if( allocated( Nonlinear_QC_Rel_Wgt )) deallocate( Nonlinear_QC_Rel_Wgt ) + if( allocated( Analysis_Use_Flag )) deallocate( Analysis_Use_Flag ) + if( allocated( Errinv_Input )) deallocate( Errinv_Input ) + if( allocated( Errinv_Adjust )) deallocate( Errinv_Final ) + if( allocated( Errinv_Final )) deallocate( Errinv_Final ) + if( allocated( Wind_Reduction_Factor_at_10m )) deallocate( Wind_Reduction_Factor_at_10m ) + if( allocated( u_Observation )) deallocate( u_Observation ) + if( allocated( u_Obs_Minus_Forecast_adjusted )) deallocate( u_Obs_Minus_Forecast_adjusted ) + if( allocated( u_Obs_Minus_Forecast_unadjusted )) deallocate( u_Obs_Minus_Forecast_unadjusted ) + if( allocated( v_Observation )) deallocate( v_Observation ) + if( allocated( v_Obs_Minus_Forecast_adjusted )) deallocate( v_Obs_Minus_Forecast_adjusted ) + if( allocated( v_Obs_Minus_Forecast_unadjusted )) deallocate( v_Obs_Minus_Forecast_unadjusted ) + + print *, ' ' + print *, ' <-- read_diag_file_uv_nc' + + end subroutine read_diag_file_uv_nc + + + !----------------------------------------------------------- + ! netcdf read routine for gps data types in netcdf files + ! + ! NOTE1: This routine is untested. At present the ConMon + ! does not process gps data. There are plans to + ! change that though. + ! + ! NOTE2: There are known descrepencies between gps obs + ! in binary and NetCDF formatted diag files. See + ! comments below. + ! + subroutine read_diag_file_gps_nc( input_file, return_all, ftin, ctype, intype,expected_nreal,nobs,in_subtype, list ) + + !--- interface + character(100), intent(in) :: input_file + logical, intent(in) :: return_all + integer, intent(in) :: ftin + character(3), intent(in) :: ctype + integer, intent(in) :: intype, expected_nreal, in_subtype + integer, intent(out) :: nobs + type(list_node_t), pointer :: list + + !--- local vars + type(list_node_t), pointer :: next => null() + type(data_ptr) :: ptr + integer :: ii, ierr, istatus, total_obs, idx + logical :: have_subtype = .true. + logical :: add_obs + + !--- NetCDF file components dimension(s) + ! + character(len=:), dimension(:), allocatable :: Station_ID ! (nobs, Station_ID_maxstrlen) + character(len=:), dimension(:), allocatable :: Observation_Class ! (nobs, Station_Class_maxstrlen) + integer, dimension(:), allocatable :: Observation_Type ! (obs) + integer, dimension(:), allocatable :: Observation_Subtype ! (obs) + real(r_single), dimension(:), allocatable :: Latitude ! (obs) + real(r_single), dimension(:), allocatable :: Longitude ! (obs) + real(r_single), dimension(:), allocatable :: Incremental_Bending_Angle ! (obs) + real(r_single), dimension(:), allocatable :: Station_Elevation ! (obs) + real(r_single), dimension(:), allocatable :: Pressure ! (obs) + real(r_single), dimension(:), allocatable :: Height ! (obs) + real(r_single), dimension(:), allocatable :: Time ! (obs) + real(r_single), dimension(:), allocatable :: Model_Elevation ! (obs) + real(r_single), dimension(:), allocatable :: Setup_QC_Mark ! (obs) + real(r_single), dimension(:), allocatable :: Prep_Use_Flag ! (obs) + real(r_single), dimension(:), allocatable :: Nonlinear_QC_Var_Jb ! (obs) + real(r_single), dimension(:), allocatable :: Nonlinear_QC_Rel_Wgt ! (obs) + real(r_single), dimension(:), allocatable :: Analysis_Use_Flag ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Input ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Adjust ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Final ! (obs) + real(r_single), dimension(:), allocatable :: Observation ! (obs) + real(r_single), dimension(:), allocatable :: Obs_Minus_Forecast_adjusted ! (obs) + real(r_single), dimension(:), allocatable :: Obs_Minus_Forecast_unadjusted ! (obs) + real(r_single), dimension(:), allocatable :: GPS_Type ! (obs) + real(r_single), dimension(:), allocatable :: Temperature_at_Obs_Location ! (obs) + real(r_single), dimension(:), allocatable :: Specific_Humidity_at_Obs_Location ! (obs) + + integer(i_kind) :: idate + + + + print *, ' ' + print *, ' --> read_diag_file_gps_nc' + + + !--- get NetCDF file dimensions + ! + if( nc_diag_read_check_dim( 'nobs' )) then + total_obs = nc_diag_read_get_dim(ftin,'nobs') + ncdiag_open_status(ii)%num_records = total_obs + print *, ' total_obs = ', total_obs + else + print *, 'ERROR: unable to read nobs' + ierr=1 + end if + + + !--- get vars + + call load_nc_var( 'Station_ID', ftin, Station_ID, ierr ) + call load_nc_var( 'Observation_Class', ftin, Observation_Class, ierr ) + call load_nc_var( 'Observation_Type', ftin, Observation_Type, ierr ) + call load_nc_var( 'Observation_Subtype', ftin, Observation_Subtype, ierr ) + if( ierr == 1 ) then + have_subtype = .false. + end if + call load_nc_var( 'Latitude', ftin, Latitude, ierr ) + call load_nc_var( 'Longitude', ftin, Longitude, ierr ) + call load_nc_var( 'Incremental_Bending_Angle', ftin, Incremental_Bending_Angle, ierr ) + call load_nc_var( 'Pressure', ftin, Pressure, ierr ) + call load_nc_var( 'Height', ftin, Height, ierr ) + call load_nc_var( 'Time', ftin, Time, ierr ) + call load_nc_var( 'Model_Elevation', ftin, Model_Elevation, ierr ) + call load_nc_var( 'Setup_QC_Mark', ftin, Setup_QC_Mark, ierr ) + call load_nc_var( 'Prep_Use_Flag', ftin, Prep_Use_Flag, ierr ) + call load_nc_var( 'Analysis_Use_Flag', ftin, Analysis_Use_Flag, ierr ) + call load_nc_var( 'Nonlinear_QC_Rel_Wgt', ftin, Nonlinear_QC_Rel_Wgt, ierr ) + call load_nc_var( 'Errinv_Input', ftin, Errinv_Input, ierr ) + call load_nc_var( 'Errinv_Adjust', ftin, Errinv_Adjust, ierr ) + call load_nc_var( 'Errinv_Final', ftin, Errinv_Final, ierr ) + call load_nc_var( 'Observation', ftin, Observation, ierr ) + call load_nc_var( 'Obs_Minus_Forecast_adjusted', ftin, Obs_Minus_Forecast_adjusted, ierr ) + call load_nc_var( 'Obs_Minus_Forecast_unadjusted', ftin, Obs_Minus_Forecast_unadjusted, ierr ) + call load_nc_var( 'GPS_Type', ftin, GPS_Type, ierr ) + call load_nc_var( 'Temperature_at_Obs_Location', ftin, Temperature_at_Obs_Location, ierr ) + call load_nc_var( 'Specific_Humidity_at_Obs_Location', ftin, Specific_Humidity_at_Obs_Location, ierr ) + +! call load_nc_var( 'Nonlinear_QC_Var_Jb', ftin, Nonlinear_QC_Var_Jb, 13, ierr ) + + + + !--------------------------------------------------------------- + ! Process all obs. If type and subtype match the input values + ! add this obs to the linked list (ptr%p). + ! + nobs = 0 + do ii = 1, total_obs + + !------------------------------------------------------------------------ + ! Check on Observation_Class to ctype is a sanity check -- + ! only a single class of obs are in any given NetCDF formatted diag + ! file + ! but, if the ctype and input file don't match, things could get + ! interesting (but not in a good way). + ! + add_obs = .false. + + if( adjustl( trim( Observation_Class(ii) )) == adjustl( trim( ctype ))) then + + if( return_all == .true. ) then + add_obs = .true. + + else if( Observation_Type(ii) == intype ) then + + if( have_subtype == .false. ) then + add_obs = .true. + else if( Observation_Subtype(ii) == in_subtype ) then + add_obs = .true. + end if + + end if + end if + + if( add_obs == .true. ) then + + nobs=nobs+1 + + !--------------------------------------------- + ! Allocate a new data element and load + ! + allocate(ptr%p) + ptr%p%stn_id = Station_ID( ii ) + + do idx=1,max_rdiag_reals + ptr%p%rdiag( idx ) = 0.00 + end do + + if( allocated ( Observation_Type )) ptr%p%rdiag( idx_obs_type_gps ) = Observation_Type( ii ) + if( allocated ( Observation_Subtype )) ptr%p%rdiag( idx_obs_subtype_gps ) = Observation_Subtype( ii ) + if( allocated ( Latitude )) ptr%p%rdiag( idx_obs_lat_gps ) = Latitude( ii ) + if( allocated ( Longitude )) ptr%p%rdiag( idx_obs_lon_gps ) = Longitude( ii ) + if( allocated ( Incremental_Bending_Angle )) ptr%p%rdiag( idx_bend_ang_gps ) = Incremental_Bending_Angle( ii ) + if( allocated ( Pressure )) ptr%p%rdiag( idx_pres_gps ) = Pressure( ii ) + if( allocated ( Height )) ptr%p%rdiag( idx_height_gps ) = Height( ii ) + if( allocated ( Time )) ptr%p%rdiag( idx_time_gps ) = Time( ii ) + if( allocated ( Model_Elevation )) ptr%p%rdiag( idx_zsges_gps ) = Model_Elevation( ii ) + if( allocated ( Setup_QC_Mark )) ptr%p%rdiag( idx_setup_qc_gps ) = Setup_QC_Mark( ii ) + if( allocated ( Prep_Use_Flag )) ptr%p%rdiag( idx_iuse_gps ) = Prep_Use_Flag( ii ) + if( allocated ( Analysis_Use_Flag )) ptr%p%rdiag( idx_anl_use_gps ) = Analysis_Use_Flag( ii ) + if( allocated ( Nonlinear_QC_Rel_Wgt )) ptr%p%rdiag( idx_rwgt_gps ) = Nonlinear_QC_Rel_Wgt( ii ) + if( allocated ( Errinv_input )) ptr%p%rdiag( idx_err_input_gps ) = Errinv_Input( ii ) + if( allocated ( Errinv_Adjust )) ptr%p%rdiag( idx_errinv_gps ) = Errinv_Adjust( ii ) + if( allocated ( Errinv_Final )) ptr%p%rdiag( idx_errinv_fnl_gps ) = Errinv_Final( ii ) + + if( allocated ( Observation )) ptr%p%rdiag( idx_obs_gps ) = Observation( ii ) + if( allocated ( Temperature_at_Obs_Location )) ptr%p%rdiag( idx_tref_gps ) = Temperature_at_Obs_Location( ii ) +! if( allocated ( Obs_Minus_Forecast_unadjusted )) ptr%p%rdiag( idx_hob_gps ) = Obs_Minus_Forecast_unadjusted( ii ) + if( allocated ( GPS_Type )) ptr%p%rdiag( idx_uses_gps ) = GPS_Type( ii ) + if( allocated ( Specific_Humidity_at_Obs_Location )) ptr%p%rdiag( idx_qref_gps ) = Specific_Humidity_at_Obs_Location( ii ) + + + ! This oddity is from genstats_gps.f90 which produces the NetCDF + ! formatted diag file: + ! + ! call nc_diag_metadata("Obs_Minus_Forecast_adjusted", sngl(gps_allptr%rdiag(17))*sngl(gps_allptr%rdiag(5)) ) + ! call nc_diag_metadata("Obs_Minus_Forecast_unadjusted", sngl(gps_allptr%rdiag(17))*sngl(gps_allptr%rdiag(5)) ) + ! call nc_diag_metadata("GPS_Type", sngl(gps_allptr%rdiag(20)) ) + ! call nc_diag_metadata("Temperature_at_Obs_Location", sngl(gps_allptr%rdiag(18)) ) + ! + ! It would seem from this that rdiagbuf(19) is not used? + ! And also Obs_Minus_Forecast_[un|'']adjusted is derived and not stored. + ! + ! This from setupbend.f90: + ! rdiagbuf(18,i) = trefges ! temperature at obs location (Kelvin) if monotone grid + ! rdiagbuf(19,i) = hob ! model vertical grid (interface) if monotone grid + ! rdiagbuf(20,i) = one ! uses gps_ref (one = use of bending angle) + ! + + + if( nobs == 1 ) then + !------------------------------------------------- + ! Initialize the list with the first data element + ! + call list_init(list, transfer(ptr, list_data)) + next => list + + else + !------------------------------------------------- + ! Insert subsequent nodes into the list + ! + call list_insert(next, transfer(ptr, list_data)) + next => list_next(next) + + end if + + end if + + end do + + + if( allocated( Station_ID )) deallocate( Station_ID ) + if( allocated( Observation_Class )) deallocate( Observation_Class ) + if( allocated( Observation_Type )) deallocate( Observation_Type ) + if( allocated( Observation_Subtype )) deallocate( Observation_Subtype ) + if( allocated( Latitude )) deallocate( Latitude ) + if( allocated( Longitude )) deallocate( Longitude ) + if( allocated( Incremental_Bending_Angle )) deallocate( Incremental_Bending_Angle ) + if( allocated( Pressure )) deallocate( Pressure ) + if( allocated( Height )) deallocate( Height ) + if( allocated( Time )) deallocate( Time ) + if( allocated( Model_Elevation )) deallocate( Model_Elevation ) + if( allocated( Setup_QC_Mark )) deallocate( Setup_QC_Mark ) + if( allocated( Prep_Use_Flag )) deallocate( Prep_Use_Flag ) + if( allocated( Analysis_Use_Flag )) deallocate( Analysis_Use_Flag ) + if( allocated( Nonlinear_QC_Rel_Wgt )) deallocate( Nonlinear_QC_Rel_Wgt ) + if( allocated( Errinv_Input )) deallocate( Errinv_Input ) + if( allocated( Errinv_Adjust )) deallocate( Errinv_Final ) + if( allocated( Errinv_Final )) deallocate( Errinv_Final ) + if( allocated( Observation )) deallocate( Observation ) + if( allocated( Obs_Minus_Forecast_adjusted )) deallocate( Obs_Minus_Forecast_adjusted ) + if( allocated( Obs_Minus_Forecast_unadjusted )) deallocate( Obs_Minus_Forecast_unadjusted ) + if( allocated( GPS_Type )) deallocate( GPS_Type ) + if( allocated( Temperature_at_Obs_Location )) deallocate( Temperature_at_Obs_Location ) + if( allocated( Specific_Humidity_at_Obs_Location )) deallocate( Specific_Humidity_at_Obs_Location ) + + print *, ' ' + print *, ' <-- read_diag_file_gps_nc' + + end subroutine read_diag_file_gps_nc + + + + + !--- binary read routine + ! + subroutine read_diag_file_bin( input_file, return_all, ctype, intype,expected_nreal,nobs,in_subtype, list ) + + !--- interface + character(100), intent(in) :: input_file + logical, intent(in) :: return_all + character(3), intent(in) :: ctype + integer, intent(in) :: intype, expected_nreal, in_subtype + integer, intent(out) :: nobs + type(list_node_t), pointer :: list + + + !--- local vars + type(list_node_t), pointer :: next => null() + type(data_ptr) :: ptr + + real(4),allocatable,dimension(:,:) :: rdiag + character(8),allocatable,dimension(:) :: cdiag + + character(3) :: dtype + character(10) :: otype + character(15) :: fileo,fileo_subtyp + + integer nchar,file_nreal,i,ii,mype,idate,iflag,file_itype,iscater,igrads + integer lunin,lunot,ldtype,file_subtype + integer idx,ioff02 + + data lunin / 11 / + + nobs=0 + print *, ' --> read_diag_file_bin' + print *, ' ctype = ', ctype + print *, ' intype, in_subtype = ', intype, in_subtype + print *, ' expected_nreal = ', expected_nreal + + + !--- open diag file + open(lunin, file=input_file, form='unformatted') + rewind(lunin) + + read(lunin) idate + print *, 'idate=',idate + + loopd: do + + !--- read obs header + read(lunin,IOSTAT=iflag) dtype,nchar,file_nreal,ii,mype,ioff02 + + if( iflag /= 0 ) exit loopd + + !----------------------------------------------------- + ! exit loop if the number of reals (nreal) from file + ! doesn't match the target number + ! + if(( return_all == .true. ) .OR. ( trim(dtype) == trim(ctype) .and. file_nreal /= expected_nreal )) then + print *, 'matched observation type:',dtype,' file_nreal=', file_nreal + exit + endif + + !--------------------------------------------- + ! skip to next iteration if types don't match + ! + if(( return_all == .false. ) .AND. ( trim( dtype ) /= trim( ctype ))) then + cycle + endif + + + !--- read diag info + allocate(cdiag(ii),rdiag(file_nreal,ii)) + read(lunin,IOSTAT=iflag) cdiag,rdiag + + !--- exit loop on read error + if( iflag /= 0 ) then + deallocate( cdiag,rdiag ) + exit loopd + end if + + do i=1,ii + file_itype = int(rdiag(1,i)) + file_subtype = int(rdiag(2,i)) + + !------------------------------------------------ + ! if both types and subtypes match + ! then add a new data element + ! + if(( return_all == .true. ) .OR. ( file_itype == intype .AND. file_subtype == in_subtype )) then + + nobs=nobs+1 + + !--------------------------------------------- + ! Allocate a new data element and load + ! + allocate(ptr%p) + ptr%p%stn_id = cdiag(i) + + do idx=1,max_rdiag_reals + if( idx > file_nreal ) then + ptr%p%rdiag( idx ) = 0.00 + else + ptr%p%rdiag( idx ) = rdiag( idx,i ) + end if + end do + + if( nobs == 1 ) then + !------------------------------------------------- + ! Initialize the list with the first data element + ! + call list_init(list, transfer(ptr, list_data)) + next => list + + else + !------------------------------------------------- + ! Insert subsequent nodes into the list + ! + call list_insert(next, transfer(ptr, list_data)) + next => list_next(next) + + end if + + endif + + enddo + + deallocate(cdiag,rdiag) + enddo loopd ! ending read data do loop + + close(lunin) + + print *, 'nobs added to list = ', nobs + print *, ' <-- read_diag_file_bin' + + return + end subroutine read_diag_file_bin + + + + !------------------------------------------------ + ! function find_ncdiag_id + !------------------------------------------------ + integer( i_kind ) function find_ncdiag_id( ftin ) + + integer(i_kind), intent(in) :: ftin + + integer(i_kind) :: i + + find_ncdiag_id = -1 + do i = 1, MAX_OPEN_NCDIAG + if ( ncdiag_open_id(i) == ftin ) then + find_ncdiag_id = i + return + endif + enddo + + return + end function find_ncdiag_id + + +end module conmon_read_diag diff --git a/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_sfc.fd/data_mod.f90 b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_sfc.fd/data_mod.f90 new file mode 100644 index 0000000000..e611a9782e --- /dev/null +++ b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_sfc.fd/data_mod.f90 @@ -0,0 +1,220 @@ +module data + implicit none + + private + public :: data_t + public :: data_ptr + + integer, parameter,public :: max_rdiag_reals = 25 + + !-------------------------------------------------- + ! generic index numbers into the rdiagbuf array + ! for _all_ data types + ! + integer, parameter, public :: idx_obs_type = 1 ! obs type + integer, parameter, public :: idx_obs_subtype = 2 ! obs subtype + integer, parameter, public :: idx_obs_lat = 3 ! obs latitude + integer, parameter, public :: idx_obs_lon = 4 ! obs longitude + integer, parameter, public :: idx_stn_elev = 5 ! stn elevation + integer, parameter, public :: idx_pres = 6 ! obs pressure + integer, parameter, public :: idx_time = 8 ! obs time (hrs relative to analysis time) + integer, parameter, public :: idx_rwgt = 13 ! non-linear qc relative weight + + + + !-------------------------------------------------- + ! index numbers into the rdiagbuf array + ! for type ps obs + ! + ! (see setupps.f90 for more info) + ! + integer, parameter, public :: idx_obs_type_ps = 1 ! obs type + integer, parameter, public :: idx_obs_subtype_ps = 2 ! obs subtype + integer, parameter, public :: idx_obs_lat_ps = 3 ! obs latitude + integer, parameter, public :: idx_obs_lon_ps = 4 ! obs longitude + integer, parameter, public :: idx_stn_elev_ps = 5 ! stn elevation + integer, parameter, public :: idx_pres_ps = 6 ! obs pressure (hPa) + integer, parameter, public :: idx_hgt_ps = 7 ! obs height (meters) + integer, parameter, public :: idx_time_ps = 8 ! obs time (hrs relative to analysis time) + integer, parameter, public :: idx_iqc_ps = 9 ! prepbufr qc or event mark + integer, parameter, public :: idx_var_jb_ps = 10 ! non-linear qc param + integer, parameter, public :: idx_iuse_ps = 11 ! read_prepbufr data usage flag + integer, parameter, public :: idx_anl_use_ps = 12 ! analysis usage flag + integer, parameter, public :: idx_rwgt_ps = 13 ! non-linear qc relative weight + integer, parameter, public :: idx_err_input_ps = 14 ! prepbufr invers obs error (hPa**-1) + integer, parameter, public :: idx_errinv_ps = 15 ! read_prepbufr invers obs error (hPa**-1) + integer, parameter, public :: idx_errinv_fnl_ps = 16 ! final invers obs error (HPa**-1) + integer, parameter, public :: idx_obs_ps = 17 ! surface pressure observation + integer, parameter, public :: idx_obsmg_adj_ps = 18 ! obs-ges used in analysis (coverted to hPa) + integer, parameter, public :: idx_obsmg_nadj_ps = 19 ! obs-ges w/o adjustment to guess surface pressure (hPa) + integer, parameter, public :: idx_spread_ps = 20 ! spread (filled in by EnKF) + + + !-------------------------------------------------- + ! index numbers into the rdiagbuf array + ! for type q obs + ! + ! (see setupq.f90 for more info) + ! + integer, parameter, public :: idx_obs_type_q = 1 ! obs type + integer, parameter, public :: idx_obs_subtype_q = 2 ! obs subtype + integer, parameter, public :: idx_obs_lat_q = 3 ! obs latitude + integer, parameter, public :: idx_obs_lon_q = 4 ! obs longitude + integer, parameter, public :: idx_stn_elev_q = 5 ! stn elevation + integer, parameter, public :: idx_pres_q = 6 ! obs pressure (hPa) + integer, parameter, public :: idx_hgt_q = 7 ! obs height (meters) + integer, parameter, public :: idx_time_q = 8 ! obs time (hrs relative to analysis time) + integer, parameter, public :: idx_iqc_q = 9 ! prepbufr qc or event mark + integer, parameter, public :: idx_var_jb_q = 10 ! non-linear qc param + integer, parameter, public :: idx_iuse_q = 11 ! read_prepbufr data usage flag + integer, parameter, public :: idx_anl_use_q = 12 ! analysis usage flag + integer, parameter, public :: idx_rwgt_q = 13 ! non-linear qc relative weight + integer, parameter, public :: idx_err_input_q = 14 ! prepbufr invers obs error + integer, parameter, public :: idx_errinv_q = 15 ! read_prepbufr invers obs error + integer, parameter, public :: idx_errinv_fnl_q = 16 ! final invers obs error + integer, parameter, public :: idx_obs_q = 17 ! surface pressure observation + integer, parameter, public :: idx_obsmg_adj_q = 18 ! obs-ges used in analysis + integer, parameter, public :: idx_obsmg_nadj_q = 19 ! obs-ges w/o adjustment to guess surface pressure + integer, parameter, public :: idx_ges_sat_q = 20 ! guess saturation specific + integer, parameter, public :: idx_spread_q = 21 ! spread (filled in by EnKF) + + + + !-------------------------------------------------- + ! index numbers into the rdiagbuf array + ! for type t obs + ! + ! (see setupt.f90 for more info) + ! + integer, parameter, public :: idx_obs_type_t = 1 ! obs type + integer, parameter, public :: idx_obs_subtype_t = 2 ! obs subtype + integer, parameter, public :: idx_obs_lat_t = 3 ! obs latitude + integer, parameter, public :: idx_obs_lon_t = 4 ! obs longitude + integer, parameter, public :: idx_stn_elev_t = 5 ! stn elevation + integer, parameter, public :: idx_pres_t = 6 ! obs pressure (hPa) + integer, parameter, public :: idx_hgt_t = 7 ! obs height (meters) + integer, parameter, public :: idx_time_t = 8 ! obs time (hrs relative to analysis time) + integer, parameter, public :: idx_iqc_t = 9 ! prepbufr qc or event mark + integer, parameter, public :: idx_setup_qc_t = 10 ! setup qc or event mark + integer, parameter, public :: idx_iuse_t = 11 ! read_prepbufr data usage flag + integer, parameter, public :: idx_anl_use_t = 12 ! analysis usage flag + integer, parameter, public :: idx_rwgt_t = 13 ! combination of var_jb and rwgt + integer, parameter, public :: idx_err_input_t = 14 ! prepbufr inverse obs error + integer, parameter, public :: idx_errinv_t = 15 ! read_prepbufr inverse obs error + integer, parameter, public :: idx_errinv_fnl_t = 16 ! final inverse obs error + integer, parameter, public :: idx_obs_t = 17 ! temperature obs (K) + integer, parameter, public :: idx_omgbc_t = 18 ! obs-ges used in analysis (K) + integer, parameter, public :: idx_omgnbc_t = 19 ! obs-ges w/o bias correction (K) + integer, parameter, public :: idx_pof_t = 20 ! data pof + integer, parameter, public :: idx_vv_t = 21 ! data vertical velocity + integer, parameter, public :: idx_pbias_one = 22 ! pred bias term 1 + integer, parameter, public :: idx_pbias_two = 23 ! pred bias term 2 + integer, parameter, public :: idx_pbias_three = 24 ! pred bias term 3 + integer, parameter, public :: idx_pbias_four = 25 ! pred bias term 4 + + + !-------------------------------------------------- + ! index numbers into the rdiagbuf array + ! for type uv obs + ! + ! (see setupw.f90 for more info) + ! + integer, parameter, public :: idx_obs_type_uv = 1 ! obs type + integer, parameter, public :: idx_obs_subtype_uv = 2 ! obs subtype + integer, parameter, public :: idx_obs_lat_uv = 3 ! obs latitude + integer, parameter, public :: idx_obs_lon_uv = 4 ! obs longitude + integer, parameter, public :: idx_stn_elev_uv = 5 ! stn elevation + integer, parameter, public :: idx_pres_uv = 6 ! obs pressure (hPa) + integer, parameter, public :: idx_hgt_uv = 7 ! obs height (meters) + integer, parameter, public :: idx_time_uv = 8 ! obs time (hrs relative to analysis time) + integer, parameter, public :: idx_iqc_uv = 9 ! prepbufr qc or event mark + integer, parameter, public :: idx_setup_qc_uv = 10 ! setup qc or event mark + integer, parameter, public :: idx_iuse_uv = 11 ! read_prepbufr data usage flag + integer, parameter, public :: idx_anl_use_uv = 12 ! analysis usage flag + integer, parameter, public :: idx_rwgt_uv = 13 ! combination of var_jb and rwgt + integer, parameter, public :: idx_err_input_uv = 14 ! prepbufr inverse obs error + integer, parameter, public :: idx_errinv_uv = 15 ! read_prepbufr inverse obs error + integer, parameter, public :: idx_errinv_fnl_uv = 16 ! final inverse obs error + integer, parameter, public :: idx_u_obs_uv = 17 ! u wind component observation + integer, parameter, public :: idx_u_omgbc_uv = 18 ! u obs-ges used in analysis (m/s) + integer, parameter, public :: idx_u_omgnbc_uv = 19 ! u obs-ges w/o bias correction (m/s) + integer, parameter, public :: idx_v_obs_uv = 20 ! v wind component observation + integer, parameter, public :: idx_v_omgbc_uv = 21 ! v obs-ges used in analysis (m/s) + integer, parameter, public :: idx_v_omgnbc_uv = 22 ! v obs-ges w/o bias correction (m/s) + + + !-------------------------------------------------- + ! index numbers into the rdiagbuf array + ! for type sst obs + ! + ! (see setupsst.f90 for more info) + ! + integer, parameter, public :: idx_obs_type_sst = 1 ! obs type + integer, parameter, public :: idx_obs_subtype_sst = 2 ! obs subtype + integer, parameter, public :: idx_obs_lat_sst = 3 ! obs latitude + integer, parameter, public :: idx_obs_lon_sst = 4 ! obs longitude + integer, parameter, public :: idx_stn_elev_sst = 5 ! stn elevation + integer, parameter, public :: idx_opn_wtr_tmp_sst = 6 ! background open water temperature + integer, parameter, public :: idx_depth_sst = 7 ! observation depth (meters) + integer, parameter, public :: idx_time_sst = 8 ! obs time (hrs relative to analysis time) + integer, parameter, public :: idx_opn_wtr_pct_sst = 9 ! open water percentage + integer, parameter, public :: idx_setup_qc_sst = 10 ! setup qc or event mark + integer, parameter, public :: idx_iuse_sst = 11 ! read_prepbufr data usage flag + integer, parameter, public :: idx_anl_use_sst = 12 ! analysis usage flag + integer, parameter, public :: idx_rwgt_sst = 13 ! combination of var_jb and rwgt + integer, parameter, public :: idx_err_input_sst = 14 ! prepbufr inverse obs error + integer, parameter, public :: idx_errinv_sst = 15 ! read_prepbufr inverse obs error + integer, parameter, public :: idx_errinv_fnl_sst = 16 ! final inverse obs error + integer, parameter, public :: idx_obs_sst = 17 ! SST observation (K) + integer, parameter, public :: idx_omgbc_sst = 18 ! obs-ges used in analysis (K) + integer, parameter, public :: idx_omgnbc_sst = 19 ! obs-ges w/o bias correction (K) + integer, parameter, public :: idx_type_sst = 20 ! type of measurment + integer, parameter, public :: idx_tr_sst = 21 ! Tr + integer, parameter, public :: idx_dt_warm_sst = 22 ! dt_warm at zob + integer, parameter, public :: idx_dt_cool_sst = 23 ! dt_cool at zob + integer, parameter, public :: idx_dtz_dtr_sst = 23 ! d(tz)/d(Tr) at zob + + + + !-------------------------------------------------- + ! index numbers into the rdiagbuf array + ! for type gps obs + ! + ! (see setupbend.f90 for more info) + ! + integer, parameter, public :: idx_obs_type_gps = 1 ! obs type + integer, parameter, public :: idx_obs_subtype_gps = 2 ! profile identifier + integer, parameter, public :: idx_obs_lat_gps = 3 ! obs latitude + integer, parameter, public :: idx_obs_lon_gps = 4 ! obs longitude + integer, parameter, public :: idx_bend_ang_gps = 5 ! incremental bending angle (x100 %) + integer, parameter, public :: idx_pres_gps = 6 ! pressure at obs location (hPa) + integer, parameter, public :: idx_height_gps = 7 ! impact height in meters + integer, parameter, public :: idx_time_gps = 8 ! obs time (hrs relative to analysis time) + integer, parameter, public :: idx_zsges_gps = 9 ! model terrain (m) + integer, parameter, public :: idx_setup_qc_gps = 10 ! setup qc or event mark + integer, parameter, public :: idx_iuse_gps = 11 ! read_prepbufr data usage flag + integer, parameter, public :: idx_anl_use_gps = 12 ! analysis usage flag + integer, parameter, public :: idx_rwgt_gps = 13 ! combination of var_jb and rwgt + integer, parameter, public :: idx_err_input_gps = 14 ! prepbufr inverse obs error + integer, parameter, public :: idx_errinv_gps = 15 ! read_prepbufr inverse obs error + integer, parameter, public :: idx_errinv_fnl_gps = 16 ! final inverse obs error + integer, parameter, public :: idx_obs_gps = 17 ! bending angle observation (radians) + integer, parameter, public :: idx_tref_gps = 18 ! temperature at obs location (K) + integer, parameter, public :: idx_hob_gps = 19 ! model vertival grid + integer, parameter, public :: idx_uses_gps = 20 ! uses gps_ref + integer, parameter, public :: idx_qref_gps = 21 ! specific humidity at obs location (kg/kg) + integer, parameter, public :: idx_spread_gps = 22 ! spread + + + ! Data is stored in data_t + type :: data_t + character(8) :: stn_id + real,dimension(25) :: rdiag + end type data_t + + ! A container for storing data_t pointers + type :: data_ptr + type(data_t), pointer :: p + end type data_ptr + +end module data diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_sfc/generic_list.f90 b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_sfc.fd/generic_list.f90 similarity index 100% rename from util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_sfc/generic_list.f90 rename to util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_sfc.fd/generic_list.f90 diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_sfc/grads_sfc.f90 b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_sfc.fd/grads_sfc.f90 similarity index 88% rename from util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_sfc/grads_sfc.f90 rename to util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_sfc.fd/grads_sfc.f90 index bc03f70060..a6a005cf25 100644 --- a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_sfc/grads_sfc.f90 +++ b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_sfc.fd/grads_sfc.f90 @@ -5,7 +5,7 @@ ! horizontal GrADS data files. !------------------------------------------------------------------------ -subroutine grads_sfc(fileo,ifileo,nobs,nreal,iscater,igrads,isubtype,subtype,list) +subroutine grads_sfc(fileo,ifileo,nobs,nreal,iscater,igrads,isubtype,subtype,list,run) use generic_list use data @@ -20,9 +20,9 @@ subroutine grads_sfc(fileo,ifileo,nobs,nreal,iscater,igrads,isubtype,subtype,lis real(4),allocatable,dimension(:,:) :: rdiag_m2 character(8),allocatable,dimension(:) :: cdiag character(8) :: stid - character(ifileo) :: fileo + character(ifileo) :: fileo, file_nobs character(30) :: files,filein,filegrads - character(3) :: subtype + character(3) :: subtype,run integer nobs,nreal,nlfag,nflg0,nlev,nlev0,iscater,igrads real(4) rtim,xlat0,xlon0,rlat,rlon @@ -53,13 +53,11 @@ subroutine grads_sfc(fileo,ifileo,nobs,nreal,iscater,igrads,isubtype,subtype,lis ! Retrieve data from the linked list and load ! into the cdiag and rdiag arrays ! -! print *, 'Associated(list) = ', associated( list ) obs_ctr = 0 next => list do while ( associated( next ) == .TRUE. ) ptr = transfer(list_get( next ), ptr) -! print *, 'node data:', ptr%p next => list_next( next ) obs_ctr = obs_ctr + 1 @@ -78,7 +76,7 @@ subroutine grads_sfc(fileo,ifileo,nobs,nreal,iscater,igrads,isubtype,subtype,lis print *, 'begin writing scatter data file' if(iscater ==1) then - files=trim(fileo)//'_'//trim(subtype)//'.scater' + files=trim(fileo)//'_'//trim(subtype)//'.scater.'//trim(run) open(51,file=files,form='unformatted') write(51) nobs,nreal_m2 @@ -94,7 +92,8 @@ subroutine grads_sfc(fileo,ifileo,nobs,nreal,iscater,igrads,isubtype,subtype,lis ! write the horiz data file ! if (igrads ==1 .AND. nobs > 0) then - filegrads=trim(fileo)//'_'//trim(subtype)//'_grads' + filegrads=trim(fileo)//'_'//trim(subtype)//'.grads.'//run + write(6,*) 'filegrads = ', filegrads open(21,file=filegrads,form='unformatted',status='new') ! open output file @@ -132,9 +131,14 @@ subroutine grads_sfc(fileo,ifileo,nobs,nreal,iscater,igrads,isubtype,subtype,lis ! stid=' ' write(21) stid,xlat0,xlon0,rtim,nlev0,nflg0 + close(21) print *, 'num recs written to GrADS file = ', ctr - close(21) + + file_nobs=trim(fileo)//'_'//trim(subtype)//'.nobs.'//trim(run) + open( 32, file=file_nobs, form='formatted', status='new' ) + write(32,*) trim(fileo), ',', trim(subtype), ',', ctr + close( 32 ) else write(6,*) "No output file generated, nobs, igrads = ", nobs, igrads endif diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radbcoef.fd/kinds.F90 b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_sfc.fd/kinds.F90 similarity index 100% rename from util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radbcoef.fd/kinds.F90 rename to util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_sfc.fd/kinds.F90 diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_sfc/maingrads_sfc.f90 b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_sfc.fd/maingrads_sfc.f90 similarity index 69% rename from util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_sfc/maingrads_sfc.f90 rename to util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_sfc.fd/maingrads_sfc.f90 index d1a6d62775..3472175c63 100644 --- a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_sfc/maingrads_sfc.f90 +++ b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_sfc.fd/maingrads_sfc.f90 @@ -9,26 +9,14 @@ program maingrads_sfc use generic_list use data + use conmon_read_diag implicit none interface - subroutine read_conv2grads(ctype,stype,itype,nreal,nobs,isubtype,subtype,list) - use generic_list - character(3) :: ctype - character(10) :: stype - integer :: itype - integer :: nreal - integer :: nobs - integer :: isubtype - character(3) :: subtype - type(list_node_t),pointer :: list - end subroutine read_conv2grads - - subroutine grads_sfc(fileo,ifileo,nobs,nreal,iscater,igrads,& - isubtype, subtype, list) + isubtype, subtype, list, run) use generic_list integer ifileo @@ -36,6 +24,7 @@ subroutine grads_sfc(fileo,ifileo,nobs,nreal,iscater,igrads,& integer :: nobs,nreal,iscater,igrads,isubtype character(3) :: subtype type(list_node_t), pointer :: list + character(3) :: run end subroutine grads_sfc end interface @@ -52,7 +41,11 @@ end subroutine grads_sfc type(list_node_t), pointer :: next => null() type(data_ptr) :: ptr - namelist /input/intype,stype,itype,nreal,iscater,igrads,subtype,isubtype + !--- namelist with defaults + logical :: netcdf = .false. + character(100) :: input_file = "conv_diag" + character(3) :: run = "ges" + namelist /input/input_file,intype,stype,itype,nreal,iscater,igrads,subtype,isubtype,netcdf,run data n_mand / 21 / data pmand /1000.,925.,850.,700.,500.,400.,300.,250.,200.,150.,100.,& @@ -64,11 +57,14 @@ end subroutine grads_sfc lstype=len_trim(stype) - call read_conv2grads( intype,stype,itype,nreal,nobs,isubtype,subtype,list ) + write(6,*)'netcdf =', netcdf + call set_netcdf_read( netcdf ) + + call conmon_read_diag_file( input_file, intype, itype, nreal, nobs, isubtype, list ) if( nobs > 0 ) then - call grads_sfc(stype,lstype,nobs,nreal,iscater,igrads,isubtype,subtype,list) + call grads_sfc(stype,lstype,nobs,nreal,iscater,igrads,isubtype,subtype,list,run) else print *, 'NOBS <= 0, NO OUTPUT GENERATED' end if diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_sfc/makefile.grads_sfc b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_sfc.fd/makefile.grads_sfc similarity index 96% rename from util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_sfc/makefile.grads_sfc rename to util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_sfc.fd/makefile.grads_sfc index f9c447dea7..bab0bbc7a7 100755 --- a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_sfc/makefile.grads_sfc +++ b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_sfc.fd/makefile.grads_sfc @@ -11,7 +11,7 @@ SRCS= data_mod.f90 generic_list.f90 maingrads_sfc.f90 read_conv2grads.f9 OBJS= data_mod.o generic_list.o maingrads_sfc.o read_conv2grads.o grads_sfc.o rm_dups.o convinfo.o -CMD= grads_sfc.x +CMD= conmon_grads_sfc.x all: $(CMD) diff --git a/util/Conventional_Monitor/image_gen/sorc/read_q/rm_dups.f90 b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_sfc.fd/rm_dups.f90 similarity index 100% rename from util/Conventional_Monitor/image_gen/sorc/read_q/rm_dups.f90 rename to util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_sfc.fd/rm_dups.f90 diff --git a/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_sfctime.fd/CMakeLists.txt b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_sfctime.fd/CMakeLists.txt new file mode 100644 index 0000000000..71e1356662 --- /dev/null +++ b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_sfctime.fd/CMakeLists.txt @@ -0,0 +1,24 @@ +cmake_minimum_required(VERSION 2.6) + + file(GLOB CONMON_GRADS_SFCTIME_SRC ${CMAKE_CURRENT_SOURCE_DIR}/*90 ) + + set(CONMON_GRADS_SFCTIME_Fortran_FLAGS "-fp-model strict -assume byterecl -convert big_endian -O3 -traceback -D_REAL8_ ") + + set(Util_MODULE_DIR ${PROJECT_BINARY_DIR}/include/conmon_grads_sfctime ) + + set_source_files_properties( ${CONMON_GRADS_SFCTIME_SRC} PROPERTIES COMPILE_FLAGS ${CONMON_GRADS_SFCTIME_Fortran_FLAGS} ) + + add_executable(conmon_grads_sfctime.x ${CONMON_GRADS_SFCTIME_SRC} ) + + set_target_properties( conmon_grads_sfctime.x PROPERTIES COMPILE_FLAGS ${CONMON_GRADS_SFCTIME_Fortran_FLAGS} ) + set_target_properties( conmon_grads_sfctime.x PROPERTIES Fortran_MODULE_DIRECTORY ${Util_MODULE_DIR} ) + + include_directories( ${CORE_INCS} ${NCDIAG_INCS} ) + + target_link_libraries( conmon_grads_sfctime.x ${W3NCO_4_LIBRARY} ${NCDIAG_LIBRARIES} ${NETCDF_Fortran_LIBRARIES} + ${NETCDF_C_LIBRARIES} ${MPI_Fortran_LIBRARIES} ) + + if(BUILD_W3NCO) + add_dependencies( conmon_grads_sfctime.x ${W3NCO_4_LIBRARY} ) + endif() + diff --git a/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_sfctime.fd/cnv_file_info b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_sfctime.fd/cnv_file_info new file mode 100644 index 0000000000..0bd390b6db --- /dev/null +++ b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_sfctime.fd/cnv_file_info @@ -0,0 +1,416 @@ +From setupps.f90: + + cdiagbuf(ii) = station_id ! station id + + rdiagbuf(1,ii) = ictype(ikx) ! observation type + rdiagbuf(2,ii) = icsubtype(ikx) ! observation subtype + rdiagbuf(3,ii) = data(ilate,i) ! observation latitude (degrees) + rdiagbuf(4,ii) = data(ilone,i) ! observation longitude (degrees) + rdiagbuf(5,ii) = data(istnelv,i) ! station elevation (meters) + rdiagbuf(6,ii) = data(ipres,i)*r10 ! observation pressure (hPa) + rdiagbuf(7,ii) = dhgt ! observation height (meters) + rdiagbuf(8,ii) = dtime-time_offset ! obs time (hours relative to analysis time) + + rdiagbuf(9,ii) = data(iqc,i) ! input prepbufr qc or event mark + rdiagbuf(10,ii) = var_jb ! non linear qc parameter + rdiagbuf(11,ii) = data(iuse,i) ! read_prepbufr data usage flag + if(muse(i)) then + rdiagbuf(12,ii) = one ! analysis usage flag (1=use, -1=not used) + else + rdiagbuf(12,ii) = -one + endif + + rdiagbuf(13,ii) = rwgt ! nonlinear qc relative weight + rdiagbuf(14,ii) = errinv_input ! prepbufr inverse obs error (hPa**-1) + rdiagbuf(15,ii) = errinv_adjst ! read_prepbufr inverse obs error (hPa**-1) + rdiagbuf(16,ii) = errinv_final ! final inverse observation error (hPa**-1) + + rdiagbuf(17,ii) = pob ! surface pressure observation (hPa) + rdiagbuf(18,ii) = pob-pges ! obs-ges used in analysis (coverted to hPa) + rdiagbuf(19,ii) = pob-pgesorig ! obs-ges w/o adjustment to guess surface pressure (hPa) + rdiagbuf(20,ii) = 1.e+10_r_single ! spread (filled in by EnKF) + + +>ncdump -h diag_conv_ps_ges.2020051806.nc4 +netcdf diag_conv_ps_ges.2020051806 { +dimensions: + nobs = UNLIMITED ; // (81624 currently) + Station_ID_maxstrlen = 8 ; + Observation_Class_maxstrlen = 7 ; +variables: + char Station_ID(nobs, Station_ID_maxstrlen) ; + char Observation_Class(nobs, Observation_Class_maxstrlen) ; + int Observation_Type(nobs) ; + int Observation_Subtype(nobs) ; + float Latitude(nobs) ; + float Longitude(nobs) ; + float Station_Elevation(nobs) ; + float Pressure(nobs) ; + float Height(nobs) ; + float Time(nobs) ; + float Prep_QC_Mark(nobs) ; + float Prep_Use_Flag(nobs) ; + float Nonlinear_QC_Var_Jb(nobs) ; + float Nonlinear_QC_Rel_Wgt(nobs) ; + float Analysis_Use_Flag(nobs) ; + float Errinv_Input(nobs) ; + float Errinv_Adjust(nobs) ; + float Errinv_Final(nobs) ; + float Observation(nobs) ; + float Obs_Minus_Forecast_adjusted(nobs) ; + float Obs_Minus_Forecast_unadjusted(nobs) ; + +// global attributes: + :date_time = 2020051806 ; +} + +from setupq.f90: + rdiagbufp(1,iip) = ictype(ikx) ! observation type + rdiagbufp(2,iip) = icsubtype(ikx) ! observation subtype + + rdiagbufp(3,iip) = data(ilate,i) ! observation latitude (degrees) + rdiagbufp(4,iip) = data(ilone,i) ! observation longitude (degrees) + rdiagbufp(5,iip) = data(istnelv,i) ! station elevation (meters) + rdiagbufp(6,iip) = prest !presq ! observation pressure (hPa) + rdiagbufp(7,iip) = data(iobshgt,i) ! observation height (meters) + rdiagbufp(8,iip) = dtime-time_offset ! obs time (hours relative to analysis time) + + rdiagbufp(9,iip) = data(iqc,i) ! input prepbufr qc or event mark + rdiagbufp(10,iip) = var_jb ! non linear qc b parameter + rdiagbufp(11,iip) = data(iuse,i) ! read_prepbufr data usage flag + if(muse(i)) then + rdiagbufp(12,iip) = one ! analysis usage flag (1=use, -1=not used) + else + rdiagbufp(12,iip) = -one + endif + + rdiagbufp(13,iip) = rwgt ! nonlinear qc relative weight + rdiagbufp(14,iip) = errinv_input ! prepbufr inverse observation error + rdiagbufp(15,iip) = errinv_adjst ! read_prepbufr inverse obs error + rdiagbufp(16,iip) = errinv_final ! final inverse observation error + + rdiagbufp(17,iip) = data(iqob,i) ! observation + rdiagbufp(18,iip) = ddiff ! obs-ges used in analysis + rdiagbufp(19,iip) = ddiff !qob-qges ! obs-ges w/o bias correction (future slot) + + rdiagbufp(20,iip) = qsges ! guess saturation specific humidity + rdiagbufp(21,iip) = 1e+10_r_single ! spread (filled in by EnKF) + + +netcdf diag_conv_q_ges.2020051806 { +dimensions: + nobs = UNLIMITED ; // (50283 currently) + Station_ID_maxstrlen = 8 ; + Observation_Class_maxstrlen = 7 ; +variables: + char Station_ID(nobs, Station_ID_maxstrlen) ; + char Observation_Class(nobs, Observation_Class_maxstrlen) ; + int Observation_Type(nobs) ; + int Observation_Subtype(nobs) ; + float Latitude(nobs) ; + float Longitude(nobs) ; + float Station_Elevation(nobs) ; + float Pressure(nobs) ; + float Height(nobs) ; + float Time(nobs) ; + float Prep_QC_Mark(nobs) ; + float Prep_Use_Flag(nobs) ; + float Nonlinear_QC_Var_Jb(nobs) ; + float Nonlinear_QC_Rel_Wgt(nobs) ; + float Analysis_Use_Flag(nobs) ; + float Errinv_Input(nobs) ; + float Errinv_Adjust(nobs) ; + float Errinv_Final(nobs) ; + float Observation(nobs) ; + float Obs_Minus_Forecast_adjusted(nobs) ; + float Obs_Minus_Forecast_unadjusted(nobs) ; + float Forecast_Saturation_Spec_Hum(nobs) ; + +// global attributes: + :date_time = 2020051806 ; +} + +from setupt.f90: + + rdiagbufp(1,iip) = ictype(ikx) ! observation type + rdiagbufp(2,iip) = icsubtype(ikx) ! observation subtype + rdiagbuf(3,ii) = data(ilate,i) ! observation latitude (degrees) + rdiagbuf(4,ii) = data(ilone,i) ! observation longitude (degrees) + rdiagbuf(5,ii) = data(istnelv,i) ! station elevation (meters) + rdiagbuf(6,ii) = prest ! observation pressure (hPa) + rdiagbuf(7,ii) = data(iobshgt,i) ! observation height (meters) + rdiagbuf(8,ii) = dtime-time_offset ! obs time (hours relative to analysis time) + + rdiagbuf(9,ii) = data(iqc,i) ! input prepbufr qc or event mark + rdiagbuf(10,ii) = data(iqt,i) ! setup qc or event mark + rdiagbuf(11,ii) = data(iuse,i) ! read_prepbufr data usage flag + if(muse(i)) then + rdiagbuf(12,ii) = one ! analysis usage flag (1=use, -1=not used) + else + rdiagbuf(12,ii) = -one + endif + +!rdiagbuf(13,ii) is the combination of var_jb and non-linear qc relative weight +! in the format of: var_jb*1.0e+6 + rwgt + rdiagbuf(13,ii) = var_jb*1.0e+6_r_single + rwgt ! combination of var_jb and rwgt + rdiagbuf(14,ii) = errinv_input ! prepbufr inverse obs error (K**-1) + rdiagbuf(15,ii) = errinv_adjst ! read_prepbufr inverse obs error (K**-1) + rdiagbuf(16,ii) = errinv_final ! final inverse observation error (K**-1) + + rdiagbuf(17,ii) = data(itob,i) ! temperature observation (K) + rdiagbuf(18,ii) = ddiff ! obs-ges used in analysis (K) + rdiagbuf(19,ii) = tob-tges ! obs-ges w/o bias correction (K) (future slot) + rdiagbuf(20,ii) = 1.e10_r_single ! spread (filled in by EnKF) + if (aircraft_t_bc_pof .or. aircraft_t_bc .or. aircraft_t_bc_ext) then + rdiagbuf(20,ii) = data(ipof,i) ! data pof + rdiagbuf(21,ii) = data(ivvlc,i) ! data vertical velocity + do j=1,npredt + rdiagbuf(21+j,ii) = predbias(j) + + +netcdf diag_conv_t_ges.2020051806 { +dimensions: + nobs = UNLIMITED ; // (100806 currently) + Station_ID_maxstrlen = 8 ; + Observation_Class_maxstrlen = 7 ; + Bias_Correction_Terms_arr_dim = 3 ; +variables: + char Station_ID(nobs, Station_ID_maxstrlen) ; + char Observation_Class(nobs, Observation_Class_maxstrlen) ; + int Observation_Type(nobs) ; + float Latitude(nobs) ; + float Longitude(nobs) ; + float Station_Elevation(nobs) ; + float Pressure(nobs) ; + float Height(nobs) ; + float Time(nobs) ; + float Prep_QC_Mark(nobs) ; + float Setup_QC_Mark(nobs) ; + float Prep_Use_Flag(nobs) ; + float Analysis_Use_Flag(nobs) ; + float Nonlinear_QC_Rel_Wgt(nobs) ; + float Errinv_Input(nobs) ; + float Errinv_Adjust(nobs) ; + float Errinv_Final(nobs) ; + float Observation(nobs) ; + float Obs_Minus_Forecast_adjusted(nobs) ; + float Obs_Minus_Forecast_unadjusted(nobs) ; + float Data_Pof(nobs) ; + float Bias_Correction_Terms(nobs, Bias_Correction_Terms_arr_dim) ; + +// global attributes: + :Number_of_Predictors = 3 ; + :date_time = 2020051806 ; +} + + +netcdf diag_conv_uv_ges.2020051806 { +dimensions: + nobs = UNLIMITED ; // (1766025 currently) + Station_ID_maxstrlen = 8 ; + Observation_Class_maxstrlen = 7 ; +variables: + char Station_ID(nobs, Station_ID_maxstrlen) ; + char Observation_Class(nobs, Observation_Class_maxstrlen) ; + int Observation_Type(nobs) ; + int Observation_Subtype(nobs) ; + float Latitude(nobs) ; + float Longitude(nobs) ; + float Station_Elevation(nobs) ; + float Pressure(nobs) ; + float Height(nobs) ; + float Time(nobs) ; + float Prep_QC_Mark(nobs) ; + float Setup_QC_Mark(nobs) ; + float Prep_Use_Flag(nobs) ; + float Analysis_Use_Flag(nobs) ; + float Nonlinear_QC_Rel_Wgt(nobs) ; + float Errinv_Input(nobs) ; + float Errinv_Adjust(nobs) ; + float Errinv_Final(nobs) ; + float Wind_Reduction_Factor_at_10m(nobs) ; + float u_Observation(nobs) ; + float u_Obs_Minus_Forecast_adjusted(nobs) ; + float u_Obs_Minus_Forecast_unadjusted(nobs) ; + float v_Observation(nobs) ; + float v_Obs_Minus_Forecast_adjusted(nobs) ; + float v_Obs_Minus_Forecast_unadjusted(nobs) ; + +// global attributes: + :date_time = 2020051806 ; +} + +from setupw.f90: + rdiagbuf(1,ii) = ictype(ikx) ! observation type + rdiagbuf(2,ii) = icsubtype(ikx) ! observation subtype + + rdiagbuf(3,ii) = data(ilate,i) ! observation latitude (degrees) + rdiagbuf(4,ii) = data(ilone,i) ! observation longitude (degrees) + rdiagbuf(5,ii) = data(ielev,i) ! station elevation (meters) + rdiagbuf(6,ii) = presw ! observation pressure (hPa) + rdiagbuf(7,ii) = data(ihgt,i) ! observation height (meters) + rdiagbuf(8,ii) = dtime-time_offset ! obs time (hours relative to analysis time) + + rdiagbuf(9,ii) = data(iqc,i) ! input prepbufr qc or event mark + rdiagbuf(10,ii) = var_jb ! non linear qc parameter + rdiagbuf(11,ii) = data(iuse,i) ! read_prepbufr data usage flag + if(muse(i)) then + rdiagbuf(12,ii) = one ! analysis usage flag (1=use, -1=not used) + else + rdiagbuf(12,ii) = -one + endif + + rdiagbuf(13,ii) = rwgt ! nonlinear qc relative weight + rdiagbuf(14,ii) = errinv_input ! prepbufr inverse obs error (m/s)**-1 + rdiagbuf(15,ii) = errinv_adjst ! read_prepbufr inverse obs error (m/s)**-1 + rdiagbuf(16,ii) = errinv_final ! final inverse observation error (m/s)**-1 + + rdiagbuf(17,ii) = data(iuob,i) ! u wind component observation (m/s) + rdiagbuf(18,ii) = dudiff ! u obs-ges used in analysis (m/s) + rdiagbuf(19,ii) = uob-ugesin ! u obs-ges w/o bias correction (m/s) (future slot) + + rdiagbuf(20,ii) = data(ivob,i) ! v wind component observation (m/s) + rdiagbuf(21,ii) = dvdiff ! v obs-ges used in analysis (m/s) + rdiagbuf(22,ii) = vob-vgesin ! v obs-ges w/o bias correction (m/s) (future slot) + + + +netcdf diag_conv_gps_anl.2020040506 { +dimensions: + nobs = UNLIMITED ; // (353443 currently) + Station_ID_maxstrlen = 8 ; + Observation_Class_maxstrlen = 7 ; +variables: + char Station_ID(nobs, Station_ID_maxstrlen) ; + char Observation_Class(nobs, Observation_Class_maxstrlen) ; + int Observation_Type(nobs) ; + int Observation_Subtype(nobs) ; + float Latitude(nobs) ; + float Longitude(nobs) ; + float Incremental_Bending_Angle(nobs) ; + float Pressure(nobs) ; + float Height(nobs) ; + float Time(nobs) ; + float Model_Elevation(nobs) ; + float Setup_QC_Mark(nobs) ; + float Prep_Use_Flag(nobs) ; + float Analysis_Use_Flag(nobs) ; + float Nonlinear_QC_Rel_Wgt(nobs) ; + float Errinv_Input(nobs) ; + float Errinv_Adjust(nobs) ; + float Errinv_Final(nobs) ; + float Observation(nobs) ; + float Obs_Minus_Forecast_adjusted(nobs) ; + float Obs_Minus_Forecast_unadjusted(nobs) ; + float GPS_Type(nobs) ; + float Temperature_at_Obs_Location(nobs) ; + float Specific_Humidity_at_Obs_Location(nobs) ; + +// global attributes: + :date_time = 2020040506 ; +} + + from setupbend.f90: + + rdiagbuf(1,i) = ictype(ikx) ! observation type + rdiagbuf(2,i) = data(iprof,i) ! profile identifier + rdiagbuf(3,i) = data(ilate,i) ! lat in degrees + rdiagbuf(4,i) = data(ilone,i) ! lon in degrees + rdiagbuf( 5,i) = (data(igps,i)-dbend)/data(igps,i) ! incremental bending angle (x100 %) + rdiagbuf(6,i) = ten*exp(dpressure) ! pressure at obs location (hPa) if monotone grid + rdiagbuf(7,i) = tpdpres(i)-rocprof ! impact height in meters + rdiagbuf(8,i) = dtime-time_offset ! obs time (hours relative to analysis time) + rdiagbuf(9,i) = zsges ! model terrain (m) + rdiagbuf(10,ii) = id_qc ! setup qc or event mark + rdiagbuf(11,i) = data(iuse,i) ! data usage flag + rdiagbuf(12,ii) = one ! analysis usage flag (1=use, -1=not used) + rdiagbuf(13,i) = zero ! nonlinear qc relative weight - will be defined in genstats_gps + rdiagbuf(14,i) = errinv_input ! original inverse gps obs error (rad**-1) + rdiagbuf(15,i) = errinv_adjst ! original + represent error inverse gps + ! obs error (rad**-1) + rdiagbuf(16,i) = errinv_final ! final inverse observation error due to + ! superob factor (rad**-1) and qc + ! modified in genstats_gps + rdiagbuf(17,i) = data(igps,i) ! bending angle observation (radians) + rdiagbuf(18,i) = trefges ! temperature at obs location (Kelvin) if monotone grid + rdiagbuf(19,i) = hob ! model vertical grid (interface) if monotone grid + rdiagbuf(20,i) = one ! uses gps_ref (one = use of bending angle) + rdiagbuf(21,i) = qrefges ! specific humidity at obs location (kg/kg) if monotone grid + rdiagbuf(22,i) = 1.e+10_r_kind ! spread (filled in by EnKF) + + + +SST --- sea surface temperature + + rdiagbuf(1,ii) = ictype(ikx) ! observation type + rdiagbuf(2,ii) = icsubtype(ikx) ! observation subtype + + rdiagbuf(3,ii) = data(ilate,i) ! observation latitude (degrees) + rdiagbuf(4,ii) = data(ilone,i) ! observation longitude (degrees) + rdiagbuf(5,ii) = data(istnelv,i) ! station elevation (meters) + rdiagbuf(6,ii) = data(itemp,i) ! background open water temperature (K) + rdiagbuf(7,ii) = data(izob,i) ! observation depth (meters) + rdiagbuf(8,ii) = dtime-time_offset ! obs time (hours relative to analysis time) + + rdiagbuf(9,ii) = data(ipct,i) ! open water percentage (0 to 1) + rdiagbuf(10,ii) = id_qc ! setup qc or event mark + rdiagbuf(11,ii) = data(iuse,i) ! read_prepbufr data usage flag + if(muse(i)) then + rdiagbuf(12,ii) = one ! analysis usage flag (1=use, -1=not used) + else + rdiagbuf(12,ii) = -one + endif + + + rdiagbuf(13,ii) = rwgt ! nonlinear qc relative weight + rdiagbuf(14,ii) = errinv_input ! prepbufr inverse obs error (K**-1) + rdiagbuf(15,ii) = errinv_adjst ! read_prepbufr inverse obs error (K**-1) + rdiagbuf(16,ii) = errinv_final ! final inverse observation error (K**-1) + + rdiagbuf(17,ii) = data(isst,i) ! SST observation (K) + rdiagbuf(18,ii) = ddiff ! obs-ges used in analysis (K) + rdiagbuf(19,ii) = data(isst,i)-sstges! obs-ges w/o bias correction (K) (future slot) + + rdiagbuf(20,ii) = data(iotype,i) ! type of measurement + if (nst_gsi>0) then + rdiagbuf(maxinfo+1,ii) = data(itref,i) ! Tr + rdiagbuf(maxinfo+2,ii) = data(idtw,i) ! dt_warm at zob + rdiagbuf(maxinfo+3,ii) = data(idtc,i) ! dt_cool at zob + rdiagbuf(maxinfo+4,ii) = data(itz_tr,i) ! d(tz)/d(Tr) at zob + endif + + +dimensions: + nobs = UNLIMITED ; // (20485 currently) + Station_ID_maxstrlen = 8 ; + Observation_Class_maxstrlen = 7 ; +variables: + char Station_ID(nobs, Station_ID_maxstrlen) ; + char Observation_Class(nobs, Observation_Class_maxstrlen) ; + int Observation_Type(nobs) ; + int Observation_Subtype(nobs) ; + float Latitude(nobs) ; + float Longitude(nobs) ; + float Station_Elevation(nobs) ; + float Pressure(nobs) ; + float Height(nobs) ; + float Time(nobs) ; + float Prep_QC_Mark(nobs) ; + float Prep_Use_Flag(nobs) ; + float Nonlinear_QC_Rel_Wgt(nobs) ; + float Analysis_Use_Flag(nobs) ; + float Errinv_Input(nobs) ; + float Errinv_Adjust(nobs) ; + float Errinv_Final(nobs) ; + float Observation(nobs) ; + float Obs_Minus_Forecast_adjusted(nobs) ; + float Obs_Minus_Forecast_unadjusted(nobs) ; + float FoundationTempBG(nobs) ; + float DiurnalWarming_at_zob(nobs) ; + float SkinLayerCooling_at_zob(nobs) ; + float Sensitivity_Tzob_Tr(nobs) ; + +// global attributes: + :date_time = 2020040306 ; + :_NCProperties = "version=2,netcdf=4.7.4-development,hdf5=1.10.6," ; + diff --git a/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_sfctime.fd/conmon_read_diag.F90 b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_sfctime.fd/conmon_read_diag.F90 new file mode 100644 index 0000000000..0b7afcf067 --- /dev/null +++ b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_sfctime.fd/conmon_read_diag.F90 @@ -0,0 +1,1839 @@ +!---------------------------------------------------------------------- +! conmon_read_diag +! +! This subroutine reads the conventional data assimilation +! diagnostic files (contained in the cnvstat tar file) and returns +! the requested obs that match the input type and subtype in a +! linked list. The diagnostic files may be in either binary or +! NetCDF format. +! +! Note: +! There are problems/mismatches between the contents of binary +! and NetCDF files for types gps and sst. +!---------------------------------------------------------------------- + +module conmon_read_diag + + !--- use ---! + use generic_list + use data + use kinds, only: i_kind,r_single,r_kind + + use nc_diag_read_mod, only: nc_diag_read_init, nc_diag_read_close, & + nc_diag_read_get_dim, nc_diag_read_get_global_attr, & + nc_diag_read_get_var_names, & + nc_diag_read_get_global_attr_names, & + nc_diag_read_get_var, nc_diag_read_get_dim_names + + use ncdr_vars, only: nc_diag_read_check_var + use ncdr_dims, only: nc_diag_read_check_dim + + + !--- implicit ---! + implicit none + + + !--- public & private ---! + private + + public :: set_netcdf_read + public :: conmon_read_diag_file + public :: conmon_return_all_obs + + interface load_nc_var + module procedure load_nc_var_int, load_nc_var_real, load_nc_var_char + end interface + + + !--- common data structures ---! + logical,save :: netcdf = .false. + + integer(i_kind), parameter :: MAX_OPEN_NCDIAG = 2 + integer(i_kind), save :: nopen_ncdiag = 0 + integer(i_kind), dimension(MAX_OPEN_NCDIAG), save :: ncdiag_open_id = (/-1, -1/) + + type ncdiag_status + logical :: nc_read + integer(i_kind) :: cur_ob_idx + integer(i_kind) :: num_records + end type ncdiag_status + + type(ncdiag_status), dimension(MAX_OPEN_NCDIAG), save :: ncdiag_open_status + + + + contains + + + subroutine load_nc_var_int( var_name, ftin, var_storage, ierr ) + character(len=*), intent(in) :: var_name + integer, intent(in) :: ftin + integer, dimension(:), allocatable, intent(out) :: var_storage + integer, intent(out) :: ierr + + if( nc_diag_read_check_var( var_name )) then + call nc_diag_read_get_var( ftin, var_name, var_storage ) + ierr = 0 + else + print *, 'WARNING: unable to read ', trim( var_name ) + ierr = 1 + end if + end subroutine + + + subroutine load_nc_var_real( var_name, ftin, var_storage, ierr ) + character(len=*), intent(in) :: var_name + integer, intent(in) :: ftin + real(r_single), dimension(:), allocatable, intent(out) :: var_storage + integer, intent(out) :: ierr + + if( nc_diag_read_check_var( var_name )) then + call nc_diag_read_get_var( ftin, var_name, var_storage ) + ierr=0 + else + print *, 'WARNING: unable to read ', trim( var_name ) + ierr=1 + end if + end subroutine + + + subroutine load_nc_var_char( var_name, ftin, var_storage, ierr ) + character(len=*), intent(in) :: var_name + integer, intent(in) :: ftin + character(len=:), dimension(:), allocatable, intent(out) :: var_storage + integer, intent(out) :: ierr + + if( nc_diag_read_check_var( var_name )) then + call nc_diag_read_get_var( ftin, var_name, var_storage ) + ierr=0 + else + print *, 'WARNING: unable to read ', trim( var_name ) + ierr=1 + end if + end subroutine + + + + !------------------------------------------------------------ + ! set_netcdf_read + ! + ! set the use_netcdf flag to signal binary (default) or + ! netcdf formatted diagnostic files. + !------------------------------------------------------------ + subroutine set_netcdf_read( use_netcdf ) + logical,intent(in) :: use_netcdf + + netcdf = use_netcdf + + end subroutine set_netcdf_read + + + + !--------------------------------------------------------------- + ! conmon_read_diag_file + ! + ! Public routine to read a conventional diagnostic file + ! + ! Obs in the input_file are returned in the list according + ! to these rules: + ! + ! 1. All obs matching intype and in_subtype are returned. + ! + ! 2. If there are no subtype values in the input_file then + ! all obs matching intype are returned. + ! + !--------------------------------------------------------------- + subroutine conmon_read_diag_file( input_file, ctype, intype, expected_nreal, nobs, in_subtype, list ) + + !--- interface + character(100), intent(in) :: input_file + character(3), intent(in) :: ctype + + !--- note expected_nreal has no meaning for netcdf files + integer, intent(in) :: intype, expected_nreal, in_subtype + integer, intent(out) :: nobs + type(list_node_t), pointer :: list + logical :: return_all = .false. + + write(6,*)'--> conmon_read_diag_file' + + if ( netcdf ) then + write(6,*) ' call nc read subroutine' + call read_diag_file_nc( input_file, return_all, ctype, intype, expected_nreal, nobs, in_subtype, list ) + else + call read_diag_file_bin( input_file,return_all, ctype, intype, expected_nreal,nobs,in_subtype, list ) + end if + + write(6,*)"<-- conmon_read_diag_file" + + end subroutine conmon_read_diag_file + + + + !------------------------------------------------------------------ + ! conmon_return_all_obs + ! + ! Retrieve all obs from a given conventional diagnostic file. + ! Note that the NetCDF formatted diag files always contain only + ! one conventional data type (gps, ps, q, sst, t, uv), while + ! binary formatted diag files contain all types for a single + ! ges or anl run. + ! + ! Note: the ctype parameter only has meaning for NetCDF + ! formatted diag files. + !------------------------------------------------------------------ + subroutine conmon_return_all_obs( input_file, ctype, nobs, list ) + + !--- interface + character(100), intent(in) :: input_file + character(3), intent(in) :: ctype + integer, intent(out) :: nobs + type(list_node_t), pointer :: list + + logical :: return_all = .true. + integer :: intype, expected_nreal, in_subtype + + write(6,*)'--> conmon_return_all_obs' + nobs = 0 + + ! + ! Q: Can I re-use the read_diag_* to do this read, + ! adding extra param(s) to switch on _all_ obs? + ! Those routines are private to this module so + ! that wouldn't pose a complexity problem for + ! accessing the routines. + ! + if ( netcdf ) then + write(6,*) ' call nc retrieve all routine' + call read_diag_file_nc( input_file, return_all, ctype, intype, expected_nreal, nobs, in_subtype, list ) + else + write(6,*) ' call bin retrieve all routine' + call read_diag_file_bin( input_file,return_all, ctype, intype, expected_nreal,nobs,in_subtype, list ) + end if + + write(6,*)'<-- conmon_return_all_obs' + + end subroutine conmon_return_all_obs + + + !------------------------------- + ! read_diag_file_nc + ! + ! NetCDF read routine + !------------------------------- + subroutine read_diag_file_nc( input_file, return_all, ctype, intype, expected_nreal, nobs, in_subtype, list ) + + !--- interface + character(100), intent(in) :: input_file + logical, intent(in) :: return_all + character(3), intent(in) :: ctype + integer, intent(in) :: intype, expected_nreal, in_subtype + integer, intent(out) :: nobs + type(list_node_t), pointer :: list + + !--- local vars + type(list_node_t), pointer :: next => null() + type(data_ptr) :: ptr + integer :: ii, ierr, istatus, ftin, total_obs, id, idx + + data ftin / 11 / + + + print *, ' ' + print *, ' --> read_diag_file_nc' + print *, ' ctype, intype, in_subtype = ', ctype, intype, in_subtype + nobs = 0 + ierr = 0 + + if (nopen_ncdiag >= MAX_OPEN_NCDIAG) then + write(6,*) 'OPEN_RADIAG: ***ERROR*** Cannot open more than ', & + MAX_OPEN_NCDIAG, ' netcdf diag files.' + endif + + call nc_diag_read_init( input_file, ftin ) + istatus=0 + + do ii = 1, MAX_OPEN_NCDIAG + + if( ncdiag_open_id(ii) < 0 ) then + ncdiag_open_id(ii) = ftin + ncdiag_open_status(ii)%nc_read = .false. + + ncdiag_open_status(ii)%cur_ob_idx = -9999 + ncdiag_open_status(ii)%num_records = -9999 + nopen_ncdiag = nopen_ncdiag + 1 + exit + endif + + enddo + + select case ( trim( adjustl( ctype ) ) ) + + case ( 'gps' ) + call read_diag_file_gps_nc( input_file, return_all, ftin, ctype, intype, expected_nreal, nobs, in_subtype, list ) + + case ( 'ps' ) + call read_diag_file_ps_nc( input_file, return_all, ftin, ctype, intype, expected_nreal, nobs, in_subtype, list ) + + case ( 'q' ) + call read_diag_file_q_nc( input_file, return_all, ftin, ctype, intype, expected_nreal, nobs, in_subtype, list ) + + case ( 'sst' ) + call read_diag_file_sst_nc( input_file, return_all, ftin, ctype, intype, expected_nreal, nobs, in_subtype, list ) + + case ( 't' ) + call read_diag_file_t_nc( input_file, return_all, ftin, ctype, intype, expected_nreal, nobs, in_subtype, list ) + + case ( 'uv' ) + call read_diag_file_uv_nc( input_file, return_all, ftin, ctype, intype, expected_nreal, nobs, in_subtype, list ) + + case default + print *, 'ERROR: unmatched ctype :', ctype + + end select + + + id = find_ncdiag_id(ftin) + if (id < 0) then + write(6,*) 'CLOSE_RADIAG: ***ERROR*** ncdiag file ', input_file, & + ' was not opened' + endif + + call nc_diag_read_close( input_file ) + ncdiag_open_id(id) = -1 + + ncdiag_open_status(id)%nc_read = .false. + ncdiag_open_status(id)%cur_ob_idx = -9999 + ncdiag_open_status(id)%num_records = -9999 + + nopen_ncdiag = nopen_ncdiag - 1 + + print *, ' ' + print *, ' <-- read_diag_file_nc, ierr = ', ierr + + + end subroutine read_diag_file_nc + + + !--------------------------------------------------------- + ! netcdf read routine for ps data types in netcdf files + ! + subroutine read_diag_file_ps_nc( input_file, return_all, ftin, ctype, intype,expected_nreal,nobs,in_subtype, list ) + + !--- interface + character(100), intent(in) :: input_file + logical, intent(in) :: return_all + integer, intent(in) :: ftin + character(3), intent(in) :: ctype + integer, intent(in) :: intype, expected_nreal, in_subtype + integer, intent(out) :: nobs + type(list_node_t), pointer :: list + + !--- local vars + type(list_node_t), pointer :: next => null() + type(data_ptr) :: ptr + integer :: ii, ierr, istatus, total_obs, idx + logical :: have_subtype = .true. + logical :: add_obs + + !--- NetCDF file components dimension(s) + ! + character(len=:), dimension(:), allocatable :: Station_ID ! (nobs, Station_ID_maxstrlen) + character(len=:), dimension(:), allocatable :: Observation_Class ! (nobs, Station_Class_maxstrlen) + integer, dimension(:), allocatable :: Observation_Type ! (obs) + integer, dimension(:), allocatable :: Observation_Subtype ! (obs) + real(r_single), dimension(:), allocatable :: Latitude ! (obs) + real(r_single), dimension(:), allocatable :: Longitude ! (obs) + real(r_single), dimension(:), allocatable :: Station_Elevation ! (obs) + real(r_single), dimension(:), allocatable :: Pressure ! (obs) + real(r_single), dimension(:), allocatable :: Height ! (obs) + real(r_single), dimension(:), allocatable :: Time ! (obs) + real(r_single), dimension(:), allocatable :: Prep_QC_Mark ! (obs) + real(r_single), dimension(:), allocatable :: Prep_Use_Flag ! (obs) + real(r_single), dimension(:), allocatable :: Nonlinear_QC_Var_Jb ! (obs) + real(r_single), dimension(:), allocatable :: Nonlinear_QC_Rel_Wgt ! (obs) + real(r_single), dimension(:), allocatable :: Analysis_Use_Flag ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Input ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Adjust ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Final ! (obs) + real(r_single), dimension(:), allocatable :: Observation ! (obs) + real(r_single), dimension(:), allocatable :: Obs_Minus_Forecast_adjusted ! (obs) + real(r_single), dimension(:), allocatable :: Obs_Minus_Forecast_unadjusted ! (obs) + integer(i_kind) :: idate + + print *, ' ' + print *, ' --> read_diag_file_ps_nc' + + + !--- get NetCDF file dimensions + ! + if( nc_diag_read_check_dim( 'nobs' )) then + total_obs = nc_diag_read_get_dim(ftin,'nobs') + ncdiag_open_status(ii)%num_records = total_obs + print *, ' total_obs = ', total_obs + else + print *, 'ERROR: unable to read nobs' + ierr=1 + end if + + + !--- get vars + + call load_nc_var( 'Station_ID', ftin, Station_ID, ierr ) + call load_nc_var( 'Observation_Class', ftin, Observation_Class, ierr ) + call load_nc_var( 'Observation_Type', ftin, Observation_Type, ierr ) + call load_nc_var( 'Observation_Subtype', ftin, Observation_Subtype, ierr ) + if( ierr == 1 ) then + have_subtype = .false. + end if + call load_nc_var( 'Latitude', ftin, Latitude, ierr ) + call load_nc_var( 'Longitude', ftin, Longitude, ierr ) + call load_nc_var( 'Station_Elevation', ftin, Station_Elevation, ierr ) + call load_nc_var( 'Pressure', ftin, Pressure, ierr ) + call load_nc_var( 'Height', ftin, Height, ierr ) + call load_nc_var( 'Time', ftin, Time, ierr ) + call load_nc_var( 'Prep_QC_Mark', ftin, Prep_QC_Mark, ierr ) + call load_nc_var( 'Nonlinear_QC_Var_Jb', ftin, Nonlinear_QC_Var_Jb, ierr ) + call load_nc_var( 'Nonlinear_QC_Rel_Wgt', ftin, Nonlinear_QC_Rel_Wgt, ierr ) + call load_nc_var( 'Prep_Use_Flag', ftin, Prep_Use_Flag, ierr ) + call load_nc_var( 'Analysis_Use_Flag', ftin, Analysis_Use_Flag, ierr ) + call load_nc_var( 'Errinv_Input', ftin, Errinv_Input, ierr ) + call load_nc_var( 'Errinv_Adjust', ftin, Errinv_Adjust, ierr ) + call load_nc_var( 'Errinv_Final', ftin, Errinv_Final, ierr ) + call load_nc_var( 'Observation', ftin, Observation, ierr ) + call load_nc_var( 'Obs_Minus_Forecast_adjusted', ftin, Obs_Minus_Forecast_adjusted, ierr ) + call load_nc_var( 'Obs_Minus_Forecast_unadjusted', ftin, Obs_Minus_Forecast_unadjusted, ierr ) + + + + !--------------------------------------------------------------- + ! Process all obs. If type and subtype match the input values + ! add this obs to the linked list (ptr%p). + ! + nobs = 0 + do ii = 1, total_obs + + + add_obs = .false. + + !------------------------------------------------------------------------ + ! Check on Observation_Class to ctype is a sanity check -- + ! only a single class of obs are in any given NetCDF formatted diag file + ! but, if the ctype and input file don't match, things could get + ! interesting (but not in a good way). + ! + if( adjustl( trim( Observation_Class(ii) )) == adjustl( trim( ctype ))) then + + if( return_all == .true. ) then + add_obs = .true. + + else if( Observation_Type(ii) == intype ) then + + if( have_subtype == .false. ) then + add_obs = .true. + else if( Observation_Subtype(ii) == in_subtype ) then + add_obs = .true. + end if + + end if + end if + + if( add_obs == .true. ) then + + nobs=nobs+1 + + !--------------------------------------------- + ! Allocate a new data element and load + ! + allocate( ptr%p ) + ptr%p%stn_id = Station_ID( ii ) + + do idx=1,max_rdiag_reals + ptr%p%rdiag( idx ) = 0.00 + end do + + if( allocated( Observation_Type )) ptr%p%rdiag( idx_obs_type_ps ) = Observation_Type( ii ) + if( allocated( Observation_Subtype )) ptr%p%rdiag( idx_obs_subtype_ps ) = Observation_Subtype( ii ) + if( allocated( Latitude )) ptr%p%rdiag( idx_obs_lat_ps ) = Latitude( ii ) + if( allocated( Longitude )) ptr%p%rdiag( idx_obs_lon_ps ) = Longitude( ii ) + if( allocated( Station_Elevation )) ptr%p%rdiag( idx_stn_elev_ps ) = Station_Elevation( ii ) + if( allocated( Pressure )) ptr%p%rdiag( idx_pres_ps ) = Pressure( ii ) + if( allocated( Height )) ptr%p%rdiag( idx_hgt_ps ) = Height( ii ) + if( allocated( Time )) ptr%p%rdiag( idx_time_ps ) = Time( ii ) + if( allocated( Prep_QC_Mark )) ptr%p%rdiag( idx_iqc_ps ) = Prep_QC_Mark( ii ) + if( allocated( Nonlinear_QC_Var_Jb )) ptr%p%rdiag( idx_var_jb_ps ) = Nonlinear_QC_Var_Jb( ii ) + if( allocated( Prep_Use_Flag )) ptr%p%rdiag( idx_iuse_ps ) = Prep_Use_Flag( ii ) + if( allocated( Analysis_Use_Flag )) ptr%p%rdiag( idx_anl_use_ps ) = Analysis_Use_Flag( ii ) + if( allocated( Nonlinear_QC_Rel_Wgt )) ptr%p%rdiag( idx_rwgt_ps ) = Nonlinear_QC_Rel_Wgt( ii ) + if( allocated( Errinv_Input )) ptr%p%rdiag( idx_err_input_ps ) = Errinv_Input( ii ) + if( allocated( Errinv_Adjust )) ptr%p%rdiag( idx_errinv_ps ) = Errinv_Adjust( ii ) + if( allocated( Errinv_Final )) ptr%p%rdiag( idx_errinv_fnl_ps ) = Errinv_Final( ii ) + if( allocated( Observation )) ptr%p%rdiag( idx_obs_ps ) = Observation( ii ) + if( allocated( Obs_Minus_Forecast_adjusted )) ptr%p%rdiag( idx_obsmg_adj_ps ) = Obs_Minus_Forecast_adjusted( ii ) + if( allocated( Obs_Minus_Forecast_unadjusted )) ptr%p%rdiag( idx_obsmg_nadj_ps ) = Obs_Minus_Forecast_unadjusted( ii ) + + if( nobs == 1 ) then + !------------------------------------------------- + ! Initialize the list with the first data element + ! + call list_init(list, transfer(ptr, list_data)) + next => list + + else + !------------------------------------------------- + ! Insert subsequent nodes into the list + ! + call list_insert(next, transfer(ptr, list_data)) + next => list_next(next) + end if + + end if + + end do + + + if( allocated( Station_ID )) deallocate( Station_ID ) + if( allocated( Observation_Class )) deallocate( Observation_Class ) + if( allocated( Observation_Type )) deallocate( Observation_Type ) + if( allocated( Observation_Subtype )) deallocate( Observation_Subtype ) + if( allocated( Latitude )) deallocate( Latitude ) + if( allocated( Longitude )) deallocate( Longitude ) + if( allocated( Station_Elevation )) deallocate( Station_Elevation ) + if( allocated( Time )) deallocate( Time ) + if( allocated( Prep_QC_Mark )) deallocate( Prep_QC_Mark ) + if( allocated( Prep_Use_Flag )) deallocate( Prep_Use_Flag ) + if( allocated( Nonlinear_QC_Var_Jb )) deallocate( Nonlinear_QC_Var_Jb ) + if( allocated( Nonlinear_QC_Rel_Wgt )) deallocate( Nonlinear_QC_Rel_Wgt ) + if( allocated( Analysis_Use_Flag )) deallocate( Analysis_Use_Flag ) + if( allocated( Errinv_Input )) deallocate( Errinv_Input ) + if( allocated( Errinv_Adjust )) deallocate( Errinv_Final ) + if( allocated( Errinv_Final )) deallocate( Errinv_Final ) + if( allocated( Observation )) deallocate( Observation ) + if( allocated( Obs_Minus_Forecast_adjusted )) deallocate( Obs_Minus_Forecast_adjusted ) + if( allocated( Obs_Minus_Forecast_unadjusted )) deallocate( Obs_Minus_Forecast_unadjusted ) + + print *, ' ' + print *, ' <-- read_diag_file_ps_nc' + + end subroutine read_diag_file_ps_nc + + + !--------------------------------------------------------- + ! netcdf read routine for q data types in netcdf files + ! + subroutine read_diag_file_q_nc( input_file, return_all, ftin, ctype, intype,expected_nreal,nobs,in_subtype, list ) + + !--- interface + character(100), intent(in) :: input_file + logical, intent(in) :: return_all + integer, intent(in) :: ftin + character(3), intent(in) :: ctype + integer, intent(in) :: intype, expected_nreal, in_subtype + integer, intent(out) :: nobs + type(list_node_t), pointer :: list + + !--- local vars + type(list_node_t), pointer :: next => null() + type(data_ptr) :: ptr + integer :: ii, ierr, istatus, total_obs, idx + logical :: have_subtype = .true. + logical :: add_obs + + !--- NetCDF file components dimension(s) + ! + character(len=:), dimension(:), allocatable :: Station_ID ! (nobs, Station_ID_maxstrlen) + character(len=:), dimension(:), allocatable :: Observation_Class ! (nobs, Station_Class_maxstrlen) + integer, dimension(:), allocatable :: Observation_Type ! (obs) + integer, dimension(:), allocatable :: Observation_Subtype ! (obs) + real(r_single), dimension(:), allocatable :: Latitude ! (obs) + real(r_single), dimension(:), allocatable :: Longitude ! (obs) + real(r_single), dimension(:), allocatable :: Station_Elevation ! (obs) + real(r_single), dimension(:), allocatable :: Pressure ! (obs) + real(r_single), dimension(:), allocatable :: Height ! (obs) + real(r_single), dimension(:), allocatable :: Time ! (obs) + real(r_single), dimension(:), allocatable :: Prep_QC_Mark ! (obs) + real(r_single), dimension(:), allocatable :: Prep_Use_Flag ! (obs) + real(r_single), dimension(:), allocatable :: Nonlinear_QC_Var_Jb ! (obs) + real(r_single), dimension(:), allocatable :: Nonlinear_QC_Rel_Wgt ! (obs) + real(r_single), dimension(:), allocatable :: Analysis_Use_Flag ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Input ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Adjust ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Final ! (obs) + real(r_single), dimension(:), allocatable :: Observation ! (obs) + real(r_single), dimension(:), allocatable :: Obs_Minus_Forecast_adjusted ! (obs) + real(r_single), dimension(:), allocatable :: Obs_Minus_Forecast_unadjusted ! (obs) + real(r_single), dimension(:), allocatable :: Forecast_Saturation_Spec_Hum ! (obs) + integer(i_kind) :: idate + + print *, ' ' + print *, ' --> read_diag_file_q_nc' + + + !--- get NetCDF file dimensions + ! + if( nc_diag_read_check_dim( 'nobs' )) then + total_obs = nc_diag_read_get_dim(ftin,'nobs') + ncdiag_open_status(ii)%num_records = total_obs + print *, ' total_obs = ', total_obs + else + print *, 'ERROR: unable to read nobs' + ierr=1 + end if + + + !--- get vars + + call load_nc_var( 'Station_ID', ftin, Station_ID, ierr ) + call load_nc_var( 'Observation_Class', ftin, Observation_Class, ierr ) + call load_nc_var( 'Observation_Type', ftin, Observation_Type, ierr ) + call load_nc_var( 'Observation_Subtype', ftin, Observation_Subtype, ierr ) + if( ierr == 1 ) then + have_subtype = .false. + end if + call load_nc_var( 'Latitude', ftin, Latitude, ierr ) + call load_nc_var( 'Longitude', ftin, Longitude, ierr ) + call load_nc_var( 'Station_Elevation', ftin, Station_Elevation, ierr ) + call load_nc_var( 'Pressure', ftin, Pressure, ierr ) + call load_nc_var( 'Height', ftin, Height, ierr ) + call load_nc_var( 'Time', ftin, Time, ierr ) + call load_nc_var( 'Prep_QC_Mark', ftin, Prep_QC_Mark, ierr ) + call load_nc_var( 'Nonlinear_QC_Var_Jb', ftin, Nonlinear_QC_Var_Jb, ierr ) + call load_nc_var( 'Nonlinear_QC_Rel_Wgt', ftin, Nonlinear_QC_Rel_Wgt, ierr ) + call load_nc_var( 'Prep_Use_Flag', ftin, Prep_Use_Flag, ierr ) + call load_nc_var( 'Analysis_Use_Flag', ftin, Analysis_Use_Flag, ierr ) + call load_nc_var( 'Errinv_Input', ftin, Errinv_Input, ierr ) + call load_nc_var( 'Errinv_Adjust', ftin, Errinv_Adjust, ierr ) + call load_nc_var( 'Errinv_Final', ftin, Errinv_Final, ierr ) + call load_nc_var( 'Observation', ftin, Observation, ierr ) + call load_nc_var( 'Obs_Minus_Forecast_adjusted', ftin, Obs_Minus_Forecast_adjusted, ierr ) + call load_nc_var( 'Obs_Minus_Forecast_unadjusted', ftin, Obs_Minus_Forecast_unadjusted, ierr ) + call load_nc_var( 'Forecast_Saturation_Spec_Hum', ftin, Forecast_Saturation_Spec_Hum, ierr ) + + + + !--------------------------------------------------------------- + ! Process all obs. If type and subtype match the input values + ! add this obs to the linked list (ptr%p). + ! + nobs = 0 + do ii = 1, total_obs + + add_obs = .false. + + !------------------------------------------------------------------------ + ! Check on Observation_Class to ctype is a sanity check -- + ! only a single class of obs are in any given NetCDF formatted diag file + ! but, if the ctype and input file don't match, things could get + ! interesting (but not in a good way). + ! + if( adjustl( trim( Observation_Class(ii) )) == adjustl( trim( ctype ))) then + + if( return_all == .true. ) then + add_obs = .true. + + else if( Observation_Type(ii) == intype ) then + + if( have_subtype == .false. ) then + add_obs = .true. + else if( Observation_Subtype(ii) == in_subtype ) then + add_obs = .true. + end if + + end if + end if + + + if( add_obs == .true. ) then + + nobs=nobs+1 + + !--------------------------------------------- + ! Allocate a new data element and load + ! + allocate(ptr%p) + ptr%p%stn_id = Station_ID( ii ) + + do idx=1,max_rdiag_reals + ptr%p%rdiag( idx ) = 0.00 + end do + + if( allocated( Observation_Type )) ptr%p%rdiag( idx_obs_type_q ) = Observation_Type( ii ) + if( allocated( Observation_Subtype )) ptr%p%rdiag( idx_obs_subtype_q ) = Observation_Subtype( ii ) + if( allocated( Latitude )) ptr%p%rdiag( idx_obs_lat_q ) = Latitude( ii ) + if( allocated( Longitude )) ptr%p%rdiag( idx_obs_lon_q ) = Longitude( ii ) + if( allocated( Station_Elevation )) ptr%p%rdiag( idx_stn_elev_q ) = Station_Elevation( ii ) + if( allocated( Pressure )) ptr%p%rdiag( idx_pres_q ) = Pressure( ii ) + if( allocated( Height )) ptr%p%rdiag( idx_hgt_q ) = Height( ii ) + if( allocated( Time )) ptr%p%rdiag( idx_time_q ) = Time( ii ) + if( allocated( Prep_QC_Mark )) ptr%p%rdiag( idx_iqc_q ) = Prep_QC_Mark( ii ) + if( allocated( Nonlinear_QC_Var_Jb )) ptr%p%rdiag( idx_var_jb_q ) = Nonlinear_QC_Var_Jb( ii ) + if( allocated( Prep_Use_Flag )) ptr%p%rdiag( idx_iuse_q ) = Prep_Use_Flag( ii ) + if( allocated( Analysis_Use_Flag )) ptr%p%rdiag( idx_anl_use_q ) = Analysis_Use_Flag( ii ) + if( allocated( Nonlinear_QC_Rel_Wgt )) ptr%p%rdiag( idx_rwgt_q ) = Nonlinear_QC_Rel_Wgt( ii ) + if( allocated( Errinv_Input )) ptr%p%rdiag( idx_err_input_q ) = Errinv_Input( ii ) + if( allocated( Errinv_Adjust )) ptr%p%rdiag( idx_errinv_q ) = Errinv_Adjust( ii ) + if( allocated( Errinv_Final )) ptr%p%rdiag( idx_errinv_fnl_q ) = Errinv_Final( ii ) + if( allocated( Observation )) ptr%p%rdiag( idx_obs_q ) = Observation( ii ) + if( allocated( Obs_Minus_Forecast_adjusted )) ptr%p%rdiag( idx_obsmg_adj_q ) = Obs_Minus_Forecast_adjusted( ii ) + if( allocated( Obs_Minus_Forecast_unadjusted )) ptr%p%rdiag( idx_obsmg_nadj_q ) = Obs_Minus_Forecast_unadjusted( ii ) + if( allocated( Forecast_Saturation_Spec_Hum )) ptr%p%rdiag( idx_ges_sat_q ) = Forecast_Saturation_Spec_Hum( ii ) + + + if( nobs == 1 ) then + !------------------------------------------------- + ! Initialize the list with the first data element + ! + call list_init(list, transfer(ptr, list_data)) + next => list + + else + !------------------------------------------------- + ! Insert subsequent nodes into the list + ! + call list_insert(next, transfer(ptr, list_data)) + next => list_next(next) + end if + + end if + + end do + + + if( allocated( Station_ID )) deallocate( Station_ID ) + if( allocated( Observation_Class )) deallocate( Observation_Class ) + if( allocated( Observation_Type )) deallocate( Observation_Type ) + if( allocated( Observation_Subtype )) deallocate( Observation_Subtype ) + if( allocated( Latitude )) deallocate( Latitude ) + if( allocated( Longitude )) deallocate( Longitude ) + if( allocated( Station_Elevation )) deallocate( Station_Elevation ) + if( allocated( Time )) deallocate( Time ) + if( allocated( Prep_QC_Mark )) deallocate( Prep_QC_Mark ) + if( allocated( Prep_Use_Flag )) deallocate( Prep_Use_Flag ) + if( allocated( Nonlinear_QC_Var_Jb )) deallocate( Nonlinear_QC_Var_Jb ) + if( allocated( Nonlinear_QC_Rel_Wgt )) deallocate( Nonlinear_QC_Rel_Wgt ) + if( allocated( Analysis_Use_Flag )) deallocate( Analysis_Use_Flag ) + if( allocated( Errinv_Input )) deallocate( Errinv_Input ) + if( allocated( Errinv_Adjust )) deallocate( Errinv_Final ) + if( allocated( Errinv_Final )) deallocate( Errinv_Final ) + if( allocated( Observation )) deallocate( Observation ) + if( allocated( Obs_Minus_Forecast_adjusted )) deallocate( Obs_Minus_Forecast_adjusted ) + if( allocated( Obs_Minus_Forecast_unadjusted )) deallocate( Obs_Minus_Forecast_unadjusted ) + if( allocated( Forecast_Saturation_Spec_Hum )) deallocate( Forecast_Saturation_Spec_Hum ) + + print *, ' ' + print *, ' <-- read_diag_file_q_nc' + + end subroutine read_diag_file_q_nc + + + + !------------------------------------------------------------- + ! netcdf read routine for ps data types in netcdf files + ! + ! NOTE1: This routine is untested. The ConMon does not + ! currently process sst obs. + ! + ! NOTE2: There are known discrepencies between the contents + ! of sst obs in binary and NetCDF files. + ! + subroutine read_diag_file_sst_nc( input_file, return_all, ftin, ctype, intype,expected_nreal,nobs,in_subtype, list ) + + !--- interface + character(100), intent(in) :: input_file + logical, intent(in) :: return_all + integer, intent(in) :: ftin + character(3), intent(in) :: ctype + integer, intent(in) :: intype, expected_nreal, in_subtype + integer, intent(out) :: nobs + type(list_node_t), pointer :: list + + !--- local vars + type(list_node_t), pointer :: next => null() + type(data_ptr) :: ptr + integer :: ii, ierr, istatus, total_obs, idx + logical :: have_subtype = .true. + logical :: add_obs + + !--- NetCDF file components dimension(s) + ! + character(len=:), dimension(:), allocatable :: Station_ID ! (nobs, Station_ID_maxstrlen) + character(len=:), dimension(:), allocatable :: Observation_Class ! (nobs, Station_Class_maxstrlen) + integer, dimension(:), allocatable :: Observation_Type ! (obs) + integer, dimension(:), allocatable :: Observation_Subtype ! (obs) + real(r_single), dimension(:), allocatable :: Latitude ! (obs) + real(r_single), dimension(:), allocatable :: Longitude ! (obs) + real(r_single), dimension(:), allocatable :: Station_Elevation ! (obs) + real(r_single), dimension(:), allocatable :: Pressure ! (obs) + real(r_single), dimension(:), allocatable :: Height ! (obs) + real(r_single), dimension(:), allocatable :: Time ! (obs) + real(r_single), dimension(:), allocatable :: Prep_QC_Mark ! (obs) + real(r_single), dimension(:), allocatable :: Prep_Use_Flag ! (obs) + real(r_single), dimension(:), allocatable :: Nonlinear_QC_Var_Jb ! (obs) + real(r_single), dimension(:), allocatable :: Nonlinear_QC_Rel_Wgt ! (obs) + real(r_single), dimension(:), allocatable :: Analysis_Use_Flag ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Input ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Adjust ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Final ! (obs) + real(r_single), dimension(:), allocatable :: Observation ! (obs) + real(r_single), dimension(:), allocatable :: Obs_Minus_Forecast_adjusted ! (obs) + real(r_single), dimension(:), allocatable :: Obs_Minus_Forecast_unadjusted ! (obs) + real(r_single), dimension(:), allocatable :: FoundationTempBG ! (obs) + real(r_single), dimension(:), allocatable :: DiurnalWarming_at_zob ! (obs) + real(r_single), dimension(:), allocatable :: SkinLayerCooling_at_zob ! (obs) + real(r_single), dimension(:), allocatable :: Sensitivity_Tzob_Tr ! (obs) + integer(i_kind) :: idate + + print *, ' ' + print *, ' --> read_diag_file_sst_nc' + + + !--- get NetCDF file dimensions + ! + if( nc_diag_read_check_dim( 'nobs' )) then + total_obs = nc_diag_read_get_dim(ftin,'nobs') + ncdiag_open_status(ii)%num_records = total_obs + print *, ' total_obs = ', total_obs + else + print *, 'ERROR: unable to read nobs' + ierr=1 + end if + + + !--- get vars + + call load_nc_var( 'Station_ID', ftin, Station_ID, ierr ) + call load_nc_var( 'Observation_Class', ftin, Station_ID, ierr ) + call load_nc_var( 'Observation_Type', ftin, Observation_Type, ierr ) + call load_nc_var( 'Observation_Subtype', ftin, Observation_Subtype, ierr ) + if( ierr == 1 ) then + have_subtype = .false. + end if + call load_nc_var( 'Latitude', ftin, Latitude, ierr ) + call load_nc_var( 'Longitude', ftin, Longitude, ierr ) + call load_nc_var( 'Station_Elevation', ftin, Station_Elevation, ierr ) + call load_nc_var( 'Pressure', ftin, Pressure, ierr ) + call load_nc_var( 'Height', ftin, Height, ierr ) + call load_nc_var( 'Time', ftin, Time, ierr ) + call load_nc_var( 'Prep_QC_Mark', ftin, Prep_QC_Mark, ierr ) + call load_nc_var( 'Nonlinear_QC_Var_Jb', ftin, Nonlinear_QC_Var_Jb, ierr ) + call load_nc_var( 'Nonlinear_QC_Rel_Wgt', ftin, Nonlinear_QC_Rel_Wgt, ierr ) + call load_nc_var( 'Prep_Use_Flag', ftin, Prep_Use_Flag, ierr ) + call load_nc_var( 'Analysis_Use_Flag', ftin, Analysis_Use_Flag, ierr ) + call load_nc_var( 'Errinv_Input', ftin, Errinv_Input, ierr ) + call load_nc_var( 'Errinv_Adjust', ftin, Errinv_Adjust, ierr ) + call load_nc_var( 'Errinv_Final', ftin, Errinv_Final, ierr ) + call load_nc_var( 'Observation', ftin, Observation, ierr ) + call load_nc_var( 'Obs_Minus_Forecast_adjusted', ftin, Obs_Minus_Forecast_adjusted, ierr ) + call load_nc_var( 'Obs_Minus_Forecast_unadjusted', ftin, Obs_Minus_Forecast_unadjusted, ierr ) + call load_nc_var( 'FoundationTempBG', ftin, FoundationTempBG, ierr ) + call load_nc_var( 'DiurnalWarming_at_zob', ftin, DiurnalWarming_at_zob, ierr ) + call load_nc_var( 'SkinLayerCooling_at_zob', ftin, SkinLayerCooling_at_zob, ierr ) + call load_nc_var( 'Sensitivity_Tzob_Tr', ftin, Sensitivity_Tzob_Tr, ierr ) + + + + !--------------------------------------------------------------- + ! Process all obs. If type and subtype match the input values + ! add this obs to the linked list (ptr%p). + ! + nobs = 0 + do ii = 1, total_obs + + add_obs = .false. + + !------------------------------------------------------------------------ + ! Check on Observation_Class to ctype is a sanity check -- + ! only a single class of obs are in any given NetCDF formatted diag + ! file + ! but, if the ctype and input file don't match, things could get + ! interesting (but not in a good way). + ! + if( adjustl( trim( Observation_Class(ii) )) == adjustl( trim( ctype ))) then + + if( return_all == .true. ) then + add_obs = .true. + + else if( Observation_Type(ii) == intype ) then + + if( have_subtype == .false. ) then + add_obs = .true. + else if( Observation_Subtype(ii) == in_subtype ) then + add_obs = .true. + end if + + end if + end if + + + if( add_obs == .true. ) then + + nobs=nobs+1 + + !--------------------------------------------- + ! Allocate a new data element and load + ! + allocate( ptr%p ) + ptr%p%stn_id = Station_ID( ii ) + + do idx=1,max_rdiag_reals + ptr%p%rdiag( idx ) = 0.00 + end do + + if( allocated( Observation_Type )) ptr%p%rdiag( idx_obs_type_sst ) = Observation_Type( ii ) + if( allocated( Observation_Subtype )) ptr%p%rdiag( idx_obs_subtype_sst ) = Observation_Subtype( ii ) + if( allocated( Latitude )) ptr%p%rdiag( idx_obs_lat_sst ) = Latitude( ii ) + if( allocated( Longitude )) ptr%p%rdiag( idx_obs_lon_sst ) = Longitude( ii ) + if( allocated( Station_Elevation )) ptr%p%rdiag( idx_stn_elev_sst ) = Station_Elevation( ii ) + + if( allocated( Pressure )) ptr%p%rdiag( idx_opn_wtr_tmp_sst ) = Pressure( ii ) ! identified as background open water temperature in setupsst.f90 + + if( allocated( Height )) ptr%p%rdiag( idx_depth_sst ) = Height( ii ) ! identified as observation depth (meters) in setupsst.f90 + + if( allocated( Time )) ptr%p%rdiag( idx_time_sst ) = Time( ii ) + +! if( allocated( )) ptr%p%rdiag( idx_opn_wtr_pct_sst ) = Prep_QC_Mark( ii ) ! identified as open water percentage in setupsst.f90 + + if( allocated( Prep_QC_Mark )) ptr%p%rdiag( idx_setup_qc_sst ) = Prep_QC_Mark( ii ) + if( allocated( Prep_Use_Flag )) ptr%p%rdiag( idx_iuse_sst ) = Prep_Use_Flag( ii ) + if( allocated( Analysis_Use_Flag )) ptr%p%rdiag( idx_anl_use_sst ) = Analysis_Use_Flag( ii ) + if( allocated( Nonlinear_QC_Rel_Wgt )) ptr%p%rdiag( idx_rwgt_sst ) = Nonlinear_QC_Rel_Wgt( ii ) + if( allocated( Errinv_Input )) ptr%p%rdiag( idx_err_input_sst ) = Errinv_Input( ii ) + if( allocated( Errinv_Adjust )) ptr%p%rdiag( idx_errinv_sst ) = Errinv_Adjust( ii ) + if( allocated( Errinv_Final )) ptr%p%rdiag( idx_errinv_fnl_sst ) = Errinv_Final( ii ) + if( allocated( Observation )) ptr%p%rdiag( idx_obs_sst ) = Observation( ii ) + if( allocated( Obs_Minus_Forecast_adjusted )) ptr%p%rdiag( idx_omgbc_sst ) = Obs_Minus_Forecast_adjusted( ii ) + if( allocated( Obs_Minus_Forecast_unadjusted )) ptr%p%rdiag( idx_omgnbc_sst ) = Obs_Minus_Forecast_unadjusted( ii ) + +! if( allocated( )) ptr%p%rdiag( idx_type_sst ) = type of measurement? per setupsst.f90 + + if( allocated( FoundationTempBG )) ptr%p%rdiag( idx_tr_sst ) = FoundationTempBG( ii ) + if( allocated( DiurnalWarming_at_Zob )) ptr%p%rdiag( idx_dt_warm_sst ) = DiurnalWarming_at_zob( ii ) + if( allocated( SkinLayerCooling_at_zob )) ptr%p%rdiag( idx_dt_cool_sst ) = SkinLayerCooling_at_zob( ii ) + if( allocated( Sensitivity_Tzob_Tr )) ptr%p%rdiag( idx_dtz_dtr_sst ) = Sensitivity_Tzob_Tr( ii ) + + + if( nobs == 1 ) then + !------------------------------------------------- + ! Initialize the list with the first data element + ! + call list_init(list, transfer(ptr, list_data)) + next => list + + else + !------------------------------------------------- + ! Insert subsequent nodes into the list + ! + call list_insert(next, transfer(ptr, list_data)) + next => list_next(next) + end if + + end if + + end do + + + if( allocated( Station_ID )) deallocate( Station_ID ) + if( allocated( Observation_Class )) deallocate( Observation_Class ) + if( allocated( Observation_Type )) deallocate( Observation_Type ) + if( allocated( Observation_Subtype )) deallocate( Observation_Subtype ) + if( allocated( Latitude )) deallocate( Latitude ) + if( allocated( Longitude )) deallocate( Longitude ) + if( allocated( Station_Elevation )) deallocate( Station_Elevation ) + if( allocated( Time )) deallocate( Time ) + if( allocated( Prep_QC_Mark )) deallocate( Prep_QC_Mark ) + if( allocated( Prep_Use_Flag )) deallocate( Prep_Use_Flag ) + if( allocated( Nonlinear_QC_Var_Jb )) deallocate( Nonlinear_QC_Var_Jb ) + if( allocated( Nonlinear_QC_Rel_Wgt )) deallocate( Nonlinear_QC_Rel_Wgt ) + if( allocated( Analysis_Use_Flag )) deallocate( Analysis_Use_Flag ) + if( allocated( Errinv_Input )) deallocate( Errinv_Input ) + if( allocated( Errinv_Adjust )) deallocate( Errinv_Final ) + if( allocated( Errinv_Final )) deallocate( Errinv_Final ) + if( allocated( Observation )) deallocate( Observation ) + if( allocated( Obs_Minus_Forecast_adjusted )) deallocate( Obs_Minus_Forecast_adjusted ) + if( allocated( Obs_Minus_Forecast_unadjusted )) deallocate( Obs_Minus_Forecast_unadjusted ) + if( allocated( FoundationTempBG )) deallocate( FoundationTempBG ) + if( allocated( DiurnalWarming_at_zob )) deallocate( DiurnalWarming_at_zob ) + if( allocated( SkinLayerCooling_at_zob )) deallocate( SkinLayerCooling_at_zob ) + if( allocated( Sensitivity_Tzob_Tr )) deallocate( Sensitivity_Tzob_Tr ) + + print *, ' ' + print *, ' <-- read_diag_file_sst_nc' + + end subroutine read_diag_file_sst_nc + + + + !--------------------------------------------------------- + ! netcdf read routine for t data types in netcdf files + ! + subroutine read_diag_file_t_nc( input_file, return_all, ftin, ctype, intype, expected_nreal, nobs, in_subtype, list ) + + !--- interface + character(100), intent(in) :: input_file + logical, intent(in) :: return_all + integer, intent(in) :: ftin + character(3), intent(in) :: ctype + integer, intent(in) :: intype, expected_nreal, in_subtype + integer, intent(out) :: nobs + type(list_node_t), pointer :: list + + !--- local vars + type(list_node_t), pointer :: next => null() + type(data_ptr) :: ptr + integer :: ii, ierr, istatus, total_obs, idx, bcor_terms + logical :: have_subtype = .true. + logical :: add_obs + + !--- NetCDF file components dimension(s) + ! + character(len=:), dimension(:), allocatable :: Station_ID ! (nobs, Station_ID_maxstrlen) + character(len=:), dimension(:), allocatable :: Observation_Class ! (nobs, Station_Class_maxstrlen) + integer, dimension(:), allocatable :: Observation_Type ! (obs) + integer, dimension(:), allocatable :: Observation_Subtype ! (obs) + real(r_single), dimension(:), allocatable :: Latitude ! (obs) + real(r_single), dimension(:), allocatable :: Longitude ! (obs) + real(r_single), dimension(:), allocatable :: Station_Elevation ! (obs) + real(r_single), dimension(:), allocatable :: Pressure ! (obs) + real(r_single), dimension(:), allocatable :: Height ! (obs) + real(r_single), dimension(:), allocatable :: Time ! (obs) + real(r_single), dimension(:), allocatable :: Prep_QC_Mark ! (obs) + real(r_single), dimension(:), allocatable :: Prep_Use_Flag ! (obs) + real(r_single), dimension(:), allocatable :: Nonlinear_QC_Var_Jb ! (obs) + real(r_single), dimension(:), allocatable :: Nonlinear_QC_Rel_Wgt ! (obs) + real(r_single), dimension(:), allocatable :: Analysis_Use_Flag ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Input ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Adjust ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Final ! (obs) + real(r_single), dimension(:), allocatable :: Observation ! (obs) + real(r_single), dimension(:), allocatable :: Obs_Minus_Forecast_adjusted ! (obs) + real(r_single), dimension(:), allocatable :: Obs_Minus_Forecast_unadjusted ! (obs) + real(r_single), dimension(:), allocatable :: Data_Pof ! (obs) + real(r_single), dimension(:), allocatable :: Data_Vertical_Velocity ! (obs) + real(r_single), dimension(:,:), allocatable :: Bias_Correction_Terms ! (nobs, Bias_Correction_Terms_arr_dim) + integer(i_kind) :: idate + integer(i_kind) :: jj + + print *, ' ' + print *, ' --> read_diag_file_t_nc' + + print *, ' input_file = ', input_file + print *, ' ftin = ', ftin + print *, ' ctype = ', ctype + print *, ' intype = ', intype + print *, ' expected_nreal = ', expected_nreal + print *, ' in_subtype = ', in_subtype + + + !--- get NetCDF file dimensions + ! + if( nc_diag_read_check_dim( 'nobs' )) then + total_obs = nc_diag_read_get_dim(ftin,'nobs') + ncdiag_open_status(ii)%num_records = total_obs + else + print *, 'ERROR: unable to read nobs' + ierr=1 + end if + + if( nc_diag_read_check_dim( 'Bias_Correction_Terms_arr_dim' )) then + bcor_terms = nc_diag_read_get_dim(ftin,'Bias_Correction_Terms_arr_dim') + else + print *, 'ERROR: unable to read bcor_terms' + ierr=1 + end if + + + + !--- get vars + + call load_nc_var( 'Station_ID', ftin, Station_ID, ierr ) + call load_nc_var( 'Observation_Class', ftin, Observation_Class, ierr ) + call load_nc_var( 'Observation_Type', ftin, Observation_Type, ierr ) + call load_nc_var( 'Observation_Subtype', ftin, Observation_Subtype, ierr ) + if( ierr == 1 ) then + have_subtype = .false. + end if + + call load_nc_var( 'Latitude', ftin, Latitude, ierr ) + call load_nc_var( 'Longitude', ftin, Longitude, ierr ) + call load_nc_var( 'Station_Elevation', ftin, Station_Elevation, ierr ) + call load_nc_var( 'Pressure', ftin, Pressure, ierr ) + call load_nc_var( 'Height', ftin, Height, ierr ) + call load_nc_var( 'Time', ftin, Time, ierr ) + call load_nc_var( 'Prep_QC_Mark', ftin, Prep_QC_Mark, ierr ) + call load_nc_var( 'Nonlinear_QC_Var_Jb', ftin, Nonlinear_QC_Var_Jb, ierr ) + call load_nc_var( 'Nonlinear_QC_Rel_Wgt', ftin, Nonlinear_QC_Rel_Wgt, ierr ) + call load_nc_var( 'Prep_Use_Flag', ftin, Prep_Use_Flag, ierr ) + call load_nc_var( 'Analysis_Use_Flag', ftin, Analysis_Use_Flag, ierr ) + call load_nc_var( 'Errinv_Input', ftin, Errinv_Input, ierr ) + call load_nc_var( 'Errinv_Adjust', ftin, Errinv_Adjust, ierr ) + call load_nc_var( 'Errinv_Final', ftin, Errinv_Final, ierr ) + call load_nc_var( 'Observation', ftin, Observation, ierr ) + call load_nc_var( 'Obs_Minus_Forecast_adjusted', ftin, Obs_Minus_Forecast_adjusted, ierr ) + call load_nc_var( 'Obs_Minus_Forecast_unadjusted', ftin, Obs_Minus_Forecast_unadjusted, ierr ) + call load_nc_var( 'Data_Pof', ftin, Data_Pof, ierr ) + call load_nc_var( 'Data_Vertical_Velocity', ftin, Data_Vertical_Velocity, ierr ) + + if( nc_diag_read_check_var( 'Bias_Correction_Terms' )) then + call nc_diag_read_get_var( ftin, 'Bias_Correction_Terms', Bias_Correction_Terms ) + ierr = 0 + else + print *, 'ERROR: unable to read Bias_Correction_Terms' + ierr = 25 + end if + + + + !--------------------------------------------------------------- + ! Process all obs. If type and subtype match the input values + ! add this obs to the linked list (ptr%p). + ! + nobs = 0 + do ii = 1, total_obs + + !------------------------------------------------------------------------ + ! Check on Observation_Class to ctype is a sanity check -- + ! only a single class of obs are in any given NetCDF formatted diag file + ! but, if the ctype and input file don't match, things could get + ! interesting (but not in a good way). + ! + add_obs = .false. + + if( adjustl( trim( Observation_Class(ii) )) == adjustl( trim( ctype ))) then + + if( return_all == .true. ) then + add_obs = .true. + + else if( Observation_Type(ii) == intype ) then + + if( have_subtype == .false. ) then + add_obs = .true. + else if( Observation_Subtype(ii) == in_subtype ) then + add_obs = .true. + end if + + end if + end if + + if( add_obs == .true. ) then + + nobs=nobs+1 + + !--------------------------------------------- + ! Allocate a new data element and load + ! + allocate(ptr%p) + ptr%p%stn_id = Station_ID( ii ) + + do idx=1,max_rdiag_reals + ptr%p%rdiag( idx ) = 0.00 + end do + + if( allocated( Observation_Type )) ptr%p%rdiag( idx_obs_type_t ) = Observation_Type( ii ) + if( allocated( Observation_Subtype )) ptr%p%rdiag( idx_obs_subtype_t ) = Observation_Subtype( ii ) + if( allocated( Latitude )) ptr%p%rdiag( idx_obs_lat_t ) = Latitude( ii ) + if( allocated( Longitude )) ptr%p%rdiag( idx_obs_lon_t ) = Longitude( ii ) + if( allocated( Station_Elevation )) ptr%p%rdiag( idx_stn_elev_t ) = Station_Elevation( ii ) + if( allocated( Pressure )) ptr%p%rdiag( idx_pres_t ) = Pressure( ii ) + if( allocated( Height )) ptr%p%rdiag( idx_hgt_t ) = Height( ii ) + if( allocated( Time )) ptr%p%rdiag( idx_time_t ) = Time( ii ) + if( allocated( Prep_QC_Mark )) ptr%p%rdiag( idx_iqc_t ) = Prep_QC_Mark( ii ) + if( allocated( Nonlinear_QC_Var_Jb )) ptr%p%rdiag( idx_setup_qc_t ) = Nonlinear_QC_Var_Jb( ii ) + if( allocated( Prep_Use_Flag )) ptr%p%rdiag( idx_iuse_t ) = Prep_Use_Flag( ii ) + if( allocated( Analysis_Use_Flag )) ptr%p%rdiag( idx_anl_use_t ) = Analysis_Use_Flag( ii ) + if( allocated( Nonlinear_QC_Rel_Wgt )) ptr%p%rdiag( idx_rwgt_t ) = Nonlinear_QC_Rel_Wgt( ii ) + if( allocated( Errinv_Input )) ptr%p%rdiag( idx_err_input_t ) = Errinv_Input( ii ) + if( allocated( Errinv_Adjust )) ptr%p%rdiag( idx_errinv_t ) = Errinv_Adjust( ii ) + if( allocated( Errinv_Final )) ptr%p%rdiag( idx_errinv_fnl_t ) = Errinv_Final( ii ) + if( allocated( Observation )) ptr%p%rdiag( idx_obs_t ) = Observation( ii ) + if( allocated( Obs_Minus_Forecast_adjusted )) ptr%p%rdiag( idx_omgbc_t ) = Obs_Minus_Forecast_adjusted( ii ) + if( allocated( Obs_Minus_Forecast_unadjusted )) ptr%p%rdiag( idx_omgnbc_t ) = Obs_Minus_Forecast_unadjusted( ii ) + if( allocated( Data_Pof )) ptr%p%rdiag( idx_pof_t ) = Data_Pof( ii ) + if( allocated( Data_Vertical_Velocity )) ptr%p%rdiag( idx_vv_t ) = Data_Vertical_Velocity( ii ) + do jj = 1, bcor_terms + if( allocated( Bias_Correction_Terms )) ptr%p%rdiag( idx_vv_t+jj ) = Bias_Correction_Terms( jj,ii ) + end do + + if( nobs == 1 ) then + !------------------------------------------------- + ! Initialize the list with the first data element + ! + call list_init(list, transfer(ptr, list_data)) + next => list + + else + !------------------------------------------------- + ! Insert subsequent nodes into the list + ! + call list_insert(next, transfer(ptr, list_data)) + next => list_next(next) + + end if + + end if + + end do + + + if( allocated( Station_ID )) deallocate( Station_ID ) + if( allocated( Observation_Class )) deallocate( Observation_Class ) + if( allocated( Observation_Type )) deallocate( Observation_Type ) + if( allocated( Observation_Subtype )) deallocate( Observation_Subtype ) + if( allocated( Latitude )) deallocate( Latitude ) + if( allocated( Longitude )) deallocate( Longitude ) + if( allocated( Station_Elevation )) deallocate( Station_Elevation ) + if( allocated( Time )) deallocate( Time ) + if( allocated( Prep_QC_Mark )) deallocate( Prep_QC_Mark ) + if( allocated( Prep_Use_Flag )) deallocate( Prep_Use_Flag ) + if( allocated( Nonlinear_QC_Var_Jb )) deallocate( Nonlinear_QC_Var_Jb ) + if( allocated( Nonlinear_QC_Rel_Wgt )) deallocate( Nonlinear_QC_Rel_Wgt ) + if( allocated( Analysis_Use_Flag )) deallocate( Analysis_Use_Flag ) + if( allocated( Errinv_Input )) deallocate( Errinv_Input ) + if( allocated( Errinv_Adjust )) deallocate( Errinv_Final ) + if( allocated( Errinv_Final )) deallocate( Errinv_Final ) + if( allocated( Observation )) deallocate( Observation ) + if( allocated( Obs_Minus_Forecast_adjusted )) deallocate( Obs_Minus_Forecast_adjusted ) + if( allocated( Obs_Minus_Forecast_unadjusted )) deallocate( Obs_Minus_Forecast_unadjusted ) + + print *, ' ' + print *, ' <-- read_diag_file_t_nc' + + end subroutine read_diag_file_t_nc + + + + !--------------------------------------------------------- + ! netcdf read routine for uv data types in netcdf files + ! + subroutine read_diag_file_uv_nc( input_file, return_all, ftin, ctype, intype, expected_nreal, nobs, in_subtype, list ) + + !--- interface + character(100), intent(in) :: input_file + logical, intent(in) :: return_all + integer, intent(in) :: ftin + character(3), intent(in) :: ctype + integer, intent(in) :: intype, expected_nreal, in_subtype + integer, intent(out) :: nobs + type(list_node_t), pointer :: list + + !--- local vars + type(list_node_t), pointer :: next => null() + type(data_ptr) :: ptr + integer :: ii, ierr, istatus, total_obs, idx + logical :: have_subtype = .true. + logical :: add_obs + + !--- NetCDF file components dimension(s) + ! + character(len=:), dimension(:), allocatable :: Station_ID ! (nobs, Station_ID_maxstrlen) + character(len=:), dimension(:), allocatable :: Observation_Class ! (nobs, Station_Class_maxstrlen) + integer, dimension(:), allocatable :: Observation_Type ! (obs) + integer, dimension(:), allocatable :: Observation_Subtype ! (obs) + real(r_single), dimension(:), allocatable :: Latitude ! (obs) + real(r_single), dimension(:), allocatable :: Longitude ! (obs) + real(r_single), dimension(:), allocatable :: Station_Elevation ! (obs) + real(r_single), dimension(:), allocatable :: Pressure ! (obs) + real(r_single), dimension(:), allocatable :: Height ! (obs) + real(r_single), dimension(:), allocatable :: Time ! (obs) + real(r_single), dimension(:), allocatable :: Prep_QC_Mark ! (obs) + real(r_single), dimension(:), allocatable :: Setup_QC_Mark ! (obs) + real(r_single), dimension(:), allocatable :: Prep_Use_Flag ! (obs) + real(r_single), dimension(:), allocatable :: Nonlinear_QC_Rel_Wgt ! (obs) + real(r_single), dimension(:), allocatable :: Nonlinear_QC_Var_Jb ! (obs) + real(r_single), dimension(:), allocatable :: Analysis_Use_Flag ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Input ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Adjust ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Final ! (obs) + real(r_single), dimension(:), allocatable :: Wind_Reduction_Factor_at_10m ! (obs) + real(r_single), dimension(:), allocatable :: u_Observation ! (obs) + real(r_single), dimension(:), allocatable :: u_Obs_Minus_Forecast_adjusted ! (obs) + real(r_single), dimension(:), allocatable :: u_Obs_Minus_Forecast_unadjusted ! (obs) + real(r_single), dimension(:), allocatable :: v_Observation ! (obs) + real(r_single), dimension(:), allocatable :: v_Obs_Minus_Forecast_adjusted ! (obs) + real(r_single), dimension(:), allocatable :: v_Obs_Minus_Forecast_unadjusted ! (obs) + integer(i_kind) :: idate + + print *, ' ' + print *, ' --> read_diag_file_uv_nc' + + + !--- get NetCDF file dimensions + ! + if( nc_diag_read_check_dim( 'nobs' )) then + total_obs = nc_diag_read_get_dim(ftin,'nobs') + ncdiag_open_status(ii)%num_records = total_obs + print *, ' total_obs = ', total_obs + else + print *, 'ERROR: unable to read nobs' + ierr=1 + end if + + + !--- get vars + + call load_nc_var( 'Station_ID', ftin, Station_ID, ierr ) + call load_nc_var( 'Observation_Class', ftin, Observation_Class, ierr ) + call load_nc_var( 'Observation_Type', ftin, Observation_Type, ierr ) + call load_nc_var( 'Observation_Subtype', ftin, Observation_Subtype, ierr ) + if( ierr == 1 ) then + have_subtype = .false. + end if + call load_nc_var( 'Latitude', ftin, Latitude, ierr ) + call load_nc_var( 'Longitude', ftin, Longitude, ierr ) + call load_nc_var( 'Station_Elevation', ftin, Station_Elevation, ierr ) + call load_nc_var( 'Pressure', ftin, Pressure, ierr ) + call load_nc_var( 'Height', ftin, Height, ierr ) + call load_nc_var( 'Time', ftin, Time, ierr ) + call load_nc_var( 'Prep_QC_Mark', ftin, Prep_QC_Mark, ierr ) + call load_nc_var( 'Setup_QC_Mark', ftin, Setup_QC_Mark, ierr ) + call load_nc_var( 'Nonlinear_QC_Rel_Wgt', ftin, Nonlinear_QC_Rel_Wgt, ierr ) + call load_nc_var( 'Prep_Use_Flag', ftin, Prep_Use_Flag, ierr ) + call load_nc_var( 'Nonlinear_QC_Var_Jb', ftin, Nonlinear_QC_Var_Jb, ierr ) + call load_nc_var( 'Analysis_Use_Flag', ftin, Analysis_Use_Flag, ierr ) + call load_nc_var( 'Errinv_Input', ftin, Errinv_Input, ierr ) + call load_nc_var( 'Errinv_Adjust', ftin, Errinv_Adjust, ierr ) + call load_nc_var( 'Errinv_Final', ftin, Errinv_Final, ierr ) + call load_nc_var( 'Wind_Reduction_Factor_at_10m', ftin, Wind_Reduction_Factor_at_10m, ierr ) + call load_nc_var( 'u_Observation', ftin, u_Observation, ierr ) + call load_nc_var( 'u_Obs_Minus_Forecast_adjusted', ftin, u_Obs_Minus_Forecast_adjusted, ierr ) + call load_nc_var( 'u_Obs_Minus_Forecast_unadjusted', ftin, u_Obs_Minus_Forecast_unadjusted, ierr ) + call load_nc_var( 'v_Observation', ftin, v_Observation, ierr ) + call load_nc_var( 'v_Obs_Minus_Forecast_adjusted', ftin, v_Obs_Minus_Forecast_adjusted, ierr ) + call load_nc_var( 'v_Obs_Minus_Forecast_unadjusted', ftin, v_Obs_Minus_Forecast_unadjusted, ierr ) + + + !--------------------------------------------------------------- + ! Process all obs. If type and subtype match the input values + ! add this obs to the linked list (ptr%p). + ! + nobs = 0 + do ii = 1, total_obs + + + !------------------------------------------------------------------------ + ! Check on Observation_Class to ctype is a sanity check -- + ! only a single class of obs are in any given NetCDF formatted diag file + ! but, if the ctype and input file don't match, things could get + ! interesting (but not in a good way). + ! + add_obs = .false. + + if( adjustl( trim( Observation_Class(ii) )) == adjustl( trim( ctype ))) then + + if( return_all == .true. ) then + add_obs = .true. + + else if( Observation_Type(ii) == intype ) then + + if( have_subtype == .false. ) then + add_obs = .true. + else if( Observation_Subtype(ii) == in_subtype ) then + add_obs = .true. + end if + + end if + end if + + if( add_obs == .true. ) then + + nobs=nobs+1 + + !--------------------------------------------- + ! Allocate a new data element and load + ! + allocate(ptr%p) + ptr%p%stn_id = Station_ID( ii ) + + do idx=1,max_rdiag_reals + ptr%p%rdiag( idx ) = 0.00 + end do + + if( allocated( Observation_Type )) ptr%p%rdiag( idx_obs_type_uv ) = Observation_Type( ii ) + if( allocated( Observation_Subtype )) ptr%p%rdiag( idx_obs_subtype_uv ) = Observation_Subtype( ii ) + if( allocated( Latitude )) ptr%p%rdiag( idx_obs_lat_uv ) = Latitude( ii ) + if( allocated( Longitude )) ptr%p%rdiag( idx_obs_lon_uv ) = Longitude( ii ) + if( allocated( Station_Elevation )) ptr%p%rdiag( idx_stn_elev_uv ) = Station_Elevation( ii ) + if( allocated( Pressure )) ptr%p%rdiag( idx_pres_uv ) = Pressure( ii ) + if( allocated( Height )) ptr%p%rdiag( idx_hgt_uv ) = Height( ii ) + if( allocated( Time )) ptr%p%rdiag( idx_time_uv ) = Time( ii ) + if( allocated( Prep_QC_Mark )) ptr%p%rdiag( idx_iqc_uv ) = Prep_QC_Mark( ii ) + +! if( allocated( Nonlinear_QC_Var_JB )) ptr%p%rdiag( idx_setup_qc_uv ) = Nonlinear_QC_Var_Jb( ii ) ! missing from diagnostic file + + if( allocated( Prep_Use_Flag )) ptr%p%rdiag( idx_iuse_uv ) = Prep_Use_Flag( ii ) + if( allocated( Analysis_Use_Flag )) ptr%p%rdiag( idx_anl_use_uv ) = Analysis_Use_Flag( ii ) + if( allocated( Nonlinear_QC_Rel_Wgt )) ptr%p%rdiag( idx_rwgt_uv ) = Nonlinear_QC_Rel_Wgt( ii ) + if( allocated( Errinv_Input )) ptr%p%rdiag( idx_err_input_uv ) = Errinv_Input( ii ) + if( allocated( Errinv_Adjust )) ptr%p%rdiag( idx_errinv_uv ) = Errinv_Adjust( ii ) + if( allocated( Errinv_Final )) ptr%p%rdiag( idx_errinv_fnl_uv ) = Errinv_Final( ii ) + + if( allocated( u_Observation )) ptr%p%rdiag( idx_u_obs_uv ) = u_Observation( ii ) + if( allocated( u_Obs_Minus_Forecast_adjusted )) ptr%p%rdiag( idx_u_omgbc_uv ) = u_Obs_Minus_Forecast_adjusted( ii ) + if( allocated( u_Obs_Minus_Forecast_unadjusted )) ptr%p%rdiag( idx_u_omgnbc_uv ) = u_Obs_Minus_Forecast_unadjusted( ii ) + if( allocated( v_Observation )) ptr%p%rdiag( idx_v_obs_uv ) = v_Observation( ii ) + if( allocated( v_Obs_Minus_Forecast_adjusted )) ptr%p%rdiag( idx_v_omgbc_uv ) = v_Obs_Minus_Forecast_adjusted( ii ) + if( allocated( v_Obs_Minus_Forecast_unadjusted )) ptr%p%rdiag( idx_v_omgnbc_uv ) = v_Obs_Minus_Forecast_unadjusted( ii ) + + + if( nobs == 1 ) then + !------------------------------------------------- + ! Initialize the list with the first data element + ! + call list_init(list, transfer(ptr, list_data)) + next => list + + else + !------------------------------------------------- + ! Insert subsequent nodes into the list + ! + call list_insert(next, transfer(ptr, list_data)) + next => list_next(next) + end if + + end if + + end do + + + if( allocated( Station_ID )) deallocate( Station_ID ) + if( allocated( Observation_Class )) deallocate( Observation_Class ) + if( allocated( Observation_Type )) deallocate( Observation_Type ) + if( allocated( Observation_Subtype )) deallocate( Observation_Subtype ) + if( allocated( Latitude )) deallocate( Latitude ) + if( allocated( Longitude )) deallocate( Longitude ) + if( allocated( Station_Elevation )) deallocate( Station_Elevation ) + if( allocated( Time )) deallocate( Time ) + if( allocated( Prep_QC_Mark )) deallocate( Prep_QC_Mark ) + if( allocated( Prep_Use_Flag )) deallocate( Prep_Use_Flag ) + if( allocated( Nonlinear_QC_Var_Jb )) deallocate( Nonlinear_QC_Var_Jb ) + if( allocated( Nonlinear_QC_Rel_Wgt )) deallocate( Nonlinear_QC_Rel_Wgt ) + if( allocated( Analysis_Use_Flag )) deallocate( Analysis_Use_Flag ) + if( allocated( Errinv_Input )) deallocate( Errinv_Input ) + if( allocated( Errinv_Adjust )) deallocate( Errinv_Final ) + if( allocated( Errinv_Final )) deallocate( Errinv_Final ) + if( allocated( Wind_Reduction_Factor_at_10m )) deallocate( Wind_Reduction_Factor_at_10m ) + if( allocated( u_Observation )) deallocate( u_Observation ) + if( allocated( u_Obs_Minus_Forecast_adjusted )) deallocate( u_Obs_Minus_Forecast_adjusted ) + if( allocated( u_Obs_Minus_Forecast_unadjusted )) deallocate( u_Obs_Minus_Forecast_unadjusted ) + if( allocated( v_Observation )) deallocate( v_Observation ) + if( allocated( v_Obs_Minus_Forecast_adjusted )) deallocate( v_Obs_Minus_Forecast_adjusted ) + if( allocated( v_Obs_Minus_Forecast_unadjusted )) deallocate( v_Obs_Minus_Forecast_unadjusted ) + + print *, ' ' + print *, ' <-- read_diag_file_uv_nc' + + end subroutine read_diag_file_uv_nc + + + !----------------------------------------------------------- + ! netcdf read routine for gps data types in netcdf files + ! + ! NOTE1: This routine is untested. At present the ConMon + ! does not process gps data. There are plans to + ! change that though. + ! + ! NOTE2: There are known descrepencies between gps obs + ! in binary and NetCDF formatted diag files. See + ! comments below. + ! + subroutine read_diag_file_gps_nc( input_file, return_all, ftin, ctype, intype,expected_nreal,nobs,in_subtype, list ) + + !--- interface + character(100), intent(in) :: input_file + logical, intent(in) :: return_all + integer, intent(in) :: ftin + character(3), intent(in) :: ctype + integer, intent(in) :: intype, expected_nreal, in_subtype + integer, intent(out) :: nobs + type(list_node_t), pointer :: list + + !--- local vars + type(list_node_t), pointer :: next => null() + type(data_ptr) :: ptr + integer :: ii, ierr, istatus, total_obs, idx + logical :: have_subtype = .true. + logical :: add_obs + + !--- NetCDF file components dimension(s) + ! + character(len=:), dimension(:), allocatable :: Station_ID ! (nobs, Station_ID_maxstrlen) + character(len=:), dimension(:), allocatable :: Observation_Class ! (nobs, Station_Class_maxstrlen) + integer, dimension(:), allocatable :: Observation_Type ! (obs) + integer, dimension(:), allocatable :: Observation_Subtype ! (obs) + real(r_single), dimension(:), allocatable :: Latitude ! (obs) + real(r_single), dimension(:), allocatable :: Longitude ! (obs) + real(r_single), dimension(:), allocatable :: Incremental_Bending_Angle ! (obs) + real(r_single), dimension(:), allocatable :: Station_Elevation ! (obs) + real(r_single), dimension(:), allocatable :: Pressure ! (obs) + real(r_single), dimension(:), allocatable :: Height ! (obs) + real(r_single), dimension(:), allocatable :: Time ! (obs) + real(r_single), dimension(:), allocatable :: Model_Elevation ! (obs) + real(r_single), dimension(:), allocatable :: Setup_QC_Mark ! (obs) + real(r_single), dimension(:), allocatable :: Prep_Use_Flag ! (obs) + real(r_single), dimension(:), allocatable :: Nonlinear_QC_Var_Jb ! (obs) + real(r_single), dimension(:), allocatable :: Nonlinear_QC_Rel_Wgt ! (obs) + real(r_single), dimension(:), allocatable :: Analysis_Use_Flag ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Input ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Adjust ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Final ! (obs) + real(r_single), dimension(:), allocatable :: Observation ! (obs) + real(r_single), dimension(:), allocatable :: Obs_Minus_Forecast_adjusted ! (obs) + real(r_single), dimension(:), allocatable :: Obs_Minus_Forecast_unadjusted ! (obs) + real(r_single), dimension(:), allocatable :: GPS_Type ! (obs) + real(r_single), dimension(:), allocatable :: Temperature_at_Obs_Location ! (obs) + real(r_single), dimension(:), allocatable :: Specific_Humidity_at_Obs_Location ! (obs) + + integer(i_kind) :: idate + + + + print *, ' ' + print *, ' --> read_diag_file_gps_nc' + + + !--- get NetCDF file dimensions + ! + if( nc_diag_read_check_dim( 'nobs' )) then + total_obs = nc_diag_read_get_dim(ftin,'nobs') + ncdiag_open_status(ii)%num_records = total_obs + print *, ' total_obs = ', total_obs + else + print *, 'ERROR: unable to read nobs' + ierr=1 + end if + + + !--- get vars + + call load_nc_var( 'Station_ID', ftin, Station_ID, ierr ) + call load_nc_var( 'Observation_Class', ftin, Observation_Class, ierr ) + call load_nc_var( 'Observation_Type', ftin, Observation_Type, ierr ) + call load_nc_var( 'Observation_Subtype', ftin, Observation_Subtype, ierr ) + if( ierr == 1 ) then + have_subtype = .false. + end if + call load_nc_var( 'Latitude', ftin, Latitude, ierr ) + call load_nc_var( 'Longitude', ftin, Longitude, ierr ) + call load_nc_var( 'Incremental_Bending_Angle', ftin, Incremental_Bending_Angle, ierr ) + call load_nc_var( 'Pressure', ftin, Pressure, ierr ) + call load_nc_var( 'Height', ftin, Height, ierr ) + call load_nc_var( 'Time', ftin, Time, ierr ) + call load_nc_var( 'Model_Elevation', ftin, Model_Elevation, ierr ) + call load_nc_var( 'Setup_QC_Mark', ftin, Setup_QC_Mark, ierr ) + call load_nc_var( 'Prep_Use_Flag', ftin, Prep_Use_Flag, ierr ) + call load_nc_var( 'Analysis_Use_Flag', ftin, Analysis_Use_Flag, ierr ) + call load_nc_var( 'Nonlinear_QC_Rel_Wgt', ftin, Nonlinear_QC_Rel_Wgt, ierr ) + call load_nc_var( 'Errinv_Input', ftin, Errinv_Input, ierr ) + call load_nc_var( 'Errinv_Adjust', ftin, Errinv_Adjust, ierr ) + call load_nc_var( 'Errinv_Final', ftin, Errinv_Final, ierr ) + call load_nc_var( 'Observation', ftin, Observation, ierr ) + call load_nc_var( 'Obs_Minus_Forecast_adjusted', ftin, Obs_Minus_Forecast_adjusted, ierr ) + call load_nc_var( 'Obs_Minus_Forecast_unadjusted', ftin, Obs_Minus_Forecast_unadjusted, ierr ) + call load_nc_var( 'GPS_Type', ftin, GPS_Type, ierr ) + call load_nc_var( 'Temperature_at_Obs_Location', ftin, Temperature_at_Obs_Location, ierr ) + call load_nc_var( 'Specific_Humidity_at_Obs_Location', ftin, Specific_Humidity_at_Obs_Location, ierr ) + +! call load_nc_var( 'Nonlinear_QC_Var_Jb', ftin, Nonlinear_QC_Var_Jb, 13, ierr ) + + + + !--------------------------------------------------------------- + ! Process all obs. If type and subtype match the input values + ! add this obs to the linked list (ptr%p). + ! + nobs = 0 + do ii = 1, total_obs + + !------------------------------------------------------------------------ + ! Check on Observation_Class to ctype is a sanity check -- + ! only a single class of obs are in any given NetCDF formatted diag + ! file + ! but, if the ctype and input file don't match, things could get + ! interesting (but not in a good way). + ! + add_obs = .false. + + if( adjustl( trim( Observation_Class(ii) )) == adjustl( trim( ctype ))) then + + if( return_all == .true. ) then + add_obs = .true. + + else if( Observation_Type(ii) == intype ) then + + if( have_subtype == .false. ) then + add_obs = .true. + else if( Observation_Subtype(ii) == in_subtype ) then + add_obs = .true. + end if + + end if + end if + + if( add_obs == .true. ) then + + nobs=nobs+1 + + !--------------------------------------------- + ! Allocate a new data element and load + ! + allocate(ptr%p) + ptr%p%stn_id = Station_ID( ii ) + + do idx=1,max_rdiag_reals + ptr%p%rdiag( idx ) = 0.00 + end do + + if( allocated ( Observation_Type )) ptr%p%rdiag( idx_obs_type_gps ) = Observation_Type( ii ) + if( allocated ( Observation_Subtype )) ptr%p%rdiag( idx_obs_subtype_gps ) = Observation_Subtype( ii ) + if( allocated ( Latitude )) ptr%p%rdiag( idx_obs_lat_gps ) = Latitude( ii ) + if( allocated ( Longitude )) ptr%p%rdiag( idx_obs_lon_gps ) = Longitude( ii ) + if( allocated ( Incremental_Bending_Angle )) ptr%p%rdiag( idx_bend_ang_gps ) = Incremental_Bending_Angle( ii ) + if( allocated ( Pressure )) ptr%p%rdiag( idx_pres_gps ) = Pressure( ii ) + if( allocated ( Height )) ptr%p%rdiag( idx_height_gps ) = Height( ii ) + if( allocated ( Time )) ptr%p%rdiag( idx_time_gps ) = Time( ii ) + if( allocated ( Model_Elevation )) ptr%p%rdiag( idx_zsges_gps ) = Model_Elevation( ii ) + if( allocated ( Setup_QC_Mark )) ptr%p%rdiag( idx_setup_qc_gps ) = Setup_QC_Mark( ii ) + if( allocated ( Prep_Use_Flag )) ptr%p%rdiag( idx_iuse_gps ) = Prep_Use_Flag( ii ) + if( allocated ( Analysis_Use_Flag )) ptr%p%rdiag( idx_anl_use_gps ) = Analysis_Use_Flag( ii ) + if( allocated ( Nonlinear_QC_Rel_Wgt )) ptr%p%rdiag( idx_rwgt_gps ) = Nonlinear_QC_Rel_Wgt( ii ) + if( allocated ( Errinv_input )) ptr%p%rdiag( idx_err_input_gps ) = Errinv_Input( ii ) + if( allocated ( Errinv_Adjust )) ptr%p%rdiag( idx_errinv_gps ) = Errinv_Adjust( ii ) + if( allocated ( Errinv_Final )) ptr%p%rdiag( idx_errinv_fnl_gps ) = Errinv_Final( ii ) + + if( allocated ( Observation )) ptr%p%rdiag( idx_obs_gps ) = Observation( ii ) + if( allocated ( Temperature_at_Obs_Location )) ptr%p%rdiag( idx_tref_gps ) = Temperature_at_Obs_Location( ii ) +! if( allocated ( Obs_Minus_Forecast_unadjusted )) ptr%p%rdiag( idx_hob_gps ) = Obs_Minus_Forecast_unadjusted( ii ) + if( allocated ( GPS_Type )) ptr%p%rdiag( idx_uses_gps ) = GPS_Type( ii ) + if( allocated ( Specific_Humidity_at_Obs_Location )) ptr%p%rdiag( idx_qref_gps ) = Specific_Humidity_at_Obs_Location( ii ) + + + ! This oddity is from genstats_gps.f90 which produces the NetCDF + ! formatted diag file: + ! + ! call nc_diag_metadata("Obs_Minus_Forecast_adjusted", sngl(gps_allptr%rdiag(17))*sngl(gps_allptr%rdiag(5)) ) + ! call nc_diag_metadata("Obs_Minus_Forecast_unadjusted", sngl(gps_allptr%rdiag(17))*sngl(gps_allptr%rdiag(5)) ) + ! call nc_diag_metadata("GPS_Type", sngl(gps_allptr%rdiag(20)) ) + ! call nc_diag_metadata("Temperature_at_Obs_Location", sngl(gps_allptr%rdiag(18)) ) + ! + ! It would seem from this that rdiagbuf(19) is not used? + ! And also Obs_Minus_Forecast_[un|'']adjusted is derived and not stored. + ! + ! This from setupbend.f90: + ! rdiagbuf(18,i) = trefges ! temperature at obs location (Kelvin) if monotone grid + ! rdiagbuf(19,i) = hob ! model vertical grid (interface) if monotone grid + ! rdiagbuf(20,i) = one ! uses gps_ref (one = use of bending angle) + ! + + + if( nobs == 1 ) then + !------------------------------------------------- + ! Initialize the list with the first data element + ! + call list_init(list, transfer(ptr, list_data)) + next => list + + else + !------------------------------------------------- + ! Insert subsequent nodes into the list + ! + call list_insert(next, transfer(ptr, list_data)) + next => list_next(next) + + end if + + end if + + end do + + + if( allocated( Station_ID )) deallocate( Station_ID ) + if( allocated( Observation_Class )) deallocate( Observation_Class ) + if( allocated( Observation_Type )) deallocate( Observation_Type ) + if( allocated( Observation_Subtype )) deallocate( Observation_Subtype ) + if( allocated( Latitude )) deallocate( Latitude ) + if( allocated( Longitude )) deallocate( Longitude ) + if( allocated( Incremental_Bending_Angle )) deallocate( Incremental_Bending_Angle ) + if( allocated( Pressure )) deallocate( Pressure ) + if( allocated( Height )) deallocate( Height ) + if( allocated( Time )) deallocate( Time ) + if( allocated( Model_Elevation )) deallocate( Model_Elevation ) + if( allocated( Setup_QC_Mark )) deallocate( Setup_QC_Mark ) + if( allocated( Prep_Use_Flag )) deallocate( Prep_Use_Flag ) + if( allocated( Analysis_Use_Flag )) deallocate( Analysis_Use_Flag ) + if( allocated( Nonlinear_QC_Rel_Wgt )) deallocate( Nonlinear_QC_Rel_Wgt ) + if( allocated( Errinv_Input )) deallocate( Errinv_Input ) + if( allocated( Errinv_Adjust )) deallocate( Errinv_Final ) + if( allocated( Errinv_Final )) deallocate( Errinv_Final ) + if( allocated( Observation )) deallocate( Observation ) + if( allocated( Obs_Minus_Forecast_adjusted )) deallocate( Obs_Minus_Forecast_adjusted ) + if( allocated( Obs_Minus_Forecast_unadjusted )) deallocate( Obs_Minus_Forecast_unadjusted ) + if( allocated( GPS_Type )) deallocate( GPS_Type ) + if( allocated( Temperature_at_Obs_Location )) deallocate( Temperature_at_Obs_Location ) + if( allocated( Specific_Humidity_at_Obs_Location )) deallocate( Specific_Humidity_at_Obs_Location ) + + print *, ' ' + print *, ' <-- read_diag_file_gps_nc' + + end subroutine read_diag_file_gps_nc + + + + + !--- binary read routine + ! + subroutine read_diag_file_bin( input_file, return_all, ctype, intype,expected_nreal,nobs,in_subtype, list ) + + !--- interface + character(100), intent(in) :: input_file + logical, intent(in) :: return_all + character(3), intent(in) :: ctype + integer, intent(in) :: intype, expected_nreal, in_subtype + integer, intent(out) :: nobs + type(list_node_t), pointer :: list + + + !--- local vars + type(list_node_t), pointer :: next => null() + type(data_ptr) :: ptr + + real(4),allocatable,dimension(:,:) :: rdiag + character(8),allocatable,dimension(:) :: cdiag + + character(3) :: dtype + character(10) :: otype + character(15) :: fileo,fileo_subtyp + + integer nchar,file_nreal,i,ii,mype,idate,iflag,file_itype,iscater,igrads + integer lunin,lunot,ldtype,file_subtype + integer idx,ioff02 + + data lunin / 11 / + + nobs=0 + print *, ' --> read_diag_file_bin' + print *, ' ctype = ', ctype + print *, ' intype, in_subtype = ', intype, in_subtype + print *, ' expected_nreal = ', expected_nreal + + + !--- open diag file + open(lunin, file=input_file, form='unformatted') + rewind(lunin) + + read(lunin) idate + print *, 'idate=',idate + + loopd: do + + !--- read obs header + read(lunin,IOSTAT=iflag) dtype,nchar,file_nreal,ii,mype,ioff02 + + if( iflag /= 0 ) exit loopd + + !----------------------------------------------------- + ! exit loop if the number of reals (nreal) from file + ! doesn't match the target number + ! + if(( return_all == .true. ) .OR. ( trim(dtype) == trim(ctype) .and. file_nreal /= expected_nreal )) then + print *, 'matched observation type:',dtype,' file_nreal=', file_nreal + exit + endif + + !--------------------------------------------- + ! skip to next iteration if types don't match + ! + if(( return_all == .false. ) .AND. ( trim( dtype ) /= trim( ctype ))) then + cycle + endif + + + !--- read diag info + allocate(cdiag(ii),rdiag(file_nreal,ii)) + read(lunin,IOSTAT=iflag) cdiag,rdiag + + !--- exit loop on read error + if( iflag /= 0 ) then + deallocate( cdiag,rdiag ) + exit loopd + end if + + do i=1,ii + file_itype = int(rdiag(1,i)) + file_subtype = int(rdiag(2,i)) + + !------------------------------------------------ + ! if both types and subtypes match + ! then add a new data element + ! + if(( return_all == .true. ) .OR. ( file_itype == intype .AND. file_subtype == in_subtype )) then + + nobs=nobs+1 + + !--------------------------------------------- + ! Allocate a new data element and load + ! + allocate(ptr%p) + ptr%p%stn_id = cdiag(i) + + do idx=1,max_rdiag_reals + if( idx > file_nreal ) then + ptr%p%rdiag( idx ) = 0.00 + else + ptr%p%rdiag( idx ) = rdiag( idx,i ) + end if + end do + + if( nobs == 1 ) then + !------------------------------------------------- + ! Initialize the list with the first data element + ! + call list_init(list, transfer(ptr, list_data)) + next => list + + else + !------------------------------------------------- + ! Insert subsequent nodes into the list + ! + call list_insert(next, transfer(ptr, list_data)) + next => list_next(next) + + end if + + endif + + enddo + + deallocate(cdiag,rdiag) + enddo loopd ! ending read data do loop + + close(lunin) + + print *, 'nobs added to list = ', nobs + print *, ' <-- read_diag_file_bin' + + return + end subroutine read_diag_file_bin + + + + !------------------------------------------------ + ! function find_ncdiag_id + !------------------------------------------------ + integer( i_kind ) function find_ncdiag_id( ftin ) + + integer(i_kind), intent(in) :: ftin + + integer(i_kind) :: i + + find_ncdiag_id = -1 + do i = 1, MAX_OPEN_NCDIAG + if ( ncdiag_open_id(i) == ftin ) then + find_ncdiag_id = i + return + endif + enddo + + return + end function find_ncdiag_id + + +end module conmon_read_diag diff --git a/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_sfctime.fd/data_mod.f90 b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_sfctime.fd/data_mod.f90 new file mode 100644 index 0000000000..e611a9782e --- /dev/null +++ b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_sfctime.fd/data_mod.f90 @@ -0,0 +1,220 @@ +module data + implicit none + + private + public :: data_t + public :: data_ptr + + integer, parameter,public :: max_rdiag_reals = 25 + + !-------------------------------------------------- + ! generic index numbers into the rdiagbuf array + ! for _all_ data types + ! + integer, parameter, public :: idx_obs_type = 1 ! obs type + integer, parameter, public :: idx_obs_subtype = 2 ! obs subtype + integer, parameter, public :: idx_obs_lat = 3 ! obs latitude + integer, parameter, public :: idx_obs_lon = 4 ! obs longitude + integer, parameter, public :: idx_stn_elev = 5 ! stn elevation + integer, parameter, public :: idx_pres = 6 ! obs pressure + integer, parameter, public :: idx_time = 8 ! obs time (hrs relative to analysis time) + integer, parameter, public :: idx_rwgt = 13 ! non-linear qc relative weight + + + + !-------------------------------------------------- + ! index numbers into the rdiagbuf array + ! for type ps obs + ! + ! (see setupps.f90 for more info) + ! + integer, parameter, public :: idx_obs_type_ps = 1 ! obs type + integer, parameter, public :: idx_obs_subtype_ps = 2 ! obs subtype + integer, parameter, public :: idx_obs_lat_ps = 3 ! obs latitude + integer, parameter, public :: idx_obs_lon_ps = 4 ! obs longitude + integer, parameter, public :: idx_stn_elev_ps = 5 ! stn elevation + integer, parameter, public :: idx_pres_ps = 6 ! obs pressure (hPa) + integer, parameter, public :: idx_hgt_ps = 7 ! obs height (meters) + integer, parameter, public :: idx_time_ps = 8 ! obs time (hrs relative to analysis time) + integer, parameter, public :: idx_iqc_ps = 9 ! prepbufr qc or event mark + integer, parameter, public :: idx_var_jb_ps = 10 ! non-linear qc param + integer, parameter, public :: idx_iuse_ps = 11 ! read_prepbufr data usage flag + integer, parameter, public :: idx_anl_use_ps = 12 ! analysis usage flag + integer, parameter, public :: idx_rwgt_ps = 13 ! non-linear qc relative weight + integer, parameter, public :: idx_err_input_ps = 14 ! prepbufr invers obs error (hPa**-1) + integer, parameter, public :: idx_errinv_ps = 15 ! read_prepbufr invers obs error (hPa**-1) + integer, parameter, public :: idx_errinv_fnl_ps = 16 ! final invers obs error (HPa**-1) + integer, parameter, public :: idx_obs_ps = 17 ! surface pressure observation + integer, parameter, public :: idx_obsmg_adj_ps = 18 ! obs-ges used in analysis (coverted to hPa) + integer, parameter, public :: idx_obsmg_nadj_ps = 19 ! obs-ges w/o adjustment to guess surface pressure (hPa) + integer, parameter, public :: idx_spread_ps = 20 ! spread (filled in by EnKF) + + + !-------------------------------------------------- + ! index numbers into the rdiagbuf array + ! for type q obs + ! + ! (see setupq.f90 for more info) + ! + integer, parameter, public :: idx_obs_type_q = 1 ! obs type + integer, parameter, public :: idx_obs_subtype_q = 2 ! obs subtype + integer, parameter, public :: idx_obs_lat_q = 3 ! obs latitude + integer, parameter, public :: idx_obs_lon_q = 4 ! obs longitude + integer, parameter, public :: idx_stn_elev_q = 5 ! stn elevation + integer, parameter, public :: idx_pres_q = 6 ! obs pressure (hPa) + integer, parameter, public :: idx_hgt_q = 7 ! obs height (meters) + integer, parameter, public :: idx_time_q = 8 ! obs time (hrs relative to analysis time) + integer, parameter, public :: idx_iqc_q = 9 ! prepbufr qc or event mark + integer, parameter, public :: idx_var_jb_q = 10 ! non-linear qc param + integer, parameter, public :: idx_iuse_q = 11 ! read_prepbufr data usage flag + integer, parameter, public :: idx_anl_use_q = 12 ! analysis usage flag + integer, parameter, public :: idx_rwgt_q = 13 ! non-linear qc relative weight + integer, parameter, public :: idx_err_input_q = 14 ! prepbufr invers obs error + integer, parameter, public :: idx_errinv_q = 15 ! read_prepbufr invers obs error + integer, parameter, public :: idx_errinv_fnl_q = 16 ! final invers obs error + integer, parameter, public :: idx_obs_q = 17 ! surface pressure observation + integer, parameter, public :: idx_obsmg_adj_q = 18 ! obs-ges used in analysis + integer, parameter, public :: idx_obsmg_nadj_q = 19 ! obs-ges w/o adjustment to guess surface pressure + integer, parameter, public :: idx_ges_sat_q = 20 ! guess saturation specific + integer, parameter, public :: idx_spread_q = 21 ! spread (filled in by EnKF) + + + + !-------------------------------------------------- + ! index numbers into the rdiagbuf array + ! for type t obs + ! + ! (see setupt.f90 for more info) + ! + integer, parameter, public :: idx_obs_type_t = 1 ! obs type + integer, parameter, public :: idx_obs_subtype_t = 2 ! obs subtype + integer, parameter, public :: idx_obs_lat_t = 3 ! obs latitude + integer, parameter, public :: idx_obs_lon_t = 4 ! obs longitude + integer, parameter, public :: idx_stn_elev_t = 5 ! stn elevation + integer, parameter, public :: idx_pres_t = 6 ! obs pressure (hPa) + integer, parameter, public :: idx_hgt_t = 7 ! obs height (meters) + integer, parameter, public :: idx_time_t = 8 ! obs time (hrs relative to analysis time) + integer, parameter, public :: idx_iqc_t = 9 ! prepbufr qc or event mark + integer, parameter, public :: idx_setup_qc_t = 10 ! setup qc or event mark + integer, parameter, public :: idx_iuse_t = 11 ! read_prepbufr data usage flag + integer, parameter, public :: idx_anl_use_t = 12 ! analysis usage flag + integer, parameter, public :: idx_rwgt_t = 13 ! combination of var_jb and rwgt + integer, parameter, public :: idx_err_input_t = 14 ! prepbufr inverse obs error + integer, parameter, public :: idx_errinv_t = 15 ! read_prepbufr inverse obs error + integer, parameter, public :: idx_errinv_fnl_t = 16 ! final inverse obs error + integer, parameter, public :: idx_obs_t = 17 ! temperature obs (K) + integer, parameter, public :: idx_omgbc_t = 18 ! obs-ges used in analysis (K) + integer, parameter, public :: idx_omgnbc_t = 19 ! obs-ges w/o bias correction (K) + integer, parameter, public :: idx_pof_t = 20 ! data pof + integer, parameter, public :: idx_vv_t = 21 ! data vertical velocity + integer, parameter, public :: idx_pbias_one = 22 ! pred bias term 1 + integer, parameter, public :: idx_pbias_two = 23 ! pred bias term 2 + integer, parameter, public :: idx_pbias_three = 24 ! pred bias term 3 + integer, parameter, public :: idx_pbias_four = 25 ! pred bias term 4 + + + !-------------------------------------------------- + ! index numbers into the rdiagbuf array + ! for type uv obs + ! + ! (see setupw.f90 for more info) + ! + integer, parameter, public :: idx_obs_type_uv = 1 ! obs type + integer, parameter, public :: idx_obs_subtype_uv = 2 ! obs subtype + integer, parameter, public :: idx_obs_lat_uv = 3 ! obs latitude + integer, parameter, public :: idx_obs_lon_uv = 4 ! obs longitude + integer, parameter, public :: idx_stn_elev_uv = 5 ! stn elevation + integer, parameter, public :: idx_pres_uv = 6 ! obs pressure (hPa) + integer, parameter, public :: idx_hgt_uv = 7 ! obs height (meters) + integer, parameter, public :: idx_time_uv = 8 ! obs time (hrs relative to analysis time) + integer, parameter, public :: idx_iqc_uv = 9 ! prepbufr qc or event mark + integer, parameter, public :: idx_setup_qc_uv = 10 ! setup qc or event mark + integer, parameter, public :: idx_iuse_uv = 11 ! read_prepbufr data usage flag + integer, parameter, public :: idx_anl_use_uv = 12 ! analysis usage flag + integer, parameter, public :: idx_rwgt_uv = 13 ! combination of var_jb and rwgt + integer, parameter, public :: idx_err_input_uv = 14 ! prepbufr inverse obs error + integer, parameter, public :: idx_errinv_uv = 15 ! read_prepbufr inverse obs error + integer, parameter, public :: idx_errinv_fnl_uv = 16 ! final inverse obs error + integer, parameter, public :: idx_u_obs_uv = 17 ! u wind component observation + integer, parameter, public :: idx_u_omgbc_uv = 18 ! u obs-ges used in analysis (m/s) + integer, parameter, public :: idx_u_omgnbc_uv = 19 ! u obs-ges w/o bias correction (m/s) + integer, parameter, public :: idx_v_obs_uv = 20 ! v wind component observation + integer, parameter, public :: idx_v_omgbc_uv = 21 ! v obs-ges used in analysis (m/s) + integer, parameter, public :: idx_v_omgnbc_uv = 22 ! v obs-ges w/o bias correction (m/s) + + + !-------------------------------------------------- + ! index numbers into the rdiagbuf array + ! for type sst obs + ! + ! (see setupsst.f90 for more info) + ! + integer, parameter, public :: idx_obs_type_sst = 1 ! obs type + integer, parameter, public :: idx_obs_subtype_sst = 2 ! obs subtype + integer, parameter, public :: idx_obs_lat_sst = 3 ! obs latitude + integer, parameter, public :: idx_obs_lon_sst = 4 ! obs longitude + integer, parameter, public :: idx_stn_elev_sst = 5 ! stn elevation + integer, parameter, public :: idx_opn_wtr_tmp_sst = 6 ! background open water temperature + integer, parameter, public :: idx_depth_sst = 7 ! observation depth (meters) + integer, parameter, public :: idx_time_sst = 8 ! obs time (hrs relative to analysis time) + integer, parameter, public :: idx_opn_wtr_pct_sst = 9 ! open water percentage + integer, parameter, public :: idx_setup_qc_sst = 10 ! setup qc or event mark + integer, parameter, public :: idx_iuse_sst = 11 ! read_prepbufr data usage flag + integer, parameter, public :: idx_anl_use_sst = 12 ! analysis usage flag + integer, parameter, public :: idx_rwgt_sst = 13 ! combination of var_jb and rwgt + integer, parameter, public :: idx_err_input_sst = 14 ! prepbufr inverse obs error + integer, parameter, public :: idx_errinv_sst = 15 ! read_prepbufr inverse obs error + integer, parameter, public :: idx_errinv_fnl_sst = 16 ! final inverse obs error + integer, parameter, public :: idx_obs_sst = 17 ! SST observation (K) + integer, parameter, public :: idx_omgbc_sst = 18 ! obs-ges used in analysis (K) + integer, parameter, public :: idx_omgnbc_sst = 19 ! obs-ges w/o bias correction (K) + integer, parameter, public :: idx_type_sst = 20 ! type of measurment + integer, parameter, public :: idx_tr_sst = 21 ! Tr + integer, parameter, public :: idx_dt_warm_sst = 22 ! dt_warm at zob + integer, parameter, public :: idx_dt_cool_sst = 23 ! dt_cool at zob + integer, parameter, public :: idx_dtz_dtr_sst = 23 ! d(tz)/d(Tr) at zob + + + + !-------------------------------------------------- + ! index numbers into the rdiagbuf array + ! for type gps obs + ! + ! (see setupbend.f90 for more info) + ! + integer, parameter, public :: idx_obs_type_gps = 1 ! obs type + integer, parameter, public :: idx_obs_subtype_gps = 2 ! profile identifier + integer, parameter, public :: idx_obs_lat_gps = 3 ! obs latitude + integer, parameter, public :: idx_obs_lon_gps = 4 ! obs longitude + integer, parameter, public :: idx_bend_ang_gps = 5 ! incremental bending angle (x100 %) + integer, parameter, public :: idx_pres_gps = 6 ! pressure at obs location (hPa) + integer, parameter, public :: idx_height_gps = 7 ! impact height in meters + integer, parameter, public :: idx_time_gps = 8 ! obs time (hrs relative to analysis time) + integer, parameter, public :: idx_zsges_gps = 9 ! model terrain (m) + integer, parameter, public :: idx_setup_qc_gps = 10 ! setup qc or event mark + integer, parameter, public :: idx_iuse_gps = 11 ! read_prepbufr data usage flag + integer, parameter, public :: idx_anl_use_gps = 12 ! analysis usage flag + integer, parameter, public :: idx_rwgt_gps = 13 ! combination of var_jb and rwgt + integer, parameter, public :: idx_err_input_gps = 14 ! prepbufr inverse obs error + integer, parameter, public :: idx_errinv_gps = 15 ! read_prepbufr inverse obs error + integer, parameter, public :: idx_errinv_fnl_gps = 16 ! final inverse obs error + integer, parameter, public :: idx_obs_gps = 17 ! bending angle observation (radians) + integer, parameter, public :: idx_tref_gps = 18 ! temperature at obs location (K) + integer, parameter, public :: idx_hob_gps = 19 ! model vertival grid + integer, parameter, public :: idx_uses_gps = 20 ! uses gps_ref + integer, parameter, public :: idx_qref_gps = 21 ! specific humidity at obs location (kg/kg) + integer, parameter, public :: idx_spread_gps = 22 ! spread + + + ! Data is stored in data_t + type :: data_t + character(8) :: stn_id + real,dimension(25) :: rdiag + end type data_t + + ! A container for storing data_t pointers + type :: data_ptr + type(data_t), pointer :: p + end type data_ptr + +end module data diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_sfctime/generic_list.f90 b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_sfctime.fd/generic_list.f90 similarity index 100% rename from util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_sfctime/generic_list.f90 rename to util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_sfctime.fd/generic_list.f90 diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_sfctime/grads_sfctime.f90 b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_sfctime.fd/grads_sfctime.f90 similarity index 89% rename from util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_sfctime/grads_sfctime.f90 rename to util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_sfctime.fd/grads_sfctime.f90 index b6caa99bf9..4f52806b66 100644 --- a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_sfctime/grads_sfctime.f90 +++ b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_sfctime.fd/grads_sfctime.f90 @@ -7,7 +7,7 @@ !--------------------------------------------------------------------------------- subroutine grads_sfctime(fileo,ifileo,nobs,nreal,nlev,plev,iscater,& - igrads,isubtype,subtype,list) + igrads,isubtype,subtype,list,run) use generic_list use data @@ -17,10 +17,17 @@ subroutine grads_sfctime(fileo,ifileo,nobs,nreal,nlev,plev,iscater,& type(list_node_t), pointer :: list type(list_node_t), pointer :: next => null() type(data_ptr) :: ptr - - real(4),allocatable,dimension(:,:) :: rdiag_m2 + + integer, intent(in) :: ifileo, nobs, nreal, nlev + integer, intent(in) :: iscater, igrads + integer(4), intent(in) :: isubtype + character(ifileo),intent(in) :: fileo + character(3), intent(in) :: run, subtype + + + real(4),dimension(nlev),intent(in) :: plev + real(4),allocatable,dimension(:,:) :: rdiag_m2 character(8),allocatable,dimension(:) :: cdiag - real(4),dimension(nlev) :: plev integer,dimension(nlev) :: ndata !----------------------------------------------------------------------------- @@ -36,7 +43,7 @@ subroutine grads_sfctime(fileo,ifileo,nobs,nreal,nlev,plev,iscater,& ! not logically possible that the necessary dimension for these variables ! will exceed the input nobs value. Indeed in my tests the resulting used ! portion of the dimension is 25%-35% of the nobs value, once duplicates and - ! data that does not conform to the availble pressure levels are tossed out. + ! data that does not conform to the available pressure levels are tossed out. ! So it makes more sense to dynamically allocate these vars to the value of ! nobs rather than arbitrarily select 10000 and find out the hard way that ! that was insufficient. @@ -46,19 +53,18 @@ subroutine grads_sfctime(fileo,ifileo,nobs,nreal,nlev,plev,iscater,& character(8),allocatable,dimension(:) :: stid character(8) :: stidend - character(ifileo) :: fileo - character(3) :: subtype - character(30) :: files,filein,filegrads - integer :: nobs,nreal,nlfag,nflag0,nlev,nlev0,getlev,iscater,igrads + character(30) :: files,filein,filegrads, file_nobs + integer :: nlfag,nflag0,nlev0,getlev real(4) :: rmiss,rtim,xlat0,xlon0,rtime integer :: first, second - integer(4):: isubtype - integer nt,ifileo,k,i,ii,j,nflag,obs_ctr + integer nt,k,i,ii,j,nflag,obs_ctr integer ilat,ilon,ipres,itime,iweight,ndup data rmiss/-999.0/ + + print *, '---> grads_sfctime' ndata=0 if( nobs > 0 ) then @@ -82,13 +88,11 @@ subroutine grads_sfctime(fileo,ifileo,nobs,nreal,nlev,plev,iscater,& ! Retrieve data from the linked list and load ! into the cdiag and rdiag arrays ! - print *, 'Associated(list) = ', associated( list ) obs_ctr = 0 next => list do while ( associated( next ) == .TRUE. ) ptr = transfer(list_get( next ), ptr) -! print *, 'node data:', ptr%p next => list_next( next ) obs_ctr = obs_ctr + 1 @@ -98,15 +102,13 @@ subroutine grads_sfctime(fileo,ifileo,nobs,nreal,nlev,plev,iscater,& end do end do - print *, 'obs_ctr (list) = ', obs_ctr - !---------------------------------------------------- ! generate scatter file ! print *, 'begin scatter file generation' if(iscater ==1) then - files=trim(fileo)//'_'//trim(subtype)//'.scater' + files=trim(fileo)//'_'//trim(subtype)//'.scater.'//trim(run) print *, 'scatter files = ', files open(51,file=files,form='unformatted') write(51) nobs,nreal-2 @@ -119,7 +121,7 @@ subroutine grads_sfctime(fileo,ifileo,nobs,nreal,nlev,plev,iscater,& if( igrads == 1 ) then - filegrads=trim(fileo)//'_'//trim(subtype)//'_grads' + filegrads=trim(fileo)//'_'//trim(subtype)//'.grads.'//trim(run) open(21,file=filegrads,form='unformatted',status='new') ! open output file print *, 'filegrads = ', filegrads @@ -215,16 +217,11 @@ subroutine grads_sfctime(fileo,ifileo,nobs,nreal,nlev,plev,iscater,& k=nt print *, 'using ndata max value of nt = ', nt -! do i=1,nlev -! print *, 'ndata(i) = ', i, ndata(i) -! end do nflag=1 rtim=0.0 nlev0=1 do i=1,ii -! print *,' writing stid(i), rlat(i),rlon(i),rtim,nlev0,nflag = ', & -! i, stid(i),rlat(i),rlon(i) write(21) stid(i),rlat(i),rlon(i),rtim,nlev0,nflag write(21) (tobs(j,i,k),j=1,nreal-4) enddo @@ -244,6 +241,11 @@ subroutine grads_sfctime(fileo,ifileo,nobs,nreal,nlev,plev,iscater,& close(21) print *, 'wrote ii tobs to file ', ii + file_nobs=trim(fileo)//'_'//trim(subtype)//'.nobs.'//trim(run) + open( 32, file=file_nobs, form='formatted', status='new' ) + write(32,*) trim(fileo), ',', trim(subtype), ',', ii + close( 32 ) + endif deallocate( cdiag,rdiag_m2,tobs ) @@ -253,6 +255,7 @@ subroutine grads_sfctime(fileo,ifileo,nobs,nreal,nlev,plev,iscater,& print *, 'NOBS <= 0, NO OUTPUT GENERATED' end if + print *, '<--- grads_sfctime' return end diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radbcor.fd/kinds.F90 b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_sfctime.fd/kinds.F90 similarity index 100% rename from util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radbcor.fd/kinds.F90 rename to util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_sfctime.fd/kinds.F90 diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_sfctime/maingrads_sfctime.f90 b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_sfctime.fd/maingrads_sfctime.f90 similarity index 73% rename from util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_sfctime/maingrads_sfctime.f90 rename to util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_sfctime.fd/maingrads_sfctime.f90 index 7be2f9d2d1..6316a00b8f 100644 --- a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_sfctime/maingrads_sfctime.f90 +++ b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_sfctime.fd/maingrads_sfctime.f90 @@ -9,28 +9,15 @@ program maingrads_sfctime use generic_list use data + use conmon_read_diag implicit none interface - subroutine read_conv2grads(ctype,stype,itype,nreal,nobs,& - isubtype,subtype,list) - use generic_list - character(3) :: ctype - character(10) :: stype - integer :: itype - integer :: nreal - integer :: nobs - integer :: isubtype - character(3) :: subtype - type(list_node_t),pointer :: list - end subroutine read_conv2grads - - subroutine grads_sfctime(fileo,ifileo,nobs,nreal,& - nlev,plev,iscater,igrads,isubtype,subtype,list) + nlev,plev,iscater,igrads,isubtype,subtype,list,run) use generic_list character(ifileo) :: fileo @@ -39,6 +26,7 @@ subroutine grads_sfctime(fileo,ifileo,nobs,nreal,& integer :: iscater,igrdas,isubtype character(3) :: subtype type(list_node_t),pointer :: list + character(3) :: run end subroutine grads_sfctime @@ -58,7 +46,12 @@ end subroutine grads_sfctime integer nobs,lstype integer n_time7,n_time11,itype - namelist /input/intype,stype,itype,nreal,iscater,igrads,timecard,isubtype,subtype + !--- namelist with defaults + logical :: netcdf = .false. + character(100) :: input_file = "conv_diag" + character(3) :: run = "ges" + namelist /input/input_file,intype,stype,itype,nreal,iscater,igrads,timecard,isubtype,subtype,netcdf,run + data n_time11 / 11 / data n_time7 / 7 / @@ -71,18 +64,19 @@ end subroutine grads_sfctime lstype=len_trim(stype) - call read_conv2grads(intype,stype,itype,nreal,nobs,isubtype,subtype,list) + write(6,*)'netcdf =', netcdf + call set_netcdf_read( netcdf ) + call conmon_read_diag_file( input_file,intype,itype,nreal,nobs,isubtype,list ) + if( nobs > 0 ) then if( trim(timecard) == 'time11') then -! print *, 'time11' call grads_sfctime(stype,lstype,nobs,nreal,n_time11,& - ptime11,iscater,igrads,isubtype,subtype, list) + ptime11,iscater,igrads,isubtype,subtype, list, run) else if( trim(timecard) == 'time7') then -! print *, 'time7' call grads_sfctime(stype,lstype,nobs,nreal,n_time7,& - ptime7,iscater,igrads,isubtype,subtype,list) + ptime7,iscater,igrads,isubtype,subtype,list, run) endif else diff --git a/util/Conventional_Monitor/image_gen/sorc/read_t/rm_dups.f90 b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_sfctime.fd/rm_dups.f90 similarity index 100% rename from util/Conventional_Monitor/image_gen/sorc/read_t/rm_dups.f90 rename to util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_sfctime.fd/rm_dups.f90 diff --git a/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_sig.fd/CMakeLists.txt b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_sig.fd/CMakeLists.txt new file mode 100644 index 0000000000..c989043c7a --- /dev/null +++ b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_sig.fd/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.6) + file(GLOB CONMON_GRADS_SIG_SRC ${CMAKE_CURRENT_SOURCE_DIR}/*90 ) + set(CONMON_GRADS_SIG_Fortran_FLAGS "-fp-model strict -assume byterecl -convert big_endian -O3 -traceback -D_REAL8_ ") + set(Util_MODULE_DIR ${PROJECT_BINARY_DIR}/include/conmon_grads_sig ) + + set_source_files_properties( ${CONMON_GRADS_SIG_SRC} PROPERTIES COMPILE_FLAGS ${CONMON_GRADS_SIG_Fortran_FLAGS} ) + add_executable(conmon_grads_sig.x ${CONMON_GRADS_SIG_SRC} ) + set_target_properties( conmon_grads_sig.x PROPERTIES COMPILE_FLAGS ${CONMON_GRADS_SIG_Fortran_FLAGS} ) + set_target_properties( conmon_grads_sig.x PROPERTIES Fortran_MODULE_DIRECTORY ${Util_MODULE_DIR} ) + + include_directories( ${CORE_INCS} ${NCDIAG_INCS} ) + + target_link_libraries( conmon_grads_sig.x ${W3NCO_4_LIBRARY} ${NCDIAG_LIBRARIES} ${NETCDF_Fortran_LIBRARIES} + ${NETCDF_C_LIBRARIES} ${MPI_Fortran_LIBRARIES} ) + + if(BUILD_W3NCO) + add_dependencies( conmon_grads_sig.x ${W3NCO_4_LIBRARY} ) + endif() + diff --git a/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_sig.fd/conmon_read_diag.F90 b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_sig.fd/conmon_read_diag.F90 new file mode 100644 index 0000000000..0b7afcf067 --- /dev/null +++ b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_sig.fd/conmon_read_diag.F90 @@ -0,0 +1,1839 @@ +!---------------------------------------------------------------------- +! conmon_read_diag +! +! This subroutine reads the conventional data assimilation +! diagnostic files (contained in the cnvstat tar file) and returns +! the requested obs that match the input type and subtype in a +! linked list. The diagnostic files may be in either binary or +! NetCDF format. +! +! Note: +! There are problems/mismatches between the contents of binary +! and NetCDF files for types gps and sst. +!---------------------------------------------------------------------- + +module conmon_read_diag + + !--- use ---! + use generic_list + use data + use kinds, only: i_kind,r_single,r_kind + + use nc_diag_read_mod, only: nc_diag_read_init, nc_diag_read_close, & + nc_diag_read_get_dim, nc_diag_read_get_global_attr, & + nc_diag_read_get_var_names, & + nc_diag_read_get_global_attr_names, & + nc_diag_read_get_var, nc_diag_read_get_dim_names + + use ncdr_vars, only: nc_diag_read_check_var + use ncdr_dims, only: nc_diag_read_check_dim + + + !--- implicit ---! + implicit none + + + !--- public & private ---! + private + + public :: set_netcdf_read + public :: conmon_read_diag_file + public :: conmon_return_all_obs + + interface load_nc_var + module procedure load_nc_var_int, load_nc_var_real, load_nc_var_char + end interface + + + !--- common data structures ---! + logical,save :: netcdf = .false. + + integer(i_kind), parameter :: MAX_OPEN_NCDIAG = 2 + integer(i_kind), save :: nopen_ncdiag = 0 + integer(i_kind), dimension(MAX_OPEN_NCDIAG), save :: ncdiag_open_id = (/-1, -1/) + + type ncdiag_status + logical :: nc_read + integer(i_kind) :: cur_ob_idx + integer(i_kind) :: num_records + end type ncdiag_status + + type(ncdiag_status), dimension(MAX_OPEN_NCDIAG), save :: ncdiag_open_status + + + + contains + + + subroutine load_nc_var_int( var_name, ftin, var_storage, ierr ) + character(len=*), intent(in) :: var_name + integer, intent(in) :: ftin + integer, dimension(:), allocatable, intent(out) :: var_storage + integer, intent(out) :: ierr + + if( nc_diag_read_check_var( var_name )) then + call nc_diag_read_get_var( ftin, var_name, var_storage ) + ierr = 0 + else + print *, 'WARNING: unable to read ', trim( var_name ) + ierr = 1 + end if + end subroutine + + + subroutine load_nc_var_real( var_name, ftin, var_storage, ierr ) + character(len=*), intent(in) :: var_name + integer, intent(in) :: ftin + real(r_single), dimension(:), allocatable, intent(out) :: var_storage + integer, intent(out) :: ierr + + if( nc_diag_read_check_var( var_name )) then + call nc_diag_read_get_var( ftin, var_name, var_storage ) + ierr=0 + else + print *, 'WARNING: unable to read ', trim( var_name ) + ierr=1 + end if + end subroutine + + + subroutine load_nc_var_char( var_name, ftin, var_storage, ierr ) + character(len=*), intent(in) :: var_name + integer, intent(in) :: ftin + character(len=:), dimension(:), allocatable, intent(out) :: var_storage + integer, intent(out) :: ierr + + if( nc_diag_read_check_var( var_name )) then + call nc_diag_read_get_var( ftin, var_name, var_storage ) + ierr=0 + else + print *, 'WARNING: unable to read ', trim( var_name ) + ierr=1 + end if + end subroutine + + + + !------------------------------------------------------------ + ! set_netcdf_read + ! + ! set the use_netcdf flag to signal binary (default) or + ! netcdf formatted diagnostic files. + !------------------------------------------------------------ + subroutine set_netcdf_read( use_netcdf ) + logical,intent(in) :: use_netcdf + + netcdf = use_netcdf + + end subroutine set_netcdf_read + + + + !--------------------------------------------------------------- + ! conmon_read_diag_file + ! + ! Public routine to read a conventional diagnostic file + ! + ! Obs in the input_file are returned in the list according + ! to these rules: + ! + ! 1. All obs matching intype and in_subtype are returned. + ! + ! 2. If there are no subtype values in the input_file then + ! all obs matching intype are returned. + ! + !--------------------------------------------------------------- + subroutine conmon_read_diag_file( input_file, ctype, intype, expected_nreal, nobs, in_subtype, list ) + + !--- interface + character(100), intent(in) :: input_file + character(3), intent(in) :: ctype + + !--- note expected_nreal has no meaning for netcdf files + integer, intent(in) :: intype, expected_nreal, in_subtype + integer, intent(out) :: nobs + type(list_node_t), pointer :: list + logical :: return_all = .false. + + write(6,*)'--> conmon_read_diag_file' + + if ( netcdf ) then + write(6,*) ' call nc read subroutine' + call read_diag_file_nc( input_file, return_all, ctype, intype, expected_nreal, nobs, in_subtype, list ) + else + call read_diag_file_bin( input_file,return_all, ctype, intype, expected_nreal,nobs,in_subtype, list ) + end if + + write(6,*)"<-- conmon_read_diag_file" + + end subroutine conmon_read_diag_file + + + + !------------------------------------------------------------------ + ! conmon_return_all_obs + ! + ! Retrieve all obs from a given conventional diagnostic file. + ! Note that the NetCDF formatted diag files always contain only + ! one conventional data type (gps, ps, q, sst, t, uv), while + ! binary formatted diag files contain all types for a single + ! ges or anl run. + ! + ! Note: the ctype parameter only has meaning for NetCDF + ! formatted diag files. + !------------------------------------------------------------------ + subroutine conmon_return_all_obs( input_file, ctype, nobs, list ) + + !--- interface + character(100), intent(in) :: input_file + character(3), intent(in) :: ctype + integer, intent(out) :: nobs + type(list_node_t), pointer :: list + + logical :: return_all = .true. + integer :: intype, expected_nreal, in_subtype + + write(6,*)'--> conmon_return_all_obs' + nobs = 0 + + ! + ! Q: Can I re-use the read_diag_* to do this read, + ! adding extra param(s) to switch on _all_ obs? + ! Those routines are private to this module so + ! that wouldn't pose a complexity problem for + ! accessing the routines. + ! + if ( netcdf ) then + write(6,*) ' call nc retrieve all routine' + call read_diag_file_nc( input_file, return_all, ctype, intype, expected_nreal, nobs, in_subtype, list ) + else + write(6,*) ' call bin retrieve all routine' + call read_diag_file_bin( input_file,return_all, ctype, intype, expected_nreal,nobs,in_subtype, list ) + end if + + write(6,*)'<-- conmon_return_all_obs' + + end subroutine conmon_return_all_obs + + + !------------------------------- + ! read_diag_file_nc + ! + ! NetCDF read routine + !------------------------------- + subroutine read_diag_file_nc( input_file, return_all, ctype, intype, expected_nreal, nobs, in_subtype, list ) + + !--- interface + character(100), intent(in) :: input_file + logical, intent(in) :: return_all + character(3), intent(in) :: ctype + integer, intent(in) :: intype, expected_nreal, in_subtype + integer, intent(out) :: nobs + type(list_node_t), pointer :: list + + !--- local vars + type(list_node_t), pointer :: next => null() + type(data_ptr) :: ptr + integer :: ii, ierr, istatus, ftin, total_obs, id, idx + + data ftin / 11 / + + + print *, ' ' + print *, ' --> read_diag_file_nc' + print *, ' ctype, intype, in_subtype = ', ctype, intype, in_subtype + nobs = 0 + ierr = 0 + + if (nopen_ncdiag >= MAX_OPEN_NCDIAG) then + write(6,*) 'OPEN_RADIAG: ***ERROR*** Cannot open more than ', & + MAX_OPEN_NCDIAG, ' netcdf diag files.' + endif + + call nc_diag_read_init( input_file, ftin ) + istatus=0 + + do ii = 1, MAX_OPEN_NCDIAG + + if( ncdiag_open_id(ii) < 0 ) then + ncdiag_open_id(ii) = ftin + ncdiag_open_status(ii)%nc_read = .false. + + ncdiag_open_status(ii)%cur_ob_idx = -9999 + ncdiag_open_status(ii)%num_records = -9999 + nopen_ncdiag = nopen_ncdiag + 1 + exit + endif + + enddo + + select case ( trim( adjustl( ctype ) ) ) + + case ( 'gps' ) + call read_diag_file_gps_nc( input_file, return_all, ftin, ctype, intype, expected_nreal, nobs, in_subtype, list ) + + case ( 'ps' ) + call read_diag_file_ps_nc( input_file, return_all, ftin, ctype, intype, expected_nreal, nobs, in_subtype, list ) + + case ( 'q' ) + call read_diag_file_q_nc( input_file, return_all, ftin, ctype, intype, expected_nreal, nobs, in_subtype, list ) + + case ( 'sst' ) + call read_diag_file_sst_nc( input_file, return_all, ftin, ctype, intype, expected_nreal, nobs, in_subtype, list ) + + case ( 't' ) + call read_diag_file_t_nc( input_file, return_all, ftin, ctype, intype, expected_nreal, nobs, in_subtype, list ) + + case ( 'uv' ) + call read_diag_file_uv_nc( input_file, return_all, ftin, ctype, intype, expected_nreal, nobs, in_subtype, list ) + + case default + print *, 'ERROR: unmatched ctype :', ctype + + end select + + + id = find_ncdiag_id(ftin) + if (id < 0) then + write(6,*) 'CLOSE_RADIAG: ***ERROR*** ncdiag file ', input_file, & + ' was not opened' + endif + + call nc_diag_read_close( input_file ) + ncdiag_open_id(id) = -1 + + ncdiag_open_status(id)%nc_read = .false. + ncdiag_open_status(id)%cur_ob_idx = -9999 + ncdiag_open_status(id)%num_records = -9999 + + nopen_ncdiag = nopen_ncdiag - 1 + + print *, ' ' + print *, ' <-- read_diag_file_nc, ierr = ', ierr + + + end subroutine read_diag_file_nc + + + !--------------------------------------------------------- + ! netcdf read routine for ps data types in netcdf files + ! + subroutine read_diag_file_ps_nc( input_file, return_all, ftin, ctype, intype,expected_nreal,nobs,in_subtype, list ) + + !--- interface + character(100), intent(in) :: input_file + logical, intent(in) :: return_all + integer, intent(in) :: ftin + character(3), intent(in) :: ctype + integer, intent(in) :: intype, expected_nreal, in_subtype + integer, intent(out) :: nobs + type(list_node_t), pointer :: list + + !--- local vars + type(list_node_t), pointer :: next => null() + type(data_ptr) :: ptr + integer :: ii, ierr, istatus, total_obs, idx + logical :: have_subtype = .true. + logical :: add_obs + + !--- NetCDF file components dimension(s) + ! + character(len=:), dimension(:), allocatable :: Station_ID ! (nobs, Station_ID_maxstrlen) + character(len=:), dimension(:), allocatable :: Observation_Class ! (nobs, Station_Class_maxstrlen) + integer, dimension(:), allocatable :: Observation_Type ! (obs) + integer, dimension(:), allocatable :: Observation_Subtype ! (obs) + real(r_single), dimension(:), allocatable :: Latitude ! (obs) + real(r_single), dimension(:), allocatable :: Longitude ! (obs) + real(r_single), dimension(:), allocatable :: Station_Elevation ! (obs) + real(r_single), dimension(:), allocatable :: Pressure ! (obs) + real(r_single), dimension(:), allocatable :: Height ! (obs) + real(r_single), dimension(:), allocatable :: Time ! (obs) + real(r_single), dimension(:), allocatable :: Prep_QC_Mark ! (obs) + real(r_single), dimension(:), allocatable :: Prep_Use_Flag ! (obs) + real(r_single), dimension(:), allocatable :: Nonlinear_QC_Var_Jb ! (obs) + real(r_single), dimension(:), allocatable :: Nonlinear_QC_Rel_Wgt ! (obs) + real(r_single), dimension(:), allocatable :: Analysis_Use_Flag ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Input ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Adjust ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Final ! (obs) + real(r_single), dimension(:), allocatable :: Observation ! (obs) + real(r_single), dimension(:), allocatable :: Obs_Minus_Forecast_adjusted ! (obs) + real(r_single), dimension(:), allocatable :: Obs_Minus_Forecast_unadjusted ! (obs) + integer(i_kind) :: idate + + print *, ' ' + print *, ' --> read_diag_file_ps_nc' + + + !--- get NetCDF file dimensions + ! + if( nc_diag_read_check_dim( 'nobs' )) then + total_obs = nc_diag_read_get_dim(ftin,'nobs') + ncdiag_open_status(ii)%num_records = total_obs + print *, ' total_obs = ', total_obs + else + print *, 'ERROR: unable to read nobs' + ierr=1 + end if + + + !--- get vars + + call load_nc_var( 'Station_ID', ftin, Station_ID, ierr ) + call load_nc_var( 'Observation_Class', ftin, Observation_Class, ierr ) + call load_nc_var( 'Observation_Type', ftin, Observation_Type, ierr ) + call load_nc_var( 'Observation_Subtype', ftin, Observation_Subtype, ierr ) + if( ierr == 1 ) then + have_subtype = .false. + end if + call load_nc_var( 'Latitude', ftin, Latitude, ierr ) + call load_nc_var( 'Longitude', ftin, Longitude, ierr ) + call load_nc_var( 'Station_Elevation', ftin, Station_Elevation, ierr ) + call load_nc_var( 'Pressure', ftin, Pressure, ierr ) + call load_nc_var( 'Height', ftin, Height, ierr ) + call load_nc_var( 'Time', ftin, Time, ierr ) + call load_nc_var( 'Prep_QC_Mark', ftin, Prep_QC_Mark, ierr ) + call load_nc_var( 'Nonlinear_QC_Var_Jb', ftin, Nonlinear_QC_Var_Jb, ierr ) + call load_nc_var( 'Nonlinear_QC_Rel_Wgt', ftin, Nonlinear_QC_Rel_Wgt, ierr ) + call load_nc_var( 'Prep_Use_Flag', ftin, Prep_Use_Flag, ierr ) + call load_nc_var( 'Analysis_Use_Flag', ftin, Analysis_Use_Flag, ierr ) + call load_nc_var( 'Errinv_Input', ftin, Errinv_Input, ierr ) + call load_nc_var( 'Errinv_Adjust', ftin, Errinv_Adjust, ierr ) + call load_nc_var( 'Errinv_Final', ftin, Errinv_Final, ierr ) + call load_nc_var( 'Observation', ftin, Observation, ierr ) + call load_nc_var( 'Obs_Minus_Forecast_adjusted', ftin, Obs_Minus_Forecast_adjusted, ierr ) + call load_nc_var( 'Obs_Minus_Forecast_unadjusted', ftin, Obs_Minus_Forecast_unadjusted, ierr ) + + + + !--------------------------------------------------------------- + ! Process all obs. If type and subtype match the input values + ! add this obs to the linked list (ptr%p). + ! + nobs = 0 + do ii = 1, total_obs + + + add_obs = .false. + + !------------------------------------------------------------------------ + ! Check on Observation_Class to ctype is a sanity check -- + ! only a single class of obs are in any given NetCDF formatted diag file + ! but, if the ctype and input file don't match, things could get + ! interesting (but not in a good way). + ! + if( adjustl( trim( Observation_Class(ii) )) == adjustl( trim( ctype ))) then + + if( return_all == .true. ) then + add_obs = .true. + + else if( Observation_Type(ii) == intype ) then + + if( have_subtype == .false. ) then + add_obs = .true. + else if( Observation_Subtype(ii) == in_subtype ) then + add_obs = .true. + end if + + end if + end if + + if( add_obs == .true. ) then + + nobs=nobs+1 + + !--------------------------------------------- + ! Allocate a new data element and load + ! + allocate( ptr%p ) + ptr%p%stn_id = Station_ID( ii ) + + do idx=1,max_rdiag_reals + ptr%p%rdiag( idx ) = 0.00 + end do + + if( allocated( Observation_Type )) ptr%p%rdiag( idx_obs_type_ps ) = Observation_Type( ii ) + if( allocated( Observation_Subtype )) ptr%p%rdiag( idx_obs_subtype_ps ) = Observation_Subtype( ii ) + if( allocated( Latitude )) ptr%p%rdiag( idx_obs_lat_ps ) = Latitude( ii ) + if( allocated( Longitude )) ptr%p%rdiag( idx_obs_lon_ps ) = Longitude( ii ) + if( allocated( Station_Elevation )) ptr%p%rdiag( idx_stn_elev_ps ) = Station_Elevation( ii ) + if( allocated( Pressure )) ptr%p%rdiag( idx_pres_ps ) = Pressure( ii ) + if( allocated( Height )) ptr%p%rdiag( idx_hgt_ps ) = Height( ii ) + if( allocated( Time )) ptr%p%rdiag( idx_time_ps ) = Time( ii ) + if( allocated( Prep_QC_Mark )) ptr%p%rdiag( idx_iqc_ps ) = Prep_QC_Mark( ii ) + if( allocated( Nonlinear_QC_Var_Jb )) ptr%p%rdiag( idx_var_jb_ps ) = Nonlinear_QC_Var_Jb( ii ) + if( allocated( Prep_Use_Flag )) ptr%p%rdiag( idx_iuse_ps ) = Prep_Use_Flag( ii ) + if( allocated( Analysis_Use_Flag )) ptr%p%rdiag( idx_anl_use_ps ) = Analysis_Use_Flag( ii ) + if( allocated( Nonlinear_QC_Rel_Wgt )) ptr%p%rdiag( idx_rwgt_ps ) = Nonlinear_QC_Rel_Wgt( ii ) + if( allocated( Errinv_Input )) ptr%p%rdiag( idx_err_input_ps ) = Errinv_Input( ii ) + if( allocated( Errinv_Adjust )) ptr%p%rdiag( idx_errinv_ps ) = Errinv_Adjust( ii ) + if( allocated( Errinv_Final )) ptr%p%rdiag( idx_errinv_fnl_ps ) = Errinv_Final( ii ) + if( allocated( Observation )) ptr%p%rdiag( idx_obs_ps ) = Observation( ii ) + if( allocated( Obs_Minus_Forecast_adjusted )) ptr%p%rdiag( idx_obsmg_adj_ps ) = Obs_Minus_Forecast_adjusted( ii ) + if( allocated( Obs_Minus_Forecast_unadjusted )) ptr%p%rdiag( idx_obsmg_nadj_ps ) = Obs_Minus_Forecast_unadjusted( ii ) + + if( nobs == 1 ) then + !------------------------------------------------- + ! Initialize the list with the first data element + ! + call list_init(list, transfer(ptr, list_data)) + next => list + + else + !------------------------------------------------- + ! Insert subsequent nodes into the list + ! + call list_insert(next, transfer(ptr, list_data)) + next => list_next(next) + end if + + end if + + end do + + + if( allocated( Station_ID )) deallocate( Station_ID ) + if( allocated( Observation_Class )) deallocate( Observation_Class ) + if( allocated( Observation_Type )) deallocate( Observation_Type ) + if( allocated( Observation_Subtype )) deallocate( Observation_Subtype ) + if( allocated( Latitude )) deallocate( Latitude ) + if( allocated( Longitude )) deallocate( Longitude ) + if( allocated( Station_Elevation )) deallocate( Station_Elevation ) + if( allocated( Time )) deallocate( Time ) + if( allocated( Prep_QC_Mark )) deallocate( Prep_QC_Mark ) + if( allocated( Prep_Use_Flag )) deallocate( Prep_Use_Flag ) + if( allocated( Nonlinear_QC_Var_Jb )) deallocate( Nonlinear_QC_Var_Jb ) + if( allocated( Nonlinear_QC_Rel_Wgt )) deallocate( Nonlinear_QC_Rel_Wgt ) + if( allocated( Analysis_Use_Flag )) deallocate( Analysis_Use_Flag ) + if( allocated( Errinv_Input )) deallocate( Errinv_Input ) + if( allocated( Errinv_Adjust )) deallocate( Errinv_Final ) + if( allocated( Errinv_Final )) deallocate( Errinv_Final ) + if( allocated( Observation )) deallocate( Observation ) + if( allocated( Obs_Minus_Forecast_adjusted )) deallocate( Obs_Minus_Forecast_adjusted ) + if( allocated( Obs_Minus_Forecast_unadjusted )) deallocate( Obs_Minus_Forecast_unadjusted ) + + print *, ' ' + print *, ' <-- read_diag_file_ps_nc' + + end subroutine read_diag_file_ps_nc + + + !--------------------------------------------------------- + ! netcdf read routine for q data types in netcdf files + ! + subroutine read_diag_file_q_nc( input_file, return_all, ftin, ctype, intype,expected_nreal,nobs,in_subtype, list ) + + !--- interface + character(100), intent(in) :: input_file + logical, intent(in) :: return_all + integer, intent(in) :: ftin + character(3), intent(in) :: ctype + integer, intent(in) :: intype, expected_nreal, in_subtype + integer, intent(out) :: nobs + type(list_node_t), pointer :: list + + !--- local vars + type(list_node_t), pointer :: next => null() + type(data_ptr) :: ptr + integer :: ii, ierr, istatus, total_obs, idx + logical :: have_subtype = .true. + logical :: add_obs + + !--- NetCDF file components dimension(s) + ! + character(len=:), dimension(:), allocatable :: Station_ID ! (nobs, Station_ID_maxstrlen) + character(len=:), dimension(:), allocatable :: Observation_Class ! (nobs, Station_Class_maxstrlen) + integer, dimension(:), allocatable :: Observation_Type ! (obs) + integer, dimension(:), allocatable :: Observation_Subtype ! (obs) + real(r_single), dimension(:), allocatable :: Latitude ! (obs) + real(r_single), dimension(:), allocatable :: Longitude ! (obs) + real(r_single), dimension(:), allocatable :: Station_Elevation ! (obs) + real(r_single), dimension(:), allocatable :: Pressure ! (obs) + real(r_single), dimension(:), allocatable :: Height ! (obs) + real(r_single), dimension(:), allocatable :: Time ! (obs) + real(r_single), dimension(:), allocatable :: Prep_QC_Mark ! (obs) + real(r_single), dimension(:), allocatable :: Prep_Use_Flag ! (obs) + real(r_single), dimension(:), allocatable :: Nonlinear_QC_Var_Jb ! (obs) + real(r_single), dimension(:), allocatable :: Nonlinear_QC_Rel_Wgt ! (obs) + real(r_single), dimension(:), allocatable :: Analysis_Use_Flag ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Input ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Adjust ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Final ! (obs) + real(r_single), dimension(:), allocatable :: Observation ! (obs) + real(r_single), dimension(:), allocatable :: Obs_Minus_Forecast_adjusted ! (obs) + real(r_single), dimension(:), allocatable :: Obs_Minus_Forecast_unadjusted ! (obs) + real(r_single), dimension(:), allocatable :: Forecast_Saturation_Spec_Hum ! (obs) + integer(i_kind) :: idate + + print *, ' ' + print *, ' --> read_diag_file_q_nc' + + + !--- get NetCDF file dimensions + ! + if( nc_diag_read_check_dim( 'nobs' )) then + total_obs = nc_diag_read_get_dim(ftin,'nobs') + ncdiag_open_status(ii)%num_records = total_obs + print *, ' total_obs = ', total_obs + else + print *, 'ERROR: unable to read nobs' + ierr=1 + end if + + + !--- get vars + + call load_nc_var( 'Station_ID', ftin, Station_ID, ierr ) + call load_nc_var( 'Observation_Class', ftin, Observation_Class, ierr ) + call load_nc_var( 'Observation_Type', ftin, Observation_Type, ierr ) + call load_nc_var( 'Observation_Subtype', ftin, Observation_Subtype, ierr ) + if( ierr == 1 ) then + have_subtype = .false. + end if + call load_nc_var( 'Latitude', ftin, Latitude, ierr ) + call load_nc_var( 'Longitude', ftin, Longitude, ierr ) + call load_nc_var( 'Station_Elevation', ftin, Station_Elevation, ierr ) + call load_nc_var( 'Pressure', ftin, Pressure, ierr ) + call load_nc_var( 'Height', ftin, Height, ierr ) + call load_nc_var( 'Time', ftin, Time, ierr ) + call load_nc_var( 'Prep_QC_Mark', ftin, Prep_QC_Mark, ierr ) + call load_nc_var( 'Nonlinear_QC_Var_Jb', ftin, Nonlinear_QC_Var_Jb, ierr ) + call load_nc_var( 'Nonlinear_QC_Rel_Wgt', ftin, Nonlinear_QC_Rel_Wgt, ierr ) + call load_nc_var( 'Prep_Use_Flag', ftin, Prep_Use_Flag, ierr ) + call load_nc_var( 'Analysis_Use_Flag', ftin, Analysis_Use_Flag, ierr ) + call load_nc_var( 'Errinv_Input', ftin, Errinv_Input, ierr ) + call load_nc_var( 'Errinv_Adjust', ftin, Errinv_Adjust, ierr ) + call load_nc_var( 'Errinv_Final', ftin, Errinv_Final, ierr ) + call load_nc_var( 'Observation', ftin, Observation, ierr ) + call load_nc_var( 'Obs_Minus_Forecast_adjusted', ftin, Obs_Minus_Forecast_adjusted, ierr ) + call load_nc_var( 'Obs_Minus_Forecast_unadjusted', ftin, Obs_Minus_Forecast_unadjusted, ierr ) + call load_nc_var( 'Forecast_Saturation_Spec_Hum', ftin, Forecast_Saturation_Spec_Hum, ierr ) + + + + !--------------------------------------------------------------- + ! Process all obs. If type and subtype match the input values + ! add this obs to the linked list (ptr%p). + ! + nobs = 0 + do ii = 1, total_obs + + add_obs = .false. + + !------------------------------------------------------------------------ + ! Check on Observation_Class to ctype is a sanity check -- + ! only a single class of obs are in any given NetCDF formatted diag file + ! but, if the ctype and input file don't match, things could get + ! interesting (but not in a good way). + ! + if( adjustl( trim( Observation_Class(ii) )) == adjustl( trim( ctype ))) then + + if( return_all == .true. ) then + add_obs = .true. + + else if( Observation_Type(ii) == intype ) then + + if( have_subtype == .false. ) then + add_obs = .true. + else if( Observation_Subtype(ii) == in_subtype ) then + add_obs = .true. + end if + + end if + end if + + + if( add_obs == .true. ) then + + nobs=nobs+1 + + !--------------------------------------------- + ! Allocate a new data element and load + ! + allocate(ptr%p) + ptr%p%stn_id = Station_ID( ii ) + + do idx=1,max_rdiag_reals + ptr%p%rdiag( idx ) = 0.00 + end do + + if( allocated( Observation_Type )) ptr%p%rdiag( idx_obs_type_q ) = Observation_Type( ii ) + if( allocated( Observation_Subtype )) ptr%p%rdiag( idx_obs_subtype_q ) = Observation_Subtype( ii ) + if( allocated( Latitude )) ptr%p%rdiag( idx_obs_lat_q ) = Latitude( ii ) + if( allocated( Longitude )) ptr%p%rdiag( idx_obs_lon_q ) = Longitude( ii ) + if( allocated( Station_Elevation )) ptr%p%rdiag( idx_stn_elev_q ) = Station_Elevation( ii ) + if( allocated( Pressure )) ptr%p%rdiag( idx_pres_q ) = Pressure( ii ) + if( allocated( Height )) ptr%p%rdiag( idx_hgt_q ) = Height( ii ) + if( allocated( Time )) ptr%p%rdiag( idx_time_q ) = Time( ii ) + if( allocated( Prep_QC_Mark )) ptr%p%rdiag( idx_iqc_q ) = Prep_QC_Mark( ii ) + if( allocated( Nonlinear_QC_Var_Jb )) ptr%p%rdiag( idx_var_jb_q ) = Nonlinear_QC_Var_Jb( ii ) + if( allocated( Prep_Use_Flag )) ptr%p%rdiag( idx_iuse_q ) = Prep_Use_Flag( ii ) + if( allocated( Analysis_Use_Flag )) ptr%p%rdiag( idx_anl_use_q ) = Analysis_Use_Flag( ii ) + if( allocated( Nonlinear_QC_Rel_Wgt )) ptr%p%rdiag( idx_rwgt_q ) = Nonlinear_QC_Rel_Wgt( ii ) + if( allocated( Errinv_Input )) ptr%p%rdiag( idx_err_input_q ) = Errinv_Input( ii ) + if( allocated( Errinv_Adjust )) ptr%p%rdiag( idx_errinv_q ) = Errinv_Adjust( ii ) + if( allocated( Errinv_Final )) ptr%p%rdiag( idx_errinv_fnl_q ) = Errinv_Final( ii ) + if( allocated( Observation )) ptr%p%rdiag( idx_obs_q ) = Observation( ii ) + if( allocated( Obs_Minus_Forecast_adjusted )) ptr%p%rdiag( idx_obsmg_adj_q ) = Obs_Minus_Forecast_adjusted( ii ) + if( allocated( Obs_Minus_Forecast_unadjusted )) ptr%p%rdiag( idx_obsmg_nadj_q ) = Obs_Minus_Forecast_unadjusted( ii ) + if( allocated( Forecast_Saturation_Spec_Hum )) ptr%p%rdiag( idx_ges_sat_q ) = Forecast_Saturation_Spec_Hum( ii ) + + + if( nobs == 1 ) then + !------------------------------------------------- + ! Initialize the list with the first data element + ! + call list_init(list, transfer(ptr, list_data)) + next => list + + else + !------------------------------------------------- + ! Insert subsequent nodes into the list + ! + call list_insert(next, transfer(ptr, list_data)) + next => list_next(next) + end if + + end if + + end do + + + if( allocated( Station_ID )) deallocate( Station_ID ) + if( allocated( Observation_Class )) deallocate( Observation_Class ) + if( allocated( Observation_Type )) deallocate( Observation_Type ) + if( allocated( Observation_Subtype )) deallocate( Observation_Subtype ) + if( allocated( Latitude )) deallocate( Latitude ) + if( allocated( Longitude )) deallocate( Longitude ) + if( allocated( Station_Elevation )) deallocate( Station_Elevation ) + if( allocated( Time )) deallocate( Time ) + if( allocated( Prep_QC_Mark )) deallocate( Prep_QC_Mark ) + if( allocated( Prep_Use_Flag )) deallocate( Prep_Use_Flag ) + if( allocated( Nonlinear_QC_Var_Jb )) deallocate( Nonlinear_QC_Var_Jb ) + if( allocated( Nonlinear_QC_Rel_Wgt )) deallocate( Nonlinear_QC_Rel_Wgt ) + if( allocated( Analysis_Use_Flag )) deallocate( Analysis_Use_Flag ) + if( allocated( Errinv_Input )) deallocate( Errinv_Input ) + if( allocated( Errinv_Adjust )) deallocate( Errinv_Final ) + if( allocated( Errinv_Final )) deallocate( Errinv_Final ) + if( allocated( Observation )) deallocate( Observation ) + if( allocated( Obs_Minus_Forecast_adjusted )) deallocate( Obs_Minus_Forecast_adjusted ) + if( allocated( Obs_Minus_Forecast_unadjusted )) deallocate( Obs_Minus_Forecast_unadjusted ) + if( allocated( Forecast_Saturation_Spec_Hum )) deallocate( Forecast_Saturation_Spec_Hum ) + + print *, ' ' + print *, ' <-- read_diag_file_q_nc' + + end subroutine read_diag_file_q_nc + + + + !------------------------------------------------------------- + ! netcdf read routine for ps data types in netcdf files + ! + ! NOTE1: This routine is untested. The ConMon does not + ! currently process sst obs. + ! + ! NOTE2: There are known discrepencies between the contents + ! of sst obs in binary and NetCDF files. + ! + subroutine read_diag_file_sst_nc( input_file, return_all, ftin, ctype, intype,expected_nreal,nobs,in_subtype, list ) + + !--- interface + character(100), intent(in) :: input_file + logical, intent(in) :: return_all + integer, intent(in) :: ftin + character(3), intent(in) :: ctype + integer, intent(in) :: intype, expected_nreal, in_subtype + integer, intent(out) :: nobs + type(list_node_t), pointer :: list + + !--- local vars + type(list_node_t), pointer :: next => null() + type(data_ptr) :: ptr + integer :: ii, ierr, istatus, total_obs, idx + logical :: have_subtype = .true. + logical :: add_obs + + !--- NetCDF file components dimension(s) + ! + character(len=:), dimension(:), allocatable :: Station_ID ! (nobs, Station_ID_maxstrlen) + character(len=:), dimension(:), allocatable :: Observation_Class ! (nobs, Station_Class_maxstrlen) + integer, dimension(:), allocatable :: Observation_Type ! (obs) + integer, dimension(:), allocatable :: Observation_Subtype ! (obs) + real(r_single), dimension(:), allocatable :: Latitude ! (obs) + real(r_single), dimension(:), allocatable :: Longitude ! (obs) + real(r_single), dimension(:), allocatable :: Station_Elevation ! (obs) + real(r_single), dimension(:), allocatable :: Pressure ! (obs) + real(r_single), dimension(:), allocatable :: Height ! (obs) + real(r_single), dimension(:), allocatable :: Time ! (obs) + real(r_single), dimension(:), allocatable :: Prep_QC_Mark ! (obs) + real(r_single), dimension(:), allocatable :: Prep_Use_Flag ! (obs) + real(r_single), dimension(:), allocatable :: Nonlinear_QC_Var_Jb ! (obs) + real(r_single), dimension(:), allocatable :: Nonlinear_QC_Rel_Wgt ! (obs) + real(r_single), dimension(:), allocatable :: Analysis_Use_Flag ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Input ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Adjust ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Final ! (obs) + real(r_single), dimension(:), allocatable :: Observation ! (obs) + real(r_single), dimension(:), allocatable :: Obs_Minus_Forecast_adjusted ! (obs) + real(r_single), dimension(:), allocatable :: Obs_Minus_Forecast_unadjusted ! (obs) + real(r_single), dimension(:), allocatable :: FoundationTempBG ! (obs) + real(r_single), dimension(:), allocatable :: DiurnalWarming_at_zob ! (obs) + real(r_single), dimension(:), allocatable :: SkinLayerCooling_at_zob ! (obs) + real(r_single), dimension(:), allocatable :: Sensitivity_Tzob_Tr ! (obs) + integer(i_kind) :: idate + + print *, ' ' + print *, ' --> read_diag_file_sst_nc' + + + !--- get NetCDF file dimensions + ! + if( nc_diag_read_check_dim( 'nobs' )) then + total_obs = nc_diag_read_get_dim(ftin,'nobs') + ncdiag_open_status(ii)%num_records = total_obs + print *, ' total_obs = ', total_obs + else + print *, 'ERROR: unable to read nobs' + ierr=1 + end if + + + !--- get vars + + call load_nc_var( 'Station_ID', ftin, Station_ID, ierr ) + call load_nc_var( 'Observation_Class', ftin, Station_ID, ierr ) + call load_nc_var( 'Observation_Type', ftin, Observation_Type, ierr ) + call load_nc_var( 'Observation_Subtype', ftin, Observation_Subtype, ierr ) + if( ierr == 1 ) then + have_subtype = .false. + end if + call load_nc_var( 'Latitude', ftin, Latitude, ierr ) + call load_nc_var( 'Longitude', ftin, Longitude, ierr ) + call load_nc_var( 'Station_Elevation', ftin, Station_Elevation, ierr ) + call load_nc_var( 'Pressure', ftin, Pressure, ierr ) + call load_nc_var( 'Height', ftin, Height, ierr ) + call load_nc_var( 'Time', ftin, Time, ierr ) + call load_nc_var( 'Prep_QC_Mark', ftin, Prep_QC_Mark, ierr ) + call load_nc_var( 'Nonlinear_QC_Var_Jb', ftin, Nonlinear_QC_Var_Jb, ierr ) + call load_nc_var( 'Nonlinear_QC_Rel_Wgt', ftin, Nonlinear_QC_Rel_Wgt, ierr ) + call load_nc_var( 'Prep_Use_Flag', ftin, Prep_Use_Flag, ierr ) + call load_nc_var( 'Analysis_Use_Flag', ftin, Analysis_Use_Flag, ierr ) + call load_nc_var( 'Errinv_Input', ftin, Errinv_Input, ierr ) + call load_nc_var( 'Errinv_Adjust', ftin, Errinv_Adjust, ierr ) + call load_nc_var( 'Errinv_Final', ftin, Errinv_Final, ierr ) + call load_nc_var( 'Observation', ftin, Observation, ierr ) + call load_nc_var( 'Obs_Minus_Forecast_adjusted', ftin, Obs_Minus_Forecast_adjusted, ierr ) + call load_nc_var( 'Obs_Minus_Forecast_unadjusted', ftin, Obs_Minus_Forecast_unadjusted, ierr ) + call load_nc_var( 'FoundationTempBG', ftin, FoundationTempBG, ierr ) + call load_nc_var( 'DiurnalWarming_at_zob', ftin, DiurnalWarming_at_zob, ierr ) + call load_nc_var( 'SkinLayerCooling_at_zob', ftin, SkinLayerCooling_at_zob, ierr ) + call load_nc_var( 'Sensitivity_Tzob_Tr', ftin, Sensitivity_Tzob_Tr, ierr ) + + + + !--------------------------------------------------------------- + ! Process all obs. If type and subtype match the input values + ! add this obs to the linked list (ptr%p). + ! + nobs = 0 + do ii = 1, total_obs + + add_obs = .false. + + !------------------------------------------------------------------------ + ! Check on Observation_Class to ctype is a sanity check -- + ! only a single class of obs are in any given NetCDF formatted diag + ! file + ! but, if the ctype and input file don't match, things could get + ! interesting (but not in a good way). + ! + if( adjustl( trim( Observation_Class(ii) )) == adjustl( trim( ctype ))) then + + if( return_all == .true. ) then + add_obs = .true. + + else if( Observation_Type(ii) == intype ) then + + if( have_subtype == .false. ) then + add_obs = .true. + else if( Observation_Subtype(ii) == in_subtype ) then + add_obs = .true. + end if + + end if + end if + + + if( add_obs == .true. ) then + + nobs=nobs+1 + + !--------------------------------------------- + ! Allocate a new data element and load + ! + allocate( ptr%p ) + ptr%p%stn_id = Station_ID( ii ) + + do idx=1,max_rdiag_reals + ptr%p%rdiag( idx ) = 0.00 + end do + + if( allocated( Observation_Type )) ptr%p%rdiag( idx_obs_type_sst ) = Observation_Type( ii ) + if( allocated( Observation_Subtype )) ptr%p%rdiag( idx_obs_subtype_sst ) = Observation_Subtype( ii ) + if( allocated( Latitude )) ptr%p%rdiag( idx_obs_lat_sst ) = Latitude( ii ) + if( allocated( Longitude )) ptr%p%rdiag( idx_obs_lon_sst ) = Longitude( ii ) + if( allocated( Station_Elevation )) ptr%p%rdiag( idx_stn_elev_sst ) = Station_Elevation( ii ) + + if( allocated( Pressure )) ptr%p%rdiag( idx_opn_wtr_tmp_sst ) = Pressure( ii ) ! identified as background open water temperature in setupsst.f90 + + if( allocated( Height )) ptr%p%rdiag( idx_depth_sst ) = Height( ii ) ! identified as observation depth (meters) in setupsst.f90 + + if( allocated( Time )) ptr%p%rdiag( idx_time_sst ) = Time( ii ) + +! if( allocated( )) ptr%p%rdiag( idx_opn_wtr_pct_sst ) = Prep_QC_Mark( ii ) ! identified as open water percentage in setupsst.f90 + + if( allocated( Prep_QC_Mark )) ptr%p%rdiag( idx_setup_qc_sst ) = Prep_QC_Mark( ii ) + if( allocated( Prep_Use_Flag )) ptr%p%rdiag( idx_iuse_sst ) = Prep_Use_Flag( ii ) + if( allocated( Analysis_Use_Flag )) ptr%p%rdiag( idx_anl_use_sst ) = Analysis_Use_Flag( ii ) + if( allocated( Nonlinear_QC_Rel_Wgt )) ptr%p%rdiag( idx_rwgt_sst ) = Nonlinear_QC_Rel_Wgt( ii ) + if( allocated( Errinv_Input )) ptr%p%rdiag( idx_err_input_sst ) = Errinv_Input( ii ) + if( allocated( Errinv_Adjust )) ptr%p%rdiag( idx_errinv_sst ) = Errinv_Adjust( ii ) + if( allocated( Errinv_Final )) ptr%p%rdiag( idx_errinv_fnl_sst ) = Errinv_Final( ii ) + if( allocated( Observation )) ptr%p%rdiag( idx_obs_sst ) = Observation( ii ) + if( allocated( Obs_Minus_Forecast_adjusted )) ptr%p%rdiag( idx_omgbc_sst ) = Obs_Minus_Forecast_adjusted( ii ) + if( allocated( Obs_Minus_Forecast_unadjusted )) ptr%p%rdiag( idx_omgnbc_sst ) = Obs_Minus_Forecast_unadjusted( ii ) + +! if( allocated( )) ptr%p%rdiag( idx_type_sst ) = type of measurement? per setupsst.f90 + + if( allocated( FoundationTempBG )) ptr%p%rdiag( idx_tr_sst ) = FoundationTempBG( ii ) + if( allocated( DiurnalWarming_at_Zob )) ptr%p%rdiag( idx_dt_warm_sst ) = DiurnalWarming_at_zob( ii ) + if( allocated( SkinLayerCooling_at_zob )) ptr%p%rdiag( idx_dt_cool_sst ) = SkinLayerCooling_at_zob( ii ) + if( allocated( Sensitivity_Tzob_Tr )) ptr%p%rdiag( idx_dtz_dtr_sst ) = Sensitivity_Tzob_Tr( ii ) + + + if( nobs == 1 ) then + !------------------------------------------------- + ! Initialize the list with the first data element + ! + call list_init(list, transfer(ptr, list_data)) + next => list + + else + !------------------------------------------------- + ! Insert subsequent nodes into the list + ! + call list_insert(next, transfer(ptr, list_data)) + next => list_next(next) + end if + + end if + + end do + + + if( allocated( Station_ID )) deallocate( Station_ID ) + if( allocated( Observation_Class )) deallocate( Observation_Class ) + if( allocated( Observation_Type )) deallocate( Observation_Type ) + if( allocated( Observation_Subtype )) deallocate( Observation_Subtype ) + if( allocated( Latitude )) deallocate( Latitude ) + if( allocated( Longitude )) deallocate( Longitude ) + if( allocated( Station_Elevation )) deallocate( Station_Elevation ) + if( allocated( Time )) deallocate( Time ) + if( allocated( Prep_QC_Mark )) deallocate( Prep_QC_Mark ) + if( allocated( Prep_Use_Flag )) deallocate( Prep_Use_Flag ) + if( allocated( Nonlinear_QC_Var_Jb )) deallocate( Nonlinear_QC_Var_Jb ) + if( allocated( Nonlinear_QC_Rel_Wgt )) deallocate( Nonlinear_QC_Rel_Wgt ) + if( allocated( Analysis_Use_Flag )) deallocate( Analysis_Use_Flag ) + if( allocated( Errinv_Input )) deallocate( Errinv_Input ) + if( allocated( Errinv_Adjust )) deallocate( Errinv_Final ) + if( allocated( Errinv_Final )) deallocate( Errinv_Final ) + if( allocated( Observation )) deallocate( Observation ) + if( allocated( Obs_Minus_Forecast_adjusted )) deallocate( Obs_Minus_Forecast_adjusted ) + if( allocated( Obs_Minus_Forecast_unadjusted )) deallocate( Obs_Minus_Forecast_unadjusted ) + if( allocated( FoundationTempBG )) deallocate( FoundationTempBG ) + if( allocated( DiurnalWarming_at_zob )) deallocate( DiurnalWarming_at_zob ) + if( allocated( SkinLayerCooling_at_zob )) deallocate( SkinLayerCooling_at_zob ) + if( allocated( Sensitivity_Tzob_Tr )) deallocate( Sensitivity_Tzob_Tr ) + + print *, ' ' + print *, ' <-- read_diag_file_sst_nc' + + end subroutine read_diag_file_sst_nc + + + + !--------------------------------------------------------- + ! netcdf read routine for t data types in netcdf files + ! + subroutine read_diag_file_t_nc( input_file, return_all, ftin, ctype, intype, expected_nreal, nobs, in_subtype, list ) + + !--- interface + character(100), intent(in) :: input_file + logical, intent(in) :: return_all + integer, intent(in) :: ftin + character(3), intent(in) :: ctype + integer, intent(in) :: intype, expected_nreal, in_subtype + integer, intent(out) :: nobs + type(list_node_t), pointer :: list + + !--- local vars + type(list_node_t), pointer :: next => null() + type(data_ptr) :: ptr + integer :: ii, ierr, istatus, total_obs, idx, bcor_terms + logical :: have_subtype = .true. + logical :: add_obs + + !--- NetCDF file components dimension(s) + ! + character(len=:), dimension(:), allocatable :: Station_ID ! (nobs, Station_ID_maxstrlen) + character(len=:), dimension(:), allocatable :: Observation_Class ! (nobs, Station_Class_maxstrlen) + integer, dimension(:), allocatable :: Observation_Type ! (obs) + integer, dimension(:), allocatable :: Observation_Subtype ! (obs) + real(r_single), dimension(:), allocatable :: Latitude ! (obs) + real(r_single), dimension(:), allocatable :: Longitude ! (obs) + real(r_single), dimension(:), allocatable :: Station_Elevation ! (obs) + real(r_single), dimension(:), allocatable :: Pressure ! (obs) + real(r_single), dimension(:), allocatable :: Height ! (obs) + real(r_single), dimension(:), allocatable :: Time ! (obs) + real(r_single), dimension(:), allocatable :: Prep_QC_Mark ! (obs) + real(r_single), dimension(:), allocatable :: Prep_Use_Flag ! (obs) + real(r_single), dimension(:), allocatable :: Nonlinear_QC_Var_Jb ! (obs) + real(r_single), dimension(:), allocatable :: Nonlinear_QC_Rel_Wgt ! (obs) + real(r_single), dimension(:), allocatable :: Analysis_Use_Flag ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Input ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Adjust ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Final ! (obs) + real(r_single), dimension(:), allocatable :: Observation ! (obs) + real(r_single), dimension(:), allocatable :: Obs_Minus_Forecast_adjusted ! (obs) + real(r_single), dimension(:), allocatable :: Obs_Minus_Forecast_unadjusted ! (obs) + real(r_single), dimension(:), allocatable :: Data_Pof ! (obs) + real(r_single), dimension(:), allocatable :: Data_Vertical_Velocity ! (obs) + real(r_single), dimension(:,:), allocatable :: Bias_Correction_Terms ! (nobs, Bias_Correction_Terms_arr_dim) + integer(i_kind) :: idate + integer(i_kind) :: jj + + print *, ' ' + print *, ' --> read_diag_file_t_nc' + + print *, ' input_file = ', input_file + print *, ' ftin = ', ftin + print *, ' ctype = ', ctype + print *, ' intype = ', intype + print *, ' expected_nreal = ', expected_nreal + print *, ' in_subtype = ', in_subtype + + + !--- get NetCDF file dimensions + ! + if( nc_diag_read_check_dim( 'nobs' )) then + total_obs = nc_diag_read_get_dim(ftin,'nobs') + ncdiag_open_status(ii)%num_records = total_obs + else + print *, 'ERROR: unable to read nobs' + ierr=1 + end if + + if( nc_diag_read_check_dim( 'Bias_Correction_Terms_arr_dim' )) then + bcor_terms = nc_diag_read_get_dim(ftin,'Bias_Correction_Terms_arr_dim') + else + print *, 'ERROR: unable to read bcor_terms' + ierr=1 + end if + + + + !--- get vars + + call load_nc_var( 'Station_ID', ftin, Station_ID, ierr ) + call load_nc_var( 'Observation_Class', ftin, Observation_Class, ierr ) + call load_nc_var( 'Observation_Type', ftin, Observation_Type, ierr ) + call load_nc_var( 'Observation_Subtype', ftin, Observation_Subtype, ierr ) + if( ierr == 1 ) then + have_subtype = .false. + end if + + call load_nc_var( 'Latitude', ftin, Latitude, ierr ) + call load_nc_var( 'Longitude', ftin, Longitude, ierr ) + call load_nc_var( 'Station_Elevation', ftin, Station_Elevation, ierr ) + call load_nc_var( 'Pressure', ftin, Pressure, ierr ) + call load_nc_var( 'Height', ftin, Height, ierr ) + call load_nc_var( 'Time', ftin, Time, ierr ) + call load_nc_var( 'Prep_QC_Mark', ftin, Prep_QC_Mark, ierr ) + call load_nc_var( 'Nonlinear_QC_Var_Jb', ftin, Nonlinear_QC_Var_Jb, ierr ) + call load_nc_var( 'Nonlinear_QC_Rel_Wgt', ftin, Nonlinear_QC_Rel_Wgt, ierr ) + call load_nc_var( 'Prep_Use_Flag', ftin, Prep_Use_Flag, ierr ) + call load_nc_var( 'Analysis_Use_Flag', ftin, Analysis_Use_Flag, ierr ) + call load_nc_var( 'Errinv_Input', ftin, Errinv_Input, ierr ) + call load_nc_var( 'Errinv_Adjust', ftin, Errinv_Adjust, ierr ) + call load_nc_var( 'Errinv_Final', ftin, Errinv_Final, ierr ) + call load_nc_var( 'Observation', ftin, Observation, ierr ) + call load_nc_var( 'Obs_Minus_Forecast_adjusted', ftin, Obs_Minus_Forecast_adjusted, ierr ) + call load_nc_var( 'Obs_Minus_Forecast_unadjusted', ftin, Obs_Minus_Forecast_unadjusted, ierr ) + call load_nc_var( 'Data_Pof', ftin, Data_Pof, ierr ) + call load_nc_var( 'Data_Vertical_Velocity', ftin, Data_Vertical_Velocity, ierr ) + + if( nc_diag_read_check_var( 'Bias_Correction_Terms' )) then + call nc_diag_read_get_var( ftin, 'Bias_Correction_Terms', Bias_Correction_Terms ) + ierr = 0 + else + print *, 'ERROR: unable to read Bias_Correction_Terms' + ierr = 25 + end if + + + + !--------------------------------------------------------------- + ! Process all obs. If type and subtype match the input values + ! add this obs to the linked list (ptr%p). + ! + nobs = 0 + do ii = 1, total_obs + + !------------------------------------------------------------------------ + ! Check on Observation_Class to ctype is a sanity check -- + ! only a single class of obs are in any given NetCDF formatted diag file + ! but, if the ctype and input file don't match, things could get + ! interesting (but not in a good way). + ! + add_obs = .false. + + if( adjustl( trim( Observation_Class(ii) )) == adjustl( trim( ctype ))) then + + if( return_all == .true. ) then + add_obs = .true. + + else if( Observation_Type(ii) == intype ) then + + if( have_subtype == .false. ) then + add_obs = .true. + else if( Observation_Subtype(ii) == in_subtype ) then + add_obs = .true. + end if + + end if + end if + + if( add_obs == .true. ) then + + nobs=nobs+1 + + !--------------------------------------------- + ! Allocate a new data element and load + ! + allocate(ptr%p) + ptr%p%stn_id = Station_ID( ii ) + + do idx=1,max_rdiag_reals + ptr%p%rdiag( idx ) = 0.00 + end do + + if( allocated( Observation_Type )) ptr%p%rdiag( idx_obs_type_t ) = Observation_Type( ii ) + if( allocated( Observation_Subtype )) ptr%p%rdiag( idx_obs_subtype_t ) = Observation_Subtype( ii ) + if( allocated( Latitude )) ptr%p%rdiag( idx_obs_lat_t ) = Latitude( ii ) + if( allocated( Longitude )) ptr%p%rdiag( idx_obs_lon_t ) = Longitude( ii ) + if( allocated( Station_Elevation )) ptr%p%rdiag( idx_stn_elev_t ) = Station_Elevation( ii ) + if( allocated( Pressure )) ptr%p%rdiag( idx_pres_t ) = Pressure( ii ) + if( allocated( Height )) ptr%p%rdiag( idx_hgt_t ) = Height( ii ) + if( allocated( Time )) ptr%p%rdiag( idx_time_t ) = Time( ii ) + if( allocated( Prep_QC_Mark )) ptr%p%rdiag( idx_iqc_t ) = Prep_QC_Mark( ii ) + if( allocated( Nonlinear_QC_Var_Jb )) ptr%p%rdiag( idx_setup_qc_t ) = Nonlinear_QC_Var_Jb( ii ) + if( allocated( Prep_Use_Flag )) ptr%p%rdiag( idx_iuse_t ) = Prep_Use_Flag( ii ) + if( allocated( Analysis_Use_Flag )) ptr%p%rdiag( idx_anl_use_t ) = Analysis_Use_Flag( ii ) + if( allocated( Nonlinear_QC_Rel_Wgt )) ptr%p%rdiag( idx_rwgt_t ) = Nonlinear_QC_Rel_Wgt( ii ) + if( allocated( Errinv_Input )) ptr%p%rdiag( idx_err_input_t ) = Errinv_Input( ii ) + if( allocated( Errinv_Adjust )) ptr%p%rdiag( idx_errinv_t ) = Errinv_Adjust( ii ) + if( allocated( Errinv_Final )) ptr%p%rdiag( idx_errinv_fnl_t ) = Errinv_Final( ii ) + if( allocated( Observation )) ptr%p%rdiag( idx_obs_t ) = Observation( ii ) + if( allocated( Obs_Minus_Forecast_adjusted )) ptr%p%rdiag( idx_omgbc_t ) = Obs_Minus_Forecast_adjusted( ii ) + if( allocated( Obs_Minus_Forecast_unadjusted )) ptr%p%rdiag( idx_omgnbc_t ) = Obs_Minus_Forecast_unadjusted( ii ) + if( allocated( Data_Pof )) ptr%p%rdiag( idx_pof_t ) = Data_Pof( ii ) + if( allocated( Data_Vertical_Velocity )) ptr%p%rdiag( idx_vv_t ) = Data_Vertical_Velocity( ii ) + do jj = 1, bcor_terms + if( allocated( Bias_Correction_Terms )) ptr%p%rdiag( idx_vv_t+jj ) = Bias_Correction_Terms( jj,ii ) + end do + + if( nobs == 1 ) then + !------------------------------------------------- + ! Initialize the list with the first data element + ! + call list_init(list, transfer(ptr, list_data)) + next => list + + else + !------------------------------------------------- + ! Insert subsequent nodes into the list + ! + call list_insert(next, transfer(ptr, list_data)) + next => list_next(next) + + end if + + end if + + end do + + + if( allocated( Station_ID )) deallocate( Station_ID ) + if( allocated( Observation_Class )) deallocate( Observation_Class ) + if( allocated( Observation_Type )) deallocate( Observation_Type ) + if( allocated( Observation_Subtype )) deallocate( Observation_Subtype ) + if( allocated( Latitude )) deallocate( Latitude ) + if( allocated( Longitude )) deallocate( Longitude ) + if( allocated( Station_Elevation )) deallocate( Station_Elevation ) + if( allocated( Time )) deallocate( Time ) + if( allocated( Prep_QC_Mark )) deallocate( Prep_QC_Mark ) + if( allocated( Prep_Use_Flag )) deallocate( Prep_Use_Flag ) + if( allocated( Nonlinear_QC_Var_Jb )) deallocate( Nonlinear_QC_Var_Jb ) + if( allocated( Nonlinear_QC_Rel_Wgt )) deallocate( Nonlinear_QC_Rel_Wgt ) + if( allocated( Analysis_Use_Flag )) deallocate( Analysis_Use_Flag ) + if( allocated( Errinv_Input )) deallocate( Errinv_Input ) + if( allocated( Errinv_Adjust )) deallocate( Errinv_Final ) + if( allocated( Errinv_Final )) deallocate( Errinv_Final ) + if( allocated( Observation )) deallocate( Observation ) + if( allocated( Obs_Minus_Forecast_adjusted )) deallocate( Obs_Minus_Forecast_adjusted ) + if( allocated( Obs_Minus_Forecast_unadjusted )) deallocate( Obs_Minus_Forecast_unadjusted ) + + print *, ' ' + print *, ' <-- read_diag_file_t_nc' + + end subroutine read_diag_file_t_nc + + + + !--------------------------------------------------------- + ! netcdf read routine for uv data types in netcdf files + ! + subroutine read_diag_file_uv_nc( input_file, return_all, ftin, ctype, intype, expected_nreal, nobs, in_subtype, list ) + + !--- interface + character(100), intent(in) :: input_file + logical, intent(in) :: return_all + integer, intent(in) :: ftin + character(3), intent(in) :: ctype + integer, intent(in) :: intype, expected_nreal, in_subtype + integer, intent(out) :: nobs + type(list_node_t), pointer :: list + + !--- local vars + type(list_node_t), pointer :: next => null() + type(data_ptr) :: ptr + integer :: ii, ierr, istatus, total_obs, idx + logical :: have_subtype = .true. + logical :: add_obs + + !--- NetCDF file components dimension(s) + ! + character(len=:), dimension(:), allocatable :: Station_ID ! (nobs, Station_ID_maxstrlen) + character(len=:), dimension(:), allocatable :: Observation_Class ! (nobs, Station_Class_maxstrlen) + integer, dimension(:), allocatable :: Observation_Type ! (obs) + integer, dimension(:), allocatable :: Observation_Subtype ! (obs) + real(r_single), dimension(:), allocatable :: Latitude ! (obs) + real(r_single), dimension(:), allocatable :: Longitude ! (obs) + real(r_single), dimension(:), allocatable :: Station_Elevation ! (obs) + real(r_single), dimension(:), allocatable :: Pressure ! (obs) + real(r_single), dimension(:), allocatable :: Height ! (obs) + real(r_single), dimension(:), allocatable :: Time ! (obs) + real(r_single), dimension(:), allocatable :: Prep_QC_Mark ! (obs) + real(r_single), dimension(:), allocatable :: Setup_QC_Mark ! (obs) + real(r_single), dimension(:), allocatable :: Prep_Use_Flag ! (obs) + real(r_single), dimension(:), allocatable :: Nonlinear_QC_Rel_Wgt ! (obs) + real(r_single), dimension(:), allocatable :: Nonlinear_QC_Var_Jb ! (obs) + real(r_single), dimension(:), allocatable :: Analysis_Use_Flag ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Input ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Adjust ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Final ! (obs) + real(r_single), dimension(:), allocatable :: Wind_Reduction_Factor_at_10m ! (obs) + real(r_single), dimension(:), allocatable :: u_Observation ! (obs) + real(r_single), dimension(:), allocatable :: u_Obs_Minus_Forecast_adjusted ! (obs) + real(r_single), dimension(:), allocatable :: u_Obs_Minus_Forecast_unadjusted ! (obs) + real(r_single), dimension(:), allocatable :: v_Observation ! (obs) + real(r_single), dimension(:), allocatable :: v_Obs_Minus_Forecast_adjusted ! (obs) + real(r_single), dimension(:), allocatable :: v_Obs_Minus_Forecast_unadjusted ! (obs) + integer(i_kind) :: idate + + print *, ' ' + print *, ' --> read_diag_file_uv_nc' + + + !--- get NetCDF file dimensions + ! + if( nc_diag_read_check_dim( 'nobs' )) then + total_obs = nc_diag_read_get_dim(ftin,'nobs') + ncdiag_open_status(ii)%num_records = total_obs + print *, ' total_obs = ', total_obs + else + print *, 'ERROR: unable to read nobs' + ierr=1 + end if + + + !--- get vars + + call load_nc_var( 'Station_ID', ftin, Station_ID, ierr ) + call load_nc_var( 'Observation_Class', ftin, Observation_Class, ierr ) + call load_nc_var( 'Observation_Type', ftin, Observation_Type, ierr ) + call load_nc_var( 'Observation_Subtype', ftin, Observation_Subtype, ierr ) + if( ierr == 1 ) then + have_subtype = .false. + end if + call load_nc_var( 'Latitude', ftin, Latitude, ierr ) + call load_nc_var( 'Longitude', ftin, Longitude, ierr ) + call load_nc_var( 'Station_Elevation', ftin, Station_Elevation, ierr ) + call load_nc_var( 'Pressure', ftin, Pressure, ierr ) + call load_nc_var( 'Height', ftin, Height, ierr ) + call load_nc_var( 'Time', ftin, Time, ierr ) + call load_nc_var( 'Prep_QC_Mark', ftin, Prep_QC_Mark, ierr ) + call load_nc_var( 'Setup_QC_Mark', ftin, Setup_QC_Mark, ierr ) + call load_nc_var( 'Nonlinear_QC_Rel_Wgt', ftin, Nonlinear_QC_Rel_Wgt, ierr ) + call load_nc_var( 'Prep_Use_Flag', ftin, Prep_Use_Flag, ierr ) + call load_nc_var( 'Nonlinear_QC_Var_Jb', ftin, Nonlinear_QC_Var_Jb, ierr ) + call load_nc_var( 'Analysis_Use_Flag', ftin, Analysis_Use_Flag, ierr ) + call load_nc_var( 'Errinv_Input', ftin, Errinv_Input, ierr ) + call load_nc_var( 'Errinv_Adjust', ftin, Errinv_Adjust, ierr ) + call load_nc_var( 'Errinv_Final', ftin, Errinv_Final, ierr ) + call load_nc_var( 'Wind_Reduction_Factor_at_10m', ftin, Wind_Reduction_Factor_at_10m, ierr ) + call load_nc_var( 'u_Observation', ftin, u_Observation, ierr ) + call load_nc_var( 'u_Obs_Minus_Forecast_adjusted', ftin, u_Obs_Minus_Forecast_adjusted, ierr ) + call load_nc_var( 'u_Obs_Minus_Forecast_unadjusted', ftin, u_Obs_Minus_Forecast_unadjusted, ierr ) + call load_nc_var( 'v_Observation', ftin, v_Observation, ierr ) + call load_nc_var( 'v_Obs_Minus_Forecast_adjusted', ftin, v_Obs_Minus_Forecast_adjusted, ierr ) + call load_nc_var( 'v_Obs_Minus_Forecast_unadjusted', ftin, v_Obs_Minus_Forecast_unadjusted, ierr ) + + + !--------------------------------------------------------------- + ! Process all obs. If type and subtype match the input values + ! add this obs to the linked list (ptr%p). + ! + nobs = 0 + do ii = 1, total_obs + + + !------------------------------------------------------------------------ + ! Check on Observation_Class to ctype is a sanity check -- + ! only a single class of obs are in any given NetCDF formatted diag file + ! but, if the ctype and input file don't match, things could get + ! interesting (but not in a good way). + ! + add_obs = .false. + + if( adjustl( trim( Observation_Class(ii) )) == adjustl( trim( ctype ))) then + + if( return_all == .true. ) then + add_obs = .true. + + else if( Observation_Type(ii) == intype ) then + + if( have_subtype == .false. ) then + add_obs = .true. + else if( Observation_Subtype(ii) == in_subtype ) then + add_obs = .true. + end if + + end if + end if + + if( add_obs == .true. ) then + + nobs=nobs+1 + + !--------------------------------------------- + ! Allocate a new data element and load + ! + allocate(ptr%p) + ptr%p%stn_id = Station_ID( ii ) + + do idx=1,max_rdiag_reals + ptr%p%rdiag( idx ) = 0.00 + end do + + if( allocated( Observation_Type )) ptr%p%rdiag( idx_obs_type_uv ) = Observation_Type( ii ) + if( allocated( Observation_Subtype )) ptr%p%rdiag( idx_obs_subtype_uv ) = Observation_Subtype( ii ) + if( allocated( Latitude )) ptr%p%rdiag( idx_obs_lat_uv ) = Latitude( ii ) + if( allocated( Longitude )) ptr%p%rdiag( idx_obs_lon_uv ) = Longitude( ii ) + if( allocated( Station_Elevation )) ptr%p%rdiag( idx_stn_elev_uv ) = Station_Elevation( ii ) + if( allocated( Pressure )) ptr%p%rdiag( idx_pres_uv ) = Pressure( ii ) + if( allocated( Height )) ptr%p%rdiag( idx_hgt_uv ) = Height( ii ) + if( allocated( Time )) ptr%p%rdiag( idx_time_uv ) = Time( ii ) + if( allocated( Prep_QC_Mark )) ptr%p%rdiag( idx_iqc_uv ) = Prep_QC_Mark( ii ) + +! if( allocated( Nonlinear_QC_Var_JB )) ptr%p%rdiag( idx_setup_qc_uv ) = Nonlinear_QC_Var_Jb( ii ) ! missing from diagnostic file + + if( allocated( Prep_Use_Flag )) ptr%p%rdiag( idx_iuse_uv ) = Prep_Use_Flag( ii ) + if( allocated( Analysis_Use_Flag )) ptr%p%rdiag( idx_anl_use_uv ) = Analysis_Use_Flag( ii ) + if( allocated( Nonlinear_QC_Rel_Wgt )) ptr%p%rdiag( idx_rwgt_uv ) = Nonlinear_QC_Rel_Wgt( ii ) + if( allocated( Errinv_Input )) ptr%p%rdiag( idx_err_input_uv ) = Errinv_Input( ii ) + if( allocated( Errinv_Adjust )) ptr%p%rdiag( idx_errinv_uv ) = Errinv_Adjust( ii ) + if( allocated( Errinv_Final )) ptr%p%rdiag( idx_errinv_fnl_uv ) = Errinv_Final( ii ) + + if( allocated( u_Observation )) ptr%p%rdiag( idx_u_obs_uv ) = u_Observation( ii ) + if( allocated( u_Obs_Minus_Forecast_adjusted )) ptr%p%rdiag( idx_u_omgbc_uv ) = u_Obs_Minus_Forecast_adjusted( ii ) + if( allocated( u_Obs_Minus_Forecast_unadjusted )) ptr%p%rdiag( idx_u_omgnbc_uv ) = u_Obs_Minus_Forecast_unadjusted( ii ) + if( allocated( v_Observation )) ptr%p%rdiag( idx_v_obs_uv ) = v_Observation( ii ) + if( allocated( v_Obs_Minus_Forecast_adjusted )) ptr%p%rdiag( idx_v_omgbc_uv ) = v_Obs_Minus_Forecast_adjusted( ii ) + if( allocated( v_Obs_Minus_Forecast_unadjusted )) ptr%p%rdiag( idx_v_omgnbc_uv ) = v_Obs_Minus_Forecast_unadjusted( ii ) + + + if( nobs == 1 ) then + !------------------------------------------------- + ! Initialize the list with the first data element + ! + call list_init(list, transfer(ptr, list_data)) + next => list + + else + !------------------------------------------------- + ! Insert subsequent nodes into the list + ! + call list_insert(next, transfer(ptr, list_data)) + next => list_next(next) + end if + + end if + + end do + + + if( allocated( Station_ID )) deallocate( Station_ID ) + if( allocated( Observation_Class )) deallocate( Observation_Class ) + if( allocated( Observation_Type )) deallocate( Observation_Type ) + if( allocated( Observation_Subtype )) deallocate( Observation_Subtype ) + if( allocated( Latitude )) deallocate( Latitude ) + if( allocated( Longitude )) deallocate( Longitude ) + if( allocated( Station_Elevation )) deallocate( Station_Elevation ) + if( allocated( Time )) deallocate( Time ) + if( allocated( Prep_QC_Mark )) deallocate( Prep_QC_Mark ) + if( allocated( Prep_Use_Flag )) deallocate( Prep_Use_Flag ) + if( allocated( Nonlinear_QC_Var_Jb )) deallocate( Nonlinear_QC_Var_Jb ) + if( allocated( Nonlinear_QC_Rel_Wgt )) deallocate( Nonlinear_QC_Rel_Wgt ) + if( allocated( Analysis_Use_Flag )) deallocate( Analysis_Use_Flag ) + if( allocated( Errinv_Input )) deallocate( Errinv_Input ) + if( allocated( Errinv_Adjust )) deallocate( Errinv_Final ) + if( allocated( Errinv_Final )) deallocate( Errinv_Final ) + if( allocated( Wind_Reduction_Factor_at_10m )) deallocate( Wind_Reduction_Factor_at_10m ) + if( allocated( u_Observation )) deallocate( u_Observation ) + if( allocated( u_Obs_Minus_Forecast_adjusted )) deallocate( u_Obs_Minus_Forecast_adjusted ) + if( allocated( u_Obs_Minus_Forecast_unadjusted )) deallocate( u_Obs_Minus_Forecast_unadjusted ) + if( allocated( v_Observation )) deallocate( v_Observation ) + if( allocated( v_Obs_Minus_Forecast_adjusted )) deallocate( v_Obs_Minus_Forecast_adjusted ) + if( allocated( v_Obs_Minus_Forecast_unadjusted )) deallocate( v_Obs_Minus_Forecast_unadjusted ) + + print *, ' ' + print *, ' <-- read_diag_file_uv_nc' + + end subroutine read_diag_file_uv_nc + + + !----------------------------------------------------------- + ! netcdf read routine for gps data types in netcdf files + ! + ! NOTE1: This routine is untested. At present the ConMon + ! does not process gps data. There are plans to + ! change that though. + ! + ! NOTE2: There are known descrepencies between gps obs + ! in binary and NetCDF formatted diag files. See + ! comments below. + ! + subroutine read_diag_file_gps_nc( input_file, return_all, ftin, ctype, intype,expected_nreal,nobs,in_subtype, list ) + + !--- interface + character(100), intent(in) :: input_file + logical, intent(in) :: return_all + integer, intent(in) :: ftin + character(3), intent(in) :: ctype + integer, intent(in) :: intype, expected_nreal, in_subtype + integer, intent(out) :: nobs + type(list_node_t), pointer :: list + + !--- local vars + type(list_node_t), pointer :: next => null() + type(data_ptr) :: ptr + integer :: ii, ierr, istatus, total_obs, idx + logical :: have_subtype = .true. + logical :: add_obs + + !--- NetCDF file components dimension(s) + ! + character(len=:), dimension(:), allocatable :: Station_ID ! (nobs, Station_ID_maxstrlen) + character(len=:), dimension(:), allocatable :: Observation_Class ! (nobs, Station_Class_maxstrlen) + integer, dimension(:), allocatable :: Observation_Type ! (obs) + integer, dimension(:), allocatable :: Observation_Subtype ! (obs) + real(r_single), dimension(:), allocatable :: Latitude ! (obs) + real(r_single), dimension(:), allocatable :: Longitude ! (obs) + real(r_single), dimension(:), allocatable :: Incremental_Bending_Angle ! (obs) + real(r_single), dimension(:), allocatable :: Station_Elevation ! (obs) + real(r_single), dimension(:), allocatable :: Pressure ! (obs) + real(r_single), dimension(:), allocatable :: Height ! (obs) + real(r_single), dimension(:), allocatable :: Time ! (obs) + real(r_single), dimension(:), allocatable :: Model_Elevation ! (obs) + real(r_single), dimension(:), allocatable :: Setup_QC_Mark ! (obs) + real(r_single), dimension(:), allocatable :: Prep_Use_Flag ! (obs) + real(r_single), dimension(:), allocatable :: Nonlinear_QC_Var_Jb ! (obs) + real(r_single), dimension(:), allocatable :: Nonlinear_QC_Rel_Wgt ! (obs) + real(r_single), dimension(:), allocatable :: Analysis_Use_Flag ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Input ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Adjust ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Final ! (obs) + real(r_single), dimension(:), allocatable :: Observation ! (obs) + real(r_single), dimension(:), allocatable :: Obs_Minus_Forecast_adjusted ! (obs) + real(r_single), dimension(:), allocatable :: Obs_Minus_Forecast_unadjusted ! (obs) + real(r_single), dimension(:), allocatable :: GPS_Type ! (obs) + real(r_single), dimension(:), allocatable :: Temperature_at_Obs_Location ! (obs) + real(r_single), dimension(:), allocatable :: Specific_Humidity_at_Obs_Location ! (obs) + + integer(i_kind) :: idate + + + + print *, ' ' + print *, ' --> read_diag_file_gps_nc' + + + !--- get NetCDF file dimensions + ! + if( nc_diag_read_check_dim( 'nobs' )) then + total_obs = nc_diag_read_get_dim(ftin,'nobs') + ncdiag_open_status(ii)%num_records = total_obs + print *, ' total_obs = ', total_obs + else + print *, 'ERROR: unable to read nobs' + ierr=1 + end if + + + !--- get vars + + call load_nc_var( 'Station_ID', ftin, Station_ID, ierr ) + call load_nc_var( 'Observation_Class', ftin, Observation_Class, ierr ) + call load_nc_var( 'Observation_Type', ftin, Observation_Type, ierr ) + call load_nc_var( 'Observation_Subtype', ftin, Observation_Subtype, ierr ) + if( ierr == 1 ) then + have_subtype = .false. + end if + call load_nc_var( 'Latitude', ftin, Latitude, ierr ) + call load_nc_var( 'Longitude', ftin, Longitude, ierr ) + call load_nc_var( 'Incremental_Bending_Angle', ftin, Incremental_Bending_Angle, ierr ) + call load_nc_var( 'Pressure', ftin, Pressure, ierr ) + call load_nc_var( 'Height', ftin, Height, ierr ) + call load_nc_var( 'Time', ftin, Time, ierr ) + call load_nc_var( 'Model_Elevation', ftin, Model_Elevation, ierr ) + call load_nc_var( 'Setup_QC_Mark', ftin, Setup_QC_Mark, ierr ) + call load_nc_var( 'Prep_Use_Flag', ftin, Prep_Use_Flag, ierr ) + call load_nc_var( 'Analysis_Use_Flag', ftin, Analysis_Use_Flag, ierr ) + call load_nc_var( 'Nonlinear_QC_Rel_Wgt', ftin, Nonlinear_QC_Rel_Wgt, ierr ) + call load_nc_var( 'Errinv_Input', ftin, Errinv_Input, ierr ) + call load_nc_var( 'Errinv_Adjust', ftin, Errinv_Adjust, ierr ) + call load_nc_var( 'Errinv_Final', ftin, Errinv_Final, ierr ) + call load_nc_var( 'Observation', ftin, Observation, ierr ) + call load_nc_var( 'Obs_Minus_Forecast_adjusted', ftin, Obs_Minus_Forecast_adjusted, ierr ) + call load_nc_var( 'Obs_Minus_Forecast_unadjusted', ftin, Obs_Minus_Forecast_unadjusted, ierr ) + call load_nc_var( 'GPS_Type', ftin, GPS_Type, ierr ) + call load_nc_var( 'Temperature_at_Obs_Location', ftin, Temperature_at_Obs_Location, ierr ) + call load_nc_var( 'Specific_Humidity_at_Obs_Location', ftin, Specific_Humidity_at_Obs_Location, ierr ) + +! call load_nc_var( 'Nonlinear_QC_Var_Jb', ftin, Nonlinear_QC_Var_Jb, 13, ierr ) + + + + !--------------------------------------------------------------- + ! Process all obs. If type and subtype match the input values + ! add this obs to the linked list (ptr%p). + ! + nobs = 0 + do ii = 1, total_obs + + !------------------------------------------------------------------------ + ! Check on Observation_Class to ctype is a sanity check -- + ! only a single class of obs are in any given NetCDF formatted diag + ! file + ! but, if the ctype and input file don't match, things could get + ! interesting (but not in a good way). + ! + add_obs = .false. + + if( adjustl( trim( Observation_Class(ii) )) == adjustl( trim( ctype ))) then + + if( return_all == .true. ) then + add_obs = .true. + + else if( Observation_Type(ii) == intype ) then + + if( have_subtype == .false. ) then + add_obs = .true. + else if( Observation_Subtype(ii) == in_subtype ) then + add_obs = .true. + end if + + end if + end if + + if( add_obs == .true. ) then + + nobs=nobs+1 + + !--------------------------------------------- + ! Allocate a new data element and load + ! + allocate(ptr%p) + ptr%p%stn_id = Station_ID( ii ) + + do idx=1,max_rdiag_reals + ptr%p%rdiag( idx ) = 0.00 + end do + + if( allocated ( Observation_Type )) ptr%p%rdiag( idx_obs_type_gps ) = Observation_Type( ii ) + if( allocated ( Observation_Subtype )) ptr%p%rdiag( idx_obs_subtype_gps ) = Observation_Subtype( ii ) + if( allocated ( Latitude )) ptr%p%rdiag( idx_obs_lat_gps ) = Latitude( ii ) + if( allocated ( Longitude )) ptr%p%rdiag( idx_obs_lon_gps ) = Longitude( ii ) + if( allocated ( Incremental_Bending_Angle )) ptr%p%rdiag( idx_bend_ang_gps ) = Incremental_Bending_Angle( ii ) + if( allocated ( Pressure )) ptr%p%rdiag( idx_pres_gps ) = Pressure( ii ) + if( allocated ( Height )) ptr%p%rdiag( idx_height_gps ) = Height( ii ) + if( allocated ( Time )) ptr%p%rdiag( idx_time_gps ) = Time( ii ) + if( allocated ( Model_Elevation )) ptr%p%rdiag( idx_zsges_gps ) = Model_Elevation( ii ) + if( allocated ( Setup_QC_Mark )) ptr%p%rdiag( idx_setup_qc_gps ) = Setup_QC_Mark( ii ) + if( allocated ( Prep_Use_Flag )) ptr%p%rdiag( idx_iuse_gps ) = Prep_Use_Flag( ii ) + if( allocated ( Analysis_Use_Flag )) ptr%p%rdiag( idx_anl_use_gps ) = Analysis_Use_Flag( ii ) + if( allocated ( Nonlinear_QC_Rel_Wgt )) ptr%p%rdiag( idx_rwgt_gps ) = Nonlinear_QC_Rel_Wgt( ii ) + if( allocated ( Errinv_input )) ptr%p%rdiag( idx_err_input_gps ) = Errinv_Input( ii ) + if( allocated ( Errinv_Adjust )) ptr%p%rdiag( idx_errinv_gps ) = Errinv_Adjust( ii ) + if( allocated ( Errinv_Final )) ptr%p%rdiag( idx_errinv_fnl_gps ) = Errinv_Final( ii ) + + if( allocated ( Observation )) ptr%p%rdiag( idx_obs_gps ) = Observation( ii ) + if( allocated ( Temperature_at_Obs_Location )) ptr%p%rdiag( idx_tref_gps ) = Temperature_at_Obs_Location( ii ) +! if( allocated ( Obs_Minus_Forecast_unadjusted )) ptr%p%rdiag( idx_hob_gps ) = Obs_Minus_Forecast_unadjusted( ii ) + if( allocated ( GPS_Type )) ptr%p%rdiag( idx_uses_gps ) = GPS_Type( ii ) + if( allocated ( Specific_Humidity_at_Obs_Location )) ptr%p%rdiag( idx_qref_gps ) = Specific_Humidity_at_Obs_Location( ii ) + + + ! This oddity is from genstats_gps.f90 which produces the NetCDF + ! formatted diag file: + ! + ! call nc_diag_metadata("Obs_Minus_Forecast_adjusted", sngl(gps_allptr%rdiag(17))*sngl(gps_allptr%rdiag(5)) ) + ! call nc_diag_metadata("Obs_Minus_Forecast_unadjusted", sngl(gps_allptr%rdiag(17))*sngl(gps_allptr%rdiag(5)) ) + ! call nc_diag_metadata("GPS_Type", sngl(gps_allptr%rdiag(20)) ) + ! call nc_diag_metadata("Temperature_at_Obs_Location", sngl(gps_allptr%rdiag(18)) ) + ! + ! It would seem from this that rdiagbuf(19) is not used? + ! And also Obs_Minus_Forecast_[un|'']adjusted is derived and not stored. + ! + ! This from setupbend.f90: + ! rdiagbuf(18,i) = trefges ! temperature at obs location (Kelvin) if monotone grid + ! rdiagbuf(19,i) = hob ! model vertical grid (interface) if monotone grid + ! rdiagbuf(20,i) = one ! uses gps_ref (one = use of bending angle) + ! + + + if( nobs == 1 ) then + !------------------------------------------------- + ! Initialize the list with the first data element + ! + call list_init(list, transfer(ptr, list_data)) + next => list + + else + !------------------------------------------------- + ! Insert subsequent nodes into the list + ! + call list_insert(next, transfer(ptr, list_data)) + next => list_next(next) + + end if + + end if + + end do + + + if( allocated( Station_ID )) deallocate( Station_ID ) + if( allocated( Observation_Class )) deallocate( Observation_Class ) + if( allocated( Observation_Type )) deallocate( Observation_Type ) + if( allocated( Observation_Subtype )) deallocate( Observation_Subtype ) + if( allocated( Latitude )) deallocate( Latitude ) + if( allocated( Longitude )) deallocate( Longitude ) + if( allocated( Incremental_Bending_Angle )) deallocate( Incremental_Bending_Angle ) + if( allocated( Pressure )) deallocate( Pressure ) + if( allocated( Height )) deallocate( Height ) + if( allocated( Time )) deallocate( Time ) + if( allocated( Model_Elevation )) deallocate( Model_Elevation ) + if( allocated( Setup_QC_Mark )) deallocate( Setup_QC_Mark ) + if( allocated( Prep_Use_Flag )) deallocate( Prep_Use_Flag ) + if( allocated( Analysis_Use_Flag )) deallocate( Analysis_Use_Flag ) + if( allocated( Nonlinear_QC_Rel_Wgt )) deallocate( Nonlinear_QC_Rel_Wgt ) + if( allocated( Errinv_Input )) deallocate( Errinv_Input ) + if( allocated( Errinv_Adjust )) deallocate( Errinv_Final ) + if( allocated( Errinv_Final )) deallocate( Errinv_Final ) + if( allocated( Observation )) deallocate( Observation ) + if( allocated( Obs_Minus_Forecast_adjusted )) deallocate( Obs_Minus_Forecast_adjusted ) + if( allocated( Obs_Minus_Forecast_unadjusted )) deallocate( Obs_Minus_Forecast_unadjusted ) + if( allocated( GPS_Type )) deallocate( GPS_Type ) + if( allocated( Temperature_at_Obs_Location )) deallocate( Temperature_at_Obs_Location ) + if( allocated( Specific_Humidity_at_Obs_Location )) deallocate( Specific_Humidity_at_Obs_Location ) + + print *, ' ' + print *, ' <-- read_diag_file_gps_nc' + + end subroutine read_diag_file_gps_nc + + + + + !--- binary read routine + ! + subroutine read_diag_file_bin( input_file, return_all, ctype, intype,expected_nreal,nobs,in_subtype, list ) + + !--- interface + character(100), intent(in) :: input_file + logical, intent(in) :: return_all + character(3), intent(in) :: ctype + integer, intent(in) :: intype, expected_nreal, in_subtype + integer, intent(out) :: nobs + type(list_node_t), pointer :: list + + + !--- local vars + type(list_node_t), pointer :: next => null() + type(data_ptr) :: ptr + + real(4),allocatable,dimension(:,:) :: rdiag + character(8),allocatable,dimension(:) :: cdiag + + character(3) :: dtype + character(10) :: otype + character(15) :: fileo,fileo_subtyp + + integer nchar,file_nreal,i,ii,mype,idate,iflag,file_itype,iscater,igrads + integer lunin,lunot,ldtype,file_subtype + integer idx,ioff02 + + data lunin / 11 / + + nobs=0 + print *, ' --> read_diag_file_bin' + print *, ' ctype = ', ctype + print *, ' intype, in_subtype = ', intype, in_subtype + print *, ' expected_nreal = ', expected_nreal + + + !--- open diag file + open(lunin, file=input_file, form='unformatted') + rewind(lunin) + + read(lunin) idate + print *, 'idate=',idate + + loopd: do + + !--- read obs header + read(lunin,IOSTAT=iflag) dtype,nchar,file_nreal,ii,mype,ioff02 + + if( iflag /= 0 ) exit loopd + + !----------------------------------------------------- + ! exit loop if the number of reals (nreal) from file + ! doesn't match the target number + ! + if(( return_all == .true. ) .OR. ( trim(dtype) == trim(ctype) .and. file_nreal /= expected_nreal )) then + print *, 'matched observation type:',dtype,' file_nreal=', file_nreal + exit + endif + + !--------------------------------------------- + ! skip to next iteration if types don't match + ! + if(( return_all == .false. ) .AND. ( trim( dtype ) /= trim( ctype ))) then + cycle + endif + + + !--- read diag info + allocate(cdiag(ii),rdiag(file_nreal,ii)) + read(lunin,IOSTAT=iflag) cdiag,rdiag + + !--- exit loop on read error + if( iflag /= 0 ) then + deallocate( cdiag,rdiag ) + exit loopd + end if + + do i=1,ii + file_itype = int(rdiag(1,i)) + file_subtype = int(rdiag(2,i)) + + !------------------------------------------------ + ! if both types and subtypes match + ! then add a new data element + ! + if(( return_all == .true. ) .OR. ( file_itype == intype .AND. file_subtype == in_subtype )) then + + nobs=nobs+1 + + !--------------------------------------------- + ! Allocate a new data element and load + ! + allocate(ptr%p) + ptr%p%stn_id = cdiag(i) + + do idx=1,max_rdiag_reals + if( idx > file_nreal ) then + ptr%p%rdiag( idx ) = 0.00 + else + ptr%p%rdiag( idx ) = rdiag( idx,i ) + end if + end do + + if( nobs == 1 ) then + !------------------------------------------------- + ! Initialize the list with the first data element + ! + call list_init(list, transfer(ptr, list_data)) + next => list + + else + !------------------------------------------------- + ! Insert subsequent nodes into the list + ! + call list_insert(next, transfer(ptr, list_data)) + next => list_next(next) + + end if + + endif + + enddo + + deallocate(cdiag,rdiag) + enddo loopd ! ending read data do loop + + close(lunin) + + print *, 'nobs added to list = ', nobs + print *, ' <-- read_diag_file_bin' + + return + end subroutine read_diag_file_bin + + + + !------------------------------------------------ + ! function find_ncdiag_id + !------------------------------------------------ + integer( i_kind ) function find_ncdiag_id( ftin ) + + integer(i_kind), intent(in) :: ftin + + integer(i_kind) :: i + + find_ncdiag_id = -1 + do i = 1, MAX_OPEN_NCDIAG + if ( ncdiag_open_id(i) == ftin ) then + find_ncdiag_id = i + return + endif + enddo + + return + end function find_ncdiag_id + + +end module conmon_read_diag diff --git a/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_sig.fd/data_mod.f90 b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_sig.fd/data_mod.f90 new file mode 100644 index 0000000000..e611a9782e --- /dev/null +++ b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_sig.fd/data_mod.f90 @@ -0,0 +1,220 @@ +module data + implicit none + + private + public :: data_t + public :: data_ptr + + integer, parameter,public :: max_rdiag_reals = 25 + + !-------------------------------------------------- + ! generic index numbers into the rdiagbuf array + ! for _all_ data types + ! + integer, parameter, public :: idx_obs_type = 1 ! obs type + integer, parameter, public :: idx_obs_subtype = 2 ! obs subtype + integer, parameter, public :: idx_obs_lat = 3 ! obs latitude + integer, parameter, public :: idx_obs_lon = 4 ! obs longitude + integer, parameter, public :: idx_stn_elev = 5 ! stn elevation + integer, parameter, public :: idx_pres = 6 ! obs pressure + integer, parameter, public :: idx_time = 8 ! obs time (hrs relative to analysis time) + integer, parameter, public :: idx_rwgt = 13 ! non-linear qc relative weight + + + + !-------------------------------------------------- + ! index numbers into the rdiagbuf array + ! for type ps obs + ! + ! (see setupps.f90 for more info) + ! + integer, parameter, public :: idx_obs_type_ps = 1 ! obs type + integer, parameter, public :: idx_obs_subtype_ps = 2 ! obs subtype + integer, parameter, public :: idx_obs_lat_ps = 3 ! obs latitude + integer, parameter, public :: idx_obs_lon_ps = 4 ! obs longitude + integer, parameter, public :: idx_stn_elev_ps = 5 ! stn elevation + integer, parameter, public :: idx_pres_ps = 6 ! obs pressure (hPa) + integer, parameter, public :: idx_hgt_ps = 7 ! obs height (meters) + integer, parameter, public :: idx_time_ps = 8 ! obs time (hrs relative to analysis time) + integer, parameter, public :: idx_iqc_ps = 9 ! prepbufr qc or event mark + integer, parameter, public :: idx_var_jb_ps = 10 ! non-linear qc param + integer, parameter, public :: idx_iuse_ps = 11 ! read_prepbufr data usage flag + integer, parameter, public :: idx_anl_use_ps = 12 ! analysis usage flag + integer, parameter, public :: idx_rwgt_ps = 13 ! non-linear qc relative weight + integer, parameter, public :: idx_err_input_ps = 14 ! prepbufr invers obs error (hPa**-1) + integer, parameter, public :: idx_errinv_ps = 15 ! read_prepbufr invers obs error (hPa**-1) + integer, parameter, public :: idx_errinv_fnl_ps = 16 ! final invers obs error (HPa**-1) + integer, parameter, public :: idx_obs_ps = 17 ! surface pressure observation + integer, parameter, public :: idx_obsmg_adj_ps = 18 ! obs-ges used in analysis (coverted to hPa) + integer, parameter, public :: idx_obsmg_nadj_ps = 19 ! obs-ges w/o adjustment to guess surface pressure (hPa) + integer, parameter, public :: idx_spread_ps = 20 ! spread (filled in by EnKF) + + + !-------------------------------------------------- + ! index numbers into the rdiagbuf array + ! for type q obs + ! + ! (see setupq.f90 for more info) + ! + integer, parameter, public :: idx_obs_type_q = 1 ! obs type + integer, parameter, public :: idx_obs_subtype_q = 2 ! obs subtype + integer, parameter, public :: idx_obs_lat_q = 3 ! obs latitude + integer, parameter, public :: idx_obs_lon_q = 4 ! obs longitude + integer, parameter, public :: idx_stn_elev_q = 5 ! stn elevation + integer, parameter, public :: idx_pres_q = 6 ! obs pressure (hPa) + integer, parameter, public :: idx_hgt_q = 7 ! obs height (meters) + integer, parameter, public :: idx_time_q = 8 ! obs time (hrs relative to analysis time) + integer, parameter, public :: idx_iqc_q = 9 ! prepbufr qc or event mark + integer, parameter, public :: idx_var_jb_q = 10 ! non-linear qc param + integer, parameter, public :: idx_iuse_q = 11 ! read_prepbufr data usage flag + integer, parameter, public :: idx_anl_use_q = 12 ! analysis usage flag + integer, parameter, public :: idx_rwgt_q = 13 ! non-linear qc relative weight + integer, parameter, public :: idx_err_input_q = 14 ! prepbufr invers obs error + integer, parameter, public :: idx_errinv_q = 15 ! read_prepbufr invers obs error + integer, parameter, public :: idx_errinv_fnl_q = 16 ! final invers obs error + integer, parameter, public :: idx_obs_q = 17 ! surface pressure observation + integer, parameter, public :: idx_obsmg_adj_q = 18 ! obs-ges used in analysis + integer, parameter, public :: idx_obsmg_nadj_q = 19 ! obs-ges w/o adjustment to guess surface pressure + integer, parameter, public :: idx_ges_sat_q = 20 ! guess saturation specific + integer, parameter, public :: idx_spread_q = 21 ! spread (filled in by EnKF) + + + + !-------------------------------------------------- + ! index numbers into the rdiagbuf array + ! for type t obs + ! + ! (see setupt.f90 for more info) + ! + integer, parameter, public :: idx_obs_type_t = 1 ! obs type + integer, parameter, public :: idx_obs_subtype_t = 2 ! obs subtype + integer, parameter, public :: idx_obs_lat_t = 3 ! obs latitude + integer, parameter, public :: idx_obs_lon_t = 4 ! obs longitude + integer, parameter, public :: idx_stn_elev_t = 5 ! stn elevation + integer, parameter, public :: idx_pres_t = 6 ! obs pressure (hPa) + integer, parameter, public :: idx_hgt_t = 7 ! obs height (meters) + integer, parameter, public :: idx_time_t = 8 ! obs time (hrs relative to analysis time) + integer, parameter, public :: idx_iqc_t = 9 ! prepbufr qc or event mark + integer, parameter, public :: idx_setup_qc_t = 10 ! setup qc or event mark + integer, parameter, public :: idx_iuse_t = 11 ! read_prepbufr data usage flag + integer, parameter, public :: idx_anl_use_t = 12 ! analysis usage flag + integer, parameter, public :: idx_rwgt_t = 13 ! combination of var_jb and rwgt + integer, parameter, public :: idx_err_input_t = 14 ! prepbufr inverse obs error + integer, parameter, public :: idx_errinv_t = 15 ! read_prepbufr inverse obs error + integer, parameter, public :: idx_errinv_fnl_t = 16 ! final inverse obs error + integer, parameter, public :: idx_obs_t = 17 ! temperature obs (K) + integer, parameter, public :: idx_omgbc_t = 18 ! obs-ges used in analysis (K) + integer, parameter, public :: idx_omgnbc_t = 19 ! obs-ges w/o bias correction (K) + integer, parameter, public :: idx_pof_t = 20 ! data pof + integer, parameter, public :: idx_vv_t = 21 ! data vertical velocity + integer, parameter, public :: idx_pbias_one = 22 ! pred bias term 1 + integer, parameter, public :: idx_pbias_two = 23 ! pred bias term 2 + integer, parameter, public :: idx_pbias_three = 24 ! pred bias term 3 + integer, parameter, public :: idx_pbias_four = 25 ! pred bias term 4 + + + !-------------------------------------------------- + ! index numbers into the rdiagbuf array + ! for type uv obs + ! + ! (see setupw.f90 for more info) + ! + integer, parameter, public :: idx_obs_type_uv = 1 ! obs type + integer, parameter, public :: idx_obs_subtype_uv = 2 ! obs subtype + integer, parameter, public :: idx_obs_lat_uv = 3 ! obs latitude + integer, parameter, public :: idx_obs_lon_uv = 4 ! obs longitude + integer, parameter, public :: idx_stn_elev_uv = 5 ! stn elevation + integer, parameter, public :: idx_pres_uv = 6 ! obs pressure (hPa) + integer, parameter, public :: idx_hgt_uv = 7 ! obs height (meters) + integer, parameter, public :: idx_time_uv = 8 ! obs time (hrs relative to analysis time) + integer, parameter, public :: idx_iqc_uv = 9 ! prepbufr qc or event mark + integer, parameter, public :: idx_setup_qc_uv = 10 ! setup qc or event mark + integer, parameter, public :: idx_iuse_uv = 11 ! read_prepbufr data usage flag + integer, parameter, public :: idx_anl_use_uv = 12 ! analysis usage flag + integer, parameter, public :: idx_rwgt_uv = 13 ! combination of var_jb and rwgt + integer, parameter, public :: idx_err_input_uv = 14 ! prepbufr inverse obs error + integer, parameter, public :: idx_errinv_uv = 15 ! read_prepbufr inverse obs error + integer, parameter, public :: idx_errinv_fnl_uv = 16 ! final inverse obs error + integer, parameter, public :: idx_u_obs_uv = 17 ! u wind component observation + integer, parameter, public :: idx_u_omgbc_uv = 18 ! u obs-ges used in analysis (m/s) + integer, parameter, public :: idx_u_omgnbc_uv = 19 ! u obs-ges w/o bias correction (m/s) + integer, parameter, public :: idx_v_obs_uv = 20 ! v wind component observation + integer, parameter, public :: idx_v_omgbc_uv = 21 ! v obs-ges used in analysis (m/s) + integer, parameter, public :: idx_v_omgnbc_uv = 22 ! v obs-ges w/o bias correction (m/s) + + + !-------------------------------------------------- + ! index numbers into the rdiagbuf array + ! for type sst obs + ! + ! (see setupsst.f90 for more info) + ! + integer, parameter, public :: idx_obs_type_sst = 1 ! obs type + integer, parameter, public :: idx_obs_subtype_sst = 2 ! obs subtype + integer, parameter, public :: idx_obs_lat_sst = 3 ! obs latitude + integer, parameter, public :: idx_obs_lon_sst = 4 ! obs longitude + integer, parameter, public :: idx_stn_elev_sst = 5 ! stn elevation + integer, parameter, public :: idx_opn_wtr_tmp_sst = 6 ! background open water temperature + integer, parameter, public :: idx_depth_sst = 7 ! observation depth (meters) + integer, parameter, public :: idx_time_sst = 8 ! obs time (hrs relative to analysis time) + integer, parameter, public :: idx_opn_wtr_pct_sst = 9 ! open water percentage + integer, parameter, public :: idx_setup_qc_sst = 10 ! setup qc or event mark + integer, parameter, public :: idx_iuse_sst = 11 ! read_prepbufr data usage flag + integer, parameter, public :: idx_anl_use_sst = 12 ! analysis usage flag + integer, parameter, public :: idx_rwgt_sst = 13 ! combination of var_jb and rwgt + integer, parameter, public :: idx_err_input_sst = 14 ! prepbufr inverse obs error + integer, parameter, public :: idx_errinv_sst = 15 ! read_prepbufr inverse obs error + integer, parameter, public :: idx_errinv_fnl_sst = 16 ! final inverse obs error + integer, parameter, public :: idx_obs_sst = 17 ! SST observation (K) + integer, parameter, public :: idx_omgbc_sst = 18 ! obs-ges used in analysis (K) + integer, parameter, public :: idx_omgnbc_sst = 19 ! obs-ges w/o bias correction (K) + integer, parameter, public :: idx_type_sst = 20 ! type of measurment + integer, parameter, public :: idx_tr_sst = 21 ! Tr + integer, parameter, public :: idx_dt_warm_sst = 22 ! dt_warm at zob + integer, parameter, public :: idx_dt_cool_sst = 23 ! dt_cool at zob + integer, parameter, public :: idx_dtz_dtr_sst = 23 ! d(tz)/d(Tr) at zob + + + + !-------------------------------------------------- + ! index numbers into the rdiagbuf array + ! for type gps obs + ! + ! (see setupbend.f90 for more info) + ! + integer, parameter, public :: idx_obs_type_gps = 1 ! obs type + integer, parameter, public :: idx_obs_subtype_gps = 2 ! profile identifier + integer, parameter, public :: idx_obs_lat_gps = 3 ! obs latitude + integer, parameter, public :: idx_obs_lon_gps = 4 ! obs longitude + integer, parameter, public :: idx_bend_ang_gps = 5 ! incremental bending angle (x100 %) + integer, parameter, public :: idx_pres_gps = 6 ! pressure at obs location (hPa) + integer, parameter, public :: idx_height_gps = 7 ! impact height in meters + integer, parameter, public :: idx_time_gps = 8 ! obs time (hrs relative to analysis time) + integer, parameter, public :: idx_zsges_gps = 9 ! model terrain (m) + integer, parameter, public :: idx_setup_qc_gps = 10 ! setup qc or event mark + integer, parameter, public :: idx_iuse_gps = 11 ! read_prepbufr data usage flag + integer, parameter, public :: idx_anl_use_gps = 12 ! analysis usage flag + integer, parameter, public :: idx_rwgt_gps = 13 ! combination of var_jb and rwgt + integer, parameter, public :: idx_err_input_gps = 14 ! prepbufr inverse obs error + integer, parameter, public :: idx_errinv_gps = 15 ! read_prepbufr inverse obs error + integer, parameter, public :: idx_errinv_fnl_gps = 16 ! final inverse obs error + integer, parameter, public :: idx_obs_gps = 17 ! bending angle observation (radians) + integer, parameter, public :: idx_tref_gps = 18 ! temperature at obs location (K) + integer, parameter, public :: idx_hob_gps = 19 ! model vertival grid + integer, parameter, public :: idx_uses_gps = 20 ! uses gps_ref + integer, parameter, public :: idx_qref_gps = 21 ! specific humidity at obs location (kg/kg) + integer, parameter, public :: idx_spread_gps = 22 ! spread + + + ! Data is stored in data_t + type :: data_t + character(8) :: stn_id + real,dimension(25) :: rdiag + end type data_t + + ! A container for storing data_t pointers + type :: data_ptr + type(data_t), pointer :: p + end type data_ptr + +end module data diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_sig/generic_list.f90 b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_sig.fd/generic_list.f90 similarity index 100% rename from util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_sig/generic_list.f90 rename to util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_sig.fd/generic_list.f90 diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_sig/grads_sig.f90 b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_sig.fd/grads_sig.f90 similarity index 91% rename from util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_sig/grads_sig.f90 rename to util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_sig.fd/grads_sig.f90 index 1561b1d3e6..b07dc632a3 100644 --- a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_sig/grads_sig.f90 +++ b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_sig.fd/grads_sig.f90 @@ -5,7 +5,7 @@ ! scatter and horiz GrADS data files. !----------------------------------------------------------- -subroutine grads_sig(fileo,ifileo,nobs,nreal,nlev,plev,iscater,igrads,isubtype,subtype,list) +subroutine grads_sig(fileo,ifileo,nobs,nreal,nlev,plev,iscater,igrads,isubtype,subtype,list,run) use generic_list use data @@ -22,10 +22,10 @@ subroutine grads_sig(fileo,ifileo,nobs,nreal,nlev,plev,iscater,igrads,isubtype,s real(4),dimension(nlev) :: plev real(4) :: rlat,rlon - character(3) subtype + character(3) subtype, run character(8) :: stidend,stdid character(ifileo) :: fileo - character(30) :: files,filegrads + character(30) :: files,filegrads, file_nobs integer :: nobs,nreal,nlfag,nflag0,nlev,nlev0,getpro,iscater,igrads,obs_ctr real(4) :: rtim,xlat0,xlon0 @@ -67,13 +67,11 @@ subroutine grads_sig(fileo,ifileo,nobs,nreal,nlev,plev,iscater,igrads,isubtype,s ! Retrieve data from the linked list and load ! into the cdiag and rdiag arrays ! -! print *, 'Associated(list) = ', associated( list ) obs_ctr = 0 next => list do while ( associated( next ) == .TRUE. ) ptr = transfer(list_get( next ), ptr) -! print *, 'node data:', ptr%p next => list_next( next ) obs_ctr = obs_ctr + 1 @@ -96,14 +94,11 @@ subroutine grads_sig(fileo,ifileo,nobs,nreal,nlev,plev,iscater,igrads,isubtype,s print *, 'begin writing scatter data file' if(iscater == 1) then - files=trim(fileo)//'_'//trim(subtype)//'.scater' + files=trim(fileo)//'_'//trim(subtype)//'.scater.'//trim(run) open(51,file=files,form='unformatted') write(51) nobs,nreal_m2 write(51) rdiag_m2 -! print *, 'writing nobs, nreal =', nobs, nreal -! print *, 'writing rdiag_m2 =', rdiag_m2 - close(51) endif @@ -115,7 +110,7 @@ subroutine grads_sig(fileo,ifileo,nobs,nreal,nlev,plev,iscater,igrads,isubtype,s ! to write output if nobs == 0. Seg faults are uncool. ! if (igrads ==1 .AND. nobs > 0) then - filegrads=trim(fileo)//'_'//trim(subtype)//'_grads' + filegrads=trim(fileo)//'_'//trim(subtype)//'.grads.'//trim(run) open(21,file=filegrads,form='unformatted',status='new') ! open output file ilat = idx_obs_lat -2 ! modified position of lat @@ -148,8 +143,6 @@ subroutine grads_sig(fileo,ifileo,nobs,nreal,nlev,plev,iscater,igrads,isubtype,s write(21) plev(k),rdiag_m2(3:nreal_m2,i) ctr = ctr + 1 -! else -! print *, 'rdiag_m2(ipres,i), no match: ', rdiag_m2(ipres,i) endif endif enddo @@ -162,6 +155,11 @@ subroutine grads_sig(fileo,ifileo,nobs,nreal,nlev,plev,iscater,igrads,isubtype,s close(21) print *, 'num recs written to GrADS file = ', ctr + file_nobs=trim(fileo)//'_'//trim(subtype)//'.nobs.'//trim(run) + open( 32, file=file_nobs, form='formatted', status='new' ) + write(32,*) trim(fileo), ',', trim(subtype), ',', ctr + close( 32 ) + else write(6,*) "No output file generated, nobs, igrads = ", nobs, igrads endif diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radtime.fd/kinds.F90 b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_sig.fd/kinds.F90 similarity index 100% rename from util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radtime.fd/kinds.F90 rename to util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_sig.fd/kinds.F90 diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_sig/maingrads_sig.f90 b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_sig.fd/maingrads_sig.f90 similarity index 69% rename from util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_sig/maingrads_sig.f90 rename to util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_sig.fd/maingrads_sig.f90 index 528c6f0e0b..256cbe9630 100644 --- a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_sig/maingrads_sig.f90 +++ b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_sig.fd/maingrads_sig.f90 @@ -10,34 +10,24 @@ program maingrads_sig use generic_list use data + use conmon_read_diag implicit none - interface - - subroutine read_conv2grads(ctype,stype,itype,nreal,nobs,isubtype,subtype,list) - use generic_list - character(3) :: ctype - character(10) :: stype - integer :: itype - integer :: nreal - integer :: nobs - integer :: isubtype - character(3) :: subtype - type(list_node_t),pointer :: list - end subroutine read_conv2grads + interface subroutine grads_sig(fileo,ifileo,nobs,nreal,nlev,plev,iscater,igrads,isubtype, & - subtype,list) + subtype,list,run) use generic_list integer ifileo character(ifileo) :: fileo integer :: nobs,nreal,nlev,igrads,isubtype real(4),dimension(nlev) :: plev - character(3) subtype + character(3) :: subtype type(list_node_t), pointer :: list + character(3) :: run end subroutine grads_sig end interface @@ -56,11 +46,17 @@ end subroutine grads_sig type(data_ptr) :: ptr - namelist /input/intype,stype,itype,nreal,iscater,igrads,subtype,isubtype + !--- namelist with defaults + logical :: netcdf = .false. + character(100) :: input_file = "conv_diag" + character(3) :: run = "ges" + namelist /input/input_file,intype,stype,itype,nreal,iscater,igrads,subtype,isubtype,netcdf,run + data n_sig / 46 / -!---------------------------------------------------------------- -! the psig levels are used to match the level in the pgb files + !---------------------------------------------------------------- + ! the psig levels are used to match the level in the pgb files + ! data psig /997.,992.,985.,978.,970.,960.,950.,938.,& 925.,911.,895.,877.,850.,837.,814.,789.,762.,& 733.,700.,671.,638.,600.,570.,534.,500.,463.,& @@ -78,12 +74,15 @@ end subroutine grads_sig lstype=len_trim(stype) - call read_conv2grads(intype,stype,itype,nreal,nobs,isubtype,subtype,list) + write(6,*)'netcdf =', netcdf + call set_netcdf_read( netcdf ) + + call conmon_read_diag_file( input_file,intype,itype,nreal,nobs,isubtype,list ) if( nobs > 0 ) then call grads_sig(stype,lstype,nobs,nreal,n_sig,psig,iscater,igrads, & - isubtype,subtype,list) + isubtype,subtype,list, run) else print *, 'NOBS <= 0, NO OUTPUT GENERATED' end if diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_sig/makefile.grads_sig b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_sig.fd/makefile.grads_sig similarity index 97% rename from util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_sig/makefile.grads_sig rename to util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_sig.fd/makefile.grads_sig index 9851df8ea0..b8e7adbadf 100755 --- a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_sig/makefile.grads_sig +++ b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_sig.fd/makefile.grads_sig @@ -12,7 +12,7 @@ OBJS= data_mod.o generic_list.o maingrads_sig.o read_conv2grads.o grads_sig.o -CMD= grads_sig.x +CMD= conmon_grads_sig.x all: $(CMD) diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_mandlev/read_conv2grads.f90 b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_sig.fd/read_conv2grads.f90 similarity index 100% rename from util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_mandlev/read_conv2grads.f90 rename to util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_sig.fd/read_conv2grads.f90 diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_sig/rm_dups.f90 b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_sig.fd/rm_dups.f90 similarity index 100% rename from util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/grads_sig/rm_dups.f90 rename to util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_grads_sig.fd/rm_dups.f90 diff --git a/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_time.fd/CMakeLists.txt b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_time.fd/CMakeLists.txt new file mode 100644 index 0000000000..627129f2db --- /dev/null +++ b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_time.fd/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 2.6) + file(GLOB CONMON_TIME_SRC ${CMAKE_CURRENT_SOURCE_DIR}/*90 ) + set(CONMON_TIME_Fortran_FLAGS "-fp-model strict -assume byterecl -convert big_endian -O3 -traceback -D_REAL8_ ") + set(Util_MODULE_DIR ${PROJECT_BINARY_DIR}/include/conmon_time ) + + set_source_files_properties( ${CONMON_TIME_SRC} PROPERTIES COMPILE_FLAGS ${CONMON_TIME_Fortran_FLAGS} ) + add_executable(conmon_time.x ${CONMON_TIME_SRC} ) + set_target_properties( conmon_time.x PROPERTIES COMPILE_FLAGS ${CONMON_TIME_Fortran_FLAGS} ) + set_target_properties( conmon_time.x PROPERTIES Fortran_MODULE_DIRECTORY ${Util_MODULE_DIR} ) + + include_directories( ${CORE_INCS} ${NCDIAG_INCS} ) + + target_link_libraries( conmon_time.x ${W3NCO_4_LIBRARY} ${NCDIAG_LIBRARIES} ${NETCDF_Fortran_LIBRARIES} + ${NETCDF_C_LIBRARIES} ${MPI_Fortran_LIBRARIES} ) + + if(BUILD_W3NCO) + add_dependencies( conmon_time.x ${W3NCO_4_LIBRARY} ) + endif() + diff --git a/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_time.fd/conmon_read_diag.F90 b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_time.fd/conmon_read_diag.F90 new file mode 100644 index 0000000000..0b7afcf067 --- /dev/null +++ b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_time.fd/conmon_read_diag.F90 @@ -0,0 +1,1839 @@ +!---------------------------------------------------------------------- +! conmon_read_diag +! +! This subroutine reads the conventional data assimilation +! diagnostic files (contained in the cnvstat tar file) and returns +! the requested obs that match the input type and subtype in a +! linked list. The diagnostic files may be in either binary or +! NetCDF format. +! +! Note: +! There are problems/mismatches between the contents of binary +! and NetCDF files for types gps and sst. +!---------------------------------------------------------------------- + +module conmon_read_diag + + !--- use ---! + use generic_list + use data + use kinds, only: i_kind,r_single,r_kind + + use nc_diag_read_mod, only: nc_diag_read_init, nc_diag_read_close, & + nc_diag_read_get_dim, nc_diag_read_get_global_attr, & + nc_diag_read_get_var_names, & + nc_diag_read_get_global_attr_names, & + nc_diag_read_get_var, nc_diag_read_get_dim_names + + use ncdr_vars, only: nc_diag_read_check_var + use ncdr_dims, only: nc_diag_read_check_dim + + + !--- implicit ---! + implicit none + + + !--- public & private ---! + private + + public :: set_netcdf_read + public :: conmon_read_diag_file + public :: conmon_return_all_obs + + interface load_nc_var + module procedure load_nc_var_int, load_nc_var_real, load_nc_var_char + end interface + + + !--- common data structures ---! + logical,save :: netcdf = .false. + + integer(i_kind), parameter :: MAX_OPEN_NCDIAG = 2 + integer(i_kind), save :: nopen_ncdiag = 0 + integer(i_kind), dimension(MAX_OPEN_NCDIAG), save :: ncdiag_open_id = (/-1, -1/) + + type ncdiag_status + logical :: nc_read + integer(i_kind) :: cur_ob_idx + integer(i_kind) :: num_records + end type ncdiag_status + + type(ncdiag_status), dimension(MAX_OPEN_NCDIAG), save :: ncdiag_open_status + + + + contains + + + subroutine load_nc_var_int( var_name, ftin, var_storage, ierr ) + character(len=*), intent(in) :: var_name + integer, intent(in) :: ftin + integer, dimension(:), allocatable, intent(out) :: var_storage + integer, intent(out) :: ierr + + if( nc_diag_read_check_var( var_name )) then + call nc_diag_read_get_var( ftin, var_name, var_storage ) + ierr = 0 + else + print *, 'WARNING: unable to read ', trim( var_name ) + ierr = 1 + end if + end subroutine + + + subroutine load_nc_var_real( var_name, ftin, var_storage, ierr ) + character(len=*), intent(in) :: var_name + integer, intent(in) :: ftin + real(r_single), dimension(:), allocatable, intent(out) :: var_storage + integer, intent(out) :: ierr + + if( nc_diag_read_check_var( var_name )) then + call nc_diag_read_get_var( ftin, var_name, var_storage ) + ierr=0 + else + print *, 'WARNING: unable to read ', trim( var_name ) + ierr=1 + end if + end subroutine + + + subroutine load_nc_var_char( var_name, ftin, var_storage, ierr ) + character(len=*), intent(in) :: var_name + integer, intent(in) :: ftin + character(len=:), dimension(:), allocatable, intent(out) :: var_storage + integer, intent(out) :: ierr + + if( nc_diag_read_check_var( var_name )) then + call nc_diag_read_get_var( ftin, var_name, var_storage ) + ierr=0 + else + print *, 'WARNING: unable to read ', trim( var_name ) + ierr=1 + end if + end subroutine + + + + !------------------------------------------------------------ + ! set_netcdf_read + ! + ! set the use_netcdf flag to signal binary (default) or + ! netcdf formatted diagnostic files. + !------------------------------------------------------------ + subroutine set_netcdf_read( use_netcdf ) + logical,intent(in) :: use_netcdf + + netcdf = use_netcdf + + end subroutine set_netcdf_read + + + + !--------------------------------------------------------------- + ! conmon_read_diag_file + ! + ! Public routine to read a conventional diagnostic file + ! + ! Obs in the input_file are returned in the list according + ! to these rules: + ! + ! 1. All obs matching intype and in_subtype are returned. + ! + ! 2. If there are no subtype values in the input_file then + ! all obs matching intype are returned. + ! + !--------------------------------------------------------------- + subroutine conmon_read_diag_file( input_file, ctype, intype, expected_nreal, nobs, in_subtype, list ) + + !--- interface + character(100), intent(in) :: input_file + character(3), intent(in) :: ctype + + !--- note expected_nreal has no meaning for netcdf files + integer, intent(in) :: intype, expected_nreal, in_subtype + integer, intent(out) :: nobs + type(list_node_t), pointer :: list + logical :: return_all = .false. + + write(6,*)'--> conmon_read_diag_file' + + if ( netcdf ) then + write(6,*) ' call nc read subroutine' + call read_diag_file_nc( input_file, return_all, ctype, intype, expected_nreal, nobs, in_subtype, list ) + else + call read_diag_file_bin( input_file,return_all, ctype, intype, expected_nreal,nobs,in_subtype, list ) + end if + + write(6,*)"<-- conmon_read_diag_file" + + end subroutine conmon_read_diag_file + + + + !------------------------------------------------------------------ + ! conmon_return_all_obs + ! + ! Retrieve all obs from a given conventional diagnostic file. + ! Note that the NetCDF formatted diag files always contain only + ! one conventional data type (gps, ps, q, sst, t, uv), while + ! binary formatted diag files contain all types for a single + ! ges or anl run. + ! + ! Note: the ctype parameter only has meaning for NetCDF + ! formatted diag files. + !------------------------------------------------------------------ + subroutine conmon_return_all_obs( input_file, ctype, nobs, list ) + + !--- interface + character(100), intent(in) :: input_file + character(3), intent(in) :: ctype + integer, intent(out) :: nobs + type(list_node_t), pointer :: list + + logical :: return_all = .true. + integer :: intype, expected_nreal, in_subtype + + write(6,*)'--> conmon_return_all_obs' + nobs = 0 + + ! + ! Q: Can I re-use the read_diag_* to do this read, + ! adding extra param(s) to switch on _all_ obs? + ! Those routines are private to this module so + ! that wouldn't pose a complexity problem for + ! accessing the routines. + ! + if ( netcdf ) then + write(6,*) ' call nc retrieve all routine' + call read_diag_file_nc( input_file, return_all, ctype, intype, expected_nreal, nobs, in_subtype, list ) + else + write(6,*) ' call bin retrieve all routine' + call read_diag_file_bin( input_file,return_all, ctype, intype, expected_nreal,nobs,in_subtype, list ) + end if + + write(6,*)'<-- conmon_return_all_obs' + + end subroutine conmon_return_all_obs + + + !------------------------------- + ! read_diag_file_nc + ! + ! NetCDF read routine + !------------------------------- + subroutine read_diag_file_nc( input_file, return_all, ctype, intype, expected_nreal, nobs, in_subtype, list ) + + !--- interface + character(100), intent(in) :: input_file + logical, intent(in) :: return_all + character(3), intent(in) :: ctype + integer, intent(in) :: intype, expected_nreal, in_subtype + integer, intent(out) :: nobs + type(list_node_t), pointer :: list + + !--- local vars + type(list_node_t), pointer :: next => null() + type(data_ptr) :: ptr + integer :: ii, ierr, istatus, ftin, total_obs, id, idx + + data ftin / 11 / + + + print *, ' ' + print *, ' --> read_diag_file_nc' + print *, ' ctype, intype, in_subtype = ', ctype, intype, in_subtype + nobs = 0 + ierr = 0 + + if (nopen_ncdiag >= MAX_OPEN_NCDIAG) then + write(6,*) 'OPEN_RADIAG: ***ERROR*** Cannot open more than ', & + MAX_OPEN_NCDIAG, ' netcdf diag files.' + endif + + call nc_diag_read_init( input_file, ftin ) + istatus=0 + + do ii = 1, MAX_OPEN_NCDIAG + + if( ncdiag_open_id(ii) < 0 ) then + ncdiag_open_id(ii) = ftin + ncdiag_open_status(ii)%nc_read = .false. + + ncdiag_open_status(ii)%cur_ob_idx = -9999 + ncdiag_open_status(ii)%num_records = -9999 + nopen_ncdiag = nopen_ncdiag + 1 + exit + endif + + enddo + + select case ( trim( adjustl( ctype ) ) ) + + case ( 'gps' ) + call read_diag_file_gps_nc( input_file, return_all, ftin, ctype, intype, expected_nreal, nobs, in_subtype, list ) + + case ( 'ps' ) + call read_diag_file_ps_nc( input_file, return_all, ftin, ctype, intype, expected_nreal, nobs, in_subtype, list ) + + case ( 'q' ) + call read_diag_file_q_nc( input_file, return_all, ftin, ctype, intype, expected_nreal, nobs, in_subtype, list ) + + case ( 'sst' ) + call read_diag_file_sst_nc( input_file, return_all, ftin, ctype, intype, expected_nreal, nobs, in_subtype, list ) + + case ( 't' ) + call read_diag_file_t_nc( input_file, return_all, ftin, ctype, intype, expected_nreal, nobs, in_subtype, list ) + + case ( 'uv' ) + call read_diag_file_uv_nc( input_file, return_all, ftin, ctype, intype, expected_nreal, nobs, in_subtype, list ) + + case default + print *, 'ERROR: unmatched ctype :', ctype + + end select + + + id = find_ncdiag_id(ftin) + if (id < 0) then + write(6,*) 'CLOSE_RADIAG: ***ERROR*** ncdiag file ', input_file, & + ' was not opened' + endif + + call nc_diag_read_close( input_file ) + ncdiag_open_id(id) = -1 + + ncdiag_open_status(id)%nc_read = .false. + ncdiag_open_status(id)%cur_ob_idx = -9999 + ncdiag_open_status(id)%num_records = -9999 + + nopen_ncdiag = nopen_ncdiag - 1 + + print *, ' ' + print *, ' <-- read_diag_file_nc, ierr = ', ierr + + + end subroutine read_diag_file_nc + + + !--------------------------------------------------------- + ! netcdf read routine for ps data types in netcdf files + ! + subroutine read_diag_file_ps_nc( input_file, return_all, ftin, ctype, intype,expected_nreal,nobs,in_subtype, list ) + + !--- interface + character(100), intent(in) :: input_file + logical, intent(in) :: return_all + integer, intent(in) :: ftin + character(3), intent(in) :: ctype + integer, intent(in) :: intype, expected_nreal, in_subtype + integer, intent(out) :: nobs + type(list_node_t), pointer :: list + + !--- local vars + type(list_node_t), pointer :: next => null() + type(data_ptr) :: ptr + integer :: ii, ierr, istatus, total_obs, idx + logical :: have_subtype = .true. + logical :: add_obs + + !--- NetCDF file components dimension(s) + ! + character(len=:), dimension(:), allocatable :: Station_ID ! (nobs, Station_ID_maxstrlen) + character(len=:), dimension(:), allocatable :: Observation_Class ! (nobs, Station_Class_maxstrlen) + integer, dimension(:), allocatable :: Observation_Type ! (obs) + integer, dimension(:), allocatable :: Observation_Subtype ! (obs) + real(r_single), dimension(:), allocatable :: Latitude ! (obs) + real(r_single), dimension(:), allocatable :: Longitude ! (obs) + real(r_single), dimension(:), allocatable :: Station_Elevation ! (obs) + real(r_single), dimension(:), allocatable :: Pressure ! (obs) + real(r_single), dimension(:), allocatable :: Height ! (obs) + real(r_single), dimension(:), allocatable :: Time ! (obs) + real(r_single), dimension(:), allocatable :: Prep_QC_Mark ! (obs) + real(r_single), dimension(:), allocatable :: Prep_Use_Flag ! (obs) + real(r_single), dimension(:), allocatable :: Nonlinear_QC_Var_Jb ! (obs) + real(r_single), dimension(:), allocatable :: Nonlinear_QC_Rel_Wgt ! (obs) + real(r_single), dimension(:), allocatable :: Analysis_Use_Flag ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Input ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Adjust ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Final ! (obs) + real(r_single), dimension(:), allocatable :: Observation ! (obs) + real(r_single), dimension(:), allocatable :: Obs_Minus_Forecast_adjusted ! (obs) + real(r_single), dimension(:), allocatable :: Obs_Minus_Forecast_unadjusted ! (obs) + integer(i_kind) :: idate + + print *, ' ' + print *, ' --> read_diag_file_ps_nc' + + + !--- get NetCDF file dimensions + ! + if( nc_diag_read_check_dim( 'nobs' )) then + total_obs = nc_diag_read_get_dim(ftin,'nobs') + ncdiag_open_status(ii)%num_records = total_obs + print *, ' total_obs = ', total_obs + else + print *, 'ERROR: unable to read nobs' + ierr=1 + end if + + + !--- get vars + + call load_nc_var( 'Station_ID', ftin, Station_ID, ierr ) + call load_nc_var( 'Observation_Class', ftin, Observation_Class, ierr ) + call load_nc_var( 'Observation_Type', ftin, Observation_Type, ierr ) + call load_nc_var( 'Observation_Subtype', ftin, Observation_Subtype, ierr ) + if( ierr == 1 ) then + have_subtype = .false. + end if + call load_nc_var( 'Latitude', ftin, Latitude, ierr ) + call load_nc_var( 'Longitude', ftin, Longitude, ierr ) + call load_nc_var( 'Station_Elevation', ftin, Station_Elevation, ierr ) + call load_nc_var( 'Pressure', ftin, Pressure, ierr ) + call load_nc_var( 'Height', ftin, Height, ierr ) + call load_nc_var( 'Time', ftin, Time, ierr ) + call load_nc_var( 'Prep_QC_Mark', ftin, Prep_QC_Mark, ierr ) + call load_nc_var( 'Nonlinear_QC_Var_Jb', ftin, Nonlinear_QC_Var_Jb, ierr ) + call load_nc_var( 'Nonlinear_QC_Rel_Wgt', ftin, Nonlinear_QC_Rel_Wgt, ierr ) + call load_nc_var( 'Prep_Use_Flag', ftin, Prep_Use_Flag, ierr ) + call load_nc_var( 'Analysis_Use_Flag', ftin, Analysis_Use_Flag, ierr ) + call load_nc_var( 'Errinv_Input', ftin, Errinv_Input, ierr ) + call load_nc_var( 'Errinv_Adjust', ftin, Errinv_Adjust, ierr ) + call load_nc_var( 'Errinv_Final', ftin, Errinv_Final, ierr ) + call load_nc_var( 'Observation', ftin, Observation, ierr ) + call load_nc_var( 'Obs_Minus_Forecast_adjusted', ftin, Obs_Minus_Forecast_adjusted, ierr ) + call load_nc_var( 'Obs_Minus_Forecast_unadjusted', ftin, Obs_Minus_Forecast_unadjusted, ierr ) + + + + !--------------------------------------------------------------- + ! Process all obs. If type and subtype match the input values + ! add this obs to the linked list (ptr%p). + ! + nobs = 0 + do ii = 1, total_obs + + + add_obs = .false. + + !------------------------------------------------------------------------ + ! Check on Observation_Class to ctype is a sanity check -- + ! only a single class of obs are in any given NetCDF formatted diag file + ! but, if the ctype and input file don't match, things could get + ! interesting (but not in a good way). + ! + if( adjustl( trim( Observation_Class(ii) )) == adjustl( trim( ctype ))) then + + if( return_all == .true. ) then + add_obs = .true. + + else if( Observation_Type(ii) == intype ) then + + if( have_subtype == .false. ) then + add_obs = .true. + else if( Observation_Subtype(ii) == in_subtype ) then + add_obs = .true. + end if + + end if + end if + + if( add_obs == .true. ) then + + nobs=nobs+1 + + !--------------------------------------------- + ! Allocate a new data element and load + ! + allocate( ptr%p ) + ptr%p%stn_id = Station_ID( ii ) + + do idx=1,max_rdiag_reals + ptr%p%rdiag( idx ) = 0.00 + end do + + if( allocated( Observation_Type )) ptr%p%rdiag( idx_obs_type_ps ) = Observation_Type( ii ) + if( allocated( Observation_Subtype )) ptr%p%rdiag( idx_obs_subtype_ps ) = Observation_Subtype( ii ) + if( allocated( Latitude )) ptr%p%rdiag( idx_obs_lat_ps ) = Latitude( ii ) + if( allocated( Longitude )) ptr%p%rdiag( idx_obs_lon_ps ) = Longitude( ii ) + if( allocated( Station_Elevation )) ptr%p%rdiag( idx_stn_elev_ps ) = Station_Elevation( ii ) + if( allocated( Pressure )) ptr%p%rdiag( idx_pres_ps ) = Pressure( ii ) + if( allocated( Height )) ptr%p%rdiag( idx_hgt_ps ) = Height( ii ) + if( allocated( Time )) ptr%p%rdiag( idx_time_ps ) = Time( ii ) + if( allocated( Prep_QC_Mark )) ptr%p%rdiag( idx_iqc_ps ) = Prep_QC_Mark( ii ) + if( allocated( Nonlinear_QC_Var_Jb )) ptr%p%rdiag( idx_var_jb_ps ) = Nonlinear_QC_Var_Jb( ii ) + if( allocated( Prep_Use_Flag )) ptr%p%rdiag( idx_iuse_ps ) = Prep_Use_Flag( ii ) + if( allocated( Analysis_Use_Flag )) ptr%p%rdiag( idx_anl_use_ps ) = Analysis_Use_Flag( ii ) + if( allocated( Nonlinear_QC_Rel_Wgt )) ptr%p%rdiag( idx_rwgt_ps ) = Nonlinear_QC_Rel_Wgt( ii ) + if( allocated( Errinv_Input )) ptr%p%rdiag( idx_err_input_ps ) = Errinv_Input( ii ) + if( allocated( Errinv_Adjust )) ptr%p%rdiag( idx_errinv_ps ) = Errinv_Adjust( ii ) + if( allocated( Errinv_Final )) ptr%p%rdiag( idx_errinv_fnl_ps ) = Errinv_Final( ii ) + if( allocated( Observation )) ptr%p%rdiag( idx_obs_ps ) = Observation( ii ) + if( allocated( Obs_Minus_Forecast_adjusted )) ptr%p%rdiag( idx_obsmg_adj_ps ) = Obs_Minus_Forecast_adjusted( ii ) + if( allocated( Obs_Minus_Forecast_unadjusted )) ptr%p%rdiag( idx_obsmg_nadj_ps ) = Obs_Minus_Forecast_unadjusted( ii ) + + if( nobs == 1 ) then + !------------------------------------------------- + ! Initialize the list with the first data element + ! + call list_init(list, transfer(ptr, list_data)) + next => list + + else + !------------------------------------------------- + ! Insert subsequent nodes into the list + ! + call list_insert(next, transfer(ptr, list_data)) + next => list_next(next) + end if + + end if + + end do + + + if( allocated( Station_ID )) deallocate( Station_ID ) + if( allocated( Observation_Class )) deallocate( Observation_Class ) + if( allocated( Observation_Type )) deallocate( Observation_Type ) + if( allocated( Observation_Subtype )) deallocate( Observation_Subtype ) + if( allocated( Latitude )) deallocate( Latitude ) + if( allocated( Longitude )) deallocate( Longitude ) + if( allocated( Station_Elevation )) deallocate( Station_Elevation ) + if( allocated( Time )) deallocate( Time ) + if( allocated( Prep_QC_Mark )) deallocate( Prep_QC_Mark ) + if( allocated( Prep_Use_Flag )) deallocate( Prep_Use_Flag ) + if( allocated( Nonlinear_QC_Var_Jb )) deallocate( Nonlinear_QC_Var_Jb ) + if( allocated( Nonlinear_QC_Rel_Wgt )) deallocate( Nonlinear_QC_Rel_Wgt ) + if( allocated( Analysis_Use_Flag )) deallocate( Analysis_Use_Flag ) + if( allocated( Errinv_Input )) deallocate( Errinv_Input ) + if( allocated( Errinv_Adjust )) deallocate( Errinv_Final ) + if( allocated( Errinv_Final )) deallocate( Errinv_Final ) + if( allocated( Observation )) deallocate( Observation ) + if( allocated( Obs_Minus_Forecast_adjusted )) deallocate( Obs_Minus_Forecast_adjusted ) + if( allocated( Obs_Minus_Forecast_unadjusted )) deallocate( Obs_Minus_Forecast_unadjusted ) + + print *, ' ' + print *, ' <-- read_diag_file_ps_nc' + + end subroutine read_diag_file_ps_nc + + + !--------------------------------------------------------- + ! netcdf read routine for q data types in netcdf files + ! + subroutine read_diag_file_q_nc( input_file, return_all, ftin, ctype, intype,expected_nreal,nobs,in_subtype, list ) + + !--- interface + character(100), intent(in) :: input_file + logical, intent(in) :: return_all + integer, intent(in) :: ftin + character(3), intent(in) :: ctype + integer, intent(in) :: intype, expected_nreal, in_subtype + integer, intent(out) :: nobs + type(list_node_t), pointer :: list + + !--- local vars + type(list_node_t), pointer :: next => null() + type(data_ptr) :: ptr + integer :: ii, ierr, istatus, total_obs, idx + logical :: have_subtype = .true. + logical :: add_obs + + !--- NetCDF file components dimension(s) + ! + character(len=:), dimension(:), allocatable :: Station_ID ! (nobs, Station_ID_maxstrlen) + character(len=:), dimension(:), allocatable :: Observation_Class ! (nobs, Station_Class_maxstrlen) + integer, dimension(:), allocatable :: Observation_Type ! (obs) + integer, dimension(:), allocatable :: Observation_Subtype ! (obs) + real(r_single), dimension(:), allocatable :: Latitude ! (obs) + real(r_single), dimension(:), allocatable :: Longitude ! (obs) + real(r_single), dimension(:), allocatable :: Station_Elevation ! (obs) + real(r_single), dimension(:), allocatable :: Pressure ! (obs) + real(r_single), dimension(:), allocatable :: Height ! (obs) + real(r_single), dimension(:), allocatable :: Time ! (obs) + real(r_single), dimension(:), allocatable :: Prep_QC_Mark ! (obs) + real(r_single), dimension(:), allocatable :: Prep_Use_Flag ! (obs) + real(r_single), dimension(:), allocatable :: Nonlinear_QC_Var_Jb ! (obs) + real(r_single), dimension(:), allocatable :: Nonlinear_QC_Rel_Wgt ! (obs) + real(r_single), dimension(:), allocatable :: Analysis_Use_Flag ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Input ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Adjust ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Final ! (obs) + real(r_single), dimension(:), allocatable :: Observation ! (obs) + real(r_single), dimension(:), allocatable :: Obs_Minus_Forecast_adjusted ! (obs) + real(r_single), dimension(:), allocatable :: Obs_Minus_Forecast_unadjusted ! (obs) + real(r_single), dimension(:), allocatable :: Forecast_Saturation_Spec_Hum ! (obs) + integer(i_kind) :: idate + + print *, ' ' + print *, ' --> read_diag_file_q_nc' + + + !--- get NetCDF file dimensions + ! + if( nc_diag_read_check_dim( 'nobs' )) then + total_obs = nc_diag_read_get_dim(ftin,'nobs') + ncdiag_open_status(ii)%num_records = total_obs + print *, ' total_obs = ', total_obs + else + print *, 'ERROR: unable to read nobs' + ierr=1 + end if + + + !--- get vars + + call load_nc_var( 'Station_ID', ftin, Station_ID, ierr ) + call load_nc_var( 'Observation_Class', ftin, Observation_Class, ierr ) + call load_nc_var( 'Observation_Type', ftin, Observation_Type, ierr ) + call load_nc_var( 'Observation_Subtype', ftin, Observation_Subtype, ierr ) + if( ierr == 1 ) then + have_subtype = .false. + end if + call load_nc_var( 'Latitude', ftin, Latitude, ierr ) + call load_nc_var( 'Longitude', ftin, Longitude, ierr ) + call load_nc_var( 'Station_Elevation', ftin, Station_Elevation, ierr ) + call load_nc_var( 'Pressure', ftin, Pressure, ierr ) + call load_nc_var( 'Height', ftin, Height, ierr ) + call load_nc_var( 'Time', ftin, Time, ierr ) + call load_nc_var( 'Prep_QC_Mark', ftin, Prep_QC_Mark, ierr ) + call load_nc_var( 'Nonlinear_QC_Var_Jb', ftin, Nonlinear_QC_Var_Jb, ierr ) + call load_nc_var( 'Nonlinear_QC_Rel_Wgt', ftin, Nonlinear_QC_Rel_Wgt, ierr ) + call load_nc_var( 'Prep_Use_Flag', ftin, Prep_Use_Flag, ierr ) + call load_nc_var( 'Analysis_Use_Flag', ftin, Analysis_Use_Flag, ierr ) + call load_nc_var( 'Errinv_Input', ftin, Errinv_Input, ierr ) + call load_nc_var( 'Errinv_Adjust', ftin, Errinv_Adjust, ierr ) + call load_nc_var( 'Errinv_Final', ftin, Errinv_Final, ierr ) + call load_nc_var( 'Observation', ftin, Observation, ierr ) + call load_nc_var( 'Obs_Minus_Forecast_adjusted', ftin, Obs_Minus_Forecast_adjusted, ierr ) + call load_nc_var( 'Obs_Minus_Forecast_unadjusted', ftin, Obs_Minus_Forecast_unadjusted, ierr ) + call load_nc_var( 'Forecast_Saturation_Spec_Hum', ftin, Forecast_Saturation_Spec_Hum, ierr ) + + + + !--------------------------------------------------------------- + ! Process all obs. If type and subtype match the input values + ! add this obs to the linked list (ptr%p). + ! + nobs = 0 + do ii = 1, total_obs + + add_obs = .false. + + !------------------------------------------------------------------------ + ! Check on Observation_Class to ctype is a sanity check -- + ! only a single class of obs are in any given NetCDF formatted diag file + ! but, if the ctype and input file don't match, things could get + ! interesting (but not in a good way). + ! + if( adjustl( trim( Observation_Class(ii) )) == adjustl( trim( ctype ))) then + + if( return_all == .true. ) then + add_obs = .true. + + else if( Observation_Type(ii) == intype ) then + + if( have_subtype == .false. ) then + add_obs = .true. + else if( Observation_Subtype(ii) == in_subtype ) then + add_obs = .true. + end if + + end if + end if + + + if( add_obs == .true. ) then + + nobs=nobs+1 + + !--------------------------------------------- + ! Allocate a new data element and load + ! + allocate(ptr%p) + ptr%p%stn_id = Station_ID( ii ) + + do idx=1,max_rdiag_reals + ptr%p%rdiag( idx ) = 0.00 + end do + + if( allocated( Observation_Type )) ptr%p%rdiag( idx_obs_type_q ) = Observation_Type( ii ) + if( allocated( Observation_Subtype )) ptr%p%rdiag( idx_obs_subtype_q ) = Observation_Subtype( ii ) + if( allocated( Latitude )) ptr%p%rdiag( idx_obs_lat_q ) = Latitude( ii ) + if( allocated( Longitude )) ptr%p%rdiag( idx_obs_lon_q ) = Longitude( ii ) + if( allocated( Station_Elevation )) ptr%p%rdiag( idx_stn_elev_q ) = Station_Elevation( ii ) + if( allocated( Pressure )) ptr%p%rdiag( idx_pres_q ) = Pressure( ii ) + if( allocated( Height )) ptr%p%rdiag( idx_hgt_q ) = Height( ii ) + if( allocated( Time )) ptr%p%rdiag( idx_time_q ) = Time( ii ) + if( allocated( Prep_QC_Mark )) ptr%p%rdiag( idx_iqc_q ) = Prep_QC_Mark( ii ) + if( allocated( Nonlinear_QC_Var_Jb )) ptr%p%rdiag( idx_var_jb_q ) = Nonlinear_QC_Var_Jb( ii ) + if( allocated( Prep_Use_Flag )) ptr%p%rdiag( idx_iuse_q ) = Prep_Use_Flag( ii ) + if( allocated( Analysis_Use_Flag )) ptr%p%rdiag( idx_anl_use_q ) = Analysis_Use_Flag( ii ) + if( allocated( Nonlinear_QC_Rel_Wgt )) ptr%p%rdiag( idx_rwgt_q ) = Nonlinear_QC_Rel_Wgt( ii ) + if( allocated( Errinv_Input )) ptr%p%rdiag( idx_err_input_q ) = Errinv_Input( ii ) + if( allocated( Errinv_Adjust )) ptr%p%rdiag( idx_errinv_q ) = Errinv_Adjust( ii ) + if( allocated( Errinv_Final )) ptr%p%rdiag( idx_errinv_fnl_q ) = Errinv_Final( ii ) + if( allocated( Observation )) ptr%p%rdiag( idx_obs_q ) = Observation( ii ) + if( allocated( Obs_Minus_Forecast_adjusted )) ptr%p%rdiag( idx_obsmg_adj_q ) = Obs_Minus_Forecast_adjusted( ii ) + if( allocated( Obs_Minus_Forecast_unadjusted )) ptr%p%rdiag( idx_obsmg_nadj_q ) = Obs_Minus_Forecast_unadjusted( ii ) + if( allocated( Forecast_Saturation_Spec_Hum )) ptr%p%rdiag( idx_ges_sat_q ) = Forecast_Saturation_Spec_Hum( ii ) + + + if( nobs == 1 ) then + !------------------------------------------------- + ! Initialize the list with the first data element + ! + call list_init(list, transfer(ptr, list_data)) + next => list + + else + !------------------------------------------------- + ! Insert subsequent nodes into the list + ! + call list_insert(next, transfer(ptr, list_data)) + next => list_next(next) + end if + + end if + + end do + + + if( allocated( Station_ID )) deallocate( Station_ID ) + if( allocated( Observation_Class )) deallocate( Observation_Class ) + if( allocated( Observation_Type )) deallocate( Observation_Type ) + if( allocated( Observation_Subtype )) deallocate( Observation_Subtype ) + if( allocated( Latitude )) deallocate( Latitude ) + if( allocated( Longitude )) deallocate( Longitude ) + if( allocated( Station_Elevation )) deallocate( Station_Elevation ) + if( allocated( Time )) deallocate( Time ) + if( allocated( Prep_QC_Mark )) deallocate( Prep_QC_Mark ) + if( allocated( Prep_Use_Flag )) deallocate( Prep_Use_Flag ) + if( allocated( Nonlinear_QC_Var_Jb )) deallocate( Nonlinear_QC_Var_Jb ) + if( allocated( Nonlinear_QC_Rel_Wgt )) deallocate( Nonlinear_QC_Rel_Wgt ) + if( allocated( Analysis_Use_Flag )) deallocate( Analysis_Use_Flag ) + if( allocated( Errinv_Input )) deallocate( Errinv_Input ) + if( allocated( Errinv_Adjust )) deallocate( Errinv_Final ) + if( allocated( Errinv_Final )) deallocate( Errinv_Final ) + if( allocated( Observation )) deallocate( Observation ) + if( allocated( Obs_Minus_Forecast_adjusted )) deallocate( Obs_Minus_Forecast_adjusted ) + if( allocated( Obs_Minus_Forecast_unadjusted )) deallocate( Obs_Minus_Forecast_unadjusted ) + if( allocated( Forecast_Saturation_Spec_Hum )) deallocate( Forecast_Saturation_Spec_Hum ) + + print *, ' ' + print *, ' <-- read_diag_file_q_nc' + + end subroutine read_diag_file_q_nc + + + + !------------------------------------------------------------- + ! netcdf read routine for ps data types in netcdf files + ! + ! NOTE1: This routine is untested. The ConMon does not + ! currently process sst obs. + ! + ! NOTE2: There are known discrepencies between the contents + ! of sst obs in binary and NetCDF files. + ! + subroutine read_diag_file_sst_nc( input_file, return_all, ftin, ctype, intype,expected_nreal,nobs,in_subtype, list ) + + !--- interface + character(100), intent(in) :: input_file + logical, intent(in) :: return_all + integer, intent(in) :: ftin + character(3), intent(in) :: ctype + integer, intent(in) :: intype, expected_nreal, in_subtype + integer, intent(out) :: nobs + type(list_node_t), pointer :: list + + !--- local vars + type(list_node_t), pointer :: next => null() + type(data_ptr) :: ptr + integer :: ii, ierr, istatus, total_obs, idx + logical :: have_subtype = .true. + logical :: add_obs + + !--- NetCDF file components dimension(s) + ! + character(len=:), dimension(:), allocatable :: Station_ID ! (nobs, Station_ID_maxstrlen) + character(len=:), dimension(:), allocatable :: Observation_Class ! (nobs, Station_Class_maxstrlen) + integer, dimension(:), allocatable :: Observation_Type ! (obs) + integer, dimension(:), allocatable :: Observation_Subtype ! (obs) + real(r_single), dimension(:), allocatable :: Latitude ! (obs) + real(r_single), dimension(:), allocatable :: Longitude ! (obs) + real(r_single), dimension(:), allocatable :: Station_Elevation ! (obs) + real(r_single), dimension(:), allocatable :: Pressure ! (obs) + real(r_single), dimension(:), allocatable :: Height ! (obs) + real(r_single), dimension(:), allocatable :: Time ! (obs) + real(r_single), dimension(:), allocatable :: Prep_QC_Mark ! (obs) + real(r_single), dimension(:), allocatable :: Prep_Use_Flag ! (obs) + real(r_single), dimension(:), allocatable :: Nonlinear_QC_Var_Jb ! (obs) + real(r_single), dimension(:), allocatable :: Nonlinear_QC_Rel_Wgt ! (obs) + real(r_single), dimension(:), allocatable :: Analysis_Use_Flag ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Input ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Adjust ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Final ! (obs) + real(r_single), dimension(:), allocatable :: Observation ! (obs) + real(r_single), dimension(:), allocatable :: Obs_Minus_Forecast_adjusted ! (obs) + real(r_single), dimension(:), allocatable :: Obs_Minus_Forecast_unadjusted ! (obs) + real(r_single), dimension(:), allocatable :: FoundationTempBG ! (obs) + real(r_single), dimension(:), allocatable :: DiurnalWarming_at_zob ! (obs) + real(r_single), dimension(:), allocatable :: SkinLayerCooling_at_zob ! (obs) + real(r_single), dimension(:), allocatable :: Sensitivity_Tzob_Tr ! (obs) + integer(i_kind) :: idate + + print *, ' ' + print *, ' --> read_diag_file_sst_nc' + + + !--- get NetCDF file dimensions + ! + if( nc_diag_read_check_dim( 'nobs' )) then + total_obs = nc_diag_read_get_dim(ftin,'nobs') + ncdiag_open_status(ii)%num_records = total_obs + print *, ' total_obs = ', total_obs + else + print *, 'ERROR: unable to read nobs' + ierr=1 + end if + + + !--- get vars + + call load_nc_var( 'Station_ID', ftin, Station_ID, ierr ) + call load_nc_var( 'Observation_Class', ftin, Station_ID, ierr ) + call load_nc_var( 'Observation_Type', ftin, Observation_Type, ierr ) + call load_nc_var( 'Observation_Subtype', ftin, Observation_Subtype, ierr ) + if( ierr == 1 ) then + have_subtype = .false. + end if + call load_nc_var( 'Latitude', ftin, Latitude, ierr ) + call load_nc_var( 'Longitude', ftin, Longitude, ierr ) + call load_nc_var( 'Station_Elevation', ftin, Station_Elevation, ierr ) + call load_nc_var( 'Pressure', ftin, Pressure, ierr ) + call load_nc_var( 'Height', ftin, Height, ierr ) + call load_nc_var( 'Time', ftin, Time, ierr ) + call load_nc_var( 'Prep_QC_Mark', ftin, Prep_QC_Mark, ierr ) + call load_nc_var( 'Nonlinear_QC_Var_Jb', ftin, Nonlinear_QC_Var_Jb, ierr ) + call load_nc_var( 'Nonlinear_QC_Rel_Wgt', ftin, Nonlinear_QC_Rel_Wgt, ierr ) + call load_nc_var( 'Prep_Use_Flag', ftin, Prep_Use_Flag, ierr ) + call load_nc_var( 'Analysis_Use_Flag', ftin, Analysis_Use_Flag, ierr ) + call load_nc_var( 'Errinv_Input', ftin, Errinv_Input, ierr ) + call load_nc_var( 'Errinv_Adjust', ftin, Errinv_Adjust, ierr ) + call load_nc_var( 'Errinv_Final', ftin, Errinv_Final, ierr ) + call load_nc_var( 'Observation', ftin, Observation, ierr ) + call load_nc_var( 'Obs_Minus_Forecast_adjusted', ftin, Obs_Minus_Forecast_adjusted, ierr ) + call load_nc_var( 'Obs_Minus_Forecast_unadjusted', ftin, Obs_Minus_Forecast_unadjusted, ierr ) + call load_nc_var( 'FoundationTempBG', ftin, FoundationTempBG, ierr ) + call load_nc_var( 'DiurnalWarming_at_zob', ftin, DiurnalWarming_at_zob, ierr ) + call load_nc_var( 'SkinLayerCooling_at_zob', ftin, SkinLayerCooling_at_zob, ierr ) + call load_nc_var( 'Sensitivity_Tzob_Tr', ftin, Sensitivity_Tzob_Tr, ierr ) + + + + !--------------------------------------------------------------- + ! Process all obs. If type and subtype match the input values + ! add this obs to the linked list (ptr%p). + ! + nobs = 0 + do ii = 1, total_obs + + add_obs = .false. + + !------------------------------------------------------------------------ + ! Check on Observation_Class to ctype is a sanity check -- + ! only a single class of obs are in any given NetCDF formatted diag + ! file + ! but, if the ctype and input file don't match, things could get + ! interesting (but not in a good way). + ! + if( adjustl( trim( Observation_Class(ii) )) == adjustl( trim( ctype ))) then + + if( return_all == .true. ) then + add_obs = .true. + + else if( Observation_Type(ii) == intype ) then + + if( have_subtype == .false. ) then + add_obs = .true. + else if( Observation_Subtype(ii) == in_subtype ) then + add_obs = .true. + end if + + end if + end if + + + if( add_obs == .true. ) then + + nobs=nobs+1 + + !--------------------------------------------- + ! Allocate a new data element and load + ! + allocate( ptr%p ) + ptr%p%stn_id = Station_ID( ii ) + + do idx=1,max_rdiag_reals + ptr%p%rdiag( idx ) = 0.00 + end do + + if( allocated( Observation_Type )) ptr%p%rdiag( idx_obs_type_sst ) = Observation_Type( ii ) + if( allocated( Observation_Subtype )) ptr%p%rdiag( idx_obs_subtype_sst ) = Observation_Subtype( ii ) + if( allocated( Latitude )) ptr%p%rdiag( idx_obs_lat_sst ) = Latitude( ii ) + if( allocated( Longitude )) ptr%p%rdiag( idx_obs_lon_sst ) = Longitude( ii ) + if( allocated( Station_Elevation )) ptr%p%rdiag( idx_stn_elev_sst ) = Station_Elevation( ii ) + + if( allocated( Pressure )) ptr%p%rdiag( idx_opn_wtr_tmp_sst ) = Pressure( ii ) ! identified as background open water temperature in setupsst.f90 + + if( allocated( Height )) ptr%p%rdiag( idx_depth_sst ) = Height( ii ) ! identified as observation depth (meters) in setupsst.f90 + + if( allocated( Time )) ptr%p%rdiag( idx_time_sst ) = Time( ii ) + +! if( allocated( )) ptr%p%rdiag( idx_opn_wtr_pct_sst ) = Prep_QC_Mark( ii ) ! identified as open water percentage in setupsst.f90 + + if( allocated( Prep_QC_Mark )) ptr%p%rdiag( idx_setup_qc_sst ) = Prep_QC_Mark( ii ) + if( allocated( Prep_Use_Flag )) ptr%p%rdiag( idx_iuse_sst ) = Prep_Use_Flag( ii ) + if( allocated( Analysis_Use_Flag )) ptr%p%rdiag( idx_anl_use_sst ) = Analysis_Use_Flag( ii ) + if( allocated( Nonlinear_QC_Rel_Wgt )) ptr%p%rdiag( idx_rwgt_sst ) = Nonlinear_QC_Rel_Wgt( ii ) + if( allocated( Errinv_Input )) ptr%p%rdiag( idx_err_input_sst ) = Errinv_Input( ii ) + if( allocated( Errinv_Adjust )) ptr%p%rdiag( idx_errinv_sst ) = Errinv_Adjust( ii ) + if( allocated( Errinv_Final )) ptr%p%rdiag( idx_errinv_fnl_sst ) = Errinv_Final( ii ) + if( allocated( Observation )) ptr%p%rdiag( idx_obs_sst ) = Observation( ii ) + if( allocated( Obs_Minus_Forecast_adjusted )) ptr%p%rdiag( idx_omgbc_sst ) = Obs_Minus_Forecast_adjusted( ii ) + if( allocated( Obs_Minus_Forecast_unadjusted )) ptr%p%rdiag( idx_omgnbc_sst ) = Obs_Minus_Forecast_unadjusted( ii ) + +! if( allocated( )) ptr%p%rdiag( idx_type_sst ) = type of measurement? per setupsst.f90 + + if( allocated( FoundationTempBG )) ptr%p%rdiag( idx_tr_sst ) = FoundationTempBG( ii ) + if( allocated( DiurnalWarming_at_Zob )) ptr%p%rdiag( idx_dt_warm_sst ) = DiurnalWarming_at_zob( ii ) + if( allocated( SkinLayerCooling_at_zob )) ptr%p%rdiag( idx_dt_cool_sst ) = SkinLayerCooling_at_zob( ii ) + if( allocated( Sensitivity_Tzob_Tr )) ptr%p%rdiag( idx_dtz_dtr_sst ) = Sensitivity_Tzob_Tr( ii ) + + + if( nobs == 1 ) then + !------------------------------------------------- + ! Initialize the list with the first data element + ! + call list_init(list, transfer(ptr, list_data)) + next => list + + else + !------------------------------------------------- + ! Insert subsequent nodes into the list + ! + call list_insert(next, transfer(ptr, list_data)) + next => list_next(next) + end if + + end if + + end do + + + if( allocated( Station_ID )) deallocate( Station_ID ) + if( allocated( Observation_Class )) deallocate( Observation_Class ) + if( allocated( Observation_Type )) deallocate( Observation_Type ) + if( allocated( Observation_Subtype )) deallocate( Observation_Subtype ) + if( allocated( Latitude )) deallocate( Latitude ) + if( allocated( Longitude )) deallocate( Longitude ) + if( allocated( Station_Elevation )) deallocate( Station_Elevation ) + if( allocated( Time )) deallocate( Time ) + if( allocated( Prep_QC_Mark )) deallocate( Prep_QC_Mark ) + if( allocated( Prep_Use_Flag )) deallocate( Prep_Use_Flag ) + if( allocated( Nonlinear_QC_Var_Jb )) deallocate( Nonlinear_QC_Var_Jb ) + if( allocated( Nonlinear_QC_Rel_Wgt )) deallocate( Nonlinear_QC_Rel_Wgt ) + if( allocated( Analysis_Use_Flag )) deallocate( Analysis_Use_Flag ) + if( allocated( Errinv_Input )) deallocate( Errinv_Input ) + if( allocated( Errinv_Adjust )) deallocate( Errinv_Final ) + if( allocated( Errinv_Final )) deallocate( Errinv_Final ) + if( allocated( Observation )) deallocate( Observation ) + if( allocated( Obs_Minus_Forecast_adjusted )) deallocate( Obs_Minus_Forecast_adjusted ) + if( allocated( Obs_Minus_Forecast_unadjusted )) deallocate( Obs_Minus_Forecast_unadjusted ) + if( allocated( FoundationTempBG )) deallocate( FoundationTempBG ) + if( allocated( DiurnalWarming_at_zob )) deallocate( DiurnalWarming_at_zob ) + if( allocated( SkinLayerCooling_at_zob )) deallocate( SkinLayerCooling_at_zob ) + if( allocated( Sensitivity_Tzob_Tr )) deallocate( Sensitivity_Tzob_Tr ) + + print *, ' ' + print *, ' <-- read_diag_file_sst_nc' + + end subroutine read_diag_file_sst_nc + + + + !--------------------------------------------------------- + ! netcdf read routine for t data types in netcdf files + ! + subroutine read_diag_file_t_nc( input_file, return_all, ftin, ctype, intype, expected_nreal, nobs, in_subtype, list ) + + !--- interface + character(100), intent(in) :: input_file + logical, intent(in) :: return_all + integer, intent(in) :: ftin + character(3), intent(in) :: ctype + integer, intent(in) :: intype, expected_nreal, in_subtype + integer, intent(out) :: nobs + type(list_node_t), pointer :: list + + !--- local vars + type(list_node_t), pointer :: next => null() + type(data_ptr) :: ptr + integer :: ii, ierr, istatus, total_obs, idx, bcor_terms + logical :: have_subtype = .true. + logical :: add_obs + + !--- NetCDF file components dimension(s) + ! + character(len=:), dimension(:), allocatable :: Station_ID ! (nobs, Station_ID_maxstrlen) + character(len=:), dimension(:), allocatable :: Observation_Class ! (nobs, Station_Class_maxstrlen) + integer, dimension(:), allocatable :: Observation_Type ! (obs) + integer, dimension(:), allocatable :: Observation_Subtype ! (obs) + real(r_single), dimension(:), allocatable :: Latitude ! (obs) + real(r_single), dimension(:), allocatable :: Longitude ! (obs) + real(r_single), dimension(:), allocatable :: Station_Elevation ! (obs) + real(r_single), dimension(:), allocatable :: Pressure ! (obs) + real(r_single), dimension(:), allocatable :: Height ! (obs) + real(r_single), dimension(:), allocatable :: Time ! (obs) + real(r_single), dimension(:), allocatable :: Prep_QC_Mark ! (obs) + real(r_single), dimension(:), allocatable :: Prep_Use_Flag ! (obs) + real(r_single), dimension(:), allocatable :: Nonlinear_QC_Var_Jb ! (obs) + real(r_single), dimension(:), allocatable :: Nonlinear_QC_Rel_Wgt ! (obs) + real(r_single), dimension(:), allocatable :: Analysis_Use_Flag ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Input ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Adjust ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Final ! (obs) + real(r_single), dimension(:), allocatable :: Observation ! (obs) + real(r_single), dimension(:), allocatable :: Obs_Minus_Forecast_adjusted ! (obs) + real(r_single), dimension(:), allocatable :: Obs_Minus_Forecast_unadjusted ! (obs) + real(r_single), dimension(:), allocatable :: Data_Pof ! (obs) + real(r_single), dimension(:), allocatable :: Data_Vertical_Velocity ! (obs) + real(r_single), dimension(:,:), allocatable :: Bias_Correction_Terms ! (nobs, Bias_Correction_Terms_arr_dim) + integer(i_kind) :: idate + integer(i_kind) :: jj + + print *, ' ' + print *, ' --> read_diag_file_t_nc' + + print *, ' input_file = ', input_file + print *, ' ftin = ', ftin + print *, ' ctype = ', ctype + print *, ' intype = ', intype + print *, ' expected_nreal = ', expected_nreal + print *, ' in_subtype = ', in_subtype + + + !--- get NetCDF file dimensions + ! + if( nc_diag_read_check_dim( 'nobs' )) then + total_obs = nc_diag_read_get_dim(ftin,'nobs') + ncdiag_open_status(ii)%num_records = total_obs + else + print *, 'ERROR: unable to read nobs' + ierr=1 + end if + + if( nc_diag_read_check_dim( 'Bias_Correction_Terms_arr_dim' )) then + bcor_terms = nc_diag_read_get_dim(ftin,'Bias_Correction_Terms_arr_dim') + else + print *, 'ERROR: unable to read bcor_terms' + ierr=1 + end if + + + + !--- get vars + + call load_nc_var( 'Station_ID', ftin, Station_ID, ierr ) + call load_nc_var( 'Observation_Class', ftin, Observation_Class, ierr ) + call load_nc_var( 'Observation_Type', ftin, Observation_Type, ierr ) + call load_nc_var( 'Observation_Subtype', ftin, Observation_Subtype, ierr ) + if( ierr == 1 ) then + have_subtype = .false. + end if + + call load_nc_var( 'Latitude', ftin, Latitude, ierr ) + call load_nc_var( 'Longitude', ftin, Longitude, ierr ) + call load_nc_var( 'Station_Elevation', ftin, Station_Elevation, ierr ) + call load_nc_var( 'Pressure', ftin, Pressure, ierr ) + call load_nc_var( 'Height', ftin, Height, ierr ) + call load_nc_var( 'Time', ftin, Time, ierr ) + call load_nc_var( 'Prep_QC_Mark', ftin, Prep_QC_Mark, ierr ) + call load_nc_var( 'Nonlinear_QC_Var_Jb', ftin, Nonlinear_QC_Var_Jb, ierr ) + call load_nc_var( 'Nonlinear_QC_Rel_Wgt', ftin, Nonlinear_QC_Rel_Wgt, ierr ) + call load_nc_var( 'Prep_Use_Flag', ftin, Prep_Use_Flag, ierr ) + call load_nc_var( 'Analysis_Use_Flag', ftin, Analysis_Use_Flag, ierr ) + call load_nc_var( 'Errinv_Input', ftin, Errinv_Input, ierr ) + call load_nc_var( 'Errinv_Adjust', ftin, Errinv_Adjust, ierr ) + call load_nc_var( 'Errinv_Final', ftin, Errinv_Final, ierr ) + call load_nc_var( 'Observation', ftin, Observation, ierr ) + call load_nc_var( 'Obs_Minus_Forecast_adjusted', ftin, Obs_Minus_Forecast_adjusted, ierr ) + call load_nc_var( 'Obs_Minus_Forecast_unadjusted', ftin, Obs_Minus_Forecast_unadjusted, ierr ) + call load_nc_var( 'Data_Pof', ftin, Data_Pof, ierr ) + call load_nc_var( 'Data_Vertical_Velocity', ftin, Data_Vertical_Velocity, ierr ) + + if( nc_diag_read_check_var( 'Bias_Correction_Terms' )) then + call nc_diag_read_get_var( ftin, 'Bias_Correction_Terms', Bias_Correction_Terms ) + ierr = 0 + else + print *, 'ERROR: unable to read Bias_Correction_Terms' + ierr = 25 + end if + + + + !--------------------------------------------------------------- + ! Process all obs. If type and subtype match the input values + ! add this obs to the linked list (ptr%p). + ! + nobs = 0 + do ii = 1, total_obs + + !------------------------------------------------------------------------ + ! Check on Observation_Class to ctype is a sanity check -- + ! only a single class of obs are in any given NetCDF formatted diag file + ! but, if the ctype and input file don't match, things could get + ! interesting (but not in a good way). + ! + add_obs = .false. + + if( adjustl( trim( Observation_Class(ii) )) == adjustl( trim( ctype ))) then + + if( return_all == .true. ) then + add_obs = .true. + + else if( Observation_Type(ii) == intype ) then + + if( have_subtype == .false. ) then + add_obs = .true. + else if( Observation_Subtype(ii) == in_subtype ) then + add_obs = .true. + end if + + end if + end if + + if( add_obs == .true. ) then + + nobs=nobs+1 + + !--------------------------------------------- + ! Allocate a new data element and load + ! + allocate(ptr%p) + ptr%p%stn_id = Station_ID( ii ) + + do idx=1,max_rdiag_reals + ptr%p%rdiag( idx ) = 0.00 + end do + + if( allocated( Observation_Type )) ptr%p%rdiag( idx_obs_type_t ) = Observation_Type( ii ) + if( allocated( Observation_Subtype )) ptr%p%rdiag( idx_obs_subtype_t ) = Observation_Subtype( ii ) + if( allocated( Latitude )) ptr%p%rdiag( idx_obs_lat_t ) = Latitude( ii ) + if( allocated( Longitude )) ptr%p%rdiag( idx_obs_lon_t ) = Longitude( ii ) + if( allocated( Station_Elevation )) ptr%p%rdiag( idx_stn_elev_t ) = Station_Elevation( ii ) + if( allocated( Pressure )) ptr%p%rdiag( idx_pres_t ) = Pressure( ii ) + if( allocated( Height )) ptr%p%rdiag( idx_hgt_t ) = Height( ii ) + if( allocated( Time )) ptr%p%rdiag( idx_time_t ) = Time( ii ) + if( allocated( Prep_QC_Mark )) ptr%p%rdiag( idx_iqc_t ) = Prep_QC_Mark( ii ) + if( allocated( Nonlinear_QC_Var_Jb )) ptr%p%rdiag( idx_setup_qc_t ) = Nonlinear_QC_Var_Jb( ii ) + if( allocated( Prep_Use_Flag )) ptr%p%rdiag( idx_iuse_t ) = Prep_Use_Flag( ii ) + if( allocated( Analysis_Use_Flag )) ptr%p%rdiag( idx_anl_use_t ) = Analysis_Use_Flag( ii ) + if( allocated( Nonlinear_QC_Rel_Wgt )) ptr%p%rdiag( idx_rwgt_t ) = Nonlinear_QC_Rel_Wgt( ii ) + if( allocated( Errinv_Input )) ptr%p%rdiag( idx_err_input_t ) = Errinv_Input( ii ) + if( allocated( Errinv_Adjust )) ptr%p%rdiag( idx_errinv_t ) = Errinv_Adjust( ii ) + if( allocated( Errinv_Final )) ptr%p%rdiag( idx_errinv_fnl_t ) = Errinv_Final( ii ) + if( allocated( Observation )) ptr%p%rdiag( idx_obs_t ) = Observation( ii ) + if( allocated( Obs_Minus_Forecast_adjusted )) ptr%p%rdiag( idx_omgbc_t ) = Obs_Minus_Forecast_adjusted( ii ) + if( allocated( Obs_Minus_Forecast_unadjusted )) ptr%p%rdiag( idx_omgnbc_t ) = Obs_Minus_Forecast_unadjusted( ii ) + if( allocated( Data_Pof )) ptr%p%rdiag( idx_pof_t ) = Data_Pof( ii ) + if( allocated( Data_Vertical_Velocity )) ptr%p%rdiag( idx_vv_t ) = Data_Vertical_Velocity( ii ) + do jj = 1, bcor_terms + if( allocated( Bias_Correction_Terms )) ptr%p%rdiag( idx_vv_t+jj ) = Bias_Correction_Terms( jj,ii ) + end do + + if( nobs == 1 ) then + !------------------------------------------------- + ! Initialize the list with the first data element + ! + call list_init(list, transfer(ptr, list_data)) + next => list + + else + !------------------------------------------------- + ! Insert subsequent nodes into the list + ! + call list_insert(next, transfer(ptr, list_data)) + next => list_next(next) + + end if + + end if + + end do + + + if( allocated( Station_ID )) deallocate( Station_ID ) + if( allocated( Observation_Class )) deallocate( Observation_Class ) + if( allocated( Observation_Type )) deallocate( Observation_Type ) + if( allocated( Observation_Subtype )) deallocate( Observation_Subtype ) + if( allocated( Latitude )) deallocate( Latitude ) + if( allocated( Longitude )) deallocate( Longitude ) + if( allocated( Station_Elevation )) deallocate( Station_Elevation ) + if( allocated( Time )) deallocate( Time ) + if( allocated( Prep_QC_Mark )) deallocate( Prep_QC_Mark ) + if( allocated( Prep_Use_Flag )) deallocate( Prep_Use_Flag ) + if( allocated( Nonlinear_QC_Var_Jb )) deallocate( Nonlinear_QC_Var_Jb ) + if( allocated( Nonlinear_QC_Rel_Wgt )) deallocate( Nonlinear_QC_Rel_Wgt ) + if( allocated( Analysis_Use_Flag )) deallocate( Analysis_Use_Flag ) + if( allocated( Errinv_Input )) deallocate( Errinv_Input ) + if( allocated( Errinv_Adjust )) deallocate( Errinv_Final ) + if( allocated( Errinv_Final )) deallocate( Errinv_Final ) + if( allocated( Observation )) deallocate( Observation ) + if( allocated( Obs_Minus_Forecast_adjusted )) deallocate( Obs_Minus_Forecast_adjusted ) + if( allocated( Obs_Minus_Forecast_unadjusted )) deallocate( Obs_Minus_Forecast_unadjusted ) + + print *, ' ' + print *, ' <-- read_diag_file_t_nc' + + end subroutine read_diag_file_t_nc + + + + !--------------------------------------------------------- + ! netcdf read routine for uv data types in netcdf files + ! + subroutine read_diag_file_uv_nc( input_file, return_all, ftin, ctype, intype, expected_nreal, nobs, in_subtype, list ) + + !--- interface + character(100), intent(in) :: input_file + logical, intent(in) :: return_all + integer, intent(in) :: ftin + character(3), intent(in) :: ctype + integer, intent(in) :: intype, expected_nreal, in_subtype + integer, intent(out) :: nobs + type(list_node_t), pointer :: list + + !--- local vars + type(list_node_t), pointer :: next => null() + type(data_ptr) :: ptr + integer :: ii, ierr, istatus, total_obs, idx + logical :: have_subtype = .true. + logical :: add_obs + + !--- NetCDF file components dimension(s) + ! + character(len=:), dimension(:), allocatable :: Station_ID ! (nobs, Station_ID_maxstrlen) + character(len=:), dimension(:), allocatable :: Observation_Class ! (nobs, Station_Class_maxstrlen) + integer, dimension(:), allocatable :: Observation_Type ! (obs) + integer, dimension(:), allocatable :: Observation_Subtype ! (obs) + real(r_single), dimension(:), allocatable :: Latitude ! (obs) + real(r_single), dimension(:), allocatable :: Longitude ! (obs) + real(r_single), dimension(:), allocatable :: Station_Elevation ! (obs) + real(r_single), dimension(:), allocatable :: Pressure ! (obs) + real(r_single), dimension(:), allocatable :: Height ! (obs) + real(r_single), dimension(:), allocatable :: Time ! (obs) + real(r_single), dimension(:), allocatable :: Prep_QC_Mark ! (obs) + real(r_single), dimension(:), allocatable :: Setup_QC_Mark ! (obs) + real(r_single), dimension(:), allocatable :: Prep_Use_Flag ! (obs) + real(r_single), dimension(:), allocatable :: Nonlinear_QC_Rel_Wgt ! (obs) + real(r_single), dimension(:), allocatable :: Nonlinear_QC_Var_Jb ! (obs) + real(r_single), dimension(:), allocatable :: Analysis_Use_Flag ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Input ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Adjust ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Final ! (obs) + real(r_single), dimension(:), allocatable :: Wind_Reduction_Factor_at_10m ! (obs) + real(r_single), dimension(:), allocatable :: u_Observation ! (obs) + real(r_single), dimension(:), allocatable :: u_Obs_Minus_Forecast_adjusted ! (obs) + real(r_single), dimension(:), allocatable :: u_Obs_Minus_Forecast_unadjusted ! (obs) + real(r_single), dimension(:), allocatable :: v_Observation ! (obs) + real(r_single), dimension(:), allocatable :: v_Obs_Minus_Forecast_adjusted ! (obs) + real(r_single), dimension(:), allocatable :: v_Obs_Minus_Forecast_unadjusted ! (obs) + integer(i_kind) :: idate + + print *, ' ' + print *, ' --> read_diag_file_uv_nc' + + + !--- get NetCDF file dimensions + ! + if( nc_diag_read_check_dim( 'nobs' )) then + total_obs = nc_diag_read_get_dim(ftin,'nobs') + ncdiag_open_status(ii)%num_records = total_obs + print *, ' total_obs = ', total_obs + else + print *, 'ERROR: unable to read nobs' + ierr=1 + end if + + + !--- get vars + + call load_nc_var( 'Station_ID', ftin, Station_ID, ierr ) + call load_nc_var( 'Observation_Class', ftin, Observation_Class, ierr ) + call load_nc_var( 'Observation_Type', ftin, Observation_Type, ierr ) + call load_nc_var( 'Observation_Subtype', ftin, Observation_Subtype, ierr ) + if( ierr == 1 ) then + have_subtype = .false. + end if + call load_nc_var( 'Latitude', ftin, Latitude, ierr ) + call load_nc_var( 'Longitude', ftin, Longitude, ierr ) + call load_nc_var( 'Station_Elevation', ftin, Station_Elevation, ierr ) + call load_nc_var( 'Pressure', ftin, Pressure, ierr ) + call load_nc_var( 'Height', ftin, Height, ierr ) + call load_nc_var( 'Time', ftin, Time, ierr ) + call load_nc_var( 'Prep_QC_Mark', ftin, Prep_QC_Mark, ierr ) + call load_nc_var( 'Setup_QC_Mark', ftin, Setup_QC_Mark, ierr ) + call load_nc_var( 'Nonlinear_QC_Rel_Wgt', ftin, Nonlinear_QC_Rel_Wgt, ierr ) + call load_nc_var( 'Prep_Use_Flag', ftin, Prep_Use_Flag, ierr ) + call load_nc_var( 'Nonlinear_QC_Var_Jb', ftin, Nonlinear_QC_Var_Jb, ierr ) + call load_nc_var( 'Analysis_Use_Flag', ftin, Analysis_Use_Flag, ierr ) + call load_nc_var( 'Errinv_Input', ftin, Errinv_Input, ierr ) + call load_nc_var( 'Errinv_Adjust', ftin, Errinv_Adjust, ierr ) + call load_nc_var( 'Errinv_Final', ftin, Errinv_Final, ierr ) + call load_nc_var( 'Wind_Reduction_Factor_at_10m', ftin, Wind_Reduction_Factor_at_10m, ierr ) + call load_nc_var( 'u_Observation', ftin, u_Observation, ierr ) + call load_nc_var( 'u_Obs_Minus_Forecast_adjusted', ftin, u_Obs_Minus_Forecast_adjusted, ierr ) + call load_nc_var( 'u_Obs_Minus_Forecast_unadjusted', ftin, u_Obs_Minus_Forecast_unadjusted, ierr ) + call load_nc_var( 'v_Observation', ftin, v_Observation, ierr ) + call load_nc_var( 'v_Obs_Minus_Forecast_adjusted', ftin, v_Obs_Minus_Forecast_adjusted, ierr ) + call load_nc_var( 'v_Obs_Minus_Forecast_unadjusted', ftin, v_Obs_Minus_Forecast_unadjusted, ierr ) + + + !--------------------------------------------------------------- + ! Process all obs. If type and subtype match the input values + ! add this obs to the linked list (ptr%p). + ! + nobs = 0 + do ii = 1, total_obs + + + !------------------------------------------------------------------------ + ! Check on Observation_Class to ctype is a sanity check -- + ! only a single class of obs are in any given NetCDF formatted diag file + ! but, if the ctype and input file don't match, things could get + ! interesting (but not in a good way). + ! + add_obs = .false. + + if( adjustl( trim( Observation_Class(ii) )) == adjustl( trim( ctype ))) then + + if( return_all == .true. ) then + add_obs = .true. + + else if( Observation_Type(ii) == intype ) then + + if( have_subtype == .false. ) then + add_obs = .true. + else if( Observation_Subtype(ii) == in_subtype ) then + add_obs = .true. + end if + + end if + end if + + if( add_obs == .true. ) then + + nobs=nobs+1 + + !--------------------------------------------- + ! Allocate a new data element and load + ! + allocate(ptr%p) + ptr%p%stn_id = Station_ID( ii ) + + do idx=1,max_rdiag_reals + ptr%p%rdiag( idx ) = 0.00 + end do + + if( allocated( Observation_Type )) ptr%p%rdiag( idx_obs_type_uv ) = Observation_Type( ii ) + if( allocated( Observation_Subtype )) ptr%p%rdiag( idx_obs_subtype_uv ) = Observation_Subtype( ii ) + if( allocated( Latitude )) ptr%p%rdiag( idx_obs_lat_uv ) = Latitude( ii ) + if( allocated( Longitude )) ptr%p%rdiag( idx_obs_lon_uv ) = Longitude( ii ) + if( allocated( Station_Elevation )) ptr%p%rdiag( idx_stn_elev_uv ) = Station_Elevation( ii ) + if( allocated( Pressure )) ptr%p%rdiag( idx_pres_uv ) = Pressure( ii ) + if( allocated( Height )) ptr%p%rdiag( idx_hgt_uv ) = Height( ii ) + if( allocated( Time )) ptr%p%rdiag( idx_time_uv ) = Time( ii ) + if( allocated( Prep_QC_Mark )) ptr%p%rdiag( idx_iqc_uv ) = Prep_QC_Mark( ii ) + +! if( allocated( Nonlinear_QC_Var_JB )) ptr%p%rdiag( idx_setup_qc_uv ) = Nonlinear_QC_Var_Jb( ii ) ! missing from diagnostic file + + if( allocated( Prep_Use_Flag )) ptr%p%rdiag( idx_iuse_uv ) = Prep_Use_Flag( ii ) + if( allocated( Analysis_Use_Flag )) ptr%p%rdiag( idx_anl_use_uv ) = Analysis_Use_Flag( ii ) + if( allocated( Nonlinear_QC_Rel_Wgt )) ptr%p%rdiag( idx_rwgt_uv ) = Nonlinear_QC_Rel_Wgt( ii ) + if( allocated( Errinv_Input )) ptr%p%rdiag( idx_err_input_uv ) = Errinv_Input( ii ) + if( allocated( Errinv_Adjust )) ptr%p%rdiag( idx_errinv_uv ) = Errinv_Adjust( ii ) + if( allocated( Errinv_Final )) ptr%p%rdiag( idx_errinv_fnl_uv ) = Errinv_Final( ii ) + + if( allocated( u_Observation )) ptr%p%rdiag( idx_u_obs_uv ) = u_Observation( ii ) + if( allocated( u_Obs_Minus_Forecast_adjusted )) ptr%p%rdiag( idx_u_omgbc_uv ) = u_Obs_Minus_Forecast_adjusted( ii ) + if( allocated( u_Obs_Minus_Forecast_unadjusted )) ptr%p%rdiag( idx_u_omgnbc_uv ) = u_Obs_Minus_Forecast_unadjusted( ii ) + if( allocated( v_Observation )) ptr%p%rdiag( idx_v_obs_uv ) = v_Observation( ii ) + if( allocated( v_Obs_Minus_Forecast_adjusted )) ptr%p%rdiag( idx_v_omgbc_uv ) = v_Obs_Minus_Forecast_adjusted( ii ) + if( allocated( v_Obs_Minus_Forecast_unadjusted )) ptr%p%rdiag( idx_v_omgnbc_uv ) = v_Obs_Minus_Forecast_unadjusted( ii ) + + + if( nobs == 1 ) then + !------------------------------------------------- + ! Initialize the list with the first data element + ! + call list_init(list, transfer(ptr, list_data)) + next => list + + else + !------------------------------------------------- + ! Insert subsequent nodes into the list + ! + call list_insert(next, transfer(ptr, list_data)) + next => list_next(next) + end if + + end if + + end do + + + if( allocated( Station_ID )) deallocate( Station_ID ) + if( allocated( Observation_Class )) deallocate( Observation_Class ) + if( allocated( Observation_Type )) deallocate( Observation_Type ) + if( allocated( Observation_Subtype )) deallocate( Observation_Subtype ) + if( allocated( Latitude )) deallocate( Latitude ) + if( allocated( Longitude )) deallocate( Longitude ) + if( allocated( Station_Elevation )) deallocate( Station_Elevation ) + if( allocated( Time )) deallocate( Time ) + if( allocated( Prep_QC_Mark )) deallocate( Prep_QC_Mark ) + if( allocated( Prep_Use_Flag )) deallocate( Prep_Use_Flag ) + if( allocated( Nonlinear_QC_Var_Jb )) deallocate( Nonlinear_QC_Var_Jb ) + if( allocated( Nonlinear_QC_Rel_Wgt )) deallocate( Nonlinear_QC_Rel_Wgt ) + if( allocated( Analysis_Use_Flag )) deallocate( Analysis_Use_Flag ) + if( allocated( Errinv_Input )) deallocate( Errinv_Input ) + if( allocated( Errinv_Adjust )) deallocate( Errinv_Final ) + if( allocated( Errinv_Final )) deallocate( Errinv_Final ) + if( allocated( Wind_Reduction_Factor_at_10m )) deallocate( Wind_Reduction_Factor_at_10m ) + if( allocated( u_Observation )) deallocate( u_Observation ) + if( allocated( u_Obs_Minus_Forecast_adjusted )) deallocate( u_Obs_Minus_Forecast_adjusted ) + if( allocated( u_Obs_Minus_Forecast_unadjusted )) deallocate( u_Obs_Minus_Forecast_unadjusted ) + if( allocated( v_Observation )) deallocate( v_Observation ) + if( allocated( v_Obs_Minus_Forecast_adjusted )) deallocate( v_Obs_Minus_Forecast_adjusted ) + if( allocated( v_Obs_Minus_Forecast_unadjusted )) deallocate( v_Obs_Minus_Forecast_unadjusted ) + + print *, ' ' + print *, ' <-- read_diag_file_uv_nc' + + end subroutine read_diag_file_uv_nc + + + !----------------------------------------------------------- + ! netcdf read routine for gps data types in netcdf files + ! + ! NOTE1: This routine is untested. At present the ConMon + ! does not process gps data. There are plans to + ! change that though. + ! + ! NOTE2: There are known descrepencies between gps obs + ! in binary and NetCDF formatted diag files. See + ! comments below. + ! + subroutine read_diag_file_gps_nc( input_file, return_all, ftin, ctype, intype,expected_nreal,nobs,in_subtype, list ) + + !--- interface + character(100), intent(in) :: input_file + logical, intent(in) :: return_all + integer, intent(in) :: ftin + character(3), intent(in) :: ctype + integer, intent(in) :: intype, expected_nreal, in_subtype + integer, intent(out) :: nobs + type(list_node_t), pointer :: list + + !--- local vars + type(list_node_t), pointer :: next => null() + type(data_ptr) :: ptr + integer :: ii, ierr, istatus, total_obs, idx + logical :: have_subtype = .true. + logical :: add_obs + + !--- NetCDF file components dimension(s) + ! + character(len=:), dimension(:), allocatable :: Station_ID ! (nobs, Station_ID_maxstrlen) + character(len=:), dimension(:), allocatable :: Observation_Class ! (nobs, Station_Class_maxstrlen) + integer, dimension(:), allocatable :: Observation_Type ! (obs) + integer, dimension(:), allocatable :: Observation_Subtype ! (obs) + real(r_single), dimension(:), allocatable :: Latitude ! (obs) + real(r_single), dimension(:), allocatable :: Longitude ! (obs) + real(r_single), dimension(:), allocatable :: Incremental_Bending_Angle ! (obs) + real(r_single), dimension(:), allocatable :: Station_Elevation ! (obs) + real(r_single), dimension(:), allocatable :: Pressure ! (obs) + real(r_single), dimension(:), allocatable :: Height ! (obs) + real(r_single), dimension(:), allocatable :: Time ! (obs) + real(r_single), dimension(:), allocatable :: Model_Elevation ! (obs) + real(r_single), dimension(:), allocatable :: Setup_QC_Mark ! (obs) + real(r_single), dimension(:), allocatable :: Prep_Use_Flag ! (obs) + real(r_single), dimension(:), allocatable :: Nonlinear_QC_Var_Jb ! (obs) + real(r_single), dimension(:), allocatable :: Nonlinear_QC_Rel_Wgt ! (obs) + real(r_single), dimension(:), allocatable :: Analysis_Use_Flag ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Input ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Adjust ! (obs) + real(r_single), dimension(:), allocatable :: Errinv_Final ! (obs) + real(r_single), dimension(:), allocatable :: Observation ! (obs) + real(r_single), dimension(:), allocatable :: Obs_Minus_Forecast_adjusted ! (obs) + real(r_single), dimension(:), allocatable :: Obs_Minus_Forecast_unadjusted ! (obs) + real(r_single), dimension(:), allocatable :: GPS_Type ! (obs) + real(r_single), dimension(:), allocatable :: Temperature_at_Obs_Location ! (obs) + real(r_single), dimension(:), allocatable :: Specific_Humidity_at_Obs_Location ! (obs) + + integer(i_kind) :: idate + + + + print *, ' ' + print *, ' --> read_diag_file_gps_nc' + + + !--- get NetCDF file dimensions + ! + if( nc_diag_read_check_dim( 'nobs' )) then + total_obs = nc_diag_read_get_dim(ftin,'nobs') + ncdiag_open_status(ii)%num_records = total_obs + print *, ' total_obs = ', total_obs + else + print *, 'ERROR: unable to read nobs' + ierr=1 + end if + + + !--- get vars + + call load_nc_var( 'Station_ID', ftin, Station_ID, ierr ) + call load_nc_var( 'Observation_Class', ftin, Observation_Class, ierr ) + call load_nc_var( 'Observation_Type', ftin, Observation_Type, ierr ) + call load_nc_var( 'Observation_Subtype', ftin, Observation_Subtype, ierr ) + if( ierr == 1 ) then + have_subtype = .false. + end if + call load_nc_var( 'Latitude', ftin, Latitude, ierr ) + call load_nc_var( 'Longitude', ftin, Longitude, ierr ) + call load_nc_var( 'Incremental_Bending_Angle', ftin, Incremental_Bending_Angle, ierr ) + call load_nc_var( 'Pressure', ftin, Pressure, ierr ) + call load_nc_var( 'Height', ftin, Height, ierr ) + call load_nc_var( 'Time', ftin, Time, ierr ) + call load_nc_var( 'Model_Elevation', ftin, Model_Elevation, ierr ) + call load_nc_var( 'Setup_QC_Mark', ftin, Setup_QC_Mark, ierr ) + call load_nc_var( 'Prep_Use_Flag', ftin, Prep_Use_Flag, ierr ) + call load_nc_var( 'Analysis_Use_Flag', ftin, Analysis_Use_Flag, ierr ) + call load_nc_var( 'Nonlinear_QC_Rel_Wgt', ftin, Nonlinear_QC_Rel_Wgt, ierr ) + call load_nc_var( 'Errinv_Input', ftin, Errinv_Input, ierr ) + call load_nc_var( 'Errinv_Adjust', ftin, Errinv_Adjust, ierr ) + call load_nc_var( 'Errinv_Final', ftin, Errinv_Final, ierr ) + call load_nc_var( 'Observation', ftin, Observation, ierr ) + call load_nc_var( 'Obs_Minus_Forecast_adjusted', ftin, Obs_Minus_Forecast_adjusted, ierr ) + call load_nc_var( 'Obs_Minus_Forecast_unadjusted', ftin, Obs_Minus_Forecast_unadjusted, ierr ) + call load_nc_var( 'GPS_Type', ftin, GPS_Type, ierr ) + call load_nc_var( 'Temperature_at_Obs_Location', ftin, Temperature_at_Obs_Location, ierr ) + call load_nc_var( 'Specific_Humidity_at_Obs_Location', ftin, Specific_Humidity_at_Obs_Location, ierr ) + +! call load_nc_var( 'Nonlinear_QC_Var_Jb', ftin, Nonlinear_QC_Var_Jb, 13, ierr ) + + + + !--------------------------------------------------------------- + ! Process all obs. If type and subtype match the input values + ! add this obs to the linked list (ptr%p). + ! + nobs = 0 + do ii = 1, total_obs + + !------------------------------------------------------------------------ + ! Check on Observation_Class to ctype is a sanity check -- + ! only a single class of obs are in any given NetCDF formatted diag + ! file + ! but, if the ctype and input file don't match, things could get + ! interesting (but not in a good way). + ! + add_obs = .false. + + if( adjustl( trim( Observation_Class(ii) )) == adjustl( trim( ctype ))) then + + if( return_all == .true. ) then + add_obs = .true. + + else if( Observation_Type(ii) == intype ) then + + if( have_subtype == .false. ) then + add_obs = .true. + else if( Observation_Subtype(ii) == in_subtype ) then + add_obs = .true. + end if + + end if + end if + + if( add_obs == .true. ) then + + nobs=nobs+1 + + !--------------------------------------------- + ! Allocate a new data element and load + ! + allocate(ptr%p) + ptr%p%stn_id = Station_ID( ii ) + + do idx=1,max_rdiag_reals + ptr%p%rdiag( idx ) = 0.00 + end do + + if( allocated ( Observation_Type )) ptr%p%rdiag( idx_obs_type_gps ) = Observation_Type( ii ) + if( allocated ( Observation_Subtype )) ptr%p%rdiag( idx_obs_subtype_gps ) = Observation_Subtype( ii ) + if( allocated ( Latitude )) ptr%p%rdiag( idx_obs_lat_gps ) = Latitude( ii ) + if( allocated ( Longitude )) ptr%p%rdiag( idx_obs_lon_gps ) = Longitude( ii ) + if( allocated ( Incremental_Bending_Angle )) ptr%p%rdiag( idx_bend_ang_gps ) = Incremental_Bending_Angle( ii ) + if( allocated ( Pressure )) ptr%p%rdiag( idx_pres_gps ) = Pressure( ii ) + if( allocated ( Height )) ptr%p%rdiag( idx_height_gps ) = Height( ii ) + if( allocated ( Time )) ptr%p%rdiag( idx_time_gps ) = Time( ii ) + if( allocated ( Model_Elevation )) ptr%p%rdiag( idx_zsges_gps ) = Model_Elevation( ii ) + if( allocated ( Setup_QC_Mark )) ptr%p%rdiag( idx_setup_qc_gps ) = Setup_QC_Mark( ii ) + if( allocated ( Prep_Use_Flag )) ptr%p%rdiag( idx_iuse_gps ) = Prep_Use_Flag( ii ) + if( allocated ( Analysis_Use_Flag )) ptr%p%rdiag( idx_anl_use_gps ) = Analysis_Use_Flag( ii ) + if( allocated ( Nonlinear_QC_Rel_Wgt )) ptr%p%rdiag( idx_rwgt_gps ) = Nonlinear_QC_Rel_Wgt( ii ) + if( allocated ( Errinv_input )) ptr%p%rdiag( idx_err_input_gps ) = Errinv_Input( ii ) + if( allocated ( Errinv_Adjust )) ptr%p%rdiag( idx_errinv_gps ) = Errinv_Adjust( ii ) + if( allocated ( Errinv_Final )) ptr%p%rdiag( idx_errinv_fnl_gps ) = Errinv_Final( ii ) + + if( allocated ( Observation )) ptr%p%rdiag( idx_obs_gps ) = Observation( ii ) + if( allocated ( Temperature_at_Obs_Location )) ptr%p%rdiag( idx_tref_gps ) = Temperature_at_Obs_Location( ii ) +! if( allocated ( Obs_Minus_Forecast_unadjusted )) ptr%p%rdiag( idx_hob_gps ) = Obs_Minus_Forecast_unadjusted( ii ) + if( allocated ( GPS_Type )) ptr%p%rdiag( idx_uses_gps ) = GPS_Type( ii ) + if( allocated ( Specific_Humidity_at_Obs_Location )) ptr%p%rdiag( idx_qref_gps ) = Specific_Humidity_at_Obs_Location( ii ) + + + ! This oddity is from genstats_gps.f90 which produces the NetCDF + ! formatted diag file: + ! + ! call nc_diag_metadata("Obs_Minus_Forecast_adjusted", sngl(gps_allptr%rdiag(17))*sngl(gps_allptr%rdiag(5)) ) + ! call nc_diag_metadata("Obs_Minus_Forecast_unadjusted", sngl(gps_allptr%rdiag(17))*sngl(gps_allptr%rdiag(5)) ) + ! call nc_diag_metadata("GPS_Type", sngl(gps_allptr%rdiag(20)) ) + ! call nc_diag_metadata("Temperature_at_Obs_Location", sngl(gps_allptr%rdiag(18)) ) + ! + ! It would seem from this that rdiagbuf(19) is not used? + ! And also Obs_Minus_Forecast_[un|'']adjusted is derived and not stored. + ! + ! This from setupbend.f90: + ! rdiagbuf(18,i) = trefges ! temperature at obs location (Kelvin) if monotone grid + ! rdiagbuf(19,i) = hob ! model vertical grid (interface) if monotone grid + ! rdiagbuf(20,i) = one ! uses gps_ref (one = use of bending angle) + ! + + + if( nobs == 1 ) then + !------------------------------------------------- + ! Initialize the list with the first data element + ! + call list_init(list, transfer(ptr, list_data)) + next => list + + else + !------------------------------------------------- + ! Insert subsequent nodes into the list + ! + call list_insert(next, transfer(ptr, list_data)) + next => list_next(next) + + end if + + end if + + end do + + + if( allocated( Station_ID )) deallocate( Station_ID ) + if( allocated( Observation_Class )) deallocate( Observation_Class ) + if( allocated( Observation_Type )) deallocate( Observation_Type ) + if( allocated( Observation_Subtype )) deallocate( Observation_Subtype ) + if( allocated( Latitude )) deallocate( Latitude ) + if( allocated( Longitude )) deallocate( Longitude ) + if( allocated( Incremental_Bending_Angle )) deallocate( Incremental_Bending_Angle ) + if( allocated( Pressure )) deallocate( Pressure ) + if( allocated( Height )) deallocate( Height ) + if( allocated( Time )) deallocate( Time ) + if( allocated( Model_Elevation )) deallocate( Model_Elevation ) + if( allocated( Setup_QC_Mark )) deallocate( Setup_QC_Mark ) + if( allocated( Prep_Use_Flag )) deallocate( Prep_Use_Flag ) + if( allocated( Analysis_Use_Flag )) deallocate( Analysis_Use_Flag ) + if( allocated( Nonlinear_QC_Rel_Wgt )) deallocate( Nonlinear_QC_Rel_Wgt ) + if( allocated( Errinv_Input )) deallocate( Errinv_Input ) + if( allocated( Errinv_Adjust )) deallocate( Errinv_Final ) + if( allocated( Errinv_Final )) deallocate( Errinv_Final ) + if( allocated( Observation )) deallocate( Observation ) + if( allocated( Obs_Minus_Forecast_adjusted )) deallocate( Obs_Minus_Forecast_adjusted ) + if( allocated( Obs_Minus_Forecast_unadjusted )) deallocate( Obs_Minus_Forecast_unadjusted ) + if( allocated( GPS_Type )) deallocate( GPS_Type ) + if( allocated( Temperature_at_Obs_Location )) deallocate( Temperature_at_Obs_Location ) + if( allocated( Specific_Humidity_at_Obs_Location )) deallocate( Specific_Humidity_at_Obs_Location ) + + print *, ' ' + print *, ' <-- read_diag_file_gps_nc' + + end subroutine read_diag_file_gps_nc + + + + + !--- binary read routine + ! + subroutine read_diag_file_bin( input_file, return_all, ctype, intype,expected_nreal,nobs,in_subtype, list ) + + !--- interface + character(100), intent(in) :: input_file + logical, intent(in) :: return_all + character(3), intent(in) :: ctype + integer, intent(in) :: intype, expected_nreal, in_subtype + integer, intent(out) :: nobs + type(list_node_t), pointer :: list + + + !--- local vars + type(list_node_t), pointer :: next => null() + type(data_ptr) :: ptr + + real(4),allocatable,dimension(:,:) :: rdiag + character(8),allocatable,dimension(:) :: cdiag + + character(3) :: dtype + character(10) :: otype + character(15) :: fileo,fileo_subtyp + + integer nchar,file_nreal,i,ii,mype,idate,iflag,file_itype,iscater,igrads + integer lunin,lunot,ldtype,file_subtype + integer idx,ioff02 + + data lunin / 11 / + + nobs=0 + print *, ' --> read_diag_file_bin' + print *, ' ctype = ', ctype + print *, ' intype, in_subtype = ', intype, in_subtype + print *, ' expected_nreal = ', expected_nreal + + + !--- open diag file + open(lunin, file=input_file, form='unformatted') + rewind(lunin) + + read(lunin) idate + print *, 'idate=',idate + + loopd: do + + !--- read obs header + read(lunin,IOSTAT=iflag) dtype,nchar,file_nreal,ii,mype,ioff02 + + if( iflag /= 0 ) exit loopd + + !----------------------------------------------------- + ! exit loop if the number of reals (nreal) from file + ! doesn't match the target number + ! + if(( return_all == .true. ) .OR. ( trim(dtype) == trim(ctype) .and. file_nreal /= expected_nreal )) then + print *, 'matched observation type:',dtype,' file_nreal=', file_nreal + exit + endif + + !--------------------------------------------- + ! skip to next iteration if types don't match + ! + if(( return_all == .false. ) .AND. ( trim( dtype ) /= trim( ctype ))) then + cycle + endif + + + !--- read diag info + allocate(cdiag(ii),rdiag(file_nreal,ii)) + read(lunin,IOSTAT=iflag) cdiag,rdiag + + !--- exit loop on read error + if( iflag /= 0 ) then + deallocate( cdiag,rdiag ) + exit loopd + end if + + do i=1,ii + file_itype = int(rdiag(1,i)) + file_subtype = int(rdiag(2,i)) + + !------------------------------------------------ + ! if both types and subtypes match + ! then add a new data element + ! + if(( return_all == .true. ) .OR. ( file_itype == intype .AND. file_subtype == in_subtype )) then + + nobs=nobs+1 + + !--------------------------------------------- + ! Allocate a new data element and load + ! + allocate(ptr%p) + ptr%p%stn_id = cdiag(i) + + do idx=1,max_rdiag_reals + if( idx > file_nreal ) then + ptr%p%rdiag( idx ) = 0.00 + else + ptr%p%rdiag( idx ) = rdiag( idx,i ) + end if + end do + + if( nobs == 1 ) then + !------------------------------------------------- + ! Initialize the list with the first data element + ! + call list_init(list, transfer(ptr, list_data)) + next => list + + else + !------------------------------------------------- + ! Insert subsequent nodes into the list + ! + call list_insert(next, transfer(ptr, list_data)) + next => list_next(next) + + end if + + endif + + enddo + + deallocate(cdiag,rdiag) + enddo loopd ! ending read data do loop + + close(lunin) + + print *, 'nobs added to list = ', nobs + print *, ' <-- read_diag_file_bin' + + return + end subroutine read_diag_file_bin + + + + !------------------------------------------------ + ! function find_ncdiag_id + !------------------------------------------------ + integer( i_kind ) function find_ncdiag_id( ftin ) + + integer(i_kind), intent(in) :: ftin + + integer(i_kind) :: i + + find_ncdiag_id = -1 + do i = 1, MAX_OPEN_NCDIAG + if ( ncdiag_open_id(i) == ftin ) then + find_ncdiag_id = i + return + endif + enddo + + return + end function find_ncdiag_id + + +end module conmon_read_diag diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/conv_time/convinfo2.f90 b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_time.fd/convinfo2.f90 similarity index 81% rename from util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/conv_time/convinfo2.f90 rename to util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_time.fd/convinfo2.f90 index 3eaf42a8c6..d723e4a031 100644 --- a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/conv_time/convinfo2.f90 +++ b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_time.fd/convinfo2.f90 @@ -7,15 +7,18 @@ subroutine convinfo(iotype_ps,iotype_q,iotype_t,iotype_uv,ntype_ps,& implicit none - integer,dimension(100) :: iotype_ps,iotype_q,iotype_t,iotype_uv - integer,dimension(100) :: iosubtype_ps,iosubtype_q,iosubtype_t,iosubtype_uv - integer,dimension(100) :: ituse_ps,ituse_q,ituse_t,ituse_uv - real(4),dimension(100,2) :: varqc_ps,varqc_q,varqc_t,varqc_uv + integer,dimension(200) :: iotype_ps,iotype_q,iotype_t,iotype_uv + integer,dimension(200) :: iosubtype_ps,iosubtype_q,iosubtype_t,iosubtype_uv + integer,dimension(200) :: ituse_ps,ituse_q,ituse_t,ituse_uv + real(4),dimension(200,2) :: varqc_ps,varqc_q,varqc_t,varqc_uv integer ittype,ituse,ntumgrp,ntgroup,ntmiter,isubtype integer lunin,ntype_ps,ntype_q,ntype_t,ntype_uv,iflag real(8) :: ttwind,gtross,etrmax,etrmin,vtar_b,vtar_pg + real(8) :: rmesh, pmesh, pmot, ptime + integer ithin, npred + character(120):: crecord character(7) :: ctype character(1) :: cflg @@ -38,8 +41,6 @@ subroutine convinfo(iotype_ps,iotype_q,iotype_t,iotype_uv,ntype_ps,& varqc_t=0.0 varqc_uv=0.0 - - print *, 'start coninfo subroutine' open(lunin,file='convinfo',form='formatted') rewind(lunin) @@ -51,8 +52,10 @@ subroutine convinfo(iotype_ps,iotype_q,iotype_t,iotype_uv,ntype_ps,& if( iflag /= 0 ) exit loopd read(crecord,*)ittype,isubtype,ituse,ttwind,ntumgrp,ntgroup,ntmiter,& - gtross,etrmax,etrmin,vtar_b,vtar_pg - + gtross,etrmax,etrmin,vtar_b,vtar_pg, & + ithin, rmesh, pmesh, npred, pmot, ptime + + if(trim(ctype) == 'ps' ) then ntype_ps=ntype_ps+1 iotype_ps(ntype_ps)=ittype @@ -74,7 +77,6 @@ subroutine convinfo(iotype_ps,iotype_q,iotype_t,iotype_uv,ntype_ps,& ntype_t=ntype_t+1 iotype_t(ntype_t)=ittype iosubtype_t(ntype_t)=isubtype - varqc_t(ntype_t,1)=vtar_b varqc_t(ntype_t,2)=vtar_pg ituse_t(ntype_t)=ituse @@ -93,6 +95,7 @@ subroutine convinfo(iotype_ps,iotype_q,iotype_t,iotype_uv,ntype_ps,& enddo loopd 1030 format(a1,a7,2x,a120) + print *, 'end coninfo subroutine' return diff --git a/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_time.fd/data_mod.f90 b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_time.fd/data_mod.f90 new file mode 100644 index 0000000000..e611a9782e --- /dev/null +++ b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_time.fd/data_mod.f90 @@ -0,0 +1,220 @@ +module data + implicit none + + private + public :: data_t + public :: data_ptr + + integer, parameter,public :: max_rdiag_reals = 25 + + !-------------------------------------------------- + ! generic index numbers into the rdiagbuf array + ! for _all_ data types + ! + integer, parameter, public :: idx_obs_type = 1 ! obs type + integer, parameter, public :: idx_obs_subtype = 2 ! obs subtype + integer, parameter, public :: idx_obs_lat = 3 ! obs latitude + integer, parameter, public :: idx_obs_lon = 4 ! obs longitude + integer, parameter, public :: idx_stn_elev = 5 ! stn elevation + integer, parameter, public :: idx_pres = 6 ! obs pressure + integer, parameter, public :: idx_time = 8 ! obs time (hrs relative to analysis time) + integer, parameter, public :: idx_rwgt = 13 ! non-linear qc relative weight + + + + !-------------------------------------------------- + ! index numbers into the rdiagbuf array + ! for type ps obs + ! + ! (see setupps.f90 for more info) + ! + integer, parameter, public :: idx_obs_type_ps = 1 ! obs type + integer, parameter, public :: idx_obs_subtype_ps = 2 ! obs subtype + integer, parameter, public :: idx_obs_lat_ps = 3 ! obs latitude + integer, parameter, public :: idx_obs_lon_ps = 4 ! obs longitude + integer, parameter, public :: idx_stn_elev_ps = 5 ! stn elevation + integer, parameter, public :: idx_pres_ps = 6 ! obs pressure (hPa) + integer, parameter, public :: idx_hgt_ps = 7 ! obs height (meters) + integer, parameter, public :: idx_time_ps = 8 ! obs time (hrs relative to analysis time) + integer, parameter, public :: idx_iqc_ps = 9 ! prepbufr qc or event mark + integer, parameter, public :: idx_var_jb_ps = 10 ! non-linear qc param + integer, parameter, public :: idx_iuse_ps = 11 ! read_prepbufr data usage flag + integer, parameter, public :: idx_anl_use_ps = 12 ! analysis usage flag + integer, parameter, public :: idx_rwgt_ps = 13 ! non-linear qc relative weight + integer, parameter, public :: idx_err_input_ps = 14 ! prepbufr invers obs error (hPa**-1) + integer, parameter, public :: idx_errinv_ps = 15 ! read_prepbufr invers obs error (hPa**-1) + integer, parameter, public :: idx_errinv_fnl_ps = 16 ! final invers obs error (HPa**-1) + integer, parameter, public :: idx_obs_ps = 17 ! surface pressure observation + integer, parameter, public :: idx_obsmg_adj_ps = 18 ! obs-ges used in analysis (coverted to hPa) + integer, parameter, public :: idx_obsmg_nadj_ps = 19 ! obs-ges w/o adjustment to guess surface pressure (hPa) + integer, parameter, public :: idx_spread_ps = 20 ! spread (filled in by EnKF) + + + !-------------------------------------------------- + ! index numbers into the rdiagbuf array + ! for type q obs + ! + ! (see setupq.f90 for more info) + ! + integer, parameter, public :: idx_obs_type_q = 1 ! obs type + integer, parameter, public :: idx_obs_subtype_q = 2 ! obs subtype + integer, parameter, public :: idx_obs_lat_q = 3 ! obs latitude + integer, parameter, public :: idx_obs_lon_q = 4 ! obs longitude + integer, parameter, public :: idx_stn_elev_q = 5 ! stn elevation + integer, parameter, public :: idx_pres_q = 6 ! obs pressure (hPa) + integer, parameter, public :: idx_hgt_q = 7 ! obs height (meters) + integer, parameter, public :: idx_time_q = 8 ! obs time (hrs relative to analysis time) + integer, parameter, public :: idx_iqc_q = 9 ! prepbufr qc or event mark + integer, parameter, public :: idx_var_jb_q = 10 ! non-linear qc param + integer, parameter, public :: idx_iuse_q = 11 ! read_prepbufr data usage flag + integer, parameter, public :: idx_anl_use_q = 12 ! analysis usage flag + integer, parameter, public :: idx_rwgt_q = 13 ! non-linear qc relative weight + integer, parameter, public :: idx_err_input_q = 14 ! prepbufr invers obs error + integer, parameter, public :: idx_errinv_q = 15 ! read_prepbufr invers obs error + integer, parameter, public :: idx_errinv_fnl_q = 16 ! final invers obs error + integer, parameter, public :: idx_obs_q = 17 ! surface pressure observation + integer, parameter, public :: idx_obsmg_adj_q = 18 ! obs-ges used in analysis + integer, parameter, public :: idx_obsmg_nadj_q = 19 ! obs-ges w/o adjustment to guess surface pressure + integer, parameter, public :: idx_ges_sat_q = 20 ! guess saturation specific + integer, parameter, public :: idx_spread_q = 21 ! spread (filled in by EnKF) + + + + !-------------------------------------------------- + ! index numbers into the rdiagbuf array + ! for type t obs + ! + ! (see setupt.f90 for more info) + ! + integer, parameter, public :: idx_obs_type_t = 1 ! obs type + integer, parameter, public :: idx_obs_subtype_t = 2 ! obs subtype + integer, parameter, public :: idx_obs_lat_t = 3 ! obs latitude + integer, parameter, public :: idx_obs_lon_t = 4 ! obs longitude + integer, parameter, public :: idx_stn_elev_t = 5 ! stn elevation + integer, parameter, public :: idx_pres_t = 6 ! obs pressure (hPa) + integer, parameter, public :: idx_hgt_t = 7 ! obs height (meters) + integer, parameter, public :: idx_time_t = 8 ! obs time (hrs relative to analysis time) + integer, parameter, public :: idx_iqc_t = 9 ! prepbufr qc or event mark + integer, parameter, public :: idx_setup_qc_t = 10 ! setup qc or event mark + integer, parameter, public :: idx_iuse_t = 11 ! read_prepbufr data usage flag + integer, parameter, public :: idx_anl_use_t = 12 ! analysis usage flag + integer, parameter, public :: idx_rwgt_t = 13 ! combination of var_jb and rwgt + integer, parameter, public :: idx_err_input_t = 14 ! prepbufr inverse obs error + integer, parameter, public :: idx_errinv_t = 15 ! read_prepbufr inverse obs error + integer, parameter, public :: idx_errinv_fnl_t = 16 ! final inverse obs error + integer, parameter, public :: idx_obs_t = 17 ! temperature obs (K) + integer, parameter, public :: idx_omgbc_t = 18 ! obs-ges used in analysis (K) + integer, parameter, public :: idx_omgnbc_t = 19 ! obs-ges w/o bias correction (K) + integer, parameter, public :: idx_pof_t = 20 ! data pof + integer, parameter, public :: idx_vv_t = 21 ! data vertical velocity + integer, parameter, public :: idx_pbias_one = 22 ! pred bias term 1 + integer, parameter, public :: idx_pbias_two = 23 ! pred bias term 2 + integer, parameter, public :: idx_pbias_three = 24 ! pred bias term 3 + integer, parameter, public :: idx_pbias_four = 25 ! pred bias term 4 + + + !-------------------------------------------------- + ! index numbers into the rdiagbuf array + ! for type uv obs + ! + ! (see setupw.f90 for more info) + ! + integer, parameter, public :: idx_obs_type_uv = 1 ! obs type + integer, parameter, public :: idx_obs_subtype_uv = 2 ! obs subtype + integer, parameter, public :: idx_obs_lat_uv = 3 ! obs latitude + integer, parameter, public :: idx_obs_lon_uv = 4 ! obs longitude + integer, parameter, public :: idx_stn_elev_uv = 5 ! stn elevation + integer, parameter, public :: idx_pres_uv = 6 ! obs pressure (hPa) + integer, parameter, public :: idx_hgt_uv = 7 ! obs height (meters) + integer, parameter, public :: idx_time_uv = 8 ! obs time (hrs relative to analysis time) + integer, parameter, public :: idx_iqc_uv = 9 ! prepbufr qc or event mark + integer, parameter, public :: idx_setup_qc_uv = 10 ! setup qc or event mark + integer, parameter, public :: idx_iuse_uv = 11 ! read_prepbufr data usage flag + integer, parameter, public :: idx_anl_use_uv = 12 ! analysis usage flag + integer, parameter, public :: idx_rwgt_uv = 13 ! combination of var_jb and rwgt + integer, parameter, public :: idx_err_input_uv = 14 ! prepbufr inverse obs error + integer, parameter, public :: idx_errinv_uv = 15 ! read_prepbufr inverse obs error + integer, parameter, public :: idx_errinv_fnl_uv = 16 ! final inverse obs error + integer, parameter, public :: idx_u_obs_uv = 17 ! u wind component observation + integer, parameter, public :: idx_u_omgbc_uv = 18 ! u obs-ges used in analysis (m/s) + integer, parameter, public :: idx_u_omgnbc_uv = 19 ! u obs-ges w/o bias correction (m/s) + integer, parameter, public :: idx_v_obs_uv = 20 ! v wind component observation + integer, parameter, public :: idx_v_omgbc_uv = 21 ! v obs-ges used in analysis (m/s) + integer, parameter, public :: idx_v_omgnbc_uv = 22 ! v obs-ges w/o bias correction (m/s) + + + !-------------------------------------------------- + ! index numbers into the rdiagbuf array + ! for type sst obs + ! + ! (see setupsst.f90 for more info) + ! + integer, parameter, public :: idx_obs_type_sst = 1 ! obs type + integer, parameter, public :: idx_obs_subtype_sst = 2 ! obs subtype + integer, parameter, public :: idx_obs_lat_sst = 3 ! obs latitude + integer, parameter, public :: idx_obs_lon_sst = 4 ! obs longitude + integer, parameter, public :: idx_stn_elev_sst = 5 ! stn elevation + integer, parameter, public :: idx_opn_wtr_tmp_sst = 6 ! background open water temperature + integer, parameter, public :: idx_depth_sst = 7 ! observation depth (meters) + integer, parameter, public :: idx_time_sst = 8 ! obs time (hrs relative to analysis time) + integer, parameter, public :: idx_opn_wtr_pct_sst = 9 ! open water percentage + integer, parameter, public :: idx_setup_qc_sst = 10 ! setup qc or event mark + integer, parameter, public :: idx_iuse_sst = 11 ! read_prepbufr data usage flag + integer, parameter, public :: idx_anl_use_sst = 12 ! analysis usage flag + integer, parameter, public :: idx_rwgt_sst = 13 ! combination of var_jb and rwgt + integer, parameter, public :: idx_err_input_sst = 14 ! prepbufr inverse obs error + integer, parameter, public :: idx_errinv_sst = 15 ! read_prepbufr inverse obs error + integer, parameter, public :: idx_errinv_fnl_sst = 16 ! final inverse obs error + integer, parameter, public :: idx_obs_sst = 17 ! SST observation (K) + integer, parameter, public :: idx_omgbc_sst = 18 ! obs-ges used in analysis (K) + integer, parameter, public :: idx_omgnbc_sst = 19 ! obs-ges w/o bias correction (K) + integer, parameter, public :: idx_type_sst = 20 ! type of measurment + integer, parameter, public :: idx_tr_sst = 21 ! Tr + integer, parameter, public :: idx_dt_warm_sst = 22 ! dt_warm at zob + integer, parameter, public :: idx_dt_cool_sst = 23 ! dt_cool at zob + integer, parameter, public :: idx_dtz_dtr_sst = 23 ! d(tz)/d(Tr) at zob + + + + !-------------------------------------------------- + ! index numbers into the rdiagbuf array + ! for type gps obs + ! + ! (see setupbend.f90 for more info) + ! + integer, parameter, public :: idx_obs_type_gps = 1 ! obs type + integer, parameter, public :: idx_obs_subtype_gps = 2 ! profile identifier + integer, parameter, public :: idx_obs_lat_gps = 3 ! obs latitude + integer, parameter, public :: idx_obs_lon_gps = 4 ! obs longitude + integer, parameter, public :: idx_bend_ang_gps = 5 ! incremental bending angle (x100 %) + integer, parameter, public :: idx_pres_gps = 6 ! pressure at obs location (hPa) + integer, parameter, public :: idx_height_gps = 7 ! impact height in meters + integer, parameter, public :: idx_time_gps = 8 ! obs time (hrs relative to analysis time) + integer, parameter, public :: idx_zsges_gps = 9 ! model terrain (m) + integer, parameter, public :: idx_setup_qc_gps = 10 ! setup qc or event mark + integer, parameter, public :: idx_iuse_gps = 11 ! read_prepbufr data usage flag + integer, parameter, public :: idx_anl_use_gps = 12 ! analysis usage flag + integer, parameter, public :: idx_rwgt_gps = 13 ! combination of var_jb and rwgt + integer, parameter, public :: idx_err_input_gps = 14 ! prepbufr inverse obs error + integer, parameter, public :: idx_errinv_gps = 15 ! read_prepbufr inverse obs error + integer, parameter, public :: idx_errinv_fnl_gps = 16 ! final inverse obs error + integer, parameter, public :: idx_obs_gps = 17 ! bending angle observation (radians) + integer, parameter, public :: idx_tref_gps = 18 ! temperature at obs location (K) + integer, parameter, public :: idx_hob_gps = 19 ! model vertival grid + integer, parameter, public :: idx_uses_gps = 20 ! uses gps_ref + integer, parameter, public :: idx_qref_gps = 21 ! specific humidity at obs location (kg/kg) + integer, parameter, public :: idx_spread_gps = 22 ! spread + + + ! Data is stored in data_t + type :: data_t + character(8) :: stn_id + real,dimension(25) :: rdiag + end type data_t + + ! A container for storing data_t pointers + type :: data_ptr + type(data_t), pointer :: p + end type data_ptr + +end module data diff --git a/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_time.fd/generic_list.f90 b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_time.fd/generic_list.f90 new file mode 100644 index 0000000000..ad57e84598 --- /dev/null +++ b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_time.fd/generic_list.f90 @@ -0,0 +1,120 @@ +module generic_list + + implicit none + + private + public :: list_node_t, list_data + public :: list_init, list_free + public :: list_insert, list_put, list_get, list_next + + ! A public variable used as a MOLD for transfer() + integer, dimension(:), allocatable :: list_data + + ! Linked list node + type :: list_node_t + private + integer, dimension(:), pointer :: data => null() + type(list_node_t), pointer :: next => null() + end type list_node_t + + +contains + + !----------------------------------------------------------------------- + ! Initialize a head node SELF and optionally store the provided DATA. + ! + subroutine list_init(self, data) + type(list_node_t), pointer :: self + integer, dimension(:), intent(in), optional :: data + + allocate(self) + nullify(self%next) + + if (present(data)) then + allocate(self%data(size(data))) + self%data = data + else + nullify(self%data) + end if + end subroutine list_init + + + !-------------------------------------------------------- + ! Free the entire list and all data, beginning at SELF + ! + subroutine list_free(self) + type(list_node_t), pointer :: self + type(list_node_t), pointer :: current + type(list_node_t), pointer :: next + + current => self + do while (associated(current)) + next => current%next + if (associated(current%data)) then + deallocate(current%data) + nullify(current%data) + end if + deallocate(current) + nullify(current) + current => next + end do + end subroutine list_free + + + !------------------------------------------------------------ + ! Insert a list node after SELF containing DATA (optional) + ! + subroutine list_insert(self, data) + type(list_node_t), pointer :: self + integer, dimension(:), intent(in), optional :: data + type(list_node_t), pointer :: next + + allocate(next) + + if (present(data)) then + allocate(next%data(size(data))) + next%data = data + else + nullify(next%data) + end if + + next%next => self%next + self%next => next + end subroutine list_insert + + + !------------------------------------------- + ! Store the encoded DATA in list node SELF + ! + subroutine list_put(self, data) + type(list_node_t), pointer :: self + integer, dimension(:), intent(in) :: data + + if (associated(self%data)) then + deallocate(self%data) + nullify(self%data) + end if + self%data = data + end subroutine list_put + + + !--------------------------------------------- + ! Return the DATA stored in the node SELF + ! + function list_get(self) result(data) + type(list_node_t), pointer :: self + integer, dimension(:), pointer :: data + data => self%data + end function list_get + + + !--------------------------------------------- + ! Return the next node after SELF + ! + function list_next(self) + type(list_node_t), pointer :: self + type(list_node_t), pointer :: list_next + list_next => self%next + end function list_next + +end module generic_list diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radang.fd/kinds.F90 b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_time.fd/kinds.F90 similarity index 100% rename from util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radang.fd/kinds.F90 rename to util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_time.fd/kinds.F90 diff --git a/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_time.fd/mainconv_time.f90 b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_time.fd/mainconv_time.f90 new file mode 100644 index 0000000000..952c0cad95 --- /dev/null +++ b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_time.fd/mainconv_time.f90 @@ -0,0 +1,102 @@ +! intype : the observarion type like t for tem., uv for wind +! stype : the observation sub type, like t120 uv220 + +! use conmon_read_time_diag + use conmon_process_time_data + + implicit none + + + integer np,mregion,nobs + integer ntype_ps,ntype_q,ntype_t,ntype_uv + + parameter(np=13) + parameter(mregion=10) + real(4),dimension(np) :: ptop,pbot,ptopq,pbotq + integer,dimension(200) :: iotype_ps,iotype_q,iotype_uv,iotype_t + integer,dimension(200) :: iosubtype_ps,iosubtype_q,iosubtype_uv,iosubtype_t + integer,dimension(200) :: ituse_ps,ituse_q,ituse_uv,ituse_t + real(4),dimension(200,2) :: varqc_ps,varqc_q,varqc_uv,varqc_t + character(len=7) dtype_ps,dtype_uv,dtype_t,dtype_q + + character(40),dimension(mregion):: region + + real,dimension(mregion):: rlatmin,rlatmax,rlonmin,rlonmax + integer lunin,lunot,nregion + + data lunin / 11 / + data lunot / 21 / + + character(100) :: input_file = "conv_diag" + logical :: netcdf = .false. + character(3) :: run = "ges" + character(3) :: ctype = " " ! this only has meaning with + ! NetCDF formatted diag files + namelist /input/input_file,nregion,netcdf,run,ctype,region,rlatmin,rlatmax,rlonmin,rlonmax + + read(5,input) + write(6,*)' User input below' + write(6,input) + + call set_netcdf_flag( netcdf ) + + dtype_ps='ps' + dtype_uv='uv' + dtype_t='t' + dtype_q='q' + + + nobs=0 + ptop(1) = 0.0; pbot(1) = 2000.0 + ptop(2) = 1000.0; pbot(2) = 2000.0 + ptop(3) = 900.0; pbot(3) = 999.9 + ptop(4) = 800.0; pbot(4) = 899.9 + ptop(5) = 600.0; pbot(5) = 799.9 + ptop(6) = 400.0; pbot(6) = 599.9 + ptop(7) = 300.0; pbot(7) = 399.9 + ptop(8) = 250.0; pbot(8) = 299.9 + ptop(9) = 200.0; pbot(9) = 249.9 + ptop(10) = 150.0; pbot(10) = 199.9 + ptop(11) = 100.0; pbot(11) = 149.9 + ptop(12) = 50.0; pbot(12) = 99.9 + ptop(13) = 0.0; pbot(13) = 49.9 + + ptopq(1) = 0.0; pbotq(1) = 2000.0 + ptopq(2) = 1000.0; pbotq(2) = 2000.0 + ptopq(3) = 950.0; pbotq(3) = 999.9 + ptopq(4) = 900.0; pbotq(4) = 949.9 + ptopq(5) = 850.0; pbotq(5) = 899.9 + ptopq(6) = 800.0; pbotq(6) = 849.9 + ptopq(7) = 750.0; pbotq(7) = 799.9 + ptopq(8) = 700.0; pbotq(8) = 749.9 + ptopq(9) = 600.0; pbotq(9) = 699.9 + ptopq(10) = 500.0; pbotq(10) = 599.9 + ptopq(11) = 400.0; pbotq(11) = 499.9 + ptopq(12) = 300.0; pbotq(12) = 399.9 + ptopq(13) = 0.0; pbotq(13) = 299.9 + + + call convinfo(iotype_ps,iotype_q,iotype_t,iotype_uv,ntype_ps,ntype_q,ntype_t,ntype_uv,& + varqc_ps,varqc_q,varqc_t,varqc_uv,& + ituse_ps,ituse_q,ituse_t,ituse_uv,& + iosubtype_ps,iosubtype_q,iosubtype_t,iosubtype_uv) + + call process_conv_diag(input_file,ctype,mregion,nregion,np,ptop,pbot,ptopq,pbotq,& + rlatmin,rlatmax,rlonmin,rlonmax,iotype_ps,iotype_q,& + iotype_t,iotype_uv,varqc_ps,varqc_q,varqc_t,varqc_uv,& + ntype_ps,ntype_q,ntype_t,ntype_uv,& + iosubtype_ps,iosubtype_q,iosubtype_t,iosubtype_uv) + + + call creatstas_ctl(dtype_ps,iotype_ps,ituse_ps,100,ntype_ps,1,nregion,18,region,& + rlatmin,rlatmax,rlonmin,rlonmax,iosubtype_ps) + call creatstas_ctl(dtype_q,iotype_q,ituse_q,100,ntype_q,np,nregion,18,region,& + rlatmin,rlatmax,rlonmin,rlonmax,iosubtype_q) + call creatstas_ctl(dtype_t,iotype_t,ituse_t,100,ntype_t,np,nregion,18,& + region,rlatmin,rlatmax,rlonmin,rlonmax,iosubtype_t) + call creatstas_ctl(dtype_uv,iotype_uv,ituse_uv,100,ntype_uv,np,nregion,18,& + region,rlatmin,rlatmax,rlonmin,rlonmax,iosubtype_uv) + + stop + + end diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/conv_time/makefile.conv_time b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_time.fd/makefile.conv_time similarity index 96% rename from util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/conv_time/makefile.conv_time rename to util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_time.fd/makefile.conv_time index de1009ea99..ecc7160a4f 100755 --- a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/conv_time/makefile.conv_time +++ b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_time.fd/makefile.conv_time @@ -8,7 +8,7 @@ OBJS= mainconv_time.o read_conv.o convinfo2.o stas_time.o stas2ctl.o -CMD= conv_time.x +CMD= conmon_time.x all: $(CMD) diff --git a/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_time.fd/process_time_data.f90 b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_time.fd/process_time_data.f90 new file mode 100644 index 0000000000..c2cafdf1c8 --- /dev/null +++ b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_time.fd/process_time_data.f90 @@ -0,0 +1,1107 @@ +!--------------------------------------------------------------------------------- +! process_time_data.f90 +! +! module conmon_process_time_data +! +! This module reads and processes the conventional time series data, +! storing the results in files that are ready to be plotted in GrADS. +! +! Both binary and NetCDF formatted conventional diagnostic files are supported. +! The binary read is contained in this module. Reading NetCDF formatted files +! is done using the conmon_read_diag.F90 module. The conmon_read_diag module +! supports reading binary cnvstat files as well, but since what is here works, +! and the binary format is being replaced by NetCDF, it didn't make sense to +! spend the time to rebuild that which is not broken. +! +!--------------------------------------------------------------------------------- + +! intype : the observarion type like t for tem., uv for wind +! stype : the observation sub type, like t120 uv220 +! twork : the array to hold statistics for temperature: the first variable of +! array is vertical level, the second variable is the number of data type +! the third variable tatistics variable: 1: the total number +! 2:the number of data rejected by variational qc +! 3:bias,4:rms, 5: penalty,6: variational penalty +! the fourth variable is region, the fifth variable is the data usuage type +! 1, used, 2, rejected, 3, monited + + +module conmon_process_time_data + + + !--- use ---! + use nc_diag_read_mod, only: nc_diag_read_init, nc_diag_read_close, & + nc_diag_read_get_dim, nc_diag_read_get_global_attr, & + nc_diag_read_get_var_names, & + nc_diag_read_get_global_attr_names, & + nc_diag_read_get_var + + use ncdr_vars, only: nc_diag_read_check_var + + use conmon_read_diag + + + !--- implicit ---! + implicit none + + !--- public & private ---! + private + + public :: set_netcdf_flag + public :: process_conv_diag + + !--- common data structures ---! + logical,save :: netcdf = .false. + + + contains + + !------------------------------------------------------------ + ! subroutine set_netcdf_read + ! + ! set the use_netcdf flag to read either binary (default) or + ! netcdf formatted diagnostic files. + !------------------------------------------------------------ + subroutine set_netcdf_flag( use_netcdf ) + logical,intent(in) :: use_netcdf + + + netcdf = use_netcdf + + call set_netcdf_read( use_netcdf ) + + end subroutine set_netcdf_flag + + + !------------------------------------------------------------ + ! subroutine process_conv_diag + ! + ! Read and process conventional diagnostic files in either + ! binary or NetCDF format. Use the set_netcdf_read routine + ! to set the netcdf flag. + !------------------------------------------------------------ + ! + subroutine process_conv_diag(input_file,ctype,mregion,nregion,np, & + ptop,pbot,ptopq,pbotq, & + rlatmin,rlatmax,rlonmin,rlonmax,iotype_ps,iotype_q,& + iotype_t,iotype_uv,varqc_ps,varqc_q,varqc_t,varqc_uv,& + ntype_ps,ntype_q,ntype_t,ntype_uv,& + iosubtype_ps,iosubtype_q,iosubtype_t,iosubtype_uv) + + character(100) :: input_file + character(3) :: ctype ! only used with NetCDF formatted diag files + integer mregion,nregion,np + real(4),dimension(np) :: ptop,pbot,ptopq,pbotq + real,dimension(mregion) :: rlatmin,rlatmax,rlonmin,rlonmax + integer,dimension(100) :: iotype_ps,iotype_q,iotype_t,iotype_uv + real(4),dimension(100,2) :: varqc_ps,varqc_q,varqc_t,varqc_uv + integer ntype_ps,ntype_q,ntype_t,ntype_uv + integer,dimension(100) :: iosubtype_ps,iosubtype_q,iosubtype_t,iosubtype_uv + + real(4),dimension(np,100,6,nregion,3) :: twork,qwork,uwork,vwork,uvwork + real(4),dimension(1,100,6,nregion,3) :: pswork + + write(6,*) 'input_file = ', input_file + + if( netcdf ) then + write(6,*) ' call nc read subroutine' + call process_conv_nc( input_file, ctype, mregion,nregion,np,ptop,pbot,ptopq,pbotq,& + rlatmin,rlatmax,rlonmin,rlonmax,iotype_ps,iotype_q,& + iotype_t,iotype_uv,varqc_ps,varqc_q,varqc_t,varqc_uv,& + ntype_ps,ntype_q,ntype_t,ntype_uv,& + iosubtype_ps,iosubtype_q,iosubtype_t,iosubtype_uv, & + twork,uwork,vwork,uvwork ) + else + write(6,*) ' call bin read subroutine' + call process_conv_bin( input_file,mregion,nregion,np,ptop,pbot,ptopq,pbotq,& + rlatmin,rlatmax,rlonmin,rlonmax,iotype_ps,iotype_q,& + iotype_t,iotype_uv,varqc_ps,varqc_q,varqc_t,varqc_uv,& + ntype_ps,ntype_q,ntype_t,ntype_uv,& + iosubtype_ps,iosubtype_q,iosubtype_t,iosubtype_uv, & + twork,qwork,uwork,vwork,uvwork, pswork ) + + call output_data( twork, qwork, uwork, vwork, uvwork, pswork, & + ntype_ps, ntype_q, ntype_t, ntype_uv, nregion, np ) + end if + + + end subroutine process_conv_diag + + + + !----------------------------------------------------------- + ! subroutine process_conv_bin + ! + ! This routine reads and processes binary formatted + ! conventional diag files. + !----------------------------------------------------------- + subroutine process_conv_bin(input_file,mregion,nregion,np,ptop,pbot,ptopq,pbotq,& + rlatmin,rlatmax,rlonmin,rlonmax,iotype_ps,iotype_q,& + iotype_t,iotype_uv,varqc_ps,varqc_q,varqc_t,varqc_uv,& + ntype_ps,ntype_q,ntype_t,ntype_uv,& + iosubtype_ps,iosubtype_q,iosubtype_t,iosubtype_uv, & + twork,qwork,uwork,vwork,uvwork,pswork ) + + implicit none + + + character(100),intent(in) :: input_file + integer, intent(in) :: mregion + integer, intent(in) :: nregion + integer, intent(in) :: np + real(4),dimension(np),intent(in) :: ptop,pbot,ptopq,pbotq + real,dimension(mregion),intent(in) :: rlatmin,rlatmax,rlonmin,rlonmax + integer,dimension(100),intent(in) :: iotype_ps,iotype_q,iotype_t,iotype_uv + real(4),dimension(100,2),intent(in) :: varqc_ps,varqc_q,varqc_t,varqc_uv + integer, intent(in) :: ntype_ps,ntype_q,ntype_t + integer,dimension(100),intent(in) :: iosubtype_ps,iosubtype_q,iosubtype_uv,iosubtype_t + + real(4),dimension(np,100,6,nregion,3), intent(out) :: twork,qwork,uwork,vwork,uvwork + real(4),dimension(1,100,6,nregion,3), intent(out) :: pswork + + + + real(4),allocatable,dimension(:,:) :: rdiag + character(8),allocatable,dimension(:) :: cdiag + + character(3) :: dtype + + integer nchar,nreal,ii,mype,idate,iflag,itype + integer lunin,lunot,nreal1,nreal2,ldtype,intype + integer ilat,ilon,ipress,iqc,iuse,imuse,iwgt,ierr1 + integer ierr2,ierr3,ipsobs,iqobs,ioff02 + integer i,j,k,ltype,iregion,ntype_uv + integer iobg,iobgu,iobgv + integer nobs + + data lunin / 11 / + data lunot / 21 / + + + twork=0.0;qwork=0.0;uwork=0.0;vwork=0.0;uvwork=0.0 + pswork=0.0 + + itype=1;ilat=3;ilon=4;ipress=6;iqc=9;iuse=11;imuse=12 + iwgt=13;ierr1=14;ierr2=15;ierr3=16;iobg=18;iobgu=18;iobgv=21 + + write(6,*) 'input_file = ', input_file + open(lunin,file=input_file,form='unformatted') + rewind(lunin) + + read(lunin) idate + + print *, 'idate=',idate + print *,ptop(1),ptop(5) + print *,pbot(1),pbot(5) + + nobs = 0 + loopd: do + read(lunin,IOSTAT=iflag) dtype,nchar,nreal,ii,mype,ioff02 + if( iflag /= 0 ) exit loopd + + allocate(cdiag(ii),rdiag(nreal,ii)) + read(lunin,IOSTAT=iflag) cdiag,rdiag + + if( iflag /= 0 ) exit loopd + + + if(trim(dtype) == ' ps') then + call stascal(dtype,rdiag,nreal,ii,iotype_ps,varqc_ps,ntype_ps,& + pswork,uwork,vwork,1,ptop,pbot,nregion,mregion,& + rlatmin,rlatmax,rlonmin,rlonmax,iosubtype_ps) + nobs = nobs + 1 + else if(trim(dtype) == ' q') then + call stascal(dtype,rdiag,nreal,ii,iotype_q,varqc_q,ntype_q,& + qwork,uwork,vwork,np,ptopq,pbotq,nregion,mregion,& + rlatmin,rlatmax,rlonmin,rlonmax,iosubtype_q) + nobs = nobs + 1 + + else if(trim(dtype) == ' t') then + call stascal(dtype,rdiag,nreal,ii,iotype_t,varqc_t,ntype_t,& + twork,uwork,vwork,np,ptop,pbot,nregion,mregion,& + rlatmin,rlatmax,rlonmin,rlonmax,iosubtype_t) + nobs = nobs + 1 + + else if(trim(dtype) == ' uv') then + call stascal(dtype,rdiag,nreal,ii,iotype_uv,varqc_uv,ntype_uv,& + uvwork,uwork,vwork,np,ptop,pbot,nregion,mregion,& + rlatmin,rlatmax,rlonmin,rlonmax,iosubtype_uv) + nobs = nobs + 1 + endif + + deallocate(cdiag,rdiag) + + enddo loopd ! ending read data do loop + + close(lunin) + + print *, 'nobs processed = ', nobs + + end subroutine process_conv_bin + + + + !----------------------------------------------------------- + ! subroutine process_conv_nc + ! + ! This routine processes NetCDF formatted conventional + ! diag files. Note that NetCDF diag files contain only + ! a single type of data (ps, q, t, uv); the cnvstat + ! tar file contains 4 ges and 4 anl diag files. + !----------------------------------------------------------- + subroutine process_conv_nc( input_file, ctype, mregion, nregion, np, & + ptop, pbot, ptopq, pbotq, rlatmin, rlatmax, rlonmin, rlonmax, & + iotype_ps, iotype_q, iotype_t, iotype_uv, varqc_ps, varqc_q, & + varqc_t, varqc_uv, ntype_ps, ntype_q, ntype_t, ntype_uv, & + iosubtype_ps, iosubtype_q, iosubtype_t, iosubtype_uv, & + twork, uwork, vwork, uvwork ) + + use generic_list + use data + + implicit none + + + character(100),intent(in) :: input_file + character(3),intent(in) :: ctype + integer, intent(in) :: mregion + integer, intent(in) :: nregion + integer, intent(in) :: np + real(4),dimension(np),intent(in) :: ptop,pbot,ptopq,pbotq + real,dimension(mregion),intent(in) :: rlatmin,rlatmax,rlonmin,rlonmax + integer,dimension(100),intent(in) :: iotype_ps,iotype_q,iotype_t,iotype_uv + real(4),dimension(100,2),intent(in) :: varqc_ps,varqc_q,varqc_t,varqc_uv + integer, intent(in) :: ntype_ps,ntype_q,ntype_t + integer,dimension(100),intent(in) :: iosubtype_ps,iosubtype_q,iosubtype_uv,iosubtype_t + + !======================================================================== + ! NOTE: I think the *work arrays don't need to be params -- they are + ! just used here and can then be deallocated w/o issue. + !======================================================================== + ! + real(4),dimension(np,100,6,nregion,3), intent(out) :: twork,uwork,vwork,uvwork + real(4),dimension(np,100,6,nregion,3) :: qwork + real(4),dimension(1,100,6,nregion,3) :: pswork + + + type(list_node_t), pointer :: list => null() + type(list_node_t), pointer :: next => null() + type(data_ptr) :: ptr + + real(4),allocatable,dimension(:,:) :: rdiag + character(8),allocatable,dimension(:) :: cdiag + integer :: nobs = 0 + character(3) :: dtype + + integer nchar,nreal,ii,mype,idate,iflag,itype + integer lunin,lunot,nreal1,nreal2,ldtype,intype + integer ilat,ilon,ipress,iqc,iuse,imuse,iwgt,ierr1 + integer ierr2,ierr3,ipsobs,iqobs,ioff02 + integer jj, obs_ctr, k,ltype,iregion,ntype_uv + integer iobg,iobgu,iobgv + + data lunin / 11 / + data lunot / 21 / + + + print *, '--> process_conv_nc' + print *, ' input_file = ', input_file + print *, ' ctype = ', ctype + + twork=0.0; qwork=0.0; uwork=0.0; vwork=0.0; uvwork=0.0; pswork=0.0 + + call conmon_return_all_obs( input_file, ctype, nobs, list ) + print *, 'nobs read = ', nobs + + allocate( rdiag( max_rdiag_reals, nobs )) + next => list + + !------------------------------------------------------------------- + ! transfer data from list to rdiag array and accumulate stats using + ! stascal + ! + select case( adjustl( trim( ctype ))) + + case ( 'ps' ) + print *, ' select, case ps' + + obs_ctr = 0 + do while ( associated( next ) == .TRUE. ) + obs_ctr = obs_ctr + 1 + ptr = transfer(list_get( next ), ptr) + next => list_next( next ) + + do jj = 1, max_rdiag_reals + rdiag(jj, obs_ctr) = ptr%p%rdiag( jj ) + end do + + end do + + call stascal( ctype, rdiag, max_rdiag_reals, nobs, iotype_ps, varqc_ps, ntype_ps, & + pswork, uwork, vwork, 1, ptop, pbot, nregion, mregion, & + rlatmin, rlatmax, rlonmin, rlonmax, iosubtype_ps ) + + call list_free( list ) + + print *, 'found nobs in list = ', obs_ctr + + call output_data_ps( pswork, ntype_ps, nregion, 1 ) + + case ( 'q' ) + print *, ' select, case q' + + obs_ctr = 0 + do while ( associated( next ) == .TRUE. ) + obs_ctr = obs_ctr + 1 + ptr = transfer(list_get( next ), ptr) + next => list_next( next ) + + do jj = 1, max_rdiag_reals + rdiag(jj, obs_ctr) = ptr%p%rdiag( jj ) + end do + + end do + + print *, 'found nobs in list = ', obs_ctr + call list_free( list ) + + call stascal(ctype, rdiag, max_rdiag_reals, nobs, iotype_q, varqc_q, ntype_q, & + qwork, uwork, vwork, np, ptop, pbot, nregion, mregion, & + rlatmin, rlatmax, rlonmin, rlonmax, iosubtype_q) + + call output_data_q( qwork, ntype_q, nregion, np ) + + + case ( 't' ) + print *, ' select, case t' + + obs_ctr = 0 + do while ( associated( next ) == .TRUE. ) + obs_ctr = obs_ctr + 1 + ptr = transfer(list_get( next ), ptr) + next => list_next( next ) + + do jj = 1, max_rdiag_reals + rdiag(jj, obs_ctr) = ptr%p%rdiag( jj ) + end do + + end do + + print *, 'found nobs in list = ', obs_ctr + call list_free( list ) + + call stascal(ctype, rdiag, max_rdiag_reals, nobs, iotype_t, varqc_t, ntype_t, & + twork, uwork, vwork, np, ptop, pbot, nregion, mregion, & + rlatmin, rlatmax, rlonmin, rlonmax, iosubtype_t) + + call output_data_t( twork, ntype_t, nregion, np ) + + case ( 'uv' ) + print *, ' select, case uv' + + obs_ctr = 0 + do while ( associated( next ) == .TRUE. ) + obs_ctr = obs_ctr + 1 + ptr = transfer(list_get( next ), ptr) + next => list_next( next ) + + do jj = 1, max_rdiag_reals + rdiag(jj, obs_ctr) = ptr%p%rdiag( jj ) + end do + + end do + + print *, 'found nobs in list = ', obs_ctr + call list_free( list ) + + call stascal(ctype, rdiag, max_rdiag_reals, nobs, iotype_uv, varqc_uv, ntype_uv, & + uvwork, uwork, vwork, np, ptop, pbot, nregion, mregion, & + rlatmin, rlatmax, rlonmin, rlonmax, iosubtype_uv) + + call output_data_uv( uvwork, uwork, vwork, ntype_uv, nregion, np ) + + end select + + + if( allocated( rdiag )) deallocate( rdiag ) + + +! itype=1;ilat=3;ilon=4;ipress=6;iqc=9;iuse=11;imuse=12 +! iwgt=13;ierr1=14;ierr2=15;ierr3=16;iobg=18;iobgu=18;iobgv=21 +! +! write(6,*) 'input_file = ', input_file +! open(lunin,file=input_file,form='unformatted') +! rewind(lunin) +! +! read(lunin) idate +! +! print *, 'idate=',idate +! print *,ptop(1),ptop(5) +! print *,pbot(1),pbot(5) +! +! loopd: do +! read(lunin,IOSTAT=iflag) dtype,nchar,nreal,ii,mype,ioff02 +! if( iflag /= 0 ) exit loopd +! +! allocate(cdiag(ii),rdiag(nreal,ii)) +! read(lunin,IOSTAT=iflag) cdiag,rdiag +! +! if( iflag /= 0 ) exit loopd +! +! +! if( adjustl( trim( dtype )) == 'ps') then +! print *, ' identified ps case for stascal ' +! call stascal(dtype,rdiag,nreal,ii,iotype_ps,varqc_ps,ntype_ps,& +! pswork,uwork,vwork,1,ptop,pbot,nregion,mregion,& +! rlatmin,rlatmax,rlonmin,rlonmax,iosubtype_ps) + +! else if(trim(dtype) == ' q') then +! call stascal(dtype,rdiag,nreal,ii,iotype_q,varqc_q,ntype_q,& +! qwork,uwork,vwork,np,ptopq,pbotq,nregion,mregion,& +! rlatmin,rlatmax,rlonmin,rlonmax,iosubtype_q) +! +! else if(trim(dtype) == ' t') then +! call stascal(dtype,rdiag,nreal,ii,iotype_t,varqc_t,ntype_t,& +! twork,uwork,vwork,np,ptop,pbot,nregion,mregion,& +! rlatmin,rlatmax,rlonmin,rlonmax,iosubtype_t) +! +! else if(trim(dtype) == ' uv') then +! call stascal(dtype,rdiag,nreal,ii,iotype_uv,varqc_uv,ntype_uv,& +! uvwork,uwork,vwork,np,ptop,pbot,nregion,mregion,& +! rlatmin,rlatmax,rlonmin,rlonmax,iosubtype_uv) +! endif +! +! deallocate( rdiag ) +! +! enddo loopd ! ending read data do loop +! +! close(lunin) + + print *, '<-- process_conv_nc' + + end subroutine process_conv_nc + + + + subroutine output_data_ps( pswork, ntype_ps, nregion, np ) + + real(4),dimension(1,100,6,nregion,3), intent(inout) :: pswork + integer, intent(in) :: ntype_ps, nregion, np + + integer :: ii, jj, ltype, iregion + integer, parameter :: outfile = 21 + + write(6,*) '--> output_data_ps' + + do iregion = 1, nregion + + do jj = 1, 3 + + do ltype=1,ntype_ps + + pswork(1,ntype_ps+1,1,iregion,jj)= & + pswork(1,ntype_ps+1,1,iregion,jj) + pswork(1,ltype,1,iregion,jj) + pswork(1,ntype_ps+1,2,iregion,jj)= & + pswork(1,ntype_ps+1,2,iregion,jj) + pswork(1,ltype,2,iregion,jj) + pswork(1,ntype_ps+1,3,iregion,jj)= & + pswork(1,ntype_ps+1,3,iregion,jj) + pswork(1,ltype,3,iregion,jj) + pswork(1,ntype_ps+1,4,iregion,jj)= & + pswork(1,ntype_ps+1,4,iregion,jj) + pswork(1,ltype,4,iregion,jj) + pswork(1,ntype_ps+1,5,iregion,jj)= & + pswork(1,ntype_ps+1,5,iregion,jj) + pswork(1,ltype,5,iregion,jj) + pswork(1,ntype_ps+1,6,iregion,jj)= & + pswork(1,ntype_ps+1,6,iregion,jj) + pswork(1,ltype,6,iregion,jj) + + if(pswork(1,ltype,1,iregion,jj) >=1.0) then + pswork(1,ltype,3,iregion,jj)= & + pswork(1,ltype,3,iregion,jj)/pswork(1,ltype,1,iregion,jj) + pswork(1,ltype,4,iregion,jj)= & + sqrt(pswork(1,ltype,4,iregion,jj)/pswork(1,ltype,1,iregion,jj)) + pswork(1,ltype,5,iregion,jj)= & + pswork(1,ltype,5,iregion,jj)/pswork(1,ltype,1,iregion,jj) + pswork(1,ltype,6,iregion,jj)= & + pswork(1,ltype,6,iregion,jj)/pswork(1,ltype,1,iregion,jj) + endif + enddo + + !---------------------------------------------- + ! for the total surface pressure statistics + ! + if(pswork(1,ntype_ps+1,1,iregion,jj) >=1.0) then + pswork(1,ntype_ps+1,3,iregion,jj) = pswork(1,ntype_ps+1,3,iregion,jj)/& + pswork(1,ntype_ps+1,1,iregion,jj) + pswork(1,ntype_ps+1,4,iregion,jj) = sqrt(pswork(1,ntype_ps+1,4,iregion,jj)& + /pswork(1,ntype_ps+1,1,iregion,jj)) + pswork(1,ntype_ps+1,5,iregion,jj) = pswork(1,ntype_ps+1,5,iregion,jj)/& + pswork(1,ntype_ps+1,1,iregion,jj) + pswork(1,ntype_ps+1,6,iregion,jj) = pswork(1,ntype_ps+1,6,iregion,jj)/& + pswork(1,ntype_ps+1,1,iregion,jj) + endif + + enddo + enddo + + !-------------------- + ! write stas file + open( outfile, file='ps_stas', form='unformatted') + do jj=1,3 + do ii=1,6 + write( outfile ) ((pswork(1,ltype,ii,iregion,jj),ltype=1,ntype_ps+1),iregion=1,nregion) + enddo + enddo + + close( outfile ) + write(6,*) '<-- output_data_ps' + + end subroutine output_data_ps + + + subroutine output_data_q( qwork, ntype_q, nregion, np ) + + real(4),dimension(np,100,6,nregion,3), intent(inout) :: qwork + integer, intent(in) :: ntype_q, nregion, np + + integer :: ii, jj, kk, ltype, iregion + integer, parameter :: outfile = 31 + + + do iregion=1,nregion + do jj=1,3 + do kk=1,np + do ltype=1,ntype_q + qwork(kk,ntype_q+1,1,iregion,jj) = & + qwork(kk,ntype_q+1,1,iregion,jj)+qwork(kk,ltype,1,iregion,jj) + qwork(kk,ntype_q+1,2,iregion,jj) = & + qwork(kk,ntype_q+1,2,iregion,jj)+qwork(kk,ltype,2,iregion,jj) + qwork(kk,ntype_q+1,3,iregion,jj) = & + qwork(kk,ntype_q+1,3,iregion,jj)+qwork(kk,ltype,3,iregion,jj) + qwork(kk,ntype_q+1,4,iregion,jj) = & + qwork(kk,ntype_q+1,4,iregion,jj)+qwork(kk,ltype,4,iregion,jj) + qwork(kk,ntype_q+1,5,iregion,jj) = & + qwork(kk,ntype_q+1,5,iregion,jj)+qwork(kk,ltype,5,iregion,jj) + qwork(kk,ntype_q+1,6,iregion,jj) = & + qwork(kk,ntype_q+1,6,iregion,jj)+qwork(kk,ltype,6,iregion,jj) + + if(qwork(kk,ltype,1,iregion,jj) >=1.0) then + qwork(kk,ltype,3,iregion,jj) = & + qwork(kk,ltype,3,iregion,jj)/qwork(kk,ltype,1,iregion,jj) + qwork(kk,ltype,4,iregion,jj) = & + sqrt(qwork(kk,ltype,4,iregion,jj)/qwork(kk,ltype,1,iregion,jj)) + qwork(kk,ltype,5,iregion,jj) = & + qwork(kk,ltype,5,iregion,jj)/qwork(kk,ltype,1,iregion,jj) + qwork(kk,ltype,6,iregion,jj) = & + qwork(kk,ltype,6,iregion,jj)/qwork(kk,ltype,1,iregion,jj) + endif + enddo + + if(qwork(kk,ntype_q+1,1,iregion,jj) >=1.0) then + qwork(kk,ntype_q+1,3,iregion,jj)=qwork(kk,ntype_q+1,3,iregion,jj)/& + qwork(kk,ntype_q+1,1,iregion,jj) + qwork(kk,ntype_q+1,4,iregion,jj)=sqrt(qwork(kk,ntype_q+1,4,iregion,jj)/& + qwork(kk,ntype_q+1,1,iregion,jj)) + qwork(kk,ntype_q+1,5,iregion,jj)=qwork(kk,ntype_q+1,5,iregion,jj)/& + qwork(kk,ntype_q+1,1,iregion,jj) + qwork(kk,ntype_q+1,6,iregion,jj)=qwork(kk,ntype_q+1,6,iregion,jj)/& + qwork(kk,ntype_q+1,1,iregion,jj) + endif + enddo + enddo + enddo + + + !-------------------- + ! write stas file + ! + open( outfile, file='q_stas', form='unformatted' ) + + do jj=1,3 + do ii=1,6 + do kk=1,np + write( outfile ) (( qwork( kk,ltype,ii,iregion,jj ), ltype=1, ntype_q+1 ), iregion=1, nregion ) + enddo + enddo + enddo + + close( outfile ) + + write(6,*) '--> output_data_q' + + end subroutine output_data_q + + + + subroutine output_data_t( twork, ntype_t, nregion, np ) + + real(4),dimension(np,100,6,nregion,3), intent(inout) :: twork + integer, intent(in) :: ntype_t, nregion, np + + integer :: ii, jj, kk, ltype, iregion + integer, parameter :: outfile = 41 + + + write(6,*) '--> output_data' + do iregion=1,nregion + do jj=1,3 + do kk=1,np + do ltype=1,ntype_t + twork(kk,ntype_t+1,1,iregion,jj) = & + twork(kk,ntype_t+1,1,iregion,jj)+twork(kk,ltype,1,iregion,jj) + twork(kk,ntype_t+1,2,iregion,jj) = & + twork(kk,ntype_t+1,2,iregion,jj)+twork(kk,ltype,2,iregion,jj) + twork(kk,ntype_t+1,3,iregion,jj) = & + twork(kk,ntype_t+1,3,iregion,jj)+twork(kk,ltype,3,iregion,jj) + twork(kk,ntype_t+1,4,iregion,jj) = & + twork(kk,ntype_t+1,4,iregion,jj)+twork(kk,ltype,4,iregion,jj) + twork(kk,ntype_t+1,5,iregion,jj) = & + twork(kk,ntype_t+1,5,iregion,jj)+twork(kk,ltype,5,iregion,jj) + twork(kk,ntype_t+1,6,iregion,jj) = & + twork(kk,ntype_t+1,6,iregion,jj)+twork(kk,ltype,6,iregion,jj) + + if(twork(kk,ltype,1,iregion,jj) >=1.0) then + twork(kk,ltype,3,iregion,jj) = & + twork(kk,ltype,3,iregion,jj)/twork(kk,ltype,1,iregion,jj) + twork(kk,ltype,4,iregion,jj) = & + sqrt(twork(kk,ltype,4,iregion,jj)/twork(kk,ltype,1,iregion,jj)) + twork(kk,ltype,5,iregion,jj) = & + twork(kk,ltype,5,iregion,jj)/twork(kk,ltype,1,iregion,jj) + twork(kk,ltype,6,iregion,jj) = & + twork(kk,ltype,6,iregion,jj)/twork(kk,ltype,1,iregion,jj) + endif + enddo + + if(twork(kk,ntype_t+1,1,iregion,jj) >=1.0) then + twork(kk,ntype_t+1,3,iregion,jj) = twork(kk,ntype_t+1,3,iregion,jj)/& + twork(kk,ntype_t+1,1,iregion,jj) + twork(kk,ntype_t+1,4,iregion,jj)=sqrt(twork(kk,ntype_t+1,4,iregion,jj)/& + twork(kk,ntype_t+1,1,iregion,jj)) + twork(kk,ntype_t+1,5,iregion,jj)=twork(kk,ntype_t+1,5,iregion,jj)/& + twork(kk,ntype_t+1,1,iregion,jj) + twork(kk,ntype_t+1,6,iregion,jj)=twork(kk,ntype_t+1,6,iregion,jj)/& + twork(kk,ntype_t+1,1,iregion,jj) + endif + enddo ! kk + enddo ! jj + enddo ! nregion + + + !-------------------- + ! write stas file + ! + open( outfile, file='t_stas', form='unformatted' ) + + do jj=1,3 + do ii=1,6 + do kk=1,np + write( outfile ) (( twork( kk,ltype,ii,iregion,jj ), ltype=1, ntype_t+1 ), iregion=1, nregion ) + enddo + enddo + enddo + + close( outfile ) + + + end subroutine output_data_t + + + + subroutine output_data_uv( uvwork, uwork, vwork, ntype_uv, nregion, np ) + + real(4),dimension(np,100,6,nregion,3), intent(inout) :: uvwork, uwork, vwork + integer, intent(in) :: ntype_uv, nregion, np + + integer :: ii, jj, kk, ltype, iregion + integer, parameter :: outfile = 51 + + + write(6,*) '--> output_data_uv' + do iregion=1,nregion + do jj=1,3 + do kk=1,np + do ltype=1,ntype_uv + uvwork(kk,ntype_uv+1,1,iregion,jj) = & + uvwork(kk,ntype_uv+1,1,iregion,jj)+uvwork(kk,ltype,1,iregion,jj) + uvwork(kk,ntype_uv+1,2,iregion,jj) = & + uvwork(kk,ntype_uv+1,2,iregion,jj)+uvwork(kk,ltype,2,iregion,jj) + uvwork(kk,ntype_uv+1,3,iregion,jj) = & + uvwork(kk,ntype_uv+1,3,iregion,jj)+uvwork(kk,ltype,3,iregion,jj) + uvwork(kk,ntype_uv+1,4,iregion,jj) = & + uvwork(kk,ntype_uv+1,4,iregion,jj)+uvwork(kk,ltype,4,iregion,jj) + uvwork(kk,ntype_uv+1,5,iregion,jj) = & + uvwork(kk,ntype_uv+1,5,iregion,jj)+uvwork(kk,ltype,5,iregion,jj) + uvwork(kk,ntype_uv+1,6,iregion,jj) = & + uvwork(kk,ntype_uv+1,6,iregion,jj)+uvwork(kk,ltype,6,iregion,jj) + uwork(kk,ntype_uv+1,3,iregion,jj) = & + uwork(kk,ntype_uv+1,3,iregion,jj)+uwork(kk,ltype,3,iregion,jj) + uwork(kk,ntype_uv+1,4,iregion,jj) = & + uwork(kk,ntype_uv+1,4,iregion,jj)+uwork(kk,ltype,4,iregion,jj) + vwork(kk,ntype_uv+1,3,iregion,jj) = & + vwork(kk,ntype_uv+1,3,iregion,jj)+vwork(kk,ltype,3,iregion,jj) + vwork(kk,ntype_uv+1,4,iregion,jj) = & + vwork(kk,ntype_uv+1,4,iregion,jj)+vwork(kk,ltype,4,iregion,jj) + + if(uvwork(kk,ltype,1,iregion,jj) >=1.0) then + uvwork(kk,ltype,3,iregion,jj) = & + uvwork(kk,ltype,3,iregion,jj)/uvwork(kk,ltype,1,iregion,jj) + uvwork(kk,ltype,4,iregion,jj) = & + sqrt(uvwork(kk,ltype,4,iregion,jj)/uvwork(kk,ltype,1,iregion,jj)) + uvwork(kk,ltype,5,iregion,jj) = & + uvwork(kk,ltype,5,iregion,jj)/uvwork(kk,ltype,1,iregion,jj) + uvwork(kk,ltype,6,iregion,jj) = & + uvwork(kk,ltype,6,iregion,jj)/uvwork(kk,ltype,1,iregion,jj) + uwork(kk,ltype,1,iregion,jj) = uvwork(kk,ltype,1,iregion,jj) + vwork(kk,ltype,1,iregion,jj) = uvwork(kk,ltype,1,iregion,jj) + uwork(kk,ltype,2,iregion,jj) = uvwork(kk,ltype,2,iregion,jj) + vwork(kk,ltype,2,iregion,jj) = uvwork(kk,ltype,2,iregion,jj) + uwork(kk,ltype,3,iregion,jj) = & + uwork(kk,ltype,3,iregion,jj)/uvwork(kk,ltype,1,iregion,jj) + uwork(kk,ltype,4,iregion,jj) = & + sqrt(uwork(kk,ltype,4,iregion,jj)/uvwork(kk,ltype,1,iregion,jj)) + vwork(kk,ltype,3,iregion,jj) = & + vwork(kk,ltype,3,iregion,jj)/uvwork(kk,ltype,1,iregion,jj) + vwork(kk,ltype,4,iregion,jj) = & + sqrt(vwork(kk,ltype,4,iregion,jj)/uvwork(kk,ltype,1,iregion,jj)) + endif + enddo + + if(uvwork(kk,ntype_uv+1,1,iregion,jj) >=1.0) then + uvwork(kk,ntype_uv+1,3,iregion,jj)=uvwork(kk,ntype_uv+1,3,iregion,jj)& + /uvwork(kk,ntype_uv+1,1,iregion,jj) + uvwork(kk,ntype_uv+1,4,iregion,jj)=sqrt(uvwork(kk,ntype_uv+1,4,iregion,jj)& + /uvwork(kk,ntype_uv+1,1,iregion,jj)) + uvwork(kk,ntype_uv+1,5,iregion,jj)=uvwork(kk,ntype_uv+1,5,iregion,jj)& + /uvwork(kk,ntype_uv+1,1,iregion,jj) + uvwork(kk,ntype_uv+1,6,iregion,jj)=uvwork(kk,ntype_uv+1,6,iregion,jj)& + /uvwork(kk,ntype_uv+1,1,iregion,jj) + uwork(kk,ntype_uv+1,1,iregion,jj)=uvwork(kk,ntype_uv+1,1,iregion,jj) + uwork(kk,ntype_uv+1,2,iregion,jj)=uvwork(kk,ntype_uv+1,2,iregion,jj) + vwork(kk,ntype_uv+1,1,iregion,jj)=uvwork(kk,ntype_uv+1,1,iregion,jj) + vwork(kk,ntype_uv+1,2,iregion,jj)=uvwork(kk,ntype_uv+1,2,iregion,jj) + + uwork(kk,ntype_uv+1,3,iregion,jj)=uwork(kk,ntype_uv+1,3,iregion,jj)& + /uwork(kk,ntype_uv+1,1,iregion,jj) + uwork(kk,ntype_uv+1,4,iregion,jj)=sqrt(uwork(kk,ntype_uv+1,4,iregion,jj)& + /uwork(kk,ntype_uv+1,1,iregion,jj)) + vwork(kk,ntype_uv+1,3,iregion,jj)=vwork(kk,ntype_uv+1,3,iregion,jj)& + /vwork(kk,ntype_uv+1,1,iregion,jj) + vwork(kk,ntype_uv+1,4,iregion,jj)=sqrt(vwork(kk,ntype_uv+1,4,iregion,jj)& + /vwork(kk,ntype_uv+1,1,iregion,jj)) + endif + + enddo !!! enddo k height + enddo !!! enddo j, j=1 assimilated, j=2 rejected, j=3 monitored + enddo !!! enddo iregion region + + + open(51,file='u_stas',form='unformatted') + do jj=1,3 + do ii=1,6 + do kk=1,np + write(51) ((uwork(kk,ltype,ii,iregion,jj),ltype=1,ntype_uv+1),iregion=1,nregion) + enddo + enddo + enddo + + open(61,file='v_stas',form='unformatted') + do jj=1,3 + do ii=1,6 + do kk=1,np + write(61) ((vwork(kk,ltype,ii,iregion,jj),ltype=1,ntype_uv+1),iregion=1,nregion) + enddo + enddo + enddo + + open(71,file='uv_stas',form='unformatted') + do jj=1,3 + do ii=1,6 + do kk=1,np + write(71) ((uvwork(kk,ltype,ii,iregion,jj),ltype=1,ntype_uv+1), & + iregion=1,nregion) + enddo + enddo + enddo + + + write(6,*) '<-- output_data_uv' + + end subroutine output_data_uv + + + + !------------------------------------- + ! May need to break this into types + ! for netcdf, because the files only + ! contain a single type of data. + !------------------------------------- + subroutine output_data( twork, qwork, uwork, vwork, uvwork, pswork, & + ntype_ps, ntype_q, ntype_t, ntype_uv, nregion, np ) + + real(4),dimension(np,100,6,nregion,3), intent(inout) :: twork,qwork,uwork,vwork,uvwork + real(4),dimension(1,100,6,nregion,3), intent(inout) :: pswork + integer, intent(in) :: ntype_ps,ntype_q,ntype_t,ntype_uv,nregion,np + + integer :: i,j,k,ltype,iregion + + + write(6,*) '--> output_data' + do iregion=1,nregion + do j=1,3 + do ltype=1,ntype_ps + pswork(1,ntype_ps+1,1,iregion,j)= & + pswork(1,ntype_ps+1,1,iregion,j)+pswork(1,ltype,1,iregion,j) + pswork(1,ntype_ps+1,2,iregion,j)= & + pswork(1,ntype_ps+1,2,iregion,j)+pswork(1,ltype,2,iregion,j) + pswork(1,ntype_ps+1,3,iregion,j)= & + pswork(1,ntype_ps+1,3,iregion,j)+pswork(1,ltype,3,iregion,j) + pswork(1,ntype_ps+1,4,iregion,j)= & + pswork(1,ntype_ps+1,4,iregion,j)+pswork(1,ltype,4,iregion,j) + pswork(1,ntype_ps+1,5,iregion,j)= & + pswork(1,ntype_ps+1,5,iregion,j)+pswork(1,ltype,5,iregion,j) + pswork(1,ntype_ps+1,6,iregion,j)= & + pswork(1,ntype_ps+1,6,iregion,j)+pswork(1,ltype,6,iregion,j) + + if(pswork(1,ltype,1,iregion,j) >=1.0) then + pswork(1,ltype,3,iregion,j)= & + pswork(1,ltype,3,iregion,j)/pswork(1,ltype,1,iregion,j) + pswork(1,ltype,4,iregion,j)= & + sqrt(pswork(1,ltype,4,iregion,j)/pswork(1,ltype,1,iregion,j)) + pswork(1,ltype,5,iregion,j)= & + pswork(1,ltype,5,iregion,j)/pswork(1,ltype,1,iregion,j) + pswork(1,ltype,6,iregion,j)= & + pswork(1,ltype,6,iregion,j)/pswork(1,ltype,1,iregion,j) + endif + enddo + + !---------------------------------------------- + ! for the total surface pressure statistics + ! + if(pswork(1,ntype_ps+1,1,iregion,j) >=1.0) then + pswork(1,ntype_ps+1,3,iregion,j) = pswork(1,ntype_ps+1,3,iregion,j)/& + pswork(1,ntype_ps+1,1,iregion,j) + pswork(1,ntype_ps+1,4,iregion,j) = sqrt(pswork(1,ntype_ps+1,4,iregion,j)& + /pswork(1,ntype_ps+1,1,iregion,j)) + pswork(1,ntype_ps+1,5,iregion,j) = pswork(1,ntype_ps+1,5,iregion,j)/& + pswork(1,ntype_ps+1,1,iregion,j) + pswork(1,ntype_ps+1,6,iregion,j) = pswork(1,ntype_ps+1,6,iregion,j)/& + pswork(1,ntype_ps+1,1,iregion,j) + endif + + do k=1,np + do ltype=1,ntype_q + qwork(k,ntype_q+1,1,iregion,j) = & + qwork(k,ntype_q+1,1,iregion,j)+qwork(k,ltype,1,iregion,j) + qwork(k,ntype_q+1,2,iregion,j) = & + qwork(k,ntype_q+1,2,iregion,j)+qwork(k,ltype,2,iregion,j) + qwork(k,ntype_q+1,3,iregion,j) = & + qwork(k,ntype_q+1,3,iregion,j)+qwork(k,ltype,3,iregion,j) + qwork(k,ntype_q+1,4,iregion,j) = & + qwork(k,ntype_q+1,4,iregion,j)+qwork(k,ltype,4,iregion,j) + qwork(k,ntype_q+1,5,iregion,j) = & + qwork(k,ntype_q+1,5,iregion,j)+qwork(k,ltype,5,iregion,j) + qwork(k,ntype_q+1,6,iregion,j) = & + qwork(k,ntype_q+1,6,iregion,j)+qwork(k,ltype,6,iregion,j) + + if(qwork(k,ltype,1,iregion,j) >=1.0) then + qwork(k,ltype,3,iregion,j) = & + qwork(k,ltype,3,iregion,j)/qwork(k,ltype,1,iregion,j) + qwork(k,ltype,4,iregion,j) = & + sqrt(qwork(k,ltype,4,iregion,j)/qwork(k,ltype,1,iregion,j)) + qwork(k,ltype,5,iregion,j) = & + qwork(k,ltype,5,iregion,j)/qwork(k,ltype,1,iregion,j) + qwork(k,ltype,6,iregion,j) = & + qwork(k,ltype,6,iregion,j)/qwork(k,ltype,1,iregion,j) + endif + enddo + + if(qwork(k,ntype_q+1,1,iregion,j) >=1.0) then + qwork(k,ntype_q+1,3,iregion,j)=qwork(k,ntype_q+1,3,iregion,j)/& + qwork(k,ntype_q+1,1,iregion,j) + qwork(k,ntype_q+1,4,iregion,j)=sqrt(qwork(k,ntype_q+1,4,iregion,j)/& + qwork(k,ntype_q+1,1,iregion,j)) + qwork(k,ntype_q+1,5,iregion,j)=qwork(k,ntype_q+1,5,iregion,j)/& + qwork(k,ntype_q+1,1,iregion,j) + qwork(k,ntype_q+1,6,iregion,j)=qwork(k,ntype_q+1,6,iregion,j)/& + qwork(k,ntype_q+1,1,iregion,j) + endif + + do ltype=1,ntype_t + twork(k,ntype_t+1,1,iregion,j) = & + twork(k,ntype_t+1,1,iregion,j)+twork(k,ltype,1,iregion,j) + twork(k,ntype_t+1,2,iregion,j) = & + twork(k,ntype_t+1,2,iregion,j)+twork(k,ltype,2,iregion,j) + twork(k,ntype_t+1,3,iregion,j) = & + twork(k,ntype_t+1,3,iregion,j)+twork(k,ltype,3,iregion,j) + twork(k,ntype_t+1,4,iregion,j) = & + twork(k,ntype_t+1,4,iregion,j)+twork(k,ltype,4,iregion,j) + twork(k,ntype_t+1,5,iregion,j) = & + twork(k,ntype_t+1,5,iregion,j)+twork(k,ltype,5,iregion,j) + twork(k,ntype_t+1,6,iregion,j) = & + twork(k,ntype_t+1,6,iregion,j)+twork(k,ltype,6,iregion,j) + + if(twork(k,ltype,1,iregion,j) >=1.0) then + twork(k,ltype,3,iregion,j) = & + twork(k,ltype,3,iregion,j)/twork(k,ltype,1,iregion,j) + twork(k,ltype,4,iregion,j) = & + sqrt(twork(k,ltype,4,iregion,j)/twork(k,ltype,1,iregion,j)) + twork(k,ltype,5,iregion,j) = & + twork(k,ltype,5,iregion,j)/twork(k,ltype,1,iregion,j) + twork(k,ltype,6,iregion,j) = & + twork(k,ltype,6,iregion,j)/twork(k,ltype,1,iregion,j) + endif + enddo + + if(twork(k,ntype_t+1,1,iregion,j) >=1.0) then + twork(k,ntype_t+1,3,iregion,j) = twork(k,ntype_t+1,3,iregion,j)/& + twork(k,ntype_t+1,1,iregion,j) + twork(k,ntype_t+1,4,iregion,j)=sqrt(twork(k,ntype_t+1,4,iregion,j)/& + twork(k,ntype_t+1,1,iregion,j)) + twork(k,ntype_t+1,5,iregion,j)=twork(k,ntype_t+1,5,iregion,j)/& + twork(k,ntype_t+1,1,iregion,j) + twork(k,ntype_t+1,6,iregion,j)=twork(k,ntype_t+1,6,iregion,j)/& + twork(k,ntype_t+1,1,iregion,j) + endif + + do ltype=1,ntype_uv + uvwork(k,ntype_uv+1,1,iregion,j) = & + uvwork(k,ntype_uv+1,1,iregion,j)+uvwork(k,ltype,1,iregion,j) + uvwork(k,ntype_uv+1,2,iregion,j) = & + uvwork(k,ntype_uv+1,2,iregion,j)+uvwork(k,ltype,2,iregion,j) + uvwork(k,ntype_uv+1,3,iregion,j) = & + uvwork(k,ntype_uv+1,3,iregion,j)+uvwork(k,ltype,3,iregion,j) + uvwork(k,ntype_uv+1,4,iregion,j) = & + uvwork(k,ntype_uv+1,4,iregion,j)+uvwork(k,ltype,4,iregion,j) + uvwork(k,ntype_uv+1,5,iregion,j) = & + uvwork(k,ntype_uv+1,5,iregion,j)+uvwork(k,ltype,5,iregion,j) + uvwork(k,ntype_uv+1,6,iregion,j) = & + uvwork(k,ntype_uv+1,6,iregion,j)+uvwork(k,ltype,6,iregion,j) + uwork(k,ntype_uv+1,3,iregion,j) = & + uwork(k,ntype_uv+1,3,iregion,j)+uwork(k,ltype,3,iregion,j) + uwork(k,ntype_uv+1,4,iregion,j) = & + uwork(k,ntype_uv+1,4,iregion,j)+uwork(k,ltype,4,iregion,j) + vwork(k,ntype_uv+1,3,iregion,j) = & + vwork(k,ntype_uv+1,3,iregion,j)+vwork(k,ltype,3,iregion,j) + vwork(k,ntype_uv+1,4,iregion,j) = & + vwork(k,ntype_uv+1,4,iregion,j)+vwork(k,ltype,4,iregion,j) + + if(uvwork(k,ltype,1,iregion,j) >=1.0) then + uvwork(k,ltype,3,iregion,j) = & + uvwork(k,ltype,3,iregion,j)/uvwork(k,ltype,1,iregion,j) + uvwork(k,ltype,4,iregion,j) = & + sqrt(uvwork(k,ltype,4,iregion,j)/uvwork(k,ltype,1,iregion,j)) + uvwork(k,ltype,5,iregion,j) = & + uvwork(k,ltype,5,iregion,j)/uvwork(k,ltype,1,iregion,j) + uvwork(k,ltype,6,iregion,j) = & + uvwork(k,ltype,6,iregion,j)/uvwork(k,ltype,1,iregion,j) + uwork(k,ltype,1,iregion,j) = uvwork(k,ltype,1,iregion,j) + vwork(k,ltype,1,iregion,j) = uvwork(k,ltype,1,iregion,j) + uwork(k,ltype,2,iregion,j) = uvwork(k,ltype,2,iregion,j) + vwork(k,ltype,2,iregion,j) = uvwork(k,ltype,2,iregion,j) + uwork(k,ltype,3,iregion,j) = & + uwork(k,ltype,3,iregion,j)/uvwork(k,ltype,1,iregion,j) + uwork(k,ltype,4,iregion,j) = & + sqrt(uwork(k,ltype,4,iregion,j)/uvwork(k,ltype,1,iregion,j)) + vwork(k,ltype,3,iregion,j) = & + vwork(k,ltype,3,iregion,j)/uvwork(k,ltype,1,iregion,j) + vwork(k,ltype,4,iregion,j) = & + sqrt(vwork(k,ltype,4,iregion,j)/uvwork(k,ltype,1,iregion,j)) + endif + enddo + + if(uvwork(k,ntype_uv+1,1,iregion,j) >=1.0) then + uvwork(k,ntype_uv+1,3,iregion,j)=uvwork(k,ntype_uv+1,3,iregion,j)& + /uvwork(k,ntype_uv+1,1,iregion,j) + uvwork(k,ntype_uv+1,4,iregion,j)=sqrt(uvwork(k,ntype_uv+1,4,iregion,j)& + /uvwork(k,ntype_uv+1,1,iregion,j)) + uvwork(k,ntype_uv+1,5,iregion,j)=uvwork(k,ntype_uv+1,5,iregion,j)& + /uvwork(k,ntype_uv+1,1,iregion,j) + uvwork(k,ntype_uv+1,6,iregion,j)=uvwork(k,ntype_uv+1,6,iregion,j)& + /uvwork(k,ntype_uv+1,1,iregion,j) + uwork(k,ntype_uv+1,1,iregion,j)=uvwork(k,ntype_uv+1,1,iregion,j) + uwork(k,ntype_uv+1,2,iregion,j)=uvwork(k,ntype_uv+1,2,iregion,j) + vwork(k,ntype_uv+1,1,iregion,j)=uvwork(k,ntype_uv+1,1,iregion,j) + vwork(k,ntype_uv+1,2,iregion,j)=uvwork(k,ntype_uv+1,2,iregion,j) + + uwork(k,ntype_uv+1,3,iregion,j)=uwork(k,ntype_uv+1,3,iregion,j)& + /uwork(k,ntype_uv+1,1,iregion,j) + uwork(k,ntype_uv+1,4,iregion,j)=sqrt(uwork(k,ntype_uv+1,4,iregion,j)& + /uwork(k,ntype_uv+1,1,iregion,j)) + vwork(k,ntype_uv+1,3,iregion,j)=vwork(k,ntype_uv+1,3,iregion,j)& + /vwork(k,ntype_uv+1,1,iregion,j) + vwork(k,ntype_uv+1,4,iregion,j)=sqrt(vwork(k,ntype_uv+1,4,iregion,j)& + /vwork(k,ntype_uv+1,1,iregion,j)) + endif + + enddo !!! enddo k height + enddo !!! enddo j, j=1 assimilated, j=2 rejected, j=3 monitored + enddo !!! enddo iregion region + + + !-------------------- + ! write stas files + open(21,file='ps_stas',form='unformatted') + do j=1,3 + do i=1,6 + write(21) ((pswork(1,ltype,i,iregion,j),ltype=1,ntype_ps+1),iregion=1,nregion) + enddo + enddo + + open(31,file='q_stas',form='unformatted') + do j=1,3 + do i=1,6 + do k=1,np + write(31) ((qwork(k,ltype,i,iregion,j),ltype=1,ntype_q+1),iregion=1,nregion) + enddo + enddo + enddo + + open(41,file='t_stas',form='unformatted') + do j=1,3 + do i=1,6 + do k=1,np + write(41) ((twork(k,ltype,i,iregion,j),ltype=1,ntype_t+1),iregion=1,nregion) + enddo + enddo + enddo + + write(6,900) (twork(k,1,1,1,1),k=1,np) + 900 format(13f10.1) + + open(51,file='u_stas',form='unformatted') + do j=1,3 + do i=1,6 + do k=1,np + write(51) ((uwork(k,ltype,i,iregion,j),ltype=1,ntype_uv+1),iregion=1,nregion) + enddo + enddo + enddo + + open(61,file='v_stas',form='unformatted') + do j=1,3 + do i=1,6 + do k=1,np + write(61) ((vwork(k,ltype,i,iregion,j),ltype=1,ntype_uv+1),iregion=1,nregion) + enddo + enddo + enddo + + open(71,file='uv_stas',form='unformatted') + do j=1,3 + do i=1,6 + do k=1,np + write(71) ((uvwork(k,ltype,i,iregion,j),ltype=1,ntype_uv+1), & + iregion=1,nregion) + enddo + enddo + enddo + + + close(21) + close(31) + close(41) + close(51) + close(61) + close(71) + + write(6,*) '<-- output_data' + end subroutine output_data + +end module conmon_process_time_data diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/conv_time/stas2ctl.f90 b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_time.fd/stas2ctl.f90 similarity index 100% rename from util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/conv_time/stas2ctl.f90 rename to util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_time.fd/stas2ctl.f90 diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/conv_time/stas_time.f90 b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_time.fd/stas_time.f90 similarity index 94% rename from util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/conv_time/stas_time.f90 rename to util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_time.fd/stas_time.f90 index 22e9daad1a..04961d92a0 100644 --- a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/sorc/conv_time/stas_time.f90 +++ b/util/Conventional_Monitor/nwprod/conmon_shared/sorc/conmon_time.fd/stas_time.f90 @@ -121,11 +121,8 @@ subroutine stascal(dtype,rdiag,nreal,n,iotype,varqc,ntype,work,worku,& endif work(k,ltype,4,j,nn)=work(k,ltype,4,j,nn)+ress*ress - if(ltype ==1) then -! print *,rdiag(iobg,i),ress,work(k,ltype,4,j,nn),ltype,j,nn,work(k,ltype,1,j,nn) - endif - work(k,ltype,5,j,nn)=work(k,ltype,5,j,nn)+val2*rat_err2 - work(k,ltype,6,j,nn)=work(k,ltype,6,j,nn)+valqc + work(k,ltype,5,j,nn)=work(k,ltype,5,j,nn)+val2*rat_err2 + work(k,ltype,6,j,nn)=work(k,ltype,6,j,nn)+valqc endif !!! endif k enddo !!! enddo k endif !!! endif region diff --git a/util/Conventional_Monitor/nwprod/conmon_shared/ush/clean_tankdir.sh b/util/Conventional_Monitor/nwprod/conmon_shared/ush/clean_tankdir.sh new file mode 100755 index 0000000000..bb992b5763 --- /dev/null +++ b/util/Conventional_Monitor/nwprod/conmon_shared/ush/clean_tankdir.sh @@ -0,0 +1,83 @@ +#!/bin/bash + +#------------------------------------------------------------------ +# +# clean_tankdir.sh +# +#------------------------------------------------------------------ + set -ax + + echo "--> clean_tankdir.sh" + rc=0 + + #--------------------------------------------------------------- + # Algorithm + # + # 1. Build a list of $run.${PDY} directories. + # 2. All $CYC/conmon directories older than 40 days get + # deleted. + # 3. All $cyc/conmon/horz_hist directories older than 7 + # days get deleted. + #--------------------------------------------------------------- + + + #---------------------------------------- + # Get list of directories in $C_TANKDIR + # + dirs=`ls ${C_TANKDIR}` + + #----------------------------------------------- + # Determine number of days from $PDATE for all + # directories that start with "gdas". Note + # that this expects the directories to be in + # the format of ${RUN}.yyyymmdd. + # + for dir in $dirs; do + file_name="${dir##*/}" + file="${file_name%.*}" + file_extension="${file_name##*.}" + + if [ $file = $RUN ]; then + + #---------------------------------------------- + # Use date utility to determine number of days + # from PDATE. Note that time difference is + # calculated in seconds, hence the division + # by the number of seconds/day. + # + days=$(( ($(date --date=${PDY} +%s) - $(date --date=${file_extension} +%s) )/(60*60*24) )) + + #-------------------------------------- + # rm anything older than 40 days and + # horz_hist subdirectories older than + # 7 days + # + if [ $days -gt 40 ]; then + echo "RM ${C_TANKDIR}/$dir/00/conmon" + rm -rf ${C_TANKDIR}/$dir/00/conmon + echo "RM ${C_TANKDIR}/$dir/06/conmon" + rm -rf ${C_TANKDIR}/$dir/06/conmon + echo "RM ${C_TANKDIR}/$dir/12/conmon" + rm -rf ${C_TANKDIR}/$dir/12/conmon + echo "RM ${C_TANKDIR}/$dir/18/conmon" + rm -rf ${C_TANKDIR}/$dir/18/conmon + + elif [ $days -gt 7 ]; then + echo "RM ${C_TANKDIR}/${dir}/00/conmon/horz_hist" + rm -rf ${C_TANKDIR}/$dir/00/conmon/horz_hist + echo "RM ${C_TANKDIR}/${dir}/06/conmon/horz_hist" + rm -rf ${C_TANKDIR}/$dir/06/conmon/horz_hist + echo "RM ${C_TANKDIR}/${dir}/12/conmon/horz_hist" + rm -rf ${C_TANKDIR}/$dir/12/conmon/horz_hist + echo "RM ${C_TANKDIR}/${dir}/18/conmon/horz_hist" + rm -rf ${C_TANKDIR}/$dir/18/conmon/horz_hist + fi + + fi + + done + + echo "<-- clean_tankdir.sh" + +exit ${rc} + diff --git a/util/Conventional_Monitor/nwprod/conmon_shared/ush/diag2grad_ps_case.sh b/util/Conventional_Monitor/nwprod/conmon_shared/ush/diag2grad_ps_case.sh new file mode 100755 index 0000000000..b10233b975 --- /dev/null +++ b/util/Conventional_Monitor/nwprod/conmon_shared/ush/diag2grad_ps_case.sh @@ -0,0 +1,97 @@ +#!/bin/sh +set -xa + +#------------------------------------------------------- +# +# diag2grad_ps_case.sh +# +#------------------------------------------------------- + + echo "--> diag2grad_ps_case.sh" + + echo "CONMON_SUFFIX = $CONMON_SUFFIX" + echo "TANKDIR_conmon = $TANKDIR_conmon" + echo "type = $type" + echo "PDATE = $PDATE" + echo "EXECconmon = $EXECconmon" + echo "cycle = $cycle" + echo "nreal = $nreal" + echo "mtype = $mtype (type = $type)" + echo "subtype = $subtype" + echo "hint = $hint" + echo "workdir = $workdir" + echo "INPUT_FILE = ${INPUT_FILE}" + + + echo "CONMON_NETCDF = ${CONMON_NETCDF}" + netcdf=".false." + run_exe=1 + + if [ $CONMON_NETCDF -eq 1 ]; then + netcdf=".true." + fi + echo "netcdf = $netcdf" + + + ctype=`echo ${mtype} | cut -c3-5` + nreal_ps=$nreal ### one less than the data items of diagnostic files + nreal2_ps=`expr $nreal - 2` ### the data items in the grads files + + + if [ "$mtype" = 'ps180' -o "$mtype" = 'ps181' -o "$mtype" = 'ps183' -o "$mtype" = 'ps187' ]; then + rm -f diag2grads + cp $EXECconmon/conmon_grads_sfctime.x ./diag2grads + rm -f input + + cat <input + &input + input_file=${INPUT_FILE},intype=' ps', stype='${mtype}', + itype=$ctype, nreal=$nreal_ps, iscater=1, igrads=1, + timecard='time11', subtype='${subtype}', isubtype=${subtype}, + netcdf=${netcdf}, run=${run}, +/ +EOF + elif [ "$mtype" = 'ps120' ]; then + rm -f diag2grads + cp ${EXECconmon}/conmon_grads_sfc.x ./diag2grads + rm -f input + + cat <input + &input + input_file=${INPUT_FILE},intype=' ps',stype='${mtype}',itype=$ctype,nreal=$nreal_ps, + iscater=1,igrads=1,subtype='${subtype}',isubtype=${subtype},netcdf=${netcdf}, + netcdf=${netcdf}, run=${run}, +/ +EOF + else + run_exe=0 + fi + + if [ $run_exe -eq 1 ]; then + ./diag2grads stdout 2>&1 + + rm -f ${mtype}_${subtype}.tmp + + + mv stdout stdout_diag2grads_${mtype}_${subtype}.$run + dest_dir="${TANKDIR_conmon}/horz_hist/${run}" + + grads_list=`ls ps*grads.${run}` + for file in $grads_list; do + ${COMPRESS} ${file} + cp -f ${file}.${Z} ${dest_dir}/${file}.${PDATE}.${Z} + done + + scater_list=`ls ps*scater.${run}` + for file in $scater_list; do + ${COMPRESS} ${file} + cp -f ${file}.${Z} ${dest_dir}/${file}.${PDATE}.${Z} + done + + else + echo "abort run, unmatched mtype ${mtype} " + fi + + echo "<-- diag2grad_ps_case.sh" + +exit diff --git a/util/Conventional_Monitor/nwprod/conmon_shared/ush/diag2grad_q_case.sh b/util/Conventional_Monitor/nwprod/conmon_shared/ush/diag2grad_q_case.sh new file mode 100755 index 0000000000..8a51b34409 --- /dev/null +++ b/util/Conventional_Monitor/nwprod/conmon_shared/ush/diag2grad_q_case.sh @@ -0,0 +1,116 @@ +#!/bin/sh +set -xa + +#------------------------------------------------------------ +# +# diag2grad_q_case.sh +# +#------------------------------------------------------------ + +echo "--> diag2grad_q_case.sh" + + echo "CONMON_SUFFIX = $CONMON_SUFFIX" + echo "TANKDIR_conmon = $TANKDIR_conmon" + echo "type = $type" + echo "PDATE = $PDATE" + echo "EXECconmon = $EXECconmon" + echo "cycle = $cycle" + echo "run = $run " + echo "nreal = $nreal" + echo "mtype = $mtype (type = $type)" + echo "subtype = $subtype" + echo "hint = $hint" + echo "workdir = $workdir" + echo "INPUT_FILE = ${INPUT_FILE}" + + nreal_q=$nreal ### one less than the data items of diagnostic files + nreal2_q=`expr $nreal - 2` ### the data items in the grads files + + echo "CONMON_NETCDF = ${CONMON_NETCDF}" + netcdf=".false." + + if [ $CONMON_NETCDF -eq 1 ]; then + netcdf=".true." + fi + echo "netcdf = $netcdf" + + + run_exe=1 + ctype=`echo ${mtype} | cut -c2-4` + + if [ "$mtype" = 'q130' -o "$mtype" = 'q131' -o "$mtype" = 'q132' -o \ + "$mtype" = 'q133' -o "$mtype" = 'q134' -o "$mtype" = 'q135' ]; then + rm -f diag2grads + cp ${EXECconmon}/conmon_grads_lev.x ./diag2grads + + cat <input + &input + input_file=${INPUT_FILE}, + intype=' q',stype='${mtype}',itype=$ctype,nreal=$nreal_q, + iscater=1,igrads=1,levcard='alllev', + intv=$hint,subtype='${subtype}',isubtype=${subtype}, + netcdf=${netcdf}, + run=${run}, +/ +EOF + elif [ "$mtype" = 'q120' ]; then + rm -f diag2grads + cp ${EXECconmon}/conmon_grads_mandlev.x ./diag2grads + + cat <input + &input + input_file=${INPUT_FILE}, + intype=' q',stype='${mtype}',itype=$ctype,nreal=$nreal_q, + iscater=1,igrads=1,subtype='${subtype}',isubtype=${subtype}, + netcdf=${netcdf}, + run=${run}, +/ +EOF + elif [ "$mtype" = 'q180' -o "$mtype" = 'q181' -o "$mtype" = 'q182' -o "$mtype" = 'q183' -o "$mtype" = 'q187' ]; then + rm -f diag2grads + cp ${EXECconmon}/conmon_grads_sfctime.x ./diag2grads + + cat <input + &input + input_file=${INPUT_FILE}, + intype=' q',stype='${mtype}',itype=$ctype,nreal=$nreal_q, + iscater=1,igrads=1,timecard='time11',subtype='${subtype}',isubtype=${subtype}, + netcdf=${netcdf}, + run=${run}, +/ +EOF + + else + run_exe=0 + fi + + + if [ $run_exe -eq 1 ]; then + + ./diag2grads stdout 2>&1 + + + rm -f *tmp + mv stdout stdout_diag2grads_${mtype}_${subtype}.${run} + + dest_dir="${TANKDIR_conmon}/horz_hist/${run}" + + grads_list=`ls q*grads.${run}` + for file in $grads_list; do + ${COMPRESS} ${file} + cp -f ${file}.${Z} ${dest_dir}/${file}.${PDATE}.${Z} + done + + scater_list=`ls q*scater.${run}` + for file in $scater_list; do + ${COMPRESS} ${file} + cp -f ${file}.${Z} ${dest_dir}/${file}.${PDATE}.${Z} + done + + else + echo "aborting run, unmatched mtype ${mtype}" + fi + +echo "<-- diag2grad_q_case.sh" + +exit diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/ush/diag2grad_t_case.sh b/util/Conventional_Monitor/nwprod/conmon_shared/ush/diag2grad_t_case.sh similarity index 54% rename from util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/ush/diag2grad_t_case.sh rename to util/Conventional_Monitor/nwprod/conmon_shared/ush/diag2grad_t_case.sh index c5de8473aa..18e2c72e51 100755 --- a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/ush/diag2grad_t_case.sh +++ b/util/Conventional_Monitor/nwprod/conmon_shared/ush/diag2grad_t_case.sh @@ -9,17 +9,27 @@ set -xa echo "--> diag2grad_t_case.sh" - echo "CMON_SUFFIX = $CMON_SUFFIX" - echo "TANKDIR_cmon = $TANKDIR_cmon" + echo "CONMON_SUFFIX = $CONMON_SUFFIX" + echo "TANKDIR_conmon = $TANKDIR_conmon" echo "type = $type" echo "PDATE = $PDATE" - echo "EXECcmon = $EXECcmon" + echo "EXECconmon = $EXECconmon" echo "cycle = $cycle" echo "nreal = $nreal" echo "mtype = $mtype (type = $type)" echo "subtype = $subtype" echo "hint = $hint" echo "workdir = $workdir" + echo "INPUT_FILE = ${INPUT_FILE}" + + echo "CONMON_NETCDF = ${CONMON_NETCDF}" + netcdf=".false." + + if [ $CONMON_NETCDF -eq 1 ]; then + netcdf=".true." + fi + echo "netcdf = $netcdf" + ctype=`echo ${mtype} | cut -c2-4` nreal2=`expr $nreal - 2` @@ -27,61 +37,77 @@ echo "--> diag2grad_t_case.sh" echo ctype, nreal2 = $ctype, nreal2 fi - #t130_card=alllev - #t131_card=alllev - #t132_card=alllev - #t133_card=alllev - card=alllev + run_exe=1 if [[ -e ./diag2grads ]]; then rm -f ./diag2grads fi if [ "$mtype" = 't130' -o "$mtype" = 't131' -o "$mtype" = 't132' -o "$mtype" = 't133' -o "$mtype" = 't134' -o "$mtype" = 't135' ]; then - cp $EXECcmon/grads_lev.x ./diag2grads + cp $EXECconmon/conmon_grads_lev.x ./diag2grads cat <input &input + input_file=${INPUT_FILE}, intype=' t',stype='${mtype}',itype=$ctype,nreal=$nreal, iscater=1,igrads=1,levcard='$card',intv=$hint,subtype='${subtype}',isubtype=${subtype}, + netcdf=${netcdf}, run=${run}, / EOF elif [ "$mtype" = 't120' ]; then - cp $EXECcmon/grads_mandlev.x ./diag2grads + cp $EXECconmon/conmon_grads_mandlev.x ./diag2grads cat <input &input + input_file=${INPUT_FILE}, intype=' t',stype='${mtype}',itype=$ctype,nreal=$nreal, iscater=1,igrads=1,subtype='${subtype}',isubtype=${subtype}, + netcdf=${netcdf}, run=${run}, / EOF elif [ "$mtype" = 't180' -o "$mtype" = 't181' -o "$mtype" = 't182' -o "$mtype" = 't183' -o "$mtype" = 't187' ]; then - cp $EXECcmon/grads_sfc.x ./diag2grads + cp $EXECconmon/conmon_grads_sfc.x ./diag2grads cat <input &input + input_file=${INPUT_FILE}, intype=' t',stype='${mtype}',itype=$ctype,nreal=$nreal, iscater=1,igrads=1,subtype='${subtype}',isubtype=${subtype}, + netcdf=${netcdf}, run=${run}, / EOF + else + run_exe=0 fi -./diag2grads stdout 2>&1 + + if [ $run_exe -eq 1 ]; then + ./diag2grads stdout 2>&1 -rm -f *tmp -mv stdout stdout_diag2grads_${mtype}_${subtype}.${cycle} -dest_dir="${TANKDIR_cmon}/horz_hist/${cycle}" + rm -f *tmp + mv stdout stdout_diag2grads_${mtype}_${subtype}.${run} -for file in t*grads; do - mv ${file} ${dest_dir}/${file}.${PDATE} -done -for file in t*scater; do - mv ${file} ${dest_dir}/${file}.${PDATE} -done + dest_dir="${TANKDIR_conmon}/horz_hist/${run}" + + grads_list=`ls t*grads.${run}` + for file in $grads_list; do + ${COMPRESS} ${file} + cp -f ${file}.${Z} ${dest_dir}/${file}.${PDATE}.${Z} + done + + scater_list=`ls t*scater.${run}` + for file in $scater_list; do + ${COMPRESS} ${file} + cp -f ${file}.${Z} ${dest_dir}/${file}.${PDATE}.${Z} + done + + else + echo "aborting run, unmatched mtype ${mtype}" + fi echo "<-- diag2grad_t_case.sh" diff --git a/util/Conventional_Monitor/nwprod/conmon_shared/ush/diag2grad_uv_case.sh b/util/Conventional_Monitor/nwprod/conmon_shared/ush/diag2grad_uv_case.sh new file mode 100755 index 0000000000..af0116a69b --- /dev/null +++ b/util/Conventional_Monitor/nwprod/conmon_shared/ush/diag2grad_uv_case.sh @@ -0,0 +1,134 @@ +#!/bin/sh +set -xa + +#---------------------------------------------------------- +# +# diag2grad_uv_case.sh +# +#---------------------------------------------------------- + +echo "--> diag2grad_uv_case.sh" + + card=alllev + + nreal_uv=$nreal + nreal2_uv=`expr $nreal - 2` + echo "nreal2_uv = ", ${nreal2_uv} + echo "mtype = ", ${mtype} + + run_exe=1 + ctype=`echo ${mtype} | cut -c3-5` + + echo "CONMON_NETCDF = ${CONMON_NETCDF}" + netcdf=".false." + run_exe=1 + + if [ $CONMON_NETCDF -eq 1 ]; then + netcdf=".true." + fi + echo "netcdf = $netcdf" + + + if [ "$mtype" = 'uv221' -o "$mtype" = 'uv224' -o "$mtype" = 'uv229' -o "$mtype" = 'uv230' -o "$mtype" = 'uv231' -o "$mtype" = 'uv232' -o "$mtype" = 'uv233' -o "$mtype" = 'uv234' -o "$mtype" = 'uv235' -o "$mtype" = 'uv240' -o "$mtype" = 'uv241' -o "$mtype" = 'uv242' -o "$mtype" = 'uv243' -o "$mtype" = 'uv245' -o "$mtype" = 'uv246' -o "$mtype" = 'uv247' -o "$mtype" = 'uv248' -o "$mtype" = 'uv249' -o "$mtype" = 'uv250' -o "$mtype" = 'uv251' -o "$mtype" = 'uv252' -o "$mtype" = 'uv253' -o "$mtype" = 'uv254' -o "$mtype" = 'uv255' -o "$mtype" = 'uv256' -o "$mtype" = 'uv257' -o "$mtype" = 'uv258' -o "$mtype" = 'uv259' -o "$mtype" = 'uv260' ]; then + + rm -f diag2grads + cp ${EXECconmon}/conmon_grads_lev.x ./diag2grads + + rm -f input + cat <input + &input + input_file=${INPUT_FILE}, + intype=' uv',stype='${mtype}',itype=$ctype,nreal=$nreal_uv, + iscater=1,igrads=1,levcard='$card',intv=$hint,subtype='${subtype}',isubtype=${subtype}, + netcdf=${netcdf}, run=${run}, +/ +EOF + + elif [ "$mtype" = 'uv223' -o "$mtype" = 'uv224' -o "$mtype" = 'uv228' ]; then + + rm -f diag2grads + cp ${EXECconmon}/conmon_grads_sig.x ./diag2grads + rm -f input + + cat <input + &input + input_file=${INPUT_FILE}, + intype=' uv',stype='${mtype}',itype=$ctype,nreal=$nreal_uv, + iscater=1,igrads=1,subtype='${subtype}',isubtype=${subtype}, + netcdf=${netcdf}, run=${run}, +/ +EOF + + elif [ "$mtype" = 'uv220' ]; then + + rm -f diag2grads + cp ${EXECconmon}/conmon_grads_mandlev.x ./diag2grads + rm -f input + cat <input + &input + input_file=${INPUT_FILE}, + intype=' uv',stype='${mtype}',itype=$ctype,nreal=$nreal_uv, + iscater=1,igrads=1,subtype='${subtype}',isubtype=${subtype}, + netcdf=${netcdf}, run=${run}, +/ +EOF + + elif [ "$mtype" = 'uv280' -o "$mtype" = 'uv281' -o "$mtype" = 'uv282' -o "$mtype" = 'uv284' -o "$mtype" = 'uv286' -o "$mtype" = 'uv287' -o "$mtype" = 'uv290' -o "$mtype" = 'uv291' -o "$mtype" = 'uv296' ]; then + + rm -f diag2grads + cp ${EXECconmon}/conmon_grads_sfctime.x ./diag2grads + rm -f input + cat <input + &input + input_file=${INPUT_FILE}, + intype=' uv',stype='${mtype}',itype=$ctype,nreal=$nreal_uv, + iscater=1,igrads=1,timecard='time11',subtype='${subtype}',isubtype=${subtype}, + netcdf=${netcdf}, run=${run}, +/ +EOF + + elif [ "$mtype" = 'uv229' ]; then + + rm -f diag2grads + cp ${EXECconmon}/conmon_grads_sfctime.x ./diag2grads + rm -f input + cat <input + &input + input_file=${INPUT_FILE}, + intype=' uv',stype='${mtype}',itype=$ctype,nreal=$nreal_uv, + iscater=1,igrads=1,timecard='time7',subtype='${subtype}',isubtype=${subtype}, + netcdf=${netcdf}, run=${run}, +/ +EOF + + else + run_exe=0 + fi + + if [ $run_exe -eq 1 ]; then + ./diag2grads stdout 2>&1 + + rm -f *tmp + + mv stdout stdout_diag2grads_${mtype}_${subtype}.${run} + dest_dir="${TANKDIR_conmon}/horz_hist/${run}" + + grads_list=`ls uv*grads.${run}` + for file in $grads_list; do + ${COMPRESS} ${file} + cp -f ${file}.${Z} ${dest_dir}/${file}.${PDATE}.${Z} + done + + scater_list=`ls uv*scater.${run}` + for file in $scater_list; do + ${COMPRESS} ${file} + cp -f ${file}.${Z} ${dest_dir}/${file}.${PDATE}.${Z} + done + + else + echo "aborting run, unmatched mtype ${mtype}" + fi + +echo "<-- diag2grad_uv_case.sh" + +exit diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/ush/g2ctl.pl b/util/Conventional_Monitor/nwprod/conmon_shared/ush/g2ctl.pl similarity index 99% rename from util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/ush/g2ctl.pl rename to util/Conventional_Monitor/nwprod/conmon_shared/ush/g2ctl.pl index 7c06d780f2..6a905d9e56 100755 --- a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/ush/g2ctl.pl +++ b/util/Conventional_Monitor/nwprod/conmon_shared/ush/g2ctl.pl @@ -37,11 +37,12 @@ use Math::Trig qw(deg2rad rad2deg); -# ***** if wgrib2 is not on path, add it here -#$wgrib2='wgrib2'; -$wgrib2='/nwprod/util/exec/wgrib2'; -# $wgrib2='/export/cpc-lw-webisuzak/wd51we/bin.lnx64/wgrib2'; -# $wgrib2='/export/cpc-lw-webisuzak/wd51we/grib2/wgrib2/wgrib2'; +#------------------------------------------------ +# Assuming module grib_util/1.1.1 (or later) +# has been loaded, this should correctly +# set wgrib2. +# +$wgrib2="$ENV{ WGRIB2 }"; $wflag=""; $tflag="-VT"; diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/ush/get_typelist.pl b/util/Conventional_Monitor/nwprod/conmon_shared/ush/get_typelist.pl similarity index 100% rename from util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/ush/get_typelist.pl rename to util/Conventional_Monitor/nwprod/conmon_shared/ush/get_typelist.pl diff --git a/util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/ush/grib2ctl.pl b/util/Conventional_Monitor/nwprod/conmon_shared/ush/grib2ctl.pl similarity index 100% rename from util/Conventional_Monitor/nwprod/cmon_shared.v1.0.0/ush/grib2ctl.pl rename to util/Conventional_Monitor/nwprod/conmon_shared/ush/grib2ctl.pl diff --git a/util/Conventional_Monitor/nwprod/conmon_shared/ush/horz_hist.sh b/util/Conventional_Monitor/nwprod/conmon_shared/ush/horz_hist.sh new file mode 100755 index 0000000000..9e93fc6ce3 --- /dev/null +++ b/util/Conventional_Monitor/nwprod/conmon_shared/ush/horz_hist.sh @@ -0,0 +1,136 @@ +#!/bin/sh + +#------------------------------------------------------------------ +# +# horz_hist.sh +# +#------------------------------------------------------------------ + + set -ax + + echo "--> horz_hist.sh" + date + rc=0 + + echo "CONMON_SUFFIX = $CONMON_SUFFIX" + export hint=10 ##(mb) the plot pressure interval press+-hint + + #---------------------------------------------------------- + # The list of data type, based on convinfo.txt file + #---------------------------------------------------------- + ps_TYPE=`${USHconmon}/get_typelist.pl --file $convinfo --type ps --mon` + q_TYPE=`${USHconmon}/get_typelist.pl --file $convinfo --type q --mon` + + t_TYPE=`${USHconmon}/get_typelist.pl --file $convinfo --type t --mon` + uv_TYPE=`${USHconmon}/get_typelist.pl --file $convinfo --type uv --mon` + + + echo TANKDIR_conmon = $TANKDIR_conmon + + mkdir -p ${TANKDIR_conmon}/horz_hist/ges + mkdir -p ${TANKDIR_conmon}/horz_hist/anl + + export nreal_ps=${nreal_ps:-19} + export nreal_q=${nreal_q:-20} + export nreal_t=${nreal_t:-24} + export nreal_uv=${nreal_uv:-23} + + + for type in ps q t uv; do + + eval stype=\${${type}_TYPE} + eval nreal=\${nreal_${type}} + exec=read_${type} + + #--------------------------------- + # decoding the dignostic file + #--------------------------------- + + for dtype in ${stype}; do + + mtype=`echo ${dtype} | cut -f1 -d_ | xargs` + subtype=`echo ${dtype} | cut -f2 -d_ | xargs` + + if [[ "$VERBOSE" = "YES" ]]; then + echo "DEBUG: dtype = $dtype" + echo "mtype, subtype = $mtype, $subtype" + fi + + for run in ges anl; do + + #------------------------------------------------------------- + # Because few things in life are convenient or consistent, + # the cnvstat has different contents depending on file type. + # + # Binary cnvstat files contain 2 diag files (ges and anl), + # while NetCDF cnvstat files contain a diag file for each + # data type (ps, q, t, etc) as well as run (ges, anl). + #------------------------------------------------------------- + if [[ $CONMON_NETCDF -eq 0 ]]; then + export INPUT_FILE="diag_conv_${run}.${PDATE}" + else + export INPUT_FILE="diag_conv_${type}_${run}.${PDATE}" + fi + echo "INPUT_FILE = ${INPUT_FILE}" + + + if [[ "$VERBOSE" = "YES" ]]; then + echo "run = $run" + fi + + ${USHconmon}/diag2grad_${type}_case.sh + + done #### done with run + + done ### done with dtype + + done ### done with type + + + #--------------------------------------- + # tar, compress, and move stdout files + #--------------------------------------- + for run in ges anl; do + stdout_tar=stdout.${PDATE}.${run}.tar + tar -cvf ${stdout_tar} stdout*.${run} + ${COMPRESS} ${stdout_tar} + + dest_dir=${TANKDIR_conmon}/horz_hist/${run} + mv -f ${stdout_tar}.${Z} ${dest_dir}/. + + cat *nobs.${run} > nobs.${run}.${PDATE} + cp nobs.${run}.${PDATE} ${dest_dir}/. + + #--------------------------------- + # run the mk_low_cnt.pl script + #--------------------------------- + ${USHconmon}/mk_low_cnt.pl --net ${CONMON_SUFFIX} \ + --run ${RUN} --cyc ${PDATE} \ + --nobsf ${TANKDIR_conmon}/horz_hist/${run}/nobs.${run}.${PDATE} \ + --lcntf ${TANKDIR_conmon}/horz_hist/${run}/low_cnt.${run}.${PDATE} \ + --basef ${conmon_base} + + + #-------------------------------- + # run the mk_err_rpt.pl script + #-------------------------------- + low_cnt_file=${TANKDIR_conmon}/horz_hist/${run}/low_cnt.${run}.${PDATE} + if [[ -e ${low_cnt_file}.gz ]]; then + $UNCOMPRESS ${low_cnt_file}.gz + fi + + prev_low_cnt_file=${TANKDIR_prev_conmon}/horz_hist/${run}/low_cnt.${run}.${GDATE} + if [[ -e ${prev_low_cnt_file}.gz ]]; then + $UNCOMPRESS ${prev_low_cnt_file}.gz + fi + + ${USHconmon}/mk_err_rpt.pl --net ${CONMON_SUFFIX} --run ${RUN} \ + --lcf ${low_cnt_file} --plcf ${prev_low_cnt_file} \ + --cyc0 ${PDATE} --cyc1 ${GDATE} \ + --errf ${TANKDIR_conmon}/horz_hist/${run}/err_rpt.${run}.${PDATE} + done + +echo "<-- horz_hist.sh" + +exit ${rc} + diff --git a/util/Conventional_Monitor/nwprod/conmon_shared/ush/mk_err_rpt.pl b/util/Conventional_Monitor/nwprod/conmon_shared/ush/mk_err_rpt.pl new file mode 100755 index 0000000000..39fb3ed71b --- /dev/null +++ b/util/Conventional_Monitor/nwprod/conmon_shared/ush/mk_err_rpt.pl @@ -0,0 +1,200 @@ +#! /usr/bin/perl + +#----------------------------------------------------------------------- +#----------------------------------------------------------------------- +# mk_err_rpt.pl +# +# Arguments: +# --net : Data source idenifier. Default is GFS. +# --run : Run name, generally 'gdas' or 'gfs'. gdas +# is the default value. +# --lcf : Low count file for the current cycle. +# --plcf : Low count file for the previous cycle. +# --cyc0 : Current cycle time. +# --cyc1 : Previous cycle time. +# --errf : Output error file. +# +#----------------------------------------------------------------------- +#----------------------------------------------------------------------- + + use strict; + use warnings; + use Getopt::Long; + use Scalar::Util qw(looks_like_number); + + + #--------------------------------------------------------- + # subroutine trim + # + # strip leading and trailing white space from a string + #--------------------------------------------------------- + sub trim { + my $s = shift; + $s =~ s/^\s+|\s+$//g; + return $s + }; + + + ##------------------------------------------------------------------ + ##------------------------------------------------------------------ + ##------------------------------------------------------------------ + ## + ## begin main + ## + ##------------------------------------------------------------------ + ##------------------------------------------------------------------ + ##------------------------------------------------------------------ + + my $net = 'GFS'; + my $run = 'gdas'; + my $lcf = ''; + my $plcf = ''; + my $cyc0 = ''; + my $cyc1 = ''; + my $errf = ''; + + GetOptions( 'net:s' => \$net, + 'run:s' => \$run, + 'lcf:s' => \$lcf, + 'plcf:s' => \$plcf, + 'cyc0:s' => \$cyc0, + 'cyc1:s' => \$cyc1, + 'errf:s' => \$errf ); + + print " net = $net\n"; + print " run = $run\n"; + print " lcf = $lcf\n"; + print " plcf = $plcf\n"; + print " cyc0 = $cyc0\n"; + print " cyc1 = $cyc1\n"; + print " errf = $errf\n"; + + + #------------------------------------------------- + # read in lcf and create a hash to an array + # of its contents + # + open( FILE, "${lcf}" ) or die( "Unable to open low count file ${lcf}" ); + my @low_cnt = ; + close( FILE ); + + my %lcf_hash; + foreach( @low_cnt ) { + my @words = split /,/, $_; + my $key = trim( $words[0] ); + + my @vals = trim( $words[1] ); + push @vals ,trim( $words[2] ); + push @vals ,trim( $words[3] ); + + $lcf_hash{ $key } = \@vals; + } + + + #------------------------------------------------ + # read in plcf and create hash to oan array + # of its contents + # + open( FILE, "${plcf}" ) or die( "Unable to open prev low count file ${plcf}" ); + my @prev_low_cnt = ; + close( FILE ); + + my %plcf_hash; + foreach( @prev_low_cnt ) { + my @words = split /,/, $_; + my $key = trim( $words[0] ); + + my @vals = trim( $words[1] ); + push @vals ,trim( $words[2] ); + push @vals ,trim( $words[3] ); + + $plcf_hash{ $key } = \@vals; + } + + + + open( FILE, '>', "${errf}" ) or die( "Unable to open error file ${errf}" ); + print FILE "ConMon low count warning report\n"; + print FILE "\n"; + print FILE "\n"; + print FILE " Net: $net\n"; + print FILE " Run: $run\n"; + print FILE " Cycle: $cyc0\n"; + print FILE "\n"; + print FILE "\n"; + + #----------------------------------------------------------------- + # Traverse the keys to lcf_hash and determine if the same key is + # found in the plcf_hash. If so write to warning file. + # + my $ctr = 0; + + foreach my $key ( keys %lcf_hash ){ + if( exists $plcf_hash{ $key }){ + + $ctr++; + my @lcf_vals = @{ $lcf_hash{ $key }}; + my @plcf_vals = @{ $plcf_hash{ $key }}; + + #------------------------------------------------------------------ + # Note there's a mismatch between how the type and subtype values + # are used in nbns and how they are used by GrADS to produce the + # resulting image file names. The net result is that the key is + # in formate $type_$subtype and we need to pass a value that + # matches the image file name, so it's $type-$subtype (note hyphen + # not underscore) and subtype 00 needs to become 0. This value is + # then used in the hyperlink as the value for 'src'. + # + my $type_str = $key; + $type_str =~ s/_00/-0/; + $type_str =~ s/_03/-3/; + $type_str =~ s/_04/-4/; + $type_str =~ s/_05/-5/; + $type_str =~ s/_/-/; + + #----------------------------------------------------- + # All ps plots, and some of the q, t and uv types use + # surface time series plots instead of time series. + # + my $ptype = "time"; + if( $type_str =~ m/ps/ || + $type_str =~ m/q18/ || $type_str =~ m/t18/ || + $type_str =~ m/uv28/ || $type_str =~ m/uv29/ ) { + $ptype = "surftime"; + } + + print FILE " $key \n"; + printf FILE " cycle: % d", $cyc1; + printf FILE " count: %6s", $plcf_vals[0]; + printf FILE " bound: %10.1f", $plcf_vals[1]; + printf FILE " avg: %10.1f \n", $plcf_vals[2]; + + printf FILE " cycle: % d", $cyc0; + printf FILE " count: %6s", $lcf_vals[0]; + printf FILE " bound: %10.1f", $lcf_vals[1]; + printf FILE " avg: %10.1f \n", $lcf_vals[2]; + print FILE " https://www.emc.ncep.noaa.gov/gmb/gdas/es_conv/index.html?net=$net&run=$run&src=$type_str&vtype=count&ptype=$ptype\n\n"; + } + } + + #------------------- + # report footer + # + print FILE "\n\n\n"; + print FILE "*********************** WARNING ***************************\n"; + print FILE "This is an automated email. Replies to sender will not be \n"; + print FILE 'received. Please direct replies to edward.safford@noaa.gov'; + print FILE " \n"; + print FILE "*********************** WARNING ***************************\n"; + + close( FILE ); + + + #-------------------------------------------- + # if no keys overlapped then delete the errf + # + if( $ctr <= 0 ){ + unlink $errf or warn "Could not unlink $errf: $!"; + } + +exit 0 diff --git a/util/Conventional_Monitor/nwprod/conmon_shared/ush/mk_low_cnt.pl b/util/Conventional_Monitor/nwprod/conmon_shared/ush/mk_low_cnt.pl new file mode 100755 index 0000000000..d4c2e70302 --- /dev/null +++ b/util/Conventional_Monitor/nwprod/conmon_shared/ush/mk_low_cnt.pl @@ -0,0 +1,156 @@ +#! /usr/bin/perl + +#----------------------------------------------------------------------- +#----------------------------------------------------------------------- +# mk_low_cnt.pl +# +# Arguments: +# --cyc : 10 digit cycle time. Required input. +# --net : data source idenifier. Default is GFS. +# --run : Run name, generally 'gdas' or 'gfs'. gdas is the +# default value. +# +#----------------------------------------------------------------------- +#----------------------------------------------------------------------- + + use strict; + use warnings; + use Getopt::Long; + use Scalar::Util qw(looks_like_number); + + + #--------------------------------------------------------- + # subroutine trim + # + # strip leading and trailing white space from a string + #--------------------------------------------------------- + sub trim { + my $s = shift; + $s =~ s/^\s+|\s+$//g; + return $s + }; + + + ##------------------------------------------------------------------ + ##------------------------------------------------------------------ + ##------------------------------------------------------------------ + ## + ## begin main + ## + ##------------------------------------------------------------------ + ##------------------------------------------------------------------ + ##------------------------------------------------------------------ + + my $net = 'GFS'; + my $run = 'gdas'; + my $cyc = ''; + my $nobsf = ''; + my $lcntf = ''; + my $basef = ''; + + GetOptions( 'net:s' => \$net, + 'run:s' => \$run, + 'cyc:s' => \$cyc, + 'nobsf:s' => \$nobsf, + 'lcntf:s' => \$lcntf, + 'basef:s' => \$basef ); + + print " net = $net\n"; + print " run = $run\n"; + print " cyc = $cyc\n"; + print " nobsf = $nobsf\n"; + print " lcntf = $lcntf\n"; + print " basef = $basef\n"; + + if( length( $cyc ) != 10 ){ + print "Error: cyc value of $cyc is missing or invalid\n"; + exit 1 + } + + #----------------------------- + # uncompress the nobs file + # + my $compressed_nobs = "${nobsf}.gz"; + if( -e $compressed_nobs ){ + system( "gunzip ${compressed_nobs}" ); + } + + + #----------------------- + # read in nobs file + # + open( FILE, "${nobsf}" ) or die( "Unable to open ${nobsf}" ); + my @nobs_data = ; + close( FILE ); + + my $hr = substr( $cyc, -2 ); + + #-------------------------------------------- + # This is a simple csv file, so break on the + # comma and push to %nobs_hash. + # + my %nobs_hash; + foreach ( @nobs_data ) { + my @words = split /,/, $_; + print " words = @words\n"; + my $key = trim( $words[0] ) . "_" . trim( $words[1] ); + my $value = trim( $words[2] ); + $nobs_hash{ $key } = $value; + } + + #------------------------------------------------ + # read in gdas_conmon_base.txt, load into hash + # + open( FILE, "${basef}" ) or die( "Unable to open ${basef}" ); + my @base_data = ; + close( FILE ); + + my %base_hash; + foreach ( @base_data ) { + my @words = split /,/, $_; + print " words = @words\n"; + my $base_hr = trim( $words[0] ); + my $key = trim( $words[1] ); + my $value = trim( $words[2] ); + + print "base_hr, hr = $base_hr, $hr \n" ; + + if( $base_hr == $hr ) { + print " adding $value to hash with key $key\n"; + $base_hash{ $key } = $value; + } + else { + print " not this hour\n"; + } + } + + + foreach my $key (keys %base_hash) { + my $value = $base_hash{$key}; + } + + + #-------------------------------------- + # Compare nobs count to base. + # Create entry in low_cnt.txt file. + # If count is low write to low_cnt. + # + open( FILE, '>', "${lcntf}" ) or die( "Unable to open ${lcntf}" ); + + foreach my $key (keys %nobs_hash) + { + my $nobs = $nobs_hash{ $key }; + my $bound = $base_hash{ $key }; + my $avg = $bound; + + #-------------------------------------------- + # start with a gross check of 75% of average + # + $bound = $bound * 0.75; + + if( $nobs < $bound ) { + print FILE "$key, $nobs, $bound, $avg\n"; + } + } + close( FILE ); + diff --git a/util/Conventional_Monitor/nwprod/conmon_shared/ush/time_vert.sh b/util/Conventional_Monitor/nwprod/conmon_shared/ush/time_vert.sh new file mode 100755 index 0000000000..f3b49b8f2a --- /dev/null +++ b/util/Conventional_Monitor/nwprod/conmon_shared/ush/time_vert.sh @@ -0,0 +1,174 @@ +#!/bin/sh +set -xa + +#---------------------------------------------------- +# This script performs the data extraction for the +# the time and vertical profile plots. +# +# time_vert.sh +# +#---------------------------------------------------- + +echo "--> time_vert.sh" + + echo " $CWD" + + rc=0 + export nregion=10 + + echo "CONMON_NETCDF = ${CONMON_NETCDF}" + netcdf=".false." + + if [ $CONMON_NETCDF -eq 1 ]; then + netcdf=".true." + fi + echo "netcdf = $netcdf" + + + #------------------------------------------ + # set up TANKDIR (output) sub-directories + # + echo TANKDIR_conmon = $TANKDIR_conmon + export savedir=$TANKDIR_conmon/time_vert + mkdir -p ${savedir} + + + echo "convinfo = $convinfo" # defined in calling script + cp ${convinfo} ./convinfo + + export execfile=${EXECconmon}/conmon_time.x + cp ${execfile} ./execfile + + export CYA=`echo $PDATE | cut -c9-10` + + + hour=`echo $PDATE | cut -c9-10` + dday=`echo $PDATE | cut -c7-8` + + + if [ $CONMON_NETCDF -eq 0 ]; then + + for run in ges anl; do + + echo " cycle = $cycle " + + ${UNCOMPRESS} ./diag_conv_${run}.${PDATE}.${Z} + + cat << EOF > input +&input + input_file=diag_conv_${run}.${PDATE}, + nregion=${nregion}, + netcdf=${netcdf}, + run=${run}, + region(1)='GL',rlonmin(1)=-180.0,rlonmax(1)=180.0,rlatmin(1)=-90.0,rlatmax(1)= 90.0, + region(2)='NH',rlonmin(2)=-180.0,rlonmax(2)=180.0,rlatmin(2)= 20.0,rlatmax(2)= 90.0, + region(3)='SH',rlonmin(3)=-180.0,rlonmax(3)=180.0,rlatmin(3)=-90.0,rlatmax(3)=-20.0, + region(4)='TR',rlonmin(4)=-180.0,rlonmax(4)=180.0,rlatmin(4)=-20.0,rlatmax(4)= 20.0, + region(5)='USA',rlonmin(5)=-125.0,rlonmax(5)=-65.0,rlatmin(5)=25.0,rlatmax(5)=50.0, + region(6)='CAN',rlonmin(6)=-125.0,rlonmax(6)=-65.0,rlatmin(6)= 50.0,rlatmax(6)= 90.0, + region(7)='N&CA',rlonmin(7)=-165.0,rlonmax(7)=-60.0, rlatmin(7)= 0.0,rlatmax(7)=90.0, + region(8)='S&CA',rlonmin(8)=-165.0,rlonmax(8)=-30.0,rlatmin(8)=-90.0,rlatmax(8)=0.0, + region(9)='EU',rlonmin(9)=-10.0,rlonmax(9)=25.0,rlatmin(9)=35.0,rlatmax(9)=70.0, + region(10)='AS',rlonmin(10)=65.0,rlonmax(10)=145.0,rlatmin(10)=5.0,rlatmax(10)=45.0, +/ +EOF + + stdout=stdout_${run}.${PDATE} + ./execfile ${stdout} 2>&1 + + echo " execfile completed " + + + cp uv_stas.ctl u_stas.ctl + cp uv_stas.ctl v_stas.ctl + + for type in ps t q uv u v; do + + for file in ${type}*stas; do + ${COMPRESS} ${file} + mv -f ${file}.${Z} ${savedir}/${run}_${file}.${PDATE}.${Z} + done + + for file in ${type}*stas.ctl; do + ${COMPRESS} ${file} + mv -f ${file}.${Z} ${savedir}/${run}_${file}.${Z} + done + + + done + + ${COMPRESS} ${stdout} + cp ${stdout}.${Z} ${savedir}/. + done + + else + echo "Handle NetCDF files here" + + for run in ges anl; do + + for type in ps t q uv; do + + + cat << EOF > input +&input + input_file=diag_conv_${type}_${run}.${PDATE}, + ctype=${type}, + nregion=${nregion}, + netcdf=${netcdf}, + run=${run}, + region(1)='GL',rlonmin(1)=-180.0,rlonmax(1)=180.0,rlatmin(1)=-90.0,rlatmax(1)= 90.0, + region(2)='NH',rlonmin(2)=-180.0,rlonmax(2)=180.0,rlatmin(2)= 20.0,rlatmax(2)= 90.0, + region(3)='SH',rlonmin(3)=-180.0,rlonmax(3)=180.0,rlatmin(3)=-90.0,rlatmax(3)=-20.0, + region(4)='TR',rlonmin(4)=-180.0,rlonmax(4)=180.0,rlatmin(4)=-20.0,rlatmax(4)= 20.0, + region(5)='USA',rlonmin(5)=-125.0,rlonmax(5)=-65.0,rlatmin(5)=25.0,rlatmax(5)=50.0, + region(6)='CAN',rlonmin(6)=-125.0,rlonmax(6)=-65.0,rlatmin(6)= 50.0,rlatmax(6)= 90.0, + region(7)='N&CA',rlonmin(7)=-165.0,rlonmax(7)=-60.0, rlatmin(7)= 0.0,rlatmax(7)=90.0, + region(8)='S&CA',rlonmin(8)=-165.0,rlonmax(8)=-30.0,rlatmin(8)=-90.0,rlatmax(8)=0.0, + region(9)='EU',rlonmin(9)=-10.0,rlonmax(9)=25.0,rlatmin(9)=35.0,rlatmax(9)=70.0, + region(10)='AS',rlonmin(10)=65.0,rlonmax(10)=145.0,rlatmin(10)=5.0,rlatmax(10)=45.0, +/ +EOF + stdout=stdout_${run}_${type}.${PDATE} + ./execfile ${stdout} 2>&1 + + echo " execfile completed " + + for file in ${type}*stas; do + ${COMPRESS} ${file} + mv -f ${file}.${Z} ${savedir}/${run}_${file}.${PDATE}.${Z} + done + + + if [ $type == 'uv' ]; then + file=u_stas + ${COMPRESS} ${file} + mv -f ${file}.${Z} ${savedir}/${run}_${file}.${PDATE}.${Z} + cp uv_stas.ctl u_stas.ctl + + file=v_stas + ${COMPRESS} ${file} + mv -f ${file}.${Z} ${savedir}/${run}_${file}.${PDATE}.${Z} + cp uv_stas.ctl v_stas.ctl + fi + + for file in *stas.ctl; do + ${COMPRESS} ${file} + mv -f ${file}.${Z} ${savedir}/${run}_${file}.${Z} + done + + done + + done + + ${COMPRESS} stdout* + tar -cf stdout.tar stdout* + ${COMPRESS} stdout.tar + mv -f stdout.tar.${Z} ${savedir}/. + + fi + + + + echo "<-- time_vert.sh" + +exit ${rc} diff --git a/util/Conventional_Monitor/nwprod/gdas_cmon.v1.0.0/driver/test_jgdas_vcmon_cray.sh b/util/Conventional_Monitor/nwprod/gdas_cmon.v1.0.0/driver/test_jgdas_vcmon_cray.sh deleted file mode 100755 index fdeab8d3bf..0000000000 --- a/util/Conventional_Monitor/nwprod/gdas_cmon.v1.0.0/driver/test_jgdas_vcmon_cray.sh +++ /dev/null @@ -1,90 +0,0 @@ -#!/bin/ksh - -#BSUB -o gdas_vcmon.o%J -#BSUB -e gdas_vcmon.o%J -#BSUB -J gdas_vcmon -#BSUB -q dev -#BSUB -M 80 -#BSUB -W 00:40 -#BSUB -P GFS-T2O -#BSUB -R "select[mem>80] rusage[mem=80]" - -set -x - -export PDATE=${PDATE:-2017030606} - -############################################################# -# Specify whether the run is production or development -############################################################# -export PDY=`echo $PDATE | cut -c1-8` -export CYC=`echo $PDATE | cut -c9-10` -export cmon_job=${cmon_job:-gdas_vcmon.${CYC}} -export pid=${pid:-$$} -export jobid=${cmon_job}.${pid} -export envir=${envir:-para} - - -############################################################# -# Specify versions -############################################################# -export gdas_ver=v13.0.0 -export global_shared_ver=v13.0.0 -export gdas_cmon_ver=v1.0.0 -export cmon_shared_ver=v1.0.0 - - -############################################################# -# Load modules -############################################################# -. $MODULESHOME/init/ksh - -module load prod_util -module load prod_envir - -module list - - -############################################################# -# WCOSS environment settings -############################################################# -export POE=YES - - -############################################################# -# Set user specific variables -############################################################# -export DATAROOT=${DATAROOT:-/gpfs/hps/emc/da/noscrub/$LOGNAME/test_data} -#export COMROOT=${COMROOT:-/gpfs/hps/ptmp/$LOGNAME/com} -export PTMP_USER=${PTMP_USER:-/gpfs/hps/ptmp/$LOGNAME} -export CMON_SUFFIX=${CMON_SUFFIX:-testcmon} -export NWTEST=${NWTEST:-/gpfs/hps/emc/da/noscrub/${LOGNAME}/CMon_486/util/Conventional_Monitor/nwprod} -export HOMEgdascmon=${HOMEgdascmon:-${NWTEST}/gdas_cmon.${gdas_cmon_ver}} -export JOBGLOBAL=${JOBGLOBAL:-${HOMEgdascmon}/jobs} -export HOMEcmon=${HOMEcmon:-${NWTEST}/cmon_shared.${cmon_shared_ver}} -export COM_IN=${COM_IN:-${DATAROOT}} - -export C_TANKDIR=${C_TANKDIR:-${PTMP_USER}/com/${CMON_SUFFIX}} -if [[ ! -d $C_TANKDIR ]]; then - mkdir -p ${C_TANKDIR} -fi - -export CMON_WORK_DIR=${CMON_WORK_DIR:-/gpfs/hps/stmp/$LOGNAME/cmon_${CMON_SUFFIX}} -if [[ ! -d $CMON_WORK_DIR ]]; then - mkdir -p ${CMON_WORK_DIR} -fi - -export CMON_LOG_DIR=${CMON_LOG_DIR:-${PTMP_USER}/logs/jlogfiles} -if [[ ! -d $CMON_LOG_DIR ]]; then - mkdir -p ${CMON_LOG_DIR} -fi - -export jlogfile=${jlogfile:-${CMON_LOG_DIR}/jlogfile.${jobid}} -export utilroot=${utilroot:-$PROD} - -############################################################# -# Execute job -############################################################# -$JOBGLOBAL/JGDAS_VCMON - -exit - diff --git a/util/Conventional_Monitor/nwprod/gdas_cmon.v1.0.0/driver/test_jgdas_vcmon_ibm.sh b/util/Conventional_Monitor/nwprod/gdas_cmon.v1.0.0/driver/test_jgdas_vcmon_ibm.sh deleted file mode 100755 index 942740b643..0000000000 --- a/util/Conventional_Monitor/nwprod/gdas_cmon.v1.0.0/driver/test_jgdas_vcmon_ibm.sh +++ /dev/null @@ -1,92 +0,0 @@ -#!/bin/ksh - -#BSUB -o gdas_vcmon.o%J -#BSUB -e gdas_vcmon.o%J -#BSUB -J gdas_vcmon -#BSUB -q dev_shared -#BSUB -n 1 -#BSUB -R affinity[core] -#BSUB -M 160 -#BSUB -W 00:30 -#BSUB -a poe -#BSUB -P GFS-T2O - -set -x - -export PDATE=${PDATE:-2018041200} - - -############################################################# -# Specify versions -############################################################# -export gdas_ver=v13.0.0 -export global_shared_ver=v13.0.0 -export gdas_cmon_ver=v1.0.0 -export cmon_shared_ver=v1.0.0 - -############################################################# -# Load modules -############################################################# -. /usrx/local/Modules/3.2.9/init/ksh -module use /nwprod2/modulefiles -module load grib_util -module load prod_util -module load util_shared - -module list - -############################################################# -# Specify whether the run is production or development -############################################################# -export PDY=`echo $PDATE | cut -c1-8` -export CYC=`echo $PDATE | cut -c9-10` -export job=gdas_vcmon.${CYC} -export pid=${pid:-$$} -export jobid=${job}.${pid} -export envir=para -ihost=`hostname | cut -c1` -export DATAROOT=${DATAROOT:-/gpfs/${ihost}d2/emc/da/noscrub/Edward.Safford/test_data} -export COMROOT=${COMROOT:-/ptmpp1/$LOGNAME/com} - -############################################################# -# WCOSS environment settings -############################################################# -export POE=YES - - -############################################################# -# Set user specific variables -############################################################# -export CMON_SUFFIX=${CMON_SUFFIX:-testcmon} -#export NWTEST=${NWTEST:-/gpfs/${ihost}d2/emc/da/noscrub/Edward.Safford/CMon_486/util/Conventional_Monitor/nwprod} -export NWTEST=${NWTEST:-/ptmpp1/Edward.Safford/ProdGSI/util/Conventional_Monitor/nwprod} -export HOMEgdascmon=${HOMEgdascmon:-${NWTEST}/gdas_cmon.${gdas_cmon_ver}} -export JOBGLOBAL=${JOBGLOBAL:-${HOMEgdascmon}/jobs} -export HOMEcmon=${HOMEcmon:-${NWTEST}/cmon_shared.${cmon_shared_ver}} -export COM_IN=${COM_IN:-${DATAROOT}} - -export C_TANKDIR=${C_TANKDIR:-${COMROOT}/${CMON_SUFFIX}} -if [[ ! -d $C_TANKDIR ]]; then - mkdir -p ${C_TANKDIR} -fi - -export CMON_WORK_DIR=${CMON_WORK_DIR:-/stmpp1/$LOGNAME/cmon_${CMON_SUFFIX}} -if [[ ! -d $CMON_WORK_DIR ]]; then - mkdir -p ${CMON_WORK_DIR} -fi - -export CMON_LOG_DIR=${CMON_LOG_DIR:-${COMROOT}/logs/jlogfiles} -if [[ ! -d $CMON_LOG_DIR ]]; then - mkdir -p ${CMON_LOG_DIR} -fi - -export jlogfile=${jlogfile:-${CMON_LOG_DIR}/jlogfile.${jobname}.${pid}} - - -############################################################# -# Execute job -############################################################# -$JOBGLOBAL/JGDAS_VCMON - -exit - diff --git a/util/Conventional_Monitor/nwprod/gdas_cmon.v1.0.0/driver/test_jgdas_vcmon_theia.sh b/util/Conventional_Monitor/nwprod/gdas_cmon.v1.0.0/driver/test_jgdas_vcmon_theia.sh deleted file mode 100755 index 581d5e371a..0000000000 --- a/util/Conventional_Monitor/nwprod/gdas_cmon.v1.0.0/driver/test_jgdas_vcmon_theia.sh +++ /dev/null @@ -1,102 +0,0 @@ -#!/bin/ksh - -#SBATCH -o %x.log -#SBATCH -J gdas_vcmon -#SBATCH --time=00:15:00 -#SBATCH --ntasks=1 -p service --mem=4g -#SBATCH -A fv3-cpu - -##PBS -o gdas_vcmon.log -##PBS -e gdas_vcmon.err -##PBS -N gdas_vcmon -##PBS -A fv3-cpu -##PBS -l procs=1,walltime=0:15:00 -##PBS -V - -set -x - -export PDATE=${PDATE:-2018070412} - -############################################################# -# Specify whether the run is production or development -############################################################# -export PDY=`echo $PDATE | cut -c1-8` -export CYC=`echo $PDATE | cut -c9-10` -export job=gfs_vcmon.${CYC} -export pid=${pid:-$$} -export jobid=${job}.${pid} -export envir=para -export DATAROOT=${DATAROOT:-/scratch4/NCEPDEV/da/noscrub/Edward.Safford/test_data} -export COMROOT=${COMROOT:-/scratch4/NCEPDEV/stmp3/$LOGNAME/com} - - -############################################################# -# Specify versions -############################################################# -#export gdas_ver=v14.1.0 -#export global_shared_ver=v14.1.0 -export gdas_cmon_ver=v1.0.0 -export cmon_shared_ver=v1.0.0 - - -############################################################# -# Add nwpara tools to path -############################################################# -export NWPROD=${NWPROD:-/scratch4/NCEPDEV/global/save/glopara/nwpara/util} -NWPRODush=${NWPRODush:=${NWPROD}/ush} -NWPRODexec=${NWPRODexec:=${NWPROD}/exec} -export PATH=${PATH}:${NWPRODush}:${NWPRODexec} - - -############################################################# -# Set user specific variables -############################################################# -export CMON_SUFFIX=${CMON_SUFFIX:-testcmon} -#export NWTEST=${NWTEST:-/scratch4/NCEPDEV/da/noscrub/${LOGNAME}/CMon_486/util/Conventional_Monitor/nwprod} -export NWTEST=${NWTEST:-/scratch4/NCEPDEV/da/noscrub/${LOGNAME}/ProdGSI/util/Conventional_Monitor/nwprod} -export HOMEgdascmon=${HOMEgdascmon:-${NWTEST}/gdas_cmon.${gdas_cmon_ver}} -export JOBGLOBAL=${JOBGLOBAL:-${HOMEgdascmon}/jobs} -export HOMEcmon=${HOMEcmon:-${NWTEST}/cmon_shared.${cmon_shared_ver}} -export COM_IN=${COM_IN:-${DATAROOT}} - -export C_TANKDIR=${C_TANKDIR:-${COMROOT}/${CMON_SUFFIX}} -if [[ ! -d $C_TANKDIR ]]; then - mkdir -p ${C_TANKDIR} -fi - -export CMON_WORK_DIR=${CMON_WORK_DIR:-/scratch4/NCEPDEV/stmp3/$LOGNAME/cmon_${CMON_SUFFIX}} -if [[ ! -d $CMON_WORK_DIR ]]; then - mkdir -p ${CMON_WORK_DIR} -fi - -export CMON_LOG_DIR=${CMON_LOG_DIR:-${COMROOT}/logs/jlogfiles} -if [[ ! -d $CMON_LOG_DIR ]]; then - mkdir -p ${CMON_LOG_DIR} -fi - -export jlogfile=${jlogfile:-${CMON_LOG_DIR}/jlogfile.${jobname}.${pid}} - - -####################################################################### -# theia specific hacks for no prod_utils module & no setpdy.sh script -####################################################################### -export NDATE=${NDATE:-/scratch4/NCEPDEV/global/save/glopara/nwpara/util/exec/ndate} -export MY_MACHINE=theia -prevday=`$NDATE -24 $PDATE` -export PDYm1=`echo $prevday | cut -c1-8` -ln -s ${NWPRODush}/startmsg.sh ${COMROOT}/startmsg -ln -s ${NWPRODush}/postmsg.sh ${COMROOT}/postmsg -ln -s ${NWPRODush}/prep_step.sh ${COMROOT}/prep_step -ln -s ${NWPRODush}/err_chk.sh ${COMROOT}/err_chk -export PATH=$PATH:${COMROOT} -export utilscript=${utilscript:-${NWPRODush}} # err_chk calls postmsg.sh - # directly so need to override - # utilscript location - -############################################################# -# Execute job -############################################################# -$JOBGLOBAL/JGDAS_VCMON - -exit - diff --git a/util/Conventional_Monitor/nwprod/gdas_cmon.v1.0.0/fix/global_convinfo.txt b/util/Conventional_Monitor/nwprod/gdas_cmon.v1.0.0/fix/global_convinfo.txt deleted file mode 100755 index 4221eb15ee..0000000000 --- a/util/Conventional_Monitor/nwprod/gdas_cmon.v1.0.0/fix/global_convinfo.txt +++ /dev/null @@ -1,210 +0,0 @@ -! otype = observation type (a7, t, uv, q, etc.) -! type = prepbufr observation type (if available) -! sub = prepbufr subtype (not yet available) -! iuse = flag if to use/not use / monitor data -! = 1 use data -! = 0 do not use data -! = -1 monitor data -! twindow = time window (+/- hours) -! numgrp = cross validation parameter - number of groups -! ngroup = cross validation parameter - group to remove from data use -! nmiter = cross validation parameter - external iteration to introduce removed data -! gross = gross error parameter - gross error -! ermax = gross error parameter - max error -! ermin = gross error parameter - min error -! var_b = variational quality control parameter - b parameter -! var_pg ithin rmesh npred = variational quality control parameter - pg parameter -! pmot: the optione to keep thinned datai as monitored, 0: not to keep, other values: to keep -! ptime: time interval for thinning, 0, no temporal thinning, other values define time interval (less than 6) -!otype type sub iuse twindow numgrp ngroup nmiter gross ermax ermin var_b var_pg ithin rmesh pmesh npred pmot ptime - tcp 112 0 1 3.0 0 0 0 75.0 5.0 1.0 75.0 0.000000 0 0. 0. 0 0. 0. - ps 120 0 1 3.0 0 0 0 4.0 3.0 1.0 4.0 0.000300 0 0. 0. 0 0. 0. - ps 132 0 -1 3.0 0 0 0 4.0 3.0 1.0 4.0 0.000300 0 0. 0. 0 0. 0. - ps 180 0 1 3.0 0 0 0 4.0 3.0 1.0 4.0 0.000300 0 0. 0. 0 0. 0. - ps 181 0 1 3.0 0 0 0 3.6 3.0 1.0 3.6 0.000300 0 0. 0. 0 0. 0. - ps 182 0 1 3.0 0 0 0 4.0 3.0 1.0 4.0 0.000300 0 0. 0. 0 0. 0. - ps 183 0 -1 3.0 0 0 0 4.0 3.0 1.0 4.0 0.000300 0 0. 0. 0 0. 0. - ps 187 0 1 3.0 0 0 0 4.0 3.0 1.0 4.0 0.000300 0 0. 0. 0 0. 0. - t 120 0 1 3.0 0 0 0 8.0 5.6 1.3 8.0 0.000001 0 0. 0. 0 0. 0. - t 126 0 -1 3.0 0 0 0 8.0 5.6 1.3 8.0 0.001000 0 0. 0. 0 0. 0. - t 130 0 1 3.0 0 0 0 7.0 5.6 1.3 7.0 0.001000 0 0. 0. 0 0. 0. - t 131 0 1 3.0 0 0 0 7.0 5.6 1.3 7.0 0.001000 0 0. 0. 0 0. 0. - t 132 0 1 3.0 0 0 0 7.0 5.6 1.3 7.0 0.001000 0 0. 0. 0 0. 0. - t 133 0 1 3.0 0 0 0 7.0 5.6 1.3 7.0 0.004000 0 0. 0. 0 0. 0. - t 134 0 -1 3.0 0 0 0 7.0 5.6 1.3 7.0 0.004000 0 0. 0. 0 0. 0. - t 135 0 -1 3.0 0 0 0 7.0 5.6 1.3 7.0 0.004000 0 0. 0. 0 0. 0. - t 180 0 1 3.0 0 0 0 7.0 5.6 1.3 7.0 0.004000 0 0. 0. 0 0. 0. - t 181 0 -1 3.0 0 0 0 7.0 5.6 1.3 7.0 0.004000 0 0. 0. 0 0. 0. - t 182 0 1 3.0 0 0 0 7.0 5.6 1.3 7.0 0.004000 0 0. 0. 0 0. 0. - t 183 0 -1 3.0 0 0 0 7.0 5.6 1.3 7.0 0.004000 0 0. 0. 0 0. 0. - t 187 0 -1 3.0 0 0 0 7.0 5.6 1.3 7.0 0.004000 0 0. 0. 0 0. 0. - q 120 0 1 3.0 0 0 0 8.0 100.0 10.0 8.0 0.000500 0 0. 0. 0 0. 0. - q 130 0 -1 3.0 0 0 0 8.0 100.0 10.0 8.0 0.000600 0 0. 0. 0 0. 0. - q 131 0 -1 3.0 0 0 0 8.0 100.0 10.0 8.0 0.000600 0 0. 0. 0 0. 0. - q 132 0 1 3.0 0 0 0 8.0 100.0 10.0 8.0 0.000600 0 0. 0. 0 0. 0. - q 133 0 1 3.0 0 0 0 8.0 100.0 10.0 8.0 0.000600 0 0. 0. 0 0. 0. - q 134 0 -1 3.0 0 0 0 8.0 100.0 10.0 8.0 0.000600 0 0. 0. 0 0. 0. - q 135 0 -1 3.0 0 0 0 8.0 100.0 10.0 8.0 0.000600 0 0. 0. 0 0. 0. - q 180 0 1 3.0 0 0 0 8.0 100.0 10.0 8.0 0.000500 0 0. 0. 0 0. 0. - q 181 0 -1 3.0 0 0 0 8.0 100.0 10.0 8.0 0.000500 0 0. 0. 0 0. 0. - q 182 0 1 3.0 0 0 0 8.0 100.0 10.0 8.0 0.000600 0 0. 0. 0 0. 0. - q 183 0 -1 3.0 0 0 0 8.0 100.0 10.0 8.0 0.000600 0 0. 0. 0 0. 0. - q 187 0 -1 3.0 0 0 0 8.0 100.0 10.0 8.0 0.000600 0 0. 0. 0 0. 0. - pw 152 0 -1 3.0 0 0 0 10.0 8.0 2.0 10.0 0.000000 0 0. 0. 0 0. 0. - pw 153 0 -1 3.0 0 0 0 5.0 5.0 2.0 5.0 0.000000 0 0. 0. 0 0. 0. - pw 156 0 -1 3.0 0 0 0 10.0 8.0 2.0 10.0 0.000000 0 0. 0. 0 0. 0. - pw 157 0 -1 3.0 0 0 0 10.0 8.0 2.0 10.0 0.000000 0 0. 0. 0 0. 0. - pw 158 0 -1 3.0 0 0 0 10.0 8.0 2.0 10.0 0.000000 0 0. 0. 0 0. 0. - pw 159 0 -1 3.0 0 0 0 10.0 8.0 2.0 10.0 0.000000 0 0. 0. 0 0. 0. - sst 181 0 -1 3.0 0 0 0 2.0 2.0 0.2 2.0 0.000000 0 0. 0. 0 0. 0. - sst 182 0 -1 3.0 0 0 0 2.0 2.0 0.2 2.0 0.000000 0 0. 0. 0 0. 0. - sst 183 0 -1 3.0 0 0 0 2.0 2.0 0.2 2.0 0.000000 0 0. 0. 0 0. 0. - sst 184 0 -1 3.0 0 0 0 2.0 2.0 0.2 2.0 0.000000 0 0. 0. 0 0. 0. - sst 185 0 -1 3.0 0 0 0 2.0 2.0 0.2 2.0 0.000000 0 0. 0. 0 0. 0. - sst 186 0 -1 3.0 0 0 0 2.0 2.0 0.2 2.0 0.000000 0 0. 0. 0 0. 0. - sst 187 0 -1 3.0 0 0 0 2.0 2.0 0.2 2.0 0.000000 0 0. 0. 0 0. 0. - sst 188 0 -1 3.0 0 0 0 2.0 2.0 0.2 2.0 0.000000 0 0. 0. 0 0. 0. - sst 189 0 -1 3.0 0 0 0 2.0 2.0 0.2 2.0 0.000000 0 0. 0. 0 0. 0. - sst 190 0 -1 3.0 0 0 0 2.5 2.0 0.2 2.5 0.000000 0 0. 0. 0 0. 0. - sst 191 0 -1 3.0 0 0 0 3.0 2.0 0.2 3.0 0.000000 0 0. 0. 0 0. 0. - sst 192 0 -1 3.0 0 0 0 3.0 2.0 0.2 3.0 0.000000 0 0. 0. 0 0. 0. - sst 193 0 -1 3.0 0 0 0 2.0 2.0 0.2 2.0 0.000000 0 0. 0. 0 0. 0. - sst 194 0 -1 3.0 0 0 0 3.0 2.0 0.2 3.0 0.000000 0 0. 0. 0 0. 0. - sst 195 0 -1 3.0 0 0 0 2.0 2.0 0.2 2.0 0.000000 0 0. 0. 0 0. 0. - sst 196 0 -1 3.0 0 0 0 2.5 2.0 0.2 2.5 0.000000 0 0. 0. 0 0. 0. - sst 197 0 -1 3.0 0 0 0 2.0 2.0 0.2 2.0 0.000000 0 0. 0. 0 0. 0. - sst 198 0 -1 3.0 0 0 0 2.5 2.0 0.2 2.5 0.000000 0 0. 0. 0 0. 0. - sst 199 0 -1 3.0 0 0 0 1.5 2.0 0.2 1.5 0.000000 0 0. 0. 0 0. 0. - sst 200 0 -1 3.0 0 0 0 2.0 2.0 0.2 2.0 0.000000 0 0. 0. 0 0. 0. - sst 201 0 -1 3.0 0 0 0 2.0 2.0 0.2 2.0 0.000000 0 0. 0. 0 0. 0. - sst 202 0 -1 3.0 0 0 0 2.0 2.0 0.2 2.0 0.000000 0 0. 0. 0 0. 0. - uv 210 0 1 3.0 0 0 0 8.0 6.1 1.4 8.0 0.000001 0 0. 0. 0 0. 0. - uv 220 0 1 3.0 0 0 0 8.0 6.1 1.4 8.0 0.000001 0 0. 0. 0 0. 0. - uv 221 0 1 3.0 0 0 0 8.0 6.1 1.4 8.0 0.000001 0 0. 0. 0 0. 0. - uv 223 0 1 3.0 0 0 0 7.5 6.1 1.4 7.5 0.000001 0 0. 0. 0 0. 0. - uv 224 0 1 3.0 0 0 0 6.5 6.1 1.4 6.5 0.000001 0 0. 0. 0 0. 0. - uv 228 0 -1 3.0 0 0 0 6.5 6.1 1.4 6.5 0.000001 0 0. 0. 0 0. 0. - uv 229 0 1 3.0 0 0 0 6.5 6.1 1.4 6.5 0.000001 0 0. 0. 0 0. 0. - uv 230 0 1 3.0 0 0 0 6.0 6.1 1.4 6.0 0.000100 0 0. 0. 0 0. 0. - uv 231 0 1 3.0 0 0 0 6.5 6.1 1.4 6.5 0.000100 0 0. 0. 0 0. 0. - uv 232 0 1 3.0 0 0 0 7.0 6.1 1.4 7.0 0.000100 0 0. 0. 0 0. 0. - uv 233 0 1 3.0 0 0 0 7.5 6.1 1.4 7.5 0.000100 0 0. 0. 0 0. 0. - uv 234 0 -1 3.0 0 0 0 7.5 6.1 1.4 7.5 0.000100 0 0. 0. 0 0. 0. - uv 235 0 -1 3.0 0 0 0 7.5 6.1 1.4 7.5 0.000100 0 0. 0. 0 0. 0. - uv 240 0 -1 3.0 0 0 0 2.5 6.1 1.4 2.5 0.000100 0 0. 0. 0 0. 0. - uv 240 257 -1 3.0 0 0 0 2.5 6.1 1.4 2.5 0.000100 0 100. 50. 0 0. 0. - uv 240 259 -1 3.0 0 0 0 2.5 6.1 1.4 2.5 0.000100 0 100. 50. 0 0. 0. - uv 241 0 -1 3.0 0 0 0 2.5 6.1 1.4 2.5 0.000100 0 0. 0. 0 0. 0. - uv 242 0 -1 3.0 0 0 0 2.5 15.0 1.4 2.5 0.005000 0 0. 0. 0 0. 0. - uv 242 171 -1 3.0 0 0 0 2.5 15.0 1.4 2.5 0.055000 1 200. 100. 0 0. 2. - uv 242 172 -1 3.0 0 0 0 2.5 15.0 1.4 2.5 0.055000 1 200. 100. 0 0. 2. - uv 242 173 1 3.0 0 0 0 2.5 15.0 1.4 2.5 0.055000 1 200. 100. 0 0. 2. - uv 243 0 -1 3.0 0 0 0 1.5 15.0 1.4 1.5 0.055000 0 0. 0. 0 0. 0. - uv 243 54 -1 3.0 0 0 0 1.5 15.0 1.4 1.5 0.055000 1 200. 100. 0 0. 2. - uv 243 55 1 3.0 0 0 0 1.5 15.0 1.4 1.5 0.055000 1 200. 100. 0 0. 2. - uv 243 56 1 3.0 0 0 0 1.5 15.0 1.4 1.5 0.055000 1 200. 100. 0 0. 2. - uv 243 57 1 3.0 0 0 0 1.5 15.0 1.4 1.5 0.055000 1 200. 100. 0 0. 2. - uv 244 0 -1 3.0 0 0 0 2.5 20.0 1.4 2.5 0.005000 0 0. 0. 0 0. 0. - uv 244 3 1 3.0 0 0 0 2.5 20.0 1.4 2.5 0.005000 0 0. 0. 0 0. 0. - uv 244 4 1 3.0 0 0 0 2.5 20.0 1.4 2.5 0.005000 0 0. 0. 0 0. 0. - uv 244 206 1 3.0 0 0 0 2.5 20.0 1.4 2.5 0.005000 0 0. 0. 0 0. 0. - uv 244 207 1 3.0 0 0 0 2.5 20.0 1.4 2.5 0.005000 0 0. 0. 0 0. 0. - uv 244 209 1 3.0 0 0 0 2.5 20.0 1.4 2.5 0.005000 0 0. 0. 0 0. 0. - uv 244 223 1 3.0 0 0 0 2.5 20.0 1.4 2.5 0.005000 0 0. 0. 0 0. 0. - uv 245 0 -1 3.0 0 0 0 1.3 20.0 1.4 1.3 0.005000 0 200. 100. 0 0. 0. - uv 245 257 1 3.0 0 0 0 1.3 20.0 1.4 1.3 0.005000 0 200. 100. 0 0. 0. - uv 245 259 1 3.0 0 0 0 1.3 20.0 1.4 1.3 0.005000 0 200. 100. 0 0. 0. - uv 246 0 -1 3.0 0 0 0 1.3 20.0 1.4 1.3 0.005000 0 200. 100. 0 0. 0. - uv 246 257 1 3.0 0 0 0 1.3 20.0 1.4 1.3 0.005000 0 200. 100. 0 0. 0. - uv 246 259 1 3.0 0 0 0 1.3 20.0 1.4 1.3 0.005000 0 200. 100. 0 0. 0. - uv 247 0 -1 3.0 0 0 0 2.5 20.0 1.4 2.5 0.005000 0 0. 0. 0 0. 0. - uv 247 257 -1 3.0 0 0 0 2.5 20.0 1.4 2.5 0.005000 0 0. 0. 0 0. 0. - uv 247 259 -1 3.0 0 0 0 2.5 20.0 1.4 2.5 0.005000 0 0. 0. 0 0. 0. - uv 248 0 -1 3.0 0 0 0 2.5 20.0 1.4 2.5 0.000500 0 0. 0. 0 0. 0. - uv 249 0 -1 3.0 0 0 0 2.5 20.0 1.4 2.5 0.050500 0 0. 0. 0 0. 0. - uv 250 0 -1 3.0 0 0 0 2.5 20.0 1.4 2.5 0.050500 0 0. 0. 0 0. 0. - uv 250 171 -1 3.0 0 0 0 2.5 20.0 1.4 2.5 0.050500 1 200. 100. 0 0. 2. - uv 250 172 -1 3.0 0 0 0 2.5 20.0 1.4 2.5 0.050500 1 200. 100. 0 0. 2. - uv 250 173 1 3.0 0 0 0 2.5 20.0 1.4 2.5 0.050500 1 200. 100. 0 0. 2. - uv 251 0 -1 3.0 0 0 0 1.3 20.0 1.4 1.3 0.050500 0 0. 0. 0 0. 0. - uv 251 257 -1 3.0 0 0 0 1.3 20.0 1.4 1.3 0.050500 0 0. 0. 0 0. 0. - uv 251 259 -1 3.0 0 0 0 1.3 20.0 1.4 1.3 0.050050 0 0. 0. 0 0. 0. - uv 252 0 -1 3.0 0 0 0 2.5 20.0 1.4 2.5 0.050050 0 0. 0. 0 0. 0. - uv 252 171 -1 3.0 0 0 0 2.5 20.0 1.4 2.5 0.050050 1 200. 100. 0 0. 2. - uv 252 172 -1 3.0 0 0 0 2.5 20.0 1.4 2.5 0.050050 1 200. 100. 0 0. 2. - uv 252 173 1 3.0 0 0 0 2.5 20.0 1.4 2.5 0.050050 1 200. 100. 0 0. 2. - uv 253 0 -1 3.0 0 0 0 1.5 20.0 1.4 1.5 0.050500 0 200. 100. 0 0. 2. - uv 253 54 -1 3.0 0 0 0 1.5 20.0 1.4 1.5 0.050500 1 200. 100. 0 0. 2. - uv 253 55 1 3.0 0 0 0 1.5 20.0 1.4 1.5 0.050500 1 200. 100. 0 0. 2. - uv 253 56 1 3.0 0 0 0 1.5 20.0 1.4 1.5 0.050500 1 200. 100. 0 0. 2. - uv 253 57 1 3.0 0 0 0 1.5 20.0 1.4 1.5 0.050500 1 200. 100. 0 0. 2. - uv 254 0 -1 3.0 0 0 0 1.5 20.0 1.4 1.5 0.050500 0 0. 0. 0 0. 0. - uv 254 54 -1 3.0 0 0 0 1.5 20.0 1.4 1.5 0.050500 1 200. 100. 0 0. 2. - uv 254 55 1 3.0 0 0 0 1.5 20.0 1.4 1.5 0.050500 1 200. 100. 0 0. 2. - uv 254 56 1 3.0 0 0 0 1.5 20.0 1.4 1.5 0.050500 0 200. 100. 0 0. 2. - uv 254 57 1 3.0 0 0 0 1.5 20.0 1.4 1.5 0.050500 1 200. 100. 0 0. 2. - uv 256 0 -1 3.0 0 0 0 2.5 20.1 1.4 2.5 0.000500 0 0. 0. 0 0. 0. - uv 257 0 -1 3.0 0 0 0 2.5 20.1 1.4 2.5 0.005500 0 0. 0. 0 0. 0. - uv 257 783 1 3.0 0 0 0 2.5 20.1 1.4 2.5 0.005500 0 0. 0. 0 0. 0. - uv 257 784 1 3.0 0 0 0 2.5 20.1 1.4 2.5 0.005500 0 0. 0. 0 0. 0. - uv 258 0 -1 3.0 0 0 0 2.5 20.1 1.4 2.5 0.005500 0 0. 0. 0 0. 0. - uv 258 783 1 3.0 0 0 0 2.5 20.1 1.4 2.5 0.005500 0 0. 0. 0 0. 0. - uv 258 784 1 3.0 0 0 0 2.5 20.1 1.4 2.5 0.005500 0 0. 0. 0 0. 0. - uv 259 0 -1 3.0 0 0 0 2.5 20.1 1.4 2.5 0.005500 0 0. 0. 0 0. 0. - uv 259 783 1 3.0 0 0 0 2.5 20.1 1.4 2.5 0.005500 0 0. 0. 0 0. 0. - uv 259 784 1 3.0 0 0 0 2.5 20.1 1.4 2.5 0.005500 0 0. 0. 0 0. 0. - uv 260 0 -1 3.0 0 0 0 2.5 20.1 1.4 2.5 0.000500 0 0. 0. 0 0. 0. - uv 260 224 -1 3.0 0 0 0 2.5 20.1 1.4 2.5 0.000500 0 0. 0. 0 0. 0. - uv 280 0 1 3.0 0 0 0 6.0 6.1 1.4 6.0 0.005500 0 0. 0. 0 0. 0. - uv 281 0 -1 3.0 0 0 0 6.0 6.1 1.4 6.0 0.005500 0 0. 0. 0 0. 0. - uv 282 0 1 3.0 0 0 0 6.0 6.1 1.4 6.0 0.005500 0 0. 0. 0 0. 0. - uv 284 0 -1 3.0 0 0 0 6.0 6.1 1.4 6.0 0.005500 0 0. 0. 0 0. 0. - uv 285 0 -1 3.0 0 0 0 5.0 6.1 1.4 5.0 0.005500 0 0. 0. 0 0. 0. - uv 286 0 -1 3.0 0 0 0 6.0 6.1 1.4 6.0 0.005500 0 0. 0. 0 0. 0. - uv 287 0 -1 3.0 0 0 0 6.0 6.1 1.4 6.0 0.000500 0 0. 0. 0 0. 0. - uv 289 0 1 3.0 0 0 0 5.0 6.1 1.4 5.0 0.000500 0 0. 0. 0 0. 0. - uv 290 4 1 3.0 0 0 0 5.0 6.1 1.4 5.0 0.000500 1 100. 1200. 0 0. 0. - uv 290 3 -1 3.0 0 0 0 5.0 6.1 1.4 5.0 0.000500 1 100. 1200. 0 0. 0. - uv 290 5 -1 3.0 0 0 0 5.0 6.1 1.4 5.0 0.000500 1 100. 1200. 0 0. 0. - uv 291 0 -1 3.0 0 0 0 5.0 6.1 1.4 5.0 0.000500 1 100. 1200. 0 0. 0. - uv 296 0 -1 3.0 0 0 0 5.0 6.1 1.4 5.0 0.000500 0 100. 1200. 0 0. 0. - spd 283 0 -1 3.0 0 0 0 8.0 6.1 1.4 8.0 0.000000 0 0. 0. 0 0. 0. - dw 999 0 -1 3.0 0 0 0 8.0 10.0 2.0 8.0 0.000000 0 0. 0. 0 0. 0. - dw 201 0 -1 3.0 0 0 0 8.0 10.0 2.0 8.0 0.000001 0 0. 0. 0 0. 0. - dw 202 0 -1 3.0 0 0 0 8.0 10.0 2.0 8.0 0.000001 0 0. 0. 0 0. 0. - dw 100 0 -1 3.0 0 0 0 4.0 5.0 2.0 8.0 0.000001 0 0. 0. 0 0. 0. - dw 101 0 -1 3.0 0 0 0 4.0 5.0 2.0 8.0 0.000001 0 0. 0. 0 0. 0. - srw 999 0 -1 2.5 0 0 0 10.0 10.0 1.0 10.0 0.000000 0 0. 0. 0 0. 0. - rw 999 0 -1 2.5 0 0 0 10.0 10.0 2.0 10.0 0.000000 0 0. 0. 0 0. 0. - gps 004 0 1 3.0 0 0 0 10.0 10.0 1.0 10.0 0.000000 0 0. 0. 0 0. 0. - gps 041 0 -1 3.0 0 0 0 10.0 10.0 1.0 10.0 0.000000 0 0. 0. 0 0. 0. - gps 722 0 1 3.0 0 0 0 10.0 10.0 1.0 10.0 0.000000 0 0. 0. 0 0. 0. - gps 723 0 -1 3.0 0 0 0 10.0 10.0 1.0 10.0 0.000000 0 0. 0. 0 0. 0. - gps 740 0 1 3.0 0 0 0 10.0 10.0 1.0 10.0 0.000000 0 0. 0. 0 0. 0. - gps 741 0 1 3.0 0 0 0 10.0 10.0 1.0 10.0 0.000000 0 0. 0. 0 0. 0. - gps 742 0 1 3.0 0 0 0 10.0 10.0 1.0 10.0 0.000000 0 0. 0. 0 0. 0. - gps 743 0 1 3.0 0 0 0 10.0 10.0 1.0 10.0 0.000000 0 0. 0. 0 0. 0. - gps 744 0 1 3.0 0 0 0 10.0 10.0 1.0 10.0 0.000000 0 0. 0. 0 0. 0. - gps 745 0 1 3.0 0 0 0 10.0 10.0 1.0 10.0 0.000000 0 0. 0. 0 0. 0. - gps 820 0 1 3.0 0 0 0 10.0 10.0 1.0 10.0 0.000000 0 0. 0. 0 0. 0. - gps 042 0 1 3.0 0 0 0 10.0 10.0 1.0 10.0 0.000000 0 0. 0. 0 0. 0. - gps 043 0 -1 3.0 0 0 0 10.0 10.0 1.0 10.0 0.000000 0 0. 0. 0 0. 0. - gps 786 0 1 3.0 0 0 0 10.0 10.0 1.0 10.0 0.000000 0 0. 0. 0 0. 0. - gps 421 0 -1 3.0 0 0 0 10.0 10.0 1.0 10.0 0.000000 0 0. 0. 0 0. 0. - gps 003 0 1 3.0 0 0 0 10.0 10.0 1.0 10.0 0.000000 0 0. 0. 0 0. 0. - gps 821 0 -1 3.0 0 0 0 10.0 10.0 1.0 10.0 0.000000 0 0. 0. 0 0. 0. - gps 440 0 -1 3.0 0 0 0 10.0 10.0 1.0 10.0 0.000000 0 0. 0. 0 0. 0. - pm2_5 102 0 -1 1.0 0 0 0 100.0 1.5 0.75 10.0 0.000000 0 0. 0. 0 0. 0. - gps 750 0 -1 3.0 0 0 0 10.0 10.0 1.0 10.0 0.000000 0 0. 0. 0 0. 0. - gps 751 0 -1 3.0 0 0 0 10.0 10.0 1.0 10.0 0.000000 0 0. 0. 0 0. 0. - gps 752 0 -1 3.0 0 0 0 10.0 10.0 1.0 10.0 0.000000 0 0. 0. 0 0. 0. - gps 753 0 -1 3.0 0 0 0 10.0 10.0 1.0 10.0 0.000000 0 0. 0. 0 0. 0. - gps 754 0 -1 3.0 0 0 0 10.0 10.0 1.0 10.0 0.000000 0 0. 0. 0 0. 0. - gps 755 0 -1 3.0 0 0 0 10.0 10.0 1.0 10.0 0.000000 0 0. 0. 0 0. 0. - gps 724 0 -1 3.0 0 0 0 10.0 10.0 1.0 10.0 0.000000 0 0. 0. 0 0. 0. - gps 725 0 -1 3.0 0 0 0 10.0 10.0 1.0 10.0 0.000000 0 0. 0. 0 0. 0. - gps 726 0 -1 3.0 0 0 0 10.0 10.0 1.0 10.0 0.000000 0 0. 0. 0 0. 0. - gps 727 0 -1 3.0 0 0 0 10.0 10.0 1.0 10.0 0.000000 0 0. 0. 0 0. 0. - gps 728 0 -1 3.0 0 0 0 10.0 10.0 1.0 10.0 0.000000 0 0. 0. 0 0. 0. - gps 729 0 -1 3.0 0 0 0 10.0 10.0 1.0 10.0 0.000000 0 0. 0. 0 0. 0. - gps 044 0 -1 3.0 0 0 0 10.0 10.0 1.0 10.0 0.000000 0 0. 0. 0 0. 0. diff --git a/util/Conventional_Monitor/nwprod/gdas_cmon.v1.0.0/jobs/JGDAS_VCMON b/util/Conventional_Monitor/nwprod/gdas_cmon.v1.0.0/jobs/JGDAS_VCMON deleted file mode 100755 index 7adec06061..0000000000 --- a/util/Conventional_Monitor/nwprod/gdas_cmon.v1.0.0/jobs/JGDAS_VCMON +++ /dev/null @@ -1,156 +0,0 @@ -#!/bin/sh -############################################################# -# Set up environment for GDAS Conventional Monitor job -######################################## -set -xa -# -# Specify whether the run is production or development -# -export RUN_ENVIR=${RUN_ENVIR:-prod} -export envir=${envir:-prod} - -############################################################### -# This block can be modified for different test environment -############################################################### -if [ $RUN_ENVIR = prod -a $envir != prod ]; then - export SENDDBN=${SENDDBN:-NO} - export jlogfile=${jlogfile:-/com/logs/${envir}/jlogfile} -fi - - -echo `date` $0 `date -u` begin -export PS4='$SECONDS + ' - -########################################################### -# set up working directory space -########################################################### -#export pid=$$ -export CMON_WORK_DIR=${CMON_WORK_DIR:-/tmpnwprd} -export DATA=${DATA:-${CMON_WORK_DIR}/${jobid}} -mkdir -p $DATA -cd $DATA - -#################################### -# File To Log Msgs -#################################### -export jlogfile=${jlogfile:-/com/logs/jlogfiles/jlogfile.${jobid}} - -#################################### -# Determine Job Output Name on System -#################################### -export outid="LL$job" -export cycle=t${CYC}z - -############################### -# Specify NET and RUN name -############################## -export NET=${NET:-gfs} -export RUN=${RUN:-gdas} - -################################################## -# SENDCOM - Copy Files From TMPDIR to $COMOUT -# SENDDBN - Issue DBNet Client Calls -################################################## -export SENDCOM=${SENDCOM:-YES} -export SENDDBN=${SENDDBN:-NO} -export VERBOSE=${VERBOSE:-YES} -export ERRSCRIPT=${ERRSCRIPT:-err_chk} - -export HOMEgdascmon=${HOMEgdascmon:-/nw${envir}/gdas_cmon.${gdas_cmon_ver}} -export SCRIPTSgdascmon=${SCRIPTSgdascmon:-$HOMEgdascmon/scripts} -export FIXgdascmon=${FIXgdascmon:-$HOMEgdascmon/fix} - -export HOMEcmon=${HOMEcmon:-/nw${envir}/cmon_shared.${cmon_shared_ver}} -export EXECcmon=${EXECcmon:-$HOMEcmon/exec} -export FIXcmon=${FIXcmon:-${FIXgdascmon}} -export USHcmon=${USHcmon:-$HOMEcmon/ush} - -export LITTLE_ENDIAN=${LITTLE_ENDIAN:-0} -export COMPRESS=${COMPRESS:-gzip} -export UNCOMPRESS=${UNCOMPRESS:-gunzip} -export Z=${Z:-gz} - - - -################################### -# Set up the UTILITIES -################################### -export NWPROD=${NWPROD:-/nwprod} - -export utilscript=${utilscript:-$UTILROOT/ush} -export utilexec=${utilexec:-$UTILROOT/exec} -export NDATE=${NDATE:-$utilexec/ndate} - -# Run setup to initialize working directory and utility scripts -# per the setup.sh (on wcoss, it's not available on cray), the setup.sh -# utility is deprecated and we can call the utilities directly -#$utilscript/setup.sh - -# Run setpdy and initialize PDY variables -#$utilscript/setpdy.sh -#source ./PDY - - -############################################################## -# COMIN - WHERE GSI OUTPUT (which is input data) RESIDES -# TANKDIR_cmon - WHERE OUTPUT DATA WILL RESIDE -############################################################## -export C_TANKDIR=${C_TANKDIR:-/com/verf/${envir}} -export TANKDIR_cmon=${C_TANKDIR}/cmon.${PDY} -export COM_IN=${COM_IN:-/com/${NET}/${envir}} -export COMIN=${COMIN:-$COM_IN/${RUN}.${PDY}} -export CMON_SUFFIX=${CMON_SUFFIX:-gdas} - -mkdir -p -m 775 $TANKDIR_cmon - -m6h_date=`$NDATE -06 $PDATE` -export CYC_m6h=`echo $m6h_date|cut -c9-10` -export PDY_m6h=`echo $m6h_date|cut -c1-8` - -export COMIN_m6h=${COMIN_m6h:-$COM_IN/${RUN}.${PDY_m6h}} - -env - -############################################################################# -############################################################################# -# Set necessary environment variables -# -# Note: The CMon used to use the pgrbanl grib file. But at some point that -# file was changed and no longer includes the RHm2 field. So at Su's -# suggestion I modified the package to use the pgrbf00 grib file -# instead of pgrbanl. -############################################################################# -############################################################################# -export CMON_AREA=${CMON_AREA:-glb} - -export cnvstat=${cnvstat:-${COMIN}/gdas.t${CYC}z.cnvstat} -export pgrbf00=${pgrbf00:-${COMIN}/gdas.t${CYC}z.pgrbf00} -export pgrbf06=${pgrbf06:-${COMIN_m6h}/gdas.t${CYC_m6h}z.pgrbf06} - - -echo "cnvstat = $cnvstat" -echo "pgrbf00 = $pgrbf00" -echo "pgrbf06 = $pgrbf06" - -msg="JOB HAS STARTED" -postmsg "$jlogfile" "$msg" - -######################################################## -# Execute the script. -${CMONSH:-$HOMEgdascmon/scripts/exgdas_vrfyconv.sh.ecf} ${PDY} ${CYC} -######################################################## - -msg="J-JOB COMPLETED NORMALLY" -postmsg "$jlogfile" "$msg" - -################################ -# Remove the Working Directory -################################ -#RM_TMPDIR=NO -#cd $DATA_IN -#if [ ${RM_TMPDIR:-YES} = YES ] ; then -# rm -rf $DATA -#fi - -date - diff --git a/util/Conventional_Monitor/nwprod/gdas_cmon.v1.0.0/scripts/exgdas_vrfyconv.sh.ecf b/util/Conventional_Monitor/nwprod/gdas_cmon.v1.0.0/scripts/exgdas_vrfyconv.sh.ecf deleted file mode 100755 index 893b91fb64..0000000000 --- a/util/Conventional_Monitor/nwprod/gdas_cmon.v1.0.0/scripts/exgdas_vrfyconv.sh.ecf +++ /dev/null @@ -1,289 +0,0 @@ -#/bin/sh -################################################################################ -#### UNIX Script Documentation Block -# . . -# Script name: exgdas_vrfyconv.sh.sms -# Script description: Runs data extract/validation for global conventional diag data -# -# Author: Ed Safford Org: NP23 Date: 2015-09 -# -# Abstract: This script runs the data extract/validation portion of the -# CMon package. -# -# Script history log: -# 2015-09 Ed Safford -# -# Input script positional parameters: -# 1 Current analysis date in yyyymmddhh format -# defaults to PDY; required -# 2 cycle time in cc format -# defaults to CYC; required -# -# Imported Shell Variables: -# C_TANKDIR repository for cmon data files -# DATA data working space -# FIXgdascmon fixed file directory, gdas specific -# FIXcmon fixed file directory -# USHcmon scripts directory -# PDY processing day; -# overridden by 1 -# CYC processing cycle; -# overridden by 2 -# INISCRIPT Preprocessing script -# defaults to none -# LOGSCRIPT Log posting script -# defaults to none -# ERRSCRIPT Error processing script -# defaults to 'eval [[ $err = 0 ]]' -# ENDSCRIPT Postprocessing script -# defaults to none -# LITTLE_ENDIAN Flag to indicate LE machine -# defaults to 0 (big endian) -# -# Exported Shell Variables: -# err last return code -# -# Modules and files referenced: -# scripts : $INISCRIPT -# $LOGSCRIPT -# $ERRSCRIPT -# $ENDSCRIPT -# -# programs : $NDATE -# -# input data : $cnvstat -# $pgrbf00 -# $pgrbf06 -# -# output data: -# -# Remarks: -# -# Condition codes -# 0 - no problem encountered -# >0 - some problem encountered -# -# Control variable resolution priority -# 1 Command line argument. -# 2 Environment variable. -# 3 Inline default. -# -################################################################################ -# Set environment -export VERBOSE=${VERBOSE:-"NO"} -if [[ "$VERBOSE" = "YES" ]] -then - echo start exgdas_vrfyconv.sh.sms - set -x -fi -export RUN_ENVIR=${RUN_ENVIR:-prod} -export NET=${NET:-gfs} -export RUN=${RUN:-gdas} -export envir=${envir:-prod} - -# Command line arguments -export PDY=${1:-${PDY:?}} -export CYC=${2:-${CYC:?}} - -# Directories -export DATA=${DATA:-$(pwd)} # work directory -export C_COM_IN=${C_COM_IN:-/com/${NET}/${envir}} -export C_COMIN=${C_COMIN:-$C_COM_IN/${RUN}.${PDY}} - -export HOMEgdascmon=${HOMEgdascmon:-/nw${envir}/gdas_cmon.v${gdas_cmon_ver}} -export FIXgdascmon=${FIXgdascmon:-$HOMEgdascmon/fix} -export FIXcmon=${FIXcmon:-${FIXgdascmon}} - -export HOMEcmon=${HOMEcmon:-/nw${envir}/cmon_shared.v${cmon_shared_ver}} -export EXECcmon=${EXECcmon:-$HOMEcmon/exec} -export USHcmon=${USHcmon:-$HOMEcmon/ush} - -export C_TANKDIR=${C_TANKDIR:-/com/verf/prod} -export TANKDIR_cmon=${C_TANKDIR}/cmon.${PDY} - -export GDATE=`$NDATE -06 $PDY$CYC` -export PDYm6h=`echo $GDATE|cut -c1-8` -export GCYC=`echo $GDATE|cut -c9-10` -export C_COMINm6h=${C_COMINm6h:-${C_COM_IN}/${RUN}.${PDYm6h}} -export TANKDIR_prev_cmon=${C_TANKDIR}/cmon.${PDYm6h} - -# Filenames -export cnvstat=${cnvstat:-${C_COMIN}/gdas1.t${CYC}z.cnvstat} -export pgrbf00=${pgrbf00:-${C_COMIN}/gdas1.t${CYC}z.pgrbf00} -export pgrbf06=${pgrbf06:-${C_COMINm6h}/gdas1.t${GCYC}z.pgrbf06} -export convinfo=${convinfo:-${FIXgdascmon}/global_convinfo.txt} - -echo "cnvstat = $cnvstat" -echo "pgrbf00 = $pgrbf00" -echo "pgrbf06 = $pgrbf06" - -export INISCRIPT=${INISCRIPT} -export ERRSCRIPT=${ERRSCRIPT:-'eval [[ $err = 0 ]]'} -export LOGSCRIPT=${LOGSCRIPT} -export ENDSCRIPT=${ENDSCRIPT} - -# Other variables -export CMON_AREA=${CMON_AREA:-glb} -export NCP=${NCP:-/bin/cp -f} -export NDATE=${NDATE:-/nwprod/util/exec/ndate} -export pgm=exgdas_vrfyconv.sh.sms - -$LOGSCRIPT - -##################################################################### -# Preprocessing -$INISCRIPT - -if [[ ! -d ${DATA} ]]; then - mkdir $DATA -fi -cd $DATA -export workdir=$DATA - -#-------------------------------------------------------- -# Ensure necessary TANKDIR directories are in place -#-------------------------------------------------------- -if [[ ! -d ${TANKDIR_cmon} ]]; then - mkdir -p ${TANKDIR_cmon} -fi -if [[ ! -d ${TANKDIR_prev_cmon} ]]; then - mkdir -p ${TANKDIR_prev_cmon} -fi - -if [[ ! -d ${TANKDIR_cmon}/horz_hist ]]; then - mkdir -p ${TANKDIR_cmon}/horz_hist - mkdir -p ${TANKDIR_cmon}/horz_hist/anl - mkdir -p ${TANKDIR_cmon}/horz_hist/ges -fi -if [[ ! -d ${TANKDIR_prev_cmon}/horz_hist ]]; then - mkdir -p ${TANKDIR_prev_cmon}/horz_hist - mkdir -p ${TANKDIR_prev_cmon}/horz_hist/anl - mkdir -p ${TANKDIR_prev_cmon}/horz_hist/ges -fi - -if [[ ! -d ${TANKDIR_cmon}/time_vert ]]; then - mkdir -p ${TANKDIR_cmon}/time_vert -fi -if [[ ! -d ${TANKDIR_prev_cmon}/time_vert ]]; then - mkdir -p ${TANKDIR_prev_cmon}/time_vert -fi - - -if [[ "$VERBOSE" = "YES" ]]; then - if [[ -s ${cnvstat} ]]; then - echo "$cnvstat is available" - fi - if [[ -s ${pgrbf00} ]]; then - echo "$pgrbf00 is available" - fi - if [[ -s ${pgrbf06} ]]; then - echo "$pgrbf06 is available" - fi -fi -##################################################################### - -data_available=0 -if [[ -s ${cnvstat} && -s ${pgrbf00} && -s ${pgrbf06} ]]; then - data_available=1 - - #------------------------------------------------------------------ - # Copy data files file to local data directory. - # Untar cnvstat file. - #------------------------------------------------------------------ - - export grib2=${grib2:-0} - $NCP $cnvstat ./cnvstat.$PDATE - $NCP $pgrbf00 ./pgbanl.$PDATE - $NCP $pgrbf06 ./pgbf06.$GDATE - - tar -xvf ./cnvstat.$PDATE - $UNCOMPRESS ./*.${Z} - - - #------------------------------------------------------------------ - # NOTE: The anal (f00) and guess (f06) grib files - # contain more information than we need for the subsequent - # image generation. Use wgrib and awk to reduce the file - # size. The resulting files contain only RH, PRES, TMP, - # and UV data. - # - # NOTE: The f06 file is taken from the GDATE cycle (the previous - # cycle but is stored in TANKDIR in the - # cmon.$PDATE/horz_hist/ges subdirectory. - # - # NOTE: In order to use the anal and guess files in GrADS we - # need an index (.idx) and control (.ctl) file. These can - # be created in the plot process and don't need to be - # stored. - #------------------------------------------------------------------ - echo "grib2 = $grib2" - if [[ $grib2 -eq 0 ]]; then - - wgrib -s pgbanl.${PDATE} | awk '(/:RH:/ && /mb:/) || (/:RH:/ && /:2 m/) || (/:PRES:sfc/) || (/:UGRD:/ && /mb:/) || (/:VGRD:/ && /mb:/) || (/:TMP:/ && /mb:/)' | wgrib -i -grib pgbanl.${PDATE} -o ./pared_anal.${PDATE} - - - wgrib -s pgbf06.${GDATE} | awk '(/:RH:/ && /mb:/) || (/:RH:/ && /:2 m/) || (/:PRES:sfc/) || (/:UGRD:/ && /mb:/) || (/:VGRD:/ && /mb:/) || (/:TMP:/ && /mb:/)' | wgrib -i -grib pgbf06.${GDATE} -o ./pared_guess.${PDATE} - - else - #--------------------- - # wgrib2 is untested - #--------------------- - wgrib2 -s pgbanl.${PDATE} | awk '(/:RH:/ && /mb:/) || (/:PRES:sfc/) || (/:UGRD:/ && /mb:/) || (/:VGRD:/ && /mb:/) || (/:TMP:/ && /mb:/)' | wgrib2 -i -grib pgbanl.${PDATE} -o ./pared_pgbanl.${PDATE} - echo "using g2ctl.pl" - ${USHcmon}/g2ctl.pl -0 pared_pgbanl.$PDATE > pared_anal_${PDATE}.ctl -# gribmap -0 -i anal_${PDATE}.ctl - ${USHcmon}/g2ctl.pl pared_pgbf06.$GDATE > guess_${GDATE}.ctl -# gribmap -i guess_${PDATE}.ctl - fi - - ${NCP} ./pared_anal.${PDATE} ${TANKDIR_cmon}/horz_hist/anl/anal.${PDATE} - ${NCP} ./pared_guess.${PDATE} ${TANKDIR_cmon}/horz_hist/ges/guess.${PDATE} - - - #------------------------------------------------------------------ - # Run the child sccripts. - # --> get unique rc values for each child, use in error reporting below - #------------------------------------------------------------------ - - #--------------------------------------- - # run the horz-hist extraction script - # - ${USHcmon}/horz_hist.sh # ${PDATE} - rc_horz_hist=$? - echo "rc_horz_hist = $rc_horz_hist" - - #--------------------------------------- - # run the time-vert extraction script - # - ${USHcmon}/time_vert.sh - rc_time_vert=$? - echo "rc_time_vert = $rc_time_vert" - -fi - -##################################################################### -# Postprocessing -#$ENDSCRIPT - -err=0 -if [[ ${data_available} -ne 1 ]]; then - err=1 -elif [[ $rc_horz_hist -ne 0 ]]; then - echo "ERROR repored from horz_hist.sh: $rc_horz_hist" - err=$rc_horz_hist -elif [[ $rc_time_vert -ne 0 ]]; then - echo "ERROR repored from time_vert.sh: $rc_time_vert" - err=$rc_time_vert -fi - -if [[ "$VERBOSE" = "YES" ]]; then - echo "end exgdas_vrfyconv.sh.sms, exit value = ${err}" -fi - -if [[ ${err} -ne 0 ]]; then - export err=$err; err_chr -fi - -set +x -exit ${err} - diff --git a/util/Conventional_Monitor/nwprod/gdas_conmon/driver/test_jgdas_vcmon_hera.sh b/util/Conventional_Monitor/nwprod/gdas_conmon/driver/test_jgdas_vcmon_hera.sh new file mode 100755 index 0000000000..6cbaa59bba --- /dev/null +++ b/util/Conventional_Monitor/nwprod/gdas_conmon/driver/test_jgdas_vcmon_hera.sh @@ -0,0 +1,91 @@ +#!/bin/ksh -l + +#SBATCH -o %x.log +#SBATCH -J gdas_vconmon +#SBATCH --time=00:40:00 +#SBATCH --ntasks=1 -p service --mem=4g +#SBATCH -A da-cpu + + +set -x + +#export PDATE=${PDATE:-2020012018} # binary +export PDATE=${PDATE:-2020040306} # netcdf + +############################################################# +# Specify versions +############################################################# +export gdas_ver=v15.0.0 +export global_shared_ver=v15.0.0 +#export gdas_conmon_ver=v1.0.0 +#export conmon_shared_ver=v1.0.0 + +module use -a /apps/modules/modulefamilies/intel +module load wgrib2/2.0.8 +export WGRIB2=`which wgrib2` +echo WGRIB2 = $WGRIB2 + +############################################################# +# Specify whether the run is production or development +############################################################# +export PDY=`echo $PDATE | cut -c1-8` +export CYC=`echo $PDATE | cut -c9-10` +export job=gfs_vconmon.${CYC} +export pid=${pid:-$$} +export jobid=${job}.${pid} +export DATAROOT=${DATAROOT:-/scratch1/NCEPDEV/da/Edward.Safford/noscrub/test_data} +export COMROOT=${COMROOT:-/scratch2/NCEPDEV/stmp3/$LOGNAME/com} + + + +############################################################# +# Add nwpara tools to path +############################################################# +#export NWPROD=${NWPROD:-/scratch4/NCEPDEV/global/save/glopara/nwpara/util} +#NWPRODush=${NWPRODush:=${NWPROD}/ush} +#NWPRODexec=${NWPRODexec:=${NWPROD}/exec} +#export PATH=${PATH}:${NWPRODush}:${NWPRODexec} + + +############################################################# +# Set user specific variables +############################################################# +export CONMON_SUFFIX=${CONMON_SUFFIX:-test_conmon} + +export NWTEST=${NWTEST:-/scratch1/NCEPDEV/da/${LOGNAME}/noscrub/GSI/util/Conventional_Monitor/nwprod} +export HOMEconmon=${HOMEconmon:-${NWTEST}/conmon_shared} + +export HOMEgdas_conmon=${HOMEgdas_conmon:-${NWTEST}/gdas_conmon} +export HOMEgfs_conmon=${HOMEgdas_conmon} + +export JOBGLOBAL=${JOBGLOBAL:-${HOMEgdas_conmon}/jobs} +export C_COM_IN=${C_COM_IN:-${DATAROOT}} + +export C_TANKDIR=${C_TANKDIR:-${COMROOT}/${CONMON_SUFFIX}} +if [[ ! -d $C_TANKDIR ]]; then + mkdir -p ${C_TANKDIR} +fi + +export CONMON_WORK_DIR=${CONMON_WORK_DIR:-/scratch2/NCEPDEV/stmp1/${LOGNAME}/conmon_${CONMON_SUFFIX}} +if [[ ! -d $CONMON_WORK_DIR ]]; then + mkdir -p ${CONMON_WORK_DIR} +fi + + +####################################################################### +# hera specific hacks for no prod_utils module +####################################################################### +export NDATE=${NDATE:-/home/Edward.Safford/bin/ndate} +export MY_MACHINE=hera + +prevday=`$NDATE -24 $PDATE` +export PDYm1=`echo $prevday | cut -c1-8` + + +############################################################# +# Execute job +############################################################# +$JOBGLOBAL/JGDAS_ATMOS_CONMON + +exit + diff --git a/util/Conventional_Monitor/nwprod/gdas_conmon/driver/test_jgdas_vcmon_wcoss_c.sh b/util/Conventional_Monitor/nwprod/gdas_conmon/driver/test_jgdas_vcmon_wcoss_c.sh new file mode 100755 index 0000000000..e7f64e808f --- /dev/null +++ b/util/Conventional_Monitor/nwprod/gdas_conmon/driver/test_jgdas_vcmon_wcoss_c.sh @@ -0,0 +1,85 @@ +#!/bin/ksh + +#BSUB -o gdas_vconmon.o%J +#BSUB -e gdas_vconmon.o%J +#BSUB -J gdas_vconmon +#BSUB -q dev +#BSUB -n 1 +#BSUB -M 900 +#BSUB -W 00:30 +#BSUB -P GFS-DEV +#BSUB -R "select[mem>900] rusage[mem=900]" + +set -x + +export PDATE=${PDATE:-2020091312} + + +############################################################# +# Specify versions +############################################################# +export gdas_ver=v15.0.0 +export global_shared_ver=v15.0.0 +#export gdas_conmon_ver=v1.0.0 +#export conmon_shared_ver=v1.0.0 + +############################################################# +# Load modules +############################################################# +. $MODULESHOME/init/ksh + +module load prod_util +module load prod_envir +module load grib_util/1.0.5 + +module list + +############################################################# +# Specify whether the run is production or development +############################################################# +export PDY=`echo $PDATE | cut -c1-8` +export CYC=`echo $PDATE | cut -c9-10` +export conmon_job=${conmon_job:-gdas_conmon.${CYC}} +export pid=${pid:-$$} +export jobid=${conmon_job}.${pid} +export DATAROOT=/gpfs/hps3/emc/da/noscrub/$LOGNAME/test_data +export COMROOT=/gpfs/hps2/ptmp/$LOGNAME/com + + +############################################################# +# WCOSS environment settings +############################################################# +export POE=YES + + +############################################################# +# Set user specific variables +############################################################# +export CONMON_SUFFIX=${CONMON_SUFFIX:-test_conmon} +export NWTEST=${NWTEST:-/gpfs/hps3/emc/da/noscrub/${LOGNAME}/GSI/util/Conventional_Monitor/nwprod} +export HOMEconmon=${HOMEconmon:-${NWTEST}/conmon_shared} +export HOMEgdas_conmon=${HOMEgdas_conmon:-${NWTEST}/gdas_conmon} +export HOMEgfs_conmon=${HOMEgdas_conmon} + +export JOBGLOBAL=${HOMEgdas_conmon}/jobs +export C_COM_IN=${C_COM_IN:-${DATAROOT}} + + +export C_TANKDIR=${C_TANKDIR:-${COMROOT}/${CONMON_SUFFIX}} +if [[ ! -d $C_TANKDIR ]]; then + mkdir -p ${C_TANKDIR} +fi + +export CONMON_WORK_DIR=${CONMON_WORK_DIR:-/gpfs/hps/stmp/$LOGNAME/conmon_${CONMON_SUFFIX}} +if [[ ! -d $CONMON_WORK_DIR ]]; then + mkdir -p ${CONMON_WORK_DIR} +fi + + +############################################################# +# Execute job +############################################################# +$JOBGLOBAL/JGDAS_ATMOS_CONMON + +exit + diff --git a/util/Conventional_Monitor/nwprod/gdas_conmon/driver/test_jgdas_vcmon_wcoss_d.sh b/util/Conventional_Monitor/nwprod/gdas_conmon/driver/test_jgdas_vcmon_wcoss_d.sh new file mode 100755 index 0000000000..b5fb2b150c --- /dev/null +++ b/util/Conventional_Monitor/nwprod/gdas_conmon/driver/test_jgdas_vcmon_wcoss_d.sh @@ -0,0 +1,89 @@ +#!/bin/ksh + +#BSUB -o gdas_conmon.o%J +#BSUB -e gdas_conmon.o%J +#BSUB -J gdas_vconmon +#BSUB -q dev_shared +#BSUB -n 1 +#BSUB -R affinity[core] +#BSUB -M 900 +#BSUB -W 00:30 +#BSUB -P GFS-DEV + +set -x + +export PDATE=${PDATE:-2020072006} + + +############################################################# +# Specify versions +############################################################# +export gdas_ver=v15.0.0 +export global_shared_ver=v15.0.0 +#export gdas_conmon_ver=v1.0.0 +#export conmon_shared_ver=v1.0.0 + +############################################################# +# Load modules +############################################################# +. /usrx/local/prod/lmod/lmod/init/profile + +module load lsf/10.1 +module load ips/18.0.1.163 +module load impi/18.0.1 +module load prod_util/1.1.0 +module load util_shared/1.1.0 +module load grib_util/1.1.1 + +module list + +############################################################# +# Specify whether the run is production or development +############################################################# +export PDY=`echo $PDATE | cut -c1-8` +export CYC=`echo $PDATE | cut -c9-10` +export job=gdas_conmon.${CYC} +export pid=${pid:-$$} +export jobid=${job}.${pid} +export DATAROOT=${DATAROOT:-/gpfs/dell2/emc/modeling/noscrub/Edward.Safford/test_data} +export COMROOT=${COMROOT:-/gpfs/dell2/ptmp/$LOGNAME/com} + + +############################################################# +# WCOSS environment settings +############################################################# +export POE=YES + + +############################################################# +# Set user specific variables +############################################################# +export CONMON_SUFFIX=${CONMON_SUFFIX:-test_conmon} + +export NWTEST=${NWTEST:-/gpfs/dell2/emc/modeling/noscrub/Edward.Safford/GSI/util/Conventional_Monitor/nwprod} +export HOMEconmon=${HOMEconmon:-${NWTEST}/conmon_shared} + +export HOMEgdas_conmon=${HOMEgdas_conmon:-${NWTEST}/gdas_conmon} +export HOMEgfs_conmon=${HOMEgdas_conmon} + +export JOBGLOBAL=${HOMEgdas_conmon}/jobs +export C_COM_IN=${C_COM_IN:-${DATAROOT}} + +export C_TANKDIR=${C_TANKDIR:-${COMROOT}/${CONMON_SUFFIX}} +if [[ ! -d $C_TANKDIR ]]; then + mkdir -p ${C_TANKDIR} +fi + +export CONMON_WORK_DIR=${CONMON_WORK_DIR:-/gpfs/dell2/stmp/$LOGNAME/conmon_${CONMON_SUFFIX}} +if [[ ! -d $CONMON_WORK_DIR ]]; then + mkdir -p ${CONMON_WORK_DIR} +fi + + +############################################################# +# Execute job +############################################################# +$JOBGLOBAL/JGDAS_ATMOS_CONMON + +exit + diff --git a/util/Conventional_Monitor/nwprod/gdas_conmon/fix/gdas_conmon_base.txt b/util/Conventional_Monitor/nwprod/gdas_conmon/fix/gdas_conmon_base.txt new file mode 100644 index 0000000000..5d62d444cd --- /dev/null +++ b/util/Conventional_Monitor/nwprod/gdas_conmon/fix/gdas_conmon_base.txt @@ -0,0 +1,252 @@ +00, ps180_00, 5893.68 +00, ps180_01, 953.57 +00, ps181_00, 8452.73 +00, ps183_00, 743.70 +00, ps187_00, 8107.02 +00, q120_00, 5203.89 +00, q131_00, 0.00 +00, q132_00, 0.00 +00, q133_00, 8889.07 +00, q134_00, 1808.64 +00, q180_00, 132.80 +00, q180_01, 438.64 +00, q181_00, 7108.14 +00, q182_00, 0.00 +00, q183_00, 431.66 +00, q187_00, 2682.73 +00, t120_00, 7430.93 +00, t130_00, 708.89 +00, t131_00, 14224.09 +00, t132_00, 134.14 +00, t133_00, 82632.52 +00, t134_00, 1964.36 +00, t135_00, 222.65 +00, uv220_00, 7566.75 +00, uv221_00, 753.02 +00, uv224_00, 12680.59 +00, uv229_00, 1.55 +00, uv230_00, 411.36 +00, uv231_00, 14216.70 +00, uv232_00, 158.33 +00, uv233_00, 82458.45 +00, uv234_00, 1964.36 +00, uv235_00, 222.65 +00, uv240_270, 47920.77 +00, uv240_271, 13175.73 +00, uv242_173, 13338.39 +00, uv243_55, 8279.71 +00, uv243_70, 558.22 +00, uv245_270, 222876.39 +00, uv245_271, 269242.55 +00, uv246_270, 119165.07 +00, uv246_271, 104762.45 +00, uv247_270, 60007.50 +00, uv247_271, 56213.55 +00, uv250_173, 16166.75 +00, uv252_173, 16777.20 +00, uv253_55, 32875.59 +00, uv253_70, 34356.59 +00, uv254_55, 118115.49 +00, uv254_70, 83193.98 +00, uv257_783, 2167.29 +00, uv257_784, 3032.76 +00, uv258_784, 1776.61 +00, uv259_784, 3418.15 +00, uv260_224, 43658.66 +00, uv260_225, 46007.07 +00, uv280_00, 660.43 +00, uv280_01, 868.59 +00, uv281_00, 8278.23 +00, uv282_00, 39.11 +00, uv284_00, 730.57 +00, uv287_00, 7943.77 +00, uv290_03, 110508.89 +00, uv290_04, 104619.18 +06, ps180_00, 5915.51 +06, ps180_01, 941.47 +06, ps181_00, 8454.42 +06, ps183_00, 900.49 +06, ps187_00, 8166.78 +06, q120_00, 159.71 +06, q131_00, 82.50 +06, q132_00, 139.00 +06, q133_00, 2004.87 +06, q134_00, 1197.58 +06, q180_00, 151.38 +06, q180_01, 461.69 +06, q181_00, 7237.73 +06, q182_00, 6.67 +06, q183_00, 609.93 +06, q187_00, 3336.22 +06, t120_00, 198.44 +06, t130_00, 882.98 +06, t131_00, 14228.80 +06, t132_00, 145.68 +06, t133_00, 28732.62 +06, t134_00, 1289.13 +06, t135_00, 12.50 +06, uv220_00, 203.76 +06, uv221_00, 698.44 +06, uv224_00, 13744.53 +06, uv229_00, 12.33 +06, uv230_00, 427.20 +06, uv231_00, 14171.40 +06, uv232_00, 156.79 +06, uv233_00, 28654.51 +06, uv234_00, 1289.13 +06, uv235_00, 12.50 +06, uv240_270, 97287.98 +06, uv240_271, 112212.91 +06, uv242_173, 9646.67 +06, uv243_55, 50572.00 +06, uv243_70, 30210.95 +06, uv245_270, 214092.53 +06, uv245_271, 236485.51 +06, uv246_270, 108383.91 +06, uv246_271, 88905.11 +06, uv247_270, 60949.51 +06, uv247_271, 53780.22 +06, uv250_173, 16122.22 +06, uv252_173, 16551.13 +06, uv253_55, 31125.00 +06, uv253_70, 35180.42 +06, uv254_55, 117679.40 +06, uv254_70, 83160.70 +06, uv257_783, 2888.46 +06, uv257_784, 4147.86 +06, uv258_784, 2009.27 +06, uv259_784, 6430.80 +06, uv260_224, 43683.71 +06, uv260_225, 46670.56 +06, uv280_00, 650.76 +06, uv280_01, 856.80 +06, uv281_00, 8295.29 +06, uv282_00, 38.72 +06, uv284_00, 883.31 +06, uv287_00, 7976.87 +06, uv290_03, 107716.42 +06, uv290_04, 112313.18 +12, ps180_00, 5864.48 +12, ps180_01, 946.30 +12, ps181_00, 8806.14 +12, ps183_00, 907.64 +12, ps187_00, 8460.68 +12, q120_00, 5247.16 +12, q131_00, 73.25 +12, q133_00, 3981.32 +12, q134_00, 897.80 +12, q180_00, 134.95 +12, q180_01, 446.68 +12, q181_00, 7435.27 +12, q183_00, 581.00 +12, q187_00, 3010.57 +12, t120_00, 7332.25 +12, t130_00, 971.36 +12, t131_00, 18361.84 +12, t132_00, 280.50 +12, t133_00, 44030.64 +12, t134_00, 973.34 +12, t135_00, 168.17 +12, uv220_00, 7481.86 +12, uv221_00, 745.18 +12, uv224_00, 11512.34 +12, uv229_00, 0.00 +12, uv230_00, 406.45 +12, uv231_00, 18290.64 +12, uv232_00, 303.33 +12, uv233_00, 44105.28 +12, uv234_00, 973.34 +12, uv235_00, 168.17 +12, uv240_270, 49415.02 +12, uv240_271, 114547.93 +12, uv242_173, 425.19 +12, uv243_55, 45787.74 +12, uv243_70, 49310.81 +12, uv245_270, 219164.93 +12, uv245_271, 231538.55 +12, uv246_270, 104615.41 +12, uv246_271, 40285.57 +12, uv247_270, 61243.82 +12, uv247_271, 17164.32 +12, uv250_173, 16750.84 +12, uv252_173, 16473.75 +12, uv253_55, 31893.95 +12, uv253_70, 32896.21 +12, uv254_55, 118387.44 +12, uv254_70, 79981.60 +12, uv257_783, 4491.00 +12, uv257_784, 2122.57 +12, uv258_784, 3163.57 +12, uv259_784, 3516.60 +12, uv260_224, 36593.61 +12, uv260_225, 38112.89 +12, uv280_00, 662.39 +12, uv280_01, 862.77 +12, uv281_00, 8629.25 +12, uv282_00, 38.67 +12, uv284_00, 892.11 +12, uv287_00, 8259.11 +12, uv290_03, 113525.11 +12, uv290_04, 111069.48 +18, ps180_00, 5946.30 +18, ps180_01, 971.98 +18, ps181_00, 8685.52 +18, ps183_00, 801.39 +18, ps187_00, 8234.98 +18, q120_00, 92.84 +18, q131_00, 76.33 +18, q133_00, 9701.55 +18, q134_00, 1615.39 +18, q180_00, 131.07 +18, q180_01, 438.98 +18, q181_00, 7434.20 +18, q183_00, 483.55 +18, q187_00, 2820.11 +18, t120_00, 210.25 +18, t130_00, 859.70 +18, t131_00, 16483.52 +18, t132_00, 79.91 +18, t133_00, 85887.59 +18, t134_00, 1765.43 +18, t135_00, 326.02 +18, uv220_00, 215.39 +18, uv221_00, 344.43 +18, uv224_00, 11812.70 +18, uv229_00, 12.70 +18, uv230_00, 369.43 +18, uv231_00, 16420.43 +18, uv232_00, 108.65 +18, uv233_00, 85676.66 +18, uv234_00, 1765.43 +18, uv235_00, 326.02 +18, uv240_270, 2130.57 +18, uv240_271, 24649.91 +18, uv242_173, 2081.18 +18, uv243_55, 8076.28 +18, uv243_70, 27930.65 +18, uv245_270, 233644.80 +18, uv245_271, 275469.66 +18, uv246_270, 117734.36 +18, uv246_271, 76461.16 +18, uv247_270, 58665.98 +18, uv247_271, 37439.39 +18, uv250_173, 16630.89 +18, uv252_173, 16480.43 +18, uv253_55, 33010.63 +18, uv253_70, 33929.35 +18, uv254_55, 117452.67 +18, uv254_70, 80732.93 +18, uv257_783, 3842.49 +18, uv257_784, 2414.48 +18, uv258_784, 2548.52 +18, uv259_784, 2972.43 +18, uv260_224, 37882.43 +18, uv260_225, 39653.05 +18, uv280_00, 660.43 +18, uv280_01, 881.84 +18, uv281_00, 8506.36 +18, uv282_00, 38.95 +18, uv284_00, 788.32 +18, uv287_00, 7989.91 +18, uv290_03, 109562.64 +18, uv290_04, 111045.18 diff --git a/util/Conventional_Monitor/nwprod/gdas_conmon/fix/global_convinfo.txt b/util/Conventional_Monitor/nwprod/gdas_conmon/fix/global_convinfo.txt new file mode 100755 index 0000000000..1444535d51 --- /dev/null +++ b/util/Conventional_Monitor/nwprod/gdas_conmon/fix/global_convinfo.txt @@ -0,0 +1,244 @@ +! otype = observation type (a7, t, uv, q, etc.) +! type = prepbufr observation type (if available) +! sub = prepbufr subtype (not yet available) +! iuse = flag if to use/not use / monitor data +! = 1 use data +! = 0 do not use data +! = -1 monitor data +! = -3 skip reading data +! twindow = time window (+/- hours) +! numgrp = cross validation parameter - number of groups +! ngroup = cross validation parameter - group to remove from data use +! nmiter = cross validation parameter - external iteration to introduce removed data +! gross = gross error parameter - gross error +! ermax = gross error parameter - max error +! ermin = gross error parameter - min error +! var_b = variational quality control parameter - b parameter +! var_pg ithin rmesh npred = variational quality control parameter - pg parameter +! pmot: the optione to keep thinned datai as monitored, 0: not to keep, other values: to keep +! ptime: time interval for thinning, 0, no temporal thinning, other values define time interval (less than 6) +! ib,ip: new nonlinear qc parameter, ib:betta, ip:kappa +!otype type sub iuse twindow numgrp ngroup nmiter gross ermax ermin var_b var_pg ithin rmesh pmesh npred pmot ptime ib ip + tcp 112 0 1 3.0 0 0 0 75.0 5.0 1.0 75.0 0.000000 0 0. 0. 0 0. 0. 0 0 + ps 120 0 1 3.0 0 0 0 5.0 3.0 1.0 5.0 0.000300 0 0. 0. 0 0. 0. 4 -9 + ps 132 0 -1 3.0 0 0 0 5.0 3.0 1.0 5.0 0.000300 0 0. 0. 0 0. 0. 0 0 + ps 180 0 1 3.0 0 0 0 5.0 3.0 1.0 5.0 0.000300 0 0. 0. 0 0. 0. 6 -7 + ps 180 01 1 3.0 0 0 0 5.0 3.0 1.0 5.0 0.000300 0 0. 0. 0 0. 0. 8 -9 + ps 181 0 1 3.0 0 0 0 5.0 3.0 1.0 5.0 0.000300 0 0. 0. 0 0. 0. 4 -9 + ps 182 0 1 3.0 0 0 0 5.0 3.0 1.0 5.0 0.000300 0 0. 0. 0 0. 0. 6 -7 + ps 183 0 -1 3.0 0 0 0 5.0 3.0 1.0 5.0 0.000300 0 0. 0. 0 0. 0. 0 0 + ps 187 0 1 3.0 0 0 0 5.0 3.0 1.0 5.0 0.000300 0 0. 0. 0 0. 0. 6 -7 + t 120 0 1 3.0 0 0 0 8.0 5.6 1.3 8.0 0.000001 0 0. 0. 0 0. 0. 3 -6 + t 126 0 -1 3.0 0 0 0 8.0 5.6 1.3 8.0 0.001000 0 0. 0. 0 0. 0. 0 0 + t 130 0 1 3.0 0 0 0 7.0 5.6 1.3 7.0 0.001000 0 0. 0. 0 0. 0. 7 -9 + t 131 0 1 3.0 0 0 0 7.0 5.6 1.3 7.0 0.001000 0 0. 0. 0 0. 0. 7 -9 + t 132 0 1 3.0 0 0 0 7.0 5.6 1.3 7.0 0.001000 0 0. 0. 0 0. 0. 3 -6 + t 133 0 1 3.0 0 0 0 7.0 5.6 1.3 7.0 0.004000 0 0. 0. 0 0. 0. 7 -9 + t 134 0 1 3.0 0 0 0 7.0 5.6 1.3 7.0 0.004000 0 0. 0. 0 0. 0. 0 0 + t 135 0 1 3.0 0 0 0 7.0 5.6 1.3 7.0 0.004000 0 0. 0. 0 0. 0. 0 0 + t 136 0 1 3.0 0 0 0 2.0 5.6 1.3 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + t 180 0 1 3.0 0 0 0 7.0 5.6 1.3 7.0 0.004000 0 0. 0. 0 0. 0. 7 -6 + t 180 01 1 3.0 0 0 0 7.0 5.6 1.3 7.0 0.004000 0 0. 0. 0 0. 0. 8 -9 + t 181 0 -1 3.0 0 0 0 7.0 5.6 1.3 7.0 0.004000 0 0. 0. 0 0. 0. 0 0 + t 182 0 1 3.0 0 0 0 7.0 5.6 1.3 7.0 0.004000 0 0. 0. 0 0. 0. 7 -6 + t 183 0 -1 3.0 0 0 0 7.0 5.6 1.3 7.0 0.004000 0 0. 0. 0 0. 0. 0 0 + t 187 0 -1 3.0 0 0 0 7.0 5.6 1.3 7.0 0.004000 0 0. 0. 0 0. 0. 0 0 + q 120 0 1 3.0 0 0 0 8.0 100.0 10.0 8.0 0.000500 0 0. 0. 0 0. 0. 7 -6 + q 130 0 -1 3.0 0 0 0 8.0 100.0 10.0 8.0 0.000600 0 0. 0. 0 0. 0. 0 0 + q 131 0 -1 3.0 0 0 0 8.0 100.0 10.0 8.0 0.000600 0 0. 0. 0 0. 0. 0 0 + q 132 0 1 3.0 0 0 0 8.0 100.0 10.0 8.0 0.000600 0 0. 0. 0 0. 0. 6 -6 + q 133 0 1 3.0 0 0 0 8.0 100.0 10.0 8.0 0.000600 0 0. 0. 0 0. 0. 6 -6 + q 134 0 -1 3.0 0 0 0 8.0 100.0 10.0 8.0 0.000600 0 0. 0. 0 0. 0. 0 0 + q 135 0 -1 3.0 0 0 0 8.0 100.0 10.0 8.0 0.000600 0 0. 0. 0 0. 0. 0 0 + q 136 0 1 3.0 0 0 0 2.0 50.0 5.0 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + q 180 0 1 3.0 0 0 0 8.0 100.0 10.0 8.0 0.000500 0 0. 0. 0 0. 0. 6 -1 + q 180 01 1 3.0 0 0 0 8.0 100.0 10.0 8.0 0.000500 0 0. 0. 0 0. 0. 6 -9 + q 181 0 -1 3.0 0 0 0 8.0 100.0 10.0 8.0 0.000500 0 0. 0. 0 0. 0. 0 0 + q 182 0 1 3.0 0 0 0 8.0 100.0 10.0 8.0 0.000600 0 0. 0. 0 0. 0. 6 -1 + q 183 0 -1 3.0 0 0 0 8.0 100.0 10.0 8.0 0.000600 0 0. 0. 0 0. 0. 0 0 + q 187 0 -1 3.0 0 0 0 8.0 100.0 10.0 8.0 0.000600 0 0. 0. 0 0. 0. 0 0 + pw 152 0 -1 3.0 0 0 0 10.0 8.0 2.0 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + pw 153 0 -1 3.0 0 0 0 5.0 5.0 2.0 5.0 0.000000 0 0. 0. 0 0. 0. 0 0 + pw 156 0 -1 3.0 0 0 0 10.0 8.0 2.0 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + pw 157 0 -1 3.0 0 0 0 10.0 8.0 2.0 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + pw 158 0 -1 3.0 0 0 0 10.0 8.0 2.0 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + pw 159 0 -1 3.0 0 0 0 10.0 8.0 2.0 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + sst 181 0 1 3.0 0 0 0 2.0 2.0 0.2 2.0 0.000000 0 0. 0. 0 0. 0. 0 0 + sst 182 0 1 3.0 0 0 0 1.5 2.0 0.2 1.5 0.000000 0 0. 0. 0 0. 0. 0 0 + sst 183 0 1 3.0 0 0 0 1.5 2.0 0.2 1.5 0.000000 0 0. 0. 0 0. 0. 0 0 + sst 184 0 1 3.0 0 0 0 1.5 2.0 0.2 1.5 0.000000 0 0. 0. 0 0. 0. 0 0 + sst 185 0 1 3.0 0 0 0 1.5 2.0 0.2 1.5 0.000000 0 0. 0. 0 0. 0. 0 0 + sst 186 0 1 3.0 0 0 0 1.5 2.0 0.2 1.5 0.000000 0 0. 0. 0 0. 0. 0 0 + sst 187 0 1 3.0 0 0 0 1.5 2.0 0.2 1.5 0.000000 0 0. 0. 0 0. 0. 0 0 + sst 188 0 1 3.0 0 0 0 1.5 2.0 0.2 1.5 0.000000 0 0. 0. 0 0. 0. 0 0 + sst 189 0 1 3.0 0 0 0 1.0 2.0 0.2 1.0 0.000000 0 0. 0. 0 0. 0. 0 0 + sst 190 0 1 3.0 0 0 0 3.0 2.0 0.2 3.0 0.000000 0 0. 0. 0 0. 0. 0 0 + sst 191 0 1 3.0 0 0 0 3.0 2.0 0.2 3.0 0.000000 0 0. 0. 0 0. 0. 0 0 + sst 192 0 1 3.0 0 0 0 2.0 2.0 0.2 2.0 0.000000 0 0. 0. 0 0. 0. 0 0 + sst 193 0 1 3.0 0 0 0 2.0 2.0 0.2 2.0 0.000000 0 0. 0. 0 0. 0. 0 0 + sst 194 0 1 3.0 0 0 0 3.0 2.0 0.2 3.0 0.000000 0 0. 0. 0 0. 0. 0 0 + sst 195 0 1 3.0 0 0 0 2.0 2.0 0.2 2.0 0.000000 0 0. 0. 0 0. 0. 0 0 + sst 196 0 1 3.0 0 0 0 2.0 2.0 0.2 2.0 0.000000 0 0. 0. 0 0. 0. 0 0 + sst 197 0 1 3.0 0 0 0 1.5 2.0 0.2 1.5 0.000000 0 0. 0. 0 0. 0. 0 0 + sst 198 0 1 3.0 0 0 0 1.5 2.0 0.2 1.5 0.000000 0 0. 0. 0 0. 0. 0 0 + sst 199 0 1 3.0 0 0 0 3.0 2.0 0.2 3.0 0.000000 0 0. 0. 0 0. 0. 0 0 + uv 210 0 -1 3.0 0 0 0 8.0 6.1 1.4 8.0 0.000001 0 0. 0. 0 0. 0. 3 -6 + uv 220 0 1 3.0 0 0 0 8.0 6.1 1.4 8.0 0.000001 0 0. 0. 0 0. 0. 3 -6 + uv 221 0 1 3.0 0 0 0 8.0 6.1 1.4 8.0 0.000001 0 0. 0. 0 0. 0. 3 -6 + uv 223 0 1 3.0 0 0 0 7.5 6.1 1.4 7.5 0.000001 0 0. 0. 0 0. 0. 3 -6 + uv 224 0 1 3.0 0 0 0 6.5 6.1 1.4 6.5 0.000001 0 0. 0. 0 0. 0. 3 -6 + uv 228 0 -1 3.0 0 0 0 6.5 6.1 1.4 6.5 0.000001 0 0. 0. 0 0. 0. 3 -6 + uv 229 0 1 3.0 0 0 0 6.5 6.1 1.4 6.5 0.000001 0 0. 0. 0 0. 0. 3 -6 + uv 230 0 1 3.0 0 0 0 6.0 6.1 1.4 6.0 0.000100 20 100. 800. 0 0. 1. 7 -4 + uv 231 0 1 3.0 0 0 0 6.5 6.1 1.4 6.5 0.000100 20 100. 800. 0 0. 1. 6 -5 + uv 232 0 1 3.0 0 0 0 7.0 6.1 1.4 7.0 0.000100 0 0. 0. 0 0. 0. 3 -7 + uv 233 0 1 3.0 0 0 0 7.5 6.1 1.4 7.5 0.000100 20 100. 800. 0 0. 1. 6 -4 + uv 234 0 1 3.0 0 0 0 7.5 6.1 1.4 7.5 0.000100 0 0. 0. 0 0. 0. 0 0 + uv 235 0 1 3.0 0 0 0 7.5 6.1 1.4 7.5 0.000100 0 0. 0. 0 0. 0. 0 0 + uv 236 0 1 3.0 0 0 0 2.0 6.1 1.4 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + uv 240 0 -1 3.0 0 0 0 2.5 6.1 1.4 2.5 0.000100 0 0. 0. 0 0. 0. 0 0 + uv 240 257 -1 3.0 0 0 0 2.5 6.1 1.4 2.5 0.000100 0 100. 50. 0 0. 0. 0 0 + uv 240 259 -1 3.0 0 0 0 2.5 6.1 1.4 2.5 0.000100 0 100. 50. 0 0. 0. 0 0 + uv 240 270 -1 3.0 0 0 0 2.5 6.1 1.4 2.5 0.000100 0 100. 50. 0 0. 0. 0 0 + uv 240 271 -1 3.0 0 0 0 2.5 6.1 1.4 2.5 0.000100 0 100. 50. 0 0. 0. 0 0 + uv 241 0 -1 3.0 0 0 0 2.5 6.1 1.4 2.5 0.000100 0 0. 0. 0 0. 0. 0 0 + uv 242 0 -1 3.0 0 0 0 2.5 15.0 1.4 2.5 0.005000 0 0. 0. 0 0. 0. 13 -8 + uv 242 171 1 3.0 0 0 0 2.5 15.0 1.4 2.5 0.055000 1 200. 100. 0 0. 2. 15 -8 + uv 242 172 1 3.0 0 0 0 2.5 15.0 1.4 2.5 0.055000 1 200. 100. 0 0. 2. 15 -8 + uv 242 173 1 3.0 0 0 0 2.5 15.0 1.4 2.5 0.055000 1 200. 100. 0 0. 2. 15 -8 + uv 242 174 1 3.0 0 0 0 2.5 15.0 1.4 2.5 0.055000 1 200. 100. 0 0. 2. 15 -8 + uv 243 0 -1 3.0 0 0 0 1.5 15.0 1.4 1.5 0.055000 0 0. 0. 0 0. 0. 15 -8 + uv 243 54 -1 3.0 0 0 0 1.5 15.0 1.4 1.5 0.055000 1 200. 100. 0 0. 2. 15 -8 + uv 243 55 1 3.0 0 0 0 1.5 15.0 1.4 1.5 0.055000 1 200. 100. 0 0. 2. 15 -8 + uv 243 56 -1 3.0 0 0 0 1.5 15.0 1.4 1.5 0.055000 1 200. 100. 0 0. 2. 15 -8 + uv 243 57 -1 3.0 0 0 0 1.5 15.0 1.4 1.5 0.055000 1 200. 100. 0 0. 2. 15 -8 + uv 243 70 1 3.0 0 0 0 1.5 15.0 1.4 1.5 0.055000 1 200. 100. 0 0. 2. 15 -8 + uv 244 0 -1 3.0 0 0 0 2.5 20.0 1.4 2.5 0.005000 0 0. 0. 0 0. 0. 15 -8 + uv 244 3 1 3.0 0 0 0 2.5 20.0 1.4 2.5 0.005000 0 0. 0. 0 0. 0. 15 -8 + uv 244 4 1 3.0 0 0 0 2.5 20.0 1.4 2.5 0.005000 0 0. 0. 0 0. 0. 15 -8 + uv 244 206 1 3.0 0 0 0 2.5 20.0 1.4 2.5 0.005000 0 0. 0. 0 0. 0. 15 -8 + uv 244 207 1 3.0 0 0 0 2.5 20.0 1.4 2.5 0.005000 0 0. 0. 0 0. 0. 15 -8 + uv 244 209 1 3.0 0 0 0 2.5 20.0 1.4 2.5 0.005000 0 0. 0. 0 0. 0. 15 -8 + uv 244 223 1 3.0 0 0 0 2.5 20.0 1.4 2.5 0.005000 0 0. 0. 0 0. 0. 15 -8 + uv 245 0 -1 3.0 0 0 0 1.3 20.0 1.4 1.3 0.005000 0 200. 100. 0 0. 0. 15 -8 + uv 245 257 -1 3.0 0 0 0 1.3 20.0 1.4 1.3 0.005000 0 200. 100. 0 0. 0. 15 -8 + uv 245 259 -1 3.0 0 0 0 1.3 20.0 1.4 1.3 0.005000 0 200. 100. 0 0. 0. 15 -8 + uv 245 270 1 3.0 0 0 0 1.3 20.0 1.4 1.3 0.005000 0 200. 100. 0 0. 0. 15 -8 + uv 245 271 1 3.0 0 0 0 1.3 20.0 1.4 1.3 0.005000 0 200. 100. 0 0. 0. 15 -8 + uv 246 0 -1 3.0 0 0 0 1.3 20.0 1.4 1.3 0.005000 0 200. 100. 0 0. 0. 15 -8 + uv 246 257 -1 3.0 0 0 0 1.3 20.0 1.4 1.3 0.005000 0 200. 100. 0 0. 0. 15 -8 + uv 246 259 -1 3.0 0 0 0 1.3 20.0 1.4 1.3 0.005000 0 200. 100. 0 0. 0. 15 -8 + uv 246 270 1 3.0 0 0 0 1.3 20.0 1.4 1.3 0.005000 0 200. 100. 0 0. 0. 15 -8 + uv 246 271 1 3.0 0 0 0 1.3 20.0 1.4 1.3 0.005000 0 200. 100. 0 0. 0. 15 -8 + uv 247 0 -1 3.0 0 0 0 2.5 20.0 1.4 2.5 0.005000 0 0. 0. 0 0. 0. 15 -8 + uv 247 257 -1 3.0 0 0 0 2.5 20.0 1.4 2.5 0.005000 0 0. 0. 0 0. 0. 15 -8 + uv 247 259 -1 3.0 0 0 0 2.5 20.0 1.4 2.5 0.005000 0 0. 0. 0 0. 0. 15 -8 + uv 247 270 1 3.0 0 0 0 2.5 20.0 1.4 2.5 0.005000 0 0. 0. 0 0. 0. 15 -8 + uv 247 271 1 3.0 0 0 0 2.5 20.0 1.4 2.5 0.005000 0 0. 0. 0 0. 0. 15 -8 + uv 248 0 -1 3.0 0 0 0 2.5 20.0 1.4 2.5 0.000500 0 0. 0. 0 0. 0. 0 0 + uv 249 0 -1 3.0 0 0 0 2.5 20.0 1.4 2.5 0.050500 0 0. 0. 0 0. 0. 0 0 + uv 250 0 -1 3.0 0 0 0 2.5 20.0 1.4 2.5 0.050500 0 0. 0. 0 0. 0. 0 0 + uv 250 171 1 3.0 0 0 0 2.5 20.0 1.4 2.5 0.050500 1 200. 100. 0 0. 2. 15 -8 + uv 250 172 1 3.0 0 0 0 2.5 20.0 1.4 2.5 0.050500 1 200. 100. 0 0. 2. 15 -8 + uv 250 173 1 3.0 0 0 0 2.5 20.0 1.4 2.5 0.050500 1 200. 100. 0 0. 2. 15 -8 + uv 250 174 1 3.0 0 0 0 2.5 20.0 1.4 2.5 0.050500 1 200. 100. 0 0. 2. 15 -8 + uv 251 0 -3 3.0 0 0 0 1.3 20.0 1.4 1.3 0.050500 0 0. 0. 0 0. 0. 0 0 + uv 251 257 -3 3.0 0 0 0 1.3 20.0 1.4 1.3 0.050500 0 0. 0. 0 0. 0. 0 0 + uv 251 259 -3 3.0 0 0 0 1.3 20.0 1.4 1.3 0.050050 0 0. 0. 0 0. 0. 0 0 + uv 251 270 -3 3.0 0 0 0 1.3 20.0 1.4 1.3 0.050050 0 0. 0. 0 0. 0. 0 0 + uv 251 271 -3 3.0 0 0 0 1.3 20.0 1.4 1.3 0.050050 0 0. 0. 0 0. 0. 0 0 + uv 252 0 -1 3.0 0 0 0 2.5 20.0 1.4 2.5 0.050050 0 0. 0. 0 0. 0. 0 0 + uv 252 171 1 3.0 0 0 0 2.5 20.0 1.4 2.5 0.050050 1 200. 100. 0 0. 2. 15 -8 + uv 252 172 1 3.0 0 0 0 2.5 20.0 1.4 2.5 0.050050 1 200. 100. 0 0. 2. 15 -8 + uv 252 173 1 3.0 0 0 0 2.5 20.0 1.4 2.5 0.050050 1 200. 100. 0 0. 2. 15 -8 + uv 252 174 1 3.0 0 0 0 2.5 20.0 1.4 2.5 0.050050 1 200. 100. 0 0. 2. 15 -8 + uv 253 0 -1 3.0 0 0 0 1.5 20.0 1.4 1.5 0.050500 0 200. 100. 0 0. 2. 0 0 + uv 253 54 -1 3.0 0 0 0 1.5 20.0 1.4 1.5 0.050500 1 200. 100. 0 0. 2. 15 -8 + uv 253 55 1 3.0 0 0 0 1.5 20.0 1.4 1.5 0.050500 1 200. 100. 0 0. 2. 15 -8 + uv 253 56 -1 3.0 0 0 0 1.5 20.0 1.4 1.5 0.050500 1 200. 100. 0 0. 2. 15 -8 + uv 253 57 -1 3.0 0 0 0 1.5 20.0 1.4 1.5 0.050500 1 200. 100. 0 0. 2. 15 -8 + uv 253 70 1 3.0 0 0 0 1.5 20.0 1.4 1.5 0.050500 1 200. 100. 0 0. 2. 15 -8 + uv 254 0 -1 3.0 0 0 0 1.5 20.0 1.4 1.5 0.050500 0 0. 0. 0 0. 0. 0 0 + uv 254 54 -1 3.0 0 0 0 1.5 20.0 1.4 1.5 0.050500 1 200. 100. 0 0. 2. 15 -8 + uv 254 55 1 3.0 0 0 0 1.5 20.0 1.4 1.5 0.050500 0 0. 0. 0 0. 2. 15 -8 + uv 254 56 -1 3.0 0 0 0 1.5 20.0 1.4 1.5 0.050500 0 200. 100. 0 0. 2. 15 -8 + uv 254 57 -1 3.0 0 0 0 1.5 20.0 1.4 1.5 0.050500 1 200. 100. 0 0. 2. 15 -8 + uv 254 70 1 3.0 0 0 0 1.5 20.0 1.4 1.5 0.050500 1 200. 100. 0 0. 2. 15 -8 + uv 255 0 -3 3.0 0 0 0 2.5 20.1 1.4 2.5 0.000500 0 0. 0. 0 0. 0. 0 0 + uv 255 854 -3 3.0 0 0 0 2.5 20.1 1.4 2.5 0.000500 0 0. 0. 0 0. 0. 15 -9 + uv 256 0 -1 3.0 0 0 0 2.5 20.1 1.4 2.5 0.000500 0 0. 0. 0 0. 0. 0 0 + uv 257 0 -1 3.0 0 0 0 2.5 20.1 1.4 2.5 0.005500 0 0. 0. 0 0. 0. 0 0 + uv 257 783 1 3.0 0 0 0 2.5 20.1 1.4 2.5 0.005500 0 0. 0. 0 0. 0. 15 -9 + uv 257 784 1 3.0 0 0 0 2.5 20.1 1.4 2.5 0.005500 0 0. 0. 0 0. 0. 15 -9 + uv 258 0 -1 3.0 0 0 0 2.5 20.1 1.4 2.5 0.005500 0 0. 0. 0 0. 0. 0 0 + uv 258 783 1 3.0 0 0 0 2.5 20.1 1.4 2.5 0.005500 0 0. 0. 0 0. 0. 15 -9 + uv 258 784 1 3.0 0 0 0 2.5 20.1 1.4 2.5 0.005500 0 0. 0. 0 0. 0. 15 -9 + uv 259 0 -1 3.0 0 0 0 2.5 20.1 1.4 2.5 0.005500 0 0. 0. 0 0. 0. 0 0 + uv 259 783 1 3.0 0 0 0 2.5 20.1 1.4 2.5 0.005500 0 0. 0. 0 0. 0. 15 -9 + uv 259 784 1 3.0 0 0 0 2.5 20.1 1.4 2.5 0.005500 0 0. 0. 0 0. 0. 15 -9 + uv 260 0 -1 3.0 0 0 0 2.5 20.1 1.4 2.5 0.000500 0 0. 0. 0 0. 0. 0 0 + uv 260 224 1 3.0 0 0 0 2.5 20.1 1.4 2.5 0.000500 0 0. 0. 0 0. 0. 15 -9 + uv 260 225 1 3.0 0 0 0 2.5 20.1 1.4 2.5 0.000500 0 0. 0. 0 0. 0. 15 -9 + uv 270 0 -1 3.0 0 0 0 2.5 20.1 1.4 2.5 0.000500 0 0. 0. 0 0. 0. 0 0 + uv 280 0 1 3.0 0 0 0 6.0 6.1 1.4 6.0 0.005500 0 0. 0. 0 0. 0. 11 -9 + uv 280 01 1 3.0 0 0 0 6.0 6.1 1.4 6.0 0.005500 0 0. 0. 0 0. 0. 11 -9 + uv 281 0 -1 3.0 0 0 0 6.0 6.1 1.4 6.0 0.005500 0 0. 0. 0 0. 0. 0 0 + uv 282 0 1 3.0 0 0 0 6.0 6.1 1.4 6.0 0.005500 0 0. 0. 0 0. 0. 0 0 + uv 284 0 -1 3.0 0 0 0 6.0 6.1 1.4 6.0 0.005500 0 0. 0. 0 0. 0. 0 0 + uv 285 0 -1 3.0 0 0 0 5.0 6.1 1.4 5.0 0.005500 0 0. 0. 0 0. 0. 0 0 + uv 286 0 -1 3.0 0 0 0 6.0 6.1 1.4 6.0 0.005500 0 0. 0. 0 0. 0. 0 0 + uv 287 0 -1 3.0 0 0 0 6.0 6.1 1.4 6.0 0.000500 0 0. 0. 0 0. 0. 0 0 + uv 289 0 1 3.0 0 0 0 5.0 6.1 1.4 5.0 0.000500 0 0. 0. 0 0. 0. 14 -9 + uv 290 4 1 3.0 0 0 0 5.0 6.1 1.4 5.0 0.000500 0 0. 0. 0 0. 0. 0 0 + uv 290 3 1 3.0 0 0 0 5.0 6.1 1.4 5.0 0.000500 0 0. 0. 0 0. 0. 0 0 + uv 290 5 -1 3.0 0 0 0 5.0 6.1 1.4 5.0 0.000500 1 100. 1200. 0 0. 0. 0 0 + uv 291 0 -1 3.0 0 0 0 5.0 6.1 1.4 5.0 0.000500 1 100. 1200. 0 0. 0. 0 0 + uv 296 0 -1 3.0 0 0 0 5.0 6.1 1.4 5.0 0.000500 0 100. 1200. 0 0. 0. 0 0 + spd 283 0 -1 3.0 0 0 0 8.0 6.1 1.4 8.0 0.000000 0 0. 0. 0 0. 0. 0 0 + dw 999 0 -1 3.0 0 0 0 8.0 10.0 2.0 8.0 0.000000 0 0. 0. 0 0. 0. 0 0 + dw 201 0 -1 3.0 0 0 0 8.0 10.0 2.0 8.0 0.000001 0 0. 0. 0 0. 0. 0 0 + dw 202 0 -1 3.0 0 0 0 8.0 10.0 2.0 8.0 0.000001 0 0. 0. 0 0. 0. 0 0 + dw 100 0 -1 3.0 0 0 0 4.0 5.0 2.0 8.0 0.000001 0 0. 0. 0 0. 0. 0 0 + dw 101 0 -1 3.0 0 0 0 4.0 5.0 2.0 8.0 0.000001 0 0. 0. 0 0. 0. 0 0 + srw 999 0 -1 2.5 0 0 0 10.0 10.0 1.0 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + rw 999 0 -1 2.5 0 0 0 10.0 10.0 2.0 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + gps 004 0 1 3.0 0 0 0 0.024 0.024 0.01 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + gps 041 0 -1 3.0 0 0 0 0.024 0.024 0.01 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + gps 722 0 1 3.0 0 0 0 0.024 0.024 0.01 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + gps 723 0 1 3.0 0 0 0 0.024 0.024 0.01 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + gps 740 0 1 3.0 0 0 0 0.024 0.024 0.01 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + gps 741 0 1 3.0 0 0 0 0.024 0.024 0.01 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + gps 742 0 1 3.0 0 0 0 0.024 0.024 0.01 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + gps 743 0 1 3.0 0 0 0 0.024 0.024 0.01 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + gps 744 0 1 3.0 0 0 0 0.024 0.024 0.01 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + gps 745 0 1 3.0 0 0 0 0.024 0.024 0.01 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + gps 820 0 1 3.0 0 0 0 0.024 0.024 0.01 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + gps 042 0 1 3.0 0 0 0 0.024 0.024 0.01 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + gps 043 0 1 3.0 0 0 0 0.024 0.024 0.01 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + gps 786 0 1 3.0 0 0 0 0.024 0.024 0.01 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + gps 421 0 -1 3.0 0 0 0 0.024 0.024 0.01 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + gps 003 0 1 3.0 0 0 0 0.024 0.024 0.01 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + gps 821 0 -1 3.0 0 0 0 0.024 0.024 0.01 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + gps 825 0 1 3.0 0 0 0 0.024 0.024 0.01 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + gps 440 0 -1 3.0 0 0 0 0.024 0.024 0.01 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + pm2_5 102 0 -1 1.0 0 0 0 100.0 1.5 0.75 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + pm10 102 0 -1 1.0 0 0 0 150.0 1.5 0.75 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + gps 750 0 1 3.0 0 0 0 0.024 0.024 0.01 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + gps 751 0 1 3.0 0 0 0 0.024 0.024 0.01 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + gps 752 0 1 3.0 0 0 0 0.024 0.024 0.01 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + gps 753 0 1 3.0 0 0 0 0.024 0.024 0.01 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + gps 754 0 1 3.0 0 0 0 0.024 0.024 0.01 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + gps 755 0 1 3.0 0 0 0 0.024 0.024 0.01 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + gps 724 0 -1 3.0 0 0 0 0.024 0.024 0.01 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + gps 725 0 -1 3.0 0 0 0 0.024 0.024 0.01 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + gps 726 0 -1 3.0 0 0 0 0.024 0.024 0.01 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + gps 727 0 -1 3.0 0 0 0 0.024 0.024 0.01 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + gps 728 0 -1 3.0 0 0 0 0.024 0.024 0.01 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + gps 729 0 -1 3.0 0 0 0 0.024 0.024 0.01 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + gps 044 0 -1 3.0 0 0 0 0.024 0.024 0.01 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + gps 005 0 1 3.0 0 0 0 0.024 0.024 0.01 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + gps 265 0 -1 3.0 0 0 0 0.024 0.024 0.01 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + gps 266 0 -1 3.0 0 0 0 0.024 0.024 0.01 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + gps 267 0 -1 3.0 0 0 0 0.024 0.024 0.01 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + gps 268 0 -1 3.0 0 0 0 0.024 0.024 0.01 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 + gps 269 0 -1 3.0 0 0 0 0.024 0.024 0.01 10.0 0.000000 0 0. 0. 0 0. 0. 0 0 diff --git a/util/Conventional_Monitor/nwprod/gdas_conmon/jobs/JGDAS_ATMOS_CONMON b/util/Conventional_Monitor/nwprod/gdas_conmon/jobs/JGDAS_ATMOS_CONMON new file mode 100755 index 0000000000..ba20649e82 --- /dev/null +++ b/util/Conventional_Monitor/nwprod/gdas_conmon/jobs/JGDAS_ATMOS_CONMON @@ -0,0 +1,112 @@ +#!/bin/sh +# +############################################################# +# Set up environment for GDAS Conventional Monitor job +######################################## +set -xa +# +# Specify whether the run is production or development +# +export RUN_ENVIR=${RUN_ENVIR:-prod} +export envir=${envir:-prod} + + +echo `date` $0 `date -u` begin +export PS4='$SECONDS + ' + +########################################################### +# set up working directory space +########################################################### +export CONMON_WORK_DIR=${CONMON_WORK_DIR:-/tmpnwprd} +export C_DATAROOT=${C_DATAROOT:-${CONMON_WORK_DIR}} +export C_DATA=${C_DATA:-${C_DATAROOT}/${jobid}} +mkdir -p $C_DATA +cd $C_DATA + + +#################################### +# Determine Job Output Name on System +#################################### +export outid="LL$job" +export cycle=t${CYC}z + +############################### +# Specify NET and RUN name +############################## +export NET=${NET:-gfs} +export RUN=${RUN:-gdas} +export component=${component:-atmos} + +################################################## +# SENDCOM - Copy Files From TMPDIR to $COMOUT +# SENDDBN - Issue DBNet Client Calls +################################################## +export SENDCOM=${SENDCOM:-YES} +export SENDDBN=${SENDDBN:-NO} +export VERBOSE=${VERBOSE:-YES} + +export HOMEgfs_conmon=${HOMEgfs_conmon:-${NWROOT}/gfs.${gfs_ver}} + +export FIXgdas=${FIXgdas:-${HOMEgfs_conmon}/fix} +export PARMmon=${PARMmon:-${HOMEgfs_conmon}/parm/mon} + +export HOMEconmon=${HOMEconmon:-${HOMEgfs_conmon}} +export EXECconmon=${EXECconmon:-${HOMEconmon}/exec} + +export FIXconmon=${FIXconmon:-${FIXgfs}} +export USHconmon=${USHconmon:-${HOMEconmon}/ush} + +export LITTLE_ENDIAN=${LITTLE_ENDIAN:-0} +export COMPRESS=${COMPRESS:-gzip} +export UNCOMPRESS=${UNCOMPRESS:-gunzip} +export Z=${Z:-gz} + +export CLEAN_TANKDIR=${CLEAN_TANKDIR:-0} + +################################### +# Set up the UTILITIES +################################### +export NWPROD=${NWPROD:-/nwprod} + +export utilscript=${utilscript:-$UTILROOT/ush} +export utilexec=${utilexec:-$UTILROOT/exec} +export NDATE=${NDATE:-$utilexec/ndate} + + +############################################################## +# COMIN - WHERE GSI OUTPUT (which is input data) RESIDES +# TANKDIR_cmon - WHERE OUTPUT DATA WILL RESIDE +############################################################## +export C_TANKDIR=${C_TANKDIR:-/com/verf/${envir}} +export C_COM_IN=${C_COM_IN:-${COMROOTp3}/${NET}/${envir}} +export C_COMIN=${C_COMIN:-$C_COM_IN/${RUN}.${PDY}} +export CONMON_SUFFIX=${CONMON_SUFFIX:-gdas} + +m6h_date=`$NDATE -06 $PDATE` +export CYC_m6h=`echo $m6h_date|cut -c9-10` +export PDY_m6h=`echo $m6h_date|cut -c1-8` + +export C_COMIN_m6h=${C_COMIN_m6h:-$C_COM_IN/${RUN}.${PDY_m6h}} + +env + +export CONMON_AREA=${CONMON_AREA:-glb} + + +######################################################## +# Execute the script. +${CONMONSH:-$HOMEgdas_conmon/scripts/exgdas_atmos_conmon.sh} ${PDY} ${CYC} +######################################################## + + +################################ +# Remove the Working Directory +################################ +KEEPDATA=${KEEPDATA:-YES} +cd $C_DATAROOT +if [ ${KEEPDATA} = NO ] ; then + rm -rf $C_DATA +fi + +date + diff --git a/util/Conventional_Monitor/nwprod/gdas_conmon/scripts/exgdas_atmos_conmon.sh b/util/Conventional_Monitor/nwprod/gdas_conmon/scripts/exgdas_atmos_conmon.sh new file mode 100755 index 0000000000..a4cd23fe74 --- /dev/null +++ b/util/Conventional_Monitor/nwprod/gdas_conmon/scripts/exgdas_atmos_conmon.sh @@ -0,0 +1,265 @@ +#/bin/sh +################################################################################ +#### UNIX Script Documentation Block +# . . +# Script name: exgdas_atmo_conmon.sh +# Script description: Runs data extract/validation for global conventional diag data +# +# Author: Ed Safford Org: NP23 Date: 2015-09 +# +# Abstract: This script runs the data extract/validation portion of the +# ConMon package. +# +# Input script positional parameters: +# 1 Current analysis date in yyyymmddhh format +# defaults to PDY; required +# 2 cycle time in cc format +# defaults to CYC; required +# +# +# Condition codes +# 0 - no problem encountered +# >0 - some problem encountered +# +################################################################################ + + export VERBOSE=${VERBOSE:-"NO"} + if [[ "$VERBOSE" = "YES" ]] + then + echo start exgdas_vrfyconv.sh.sms + set -x + fi + + export RUN_ENVIR=${RUN_ENVIR:-nco} + export NET=${NET:-gfs} + export RUN=${RUN:-gdas} + export envir=${envir:-prod} + export component=${component:-atmos} + + # Command line arguments + export PDY=${1:-${PDY:?}} + export CYC=${2:-${CYC:?}} + + # Directories + export C_DATA=${C_DATA:-$(pwd)/workdir} # work directory + export C_COM_IN=${C_COM_IN:-/${COMROOT}/${NET}/${envir}} + export C_COMIN=${C_COMIN:-$C_COM_IN/${RUN}.${PDY}} + + export TANKDIR_conmon=${C_TANKDIR}/gdas.${PDY}/${CYC}/conmon + + export GDATE=`$NDATE -06 $PDY$CYC` + export PDYm6h=`echo $GDATE|cut -c1-8` + export GCYC=`echo $GDATE|cut -c9-10` + export C_COMINm6h=${C_COMINm6h:-${C_COM_IN}/${RUN}.${PDYm6h}} + export TANKDIR_prev_conmon=${C_TANKDIR}/gdas.${PDYm6h}/${GCYC}/conmon + + # Filenames + cnvstat=${cnvstat:-${C_COMIN}/${CYC}/${component}/gdas.t${CYC}z.cnvstat} + if [[ ! -e ${cnvstat} ]]; then + cnvstat=${C_COMIN}/gdas.t${CYC}z.cnvstat} + fi + export cnvstat=${cnvstat} + + #---------------- + # analysis file: + # + pgrbf00=${pgrbf00:-${C_COMIN}/${CYC}/${component}/gdas.t${CYC}z.pgrb2.0p25.f000} + if [[ ! -e ${pgrbf00} ]]; then + pgrbf00=${C_COMIN}/gdas.t${CYC}z.pgrb2b.1p00.anl} + fi + export pgrbf00=${pgrbf00} + + #-------------- + # guess file: + # + pgrbf06=${pgrbf06:-${C_COMINm6h}/${GCYC}/${component}/gdas.t${GCYC}z.pgrb2.0p25.f006} + if [[ ! -e ${pgrbf06} ]]; then + pgrbf06=${C_COMINm6h}/gdas.t${GCYC}z.pgrb2b.1p00.anl} + fi + export pgrbf06=${pgrbf06} + + export convinfo=${convinfo:-${FIXgdas}/global_convinfo.txt} + export conmon_base=${conmon_base:-${HOMEgdas_conmon}/fix/gdas_conmon_base.txt} + + echo "cnvstat = $cnvstat" + echo "pgrbf00 = $pgrbf00" + echo "pgrbf06 = $pgrbf06" + + + # Other variables + export NCP=${NCP:-/bin/cp -f} + export NDATE=${NDATE:-/nwprod/util/exec/ndate} + export PDATE=${PDY}${CYC} + + ##################################################################### + # Preprocessing + $INISCRIPT + + if [[ ! -d ${C_DATA} ]]; then + mkdir $C_DATA + fi + cd $C_DATA + export workdir=$C_DATA + + #-------------------------------------------------------- + # Ensure necessary TANKDIR directories are in place + #-------------------------------------------------------- + if [[ ! -d ${TANKDIR_conmon} ]]; then + mkdir -p ${TANKDIR_conmon} + fi + if [[ ! -d ${TANKDIR_prev_conmon} ]]; then + mkdir -p ${TANKDIR_prev_conmon} + fi + + if [[ ! -d ${C_TANKDIR_conmon}/horz_hist ]]; then + mkdir -p ${TANKDIR_conmon}/horz_hist + mkdir -p ${TANKDIR_conmon}/horz_hist/anl + mkdir -p ${TANKDIR_conmon}/horz_hist/ges + fi + + if [[ ! -d ${TANKDIR_prev_conmon}/horz_hist ]]; then + mkdir -p ${TANKDIR_prev_conmon}/horz_hist + mkdir -p ${TANKDIR_prev_conmon}/horz_hist/anl + mkdir -p ${TANKDIR_prev_conmon}/horz_hist/ges + fi + + if [[ ! -d ${TANKDIR_conmon}/time_vert ]]; then + mkdir -p ${TANKDIR_conmon}/time_vert + fi + if [[ ! -d ${TANKDIR_prev_conmon}/time_vert ]]; then + mkdir -p ${TANKDIR_prev_conmon}/time_vert + fi + + + if [[ "$VERBOSE" = "YES" ]]; then + if [[ -s ${cnvstat} ]]; then + echo "$cnvstat is available" + fi + if [[ -s ${pgrbf00} ]]; then + echo "$pgrbf00 is available" + fi + if [[ -s ${pgrbf06} ]]; then + echo "$pgrbf06 is available" + fi + fi + ##################################################################### + + data_available=0 + if [[ -s ${cnvstat} && -s ${pgrbf00} && -s ${pgrbf06} ]]; then + data_available=1 + + #------------------------------------------------------------------ + # Copy data files file to local data directory. + # Untar cnvstat file. + #------------------------------------------------------------------ + + export grib2=${grib2:-1} + $NCP $cnvstat ./cnvstat.$PDATE + $NCP $pgrbf00 ./pgbanl.$PDATE + $NCP $pgrbf06 ./pgbf06.$GDATE + + tar -xvf ./cnvstat.$PDATE + #rm cnvstat.$PDATE + + netcdf=0 + count=`ls diag* | grep ".nc4" | wc -l` + if [ $count -gt 0 ] ; then + netcdf=1 + for filenc4 in `ls diag*nc4.gz`; do + file=`echo $filenc4 | cut -d'.' -f1-2`.gz + mv $filenc4 $file + done + fi + + export CONMON_NETCDF=${netcdf} + $UNCOMPRESS ./*.${Z} + + + #------------------------------------------------------------------ + # NOTE: The anal (f00) and guess (f06) grib files + # contain more information than we need for the subsequent + # image generation. Use wgrib and awk to reduce the file + # size. The resulting files contain only RH, PRES, TMP, + # and UV data. + # + # NOTE: The f06 file is taken from the GDATE cycle (the previous + # cycle but is stored in TANKDIR in the + # $NET.$PDATE/$cyc/conmon/horz_hist/ges subdirectory. + # + # NOTE: In order to use the anal and guess files in GrADS we + # need an index (.idx) and control (.ctl) file. These can + # be created in the plot process and don't need to be + # stored. + #------------------------------------------------------------------ + echo "grib2 = $grib2" + if [[ $grib2 -eq 0 ]]; then + + ${WGRIB} -s pgbanl.${PDATE} | awk '(/:RH:/ && /mb:/) || (/:RH:/ && /:2 m/) || (/:PRES:sfc/) || (/:UGRD:/ && /mb:/) || (/:VGRD:/ && /mb:/) || (/:TMP:/ && /mb:/)' | ${WGRIB} -i -grib pgbanl.${PDATE} -o ./pared_anal.${PDATE} + + + ${WGRIB} -s pgbf06.${GDATE} | awk '(/:RH:/ && /mb:/) || (/:RH:/ && /:2 m/) || (/:PRES:sfc/) || (/:UGRD:/ && /mb:/) || (/:VGRD:/ && /mb:/) || (/:TMP:/ && /mb:/)' | ${WGRIB} -i -grib pgbf06.${GDATE} -o ./pared_guess.${PDATE} + + else + + ${WGRIB2} pgbanl.${PDATE} | awk '(/:RH:/ && /mb:/) || (/:RH:/ && /:2 m a/) || (/:PRES:surface:/) || (/:UGRD:/ && /mb:/) || (/:UGRD:/ && /:10 m a/) || (/:VGRD:/ && /mb:/) || (/:VGRD:/ && /:10 m a/) || (/:TMP:/ && /mb:/) || (/:TMP:/ && /:surface:/)' | ${WGRIB2} pgbanl.${PDATE} -i -grib ./pared_anal.${PDATE} + + ${WGRIB2} pgbf06.${GDATE} | awk '(/:RH:/ && /mb:/) || (/:RH:/ && /:2 m a/) || (/:PRES:surface:/) || (/:UGRD:/ && /mb:/) || (/:UGRD:/ && /:10 m a/) || (/:VGRD:/ && /mb:/) || (/:VGRD:/ && /:10 m a/) || (/:TMP:/ && /mb:/) || (/:TMP:/ && /:surface:/)' | ${WGRIB2} pgbf06.${GDATE} -i -grib ./pared_guess.${PDATE} + + fi + + ${NCP} ./pared_anal.${PDATE} ${TANKDIR_conmon}/horz_hist/anl/anal.${PDATE} + ${NCP} ./pared_guess.${PDATE} ${TANKDIR_conmon}/horz_hist/ges/guess.${PDATE} + + + #------------------------------------------------------------------ + # Run the child sccripts. + # --> get unique rc values for each child, use in error reporting below + #------------------------------------------------------------------ + + #--------------------------------------- + # run the horz-hist extraction script + # + ${USHconmon}/horz_hist.sh + rc_horz_hist=$? + echo "rc_horz_hist = $rc_horz_hist" + + #--------------------------------------- + # run the time-vert extraction script + # + ${USHconmon}/time_vert.sh + rc_time_vert=$? + echo "rc_time_vert = $rc_time_vert" + + #-------------------------------------- + # optionally run clean_tankdir script + # + if [[ ${CLEAN_TANKDIR} -eq 1 ]]; then + ${USHconmon}/clean_tankdir.sh + rc_clean_tankdir=$? + echo "rc_clean_tankdir = $rc_clean_tankdir" + fi + fi + + ##################################################################### + # Postprocessing + # + err=0 + if [[ ${data_available} -ne 1 ]]; then + err=1 + elif [[ $rc_horz_hist -ne 0 ]]; then + echo "ERROR repored from horz_hist.sh: $rc_horz_hist" + err=$rc_horz_hist + elif [[ $rc_time_vert -ne 0 ]]; then + echo "ERROR repored from time_vert.sh: $rc_time_vert" + err=$rc_time_vert + fi + + if [[ "$VERBOSE" = "YES" ]]; then + echo "end exgdas_conmon.sh.sms, exit value = ${err}" + fi + + + set +x + +exit ${err} + diff --git a/util/Conventional_Monitor/parm/ConMon.ver b/util/Conventional_Monitor/parm/ConMon.ver deleted file mode 100644 index a62136cd58..0000000000 --- a/util/Conventional_Monitor/parm/ConMon.ver +++ /dev/null @@ -1,2 +0,0 @@ -export gdas_cmon_ver=1.0.0 -export cmon_shared_ver=1.0.0 diff --git a/util/Conventional_Monitor/parm/ConMon_config b/util/Conventional_Monitor/parm/ConMon_config index f65289e9a7..f531967a08 100644 --- a/util/Conventional_Monitor/parm/ConMon_config +++ b/util/Conventional_Monitor/parm/ConMon_config @@ -1,127 +1,175 @@ -# +#------------------------------------------------------- # Conventional Monitor package configuration file # +#------------------------------------------------------- + +if [[ $CONMON_CONFIG -ne 1 ]]; then + + echo "begin ConMon_config" + + export CONMON_CONFIG=1 + + export MY_MACHINE=wcoss_d + + + #----------------------------------------------------- + # DO_DATA_RPT controls the generation of automated + # warning messages to detect and report potential + # low counts by data type_subtype. + # + # MAIL_TO and MAIL_CC specifies the default + # distribution for warning messages. + # + export DO_DATA_RPT=${DO_DATA_RPT:-1} + + export MAIL_TO=${MAIL_TO:-"edward.safford@noaa.gov"} + export MAIL_CC=${MAIL_CC:=""} + + #----------------------------------------------------- + # The grib2 flag indicates if the data files are in + # grib2 format (1) or grib (0) + # + export grib2=${grib2:-1} + + #--------------------------------------------------------------------- + # MY_CONMON should point to your working directory which contains the + # top level directory to the ConMon package. + # + export MY_CONMON=${MY_CONMON:-/gpfs/dell2/emc/modeling/noscrub/Edward.Safford/GSI/util/Conventional_Monitor} + + #--------------------------------------------------------------------------- + # The CONMON_TANKDIR will be the location for the extracted data files and + # the control files used for image plotting. This is the base definition + # and the succedding scripts will construct and use subdirectories under + # this location. + # + + export MY_TANKDIR=${MY_TANKDIR:-/u/Edward.Safford/nbns} + export CONMON_TANKDIR=$MY_TANKDIR + export C_TANKverf=${C_TANKverf:-${CONMON_TANKDIR}} + + export C_TANKDIR=${CONMON_TANKDIR}/stats/${CONMON_SUFFIX} + export C_IMGNDIR=${CONMON_TANKDIR}/imgn/${CONMON_SUFFIX}/${RUN}/conmon + + + if [[ $MY_MACHINE = "wcoss_c" ]]; then + module load prod_util # defines $NDATE among other things + module load prod_envir + module load grib_util/1.0.5 # note 1.1.0 and 1.1.1 report runtime errors + module load util_shared + + export SUB="bsub" + export COMPRESS=gzip + export UNCOMPRESS="gunzip -f" + export PROJECT=${PROJECT:-GDAS-DEV} + export JOB_QUEUE=${JOB_QUEUE:-dev_shared} + + elif [[ $MY_MACHINE = "wcoss_d" ]]; then + shell=sh + source /usrx/local/prod/lmod/lmod/init/${shell} + + MODULEPATH=/usrx/local/prod/lmod/lmod/modulefiles/Core + MODULEPATH=${MODULEPATH}:/usrx/local/prod/modulefiles/core_third + MODULEPATH=${MODULEPATH}:/usrx/local/prod/modulefiles/defs + MODULEPATH=${MODULEPATH}:/gpfs/dell1/nco/ops/nwprod/modulefiles/core_prod + export MODULEPATH=${MODULEPATH}:/usrx/local/dev/modulefiles + + module load ips/18.0.1.163 + module load metplus/2.1 + module load lsf/10.1 + module load prod_util/1.1.2 + module load GrADS/2.2.0 + module load grib_util/1.1.1 + module load prod_envir/1.0.3 + +# module prod_envir won't load at the moment. Maybe +# that's file system problems, maybe it's worse. +# Either way I need COMROOTp3 defined, so I'll do it +# manually for the moment. +# module load prod_envir/1.0.3 + export COMROOTp3="/gpfs/dell1/nco/ops/com" + + export GRADS=`which grads` + export SUB="bsub" + export COMPRESS=/usr/bin/gzip + export UNCOMPRESS="/usr/bin/gunzip -f" + export PROJECT=${PROJECT:-GFS-DEV} + export JOB_QUEUE=${JOB_QUEUE:-dev_shared} + + elif [[ $MY_MACHINE = "hera" ]]; then + module use -a /apps/modules/modulefamilies/intel + module load wgrib2/2.0.8 + module load grads/2.2.1 -echo "begin CMon_config" - -export MY_MACHINE=theia - -# -# MY_CMON should point to your working directory which contains the -# top level directory to the CMon package. If you checked out the package -# as part of the GSI point to the GSI's util/Conventional_Monitor directory. -# if you checked out only the Radiance_Monitor portion of the branch then -# MY_CMON should point to that. -# + export WGRIB2=`which wgrib2` + + export GRADS=`which grads` + export STNMAP=`which stnmap` #/apps/grads/2.0.2/bin/stnmap -export MY_CMON=/scratch4/NCEPDEV/da/noscrub/Edward.Safford/ProdGSI/util/Conventional_Monitor + export SUB=/apps/slurm/default/bin/sbatch + export NDATE=/home/Edward.Safford/bin/ndate + export COMPRESS=${COMPRESS:-gzip} + export UNCOMPRESS=${UNCOMPRESS:-"gunzip -f"} + fi -# -# The CMON_TANKDIR will be the location for the extracted data files and -# the control files used for image plotting. This is the base definition -# and the succedding scripts will construct and use subdirectories under -# this location. -# - -export CMON_TANKDIR=/scratch4/NCEPDEV/da/save/Edward.Safford/nbns -export C_TANKverf=${C_TANKverf:-${CMON_TANKDIR}} - -export C_TANKDIR=${CMON_TANKDIR}/stats/${CMON_SUFFIX} -export C_IMGNDIR=${CMON_TANKDIR}/imgn/${CMON_SUFFIX} - - -if [[ $MY_MACHINE = "wcoss" ]]; then - shell=sh - . /usrx/local/Modules/default/init/${shell} - module load lsf - module unload GrADS # version 2.0.1 is loaded automatically, but it's out of - module load GrADS # date -- curent default is 2.0.2 - module load grib_util - module load prod_util - module load util_shared - - export GRADS=grads - - export UTILS_BIN= - export LLQ= - export SUB="bsub" - export NCP=/bin/cp - export NWPROD=/nwprod - export FIXDIR=/nwprod/fix - export COMPRESS=gzip - export UNCOMPRESS="gunzip -f" export Z="gz" - export TIMEX= - export PROJECT=${PROJECT:-GDAS-T2O} - export JOB_QUEUE=${JOB_QUEUE:-dev_shared} - -elif [[ $MY_MACHINE = "cray" ]]; then - module load prod_util # defines $NDATE among other things - module load prod_envir - module load grib_util - module load util_shared - - export SUB="bsub" - export NWPROD=${COMROOTp1} - export COMPRESS=gzip - export UNCOMPRESS="gunzip -f" - export PROJECT=${PROJECT:-GDAS-T2O} - export JOB_QUEUE=${JOB_QUEUE:-dev_shared} - export Z="gz" - -elif [[ $MY_MACHINE = "theia" ]]; then - export SUB=sbatch - export NWPROD=/scratch4/NCEPDEV/da/save/Michael.Lueken/nwprod - export COMPRESS=gzip - export UNCOMPRESS="gunzip -f" - export Z="gz" -fi - -export NDATE=${NWPROD}/util/exec/ndate -export ACCOUNT=${ACCOUNT:-fv3-cpu} + export ACCOUNT=${ACCOUNT:-} -export C_STMP=${C_STMP:-/scratch4/NCEPDEV/stmp3} -export C_STMP_USER=${C_STMP_USER:-${C_STMP}/${LOGNAME}} -export C_PTMP=${C_PTMP:-/scratch4/NCEPDEV/stmp4} -export C_PTMP_USER=${C_PTMP_USER:-${C_PTMP}/${LOGNAME}} - -export C_LOGDIR=${C_PTMP_USER}/logs/${CMON_SUFFIX}/ConMon -export LOGSverf_cmon=${LOGSverf_cmon:-${C_LOGDIR}} -export WORKverf_cmon=${WORKverf_cmon:-${C_STMP_USER}} - -export CONVINFO_FILE=${FIXDIR}/global_convinfo.txt # does this belong in this config file? IMG/parm? - - -# -# Web server resources include the sever name (WEB_SVR), the user name -# on the web server (WEB_USER), and location of the top level directory -# for the html on the web server (WEBDIR). -# -export WEBDIR=/home/people/emc/www/htdocs/gmb/gdas -export WEBUSER=esafford -export WEBSVR=emcrzdm - - -# -# Definitions for internal reference -# -export CMON_DATA_EXTRACT=${CMON_DATA_EXTRACT:-${MY_CMON}/data_extract} -export C_DE_EXEC=${C_DE_EXEC:-${CMON_DATA_EXTRACT}/exec} -export C_DE_PARM=${C_DE_PARM:-${CMON_DATA_EXTRACT}/parm} -export C_DE_SCRIPTS=${C_DE_SCRIPTS:-${CMON_DATA_EXTRACT}/ush} - -export CMON_IMAGE_GEN=${CMON_IMAGE_GEN:-${MY_CMON}/image_gen} -export C_IG_EXEC=${C_IG_EXEC:-${CMON_IMAGE_GEN}/exec} -export C_IG_GSCRIPTS=${C_IG_GSCRIPTS:-${CMON_IMAGE_GEN}/gscripts} -export C_IG_PARM=${C_IG_PARM:-${CMON_IMAGE_GEN}/parm} -export C_IG_SCRIPTS=${C_IG_SCRIPTS:-${CMON_IMAGE_GEN}/ush} -export C_IG_FIX=${C_IG_FIX:-${CMON_IMAGE_GEN}/fix} -export C_IG_HTML=${C_IG_HTML:-${CMON_IMAGE_GEN}/html} - -export CMON_PARM=${CMON_PARM:-${MY_CMON}/parm} -. $CMON_PARM/ConMon.ver - -export HOMEgdascmon=${HOMEgdascmon:-${MY_CMON}/nwprod/gdas_cmon.v${gdas_cmon_ver}} -export HOMEcmon=${HOMEcmon:-${MY_CMON}/nwprod/cmon_shared.v${cmon_shared_ver}} - + export C_STMP=${C_STMP:-/gpfs/dell2/stmp} + export C_STMP_USER=${C_STMP_USER:-${C_STMP}/${LOGNAME}} + export C_PTMP=${C_PTMP:-/gpfs/dell2/ptmp} + export C_PTMP_USER=${C_PTMP_USER:-${C_PTMP}/${LOGNAME}} + + export C_LOGDIR=${C_PTMP_USER}/logs/${CONMON_SUFFIX}/${RUN}/conmon + export WORK_conmon=${WORK_conmon:-${C_STMP_USER}/${CONMON_SUFFIX}/${RUN}/ConMon} + + # + # Automatically remove old, extracted data files + # + export CLEAN_TANKDIR=${CLEAN_TANKDIR:-1} + + # + # Number of cycles worth of image data to be retained in tankdir + # + export NUM_IMG_CYCLES=${NUM_IMG_CYCLES:-20} + + # + # Web server resources include the sever name (WEB_SVR), the user name + # on the web server (WEB_USER), and location of the top level directory + # for the html on the web server (WEBDIR). + # + export WEBDIR=/home/people/emc/www/htdocs/gmb/gdas/es_conv + export WEBUSER=esafford + export WEBSVR=emcrzdm + + + # + # Definitions for internal reference + # + export CONMON_DATA_EXTRACT=${CONMON_DATA_EXTRACT:-${MY_CONMON}/data_extract} + export C_DE_EXEC=${C_DE_EXEC:-${CONMON_DATA_EXTRACT}/exec} + export C_DE_PARM=${C_DE_PARM:-${CONMON_DATA_EXTRACT}/parm} + export C_DE_SCRIPTS=${C_DE_SCRIPTS:-${CONMON_DATA_EXTRACT}/ush} + + export CONMON_IMAGE_GEN=${CONMON_IMAGE_GEN:-${MY_CONMON}/image_gen} + export C_IG_EXEC=${C_IG_EXEC:-${CONMON_IMAGE_GEN}/exec} + export C_IG_GSCRIPTS=${C_IG_GSCRIPTS:-${CONMON_IMAGE_GEN}/gscripts} + export C_IG_PARM=${C_IG_PARM:-${CONMON_IMAGE_GEN}/parm} + export C_IG_SCRIPTS=${C_IG_SCRIPTS:-${CONMON_IMAGE_GEN}/ush} + export C_IG_FIX=${C_IG_FIX:-${CONMON_IMAGE_GEN}/fix} + export C_IG_HTML=${C_IG_HTML:-${CONMON_IMAGE_GEN}/html} + export C_IG_SAVE_WORK=${C_IG_SAVE_WORK:-1} # switch to save plot work directories + + export CONMON_PARM=${CONMON_PARM:-${MY_CONMON}/parm} + + export HOMEconmon_shared=${HOMEconmon_shared:-${MY_CONMON}/nwprod/conmon_shared} + export HOMEgdas_conmon=${HOMEgdas_conmon:-${MY_CONMON}/nwprod/gdas_conmon} + export HOMEgfs_conmon=$HOMEgdas_conmon + + export USHconmon=${USHconmon:-${HOMEconmon_shared}/ush} + export EXECconmon=${EXECconmon:-${HOMEconmon_shared}/exec} + +else + echo "ConMon_config is already loaded" +fi diff --git a/util/Conventional_Monitor/parm/ConMon_user_settings b/util/Conventional_Monitor/parm/ConMon_user_settings deleted file mode 100644 index d42a467239..0000000000 --- a/util/Conventional_Monitor/parm/ConMon_user_settings +++ /dev/null @@ -1,27 +0,0 @@ -# -# Conventional Monitor package user settings file -# - -echo "begin CMon_user_settings" - - -################################################################# -# The grib2 flag indicates if the data files are in -# grib2 format (1) or grib (0) -################################################################# -export grib2=0 - -################################################################# -# RUN_ONLY_ON_DEV limits use to dev machine only (1) -# or allow to run on prod (0) -################################################################# -export RUN_ONLY_ON_DEV=${RUN_ONLY_ON_DEV:-1} - - - -################################################################# -# C_DATDIR is the location of the cnvstat files -################################################################# -export CNVSTAT_LOCATION=${CNVSTAT_LOCATION:-/com2/gfs/prod/} - -echo "end CMon_user_settings" diff --git a/util/Correlated_Obs/CMakeLists.txt b/util/Correlated_Obs/CMakeLists.txt index 2252ff96aa..28137ad946 100644 --- a/util/Correlated_Obs/CMakeLists.txt +++ b/util/Correlated_Obs/CMakeLists.txt @@ -69,7 +69,6 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) include_directories(${MPI_Fortran_INCLUDE_DIRS} ${MPI_INCLUDE_PATH} "./" ${CMAKE_INCLUDE_OUTPUT_DIRECTORY}) link_directories(${MPI_Fortran_LIBRARIES} ${ARCHIVE_OUTPUT_PATH} ) find_package( NetCDF REQUIRED) - find_package(HDF5 COMPONENTS C HL Fortran_HL ) set(NCDIAG_INCS "${PROJECT_BINARY_DIR}/libsrc/ncdiag") set(BUILD_NCDIAG ON) add_subdirectory(${PROJECT_SOURCE_DIR}/../../src/ncdiag ${PROJECT_BINARY_DIR}/libsrc/ncdiag) @@ -83,9 +82,9 @@ message("ncdiag is ${NCDIAG_LIBRARIES}") add_executable(cov_calc ${COV_CALC_SRC} ) add_dependencies(cov_calc ${NCDIAG_LIBRARIES}) set_target_properties( cov_calc PROPERTIES COMPILE_FLAGS ${COV_CALC_FLAGS} ) - include_directories( ${CORE_INCS} ${NETCDF_INCLUDES} ${NCDIAG_INCS}) + include_directories( ${CORE_INCS} ${NETCDF_INCLUDE_DIRS} ${NCDIAG_INCS}) # target_link_libraries( cov_calc ${W3NCO_LIBRARY} ) - target_link_libraries( cov_calc ${OpenMP_Fortran_LIBRARIES} ${NCDIAG_LIBRARIES} ${NETCDF_LIBRARIES}) + target_link_libraries( cov_calc ${OpenMP_Fortran_LIBRARIES} ${NCDIAG_LIBRARIES} ${NETCDF_Fortran_LIBRARIES} ${NETCDF_C_LIBRARIES} ${MPI_Fortran_LIBRARIES}) if(BUILD_COV_CALC) # add_dependencies( cov_calc ${W3NCO_LIBRARY} ) # add_dependencies( cov_calc ${OpenMP_Fortran_LIBRARIES} ) diff --git a/util/EnKF/arw/src/enspreproc_regional.fd/CMakeLists.txt b/util/EnKF/arw/src/enspreproc_regional.fd/CMakeLists.txt index a994eb945e..e7f1eafe0a 100644 --- a/util/EnKF/arw/src/enspreproc_regional.fd/CMakeLists.txt +++ b/util/EnKF/arw/src/enspreproc_regional.fd/CMakeLists.txt @@ -2,12 +2,12 @@ cmake_minimum_required(VERSION 2.6) set(GSI_Fortran_FLAGS_LOCAL "${GSI_Fortran_FLAGS} -DWRF") file(GLOB LOCAL_SRC ${CMAKE_CURRENT_SOURCE_DIR}/*.f90 ${CMAKE_CURRENT_SOURCE_DIR}/*.F90) set_source_files_properties( ${LOCAL_SRC} PROPERTIES COMPILE_FLAGS ${GSI_Fortran_FLAGS_LOCAL} ) - include_directories( ${PROJECT_BINARY_DIR}/include ${CORE_INCS} ${NETCDF_INCLUDES} ${MPI_Fortran_INCLUDE_PATH} ${FV3GFS_NCIO_INCS} ) + include_directories( ${PROJECT_BINARY_DIR}/include ${CORE_INCS} ${NETCDF_INCLUDE_DIRS} ${MPI_Fortran_INCLUDE_PATH} ${FV3GFS_NCIO_INCS} ) add_executable(enspreproc.x ${LOCAL_SRC} ) set_target_properties( enspreproc.x PROPERTIES COMPILE_FLAGS ${GSI_Fortran_FLAGS_LOCAL} ) target_link_libraries(enspreproc.x ${GSISHAREDLIB} ${GSILIB} ${GSISHAREDLIB} ${WRF_LIBRARIES} - ${NETCDF_LIBRARIES_F90} ${NETCDF_LIBRARIES} ${HDF5_Fortran_HL_LIBRARIES} ${MPI_Fortran_LIBRARIES} - ${LAPACK_LIBRARIES} -L./ ${EXTRA_LINKER_FLAGS} ${HDF5_LIBRARIES} ${CURL_LIBRARIES} ${CORE_LIBRARIES} ${CORE_BUILT} - ${GSI_LDFLAGS} ${NCDIAG_LIBRARIES} ${ZLIB_LIBRARIES} ${wrflib} ${FV3GFS_NCIO_LIBRARIES} ) + ${NETCDF_Fortran_LIBRARIES} ${NETCDF_C_LIBRARIES} ${MPI_Fortran_LIBRARIES} + ${LAPACK_LIBRARIES} -L./ ${EXTRA_LINKER_FLAGS} ${CORE_LIBRARIES} ${CORE_BUILT} + ${GSI_LDFLAGS} ${NCDIAG_LIBRARIES} ${wrflib} ${FV3GFS_NCIO_LIBRARIES} ) add_dependencies(enspreproc.x ${GSILIB}) diff --git a/util/EnKF/arw/src/initialens_regional.fd/CMakeLists.txt b/util/EnKF/arw/src/initialens_regional.fd/CMakeLists.txt index f2064c73b5..0e2de4f991 100644 --- a/util/EnKF/arw/src/initialens_regional.fd/CMakeLists.txt +++ b/util/EnKF/arw/src/initialens_regional.fd/CMakeLists.txt @@ -1,12 +1,12 @@ cmake_minimum_required(VERSION 2.6) file(GLOB LOCAL_SRC ${CMAKE_CURRENT_SOURCE_DIR}/*.f90) set_source_files_properties( ${LOCAL_SRC} PROPERTIES COMPILE_FLAGS ${GSI_Fortran_FLAGS} ) - include_directories( "${PROJECT_BINARY_DIR}/include" ${NETCDF_INCLUDES} ${MPI_Fortran_INCLUDE_PATH} ) + include_directories( "${PROJECT_BINARY_DIR}/include" ${NETCDF_INCLUDE_DIRS} ${MPI_Fortran_INCLUDE_PATH} ) add_executable(initialens.x ${LOCAL_SRC} ) set_target_properties( initialens.x PROPERTIES COMPILE_FLAGS ${GSI_Fortran_FLAGS} ) target_link_libraries( initialens.x ${GSISHAREDLIB} ${GSILIB} ${GSISHAREDLIB} ${WRF_LIBRARIES} - ${NETCDF_LIBRARIES_F90} ${NETCDF_LIBRARIES} ${HDF5_Fortran_HL_LIBRARIES} ${MPI_Fortran_LIBRARIES} - ${LAPACK_LIBRARIES} -L./ ${EXTRA_LINKER_FLAGS} ${HDF5_LIBRARIES} ${CURL_LIBRARIES} ${CORE_LIBRARIES} ${CORE_BUILT} - ${GSI_LDFLAGS} ${NCDIAG_LIBRARIES} ${ZLIB_LIBRARIES} ${wrflib} ) + ${NETCDF_Fortran_LIBRARIES} ${MPI_Fortran_LIBRARIES} + -L./ ${EXTRA_LINKER_FLAGS} ${CORE_LIBRARIES} ${CORE_BUILT} + ${GSI_LDFLAGS} ${NCDIAG_LIBRARIES} ${wrflib} ) add_dependencies(initialens.x ${GSILIB}) diff --git a/util/EnKF/gfs/src/calc_increment_ens.fd/CMakeLists.txt b/util/EnKF/gfs/src/calc_increment_ens.fd/CMakeLists.txt index 30e1925dc0..e063902e14 100644 --- a/util/EnKF/gfs/src/calc_increment_ens.fd/CMakeLists.txt +++ b/util/EnKF/gfs/src/calc_increment_ens.fd/CMakeLists.txt @@ -9,6 +9,6 @@ if(BUILD_UTIL) set_target_properties( calc_increment_ens.x PROPERTIES COMPILE_FLAGS ${UTIL_Fortran_FLAGS} ) set_target_properties( calc_increment_ens.x PROPERTIES Fortran_MODULE_DIRECTORY ${Util_MODULE_DIRECTORY} ) SET( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_Fortran_FLAGS}" ) - include_directories( ${UTIL_INC} ${NEMSIOINC} ${NETCDF_INCLUDES} ${MPI_Fortran_INCLUDE_PATH} ) - target_link_libraries( calc_increment_ens.x ${NEMSIO_LIBRARY} ${BACIO_LIBRARY} ${W3NCO_4_LIBRARY} ${NETCDF_LIBRARIES_F90} ${NETCDF_LIBRARIES} ${MPI_Fortran_LIBRARIES} ${HDF5_Fortran_HL_LIBRARIES} ${HDF5_LIBRARIES} ${ZLIB_LIBRARIES} ${CURL_LIBRARIES} ) + include_directories( ${UTIL_INC} ${NEMSIOINC} ${NETCDF_INCLUDE_DIRS} ${MPI_Fortran_INCLUDE_PATH} ) + target_link_libraries( calc_increment_ens.x ${NEMSIO_LIBRARY} ${BACIO_LIBRARY} ${W3NCO_4_LIBRARY} ${NETCDF_Fortran_LIBRARIES} ${NETCDF_C_LIBRARIES} ${MPI_Fortran_LIBRARIES}) endif() diff --git a/util/EnKF/gfs/src/calc_increment_ens_ncio.fd/CMakeLists.txt b/util/EnKF/gfs/src/calc_increment_ens_ncio.fd/CMakeLists.txt index bc97cffb28..5854233ffa 100644 --- a/util/EnKF/gfs/src/calc_increment_ens_ncio.fd/CMakeLists.txt +++ b/util/EnKF/gfs/src/calc_increment_ens_ncio.fd/CMakeLists.txt @@ -9,6 +9,6 @@ if(BUILD_UTIL) set_target_properties( calc_increment_ens_ncio.x PROPERTIES COMPILE_FLAGS ${UTIL_Fortran_FLAGS} ) set_target_properties( calc_increment_ens_ncio.x PROPERTIES Fortran_MODULE_DIRECTORY ${Util_MODULE_DIRECTORY} ) SET( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_Fortran_FLAGS}" ) - include_directories( ${UTIL_INC} ${NEMSIOINC} ${NETCDF_INCLUDES} ${MPI_Fortran_INCLUDE_PATH} ${FV3GFS_NCIO_INCS}) - target_link_libraries( calc_increment_ens_ncio.x ${NEMSIO_LIBRARY} ${BACIO_LIBRARY} ${W3NCO_4_LIBRARY} ${NETCDF_LIBRARIES_F90} ${NETCDF_LIBRARIES} ${MPI_Fortran_LIBRARIES} ${HDF5_Fortran_HL_LIBRARIES} ${HDF5_LIBRARIES} ${ZLIB_LIBRARIES} ${CURL_LIBRARIES} ${FV3GFS_NCIO_LIBRARIES}) + include_directories( ${UTIL_INC} ${NEMSIOINC} ${NETCDF_INCLUDE_DIRS} ${MPI_Fortran_INCLUDE_PATH} ${FV3GFS_NCIO_INCS}) + target_link_libraries( calc_increment_ens_ncio.x ${NEMSIO_LIBRARY} ${BACIO_LIBRARY} ${W3NCO_4_LIBRARY} ${NETCDF_Fortran_LIBRARIES} ${NETCDF_C_LIBRARIES} ${MPI_Fortran_LIBRARIES} ${FV3GFS_NCIO_LIBRARIES}) endif() diff --git a/util/EnKF/gfs/src/calc_increment_ncio.fd/CMakeLists.txt b/util/EnKF/gfs/src/calc_increment_ncio.fd/CMakeLists.txt index cd3928f602..716d9019e9 100644 --- a/util/EnKF/gfs/src/calc_increment_ncio.fd/CMakeLists.txt +++ b/util/EnKF/gfs/src/calc_increment_ncio.fd/CMakeLists.txt @@ -6,6 +6,6 @@ if(BUILD_UTIL) add_executable(calc_increment_ncio.x ${LOCAL_SRC} ) set_target_properties( calc_increment_ncio.x PROPERTIES COMPILE_FLAGS ${UTIL_Fortran_FLAGS} ) SET( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_Fortran_FLAGS}" ) - include_directories( ${UTIL_INC} ${NEMSIOINC} ${NETCDF_INCLUDES} ${MPI_Fortran_INCLUDE_PATH} ${FV3GFS_NCIO_INCS}) - target_link_libraries( calc_increment_ncio.x ${CORE_LIBRARIES} ${NETCDF_LIBRARIES_F90} ${NETCDF_LIBRARIES} ${HDF5_Fortran_HL_LIBRARIES} ${MPI_Fortran_LIBRARIES} ${HDF5_LIBRARIES} ${FV3GFS_NCIO_LIBRARIES} ) + include_directories( ${UTIL_INC} ${NEMSIOINC} ${NETCDF_INCLUDE_DIRS} ${MPI_Fortran_INCLUDE_PATH} ${FV3GFS_NCIO_INCS}) + target_link_libraries( calc_increment_ncio.x ${CORE_LIBRARIES} ${NETCDF_Fortran_LIBRARIES} ${NETCDF_C_LIBRARIES} ${MPI_Fortran_LIBRARIES} ${FV3GFS_NCIO_LIBRARIES} ) endif() diff --git a/util/EnKF/gfs/src/calc_increment_serial.fd/CMakeLists.txt b/util/EnKF/gfs/src/calc_increment_serial.fd/CMakeLists.txt index d9c40e8a4d..406281cd3a 100644 --- a/util/EnKF/gfs/src/calc_increment_serial.fd/CMakeLists.txt +++ b/util/EnKF/gfs/src/calc_increment_serial.fd/CMakeLists.txt @@ -7,7 +7,7 @@ if(BUILD_UTIL) add_executable(calc_increment_serial.x ${LOCAL_SRC} ) set_target_properties( calc_increment_serial.x PROPERTIES COMPILE_FLAGS ${UTIL_Fortran_FLAGS} ) SET( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_Fortran_FLAGS}" ) - include_directories( ${UTIL_INC} ${CORE_INCS} ${NETCDF_INCLUDES} ) - target_link_libraries( calc_increment_serial.x ${CORE_LIBRARIES} ${NETCDF_LIBRARIES_F90} ${NETCDF_LIBRARIES} ${MPI_Fortran_LIBRARIES} ${HDF5_Fortran_HL_LIBRARIES} ${HDF5_LIBRARIES} ) + include_directories( ${UTIL_INC} ${CORE_INCS} ${NETCDF_INCLUDE_DIRS} ) + target_link_libraries( calc_increment_serial.x ${CORE_LIBRARIES} ${NETCDF_Fortran_LIBRARIES} ${NETCDF_C_LIBRARIES} ${MPI_Fortran_LIBRARIES}) add_dependencies( calc_increment_serial.x enkfdeplib enkflib ) endif() diff --git a/util/EnKF/gfs/src/getsfcensmeanp.fd/CMakeLists.txt b/util/EnKF/gfs/src/getsfcensmeanp.fd/CMakeLists.txt index df033c979a..9750cbc97c 100644 --- a/util/EnKF/gfs/src/getsfcensmeanp.fd/CMakeLists.txt +++ b/util/EnKF/gfs/src/getsfcensmeanp.fd/CMakeLists.txt @@ -5,6 +5,6 @@ if(BUILD_UTIL) add_executable( getsfcensmeanp.x ${LOCAL_SRC} ) set_target_properties( getsfcensmeanp.x PROPERTIES COMPILE_FLAGS ${UTIL_Fortran_FLAGS} ) SET( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_Fortran_FLAGS}" ) - include_directories( ${NEMSIOINC} ${SFCIOINC} ${NETCDF_INCLUDES} ${FV3GFS_NCIO_INCS}) - target_link_libraries( getsfcensmeanp.x ${BACIO_LIBRARY} ${NEMSIO_LIBRARY} ${BACIO_LIBRARY} ${SFCIO_LIBRARY} ${W3NCO_4_LIBRARY} ${MPI_Fortran_LIBRARIES} ${NETCDF_LIBRARIES_F90} ${NETCDF_LIBRARIES} ${FV3GFS_NCIO_LIBRARIES} ) + include_directories( ${NEMSIOINC} ${SFCIOINC} ${NETCDF_INCLUDE_DIRS} ${FV3GFS_NCIO_INCS}) + target_link_libraries( getsfcensmeanp.x ${FV3GFS_NCIO_LIBRARIES} ${BACIO_LIBRARY} ${NEMSIO_LIBRARY} ${BACIO_LIBRARY} ${SFCIO_LIBRARY} ${W3NCO_4_LIBRARY} ${MPI_Fortran_LIBRARIES} ${NETCDF_Fortran_LIBRARIES} ${NETCDF_C_LIBRARIES}) endif() diff --git a/util/EnKF/gfs/src/getsigensmeanp_smooth.fd/CMakeLists.txt b/util/EnKF/gfs/src/getsigensmeanp_smooth.fd/CMakeLists.txt index 0e41e9a848..08ab0defdf 100644 --- a/util/EnKF/gfs/src/getsigensmeanp_smooth.fd/CMakeLists.txt +++ b/util/EnKF/gfs/src/getsigensmeanp_smooth.fd/CMakeLists.txt @@ -7,6 +7,6 @@ if(BUILD_UTIL) add_executable(getsigensmeanp_smooth.x ${LOCAL_SRC} ) set_target_properties( getsigensmeanp_smooth.x PROPERTIES COMPILE_FLAGS ${LOCAL_Fortran_FLAGS} ) SET( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_Fortran_FLAGS}" ) - include_directories( ${NEMSIOINC} ${SIGIOINC} ${NETCDF_INCLUDES} ${FV3GFS_NCIO_INCS}) - target_link_libraries( getsigensmeanp_smooth.x ${BACIO_LIBRARY} ${NEMSIO_LIBRARY} ${BACIO_LIBRARY} ${SIGIO_LIBRARY} ${W3NCO_4_LIBRARY} ${SP_4_LIBRARY} ${MPI_Fortran_LIBRARIES} ${NETCDF_LIBRARIES_F90} ${NETCDF_LIBRARIES} ${FV3GFS_NCIO_LIBRARIES} ) + include_directories( ${NEMSIOINC} ${SIGIOINC} ${NETCDF_INCLUDE_DIRS} ${FV3GFS_NCIO_INCS}) + target_link_libraries( getsigensmeanp_smooth.x ${FV3GFS_NCIO_LIBRARIES} ${BACIO_LIBRARY} ${NEMSIO_LIBRARY} ${BACIO_LIBRARY} ${SIGIO_LIBRARY} ${W3NCO_4_LIBRARY} ${SP_4_LIBRARY} ${MPI_Fortran_LIBRARIES} ${NETCDF_Fortran_LIBRARIES} ${NETCDF_C_LIBRARIES}) endif() diff --git a/util/EnKF/gfs/src/getsigensstatp.fd/CMakeLists.txt b/util/EnKF/gfs/src/getsigensstatp.fd/CMakeLists.txt index c888c52710..dfbf5ca596 100644 --- a/util/EnKF/gfs/src/getsigensstatp.fd/CMakeLists.txt +++ b/util/EnKF/gfs/src/getsigensstatp.fd/CMakeLists.txt @@ -6,6 +6,6 @@ if(BUILD_UTIL) set_target_properties( getsigensstatp.x PROPERTIES COMPILE_FLAGS ${UTIL_Fortran_FLAGS} ) SET( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_Fortran_FLAGS}" ) message(" hey, incl dirs are ${MPI_Fortran_INCLUDE_PATH} ") - include_directories( ${NETCDF_INCLUDES} ${SIGIOINC} ${NEMSIOINC} ${MPI_Fortran_INCLUDE_PATH} ${FV3GFS_NCIO_INCS}) - target_link_libraries( getsigensstatp.x ${SIGIO_LIBRARY} ${NEMSIO_LIBRARY} ${BACIO_LIBRARY} ${SP_4_LIBRARY} ${W3NCO_4_LIBRARY} ${NETCDF_LIBRARIES_F90} ${NETCDF_LIBRARIES} ${MPI_Fortran_LIBRARIES} ${HDF5_Fortran_HL_LIBRARIES} ${HDF5_LIBRARIES} ${ZLIB_LIBRARIES} ${CURL_LIBRARIES} ${FV3GFS_NCIO_LIBRARIES}) + include_directories( ${NETCDF_INCLUDE_DIRS} ${SIGIOINC} ${NEMSIOINC} ${MPI_Fortran_INCLUDE_PATH} ${FV3GFS_NCIO_INCS}) + target_link_libraries( getsigensstatp.x ${SIGIO_LIBRARY} ${NEMSIO_LIBRARY} ${BACIO_LIBRARY} ${SP_4_LIBRARY} ${W3NCO_4_LIBRARY} ${NETCDF_Fortran_LIBRARIES} ${NETCDF_C_LIBRARIES} ${MPI_Fortran_LIBRARIES} ${FV3GFS_NCIO_LIBRARIES}) endif() diff --git a/util/EnKF/gfs/src/recenterncio_hybgain.fd/CMakeLists.txt b/util/EnKF/gfs/src/recenterncio_hybgain.fd/CMakeLists.txt index 22671e6ba1..79199d143f 100644 --- a/util/EnKF/gfs/src/recenterncio_hybgain.fd/CMakeLists.txt +++ b/util/EnKF/gfs/src/recenterncio_hybgain.fd/CMakeLists.txt @@ -5,6 +5,6 @@ if(BUILD_UTIL) add_executable(recenterncio_hybgain.x ${LOCAL_SRC} ) set_target_properties( recenterncio_hybgain.x PROPERTIES COMPILE_FLAGS ${UTIL_Fortran_FLAGS} ) SET( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_Fortran_FLAGS}" ) - include_directories( ${NETCDF_INCLUDES} ${FV3GFS_NCIO_INCS}) - target_link_libraries( recenterncio_hybgain.x ${W3NCO_4_LIBRARY} ${MPI_Fortran_LIBRARIES} ${NETCDF_LIBRARIES_F90} ${NETCDF_LIBRARIES} ${FV3GFS_NCIO_LIBRARIES} ) + include_directories( ${NETCDF_INCLUDE_DIRS} ${FV3GFS_NCIO_INCS}) + target_link_libraries( recenterncio_hybgain.x ${FV3GFS_NCIO_LIBRARIES} ${W3NCO_4_LIBRARY} ${MPI_Fortran_LIBRARIES} ${NETCDF_Fortran_LIBRARIES} ${NETCDF_C_LIBRARIES}) endif() diff --git a/util/EnKF/gfs/src/recentersigp.fd/CMakeLists.txt b/util/EnKF/gfs/src/recentersigp.fd/CMakeLists.txt index 7a9d49192d..5c5537a2ef 100644 --- a/util/EnKF/gfs/src/recentersigp.fd/CMakeLists.txt +++ b/util/EnKF/gfs/src/recentersigp.fd/CMakeLists.txt @@ -5,6 +5,6 @@ if(BUILD_UTIL) add_executable(recentersigp.x ${LOCAL_SRC} ) set_target_properties( recentersigp.x PROPERTIES COMPILE_FLAGS ${UTIL_Fortran_FLAGS} ) SET( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_Fortran_FLAGS}" ) - include_directories( ${NEMSIOINC} ${SIGIOINC} ${NETCDF_INCLUDES} ${FV3GFS_NCIO_INCS}) - target_link_libraries( recentersigp.x ${SIGIO_LIBRARY} ${NEMSIO_LIBRARY} ${BACIO_LIBRARY} ${W3NCO_4_LIBRARY} ${MPI_Fortran_LIBRARIES} ${NETCDF_LIBRARIES_F90} ${NETCDF_LIBRARIES} ${FV3GFS_NCIO_LIBRARIES} ) + include_directories( ${NEMSIOINC} ${SIGIOINC} ${NETCDF_INCLUDE_DIRS} ${FV3GFS_NCIO_INCS}) + target_link_libraries( recentersigp.x ${FV3GFS_NCIO_LIBRARIES} ${SIGIO_LIBRARY} ${NEMSIO_LIBRARY} ${BACIO_LIBRARY} ${W3NCO_4_LIBRARY} ${MPI_Fortran_LIBRARIES} ${NETCDF_Fortran_LIBRARIES} ${NETCDF_C_LIBRARIES}) endif() diff --git a/util/Minimization_Monitor/nwprod/gdas.v1.0.0/jobs/JGDAS_VMINMON b/util/Minimization_Monitor/nwprod/gdas.v1.0.0/jobs/JGDAS_ATMOS_VMINMON similarity index 91% rename from util/Minimization_Monitor/nwprod/gdas.v1.0.0/jobs/JGDAS_VMINMON rename to util/Minimization_Monitor/nwprod/gdas.v1.0.0/jobs/JGDAS_ATMOS_VMINMON index 3c584893fb..2e0ffac0fd 100755 --- a/util/Minimization_Monitor/nwprod/gdas.v1.0.0/jobs/JGDAS_VMINMON +++ b/util/Minimization_Monitor/nwprod/gdas.v1.0.0/jobs/JGDAS_ATMOS_VMINMON @@ -7,11 +7,11 @@ echo `date` $0 `date -u` begin export PS4='$SECONDS + ' ############################### -# Specify NET and RUN name +# Specify NET, RUN, and COMPONENT name ############################## export NET=${NET:-gfs} export RUN=${RUN:-gdas} - +export COMPONENT=${COMPONENT:-atmos} ########################################################### # obtain unique process id (pid) and make temp directories @@ -70,11 +70,11 @@ export p_cyc=`echo ${cdate} | cut -c9-10` export COM_IN=${COM_IN:-${COMROOT}/${NET}/${envir}} M_TANKverf=${M_TANKverf:-${COM_IN}} -M_TANKverfM0=${M_TANKverfM0:-${M_TANKverf}/${RUN}.${PDY}/${cyc}/minmon} -export M_TANKverfM1=${M_TANKverfM1:-${M_TANKverf}/${RUN}.${P_PDY}/${p_cyc}/minmon} +M_TANKverfM0=${M_TANKverfM0:-${M_TANKverf}/${RUN}.${PDY}/${cyc}/$COMPONENT/minmon} +export M_TANKverfM1=${M_TANKverfM1:-${M_TANKverf}/${RUN}.${P_PDY}/${p_cyc}/$COMPONENT/minmon} export M_TANKverf=$M_TANKverfM0 -export COMIN=${COMIN:-$COM_IN/${RUN}.${PDY}/${cyc}} +export COMIN=${COMIN:-$COM_IN/${RUN}.${PDY}/${cyc}/$COMPONENT} mkdir -p -m 775 $M_TANKverf @@ -89,7 +89,7 @@ export gsistat=${gsistat:-${COMIN}/gdas.t${cyc}z.gsistat} ######################################################## # Execute the script. -${GMONSH:-$SCRgfs/exgdas_vrfminmon.sh.ecf} ${PDY} ${cyc} +${GMONSH:-$SCRgfs/exgdas_atmos_vminmon.sh} ${PDY} ${cyc} err=$? [[ $err -ne 0 ]] && exit $err diff --git a/util/Minimization_Monitor/nwprod/gdas.v1.0.0/scripts/exgdas_vrfminmon.sh.ecf b/util/Minimization_Monitor/nwprod/gdas.v1.0.0/scripts/exgdas_atmos_vminmon.sh similarity index 95% rename from util/Minimization_Monitor/nwprod/gdas.v1.0.0/scripts/exgdas_vrfminmon.sh.ecf rename to util/Minimization_Monitor/nwprod/gdas.v1.0.0/scripts/exgdas_atmos_vminmon.sh index f55d494fb7..af3e338151 100755 --- a/util/Minimization_Monitor/nwprod/gdas.v1.0.0/scripts/exgdas_vrfminmon.sh.ecf +++ b/util/Minimization_Monitor/nwprod/gdas.v1.0.0/scripts/exgdas_atmos_vminmon.sh @@ -2,7 +2,7 @@ ################################################################################ #### UNIX Script Documentation Block # . . -# Script name: exgdas_vrfminmon.sh.ecf +# Script name: exgdas_vrfminmon.sh # Script description: Runs data extract/validation for GSI normalization diag data # # Author: Ed Safford Org: NP23 Date: 2015-04-10 @@ -26,7 +26,7 @@ then set -x fi -export scr=exgdas_vrfyminmon.sh.ecf +export scr=exgdas_vrfyminmon.sh export RUN_ENVIR=${RUN_ENVIR:-nco} @@ -60,7 +60,7 @@ export MINMON_SUFFIX=${MINMON_SUFFIX:-GDAS} export PDATE=${PDY}${cyc} export NCP=${NCP:-/bin/cp} export NDATE=${NDATE:-/nwprod/util/exec/ndate} -export pgm=exgdas_vrfminmon.sh.ecf +export pgm=exgdas_vrfminmon.sh if [[ ! -d ${DATA} ]]; then mkdir $DATA @@ -118,7 +118,7 @@ elif [[ $rc_reduct -ne 0 ]]; then fi if [[ "$VERBOSE" = "YES" ]]; then - echo "end exgdas_vrfminmon.sh.ecf, exit value = ${err}" + echo "end exgdas_vrfminmon.sh, exit value = ${err}" fi diff --git a/util/Minimization_Monitor/nwprod/gfs.v1.0.0/jobs/JGFS_VMINMON b/util/Minimization_Monitor/nwprod/gfs.v1.0.0/jobs/JGFS_ATMOS_VMINMON similarity index 93% rename from util/Minimization_Monitor/nwprod/gfs.v1.0.0/jobs/JGFS_VMINMON rename to util/Minimization_Monitor/nwprod/gfs.v1.0.0/jobs/JGFS_ATMOS_VMINMON index bdc78268c1..a0d3503ef3 100755 --- a/util/Minimization_Monitor/nwprod/gfs.v1.0.0/jobs/JGFS_VMINMON +++ b/util/Minimization_Monitor/nwprod/gfs.v1.0.0/jobs/JGFS_ATMOS_VMINMON @@ -11,6 +11,7 @@ export PS4='$SECONDS + ' ############################## export NET=${NET:-gfs} export RUN=${RUN:-gfs} +export COMPONENT=${COMPONENT:-atmos} ########################################################### @@ -76,11 +77,11 @@ TANK_USE_RUN=${TANK_USE_RUN:-1} export COM_IN=${COM_IN:-${COMROOT}/${NET}/${envir}} M_TANKverf=${M_TANKverf:-${COM_IN}} -M_TANKverfM0=${M_TANKverfM0:-${M_TANKverf}/${RUN}.${PDY}/${cyc}/minmon} -export M_TANKverfM1=${M_TANKverfM1:-${M_TANKverf}/${RUN}.${P_PDY}/${p_cyc}/minmon} +M_TANKverfM0=${M_TANKverfM0:-${M_TANKverf}/${RUN}.${PDY}/${cyc}/$COMPONENT/minmon} +export M_TANKverfM1=${M_TANKverfM1:-${M_TANKverf}/${RUN}.${P_PDY}/${p_cyc}/$COMPONENT/minmon} export M_TANKverf=$M_TANKverfM0 -export COMIN=${COMIN:-$COM_IN/${RUN}.${PDY}/${cyc}} +export COMIN=${COMIN:-$COM_IN/${RUN}.${PDY}/${cyc}/$COMPONENT} mkdir -p -m 775 $M_TANKverf @@ -94,7 +95,7 @@ export gsistat=${gsistat:-${COMIN}/gfs.t${cyc}z.gsistat} ######################################################## # Execute the script. -${GMONSH:-$SCRgfs/exgfs_vrfminmon.sh.ecf} ${PDY} ${cyc} +${GMONSH:-$SCRgfs/exgfs_atmos_vminmon.sh} ${PDY} ${cyc} err=$? [[ $err -ne 0 ]] && exit $err diff --git a/util/Minimization_Monitor/nwprod/gfs.v1.0.0/scripts/exgfs_vrfminmon.sh.ecf b/util/Minimization_Monitor/nwprod/gfs.v1.0.0/scripts/exgfs_atmos_vminmon.sh similarity index 95% rename from util/Minimization_Monitor/nwprod/gfs.v1.0.0/scripts/exgfs_vrfminmon.sh.ecf rename to util/Minimization_Monitor/nwprod/gfs.v1.0.0/scripts/exgfs_atmos_vminmon.sh index 1a182f9fc3..98e33c708d 100755 --- a/util/Minimization_Monitor/nwprod/gfs.v1.0.0/scripts/exgfs_vrfminmon.sh.ecf +++ b/util/Minimization_Monitor/nwprod/gfs.v1.0.0/scripts/exgfs_atmos_vminmon.sh @@ -2,7 +2,7 @@ ################################################################################ #### UNIX Script Documentation Block # . . -# Script name: exgfs_vrfminmon.sh.ecf +# Script name: exgfs_vrfminmon.sh # Script description: Runs data extract/validation for GSI normalization diag data # # Author: Ed Safford Org: NP23 Date: 2015-04-10 @@ -26,7 +26,7 @@ then set -x fi -export scr=exgfs_vrfyminmon.sh.ecf +export scr=exgfs_vrfyminmon.sh export RUN_ENVIR=${RUN_ENVIR:-nco} export NET=${NET:-gfs} @@ -59,7 +59,7 @@ export MINMON_SUFFIX=${MINMON_SUFFIX:-GFS} export PDATE=${PDY}${cyc} export NCP=${NCP:-/bin/cp} export NDATE=${NDATE:-/nwprod/util/exec/ndate} -export pgm=exgfs_vrfminmon.sh.ecf +export pgm=exgfs_vrfminmon.sh @@ -119,7 +119,7 @@ elif [[ $rc_reduct -ne 0 ]]; then fi if [[ "$VERBOSE" = "YES" ]]; then - echo "end exgfs_vrfminmon.sh.ecf, exit value = ${err}" + echo "end exgfs_vrfminmon.sh, exit value = ${err}" fi diff --git a/util/Ozone_Monitor/CMakeLists.txt b/util/Ozone_Monitor/CMakeLists.txt index b8f928a61d..d130e2bca9 100644 --- a/util/Ozone_Monitor/CMakeLists.txt +++ b/util/Ozone_Monitor/CMakeLists.txt @@ -1,9 +1,9 @@ -cmake_minimum_required(VERSION 2.6) +cmake_minimum_required(VERSION 2.8) if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) # I am top-level project. if( NOT DEFINED ENV{CC} ) find_path( crayComp "ftn" ) -# find_path( wcossIntel "mpfort" ) + find_path( wcossIntel "mpfort" ) find_path( intelComp "ifort" ) find_path( pgiComp "pgf90" ) if( crayComp ) @@ -22,7 +22,7 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) message("Setting env for wcoss intel") set(ENV{CC} "mpcc") set(ENV{CXX} "mpCC") -# set(ENV{FC} "mpfort") + set(ENV{FC} "mpfort") endif() if( pgiComp ) set(ENV{CC} "pgcc") @@ -32,8 +32,8 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) endif() project(COV_Calc) enable_language (Fortran) -# find_package(OpenMP) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/../../cmake/Modules/") + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib") include(${CMAKE_SOURCE_DIR}/../../cmake/Modules/setPlatformVariables.cmake) include(${CMAKE_SOURCE_DIR}/../../cmake/Modules/setIntelFlags.cmake) include(${CMAKE_SOURCE_DIR}/../../cmake/Modules/setGNUFlags.cmake) @@ -64,26 +64,32 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) message("Setting PGI flags") setPGI() endif() + + cmake_policy(SET CMP0009 NEW) + find_package(OpenMP) + message("found openmp with flag ${OPENMP_Fortran_FLAGS}") + +# Set Host specific flags and options setHOST() + find_package(MPI REQUIRED) + message("MPI version is ${MPI_Fortran_VERSION}") + message("MPI f90 version is ${MPI_Fortran_HAVE_F90_MODULE}") + message("MPI f08 version is ${MPI_Fortran_HAVE_F08_MODULE}") + add_definitions(${MPI_Fortran_COMPILE_FLAGS}) include_directories(${MPI_Fortran_INCLUDE_DIRS} ${MPI_INCLUDE_PATH} "./" ${CMAKE_INCLUDE_OUTPUT_DIRECTORY}) link_directories(${MPI_Fortran_LIBRARIES} ${ARCHIVE_OUTPUT_PATH} ) - find_package( NetCDF REQUIRED) - if(FIND_HDF5_HL) - find_package(HDF5 COMPONENTS C HL Fortran_HL ) - elseif(FIND_HDF5) - find_package(HDF5) - endif() + find_package( NetCDF COMPONENTS C Fortran REQUIRED) find_package( W3NCO ) - set(NCDIAG_INCS "${PROJECT_BINARY_DIR}/libsrc/ncdiag") + set(BUILD_NCDIAG ON) + set(NCDIAG_INCS "${PROJECT_BINARY_DIR}/libsrc/ncdiag") add_subdirectory(${PROJECT_SOURCE_DIR}/../../src/ncdiag ${PROJECT_BINARY_DIR}/libsrc/ncdiag) set(NCDIAG_LIBRARIES ncdiag ) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) endif() -add_subdirectory(nwprod/oznmon_shared.v2.0.0/sorc/oznmon_horiz.fd) -add_subdirectory(nwprod/oznmon_shared.v2.0.0/sorc/oznmon_time.fd) +add_subdirectory(nwprod/oznmon_shared/sorc/oznmon_horiz.fd) +add_subdirectory(nwprod/oznmon_shared/sorc/oznmon_time.fd) add_subdirectory(data_xtrct/sorc/make_base.fd) - diff --git a/util/Ozone_Monitor/OznMon_install.pl b/util/Ozone_Monitor/OznMon_install.pl index 87b2ae65e3..0c7906d684 100755 --- a/util/Ozone_Monitor/OznMon_install.pl +++ b/util/Ozone_Monitor/OznMon_install.pl @@ -5,7 +5,7 @@ # # This script makes sets all necessary configuration definitions # and calls the makeall.sh script to build all the necessary -# executables. This script works for hera, wcoss, cray, and +# executables. This script works for hera, wcoss_c, and # wcoss_d machines. # #------------------------------------------------------------------- @@ -16,7 +16,7 @@ my $machine = `/usr/bin/perl get_hostname.pl`; my $my_machine="export MY_MACHINE=$machine"; - if( $machine ne "cray" && $machine ne "hera" && $machine ne "wcoss" && $machine ne "wcoss_d" ) { + if( $machine ne "wcoss_c" && $machine ne "hera" && $machine ne "wcoss_d" ) { die( "ERROR --- Unrecognized machine hostname, $machine. Exiting now...\n" ); } else { @@ -24,7 +24,7 @@ } # - # hera, wcoss, cray, wcoss_d are all little endian machines, and all run linux + # hera, wcoss_c, wcoss_d are all little endian machines, and all run linux # my $little_endian = "export LITTLE_ENDIAN=\${LITTLE_ENDIAN:-0}"; my $my_os = "linux"; @@ -59,7 +59,7 @@ elsif( $machine eq "wcoss_d" ){ $tankdir = "/gpfs/dell2/emc/modeling/noscrub/$user_name/nbns"; } - elsif( $machine eq "cray" ){ + elsif( $machine eq "wcoss_c" ){ $tankdir = "/gpfs/hps/emc/da/noscrub/$user_name/nbns"; } else { @@ -205,7 +205,7 @@ $my_ptmp="export OZN_PTMP=\${OZN_PTMP:-/gpfs/dell2/ptmp}"; $my_stmp="export OZN_STMP=\${OZN_STMP:-/gpfs/dell2/stmp}"; } - elsif( $machine eq "cray" ) { + elsif( $machine eq "wcoss_c" ) { $my_ptmp="export OZN_PTMP=\${OZN_PTMP:-/gpfs/hps2/ptmp}"; $my_stmp="export OZN_STMP=\${OZN_STMP:-/gpfs/hps2/stmp}"; } @@ -331,12 +331,12 @@ } my $project = "export PROJECT=\${PROJECT:-GFS-DEV}"; - if( $machine ne "wcoss" && $machine ne "cray" && $machine ne "wcoss_d" ) { + if( $machine ne "wcoss_c" && $machine ne "wcoss_d" ) { $project="export PROJECT="; } my $job_queue="export JOB_QUEUE="; - if( $machine eq "cray" ) { + if( $machine eq "wcoss_c" ) { $job_queue="export JOB_QUEUE=\${JOB_QUEUE:-dev}"; } elsif( $machine eq "wcoss" || $machine eq "wcoss_d" ){ $job_queue = "export JOB_QUEUE=\${JOB_QUEUE:-dev_shared}"; diff --git a/util/Ozone_Monitor/build_OznMon_cmake.sh b/util/Ozone_Monitor/build_OznMon_cmake.sh index 7f72652874..c21d2d70b6 100755 --- a/util/Ozone_Monitor/build_OznMon_cmake.sh +++ b/util/Ozone_Monitor/build_OznMon_cmake.sh @@ -14,9 +14,14 @@ set -ax mode=${1:-} +MY_OZNMON=${2:-} + top_level=${PWD} echo "top_level = ${top_level}" +export MY_OZNMON=${MY_OZNMON:-$top_level} +echo "MY_OZNMON = ${MY_OZNMON}" + #module purge if [[ -d /dcom && -d /hwrf ]] ; then @@ -33,6 +38,9 @@ elif [[ -d /ioddev_dell ]]; then elif [[ -d /scratch1 ]] ; then . /apps/lmod/lmod/init/sh target=hera +elif [[ -d /work ]]; then + . $MODULESHOME/init/sh + target=orion else echo "unknown target = $target" exit 9 @@ -55,8 +63,8 @@ fi # Verify this is a supported machine #--------------------------------------------------- -if [[ ${target} = "hera" || ${target} = "wcoss" \ - || ${target} = "wcoss_c" || ${target} = "wcoss_d" ]]; then +if [[ ${target} = "hera" || ${target} = "wcoss_c" \ + || ${target} = "wcoss_d" || ${target} = "orion" ]]; then echo Building nwprod executables on ${target} echo @@ -68,10 +76,14 @@ if [[ ${target} = "hera" || ${target} = "wcoss" \ module purge module use -a $dir_modules module load modulefile.ProdGSI.$target - elif [ $target = wcoss -o $target = gaea ]; then + elif [ $target = gaea ]; then module purge module load $dir_modules/modulefile.ProdGSI.$target - elif [ $target = hera -o $target = cheyenne ]; then + elif [ $target = hera -o $target = orion ]; then + module purge + module use $dir_modules + module load modulefile.ProdGSI.$target + elif [ $target = cheyenne ]; then module purge source $dir_modules/modulefile.ProdGSI.$target elif [ $target = wcoss_c ]; then diff --git a/util/Ozone_Monitor/data_xtrct/ush/OznMon_CP.sh b/util/Ozone_Monitor/data_xtrct/ush/OznMon_CP.sh new file mode 100755 index 0000000000..a40867709b --- /dev/null +++ b/util/Ozone_Monitor/data_xtrct/ush/OznMon_CP.sh @@ -0,0 +1,205 @@ +#!/bin/bash + +#-------------------------------------------------------------------- +# OznMon_CP.sh +# +# This script searches for new oznmon output from the global GDAS +# and copies those filess to the user's $TANKDIR directory under +# the specified suffix argument. +# +# The bad_penalty, low count, and missing diag reports are +# reevaluated using local copies of the base file and satype +# files in the $TANKdir/$suffix/info directory. +# +# Note that processing occurs within TANKdir, not in stmp space. +# +# The unified error report is journaled to warning.${PDY}${CYC}. +# +#-------------------------------------------------------------------- + +function usage { + echo "Usage: OznMon_CP_glb.sh suffix [-r|--run gdas|gfs -p|--pdate yyyymmddhh" + echo "" + echo " Suffix (NET) is the indentifier for this data source." + echo "" + echo " -r|--run is the run value, typically gdas or gfs. Default value is gdas." + echo "" + echo " -p|--pdate is 10 digit yyyymmddhh string of cycle to be copied." + echo " If not specified the pdate will be calculated by finding the latest" + echo " cycle time in $OZN_STATS_TANKDIR and incrementing it by 6 hours." + echo "" + echo " --oznf parent directory to file location. This will be extended by " + echo " $RUN.$PDY/$CYC/atmos/oznmon and the files there copied to OZN_STATS_TANKDIR." + echo "" + echo " --ostat directory of oznstat file." +} + + +echo start OznMon_CP.sh +exit_value=0 + +nargs=$# +if [[ $nargs -le 0 || $nargs -gt 7 ]]; then + usage + exit 1 +fi + +set -ax + +#----------------------------------------------------------- +# Set default values and process command line arguments. +# +run=gdas + +while [[ $# -ge 1 ]] +do + key="$1" + echo $key + + case $key in + -p|--pdate) + pdate="$2" + shift # past argument + ;; + -r|--run) + run="$2" + shift # past argument + ;; + --oznf) + oznmon_file_loc="$2" + shift # past argument + ;; + --ostat) + oznmon_stat_loc="$2" + shift # past argument + ;; + *) + #any unspecified key is OZNMON_SUFFIX + export OZNMON_SUFFIX=$key + ;; + esac + + shift +done + +echo "OZNMON_SUFFIX = $OZNMON_SUFFIX" +echo "run = $run" +echo "pdate = $pdate" +echo "oznmon_file_loc = ${oznmon_file_loc}" +echo "oznmon_stat_loc = ${oznmon_stat_loc}" + +export RUN=${RUN:-${run}} + + +#-------------------------------------------------------------------- +# Set environment variables +#-------------------------------------------------------------------- +this_dir=`dirname $0` + +top_parm=${this_dir}/../../parm + +oznmon_user_settings=${oznmon_user_settings:-${top_parm}/OznMon_user_settings} +if [[ -s ${oznmon_user_settings} ]]; then + . ${oznmon_user_settings} + echo "able to source ${oznmon_user_settings}" +else + echo "Unable to source ${oznmon_user_settings} file" + exit 4 +fi + + +oznmon_config=${oznmon_config:-${top_parm}/OznMon_config} +if [[ -s ${oznmon_config} ]]; then + . ${oznmon_config} + echo "able to source ${oznmon_config}" +else + echo "Unable to source ${oznmon_config} file" + exit 3 +fi + +if [[ ${oznmon_stat_loc} = "" ]]; then + oznmon_stat_loc=${OZNSTAT_LOCATION} +fi + + +#--------------------------------------------------------------- +# Create any missing directories. +#--------------------------------------------------------------- +if [[ ! -d ${OZN_STATS_TANKDIR} ]]; then + mkdir -p ${OZN_STATS_TANKDIR} +fi +if [[ ! -d ${OZN_LOGdir} ]]; then + mkdir -p ${OZN_LOGdir} +fi + +#--------------------------------------------------------------- +# If the pdate (processing date) was not specified at the +# command line then set it by finding the latest cycle in +# $TANKverf and increment 6 hours. +#--------------------------------------------------------------- +if [[ $pdate = "" ]]; then + ldate=`${OZN_DE_SCRIPTS}/find_cycle.pl --run $RUN --cyc 1 --dir ${OZN_STATS_TANKDIR}` + pdate=`${NDATE} +06 ${ldate}` +fi +export PDATE=${pdate} + +export PDY=`echo $PDATE|cut -c1-8` +export CYC=`echo $PDATE|cut -c9-10` + +#--------------------------------------------------------------- +# Verify the data files are available +#--------------------------------------------------------------- +export OZNSTAT_LOCATION=${oznmon_stat_loc}/${RUN}.${PDY}/${CYC}/atmos + + +#--------------------------------------------------------------- +# Location of the oznmon files is an adventure. The if case +# is the default gfs output location. Para runs are handled +# in the else condition +# +if [[ ${oznmon_file_loc} = "" ]]; then + data_location=${OZNSTAT_LOCATION}/oznmon +else + data_location=${oznmon_file_loc} + if [[ -d ${data_location}/${RUN}.${PDY} ]]; then + data_location=${data_location}/${RUN}.${PDY} + fi +fi + +export DATA_LOCATION=${data_location} +echo "DATA_LOCATION = ${DATA_LOCATION}" +nfile_src=`ls -l ${DATA_LOCATION}/time/*${PDATE}*ieee_d* | egrep -c '^-'` + +export OZNSTAT=${OZNSTAT_LOCATION}/${RUN}.t${CYC}z.oznstat + + +if [[ ${nfile_src} -gt 0 ]]; then + job=${OZN_DE_SCRIPTS}/oznmon_copy.sh + jobname=OznMon_CP_${OZNMON_SUFFIX} + logfile=${OZN_LOGdir}/CP.${PDY}.${CYC}.log + if [[ -e ${logfile} ]]; then + rm -f ${logfile} + fi + + + if [[ $MY_MACHINE = "wcoss_d" ]]; then + $SUB -q $JOB_QUEUE -P $PROJECT -o ${logfile} \ + -M 80 -R affinity[core] -W 0:10 -J ${jobname} -cwd ${PWD} ${job} + + elif [[ $MY_MACHINE = "wcoss_c" ]]; then + $SUB -q $JOB_QUEUE -P $PROJECT -o ${logfile} \ + -M 100 -W 0:20 -J ${jobname} -cwd ${PWD} ${job} + + elif [[ $MY_MACHINE = "hera" ]]; then + $SUB --account=${ACCOUNT} --time=10 -J ${jobname} -D . \ + -o ${logfile} --ntasks=1 --mem=5g ${job} + fi +else + echo "Unable to locate DATA_LOCATION: ${DATA_LOCATION}" + exit_value=4 +fi + + +echo end OznMon_CP.sh +exit ${exit_value} + diff --git a/util/Ozone_Monitor/data_xtrct/ush/OznMon_DE.sh b/util/Ozone_Monitor/data_xtrct/ush/OznMon_DE.sh index 268e347d52..abe0d3680c 100755 --- a/util/Ozone_Monitor/data_xtrct/ush/OznMon_DE.sh +++ b/util/Ozone_Monitor/data_xtrct/ush/OznMon_DE.sh @@ -1,4 +1,4 @@ -#!/bin/ksh +#!/bin/bash #-------------------------------------------------------------------- # usage @@ -6,10 +6,11 @@ function usage { echo "Usage: OznMon_DE.sh suffix [pdate]" echo " Suffix is the indentifier for this data source." - echo " -p | -pdate yyyymmddcc to specify the cycle to be processed" + echo " -p | --pdate yyyymmddcc to specify the cycle to be processed" echo " if unspecified the last available date will be processed" - echo " -r | -run the gdas|gfs run to be processed" + echo " -r | --run the gdas|gfs run to be processed" echo " use only if data in TANKdir stores both runs" + echo " -s | --ostat location of directory to oznstat files" echo " " } @@ -19,7 +20,7 @@ function usage { set -ax nargs=$# -if [[ $nargs -lt 1 || $nargs -gt 5 ]]; then +if [[ $nargs -lt 1 || $nargs -gt 7 ]]; then usage exit 1 fi @@ -34,13 +35,17 @@ do case $key in -p|--pdate) - export PDATE="$2" + pdate="$2" shift # past argument ;; -r|--run) export RUN="$2" shift # past argument ;; + -o|--ostat) + oznstat_dir="$2" + shift # past argument + ;; *) #any unspecified key is OZNMON_SUFFIX export OZNMON_SUFFIX=$key @@ -55,19 +60,10 @@ this_dir=`dirname $0` echo "OZNMON_SUFFIX = $OZNMON_SUFFIX" echo "RUN = $RUN" -echo "PDATE = $PDATE" +echo "pdate = $pdate" top_parm=${this_dir}/../../parm -oznmon_version_file=${oznmon_version:-${top_parm}/OznMon.ver} -if [[ -s ${oznmon_version_file} ]]; then - . ${oznmon_version_file} - echo "able to source ${oznmon_version_file}" -else - echo "Unable to source ${oznmon_version_file} file" - exit 2 -fi - oznmon_user_settings=${oznmon_user_settings:-${top_parm}/OznMon_user_settings} if [[ -s ${oznmon_user_settings} ]]; then . ${oznmon_user_settings} @@ -100,12 +96,12 @@ fi #-------------------------------------------------------------- # Determine next cycle -# If PDATE wasn't an argument then call find_cycle.pl -# to determine the last processed cycle, and set PDATE to +# If pdate wasn't an argument then call find_cycle.pl +# to determine the last processed cycle, and set pdate to # the next cycle #-------------------------------------------------------------- -if [[ ${#PDATE} -le 0 ]]; then - echo "PDATE not specified: setting PDATE using last cycle" +if [[ ${#pdate} -le 0 ]]; then + echo "pdate not specified: setting pdate using last cycle" if [[ -d ${OZN_DE_SCRIPTS} ]]; then echo "good: $OZN_DE_SCRIPTS" else @@ -117,17 +113,22 @@ if [[ ${#PDATE} -le 0 ]]; then date=`${OZN_DE_SCRIPTS}/find_cycle.pl -run gdas -cyc 1 -dir ${OZN_STATS_TANKDIR}` echo "date = $date" - export PDATE=`$NDATE +6 $date` + pdate=`$NDATE +6 $date` else - echo "PDATE was specified: $PDATE" + echo "pdate was specified: $pdate" fi +export PDATE=${pdate} export PDY=`echo $PDATE|cut -c1-8` export cyc=`echo $PDATE|cut -c9-10` mdate=`$NDATE -24 $PDATE` -PDYm1=`echo $mdate|cut -c1-8` -echo "PDY, cyc, PDYm1 = $PDY, $cyc $PDYm1" +PDYm1=`echo ${mdate}|cut -c1-8` +cycm1=`echo ${mdate}|cut -c9-10` +echo "PDY, cyc, PDYm1 = ${PDY}, ${cyc} ${PDYm1}" + +export TANKverf_ozn=${OZN_TANKDIR}/${RUN}.${PDY}/${cyc}/oznmon +export TANKverf_oznM1=${OZN_TANKDIR}/${RUN}.${PDYm1}/${cycm1}/oznmon pid=${pid:-$$} @@ -150,11 +151,15 @@ export jobid=${jobid:-${job}.${cyc}.${pid}} export COMROOT=${PTMP_USER} #------------------------------------------------------------- -# This is default for wcoss/cray machines. Need to reset -# COM_IN in parm files for hera. +# Set COM_IN to default or input value. # -export COM_IN=${COM_IN:-/gpfs/hps/nco/ops/com/gfs/prod} +if [ ${#oznstat_dir} -gt 0 ]; then + com_in=${oznstat_dir} +else + com_in=${COM_IN:-/gpfs/dell1/nco/ops/com/gfs/prod} +fi +export COM_IN=${com_in} export COMROOT=${COMROOT:-/${PTMP_USER}} @@ -176,7 +181,7 @@ echo "gdas_oznmon_ver = $gdas_oznmon_ver" echo "shared_oznmon_ver = $shared_oznmon_ver" echo "ACCOUNT = $ACCOUNT" -jobfile=${jobfile:-${HOMEgdas_ozn}/jobs/JGDAS_VERFOZN} +jobfile=${jobfile:-${HOMEgdas_ozn}/jobs/JGDAS_ATMOS_VERFOZN} echo "jobfile = $jobfile" #------------------------------------------------------------- @@ -185,8 +190,8 @@ echo "jobfile = $jobfile" #if [[ $GLB_AREA -eq 0 ]]; then # jobfile=${jobfile:-${HOMEnam}/jobs/JNAM_VERFOZN} #else - jobfile=${jobfile:-${HOMEgdas_ozn}/jobs/JGDAS_VERFOZN} - echo "jobfile = $jobfile" +# jobfile=${jobfile:-${HOMEgdas_ozn}/jobs/JGDAS_ATMOS_VERFOZN} +# echo "jobfile = $jobfile" #fi @@ -210,13 +215,6 @@ if [[ $MY_MACHINE = "hera" ]]; then --ntasks=1 --mem=5g \ ${jobfile} -elif [[ $MY_MACHINE = "wcoss" ]]; then - - $SUB -q $JOB_QUEUE -P $PROJECT -M 50 -R affinity[core] \ - -o ${OZN_LOGdir}/DE.${PDY}.${cyc}.log \ - -e ${OZN_LOGdir}/DE.${PDY}.${cyc}.err \ - -W 0:05 -J ${job} -cwd ${PWD} $jobfile - elif [[ $MY_MACHINE = "wcoss_d" ]]; then $SUB -q $JOB_QUEUE -P $PROJECT -M 400 -R affinity[core] \ @@ -224,7 +222,7 @@ elif [[ $MY_MACHINE = "wcoss_d" ]]; then -e ${OZN_LOGdir}/DE.${PDY}.${cyc}.err \ -W 0:05 -J ${job} -cwd ${PWD} $jobfile -elif [[ $MY_MACHINE = "cray" ]]; then +elif [[ $MY_MACHINE = "wcoss_c" ]]; then $SUB -q $JOB_QUEUE -P $PROJECT -o ${OZN_LOGdir}/DE.${PDY}.${cyc}.log \ -e ${OZN_LOGdir}/DE.${PDY}.${cyc}.err \ diff --git a/util/Ozone_Monitor/data_xtrct/ush/find_cycle.pl b/util/Ozone_Monitor/data_xtrct/ush/find_cycle.pl index 165e4cca64..069dae672c 100755 --- a/util/Ozone_Monitor/data_xtrct/ush/find_cycle.pl +++ b/util/Ozone_Monitor/data_xtrct/ush/find_cycle.pl @@ -4,12 +4,12 @@ # find_cycle.pl # # Arguments: -# --dir : Required string value containing $TANKdir/$SUFFIX. -# --cyc : Optional integer value: +# -dir : Required string value containing $TANKdir/$SUFFIX. +# -cyc : Optional integer value: # 1 = last cycle (default) # 2 = 2nd to last cycle # 0 = first cycle -# --run : Run name, generally 'gdas' or 'gfs'. +# -run : Run name, generally 'gdas' or 'gfs'. # If not specified 'gdas' will be used. # # Return that first/last cycle as a text string in YYYYMMDDHH format, @@ -135,7 +135,10 @@ $hr_ctr = $hr_ctr - 1; - $newdir = "${dirpath}/${sortmm[$ctr]}/${hrs[$hr_ctr]}/oznmon/time"; + $newdir = "${dirpath}/${sortmm[$ctr]}/${hrs[$hr_ctr]}/atmos/oznmon/time"; + if( ! -d $newdir ) { + $newdir = "${dirpath}/${sortmm[$ctr]}/${hrs[$hr_ctr]}/oznmon/time"; + } if( -d $newdir ) { opendir DIR, $newdir or die "Cannot open the current directory: $!"; @@ -179,7 +182,7 @@ } } - } + } } while $hr_ctr > 0 && $found_cycle == 0; diff --git a/util/Ozone_Monitor/data_xtrct/ush/oznmon_copy.sh b/util/Ozone_Monitor/data_xtrct/ush/oznmon_copy.sh new file mode 100755 index 0000000000..0919aa3907 --- /dev/null +++ b/util/Ozone_Monitor/data_xtrct/ush/oznmon_copy.sh @@ -0,0 +1,171 @@ +#!/bin/bash + +#-------------------------------------------------------------------- +# oznmon_copy.sh +# +# This script is run as a submitted job by OznMon_CP.sh and +# should not be run directly. +# +# This script searches for new radmon output and copies those +# filess to the user's $TANKDIR directory under the specified +# suffix argument. +# +# The bad_penalty, low count, and missing diag reports are +# reevaluated using local copies of the base file and satype +# files in the $TANKdir/$suffix/info directory. +# +# Note that processing occurs within TANKdir, not in stmp space. +# +# The unified error report is journaled to warning.${PDY}${CYC}. +# +#-------------------------------------------------------------------- + + +echo "" +echo "--> oznmon_copy.sh" +echo "" +echo "OZNMON_SUFFIX = $OZNMON_SUFFIX" +echo "PDATE = $PDATE" +echo "RUN = $RUN" +echo "DATA_LOCATION = ${DATA_LOCATION}" + +exit_value=0 +monitor=oznmon + +set -ax + +prev=`$NDATE -06 $PDATE` +prev_day=`echo $prev|cut -c1-8` +prev_cyc=`echo $prev|cut -c9-10` + +echo prev_day, prev_cyc = $prev_day, $prev_cyc + +dest_dir=${OZN_STATS_TANKDIR}/${RUN}.${PDY}/${CYC}/oznmon +echo "dest_dir = ${dest_dir}" +satype_file=${OZN_STATS_TANKDIR}/info/${RUN}_oznmon_satype.txt + +if [[ ! -s ${satype_file} ]]; then + satype_file=${FIXgdas_ozn}/gdas_oznmon_satype.txt +fi + +if [[ ! -s ${satype_file} ]]; then + echo "WARNING: unable to locate ${satype_file}" +else + satype_list=`cat ${satype_file}` +fi + + +#--------------------------------------------------- +# Check the number of files available to copy +# and the number of files < 30 min old. Abort the +# copy if any files are < 30 min old. This avoids +# incomplete results which can result in false +# 'drop out' plots. +# + +subdir_list="horiz time" +for sub in ${subdir_list}; do + nfile_src=`ls -l ${DATA_LOCATION}/${sub}/*${PDATE}*ieee_d* | egrep -c '^-'` + echo "nfile_src = ${nfile_src}" + + nfile_thirty=`find ${DATA_LOCATION}/${sub}/*${PDATE}*ieee_d* -maxdepth 0 -mmin -30` + echo "nfile_thirty = ${nfile_thirty}" + + if [[ ${nfile_src} -le 0 ]]; then + exit_value=5 + exit + elif [[ ${nfile_thirty} != "" ]]; then + exit_value=4 + exit + fi +done + +if [[ ${exit_value} -eq 0 ]]; then + if [[ ! -d ${dest_dir} ]]; then + mkdir -p ${dest_dir} + fi + cd ${dest_dir} + + + for sub in ${subdir_list}; do + + mkdir -p ${dest_dir}/${sub} + + $NCP ${DATA_LOCATION}/${sub}/*${PDATE}.ieee_d* ${dest_dir}/${sub}/. + $NCP ${DATA_LOCATION}/${sub}/*.ctl* ${dest_dir}/${sub}/. + if [[ ${sub} = "time" ]]; then + $NCP ${DATA_LOCATION}/${sub}/bad*${PDATE}* ${dest_dir}/${sub}/. + fi + done + + + if [[ $DO_DATA_RPT -eq 1 && ${#satype_list} -gt 0 ]]; then + + #------------------------------------------------------------------- + # re-run the bad_diag report + # 1. Rm any existing bad_diag file. + # 2. Get the contents of the SATYPE list in this order: + # $OZN_TANKdir/$SUFFIX/info/gdas_oznmon_satype.txt + # $GDAS_OZNMON/fix/gdas/oznmon_satype.txt + # 3. Get contents of oznstat file & strip to sat/instr. + # 4. Compare satype list to oznstat contents; report missing. + # + bad_diag=${dest_dir}/time/bad_diag.${PDATE} + if [[ -e ${bad_diag} ]]; then + rm ${bad_diag} + fi + + oznstat_files=`tar -tf ${OZNSTAT}` + #------------------------------------------------------------------------- + # Diag files are in this format: + # diag_gome_metop-a_ges.2021040506.nc4.gz + # diag_gome_metop-a_anl.2021040506.nc4.gz + # + # Select only the 'ges' files and reduce them to: + # gome_metop-a + # + for file in ${oznstat_files}; do + if [[ "${file}" == *"ges"* ]]; then + sat=`echo ${file} | cut -d. -f1` + sat="$( cut -d '_' -f2- <<< "${sat}" )"; + sat=`echo ${sat} | rev | cut -d"_" -f2- | rev` + + oznstat_list="${oznstat_list} ${sat}" + fi + done + + + if [[ ${#oznstat_list} -gt 0 ]]; then + + diag_rpt="diag_rpt.txt" + echo '' > ${diag_rpt} + + for sat in ${satype_list}; do + test=`echo ${oznstat_list} | grep ${sat}` + echo "test length = ${#test}" + + if [[ "${#test}" -eq 0 ]]; then + echo " missing diag file -- diag_${sat}.${PDATE} not found" >> ${diag_rpt} + fi + done + + diag_test=`cat ${diag_rpt}` + if [[ ${#diag_test} -gt 0 ]]; then + mv ${diag_rpt} ${bad_diag} + fi + + if [[ -e ${diag_rpt} ]]; then + rm ${diag_rpt} + fi + fi + + fi # DO_DATA_REPORT + + +fi # exit value != 0 + +echo "" +echo "<-- oznmon_copy.sh" +echo "" +exit ${exit_value} + diff --git a/util/Ozone_Monitor/data_xtrct/ush/run_GEOIRctl3.sh b/util/Ozone_Monitor/data_xtrct/ush/run_GEOIRctl3.sh deleted file mode 100755 index 7f117456eb..0000000000 --- a/util/Ozone_Monitor/data_xtrct/ush/run_GEOIRctl3.sh +++ /dev/null @@ -1,71 +0,0 @@ -#!/bin/sh - -set -xa - -OZN_SUFFIX=GEOIRctl3 -run=gdas - -NET=gfs -envir=prod - -MY_MACHINE=wcoss_d -package="ProdGSI/util/Ozone_Monitor" -#package="OznMon" - -if [[ $MY_MACHINE = "cray" ]]; then - . /opt/modules/3.2.6.7/init/sh - module use -a /gpfs/hps/nco/ops/nwprod/modulefiles - module load prod_util -elif [[ $MY_MACHINE = "wcoss" ]]; then - shell=sh - . /usrx/local/Modules/default/init/${shell} - module load prod_util -elif [[ $MY_MACHINE = "wcoss_d" ]]; then - shell=sh - . /usrx/local/prod/modules/default/init/${shell} - module load prod_util/1.1.0 - MODULEPATH=/usrx/local/prod/lmod/lmod/modulefiles/Core - MODULEPATH=${MODULEPATH}:/usrx/local/prod/modulefiles/core_third - MODULEPATH=${MODULEPATH}:/usrx/local/prod/modulefiles/defs - MODULEPATH=${MODULEPATH}:/gpfs/dell1/nco/ops/nwprod/modulefiles/core_prod - export MODULEPATH=${MODULEPATH}:/usrx/local/dev/modulefiles -fi - - -if [[ $MY_MACHINE = "theia" ]]; then - scripts=/scratch4/NCEPDEV/da/noscrub/Edward.Safford/ProdGSI/util/Ozone_Monitor/data_xtrct/ush -elif [[ $MY_MACHINE = "wcoss" ]]; then - scripts=/gpfs/gd2/emc/da/noscrub/Edward.Safford/${package}/data_xtrct/ush -elif [[ $MY_MACHINE = "wcoss_d" ]]; then - scripts=/gpfs/dell2/emc/modeling/noscrub/Edward.Safford/ProdGSI/util/Ozone_Monitor/data_xtrct/ush -elif [[ $MY_MACHINE = "cray" ]]; then - scripts=/gpfs/hps3/emc/da/noscrub/Edward.Safford/ProdGSI/util/Ozone_Monitor/data_xtrct/ush -fi - -idate=`${scripts}/find_cycle.pl -dir ~/nbns/stats/${OZN_SUFFIX} -cyc 1 -run ${run}` -echo "idate = $idate" - -export NDATE=/gpfs/dell1/nco/ops/nwprod/prod_util.v1.1.1/exec/ips/ndate -export START_DATE=2019052006 -#START_DATE=`${NDATE} +06 $idate` - -PDY=`echo $START_DATE | cut -c1-8` -cyc=`echo $START_DATE | cut -c9-10` - - -#export COM_IN=/gpfs/dell1/nco/ops/com/${NET}/${envir}/${run}.${PDY}/${cyc} -export COM_IN=/gpfs/dell3/ptmp/Haixia.Liu/ROTDIRS/prfv3_GEOIRctl3/${run}.${PDY}/${cyc} - -export oznstat=${COM_IN}/${run}.t${cyc}z.oznstat - -export OZN_TANKDIR=/u/${LOGNAME}/nbns - -log=/gpfs/dell2/ptmp/Edward.Safford/logs/${OZN_SUFFIX}/${run}/oznmon/OznMon_DE.log -#log=/ptmpd1/Edward.Safford/logs/${OZN_SUFFIX}/${run}/oznmon/OznMon_DE.log -#log=./log - -#err=/ptmpd1/Edward.Safford/logs/${OZN_SUFFIX}/${run}/oznmon/OznMon_DE.err -err=/gpfs/dell2/ptmp/Edward.Safford/logs/${OZN_SUFFIX}/${run}/oznmon/OznMon_DE.err -#err=./err - -${scripts}/OznMon_DE.sh $OZN_SUFFIX -p $START_DATE -r gdas 1>$log 2>$err diff --git a/util/Ozone_Monitor/data_xtrct/ush/run_GEOIRimg4.sh b/util/Ozone_Monitor/data_xtrct/ush/run_GEOIRimg4.sh deleted file mode 100755 index 5b9160ee74..0000000000 --- a/util/Ozone_Monitor/data_xtrct/ush/run_GEOIRimg4.sh +++ /dev/null @@ -1,72 +0,0 @@ -#!/bin/sh - -set -xa - -OZN_SUFFIX=GEOIRimg4 -run=gdas - -NET=gfs -envir=prod - -MY_MACHINE=wcoss_d -package="ProdGSI/util/Ozone_Monitor" -#package="OznMon" - -if [[ $MY_MACHINE = "cray" ]]; then - . /opt/modules/3.2.6.7/init/sh - module use -a /gpfs/hps/nco/ops/nwprod/modulefiles - module load prod_util -elif [[ $MY_MACHINE = "wcoss" ]]; then - shell=sh - . /usrx/local/Modules/default/init/${shell} - module load prod_util -elif [[ $MY_MACHINE = "wcoss_d" ]]; then - shell=sh - . /usrx/local/prod/modules/default/init/${shell} - module load prod_util/1.1.0 - MODULEPATH=/usrx/local/prod/lmod/lmod/modulefiles/Core - MODULEPATH=${MODULEPATH}:/usrx/local/prod/modulefiles/core_third - MODULEPATH=${MODULEPATH}:/usrx/local/prod/modulefiles/defs - MODULEPATH=${MODULEPATH}:/gpfs/dell1/nco/ops/nwprod/modulefiles/core_prod - export MODULEPATH=${MODULEPATH}:/usrx/local/dev/modulefiles -fi - - -if [[ $MY_MACHINE = "theia" ]]; then - scripts=/scratch4/NCEPDEV/da/noscrub/Edward.Safford/ProdGSI/util/Ozone_Monitor/data_xtrct/ush -elif [[ $MY_MACHINE = "wcoss" ]]; then - scripts=/gpfs/gd2/emc/da/noscrub/Edward.Safford/${package}/data_xtrct/ush -elif [[ $MY_MACHINE = "wcoss_d" ]]; then - scripts=/gpfs/dell2/emc/modeling/noscrub/Edward.Safford/ProdGSI/util/Ozone_Monitor/data_xtrct/ush -elif [[ $MY_MACHINE = "cray" ]]; then - scripts=/gpfs/hps3/emc/da/noscrub/Edward.Safford/ProdGSI/util/Ozone_Monitor/data_xtrct/ush -fi - -idate=`${scripts}/find_cycle.pl -dir ~/nbns/stats/${OZN_SUFFIX} -cyc 1 -run ${run}` -echo "idate = $idate" - -export NDATE=/gpfs/dell1/nco/ops/nwprod/prod_util.v1.1.1/exec/ips/ndate -#export START_DATE=2019062812 -START_DATE=`${NDATE} +06 $idate` - -PDY=`echo $START_DATE | cut -c1-8` -cyc=`echo $START_DATE | cut -c9-10` - - -#export COM_IN=/gpfs/dell1/nco/ops/com/${NET}/${envir}/${run}.${PDY}/${cyc} -export COM_IN=/gpfs/dell3/ptmp/Haixia.Liu/ROTDIRS/prfv3_${OZN_SUFFIX}/${run}.${PDY}/${cyc} - -export oznstat=${COM_IN}/${run}.t${cyc}z.oznstat - -export OZN_TANKDIR=/u/${LOGNAME}/nbns -export OZNMON_NEW_HDR=1 - -log=/gpfs/dell2/ptmp/Edward.Safford/logs/${OZN_SUFFIX}/${run}/oznmon/OznMon_DE.log -#log=/ptmpd1/Edward.Safford/logs/${OZN_SUFFIX}/${run}/oznmon/OznMon_DE.log -#log=./log - -#err=/ptmpd1/Edward.Safford/logs/${OZN_SUFFIX}/${run}/oznmon/OznMon_DE.err -err=/gpfs/dell2/ptmp/Edward.Safford/logs/${OZN_SUFFIX}/${run}/oznmon/OznMon_DE.err -#err=./err - -${scripts}/OznMon_DE.sh $OZN_SUFFIX -p $START_DATE -r gdas 1>$log 2>$err diff --git a/util/Ozone_Monitor/data_xtrct/ush/run_gfs_gdas.sh b/util/Ozone_Monitor/data_xtrct/ush/run_gfs_gdas.sh index 92bbaec9ea..37c2475cca 100755 --- a/util/Ozone_Monitor/data_xtrct/ush/run_gfs_gdas.sh +++ b/util/Ozone_Monitor/data_xtrct/ush/run_gfs_gdas.sh @@ -12,14 +12,10 @@ MY_MACHINE=wcoss_d package="ProdGSI/util/Ozone_Monitor" #package="OznMon" -if [[ $MY_MACHINE = "cray" ]]; then +if [[ $MY_MACHINE = "wcoss_c" ]]; then . /opt/modules/3.2.6.7/init/sh module use -a /gpfs/hps/nco/ops/nwprod/modulefiles module load prod_util -elif [[ $MY_MACHINE = "wcoss" ]]; then - shell=sh - . /usrx/local/Modules/default/init/${shell} - module load prod_util elif [[ $MY_MACHINE = "wcoss_d" ]]; then shell=sh . /usrx/local/prod/modules/default/init/${shell} @@ -34,11 +30,9 @@ fi if [[ $MY_MACHINE = "hera" ]]; then scripts=/scratch4/NCEPDEV/da/noscrub/Edward.Safford/ProdGSI/util/Ozone_Monitor/data_xtrct/ush -elif [[ $MY_MACHINE = "wcoss" ]]; then - scripts=/gpfs/gd2/emc/da/noscrub/Edward.Safford/${package}/data_xtrct/ush elif [[ $MY_MACHINE = "wcoss_d" ]]; then scripts=/gpfs/dell2/emc/modeling/noscrub/Edward.Safford/ProdGSI/util/Ozone_Monitor/data_xtrct/ush -elif [[ $MY_MACHINE = "cray" ]]; then +elif [[ $MY_MACHINE = "wcoss_c" ]]; then scripts=/gpfs/hps3/emc/da/noscrub/Edward.Safford/ProdGSI/util/Ozone_Monitor/data_xtrct/ush fi diff --git a/util/Ozone_Monitor/get_hostname.pl b/util/Ozone_Monitor/get_hostname.pl index 8d2d6d5b95..145b3a91c5 100755 --- a/util/Ozone_Monitor/get_hostname.pl +++ b/util/Ozone_Monitor/get_hostname.pl @@ -4,22 +4,17 @@ # get_hostname.pl # # This script determines the hostname of the current machine. The -# possiblities are cray, theia, wcoss or "" if the host is not +# possiblities are wcoss_c, wcoss_d, hera, or "" if the host is not # one of those three. #------------------------------------------------------------------- -# my $arch; -# $arch = ` uname -s | tr '[:upper:]' '[:lower:]' `; -# $arch =~ s/^\s+|\s+$//g; -# my $my_os = "export MY_OS=$arch"; - my $machine = ""; # # hera login nodes are hfe1-hfeN, and hostname command only returns the node name, # while wcoss_c and wcoss_d return [hostname].ncep.noaa.gov. Keep only the - # actual hostname and see if it matches the node names for hera, wcoss_d, or cray. + # actual hostname and see if it matches the node names for hera, wcoss_d, or wcoss_c. # my $host = ""; $host = ` hostname `; @@ -34,10 +29,7 @@ $machine = "hera"; } elsif( $host =~ /login/ ) { - $machine = "cray"; - } - elsif( $host =~ /t/ || $host =~ /g/ ){ # wcoss nodes are tXXaY and gXXaY - $machine = "wcoss"; + $machine = "wcoss_c"; } elsif( $host =~ /v/ || $host =~ /m/ ){ # wcoss_d nodes are vXXaY and mXXaY $machine = "wcoss_d"; diff --git a/util/Ozone_Monitor/image_gen/ush/OznMon_Plt.sh b/util/Ozone_Monitor/image_gen/ush/OznMon_Plt.sh index 4b0bbec701..4c922f8a2e 100755 --- a/util/Ozone_Monitor/image_gen/ush/OznMon_Plt.sh +++ b/util/Ozone_Monitor/image_gen/ush/OznMon_Plt.sh @@ -11,13 +11,13 @@ # # OZNMON_SUFFIX = data source identifier which matches data # in the TANKverf/stats directory. -# -p --pdate = specified cycle to plot. If not specified the +# -p|--pdate = specified cycle to plot. If not specified the # last available date will be plotted. -# -r --run = $RUN value, gdas|gfs, default is gdas. -# -c1|--comp1 = define first source to plot as comparison (time -# series plots only) -# -c2|--comp2 = define second source to plot as comparison (time -# series plots only) +# -r|--run = $RUN value, gdas|gfs, default is gdas. +# -c1|--comp1 = define first instrument/sat source to plot as comparison +# (applies to time series plots only) +# -c2|--comp2 = define second instrument/sat source to plot as comparison +# (applies to time series plots only) # # NOTE: Both COMP1 and COMP2 have to be defined to # generate comparison plots as part of the COMP1 @@ -52,7 +52,7 @@ do case $key in -p|--pdate) - PDATE="$2" + pdate="$2" shift # past argument ;; -r|--run) @@ -96,7 +96,7 @@ if [[ ${#RUN} -le 0 ]]; then fi echo "OZNMON_SUFFIX = $OZNMON_SUFFIX" -echo "PDATE = $PDATE" +echo "pdate = $pdate" echo "RUN = $RUN" @@ -115,15 +115,6 @@ this_dir=`dirname $0` top_parm=${this_dir}/../../parm -oznmon_version_file=${oznmon_version:-${top_parm}/OznMon.ver} -if [[ -s ${oznmon_version_file} ]]; then - . ${oznmon_version_file} - echo "able to source ${oznmon_version_file}" -else - echo "Unable to source ${oznmon_version_file} file" - exit 2 -fi - oznmon_user_settings=${oznmon_user_settings:-${top_parm}/OznMon_user_settings} if [[ -s ${oznmon_user_settings} ]]; then . ${oznmon_user_settings} @@ -172,63 +163,101 @@ fi #-------------------------------------------------------------------- -# If PDATE wasn't specified as an argument then plot the last -# available cycle. +# Determine cycle to plot. Exit if cycle is > last available +# data. +# +# PDATE can be set one of 3 ways. This is the order of priority: +# +# 1. Specified via command line argument +# 2. Read from ${OZN_IMGN_TANKbase}/last_plot_time file and +# advanced one cycle. +# 3. Using the last available cycle for which there is +# data in ${TANKDIR}. +# +# If option 2 has been used the ${IMGNDIR}/last_plot_time file +# will be updated with ${PDATE} if the plot is able to run. #-------------------------------------------------------------------- -if [[ ${#PDATE} -le 0 ]]; then - echo "PDATE not specified: setting PDATE using last cycle" - PDATE=`${OZN_IG_SCRIPTS}/find_cycle.pl -run ${RUN} -cyc 1 -dir ${TANKDIR}` -else - echo "PDATE was specified: $PDATE" -fi -export PDATE=$PDATE -export PDY=`echo $PDATE|cut -c1-8` -export cyc=`echo $PDATE|cut -c9-10` +echo "OZN_IMGN_TANKbase = ${OZN_IMGN_TANKbase}" +last_plot_time=${OZN_IMGN_TANKbase}/${RUN}/oznmon/last_plot_time +echo "last_plot_time file = ${last_plot_time}" -#-------------------------------------------------------------------- -# Create the WORKDIR and link the data files to it -#-------------------------------------------------------------------- -export WORKDIR=${STMP_USER}/${OZNMON_SUFFIX}/${RUN}/oznmon/IG.${PDY}.${cyc} -if [[ -d $WORKDIR ]]; then - rm -rf $WORKDIR +latest_data=`${OZN_IG_SCRIPTS}/find_cycle.pl -run gdas -cyc 1 -dir ${OZN_STATS_TANKDIR}` + +if [[ ${#pdate} -le 0 ]]; then + if [[ -e ${last_plot_time} ]]; then + echo " USING last_plot_time file" + last_plot=`cat ${last_plot_time}` + pdate=`$NDATE +6 ${last_plot}` + else + echo " USING find_cycle file" + pdate=${latest_data} + fi fi -mkdir $WORKDIR -cd $WORKDIR -#-------------------------------------------------------------------- -# Plot scripts are plot_time.sh and plot_horiz.sh. The plot_time.sh -# script calls plot_summary.sh. The plot_time & plot_horiz are -# submitted jobs. -# -# All plot_* scripts call transfer.sh. We'll handle that like the -# other monitors. -#-------------------------------------------------------------------- +echo "pdate, latest_data = ${pdate} ${latest_data}" -#-------------------------------------------------------------------- -# export SATYPE -# -# For the moment we can just load the -# gdas.v2.0.0/fix/gdas_oznmon_satype.txt file. Eventually DE will -# need to compare actual files vs this list (or an updated one in -# TANKDIR/info like RadMon. -# -# Update the search order to use the local copy in $TANKDIR/info -# if available. -#-------------------------------------------------------------------- -if [[ -e ${TANKDIR}/info/gdas_oznmon_satype.txt ]]; then - export SATYPE=${SATYPE:-`cat ${TANKDIR}/info/${RUN}_oznmon_satype.txt`} -else - export SATYPE=${SATYPE:-`cat ${HOMEgdas_ozn}/fix/${RUN}_oznmon_satype.txt`} -fi +if [[ ${pdate} -le ${latest_data} ]]; then + echo " proceeding with plot" + + export PDATE=$pdate + export PDY=`echo $PDATE|cut -c1-8` + export cyc=`echo $PDATE|cut -c9-10` + + #-------------------------------------------------------------------- + # Create the WORKDIR and link the data files to it + #-------------------------------------------------------------------- + export WORKDIR=${STMP_USER}/${OZNMON_SUFFIX}/${RUN}/oznmon/IG.${PDY}.${cyc} + if [[ -d $WORKDIR ]]; then + rm -rf $WORKDIR + fi + mkdir $WORKDIR + cd $WORKDIR + + #-------------------------------------------------------------------- + # Plot scripts are plot_time.sh and plot_horiz.sh. The plot_time.sh + # script calls plot_summary.sh. The plot_time & plot_horiz are + # submitted jobs. + # + # All plot_* scripts call transfer.sh. We'll handle that like the + # other monitors. + #-------------------------------------------------------------------- + + if [[ -e ${TANKDIR}/info/gdas_oznmon_satype.txt ]]; then + export SATYPE=${SATYPE:-`cat ${TANKDIR}/info/${RUN}_oznmon_satype.txt`} + else + export SATYPE=${SATYPE:-`cat ${HOMEgdas_ozn}/fix/${RUN}_oznmon_satype.txt`} + fi + + + ${OZN_IG_SCRIPTS}/mk_horiz.sh + ${OZN_IG_SCRIPTS}/mk_time.sh + ${OZN_IG_SCRIPTS}/mk_summary.sh + + if [[ $DO_DATA_RPT -eq 1 ]]; then + ${OZN_IG_SCRIPTS}/mk_err_rpt.sh + fi + + #-------------------------------------------------------------------- + # Update the last_plot_time file if found + #-------------------------------------------------------------------- + if [[ -e ${last_plot_time} ]]; then + echo "update last_plot_time file" + echo ${PDATE} > ${last_plot_time} + fi -${OZN_IG_SCRIPTS}/mk_horiz.sh -${OZN_IG_SCRIPTS}/mk_time.sh -${OZN_IG_SCRIPTS}/mk_summary.sh + #-------------------------------------------------------------------- + # Remove all but the last 30 cycles worth of data image files. + # + # This is not currently necessary -- the OznMon doesn't make any + # time-stampped plots. But it's here (borrowed from the RadMon) + # to meet that contingency. + #-------------------------------------------------------------------- + #${OZN_IG_SCRIPTS}/rm_img_files.pl --dir ${OZN_IMGN_TANKDIR} --nfl 30 -if [[ $DO_DATA_RPT -eq 1 ]]; then - ${OZN_IG_SCRIPTS}/mk_err_rpt.sh +else + echo "unable to plot" fi echo "end OznMon_Plt.sh" diff --git a/util/Ozone_Monitor/image_gen/ush/OznMon_Transfer.sh b/util/Ozone_Monitor/image_gen/ush/OznMon_Transfer.sh index 22eecc2f4a..4a9bb5602c 100755 --- a/util/Ozone_Monitor/image_gen/ush/OznMon_Transfer.sh +++ b/util/Ozone_Monitor/image_gen/ush/OznMon_Transfer.sh @@ -48,18 +48,6 @@ fi echo "OZNMON_SUFFIX, RUN = $OZNMON_SUFFIX, $RUN" -#-------------------------------------------------------------------- -# Check for my monitoring use. Abort if running on prod machine. -#-------------------------------------------------------------------- - -if [[ $RUN_ONLY_ON_DEV -eq 1 ]]; then - is_prod=`${OZN_IG_SCRIPTS}/onprod.sh` - if [[ $is_prod = 1 ]]; then - exit 10 - fi -fi - - #-------------------------------------------------- # source verison, config, and user_settings files #-------------------------------------------------- @@ -68,15 +56,6 @@ this_dir=`dirname $0` top_parm=${this_dir}/../../parm -oznmon_version_file=${oznmon_version:-${top_parm}/OznMon.ver} -if [[ -s ${oznmon_version_file} ]]; then - . ${oznmon_version_file} - echo "able to source ${oznmon_version_file}" -else - echo "Unable to source ${oznmon_version_file} file" - exit 2 -fi - oznmon_user_settings=${oznmon_user_settings:-${top_parm}/OznMon_user_settings} if [[ -s ${oznmon_user_settings} ]]; then . ${oznmon_user_settings} @@ -112,12 +91,9 @@ fi transfer_script=${OZN_IG_SCRIPTS}/transfer.sh job=${OZNMON_SUFFIX}_ozn_transfer -if [[ $MY_MACHINE = "wcoss" || $MY_MACHINE = "wcoss_d" ]]; then +if [[ $MY_MACHINE = "wcoss_d" || $MY_MACHINE = "wcoss_c" ]]; then - job_queue="transfer" - if [[ $MY_MACHINE = "wcoss_d" ]]; then - job_queue="dev_transfer" - fi + job_queue="dev_transfer" echo "PROJECT = $PROJECT" echo "logf = $logf" @@ -128,18 +104,6 @@ if [[ $MY_MACHINE = "wcoss" || $MY_MACHINE = "wcoss_d" ]]; then -R affinity[core] -J ${job} -cwd ${OZN_IG_SCRIPTS} \ ${transfer_script} -elif [[ $MY_MACHINE = "cray" ]]; then - - echo "" -# ${OZN_IG_SCRIPTS}/transfer.sh ${OZNMON_SUFFIX} \ -# 1>${logf} 2> ${errf} - - ${OZN_IG_SCRIPTS}/transfer.sh 1>${logf} 2> ${errf} - -# $SUB -q ${JOB_QUEUE} -P ${PROJECT} -o ${logf} -e ${errf} \ -# -R "select[mem>100] rusage[mem=100]" \ -# -M 100 -W 0:05 -J ${job} -cwd ${OZN_IG_SCRIPTS} ${transfer_script} - fi exit diff --git a/util/Ozone_Monitor/image_gen/ush/mk_err_rpt.sh b/util/Ozone_Monitor/image_gen/ush/mk_err_rpt.sh index de8f8d8eb9..99039af677 100755 --- a/util/Ozone_Monitor/image_gen/ush/mk_err_rpt.sh +++ b/util/Ozone_Monitor/image_gen/ush/mk_err_rpt.sh @@ -78,21 +78,12 @@ hyperlink_base="http://www.emc.ncep.noaa.gov/gmb/gdas/es_ozn/index.html?" if [[ "$standalone" -eq 1 ]]; then #-------------------------------------------------- - # source verison, config, and user_settings files + # source config and user_settings files #-------------------------------------------------- this_dir=`dirname $0` top_parm=${this_dir}/../../parm - oznmon_version_file=${oznmon_version:-${top_parm}/OznMon.ver} - if [[ -s ${oznmon_version_file} ]]; then - . ${oznmon_version_file} - echo "able to source ${oznmon_version_file}" - else - echo "Unable to source ${oznmon_version_file} file" - exit 2 - fi - oznmon_user_settings=${oznmon_user_settings:-${top_parm}/OznMon_user_settings} if [[ -s ${oznmon_user_settings} ]]; then . ${oznmon_user_settings} @@ -233,7 +224,6 @@ if [[ -s $bad_cnt || -s $bad_diag || -s $bad_pen ]]; then link="${link}&stat=${stat}" link="${link}&src=${OZNMON_SUFFIX}/${RUN}" -# echo "link = $link" if [[ ${#test} -gt 0 ]]; then @@ -361,4 +351,3 @@ fi echo end mk_err_rpt.sh -#exit( $err ) diff --git a/util/Ozone_Monitor/image_gen/ush/mk_horiz.sh b/util/Ozone_Monitor/image_gen/ush/mk_horiz.sh index 9a23c4a388..9d91165ab4 100755 --- a/util/Ozone_Monitor/image_gen/ush/mk_horiz.sh +++ b/util/Ozone_Monitor/image_gen/ush/mk_horiz.sh @@ -79,18 +79,12 @@ for dsrc in ${data_source}; do fi - if [[ ${MY_MACHINE} = "wcoss" ]]; then - - $SUB -q ${JOB_QUEUE} -P ${PROJECT} -M 50 -R affinity[core] \ - -o ${logf} -e ${errf} -W 0:05 -J ${job} -cwd ${WORKDIR} \ - ${WORKDIR}/${cmdfile} - - elif [[ ${MY_MACHINE} = "hera" ]]; then + if [[ ${MY_MACHINE} = "hera" ]]; then $SUB --account ${ACCOUNT} -n $ctr -o ${logf} -D . -J ${job} \ --time=10 --wrap "srun -l --multi-prog ${cmdfile}" - elif [[ ${MY_MACHINE} = "cray" ]]; then + elif [[ ${MY_MACHINE} = "wcoss_c" ]]; then $SUB -q ${JOB_QUEUE} -P ${PROJECT} -o ${logf} -e ${errf} \ -R "select[mem>100] rusage[mem=100]" \ diff --git a/util/Ozone_Monitor/image_gen/ush/mk_summary.sh b/util/Ozone_Monitor/image_gen/ush/mk_summary.sh index 823205cf05..2f87d6d455 100755 --- a/util/Ozone_Monitor/image_gen/ush/mk_summary.sh +++ b/util/Ozone_Monitor/image_gen/ush/mk_summary.sh @@ -94,17 +94,12 @@ for ptype in ${process_type}; do rm -f $errf fi - if [[ ${MY_MACHINE} = "wcoss" ]]; then - - $SUB -q ${JOB_QUEUE} -P ${PROJECT} -M 50 -R affinity[core] \ - -o ${logf} -e ${errf} -W 0:05 -J ${job} -cwd ${WORKDIR} ${WORKDIR}/${cmdfile} - - elif [[ ${MY_MACHINE} = "hera" ]]; then + if [[ ${MY_MACHINE} = "hera" ]]; then $SUB --account ${ACCOUNT} -n $ctr -o ${logf} -D . -J ${job} --time=10 \ --wrap "srun -l --multi-prog ${cmdfile}" - elif [[ ${MY_MACHINE} = "cray" ]]; then + elif [[ ${MY_MACHINE} = "wcoss_c" ]]; then $SUB -q ${JOB_QUEUE} -P ${PROJECT} -o ${logf} -e ${errf} \ -R "select[mem>100] rusage[mem=100]" \ diff --git a/util/Ozone_Monitor/image_gen/ush/mk_time.sh b/util/Ozone_Monitor/image_gen/ush/mk_time.sh index 2b4bfdaf2f..e0386c7212 100755 --- a/util/Ozone_Monitor/image_gen/ush/mk_time.sh +++ b/util/Ozone_Monitor/image_gen/ush/mk_time.sh @@ -72,17 +72,12 @@ for dsrc in ${data_source}; do rm -f $errf fi - if [[ ${MY_MACHINE} = "wcoss" ]]; then - - $SUB -q ${JOB_QUEUE} -P ${PROJECT} -M 50 -R affinity[core] \ - -o ${logf} -e ${errf} -W 0:05 -J ${job} -cwd ${WORKDIR} ${WORKDIR}/${cmdfile} - - elif [[ ${MY_MACHINE} = "hera" ]]; then + if [[ ${MY_MACHINE} = "hera" ]]; then $SUB --account ${ACCOUNT} -n $ctr -o ${logf} -D . -J ${job} --time=10 \ --wrap "srun -l --multi-prog ${cmdfile}" - elif [[ ${MY_MACHINE} = "cray" ]]; then + elif [[ ${MY_MACHINE} = "wcoss_c" ]]; then $SUB -q ${JOB_QUEUE} -P ${PROJECT} -o ${logf} -e ${errf} \ -R "select[mem>100] rusage[mem=100]" \ diff --git a/util/Ozone_Monitor/image_gen/ush/plot_horiz.sh b/util/Ozone_Monitor/image_gen/ush/plot_horiz.sh index c812bdbc17..ae23681c4a 100755 --- a/util/Ozone_Monitor/image_gen/ush/plot_horiz.sh +++ b/util/Ozone_Monitor/image_gen/ush/plot_horiz.sh @@ -40,7 +40,12 @@ cdate=$PDATE while [[ $ctr -le 3 ]]; do c_pdy=`echo $cdate|cut -c1-8` c_cyc=`echo $cdate|cut -c9-10` - tankdir_cdate=${TANKDIR}/${RUN}.${c_pdy}/${c_cyc}/oznmon/horiz + + tankdir_cdate=${TANKDIR}/${RUN}.${c_pdy}/${c_cyc}/atmos/oznmon/horiz + if [[ ! -d ${tankdir_cdate} ]]; then + tankdir_cdate=${TANKDIR}/${RUN}.${c_pdy}/${c_cyc}/oznmon/horiz + fi + $NCP ${tankdir_cdate}/${SATYPE}.${dsrc}.ctl ./ $NCP ${tankdir_cdate}/${SATYPE}.${dsrc}.${c_pdy}* ./ diff --git a/util/Ozone_Monitor/image_gen/ush/plot_summary.sh b/util/Ozone_Monitor/image_gen/ush/plot_summary.sh index 40c8168f06..2d57d0437f 100755 --- a/util/Ozone_Monitor/image_gen/ush/plot_summary.sh +++ b/util/Ozone_Monitor/image_gen/ush/plot_summary.sh @@ -35,7 +35,11 @@ cdate=$PDATE while [[ $ctr -le 120 ]]; do c_pdy=`echo $cdate|cut -c1-8` c_cyc=`echo $cdate|cut -c9-10` - tankdir_cdate=${TANKDIR}/${RUN}.${c_pdy}/${c_cyc}/oznmon/time + + tankdir_cdate=${TANKDIR}/${RUN}.${c_pdy}/${c_cyc}/atmos/oznmon/time + if [[ ! -d ${tankdir_cdate} ]]; then + tankdir_cdate=${TANKDIR}/${RUN}.${c_pdy}/${c_cyc}/oznmon/time + fi if [[ ! -e ./${SATYPE}.${ptype}.ctl ]]; then $NCP ${tankdir_cdate}/${SATYPE}.${ptype}.ctl ./ diff --git a/util/Ozone_Monitor/image_gen/ush/plot_time.sh b/util/Ozone_Monitor/image_gen/ush/plot_time.sh index f0c7289c4c..71ccde2e16 100755 --- a/util/Ozone_Monitor/image_gen/ush/plot_time.sh +++ b/util/Ozone_Monitor/image_gen/ush/plot_time.sh @@ -47,7 +47,11 @@ cdate=$PDATE while [[ $ctr -le 119 ]]; do c_pdy=`echo $cdate|cut -c1-8` c_cyc=`echo $cdate|cut -c9-10` - tankdir_cdate=${TANKDIR}/${RUN}.${c_pdy}/${c_cyc}/oznmon/time + + tankdir_cdate=${TANKDIR}/${RUN}.${c_pdy}/${c_cyc}/atmos/oznmon/time + if [[ ! -d ${tankdir_cdate} ]]; then + tankdir_cdate=${TANKDIR}/${RUN}.${c_pdy}/${c_cyc}/oznmon/time + fi if [[ ! -e ./${SATYPE}.${dsrc}.ctl ]]; then $NCP ${tankdir_cdate}/${SATYPE}.${dsrc}.ctl ./ diff --git a/util/Ozone_Monitor/image_gen/ush/rm_img_files.pl b/util/Ozone_Monitor/image_gen/ush/rm_img_files.pl new file mode 100755 index 0000000000..36e86eb849 --- /dev/null +++ b/util/Ozone_Monitor/image_gen/ush/rm_img_files.pl @@ -0,0 +1,101 @@ +#!/usr/bin/perl +use strict; +use warnings; +use Getopt::Long; +use Scalar::Util qw(looks_like_number); + + +#------------------------------------------------------------------- +# +# Subroutine uniq +# +# Given an input array, return all unique values in an array. +# +#------------------------------------------------------------------- + sub uniq { + my %seen; + return grep { !$seen{$_}++ } @_; + } + + +#-------------------- +# Main begins here +#-------------------- + +print "--> rm_img_files.pl\n"; + +#-------------------------------- +# load command line argument(s) +#-------------------------------- +my $dir = './'; # directory to be cleaned up (~/nbns/imgn/NET/RUN/monitor/pngs) +my $nfl = 20; # number of files to keep + +GetOptions( 'dir=s' => \$dir, + 'nfl=i' => \$nfl ); + +#----------------------------------- +# get directory $dir/hist contents +#----------------------------------- +opendir my $target_dir, "$dir/summary" or die "Cannot open directory: $!"; +my @files = readdir $target_dir; +closedir $target_dir; + +#----------------------------------------------------- +# Break up file names and get the unique cycle times +# +# Sort the unique list in reverse order so the latest +# cycle time is first. +#----------------------------------------------------- +my @times = (); +foreach my $file ( @files ) { + my @spl = split( '\.', $file ); + if( looks_like_number( $spl[1] ) && length($spl[1] ) == 10 ) { + push( @times, $spl[1] ); + } +} + +my @unique = (); +if ( $#times >= 0 ) { + @unique = sort{ $b <=> $a }( uniq( @times )); +} + + +#------------------------------------- +# Identify cycle times to be removed +#------------------------------------- +my @del_list = (); +my @sdir_list = qw( summary ); + +if( $#unique >= $nfl ) { + my $ii = $nfl; + my $end = $#unique; + + foreach my $time ( @unique ) { + print "$time\n"; + } + print " ii, end = $ii, $end\n"; + + do { + push( @del_list, $unique[$ii] ); + $ii++; + } while $ii <= $end; + + + #--------------------------------------------- + # step through the del_list and dir_list to + # remove old image files + #--------------------------------------------- + print "del_list = @del_list\n"; + + foreach my $sdir ( @sdir_list ) { + + foreach my $del ( @del_list ) { + my $rm_cmd = "rm -f $dir/$sdir/*$del*"; + print "RM: $rm_cmd\n"; + system( $rm_cmd ) == 0 + or die "system $rm_cmd failed: $?"; + } + } +} + +print "<-- rm_img_files.pl\n"; diff --git a/util/Ozone_Monitor/image_gen/ush/run_plot_GEOIRimg4.sh b/util/Ozone_Monitor/image_gen/ush/run_plot_GEOIRimg4.sh deleted file mode 100755 index 2052183ccc..0000000000 --- a/util/Ozone_Monitor/image_gen/ush/run_plot_GEOIRimg4.sh +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/sh -set -ax - -package=ProdGSI/util/Ozone_Monitor -#package=OznMon - -DO_COMP=1 -COMP1=sbuv2_n19 -COMP2=ompsnp_npp - -ozn_suffix=GEOIRimg4 -run=gdas - -my_machine=wcoss_d - - -export NDATE=/gpfs/dell1/nco/ops/nwprod/prod_util.v1.1.0/exec/ips/ndate - -echo "NDATE = $NDATE" - -scripts=/gpfs/dell2/emc/modeling/noscrub/Edward.Safford/${package}/image_gen/ush -data_map=${scripts}/data_map.xml - -export JOB_QUEUE=dev -export MAIL_TO="edward.safford@noaa.gov" - -export OZN_USE_RUN=1 - -export CYCLE_INTERVAL=6 - -tankdir=/u/Edward.Safford/nbns/stats/${ozn_suffix} -#imgdate=`${scripts}/query_data_map.pl ${data_map} ${ozn_suffix}_${run} imgdate` -#idate=`$NDATE +${CYCLE_INTERVAL} $imgdate` - -logdir=/gpfs/dell2/ptmp/Edward.Safford/logs - -#export SATYPE=`cat ${tankdir}/info/gdas_oznmon_satype.txt` - -prodate=`${scripts}/find_cycle.pl -run ${run} -cyc 1 -dir ${tankdir}` -echo "imgdate, idate, prodate = $imgdate, $idate, $prodate" -idate=2019063018 - -if [[ $idate -le $prodate ]]; then - - echo " firing OznMon_Plt.sh" - - if [[ $DO_COMP -eq 1 ]]; then - ${scripts}/OznMon_Plt.sh $ozn_suffix -p $idate -r $run \ - -c1 $COMP1 -c2 $COMP2 \ - 1>${logdir}/${ozn_suffix}/${run}/oznmon/OznMon_Plt.log \ - 2>${logdir}/${ozn_suffix}/${run}/oznmon/OznMon_Plt.err - else - - ${scripts}/OznMon_Plt.sh $ozn_suffix -p $idate -r $run \ - 1>${logdir}/${ozn_suffix}/${run}/oznmon/OznMon_Plt.log \ - 2>${logdir}/${ozn_suffix}/${run}/oznmon/OznMon_Plt.err - fi - - rc=`${scripts}/update_data_map.pl ${data_map} \ - ${ozn_suffix}_${run} imgdate ${idate}` - - echo "rc from update_data_map.pl = $rc" - -fi - -exit diff --git a/util/Ozone_Monitor/image_gen/ush/run_plot_gdas.sh b/util/Ozone_Monitor/image_gen/ush/run_plot_gdas.sh deleted file mode 100755 index 4558f4fd9e..0000000000 --- a/util/Ozone_Monitor/image_gen/ush/run_plot_gdas.sh +++ /dev/null @@ -1,68 +0,0 @@ -#!/bin/sh - -package=ProdGSI/util/Ozone_Monitor -#package=OznMon - -suffix=GFS -run=gdas - -DO_COMP=1 -COMP1=sbuv2_n19 -COMP2=ompsnp_npp - -idev=`cat /etc/dev | cut -c1` -iprod=`cat /etc/prod | cut -c1` - -#scripts=/gpfs/${idev}d2/emc/da/noscrub/Edward.Safford/${package}/image_gen/ush -#scripts=/scratch4/NCEPDEV/da/noscrub/Edward.Safford/${package}/image_gen/ush -scripts=/gpfs/dell2/emc/modeling/noscrub/Edward.Safford/${package}/image_gen/ush - -data_map=${scripts}/data_map.xml - -#export NDATE=/nwprod/util/exec/ndate -export NDATE=/gpfs/dell1/nco/ops/nwprod/prod_util.v1.1.0/exec/ips/ndate - -export MAIL_CC="russ.treadon@noaa.gov, andrew.collard@noaa.gov, haixia.liu@noaa.gov" -export MAIL_TO="edward.safford@noaa.gov" - -export OZN_USE_RUN=1 - -export CYCLE_INTERVAL=6 - -#tankdir=/gpfs/${idev}d2/emc/da/noscrub/Edward.Safford/nbns/stats/${suffix} -#tankdir=/scratch4/NCEPDEV/da/save/Edward.Safford/nbns/stats/${suffix} -tankdir=/u/Edward.Safford/nbns/stats/${suffix} - -imgdate=`${scripts}/query_data_map.pl ${data_map} ${suffix}_${run} imgdate` -idate=`$NDATE +${CYCLE_INTERVAL} $imgdate` -#idate=2019071306 - -prodate=`${scripts}/find_cycle.pl -run ${run} -cyc 1 -dir ${tankdir}` - -logdir=/gpfs/dell2/ptmp/Edward.Safford/logs - -echo "imgdate, idate, prodate = $imgdate, $idate, $prodate" -if [[ $idate -le $prodate ]]; then - - echo " firing OznMon_Plt.sh" - - if [[ $DO_COMP -eq 1 ]]; then - ${scripts}/OznMon_Plt.sh $suffix -p $idate -r $run \ - -c1 $COMP1 -c2 $COMP2 \ - 1>${logdir}/${suffix}/${run}/oznmon/OznMon_Plt.log \ - 2>${logdir}/${suffix}/${run}/oznmon/OznMon_Plt.err - - else - ${scripts}/OznMon_Plt.sh $suffix -p $idate -r $run \ - 1>${logdir}/${suffix}/${run}/oznmon/OznMon_Plt.log \ - 2>${logdir}/${suffix}/${run}/oznmon/OznMon_Plt.err - fi - - rc=`${scripts}/update_data_map.pl ${data_map} \ - ${suffix}_${run} imgdate ${idate}` - - echo "rc from update_data_map.pl = $rc" - -fi - -exit diff --git a/util/Ozone_Monitor/image_gen/ush/run_transfer_gfs.sh b/util/Ozone_Monitor/image_gen/ush/run_transfer_gfs.sh deleted file mode 100755 index b74e07713d..0000000000 --- a/util/Ozone_Monitor/image_gen/ush/run_transfer_gfs.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - -package=ProdGSI/util/Ozone_Monitor -#package=OznMon - -ozn_suffix=GFS -run=gdas - -ch=`hostname | cut -c1` - -#export WEB_DIR=/home/people/emc/www/htdocs/gmb/gdas/es_ozn/pngs - -scripts=/gpfs/dell2/emc/modeling/noscrub/Edward.Safford/${package}/image_gen/ush - -${scripts}/OznMon_Transfer.sh ${ozn_suffix} --run ${run} - -exit diff --git a/util/Ozone_Monitor/image_gen/ush/transfer.sh b/util/Ozone_Monitor/image_gen/ush/transfer.sh index 71a645d0fc..d34921879b 100755 --- a/util/Ozone_Monitor/image_gen/ush/transfer.sh +++ b/util/Ozone_Monitor/image_gen/ush/transfer.sh @@ -4,56 +4,28 @@ echo "start transfer.sh" set -ax -# Check to determine if this maching is currently -# the production machine. -# -# Return values: -# 1 = prod -# 0 = dev -# -# iamprod=0 -# machine=`hostname | cut -c1` -# if [[ -e /etc/prod ]]; then -# prod=`cat /etc/prod | cut -c1` -# -# if [[ $machine = $prod ]]; then -# iamprod=1 -# fi -# fi - -# echo $iamprod - - echo "OZN_IMGN_TANKDIR = ${OZN_IMGN_TANKDIR}" - echo "OZNMON_SUFFIX = ${OZNMON_SUFFIX} " - echo "WEB_SVR = $WEB_SVR" - echo "WEB_USER = $WEB_USER" - echo "WEB_DIR = $WEB_DIR" - echo "RSYNCH = $RSYNC" - - if [[ ${OZN_IMGN_TANKDIR} != "/" ]]; then # sanity check - - if [[ $MY_MACHINE = "wcoss" || $MY_MACHINE = "wcoss_d" || \ - $MY_MACHINE = "cray" ]]; then - - #---------------------------------------------------------------- - # expand WEB_DIR to include the suffix and conditionally the RUN - # - if [[ $OZN_USE_RUN -eq 1 ]]; then - export WEB_DIR=${WEB_DIR}/${OZNMON_SUFFIX}/${RUN} - else - export WEB_DIR=${WEB_DIR}/${OZNMON_SUFFIX} - fi - - ssh ${WEB_USER}@${WEB_SVR}.ncep.noaa.gov "mkdir -p ${WEB_DIR}" - - #---------------------------------------------------------------- - # use rsync to perform the file transfer - # - $RSYNC -ave ssh ${OZN_IMGN_TANKDIR}/ \ - ${WEB_USER}@${WEB_SVR}.ncep.noaa.gov:${WEB_DIR}/ - fi +echo "OZN_IMGN_TANKDIR = ${OZN_IMGN_TANKDIR}" +echo "OZNMON_SUFFIX = ${OZNMON_SUFFIX} " +echo "WEB_SVR = $WEB_SVR" +echo "WEB_USER = $WEB_USER" +echo "WEB_DIR = $WEB_DIR" +echo "RSYNCH = $RSYNC" +if [[ ${OZN_IMGN_TANKDIR} != "/" ]]; then # sanity check + + if [[ $MY_MACHINE = "wcoss_c" || $MY_MACHINE = "wcoss_d" ]]; then + + WEB_DIR=${WEB_DIR}/${OZNMON_SUFFIX}/${RUN} + ssh ${WEB_USER}@${WEB_SVR}.ncep.noaa.gov "mkdir -p ${WEB_DIR}" + + #---------------------------------------------------------------- + # use rsync to perform the file transfer + # + $RSYNC -ave ssh --delete-during ${OZN_IMGN_TANKDIR}/ \ + ${WEB_USER}@${WEB_SVR}.ncep.noaa.gov:${WEB_DIR}/ fi - echo "end transfer.sh" - exit +fi + +echo "end transfer.sh" +exit diff --git a/util/Ozone_Monitor/makeall.sh b/util/Ozone_Monitor/makeall.sh deleted file mode 100755 index d1e8c4a16d..0000000000 --- a/util/Ozone_Monitor/makeall.sh +++ /dev/null @@ -1,82 +0,0 @@ -#! /bin/bash - -#------------------------------------------------------------------ -# makeall -# -# This scripts makes all of the executables in the -# nwprod/oznmon_shared/sorc subdirectories and places the -# executables into the proper exec directories. -# -# An optional arguments to this script include "clean", "debug", -# and "check_prereqs". Do not use "install" as an optional -# argument -- this script will do that automatically. -# If no argument is included "all" and "install" are assumed. -#------------------------------------------------------------------ -set -ax - -mode=${1:-} -top_level=${PWD} -echo "top_level = ${top_level}" - -machine=`./get_hostname.pl` -echo "machine = $machine" - -#------------------------------ -# source OznMon_config -#------------------------------ -. ${top_level}/parm/OznMon_config -. ${top_level}/parm/OznMon.ver - -HOMEoznmon=${MY_OZNMON}/nwprod/oznmon_shared.${shared_oznmon_ver} -echo HOMEoznmon = $HOMEoznmon - -if [[ ${machine} = "theia" || ${machine} = "wcoss" || ${machine} = "cray" || ${machine} = "dell" ]]; then - echo Building executables on ${machine} - echo - - #------------------------------------------------------------------ - # make data extract executables in ${HOMEoznmon}/sorc directories - #------------------------------------------------------------------ - - module use -a ${HOMEoznmon}/modulefiles/${machine} - module load OznMonBuild - - executables="oznmon_horiz oznmon_time" - echo "Making executables in nwprod/oznmon_shared.${shared_oznmon_ver}/sorc:" - export dir_root=${HOMEoznmon} - for var in ${executables}; do - cd ${HOMEoznmon}/sorc/${var}.fd - - make ${mode} - if [[ $mode = "" ]]; then - make install - fi - - echo - - done - - executables="make_base" - echo "Making executables in data_xtrc/sorc:" - export dir_root=${MY_OZNMON}/data_xtrct/ - for var in ${executables}; do - cd ${OZN_DE_SORC}/${var}.fd - - make ${mode} - if [[ $mode = "" ]]; then - make install - fi - - echo - - done - -# module unload OznMonBuild - set +x - -else - echo ${machine} is not supported -fi - -exit - diff --git a/util/Ozone_Monitor/nwprod/gdas_oznmon.v2.0.0/driver/test_jgdas_verfozn.sh b/util/Ozone_Monitor/nwprod/gdas_oznmon.v2.0.0/driver/test_jgdas_verfozn.sh deleted file mode 100755 index 3edbccf3c8..0000000000 --- a/util/Ozone_Monitor/nwprod/gdas_oznmon.v2.0.0/driver/test_jgdas_verfozn.sh +++ /dev/null @@ -1,93 +0,0 @@ -#!/bin/ksh - -#BSUB -o gdas_verfozn.o%J -#BSUB -e gdas_verfozn.o%J -#BSUB -J gdas_verfozn -#BSUB -q dev_shared -#BSUB -n 1 -#BSUB -R affinity[core] -#BSUB -M 100 -#BSUB -W 00:05 -#BSUB -a poe -#BSUB -P GFS-DEV - -##------------------------------------------------------------ -## This is the test driver script for the wcoss/ibm systems -## to run the JGDAS_VERFOZN job. -##------------------------------------------------------------ - -set -x - -export OZNMON_NEW_HDR=${OZN_NEW_HDR:-0} -export PDATE=${PDATE:-2017072206} -export NET=${NET:-gfs} -export RUN=${RUN:-gdas} - - -export PDY=`echo $PDATE | cut -c1-8` -export cyc=`echo $PDATE | cut -c9-10` -export job=gdas_verfozn.${cyc} -export pid=${pid:-$$} -export jobid=${job}.${pid} -export envir=${envir:-test} -export DATAROOT=${DATAROOT:-/gpfs/gd2/emc/da/noscrub/${LOGNAME}/test_data} -export COMROOT=${COMROOT:-/ptmpp1/${LOGNAME}/com} -export OZN_WORK_DIR=${OZN_WORK_DIR:-/stmpp1/${LOGNAME}/oznmon.${pid}} - -#------------------------------------------------------------ -# Specify versions -# -export gdas_oznmon_ver=v2.0.0 -export oznmon_shared_ver=v2.0.0 - - -#------------------------------------------------------------ -# Load modules -# -. /usrx/local/Modules/3.2.9/init/ksh -module use /nwprod2/modulefiles -module load prod_util -module load util_shared - - -module list - - -#------------------------------------------------------------ -# WCOSS environment settings -# -export POE=YES - - -#------------------------------------------------------------ -# Set user specific variables -# -export OZNMON_SUFFIX=${OZNMON_SUFFIX:-testozn} -export NWTEST=${NWTEST:-/gpfs/gd2/emc/da/noscrub/Edward.Safford/ProdGSI/util/Ozone_Monitor/nwprod} -export HOMEgdas_ozn=${NWTEST}/gdas_oznmon.${gdas_oznmon_ver} -export PARMgdas_ozn=${HOMEgdas_ozn}/parm -export FIXgdas_ozn=${FIXgdas_ozn:-${HOMEgdas_ozn}/fix} - - -export HOMEgfs_ozn=${HOMEgfs_ozn:-${HOMEgdas_ozn}} -export PARMgfs_ozn=${PARMgfs_ozn:-${PARMgdas_ozn}} -export FIXgfs_ozn=${FIXgfs_ozn:-${FIXgdas_ozn}} - -export JOBGLOBAL=${JOBGLOBAL:-${HOMEgdas_ozn}/jobs} -export HOMEoznmon=${HOMEoznmon:-${NWTEST}/oznmon_shared.${shared_oznmon_ver}} - -#export SCRgdas_ozn=${HOMEgdas_ozn}/scripts -#JOBgdas_ozn=${HOMEgdas_ozn}/jobs - -export HOMEoznmon=${NWTEST}/oznmon_shared.${oznmon_shared_ver} -export COM_IN=${COM_IN:-$DATAROOT} -export OZN_TANKDIR=${OZN_TANKDIR:-${COMROOT}/${OZNMON_SUFFIX}} - - -#------------------------------------------------------------ -# Execute job -# -${JOBGLOBAL}/JGDAS_VERFOZN - -exit - diff --git a/util/Ozone_Monitor/nwprod/gdas_oznmon.v2.0.0/scripts/exgdas_vrfyozn.sh.ecf b/util/Ozone_Monitor/nwprod/gdas_oznmon.v2.0.0/scripts/exgdas_vrfyozn.sh.ecf deleted file mode 100755 index 8a937e1be8..0000000000 --- a/util/Ozone_Monitor/nwprod/gdas_oznmon.v2.0.0/scripts/exgdas_vrfyozn.sh.ecf +++ /dev/null @@ -1,137 +0,0 @@ -#/bin/sh - -set -ax - -################################################################################ -#### UNIX Script Documentation Block -# . . -# Script name: exgdas_vrfyozn.sh.ecf -# Script description: Runs data extract/validation for global ozone diag data -# -# Author: Ed Safford Org: NP23 Date: 2012-01-18 -# -# Abstract: This script runs the data extract/validation portion of the -# OznMon package. -# -# Script history log: -# -# Input script positional parameters: -# 1 Current analysis date in yyyymmddhh format -# defaults to PDY; required -# 2 cycle time in cc format -# defaults to cyc; required -# -# input data : $oznstat -# -# output data: -# -# Remarks: -# -# Condition codes -# 0 - no problem encountered -# >0 - some problem encountered -# -################################################################################ -export scr=exgdas_vrfyozn.sh.ecf - -err=0 - -#------------------------------------------------------------------------------- -# Set environment -# -export RUN_ENVIR=${RUN_ENVIR:-nco} -export NET=${NET:-gfs} -export RUN=${RUN:-gdas} -export envir=${envir:-prod} - -# Command line arguments -export PDY=${1:-${PDY:?}} -export cyc=${2:-${cyc:?}} - -# Directories -export OZN_WORK_DIR=${OZN_WORK_DIR:-$(pwd)} -export COM_IN=${COM_IN:-${COMROOT}/${NET}/${envir}} -export COMIN=${COMIN:-$COM_IN/${RUN}.${PDY}} - -export HOMEgdas_ozn=${HOMEgdas_ozn:-${NWROOT}/gdas.${gdas_oznmon_ver}} -export FIXgdas_ozn=${FIXgdas_ozn:-$HOMEgdas/fix} - -export HOMEoznmon=${HOMEoznmon:-/${NWROOT}/oznmon_shared.v${shared_oznmon_ver}} -export EXECoznmon=${EXECoznmon:-$HOMEoznmon/exec} -export FIXoznmon=${FIXoznmon:-${HOMEoznmon}/fix} -export USHoznmon=${USHoznmon:-$HOMEoznmon/ush} - - -# Filenames -export oznstat=${oznstat:-$COMIN/gdas.t${cyc}z.oznstat} -export satype_file=${satype_file:-$FIXgdas_ozn/gdas_oznmon_satype.txt} - -# Other variables -#export USE_ANL=${USE_ANL:-1} -export PDATE=${PDY}${cyc} -export DO_DATA_RPT=${DO_DATA_RPT:-1} -export NCP=${NCP:-/bin/cp} -export NDATE=${NDATE:-/nwprod/util/exec/ndate} - - -################################################################## -# ensure work and TANK dirs exist, verify oznstat is available -if [[ ! -d ${OZN_WORK_DIR} ]]; then - mkdir $OZN_WORK_DIR -fi -cd $OZN_WORK_DIR - -if [[ ! -d ${TANKverf_ozn} ]]; then - mkdir -p $TANKverf_ozn -fi - -if [[ -s ${oznstat} ]]; then - echo ${oznstat} is available -fi - -##################################################################### - -data_available=0 - -if [[ -s ${oznstat} ]]; then - data_available=1 - - #------------------------------------------------------------------ - # Copy data files file to local data directory. - # Untar oznstat file. - #------------------------------------------------------------------ - - $NCP $oznstat ./oznstat.$PDATE - - tar -xvf oznstat.$PDATE - rm oznstat.$PDATE - - netcdf=0 - count=`ls diag* | grep ".nc4" | wc -l` - if [ $count -gt 0 ] ; then - netcdf=1 - for filenc4 in `ls diag*nc4.gz`; do - file=`echo $filenc4 | cut -d'.' -f1-2`.gz - mv $filenc4 $file - done - fi - - export OZNMON_NETCDF=${netcdf} - - ${HOMEoznmon}/ush/ozn_xtrct.sh - err=$? - -else - # oznstat file is not available - err=1 -fi - - -if [[ "$VERBOSE" = "YES" ]]; then - echo "end exgdas_vrfyozn.sh.ecf, exit value = ${err}" -fi - - -set +x -exit ${err} - diff --git a/util/Ozone_Monitor/nwprod/gdas_oznmon.v2.0.0/driver/test_jgdas_verfozn_hera.sh b/util/Ozone_Monitor/nwprod/gdas_oznmon/driver/test_jgdas_verfozn_hera.sh similarity index 53% rename from util/Ozone_Monitor/nwprod/gdas_oznmon.v2.0.0/driver/test_jgdas_verfozn_hera.sh rename to util/Ozone_Monitor/nwprod/gdas_oznmon/driver/test_jgdas_verfozn_hera.sh index b26a8fb724..705d270ad9 100755 --- a/util/Ozone_Monitor/nwprod/gdas_oznmon.v2.0.0/driver/test_jgdas_verfozn_hera.sh +++ b/util/Ozone_Monitor/nwprod/gdas_oznmon/driver/test_jgdas_verfozn_hera.sh @@ -11,8 +11,8 @@ set -x export OZNMON_NEW_HDR=${OZN_NEW_HDR:-0} -#export PDATE=${PDATE:-2019083100} # netcdf -export PDATE=${PDATE:-2018091706} # bin +export PDATE=${PDATE:-2020032106} # netcdf +#export PDATE=${PDATE:-2020013000} # bin export NET=${NET:-gfs} export RUN=${RUN:-gdas} @@ -26,37 +26,23 @@ export DATAROOT=${DATAROOT:-/scratch1/NCEPDEV/da/Edward.Safford/noscrub/test_dat export COMROOT=${COMROOT:-/scratch2/NCEPDEV/stmp3/${LOGNAME}/com} export OZN_WORK_DIR=${OZN_WORK_DIR:-/scratch2/NCEPDEV/stmp3/${LOGNAME}/oznmon.${pid}} -#------------------------------------------------------------ -# Specify versions -# -export gdas_oznmon_ver=v2.0.0 -export shared_oznmon_ver=v2.0.0 - - -#------------------------------------------------------------ -# Add nwpara tools to path -# -#NWPROD=${NWPROD:-/scratch4/NCEPDEV/global/save/glopara/nwpara/util} -#NWPRODush=${NWPRODush:=${NWPROD}/ush} -#NWPRODexec=${NWPRODexec:=${NWPROD}/exec} -#export PATH=${PATH}:${NWPRODush}:${NWPRODexec} #------------------------------------------------------------ -# Set user specific variables +# Set package definitions. # - export OZNMON_SUFFIX=${OZNMON_SUFFIX:-testozn} -export NWTEST=${NWTEST:-/scratch1/NCEPDEV/da/${LOGNAME}/noscrub/ProdGSI/util/Ozone_Monitor/nwprod} -export HOMEgdas_ozn=${HOMEgdas_ozn:-${NWTEST}/gdas_oznmon.${gdas_oznmon_ver}} +export NWTEST=${NWTEST:-/scratch1/NCEPDEV/da/Edward.Safford/noscrub/update/util/Ozone_Monitor/nwprod} +export HOMEgdas_ozn=${HOMEgdas_ozn:-${NWTEST}/gdas_oznmon} export PARMgdas_ozn=${PARMgdas_ozn:-${HOMEgdas_ozn}/parm} export FIXgdas_ozn=${FIXgdas_ozn:-${HOMEgdas_ozn}/fix} -export HOMEgfs_ozn=${HOMEgfs_ozn:-${HOMEgdas_ozn}} +export HOMEgfs=${HOMEgfs:-${HOMEgdas_ozn}} +export HOMEgfs_ozn=${HOMEgfs_ozn:-${HOMEgfs}} export PARMgfs_ozn=${PARMgfs_ozn:-${PARMgdas_ozn}} export FIXgfs_ozn=${FIXgfs_ozn:-${FIXgdas_ozn}} export JOBGLOBAL=${JOBGLOBAL:-${HOMEgdas_ozn}/jobs} -export HOMEoznmon=${HOMEoznmon:-${NWTEST}/oznmon_shared.${shared_oznmon_ver}} +export HOMEoznmon=${HOMEoznmon:-${NWTEST}/oznmon_shared} export COM_IN=${COM_IN:-${DATAROOT}} export OZN_TANKDIR=${OZN_TANKDIR:-${COMROOT}/${OZNMON_SUFFIX}} @@ -66,23 +52,17 @@ export NDATE=${NDATE:-/home/Edward.Safford/bin/ndate} #------------------------------------------------------------ -# theia specific hacks for no prod_utils module & no setpdy.sh script +# hera specific hack for no prod_utils module # export MY_MACHINE=hera prevday=`$NDATE -24 $PDATE` export PDYm1=`echo $prevday | cut -c1-8` -#ln -s ${NWPRODush}/startmsg.sh ${COMROOT}/startmsg -#ln -s ${NWPRODush}/postmsg.sh ${COMROOT}/postmsg -#ln -s ${NWPRODush}/prep_step.sh ${COMROOT}/prep_step -#ln -s ${NWPRODush}/err_chk.sh ${COMROOT}/err_chk export PATH=$PATH:${COMROOT} -#export utilscript=${utilscript:-${NWPRODush}} # err_chk calls postmsg.sh - # directly so need to override - # utilscript location for theia + #------------------------------------------------------------ # Execute job # -$JOBGLOBAL/JGDAS_VERFOZN +$JOBGLOBAL/JGDAS_ATMOS_VERFOZN exit diff --git a/util/Ozone_Monitor/nwprod/gdas_oznmon.v2.0.0/driver/test_jgdas_verfozn_wcoss_c.sh b/util/Ozone_Monitor/nwprod/gdas_oznmon/driver/test_jgdas_verfozn_wcoss_c.sh similarity index 74% rename from util/Ozone_Monitor/nwprod/gdas_oznmon.v2.0.0/driver/test_jgdas_verfozn_wcoss_c.sh rename to util/Ozone_Monitor/nwprod/gdas_oznmon/driver/test_jgdas_verfozn_wcoss_c.sh index e165008999..806d0a74a2 100755 --- a/util/Ozone_Monitor/nwprod/gdas_oznmon.v2.0.0/driver/test_jgdas_verfozn_wcoss_c.sh +++ b/util/Ozone_Monitor/nwprod/gdas_oznmon/driver/test_jgdas_verfozn_wcoss_c.sh @@ -19,7 +19,7 @@ set -x export OZNMON_NEW_HDR=${OZN_NEW_HDR:-0} -export PDATE=${PDATE:-2019083100} +export PDATE=${PDATE:-2021031100} export NET=${NET:-gfs} export RUN=${RUN:-gdas} @@ -34,12 +34,6 @@ export DATAROOT=${DATAROOT:-/gpfs/hps3/emc/da/noscrub/${LOGNAME}/test_data} export COMROOT=/gpfs/hps2/ptmp/${LOGNAME}/com export OZN_WORK_DIR=${OZN_WORK_DIR:-/gpfs/hps2/stmp/${LOGNAME}/oznmon.${pid}} -#------------------------------------------------------------ -# Specify versions -# -export gdas_oznmon_ver=v2.0.0 -export oznmon_shared_ver=v2.0.0 - ############################################################# # Load modules @@ -52,35 +46,30 @@ module load util_shared module list -#------------------------------------------------------------ -# WCOSS environment settings -# -export POE=YES - #------------------------------------------------------------ # Set user specific variables # -export OZNMON_SUFFIX=${OZNMON_SUFFIX:-testozn} -export NWTEST=${NWTEST:-/gpfs/hps3/emc/da/noscrub/Edward.Safford/ProdGSI/util/Ozone_Monitor/nwprod} -export HOMEgdas_ozn=${NWTEST}/gdas_oznmon.${gdas_oznmon_ver} +export OZNMON_SUFFIX=${OZNMON_SUFFIX:-testozn} +export NWTEST=${NWTEST:-/gpfs/hps3/emc/da/noscrub/Edward.Safford/update/util/Ozone_Monitor/nwprod} +export HOMEgdas_ozn=${NWTEST}/gdas_oznmon export PARMgdas_ozn=${HOMEgdas_ozn}/parm -export SCRgdas_ozn=${HOMEgdas_ozn}/scripts export FIXgdas_ozn=${HOMEgdas_ozn}/fix -JOBgdas_ozn=${HOMEgdas_ozn}/jobs -export HOMEgfs_ozn=${HOMEgfs_ozn:-${HOMEgdas_ozn}} +export HOMEgfs=${HOMEgfs:-${HOMEgdas_ozn}} +export HOMEgfs_ozn=${HOMEgfs_ozn:-${HOMEgfs}} export PARMgfs_ozn=${PARMgfs_ozn:-${PARMgdas_ozn}} export FIXgfs_ozn=${FIXgfs_ozn:-${FIXgdas_ozn}} -export HOMEoznmon=${NWTEST}/oznmon_shared.${oznmon_shared_ver} +export HOMEoznmon=${NWTEST}/oznmon_shared export COM_IN=${COM_IN:-$DATAROOT} export OZN_TANKDIR=${OZN_TANKDIR:-${COMROOT}/${OZNMON_SUFFIX}} +export OZN_TANKDIR=${OZN_TANKDIR:-${COMROOT}/${OZNMON_SUFFIX}} #------------------------------------------------------------ # Execute job # -${JOBgdas_ozn}/JGDAS_VERFOZN +${HOMEgdas_ozn}/jobs/JGDAS_ATMOS_VERFOZN exit diff --git a/util/Ozone_Monitor/nwprod/gdas_oznmon.v2.0.0/driver/test_jgdas_verfozn_wcoss_d.sh b/util/Ozone_Monitor/nwprod/gdas_oznmon/driver/test_jgdas_verfozn_wcoss_d.sh similarity index 79% rename from util/Ozone_Monitor/nwprod/gdas_oznmon.v2.0.0/driver/test_jgdas_verfozn_wcoss_d.sh rename to util/Ozone_Monitor/nwprod/gdas_oznmon/driver/test_jgdas_verfozn_wcoss_d.sh index 2c54897e09..2517bb497b 100755 --- a/util/Ozone_Monitor/nwprod/gdas_oznmon.v2.0.0/driver/test_jgdas_verfozn_wcoss_d.sh +++ b/util/Ozone_Monitor/nwprod/gdas_oznmon/driver/test_jgdas_verfozn_wcoss_d.sh @@ -6,7 +6,7 @@ #BSUB -q dev_shared #BSUB -n 1 #BSUB -R affinity[core] -#BSUB -M 500 +#BSUB -M 100 #BSUB -W 00:05 #BSUB -P GFS-DEV @@ -25,8 +25,8 @@ export OZNMON_NEW_HDR=${OZN_NEW_HDR:-0} # References to netcdf and binary indicate available files in # the test_data space. # -#export PDATE=${PDATE:-2019083100} # netcdf -export PDATE=${PDATE:-2018091706} # binary +export PDATE=${PDATE:-2021031106} # netcdf +#export PDATE=${PDATE:-2018091706} # binary export NET=${NET:-gfs} export RUN=${RUN:-gdas} @@ -41,12 +41,6 @@ export DATAROOT=${DATAROOT:-/gpfs/dell2/emc/modeling/noscrub/${LOGNAME}/test_dat export COMROOT=/gpfs/dell2/ptmp/${LOGNAME}/com export OZN_WORK_DIR=${OZN_WORK_DIR:-/gpfs/dell2/stmp/${LOGNAME}/oznmon.${pid}} -#------------------------------------------------------------ -# Specify versions -# -export gdas_oznmon_ver=v2.0.0 -export oznmon_shared_ver=v2.0.0 - #------------------------------------------------------------ # Load modules @@ -86,23 +80,20 @@ export POE=YES # Set user specific variables # export OZNMON_SUFFIX=${OZNMON_SUFFIX:-testozn} -export NWTEST=${NWTEST:-/gpfs/dell2/emc/modeling/noscrub/Edward.Safford/ProdGSI/util/Ozone_Monitor/nwprod} -export HOMEgdas_ozn=${NWTEST}/gdas_oznmon.${gdas_oznmon_ver} +export NWTEST=${NWTEST:-/gpfs/dell2/emc/modeling/noscrub/Edward.Safford/update/util/Ozone_Monitor/nwprod} +export HOMEgdas_ozn=${NWTEST}/gdas_oznmon export PARMgdas_ozn=${HOMEgdas_ozn}/parm export FIXgdas_ozn=${FIXgdas_ozn:-${HOMEgdas_ozn}/fix} - -export HOMEgfs_ozn=${HOMEgfs_ozn:-${HOMEgdas_ozn}} +export HOMEgfs=${HOMEgfs:-${HOMEgdas_ozn}} +export HOMEgfs_ozn=${HOMEgfs_ozn:-${HOMEgfs}} export PARMgfs_ozn=${PARMgfs_ozn:-${PARMgdas_ozn}} export FIXgfs_ozn=${FIXgfs_ozn:-${FIXgdas_ozn}} export JOBGLOBAL=${JOBGLOBAL:-${HOMEgdas_ozn}/jobs} -export HOMEoznmon=${HOMEoznmon:-${NWTEST}/oznmon_shared.${shared_oznmon_ver}} - -#export SCRgdas_ozn=${HOMEgdas_ozn}/scripts -#JOBgdas_ozn=${HOMEgdas_ozn}/jobs +export HOMEoznmon=${HOMEoznmon:-${NWTEST}/oznmon_shared} -export HOMEoznmon=${NWTEST}/oznmon_shared.${oznmon_shared_ver} +export HOMEoznmon=${NWTEST}/oznmon_shared export COM_IN=${COM_IN:-$DATAROOT} export OZN_TANKDIR=${OZN_TANKDIR:-${COMROOT}/${OZNMON_SUFFIX}} @@ -110,7 +101,7 @@ export OZN_TANKDIR=${OZN_TANKDIR:-${COMROOT}/${OZNMON_SUFFIX}} #------------------------------------------------------------ # Execute job # -${JOBGLOBAL}/JGDAS_VERFOZN +${JOBGLOBAL}/JGDAS_ATMOS_VERFOZN exit diff --git a/util/Ozone_Monitor/nwprod/gdas_oznmon/fix/gdas_oznmon_base.tar b/util/Ozone_Monitor/nwprod/gdas_oznmon/fix/gdas_oznmon_base.tar new file mode 100644 index 0000000000..0526bd1b1e Binary files /dev/null and b/util/Ozone_Monitor/nwprod/gdas_oznmon/fix/gdas_oznmon_base.tar differ diff --git a/util/Ozone_Monitor/nwprod/gdas_oznmon.v2.0.0/fix/gdas_oznmon_satype.txt b/util/Ozone_Monitor/nwprod/gdas_oznmon/fix/gdas_oznmon_satype.txt similarity index 100% rename from util/Ozone_Monitor/nwprod/gdas_oznmon.v2.0.0/fix/gdas_oznmon_satype.txt rename to util/Ozone_Monitor/nwprod/gdas_oznmon/fix/gdas_oznmon_satype.txt diff --git a/util/Ozone_Monitor/nwprod/gdas_oznmon.v2.0.0/jobs/JGDAS_VERFOZN b/util/Ozone_Monitor/nwprod/gdas_oznmon/jobs/JGDAS_ATMOS_VERFOZN similarity index 79% rename from util/Ozone_Monitor/nwprod/gdas_oznmon.v2.0.0/jobs/JGDAS_VERFOZN rename to util/Ozone_Monitor/nwprod/gdas_oznmon/jobs/JGDAS_ATMOS_VERFOZN index cc0754954b..13b8b3045a 100755 --- a/util/Ozone_Monitor/nwprod/gdas_oznmon.v2.0.0/jobs/JGDAS_VERFOZN +++ b/util/Ozone_Monitor/nwprod/gdas_oznmon/jobs/JGDAS_ATMOS_VERFOZN @@ -4,13 +4,14 @@ ############################################################# set -xa echo `date` $0 `date -u` begin -export PS4='$SECONDS + ' + ############################### -# Specify NET and RUN name +# Specify NET, RUN, and COMPONENT name ############################## export NET=${NET:-gfs} export RUN=${RUN:-gdas} +export COMPONENT=${COMPONENT:-atmos} ########################################################### # obtain unique process id (pid) and make temp directories @@ -21,8 +22,8 @@ export DATA=${DATA:-${DATAROOT}/${jobid:?}} export OZNMON_SUFFIX=${OZNMON_SUFFIX:-${NET}} -mkdir -p $DATA -cd $DATA +mkdir -p ${DATA} +cd ${DATA} #################################### @@ -33,17 +34,11 @@ export pgmerr=errfile export cycle=t${cyc}z -#---------------------------------- -# Set up the UTILITIES -# -export utilscript=${utilscript:-${UTILROOT}/ush} -export utilexec=${utilexec:-${UTILROOT}/exec} - - #--------------------------------------------- # Specify Execution Areas # -export HOMEgdas_ozn=${HOMEgfs_ozn:-${NWROOT}/gfs.$gfs_ver} +export HOMEgfs_ozn=${HOMEgfs:-${NWROOT}/gfs.${gfs_ver}} +export HOMEgdas_ozn=${HOMEgfs_ozn:-${NWROOT}/gfs.${gfs_ver}} export PARMgdas_ozn=${PARMgfs_ozn:-$HOMEgfs_ozn/parm/mon} export SCRgdas_ozn=${SCRgfs_ozn:-$HOMEgfs_ozn/scripts} export FIXgdas_ozn=${FIXgfs_ozn:-$HOMEgfs_ozn/fix/gdas} @@ -71,23 +66,22 @@ export P_PDY=`echo ${cdate} | cut -c1-8` export p_cyc=`echo ${cdate} | cut -c9-10` #--------------------------------------------- -# COMOUT - WHERE GSI OUTPUT RESIDES # OZN_TANKDIR - WHERE OUTPUT DATA WILL RESIDE # -echo "pre-assignment, OZN_TANKDIR = $OZN_TANKDIR" -export TANKverf_ozn=${TANKverf_ozn:-${OZN_TANKDIR}/${RUN}.${PDY}/${cyc}/oznmon} -export TANKverf_oznM1=${TANKverf_oznM1:-${OZN_TANKDIR}/${RUN}.${P_PDY}/${p_cyc}/oznmon} -export COM_IN=${COM_IN:-${COMROOT}/${NET}/${envir}} -export COMIN=${COMIN:-${COM_IN}/${RUN}.${PDY}/${cyc}} +export OZN_TANKDIR=${OZN_TANKDIR:-${COMROOTp3}/$NET/$envir} +export TANKverf_ozn=${TANKverf_ozn:-${OZN_TANKDIR}/${RUN}.${PDY}/${cyc}/${COMPONENT}/oznmon} +export TANKverf_oznM1=${TANKverf_oznM1:-${OZN_TANKDIR}/${RUN}.${P_PDY}/${p_cyc}/${COMPONENT}/oznmon} +export COM_IN=${COM_IN:-${COMROOTp3}/${NET}/${envir}} +export COMIN=${COMIN:-${COM_IN}/${RUN}.${PDY}/${cyc}/${COMPONENT}} if [[ ! -d ${TANKverf_ozn} ]]; then - mkdir -p -m 775 $TANKverf_ozn + mkdir -p -m 775 ${TANKverf_ozn} fi #--------------------------------------- # set up validation file # -if [[ $VALIDATE_DATA -eq 1 ]]; then +if [[ ${VALIDATE_DATA} -eq 1 ]]; then export ozn_val_file=${ozn_val_file:-${FIXgdas_ozn}/gdas_oznmon_base.tar} fi @@ -95,14 +89,13 @@ fi # Set necessary environment variables # export OZN_AREA=${OZN_AREA:-glb} - export oznstat=${oznstat:-$COMIN/gdas.t${cyc}z.oznstat} #------------------------------------------------------- # Execute the script. # -${OZNMONSH:-${SCRgdas_ozn}/exgdas_vrfyozn.sh.ecf} ${PDY} ${cyc} +${OZNMONSH:-${SCRgdas_ozn}/exgdas_atmos_verfozn.sh} ${PDY} ${cyc} err=$? [[ $err -ne 0 ]] && exit $err diff --git a/util/Ozone_Monitor/nwprod/gdas_oznmon.v2.0.0/parm/gdas_oznmon.parm b/util/Ozone_Monitor/nwprod/gdas_oznmon/parm/gdas_oznmon.parm similarity index 100% rename from util/Ozone_Monitor/nwprod/gdas_oznmon.v2.0.0/parm/gdas_oznmon.parm rename to util/Ozone_Monitor/nwprod/gdas_oznmon/parm/gdas_oznmon.parm diff --git a/util/Ozone_Monitor/nwprod/gdas_oznmon/scripts/exgdas_atmos_verfozn.sh b/util/Ozone_Monitor/nwprod/gdas_oznmon/scripts/exgdas_atmos_verfozn.sh new file mode 100755 index 0000000000..939b03a3d4 --- /dev/null +++ b/util/Ozone_Monitor/nwprod/gdas_oznmon/scripts/exgdas_atmos_verfozn.sh @@ -0,0 +1,100 @@ +#/bin/sh + +set -ax + +################################################################################ +# exgdas_vrfyozn.sh +# +# This script runs the data extract/validation portion of the Ozone Monitor +# (OznMon) DA package. +# +################################################################################ +export scr=exgdas_vrfyozn.sh + +err=0 + +#------------------------------------------------------------------------------- +# Set environment +# +export RUN_ENVIR=${RUN_ENVIR:-nco} +export NET=${NET:-gfs} +export RUN=${RUN:-gdas} +export envir=${envir:-prod} +export COMPONENT=${COMPONENT:-atmos} + +# Command line arguments +export PDY=${1:-${PDY:?}} +export cyc=${2:-${cyc:?}} + + +# Other variables +export SATYPE_FILE=${SATYPE_FILE:-$FIXgdas_ozn/gdas_oznmon_satype.txt} +export PDATE=${PDY}${cyc} +export DO_DATA_RPT=${DO_DATA_RPT:-1} +export NCP=${NCP:-/bin/cp} + + +#----------------------------------------------------------------- +# ensure work and TANK dirs exist, verify oznstat is available +# +export OZN_WORK_DIR=${OZN_WORK_DIR:-$(pwd)} + +if [[ ! -d ${OZN_WORK_DIR} ]]; then + mkdir $OZN_WORK_DIR +fi +cd $OZN_WORK_DIR + +if [[ ! -d ${TANKverf_ozn} ]]; then + mkdir -p $TANKverf_ozn +fi + +if [[ -s ${oznstat} ]]; then + echo ${oznstat} is available +fi + + + +data_available=0 + +if [[ -s ${oznstat} ]]; then + data_available=1 + + #------------------------------------------------------------------ + # Copy data files file to local data directory. + # Untar oznstat file. + #------------------------------------------------------------------ + + $NCP $oznstat ./oznstat.$PDATE + + tar -xvf oznstat.$PDATE + rm oznstat.$PDATE + + netcdf=0 + count=`ls diag* | grep ".nc4" | wc -l` + if [ $count -gt 0 ] ; then + netcdf=1 + for filenc4 in `ls diag*nc4.gz`; do + file=`echo $filenc4 | cut -d'.' -f1-2`.gz + mv $filenc4 $file + done + fi + + export OZNMON_NETCDF=${netcdf} + + ${HOMEoznmon}/ush/ozn_xtrct.sh + err=$? + +else + # oznstat file not found + err=1 +fi + + +if [[ "$VERBOSE" = "YES" ]]; then + echo "end exgdas_vrfyozn.sh, exit value = ${err}" +fi + + +set +x +exit ${err} + diff --git a/util/Ozone_Monitor/nwprod/oznmon_shared.v2.0.0/sorc/oznmon_horiz.fd/makefile b/util/Ozone_Monitor/nwprod/oznmon_shared.v2.0.0/sorc/oznmon_horiz.fd/makefile deleted file mode 100755 index e7be37ccfe..0000000000 --- a/util/Ozone_Monitor/nwprod/oznmon_shared.v2.0.0/sorc/oznmon_horiz.fd/makefile +++ /dev/null @@ -1,69 +0,0 @@ -# ***************************************************************** -# makefile.horiz -# -# Make the OzMon horiz executable -# -# To build enter these commands: -# > module use -a ../nwprod/ozmon_shared.v2.0.0/modulefiles/cray|theia|wcoss -# > module load OzMonBuild -# > make -f makefile -# > make -f makefile install -# > module unload OzMonBuild -# -# Notes: -# 1) Makefile.conf.* have been replaced with the build modules -# 2) make options supported include: -# a) make all (default if all is not specified) -# b) clean -# c) debug -# d) install -# ***************************************************************** -SHELL=/bin/sh - -BINDIR = ${dir_root}/exec - -LIBS = $(W3NCO_LIB4) - -SRCS = kinds.f90 read_diag.f90 horiz.f90 create_ctl_horiz.f90 \ - update_ctl_horiz.f90 - -OBJS = kinds.o read_diag.o horiz.o create_ctl_horiz.o \ - update_ctl_horiz.o - -# -# ***************************************************************** -# - -CMD = oznmon_horiz.x - -all: $(CMD) - -clean: - rm -f *.x - rm -f *.o - rm -f *.mod - -install: - cp -f $(CMD) $(BINDIR)/ - -debug: FFLAGS = $(D_FFLAGS) -debug: $(CMD) - -$(CMD): $(OBJS) - $(CF) $(FFLAGS) $(LDFLAGS) -o $(@) $(OBJS) $(LIBS) - -kinds.o : kinds.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -read_diag.o : read_diag.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -horiz.o : horiz.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -create_ctl_horiz.o : create_ctl_horiz.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -update_ctl_horiz.o : update_ctl_horiz.f90 - $(CF) $(FFLAGS) -c $(*).f90 - diff --git a/util/Ozone_Monitor/nwprod/oznmon_shared.v2.0.0/sorc/oznmon_horiz.fd/update_ctl_horiz.f90 b/util/Ozone_Monitor/nwprod/oznmon_shared.v2.0.0/sorc/oznmon_horiz.fd/update_ctl_horiz.f90 deleted file mode 100755 index 2da714ffa3..0000000000 --- a/util/Ozone_Monitor/nwprod/oznmon_shared.v2.0.0/sorc/oznmon_horiz.fd/update_ctl_horiz.f90 +++ /dev/null @@ -1,93 +0,0 @@ -subroutine update_ctl_horiz(n_chan,iyy,imm,idd,ihh,idhh,incr,& - ctl_file,lunctl) - - implicit none - - logical eof - - character(3),dimension(12):: mon - character(40) ctl_file - character(120) line - character(120),dimension(n_chan+50):: ctl_line - - integer lunctl,iyy,imm,idd,ihh,n_chan,idhh,incr - integer iyy2,imm2,idd2,ihh2,ntime,iline,nline,maxlin - integer,dimension(8):: ida,jda - - real,dimension(5):: fha - - data mon / 'jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', & - 'aug', 'sep', 'oct', 'nov', 'dec' / - -!*********************************************************************** -! - maxlin=n_chan+50 - -! Create date for tdef based on given date and hour offset - fha=0.0; ida=0; jda=0; ntime=0 - iyy2=iyy; imm2=imm; idd2=idd; ihh2=ihh - if (idhh/=0) then - ntime = abs(idhh)/incr - fha(2)=idhh - ida(1)=iyy - ida(2)=imm - ida(3)=idd - ida(4)=0 - ida(5)=ihh - call w3movdat(fha,ida,jda) - iyy2=jda(1) - imm2=jda(2) - idd2=jda(3) - ihh2=jda(5) - endif - ntime=ntime+1 - -! Open unit to GrADS control file - open(lunctl,file=ctl_file,form='formatted') - - -! Read control file, line by line. Upate time -! definition line. - iline=0 - eof=.false. - do while (.not.eof) - read(lunctl,100,end=200) line -100 format(a120) - if (index(line,'tdef') /= 0) then - write(line,110) ntime,ihh2,idd2,mon(imm2),iyy2 -110 format('tdef ',i4,' linear ',i2.2,'Z',i2.2,a3,i4.4,' 06hr') - write(6,*) line - endif - - iline=iline+1 - if (iline>maxlin) then - write(6,*)'***ERROR*** number of lines in ',ctl_file,& - ' exceeds maxlin=',maxlin - write(6,*)' last line read is ',line - call errexit(94) - endif - ctl_line(iline)=line - - goto 300 - -200 continue - eof=.true. -300 continue - end do - nline=iline - write(6,*)'update_ctl_horiz: read nline=',nline,' lines from ctl file' - - -! Rewind control file. Write stored information to file. - rewind(lunctl) - do iline=1,nline - line=ctl_line(iline) - write(lunctl,400) line -400 format(t1,a120) - end do - close(lunctl) - - -! Return - return -end subroutine update_ctl_horiz diff --git a/util/Ozone_Monitor/nwprod/oznmon_shared.v2.0.0/sorc/oznmon_time.fd/makefile b/util/Ozone_Monitor/nwprod/oznmon_shared.v2.0.0/sorc/oznmon_time.fd/makefile deleted file mode 100755 index 2323c7c2c5..0000000000 --- a/util/Ozone_Monitor/nwprod/oznmon_shared.v2.0.0/sorc/oznmon_time.fd/makefile +++ /dev/null @@ -1,76 +0,0 @@ -# ***************************************************************** -# makefile.time -# -# Make the OzMon time executable -# -# To build enter these commands: -# > module use -a ../nwprod/ozmon_shared.v2.0.0/modulefiles/cray|theia|wcoss -# > module load OzMonBuild -# > make -# > make install -# > module unload OzMonBuild -# -# Notes: -# 1) Makefile.conf.* have been replaced with the build modules -# 2) make options supported include: -# a) make all (default if "all" is not specified) -# b) clean -# c) debug -# d) install -# ***************************************************************** - -SHELL=/bin/sh - -BINDIR = $(dir_root)/exec - -LIBS = $(W3NCO_LIB4) - -SRCS = kinds.f90 read_diag.f90 \ - valid.f90 time.f90 create_ctl_time.f90 avgsdv.f90 \ - update_ctl_time.f90 - -OBJS = kinds.o read_diag.o valid.o time.o \ - create_ctl_time.o avgsdv.o update_ctl_time.o - -# -# ***************************************************************** -# - -CMD = oznmon_time.x - -all: $(CMD) - -clean: - rm -f *.x - rm -f *.o - rm -f *.mod - -install: - cp -f $(CMD) $(BINDIR)/ - -debug: FFLAGS = $(D_FFLAGS) -debug: $(CMD) - -$(CMD): $(OBJS) - $(CF) $(FFLAGS) $(LDFLAGS) -o $(@) $(OBJS) $(LIBS) - -kinds.o : kinds.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -read_diag.o : read_diag.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -valid.o : valid.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -time.o : time.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -create_ctl_time.o : create_ctl_time.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -avgsdv.o : avgsdv.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -update_ctl_time.o : update_ctl_time.f90 - $(CF) $(FFLAGS) -c $(*).f90 diff --git a/util/Ozone_Monitor/nwprod/oznmon_shared.v2.0.0/sorc/oznmon_time.fd/update_ctl_time.f90 b/util/Ozone_Monitor/nwprod/oznmon_shared.v2.0.0/sorc/oznmon_time.fd/update_ctl_time.f90 deleted file mode 100755 index e008ef687b..0000000000 --- a/util/Ozone_Monitor/nwprod/oznmon_shared.v2.0.0/sorc/oznmon_time.fd/update_ctl_time.f90 +++ /dev/null @@ -1,93 +0,0 @@ -subroutine update_ctl_oz(n_chan,iyy,imm,idd,ihh,idhh,incr,& - ctl_file,lunctl) - - implicit none - - logical eof - - character(3),dimension(12):: mon - character(40) ctl_file - character(120) line - character(120),dimension(n_chan+50):: ctl_line - - integer lunctl,iyy,imm,idd,ihh,n_chan,idhh,incr - integer iyy2,imm2,idd2,ihh2,ntime,iline,nline,maxlin - integer,dimension(8):: ida,jda - - real,dimension(5):: fha - - data mon / 'jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', & - 'aug', 'sep', 'oct', 'nov', 'dec' / - -!*********************************************************************** -! - maxlin=n_chan+50 - -! Create date for tdef based on given date and hour offset - fha=0.0; ida=0; jda=0; ntime=0 - iyy2=iyy; imm2=imm; idd2=idd; ihh2=ihh - if (idhh/=0) then - ntime = abs(idhh)/incr - fha(2)=idhh - ida(1)=iyy - ida(2)=imm - ida(3)=idd - ida(4)=0 - ida(5)=ihh - call w3movdat(fha,ida,jda) - iyy2=jda(1) - imm2=jda(2) - idd2=jda(3) - ihh2=jda(5) - endif - ntime=ntime+1 - -! Open unit to GrADS control file - open(lunctl,file=ctl_file,form='formatted') - - -! Read control file, line by line. Upate time -! definition line. - iline=0 - eof=.false. - do while (.not.eof) - read(lunctl,100,end=200) line -100 format(a120) - if (index(line,'tdef') /= 0) then - write(line,110) ntime,ihh2,idd2,mon(imm2),iyy2 -110 format('tdef ',i4,' linear ',i2.2,'Z',i2.2,a3,i4.4,' 06hr') - write(6,*) line - endif - - iline=iline+1 - if (iline>maxlin) then - write(6,*)'***ERROR*** number of lines in ',ctl_file,& - ' exceeds maxlin=',maxlin - write(6,*)' last line read is ',line - call errexit(94) - endif - ctl_line(iline)=line - - goto 300 - -200 continue - eof=.true. -300 continue - end do - nline=iline - write(6,*)'update_ctl_oz: read nline=',nline,' lines from ctl file' - - -! Rewind control file. Write stored information to file. - rewind(lunctl) - do iline=1,nline - line=ctl_line(iline) - write(lunctl,400) line -400 format(t1,a120) - end do - close(lunctl) - - -! Return - return -end subroutine update_ctl_oz diff --git a/util/Ozone_Monitor/nwprod/oznmon_shared.v2.0.0/exec/.gitignore b/util/Ozone_Monitor/nwprod/oznmon_shared/exec/.gitignore similarity index 100% rename from util/Ozone_Monitor/nwprod/oznmon_shared.v2.0.0/exec/.gitignore rename to util/Ozone_Monitor/nwprod/oznmon_shared/exec/.gitignore diff --git a/util/Ozone_Monitor/nwprod/oznmon_shared.v2.0.0/modulefiles/cray/OznMonBuild b/util/Ozone_Monitor/nwprod/oznmon_shared/modulefiles/cray/OznMonBuild similarity index 100% rename from util/Ozone_Monitor/nwprod/oznmon_shared.v2.0.0/modulefiles/cray/OznMonBuild rename to util/Ozone_Monitor/nwprod/oznmon_shared/modulefiles/cray/OznMonBuild diff --git a/util/Ozone_Monitor/nwprod/oznmon_shared.v2.0.0/modulefiles/dell/OznMonBuild b/util/Ozone_Monitor/nwprod/oznmon_shared/modulefiles/dell/OznMonBuild similarity index 100% rename from util/Ozone_Monitor/nwprod/oznmon_shared.v2.0.0/modulefiles/dell/OznMonBuild rename to util/Ozone_Monitor/nwprod/oznmon_shared/modulefiles/dell/OznMonBuild diff --git a/util/Ozone_Monitor/nwprod/oznmon_shared.v2.0.0/modulefiles/theia/OznMonBuild b/util/Ozone_Monitor/nwprod/oznmon_shared/modulefiles/theia/OznMonBuild similarity index 100% rename from util/Ozone_Monitor/nwprod/oznmon_shared.v2.0.0/modulefiles/theia/OznMonBuild rename to util/Ozone_Monitor/nwprod/oznmon_shared/modulefiles/theia/OznMonBuild diff --git a/util/Ozone_Monitor/nwprod/oznmon_shared.v2.0.0/modulefiles/wcoss/OznMonBuild b/util/Ozone_Monitor/nwprod/oznmon_shared/modulefiles/wcoss/OznMonBuild similarity index 100% rename from util/Ozone_Monitor/nwprod/oznmon_shared.v2.0.0/modulefiles/wcoss/OznMonBuild rename to util/Ozone_Monitor/nwprod/oznmon_shared/modulefiles/wcoss/OznMonBuild diff --git a/util/Ozone_Monitor/nwprod/oznmon_shared.v2.0.0/sorc/oznmon_horiz.fd/CMakeLists.txt b/util/Ozone_Monitor/nwprod/oznmon_shared/sorc/oznmon_horiz.fd/CMakeLists.txt similarity index 86% rename from util/Ozone_Monitor/nwprod/oznmon_shared.v2.0.0/sorc/oznmon_horiz.fd/CMakeLists.txt rename to util/Ozone_Monitor/nwprod/oznmon_shared/sorc/oznmon_horiz.fd/CMakeLists.txt index fd434a4da2..fa8c7e459f 100644 --- a/util/Ozone_Monitor/nwprod/oznmon_shared.v2.0.0/sorc/oznmon_horiz.fd/CMakeLists.txt +++ b/util/Ozone_Monitor/nwprod/oznmon_shared/sorc/oznmon_horiz.fd/CMakeLists.txt @@ -7,7 +7,7 @@ cmake_minimum_required(VERSION 2.6) set_target_properties( oznmon_horiz.x PROPERTIES COMPILE_FLAGS ${OZNMON_HORIZ_Fortran_FLAGS} ) set_target_properties( oznmon_horiz.x PROPERTIES Fortran_MODULE_DIRECTORY ${Util_MODULE_DIR} ) include_directories( ${CORE_INCS} ${NCDIAG_INCS} ) - target_link_libraries( oznmon_horiz.x ${W3NCO_4_LIBRARY} ${NCDIAG_LIBRARIES} ${NETCDF_LIBRARIES_F90} ${NETCDF_LIBRARIES} ${HDF5_Fortran_HL_LIBRARIES} ${MPI_Fortran_LIBRARIES} ${HDF5_LIBRARIES} ) + target_link_libraries( oznmon_horiz.x ${W3NCO_4_LIBRARY} ${NCDIAG_LIBRARIES} ${NETCDF_Fortran_LIBRARIES} ${NETCDF_C_LIBRARIES} ${MPI_Fortran_LIBRARIES}) if(BUILD_W3NCO) add_dependencies( oznmon_horiz.x ${W3NCO_4_LIBRARY} ) endif() diff --git a/util/Ozone_Monitor/nwprod/oznmon_shared.v2.0.0/sorc/oznmon_horiz.fd/create_ctl_horiz.f90 b/util/Ozone_Monitor/nwprod/oznmon_shared/sorc/oznmon_horiz.fd/create_ctl_horiz.f90 similarity index 100% rename from util/Ozone_Monitor/nwprod/oznmon_shared.v2.0.0/sorc/oznmon_horiz.fd/create_ctl_horiz.f90 rename to util/Ozone_Monitor/nwprod/oznmon_shared/sorc/oznmon_horiz.fd/create_ctl_horiz.f90 diff --git a/util/Ozone_Monitor/nwprod/oznmon_shared.v2.0.0/sorc/oznmon_horiz.fd/horiz.f90 b/util/Ozone_Monitor/nwprod/oznmon_shared/sorc/oznmon_horiz.fd/horiz.f90 similarity index 93% rename from util/Ozone_Monitor/nwprod/oznmon_shared.v2.0.0/sorc/oznmon_horiz.fd/horiz.f90 rename to util/Ozone_Monitor/nwprod/oznmon_shared/sorc/oznmon_horiz.fd/horiz.f90 index 60744fdde2..2a176befda 100644 --- a/util/Ozone_Monitor/nwprod/oznmon_shared.v2.0.0/sorc/oznmon_horiz.fd/horiz.f90 +++ b/util/Ozone_Monitor/nwprod/oznmon_shared/sorc/oznmon_horiz.fd/horiz.f90 @@ -1,5 +1,5 @@ program horiz - use read_diag + use oznmon_read_diag implicit none integer ntype, mls2_levs,mls3_levs @@ -361,47 +361,11 @@ program horiz write(6,*)'write output to lungrd=',lungrd,', file=',trim(grad_file) -! Deallocate arrays deallocate(var,iuse,error) - goto 950 - - -!------------------------------------------------------------------- -! Jump to here if eof or error reading diagnostic file. -900 continue - write(6,*)'***PROBLEM reading diagnostic file. diag_oz=',diag_oz - - if (m_levs<=0) then - write(6,*)'***ERROR*** invalid nlevs=',n_levs,' STOP program' - call errexit(93) - endif - - call update_ctl_horiz(n_levs,iyy,imm,idd,ihh,idhh,incr,& - ctl_file,lunctl) - - allocate(var(n_levs,ntype)) - do j=1,ntype - do i=1,n_levs - var(i,j)=rmiss - end do - end do - - open(lungrd,file=grad_file,form='unformatted') - - stid='missing' - rlat=0.0 - rlon=0.0 - - write(lungrd) stid,rlat,rlon,rtim,nlev,nflag - write(lungrd) ((var(i,j),i=1,n_levs),j=1,ntype) - irite=1 - - deallocate(var) !----------------------------------- ! Close unit to diagnostic file -950 continue close(lndiag) !---------------------------------------------------------------------- diff --git a/util/Ozone_Monitor/nwprod/oznmon_shared.v2.0.0/sorc/oznmon_horiz.fd/kinds.f90 b/util/Ozone_Monitor/nwprod/oznmon_shared/sorc/oznmon_horiz.fd/kinds.f90 similarity index 100% rename from util/Ozone_Monitor/nwprod/oznmon_shared.v2.0.0/sorc/oznmon_horiz.fd/kinds.f90 rename to util/Ozone_Monitor/nwprod/oznmon_shared/sorc/oznmon_horiz.fd/kinds.f90 diff --git a/util/Ozone_Monitor/nwprod/oznmon_shared.v2.0.0/sorc/oznmon_time.fd/read_diag.f90 b/util/Ozone_Monitor/nwprod/oznmon_shared/sorc/oznmon_horiz.fd/oznmon_read_diag.f90 similarity index 87% rename from util/Ozone_Monitor/nwprod/oznmon_shared.v2.0.0/sorc/oznmon_time.fd/read_diag.f90 rename to util/Ozone_Monitor/nwprod/oznmon_shared/sorc/oznmon_horiz.fd/oznmon_read_diag.f90 index 7e592d3a5e..8feb261ca4 100644 --- a/util/Ozone_Monitor/nwprod/oznmon_shared.v2.0.0/sorc/oznmon_time.fd/read_diag.f90 +++ b/util/Ozone_Monitor/nwprod/oznmon_shared/sorc/oznmon_horiz.fd/oznmon_read_diag.f90 @@ -1,27 +1,18 @@ !$$$ subprogram documentation block ! . . . . -! subprogram: read_diag read ozone diag file -! prgmmr: hliu org: np20 date: 2009-04-15 +! subprogram: oznmon_read_diag read ozone diag file ! ! abstract: This module contains code to process ozone ! diagnostic files. The module defines structures ! to contain information from the ozone ! diagnostic files and then provides two routines -! to access contents of the file. +! to access contents of the file. Both binary +! and NetCDF formats are supported. ! -! program history log: -! -! contains -! read_ozndiag_header - read ozone diagnostic file header -! read_ozndiag_data - read ozone diagnostic file data -! set_netcdf_read - call set_netcdf_read(.true.) to use nc4 hooks, -! otherwise read file as binary format -! open_ozndiag - open a diag file for reading -! close_ozndiag - close an open diag file !------------------------------------------------------------ -! -module read_diag + +module oznmon_read_diag !--- use ---! @@ -299,19 +290,19 @@ subroutine read_ozndiag_header( ftin, header_fix, header_nlev, new_hdr, istatus call read_ozndiag_header_bin( ftin, header_fix, header_nlev, new_hdr, istatus ) endif - print*, 'ftin = ', ftin - print*, 'header_fix%isis = ', header_fix%isis - print*, 'header_fix%id = ', header_fix%id - print*, 'header_fix%obstype = ', header_fix%obstype - print*, 'header_fix%jiter = ', header_fix%jiter - print*, 'header_fix%nlevs = ', header_fix%nlevs - print*, 'header_fix%ianldate = ', header_fix%ianldate - print*, 'header_fix%iint = ', header_fix%iint - print*, 'header_fix%ireal = ', header_fix%ireal - print*, 'header_fix%iextra = ', header_fix%iextra - - print*, 'istatus = ', istatus - print*, '' + write(6,*) 'ftin = ', ftin + write(6,*) 'header_fix%isis = ', header_fix%isis + write(6,*) 'header_fix%id = ', header_fix%id + write(6,*) 'header_fix%obstype = ', header_fix%obstype + write(6,*) 'header_fix%jiter = ', header_fix%jiter + write(6,*) 'header_fix%nlevs = ', header_fix%nlevs + write(6,*) 'header_fix%ianldate = ', header_fix%ianldate + write(6,*) 'header_fix%iint = ', header_fix%iint + write(6,*) 'header_fix%ireal = ', header_fix%ireal + write(6,*) 'header_fix%iextra = ', header_fix%iextra + + write(6,*) 'istatus = ', istatus + write(6,*) '' end subroutine read_ozndiag_header @@ -349,9 +340,9 @@ subroutine read_ozndiag_header_nc( ftin, header_fix, header_nlev, new_hdr, istat !--- get global attr ! ! This may look like overkill with a check on each variable - ! name, but due to the genius of the ncdiag library, a - ! failure on these read operations is fatal, because, reasons - ! I guess. Thus, this abundance of caution. + ! name, but a failure on these nc library read operations + ! is fatal. Thus, this abundance of caution verifying the + ! variable exists before attempting to retreive it. ! if( verify_var_name_nc( "date_time" ) ) then call nc_diag_read_get_global_attr(ftin, "date_time", idate) @@ -377,12 +368,6 @@ subroutine read_ozndiag_header_nc( ftin, header_fix, header_nlev, new_hdr, istat write(6,*) 'WARNING: unable to read global var Observation_type from file ' end if - if( verify_var_name_nc( "Number_of_state_vars" ) ) then - call nc_diag_read_get_global_attr(ftin, "Number_of_state_vars", nsdim ) - else - write(6,*) 'WARNING: unable to read global var Number_of_state_vars from file ' - end if - if( verify_var_name_nc( "pobs" ) ) then call nc_diag_read_get_global_attr(ftin, "pobs", pobs ) else @@ -401,7 +386,6 @@ subroutine read_ozndiag_header_nc( ftin, header_fix, header_nlev, new_hdr, istat write(6,*) 'WARNING: unable to read global var tnoise from file ' end if - !------------------------------------------------------------------- ! The Anaysis_Use_Flag in the netcdf file resides in the ! obs data rather than global (equivalent of binary file header @@ -438,6 +422,8 @@ subroutine read_ozndiag_header_nc( ftin, header_fix, header_nlev, new_hdr, istat !--- allocate if necessary + write(6,*) 'header_fix%nlevs, nlevs_last = ', header_fix%nlevs, nlevs_last + if( header_fix%nlevs /= nlevs_last )then if( nlevs_last > 0 )then deallocate( header_nlev ) @@ -455,8 +441,10 @@ subroutine read_ozndiag_header_nc( ftin, header_fix, header_nlev, new_hdr, istat header_nlev(k)%iouse = iuse_flag(k) end do - deallocate( pobs,gross,tnoise,iuse_flag ) - + if( allocated( pobs )) deallocate( pobs ) + if( allocated( gross )) deallocate( gross ) + if( allocated( tnoise )) deallocate( tnoise ) + if( allocated( iuse_flag )) deallocate( iuse_flag ) end subroutine read_ozndiag_header_nc @@ -511,8 +499,8 @@ subroutine read_ozndiag_header_bin( ftin, header_fix, header_nlev, new_hdr, ista if( header_fix%ireal /= IREAL_RESERVE ) then - print *, '### ERROR: UNEXPECTED DATA RECORD FORMAT' - print *, 'ireal =', header_fix%ireal + write(6,*) '### ERROR: UNEXPECTED DATA RECORD FORMAT' + write(6,*) 'ireal =', header_fix%ireal stop 99 endif @@ -524,6 +512,7 @@ subroutine read_ozndiag_header_bin( ftin, header_fix, header_nlev, new_hdr, ista !--- allocate if necessary + write(6,*) 'header_fix%nlevs, nlevs_last = ', header_fix%nlevs, nlevs_last if( header_fix%nlevs /= nlevs_last )then if( nlevs_last > 0 )then deallocate( header_nlev ) @@ -545,7 +534,11 @@ subroutine read_ozndiag_header_bin( ftin, header_fix, header_nlev, new_hdr, ista header_nlev(k)%err = err(k) header_nlev(k)%iouse = iouse(k) end do - deallocate (pob,grs,err,iouse) + + if( allocated( pob )) deallocate( pob ) + if( allocated( grs )) deallocate( grs ) + if( allocated( err )) deallocate( err ) + if( allocated( iouse )) deallocate( iouse ) end subroutine read_ozndiag_header_bin @@ -628,7 +621,7 @@ subroutine read_ozndiag_data_nc( ftin, header_fix, data_fix, data_nlev, data_ext logical :: test cur_idx = ncdiag_open_id( nopen_ncdiag ) - + !---------------------------------------------------------- ! The binary file read (the original version of the file ! read) is designed to be called in a loop, as it reads @@ -636,12 +629,12 @@ subroutine read_ozndiag_data_nc( ftin, header_fix, data_fix, data_nlev, data_ext ! ! The newer netcdf read processes each field for all obs ! so it can grab all the obs data in a single call. The - ! calling routine in time.f90 uses the iflag value to - ! process the results, and non-zero value to indicate - ! everything has been read. In order to use this same - ! iflag mechanism we'll use the ncdiag_open_status%nc_read - ! field, setting it to true and iflag to 0 after reading, - ! and if nc_read is already true then set iflag to -1. + ! calling routine uses the iflag value to process the, + ! and non-zero value to indicate everything has been read. + ! In order to use this same iflag mechanism we'll use the + ! ncdiag_open_status%nc_read field, setting it to true and + ! iflag to 0 after reading, and if nc_read is already true + ! then set iflag to -1. ! ! It's not as clear or clean as it should be, so I'll ! leave this comment in as a note-to-self to redesign this @@ -705,23 +698,39 @@ subroutine read_ozndiag_data_nc( ftin, header_fix, data_fix, data_nlev, data_ext write(6,*) 'WARNING: unable to read global var Time from file ' end if - !----------------------------------------------- + !------------------------------------------------------- ! lat, lon, obstime are dimensioned to nrecords - ! read those as nobs * nlevs + ! read those as nobs * nlevs with all lat/lon values + ! for a given obs being the same. So a source with 22 + ! levels has that value repeated 22 times for each + ! obs. The data_fix structure is dimentioned to nobs, + ! not nrecords to match the binary file structure. + ! + ! Note that only sbuv2_n19 and ompsnp_npp (at present) + ! have nlevs > 1. ! do ii=1,ntobs - data_fix(ii)%lat = lat(ii + ((ii-1)*nlevs) ) - data_fix(ii)%lon = lon(ii + ((ii-1)*nlevs) ) - data_fix(ii)%obstime = obstime(ii + ((ii-1)*nlevs) ) + if( nlevs > 1 ) then + data_fix(ii)%lat = lat(1 + ((ii-1)*nlevs) ) + data_fix(ii)%lon = lon(1 + ((ii-1)*nlevs) ) + data_fix(ii)%obstime = obstime(1 + ((ii-1)*nlevs) ) + else + data_fix(ii)%lat = lat(ii) + data_fix(ii)%lon = lon(ii) + data_fix(ii)%obstime = obstime(ii) + end if + end do - deallocate( lat, lon, obstime ) + if( allocated( lat )) deallocate( lat ) + if( allocated( lon )) deallocate( lon ) + if( allocated( obstime )) deallocate( obstime ) !--------------------------------- ! load data_nlev structure ! - allocate( data_nlev( header_fix%nlevs,nrecords ) ) allocate( ozobs(nrecords) ) + allocate( ozone_inv(nrecords) ) allocate( varinv(nrecords) ) allocate( sza(nrecords) ) @@ -769,23 +778,23 @@ subroutine read_ozndiag_data_nc( ftin, header_fix, data_fix, data_nlev, data_ext ! All vars used to read the file are dimensioned ! to nrecord, which is nobs * nlevs ! - do jj=0,ntobs-1 + do jj=1,ntobs do ii=1,header_fix%nlevs - data_nlev(ii,jj)%ozobs = ozobs( ii + (jj * nlevs) ) - data_nlev(ii,jj)%ozone_inv = ozone_inv( ii + (jj * nlevs) ) - data_nlev(ii,jj)%varinv = varinv( ii + (jj * nlevs) ) - data_nlev(ii,jj)%sza = sza( ii + (jj * nlevs) ) - data_nlev(ii,jj)%fovn = fovn( ii + (jj * nlevs) ) - data_nlev(ii,jj)%toqf = toqf( ii + (jj * nlevs) ) + data_nlev(ii,jj)%ozobs = ozobs( ii + ((jj-1) * nlevs) ) + data_nlev(ii,jj)%ozone_inv = ozone_inv( ii + ((jj-1) * nlevs) ) + data_nlev(ii,jj)%varinv = varinv( ii + ((jj-1) * nlevs) ) + data_nlev(ii,jj)%sza = sza( ii + ((jj-1) * nlevs) ) + data_nlev(ii,jj)%fovn = fovn( ii + ((jj-1) * nlevs) ) + data_nlev(ii,jj)%toqf = toqf( ii + ((jj-1) * nlevs) ) end do end do - deallocate( ozobs ) - deallocate( ozone_inv ) - deallocate( varinv ) - deallocate( sza ) - deallocate( fovn ) - deallocate( toqf ) + if( allocated( ozobs )) deallocate( ozobs ) + if( allocated( ozone_inv )) deallocate( ozone_inv ) + if( allocated( varinv )) deallocate( varinv ) + if( allocated( sza )) deallocate( sza ) + if( allocated( fovn )) deallocate( fovn ) + if( allocated( toqf )) deallocate( toqf ) ncdiag_open_status(cur_idx)%nc_read = .true. @@ -831,6 +840,7 @@ subroutine read_ozndiag_data_bin( ftin, header_fix, data_fix, data_nlev, data_ex read(ftin,IOSTAT=iflag) ntobs write(6,*) ' READ 1, ntobs, iflag = ', ntobs, iflag + write(6,*) 'header_fix%nlevs, nlevs_last = ', header_fix%nlevs, nlevs_last if( header_fix%nlevs /= nlevs_last )then if( nlevs_last > 0 )then write(6,*) ' DEALLOCATING data_nlev, data_fix, data_mpi' @@ -845,8 +855,9 @@ subroutine read_ozndiag_data_bin( ftin, header_fix, data_fix, data_nlev, data_ex nlevs_last = header_fix%nlevs endif + write(6,*) 'iextra_last = ', iextra_last if (iextra_last > 0) then - deallocate (data_extra) + deallocate ( data_extra ) endif allocate( data_extra(header_fix%iextra,ntobs) ) @@ -869,7 +880,7 @@ subroutine read_ozndiag_data_bin( ftin, header_fix, data_fix, data_nlev, data_ex end do end do - deallocate(tmp_extra) + if( allocated( tmp_extra )) deallocate( tmp_extra ) endif do j=1,ntobs @@ -877,7 +888,7 @@ subroutine read_ozndiag_data_bin( ftin, header_fix, data_fix, data_nlev, data_ex data_fix(j)%lon = tmp_fix(2,j) data_fix(j)%obstime = tmp_fix(3,j) end do - deallocate(tmp_fix) + if( allocated( tmp_fix )) deallocate( tmp_fix ) do j=1,ntobs do i=1,header_fix%nlevs @@ -889,7 +900,7 @@ subroutine read_ozndiag_data_bin( ftin, header_fix, data_fix, data_nlev, data_ex data_nlev(i,j)%toqf = tmp_nlev(6,i,j) end do end do - deallocate(tmp_nlev) + if( allocated( tmp_nlev )) deallocate( tmp_nlev ) nlevs_last = -1 @@ -966,5 +977,5 @@ logical function verify_var_name_nc( test_name ) end function verify_var_name_nc -end module read_diag +end module oznmon_read_diag diff --git a/util/Ozone_Monitor/nwprod/oznmon_shared.v2.0.0/sorc/oznmon_time.fd/CMakeLists.txt b/util/Ozone_Monitor/nwprod/oznmon_shared/sorc/oznmon_time.fd/CMakeLists.txt similarity index 86% rename from util/Ozone_Monitor/nwprod/oznmon_shared.v2.0.0/sorc/oznmon_time.fd/CMakeLists.txt rename to util/Ozone_Monitor/nwprod/oznmon_shared/sorc/oznmon_time.fd/CMakeLists.txt index 5a6c15b41a..c957a0a243 100644 --- a/util/Ozone_Monitor/nwprod/oznmon_shared.v2.0.0/sorc/oznmon_time.fd/CMakeLists.txt +++ b/util/Ozone_Monitor/nwprod/oznmon_shared/sorc/oznmon_time.fd/CMakeLists.txt @@ -7,7 +7,7 @@ cmake_minimum_required(VERSION 2.6) set_target_properties( oznmon_time.x PROPERTIES COMPILE_FLAGS ${OZNMON_TIME_Fortran_FLAGS} ) set_target_properties( oznmon_time.x PROPERTIES Fortran_MODULE_DIRECTORY ${Util_MODULE_DIR} ) include_directories( ${CORE_INCS} ${NCDIAG_INCS} ) - target_link_libraries( oznmon_time.x ${W3NCO_4_LIBRARY} ${NCDIAG_LIBRARIES} ${NETCDF_LIBRARIES_F90} ${NETCDF_LIBRARIES} ${HDF5_Fortran_HL_LIBRARIES} ${MPI_Fortran_LIBRARIES} ${HDF5_LIBRARIES} ) + target_link_libraries( oznmon_time.x ${W3NCO_4_LIBRARY} ${NCDIAG_LIBRARIES} ${NETCDF_Fortran_LIBRARIES} ${NETCDF_C_LIBRARIES} ${MPI_Fortran_LIBRARIES}) if(BUILD_W3NCO) add_dependencies( oznmon_time.x ${W3NCO_4_LIBRARY} ) endif() diff --git a/util/Ozone_Monitor/nwprod/oznmon_shared.v2.0.0/sorc/oznmon_time.fd/avgsdv.f90 b/util/Ozone_Monitor/nwprod/oznmon_shared/sorc/oznmon_time.fd/avgsdv.f90 similarity index 100% rename from util/Ozone_Monitor/nwprod/oznmon_shared.v2.0.0/sorc/oznmon_time.fd/avgsdv.f90 rename to util/Ozone_Monitor/nwprod/oznmon_shared/sorc/oznmon_time.fd/avgsdv.f90 diff --git a/util/Ozone_Monitor/nwprod/oznmon_shared.v2.0.0/sorc/oznmon_time.fd/create_ctl_time.f90 b/util/Ozone_Monitor/nwprod/oznmon_shared/sorc/oznmon_time.fd/create_ctl_time.f90 similarity index 100% rename from util/Ozone_Monitor/nwprod/oznmon_shared.v2.0.0/sorc/oznmon_time.fd/create_ctl_time.f90 rename to util/Ozone_Monitor/nwprod/oznmon_shared/sorc/oznmon_time.fd/create_ctl_time.f90 diff --git a/util/Ozone_Monitor/nwprod/oznmon_shared.v2.0.0/sorc/oznmon_time.fd/kinds.f90 b/util/Ozone_Monitor/nwprod/oznmon_shared/sorc/oznmon_time.fd/kinds.f90 similarity index 100% rename from util/Ozone_Monitor/nwprod/oznmon_shared.v2.0.0/sorc/oznmon_time.fd/kinds.f90 rename to util/Ozone_Monitor/nwprod/oznmon_shared/sorc/oznmon_time.fd/kinds.f90 diff --git a/util/Ozone_Monitor/nwprod/oznmon_shared.v2.0.0/sorc/oznmon_horiz.fd/read_diag.f90 b/util/Ozone_Monitor/nwprod/oznmon_shared/sorc/oznmon_time.fd/oznmon_read_diag.f90 similarity index 87% rename from util/Ozone_Monitor/nwprod/oznmon_shared.v2.0.0/sorc/oznmon_horiz.fd/read_diag.f90 rename to util/Ozone_Monitor/nwprod/oznmon_shared/sorc/oznmon_time.fd/oznmon_read_diag.f90 index 7e592d3a5e..8feb261ca4 100644 --- a/util/Ozone_Monitor/nwprod/oznmon_shared.v2.0.0/sorc/oznmon_horiz.fd/read_diag.f90 +++ b/util/Ozone_Monitor/nwprod/oznmon_shared/sorc/oznmon_time.fd/oznmon_read_diag.f90 @@ -1,27 +1,18 @@ !$$$ subprogram documentation block ! . . . . -! subprogram: read_diag read ozone diag file -! prgmmr: hliu org: np20 date: 2009-04-15 +! subprogram: oznmon_read_diag read ozone diag file ! ! abstract: This module contains code to process ozone ! diagnostic files. The module defines structures ! to contain information from the ozone ! diagnostic files and then provides two routines -! to access contents of the file. +! to access contents of the file. Both binary +! and NetCDF formats are supported. ! -! program history log: -! -! contains -! read_ozndiag_header - read ozone diagnostic file header -! read_ozndiag_data - read ozone diagnostic file data -! set_netcdf_read - call set_netcdf_read(.true.) to use nc4 hooks, -! otherwise read file as binary format -! open_ozndiag - open a diag file for reading -! close_ozndiag - close an open diag file !------------------------------------------------------------ -! -module read_diag + +module oznmon_read_diag !--- use ---! @@ -299,19 +290,19 @@ subroutine read_ozndiag_header( ftin, header_fix, header_nlev, new_hdr, istatus call read_ozndiag_header_bin( ftin, header_fix, header_nlev, new_hdr, istatus ) endif - print*, 'ftin = ', ftin - print*, 'header_fix%isis = ', header_fix%isis - print*, 'header_fix%id = ', header_fix%id - print*, 'header_fix%obstype = ', header_fix%obstype - print*, 'header_fix%jiter = ', header_fix%jiter - print*, 'header_fix%nlevs = ', header_fix%nlevs - print*, 'header_fix%ianldate = ', header_fix%ianldate - print*, 'header_fix%iint = ', header_fix%iint - print*, 'header_fix%ireal = ', header_fix%ireal - print*, 'header_fix%iextra = ', header_fix%iextra - - print*, 'istatus = ', istatus - print*, '' + write(6,*) 'ftin = ', ftin + write(6,*) 'header_fix%isis = ', header_fix%isis + write(6,*) 'header_fix%id = ', header_fix%id + write(6,*) 'header_fix%obstype = ', header_fix%obstype + write(6,*) 'header_fix%jiter = ', header_fix%jiter + write(6,*) 'header_fix%nlevs = ', header_fix%nlevs + write(6,*) 'header_fix%ianldate = ', header_fix%ianldate + write(6,*) 'header_fix%iint = ', header_fix%iint + write(6,*) 'header_fix%ireal = ', header_fix%ireal + write(6,*) 'header_fix%iextra = ', header_fix%iextra + + write(6,*) 'istatus = ', istatus + write(6,*) '' end subroutine read_ozndiag_header @@ -349,9 +340,9 @@ subroutine read_ozndiag_header_nc( ftin, header_fix, header_nlev, new_hdr, istat !--- get global attr ! ! This may look like overkill with a check on each variable - ! name, but due to the genius of the ncdiag library, a - ! failure on these read operations is fatal, because, reasons - ! I guess. Thus, this abundance of caution. + ! name, but a failure on these nc library read operations + ! is fatal. Thus, this abundance of caution verifying the + ! variable exists before attempting to retreive it. ! if( verify_var_name_nc( "date_time" ) ) then call nc_diag_read_get_global_attr(ftin, "date_time", idate) @@ -377,12 +368,6 @@ subroutine read_ozndiag_header_nc( ftin, header_fix, header_nlev, new_hdr, istat write(6,*) 'WARNING: unable to read global var Observation_type from file ' end if - if( verify_var_name_nc( "Number_of_state_vars" ) ) then - call nc_diag_read_get_global_attr(ftin, "Number_of_state_vars", nsdim ) - else - write(6,*) 'WARNING: unable to read global var Number_of_state_vars from file ' - end if - if( verify_var_name_nc( "pobs" ) ) then call nc_diag_read_get_global_attr(ftin, "pobs", pobs ) else @@ -401,7 +386,6 @@ subroutine read_ozndiag_header_nc( ftin, header_fix, header_nlev, new_hdr, istat write(6,*) 'WARNING: unable to read global var tnoise from file ' end if - !------------------------------------------------------------------- ! The Anaysis_Use_Flag in the netcdf file resides in the ! obs data rather than global (equivalent of binary file header @@ -438,6 +422,8 @@ subroutine read_ozndiag_header_nc( ftin, header_fix, header_nlev, new_hdr, istat !--- allocate if necessary + write(6,*) 'header_fix%nlevs, nlevs_last = ', header_fix%nlevs, nlevs_last + if( header_fix%nlevs /= nlevs_last )then if( nlevs_last > 0 )then deallocate( header_nlev ) @@ -455,8 +441,10 @@ subroutine read_ozndiag_header_nc( ftin, header_fix, header_nlev, new_hdr, istat header_nlev(k)%iouse = iuse_flag(k) end do - deallocate( pobs,gross,tnoise,iuse_flag ) - + if( allocated( pobs )) deallocate( pobs ) + if( allocated( gross )) deallocate( gross ) + if( allocated( tnoise )) deallocate( tnoise ) + if( allocated( iuse_flag )) deallocate( iuse_flag ) end subroutine read_ozndiag_header_nc @@ -511,8 +499,8 @@ subroutine read_ozndiag_header_bin( ftin, header_fix, header_nlev, new_hdr, ista if( header_fix%ireal /= IREAL_RESERVE ) then - print *, '### ERROR: UNEXPECTED DATA RECORD FORMAT' - print *, 'ireal =', header_fix%ireal + write(6,*) '### ERROR: UNEXPECTED DATA RECORD FORMAT' + write(6,*) 'ireal =', header_fix%ireal stop 99 endif @@ -524,6 +512,7 @@ subroutine read_ozndiag_header_bin( ftin, header_fix, header_nlev, new_hdr, ista !--- allocate if necessary + write(6,*) 'header_fix%nlevs, nlevs_last = ', header_fix%nlevs, nlevs_last if( header_fix%nlevs /= nlevs_last )then if( nlevs_last > 0 )then deallocate( header_nlev ) @@ -545,7 +534,11 @@ subroutine read_ozndiag_header_bin( ftin, header_fix, header_nlev, new_hdr, ista header_nlev(k)%err = err(k) header_nlev(k)%iouse = iouse(k) end do - deallocate (pob,grs,err,iouse) + + if( allocated( pob )) deallocate( pob ) + if( allocated( grs )) deallocate( grs ) + if( allocated( err )) deallocate( err ) + if( allocated( iouse )) deallocate( iouse ) end subroutine read_ozndiag_header_bin @@ -628,7 +621,7 @@ subroutine read_ozndiag_data_nc( ftin, header_fix, data_fix, data_nlev, data_ext logical :: test cur_idx = ncdiag_open_id( nopen_ncdiag ) - + !---------------------------------------------------------- ! The binary file read (the original version of the file ! read) is designed to be called in a loop, as it reads @@ -636,12 +629,12 @@ subroutine read_ozndiag_data_nc( ftin, header_fix, data_fix, data_nlev, data_ext ! ! The newer netcdf read processes each field for all obs ! so it can grab all the obs data in a single call. The - ! calling routine in time.f90 uses the iflag value to - ! process the results, and non-zero value to indicate - ! everything has been read. In order to use this same - ! iflag mechanism we'll use the ncdiag_open_status%nc_read - ! field, setting it to true and iflag to 0 after reading, - ! and if nc_read is already true then set iflag to -1. + ! calling routine uses the iflag value to process the, + ! and non-zero value to indicate everything has been read. + ! In order to use this same iflag mechanism we'll use the + ! ncdiag_open_status%nc_read field, setting it to true and + ! iflag to 0 after reading, and if nc_read is already true + ! then set iflag to -1. ! ! It's not as clear or clean as it should be, so I'll ! leave this comment in as a note-to-self to redesign this @@ -705,23 +698,39 @@ subroutine read_ozndiag_data_nc( ftin, header_fix, data_fix, data_nlev, data_ext write(6,*) 'WARNING: unable to read global var Time from file ' end if - !----------------------------------------------- + !------------------------------------------------------- ! lat, lon, obstime are dimensioned to nrecords - ! read those as nobs * nlevs + ! read those as nobs * nlevs with all lat/lon values + ! for a given obs being the same. So a source with 22 + ! levels has that value repeated 22 times for each + ! obs. The data_fix structure is dimentioned to nobs, + ! not nrecords to match the binary file structure. + ! + ! Note that only sbuv2_n19 and ompsnp_npp (at present) + ! have nlevs > 1. ! do ii=1,ntobs - data_fix(ii)%lat = lat(ii + ((ii-1)*nlevs) ) - data_fix(ii)%lon = lon(ii + ((ii-1)*nlevs) ) - data_fix(ii)%obstime = obstime(ii + ((ii-1)*nlevs) ) + if( nlevs > 1 ) then + data_fix(ii)%lat = lat(1 + ((ii-1)*nlevs) ) + data_fix(ii)%lon = lon(1 + ((ii-1)*nlevs) ) + data_fix(ii)%obstime = obstime(1 + ((ii-1)*nlevs) ) + else + data_fix(ii)%lat = lat(ii) + data_fix(ii)%lon = lon(ii) + data_fix(ii)%obstime = obstime(ii) + end if + end do - deallocate( lat, lon, obstime ) + if( allocated( lat )) deallocate( lat ) + if( allocated( lon )) deallocate( lon ) + if( allocated( obstime )) deallocate( obstime ) !--------------------------------- ! load data_nlev structure ! - allocate( data_nlev( header_fix%nlevs,nrecords ) ) allocate( ozobs(nrecords) ) + allocate( ozone_inv(nrecords) ) allocate( varinv(nrecords) ) allocate( sza(nrecords) ) @@ -769,23 +778,23 @@ subroutine read_ozndiag_data_nc( ftin, header_fix, data_fix, data_nlev, data_ext ! All vars used to read the file are dimensioned ! to nrecord, which is nobs * nlevs ! - do jj=0,ntobs-1 + do jj=1,ntobs do ii=1,header_fix%nlevs - data_nlev(ii,jj)%ozobs = ozobs( ii + (jj * nlevs) ) - data_nlev(ii,jj)%ozone_inv = ozone_inv( ii + (jj * nlevs) ) - data_nlev(ii,jj)%varinv = varinv( ii + (jj * nlevs) ) - data_nlev(ii,jj)%sza = sza( ii + (jj * nlevs) ) - data_nlev(ii,jj)%fovn = fovn( ii + (jj * nlevs) ) - data_nlev(ii,jj)%toqf = toqf( ii + (jj * nlevs) ) + data_nlev(ii,jj)%ozobs = ozobs( ii + ((jj-1) * nlevs) ) + data_nlev(ii,jj)%ozone_inv = ozone_inv( ii + ((jj-1) * nlevs) ) + data_nlev(ii,jj)%varinv = varinv( ii + ((jj-1) * nlevs) ) + data_nlev(ii,jj)%sza = sza( ii + ((jj-1) * nlevs) ) + data_nlev(ii,jj)%fovn = fovn( ii + ((jj-1) * nlevs) ) + data_nlev(ii,jj)%toqf = toqf( ii + ((jj-1) * nlevs) ) end do end do - deallocate( ozobs ) - deallocate( ozone_inv ) - deallocate( varinv ) - deallocate( sza ) - deallocate( fovn ) - deallocate( toqf ) + if( allocated( ozobs )) deallocate( ozobs ) + if( allocated( ozone_inv )) deallocate( ozone_inv ) + if( allocated( varinv )) deallocate( varinv ) + if( allocated( sza )) deallocate( sza ) + if( allocated( fovn )) deallocate( fovn ) + if( allocated( toqf )) deallocate( toqf ) ncdiag_open_status(cur_idx)%nc_read = .true. @@ -831,6 +840,7 @@ subroutine read_ozndiag_data_bin( ftin, header_fix, data_fix, data_nlev, data_ex read(ftin,IOSTAT=iflag) ntobs write(6,*) ' READ 1, ntobs, iflag = ', ntobs, iflag + write(6,*) 'header_fix%nlevs, nlevs_last = ', header_fix%nlevs, nlevs_last if( header_fix%nlevs /= nlevs_last )then if( nlevs_last > 0 )then write(6,*) ' DEALLOCATING data_nlev, data_fix, data_mpi' @@ -845,8 +855,9 @@ subroutine read_ozndiag_data_bin( ftin, header_fix, data_fix, data_nlev, data_ex nlevs_last = header_fix%nlevs endif + write(6,*) 'iextra_last = ', iextra_last if (iextra_last > 0) then - deallocate (data_extra) + deallocate ( data_extra ) endif allocate( data_extra(header_fix%iextra,ntobs) ) @@ -869,7 +880,7 @@ subroutine read_ozndiag_data_bin( ftin, header_fix, data_fix, data_nlev, data_ex end do end do - deallocate(tmp_extra) + if( allocated( tmp_extra )) deallocate( tmp_extra ) endif do j=1,ntobs @@ -877,7 +888,7 @@ subroutine read_ozndiag_data_bin( ftin, header_fix, data_fix, data_nlev, data_ex data_fix(j)%lon = tmp_fix(2,j) data_fix(j)%obstime = tmp_fix(3,j) end do - deallocate(tmp_fix) + if( allocated( tmp_fix )) deallocate( tmp_fix ) do j=1,ntobs do i=1,header_fix%nlevs @@ -889,7 +900,7 @@ subroutine read_ozndiag_data_bin( ftin, header_fix, data_fix, data_nlev, data_ex data_nlev(i,j)%toqf = tmp_nlev(6,i,j) end do end do - deallocate(tmp_nlev) + if( allocated( tmp_nlev )) deallocate( tmp_nlev ) nlevs_last = -1 @@ -966,5 +977,5 @@ logical function verify_var_name_nc( test_name ) end function verify_var_name_nc -end module read_diag +end module oznmon_read_diag diff --git a/util/Ozone_Monitor/nwprod/oznmon_shared.v2.0.0/sorc/oznmon_time.fd/time.f90 b/util/Ozone_Monitor/nwprod/oznmon_shared/sorc/oznmon_time.fd/time.f90 similarity index 99% rename from util/Ozone_Monitor/nwprod/oznmon_shared.v2.0.0/sorc/oznmon_time.fd/time.f90 rename to util/Ozone_Monitor/nwprod/oznmon_shared/sorc/oznmon_time.fd/time.f90 index d6402196aa..15d70cbaa2 100755 --- a/util/Ozone_Monitor/nwprod/oznmon_shared.v2.0.0/sorc/oznmon_time.fd/time.f90 +++ b/util/Ozone_Monitor/nwprod/oznmon_shared/sorc/oznmon_time.fd/time.f90 @@ -1,5 +1,5 @@ program main - use read_diag + use oznmon_read_diag use valid use kinds, only: i_kind @@ -252,7 +252,6 @@ program main ! check in this comment just in case it's needed some day. ! - write(6,*) 'data_nlev(j,iobs)%varinv = ', j, iobs, data_nlev(j,iobs)%varinv pen = data_nlev(j,iobs)%varinv*(data_nlev(j,iobs)%ozone_inv)**2 cor_omg(1) = data_nlev(j,iobs)%ozone_inv cor_omg(2) = (cor_omg(1))**2 diff --git a/util/Ozone_Monitor/nwprod/oznmon_shared.v2.0.0/sorc/oznmon_time.fd/valid.f90 b/util/Ozone_Monitor/nwprod/oznmon_shared/sorc/oznmon_time.fd/valid.f90 similarity index 100% rename from util/Ozone_Monitor/nwprod/oznmon_shared.v2.0.0/sorc/oznmon_time.fd/valid.f90 rename to util/Ozone_Monitor/nwprod/oznmon_shared/sorc/oznmon_time.fd/valid.f90 diff --git a/util/Ozone_Monitor/nwprod/oznmon_shared/ush/clean_tankdir.sh b/util/Ozone_Monitor/nwprod/oznmon_shared/ush/clean_tankdir.sh new file mode 100755 index 0000000000..87319a961c --- /dev/null +++ b/util/Ozone_Monitor/nwprod/oznmon_shared/ush/clean_tankdir.sh @@ -0,0 +1,123 @@ +#!/bin/bash + +#------------------------------------------------------------------ +# +# clean_tankdir.sh +# +#------------------------------------------------------------------ + + echo "--> clean_tankdir.sh" + rc=0 + + area=$1 + days_to_keep=$2 + echo " area, days_to_keep = ${area}, ${days_to_keep}" + + #--------------------------------------------------------------- + # Algorithm + # + # 1. Build list of $run.${PDY} || radmon.${PDY} sudirectories. + # 2. All subdirectories older than $days_to_keep get deleted. + #--------------------------------------------------------------- + if [[ ${area} = 'rgn' ]]; then + subdir="radmon" + else + subdir=${RUN} + fi + + echo "OZN_STATS_TANKDIR = ${OZN_STATS_TANKDIR}" + + dirs=`ls ${OZN_STATS_TANKDIR}` + echo "dirs = ${dirs}" + + + if [[ ${area} = 'rgn' ]]; then + echo " in rgn" + #----------------------------------------------- + # Determine number of days from $PDATE for all + # directories that start with "radmon". Note + # that this expects the directories to be in + # the format of ${RUN}.yyyymmdd. + # + for dir in $dirs; do + file_name="${dir##*/}" + file="${file_name%.*}" + file_extension="${file_name##*.}" + echo "file, file_extension = ${file}, ${file_extension}" + + if [ ${file} = ${subdir} ]; then + + #---------------------------------------------- + # Use date utility to determine number of days + # from PDATE. Note that time difference is + # calculated in seconds, hence the division + # by the number of seconds/day. + # + days=$(( ($(date --date=${PDY} +%s) - $(date --date=${file_extension} +%s) )/(60*60*24) )) + echo "days = ${days}" + + #---------------------------------------- + # rm anything older than $days_to_keep + # + if [ $days -gt ${days_to_keep} ]; then + + cycle_dir="${OZN_STATS_TANKDIR}/${dir}" + echo "cycle_dir = ${cycle_dir}" + + if [[ -d ${cycle_dir} ]]; then + echo "RM ${cycle_dir}" + rm -rf ${cycle_dir} + fi + fi + + fi + done + + else + + #----------------------------------------------- + # Determine number of days from $PDATE for all + # directories that start with "gdas". Note + # that this expects the directories to be in + # the format of ${RUN}.yyyymmdd. + # + for dir in $dirs; do + file_name="${dir##*/}" + file="${file_name%.*}" + file_extension="${file_name##*.}" + + if [ ${file} = ${subdir} ]; then + + #---------------------------------------------- + # Use date utility to determine number of days + # from PDATE. Note that time difference is + # calculated in seconds, hence the division + # by the number of seconds/day. + # + days=$(( ($(date --date=${PDY} +%s) - $(date --date=${file_extension} +%s) )/(60*60*24) )) + + #---------------------------------------- + # rm anything older than $days_to_keep + # + if [ $days -gt ${days_to_keep} ]; then + cycles="00 06 12 18" + + for cyc in $cycles; do + cycle_dir="${OZN_STATS_TANKDIR}/${dir}/${cyc}/oznmon" + if [[ -d ${cycle_dir} ]]; then + echo "RM ${cycle_dir}" + rm -rf ${cycle_dir} + fi + done + + fi + + fi + + done + fi + + echo "<-- clean_tankdir.sh" + +exit ${rc} + diff --git a/util/Ozone_Monitor/nwprod/oznmon_shared.v2.0.0/ush/ozn_xtrct.sh b/util/Ozone_Monitor/nwprod/oznmon_shared/ush/ozn_xtrct.sh similarity index 64% rename from util/Ozone_Monitor/nwprod/oznmon_shared.v2.0.0/ush/ozn_xtrct.sh rename to util/Ozone_Monitor/nwprod/oznmon_shared/ush/ozn_xtrct.sh index 5ee05253fe..f301a95fb3 100755 --- a/util/Ozone_Monitor/nwprod/oznmon_shared.v2.0.0/ush/ozn_xtrct.sh +++ b/util/Ozone_Monitor/nwprod/oznmon_shared/ush/ozn_xtrct.sh @@ -1,8 +1,8 @@ -#!/bin/ksh +#!/bin/bash #------------------------------------------------------------------ # ozn_xtrct.sh # -# This script performs the data extraction from the cnvstat's +# This script performs the data extraction from the oznstat # diagnostic files. The resulting data (*.ieee_d) files, GrADS # control files and stdout files will be moved to the # $TANKverf_ozn. @@ -14,7 +14,7 @@ # # Return values are # 0 = normal -# 2 = unable to generate SATYPE list; may indicate no diag +# 2 = unable to generate satype list; may indicate no diag # files found in oznstat file #------------------------------------------------------------------ @@ -24,33 +24,35 @@ set -ax #-------------------------------------------------- # check_diag_files # -# Compare SATYPE (which contains the contents of +# Compare $satype (which contains the contents of # gdas_oznmon_satype.txt to $avail_satype which is # determined by the contents of the oznstat file. # Report any missing diag files in a file named # bad_diag.$PDATE # check_diag_files() { - PDATE=$1 - SATYPE=$2 + pdate=$1 + found_satype=$2 avail_satype=$3 - out_file="bad_diag.${PDATE}" - echo "--> check_diag_files" + out_file="bad_diag.${pdate}" - for type in ${SATYPE}; do - check=`echo $avail_satype | grep $type` - len_check=`echo -n "$check" | wc -c` + echo ""; echo ""; echo "--> check_diag_files" - if [[ $len_check -le 1 ]]; then - echo "missing diag file -- diag_$type.${PDATE}.gz not found " >> ./$out_file + for type in ${found_satype}; do + check=`echo ${avail_satype} | grep ${type}` + len_check=`echo -n "${check}" | wc -c` + + if [[ ${len_check} -le 1 ]]; then + echo "missing diag file -- diag_${type}_ges.${pdate}.gz not found " >> ./${out_file} fi done - echo "<-- check_diag_files" + echo "<-- check_diag_files"; echo ""; echo "" } + echo "start ozn_xtrct.sh" iret=0 @@ -75,7 +77,7 @@ fi # validate=".FALSE." if [[ $VALIDATE_DATA -eq 1 ]]; then - if [[ ! -e $ozn_val_file ]]; then + if [[ ! -e $ozn_val_file && ! -h $ozn_val_file ]]; then echo "WARNING: VALIDATE_DATA set to 1, but unable to locate $ozn_val_file" echo " Setting VALIDATE_DATA to 0/OFF" VALIDATE_DATA=0 @@ -91,48 +93,42 @@ echo "VALIDATE_DATA, validate = $VALIDATE_DATA, $validate " #------------------------------------------------------------------ -# ptype here is the processing type which is intended to be "ges" +# ozn_ptype here is the processing type which is intended to be "ges" # or "anl". Default is "ges". # ozn_ptype=${ozn_ptype:-"ges anl"} #--------------------------------------------------------------------------- -# Build SATYPE list from files found in oznstat file. +# Build satype list from the available diag files. # -# NOTE: at some point we'll want to make this a fixed list so we can -# detect missing instruments, allowing new sources to be added like the -# radmon does. -# -# An empty SATYPE list means there are no diag files to process. That's +# An empty satype list means there are no diag files to process. That's # a problem, reported by an iret value of 2 # avail_satype=`ls -l d*ges* | sed -e 's/_/ /g;s/\./ /' | gawk '{ print $11 "_" $12 }'` -if [[ $DO_DATA_RPT -eq 1 ]]; then - if [[ -e ${satype_file} ]]; then - SATYPE=`cat ${satype_file}` - check_diag_files ${PDATE} "${SATYPE}" "${avail_satype}" +if [[ ${DO_DATA_RPT} -eq 1 ]]; then + if [[ -e ${SATYPE_FILE} ]]; then + satype=`cat ${SATYPE_FILE}` + check_diag_files ${PDATE} "${satype}" "${avail_satype}" else - echo "WARNING: missing ${satype_file}" + echo "WARNING: missing ${SATYPE_FILE}" fi fi -echo $SATYPE - -len_satype=`echo -n "$SATYPE" | wc -c` +len_satype=`echo -n "${satype}" | wc -c` -if [[ $len_satype -le 1 ]]; then - SATYPE=$aval_satype +if [[ ${len_satype} -le 1 ]]; then + satype=${avail_satype} fi -echo $SATYPE +echo ${satype} -len_satype=`echo -n "$SATYPE" | wc -c` +len_satype=`echo -n "${satype}" | wc -c` -if [[ $DO_DATA_RPT -eq 1 && $len_satype -lt 1 ]]; then +if [[ ${DO_DATA_RPT} -eq 1 && ${len_satype} -lt 1 ]]; then iret=2 else @@ -140,28 +136,27 @@ else #-------------------------------------------------------------------- # Copy extraction programs to working directory # - $NCP ${HOMEoznmon}/exec/oznmon_time.x ./oznmon_time.x + ${NCP} ${HOMEoznmon}/exec/oznmon_time.x ./oznmon_time.x if [[ ! -e oznmon_time.x ]]; then iret=2 - exit $iret + exit ${iret} fi - $NCP ${HOMEoznmon}/exec/oznmon_horiz.x ./oznmon_horiz.x + ${NCP} ${HOMEoznmon}/exec/oznmon_horiz.x ./oznmon_horiz.x if [[ ! -e oznmon_horiz.x ]]; then iret=3 - exit $iret + exit ${iret} fi #--------------------------------------------------------------------------- - # NOTE: If ges && anl are to be processed then add an outer for loop on - # $ozn_ptype + # Outer loop over $ozn_ptype (default values 'ges', 'anl') # - echo "ozn_ptype = $ozn_ptype" + echo "ozn_ptype = ${ozn_ptype}" for ptype in ${ozn_ptype}; do - echo "ptype = $ptype" + echo "ptype = ${ptype}" - for type in ${SATYPE}; do + for type in ${satype}; do mv diag_${type}_${ptype}.${PDATE}.gz ${type}.${ptype}.gz gunzip ./${type}.${ptype}.gz done @@ -170,13 +165,13 @@ else #-------------------------------------------------------------------- # Run programs for given time - iyy=`echo $PDATE | cut -c1-4` - imm=`echo $PDATE | cut -c5-6` - idd=`echo $PDATE | cut -c7-8` - ihh=`echo $PDATE | cut -c9-10` + iyy=`echo ${PDATE} | cut -c1-4` + imm=`echo ${PDATE} | cut -c5-6` + idd=`echo ${PDATE} | cut -c7-8` + ihh=`echo ${PDATE} | cut -c9-10` - for type in ${SATYPE}; do - echo "processing ptype, type: $ptype, $type" + for type in ${satype}; do + echo "processing ptype, type: ${ptype}, ${type}" rm -f input cat << EOF > input @@ -195,7 +190,7 @@ cat << EOF > input region(4)='20S-20N', rlonmin(4)=-180.0,rlonmax(4)=180.0,rlatmin(4)=-20.0,rlatmax(4)= 20.0, region(5)='20S-70S', rlonmin(5)=-180.0,rlonmax(5)=180.0,rlatmin(5)=-70.0,rlatmax(5)=-20.0, region(6)='70S-90S', rlonmin(6)=-180.0,rlonmax(6)=180.0,rlatmin(6)=-90.0,rlatmax(6)=-70.0, - validate=$validate, + validate=${validate}, new_hdr=${new_hdr}, ptype=${ptype}, netcdf=${netcdf_boolean} @@ -203,11 +198,11 @@ cat << EOF > input EOF - echo "oznmon_time.x HAS STARTED $type" + echo "oznmon_time.x HAS STARTED ${type}" ./oznmon_time.x < input > stdout.time.${type}.${ptype} - echo "oznmon_time.x HAS ENDED $type" + echo "oznmon_time.x HAS ENDED ${type}" if [[ ! -d ${TANKverf_ozn}/time ]]; then mkdir -p ${TANKverf_ozn}/time @@ -215,8 +210,6 @@ EOF $NCP ${type}.${ptype}.ctl ${TANKverf_ozn}/time/ $NCP ${type}.${ptype}.${PDATE}.ieee_d ${TANKverf_ozn}/time/ -# $COMPRESS stdout.time.${type}.${ptype} -# $NCP stdout.time.${type}.${ptype}.${Z} ${TANKverf_ozn}/time/ $NCP bad* ${TANKverf_ozn}/time/ rm -f input @@ -236,11 +229,11 @@ cat << EOF > input / EOF - echo "oznmon_horiz.x HAS STARTED $type" + echo "oznmon_horiz.x HAS STARTED ${type}" ./oznmon_horiz.x < input > stdout.horiz.${type}.${ptype} - echo "oznmon_horiz.x HAS ENDED $type" + echo "oznmon_horiz.x HAS ENDED ${type}" if [[ ! -d ${TANKverf_ozn}/horiz ]]; then mkdir -p ${TANKverf_ozn}/horiz @@ -250,23 +243,29 @@ EOF $COMPRESS ${type}.${ptype}.${PDATE}.ieee_d $NCP ${type}.${ptype}.${PDATE}.ieee_d.${Z} ${TANKverf_ozn}/horiz/ -# $COMPRESS stdout.horiz.${type}.${ptype} -# $NCP stdout.horiz.${type}.${ptype}.${Z} ${TANKverf_ozn}/horiz/ echo "finished processing ptype, type: $ptype, $type" - done # type in SATYPE + done # type in satype done # ptype in $ozn_ptype tar -cvf stdout.horiz.tar stdout.horiz* - $COMPRESS stdout.horiz.tar - $NCP stdout.horiz.tar.${Z} ${TANKverf_ozn}/horiz/ + ${COMPRESS} stdout.horiz.tar + ${NCP} stdout.horiz.tar.${Z} ${TANKverf_ozn}/horiz/ tar -cvf stdout.time.tar stdout.time* - $COMPRESS stdout.time.tar - $NCP stdout.time.tar.${Z} ${TANKverf_ozn}/time/ + ${COMPRESS} stdout.time.tar + ${NCP} stdout.time.tar.${Z} ${TANKverf_ozn}/time/ fi -echo "ozn_xtrct.sh HAS ENDED, iret = $iret" +#------------------------------------------------------- +# Conditionally remove data files older than 40 days +# +if [[ ${CLEAN_TANKDIR} -eq 1 ]]; then + ${HOMEoznmon}/ush/clean_tankdir.sh glb 40 +fi + + +echo "ozn_xtrct.sh HAS ENDED, iret = ${iret}" -exit $iret +exit ${iret} diff --git a/util/Ozone_Monitor/parm/OznMon.ver b/util/Ozone_Monitor/parm/OznMon.ver deleted file mode 100644 index f1350a658a..0000000000 --- a/util/Ozone_Monitor/parm/OznMon.ver +++ /dev/null @@ -1,2 +0,0 @@ -export gdas_oznmon_ver=v2.0.0 -export shared_oznmon_ver=v2.0.0 diff --git a/util/Ozone_Monitor/parm/OznMon_config b/util/Ozone_Monitor/parm/OznMon_config index 758849716d..13dabad249 100644 --- a/util/Ozone_Monitor/parm/OznMon_config +++ b/util/Ozone_Monitor/parm/OznMon_config @@ -18,7 +18,7 @@ if [[ $OZNMON_CONFIG -ne 1 ]]; then export OZNMON_CONFIG=1 -export MY_MACHINE=hera + export MY_MACHINE=wcoss_d #------------------------------------------------------------------- # Note: The file header in the oznstat file has slightly changed. @@ -38,7 +38,7 @@ export MY_MACHINE=hera # you checked out only the Ozone_Monitor portion of the branch then # MY_RADMON should point to that. # -export MY_OZNMON=${MY_OZNMON:-/scratch1/NCEPDEV/da/Edward.Safford/noscrub/ProdGSI/util/Ozone_Monitor} + export MY_OZNMON=${MY_OZNMON:-/gpfs/dell2/emc/modeling/noscrub/Edward.Safford/GSI/util/Ozone_Monitor} export OZN_SCRIPTS=${OZN_SCRIPTS:-${MY_OZNMON}/scripts} export OZN_DE_SCRIPTS=${OZN_DE_SCRIPTS:-${MY_OZNMON}/data_xtrct/ush} @@ -48,8 +48,9 @@ export MY_OZNMON=${MY_OZNMON:-/scratch1/NCEPDEV/da/Edward.Safford/noscrub/ProdGS export OZN_IG_GSCRPTS=${OZN_IG_GSCRPTS:-${MY_OZNMON}/image_gen/gscripts} export OZN_EXEDIR=${OZN_EXEDIR:-${MY_OZNMON}/exec} - export HOMEgdas_ozn=${HOMEgdas_ozn:-${MY_OZNMON}/nwprod/gdas_oznmon.${gdas_oznmon_ver}} - export HOMEoznmon=${HOMEoznmon:-${MY_OZNMON}/nwprod/oznmon_shared.${shared_oznmon_ver}} + export HOMEgdas_ozn=${HOMEgdas_ozn:-${MY_OZNMON}/nwprod/gdas_oznmon} + export FIXgdas_ozn=${FIXgdas_ozn:-${HOMEgdas_ozn}/fix} + export HOMEoznmon=${HOMEoznmon:-${MY_OZNMON}/nwprod/oznmon_shared} # # Add these gfs definitions to accomodate the changes @@ -65,13 +66,14 @@ export MY_OZNMON=${MY_OZNMON:-/scratch1/NCEPDEV/da/Edward.Safford/noscrub/ProdGS # and the succedding scripts will construct and use subdirectories under # this location. # -export OZN_TANKDIR=${OZN_TANKDIR:-/scratch1/NCEPDEV/da/Edward.Safford/nbns} + export OZN_TANKDIR=${OZN_TANKDIR:-/u/Edward.Safford/nbns} if [[ $GLB_AREA -eq 1 ]]; then OZN_IMGN_TANKDIR=${OZN_TANKDIR}/imgn/${OZNMON_SUFFIX} else OZN_IMGN_TANKDIR=${OZN_TANKDIR}/imgn/regional/${OZNMON_SUFFIX} fi + export OZN_IMGN_TANKbase=${OZN_IMGN_TANKDIR} if [[ $OZN_USE_RUN -eq 1 ]]; then OZN_IMGN_TANKDIR=${OZN_IMGN_TANKDIR}/${RUN} @@ -91,9 +93,9 @@ export OZN_TANKDIR=${OZN_TANKDIR:-/scratch1/NCEPDEV/da/Edward.Safford/nbns} # # Log and work space definitions # -export OZN_PTMP=${OZN_PTMP:-/scratch2/NCEPDEV/stmp3} + export OZN_PTMP=${OZN_PTMP:-/gpfs/dell2/ptmp} export PTMP_USER=${PTMP_USER:-${OZN_PTMP}/${LOGNAME}} -export OZN_STMP=${OZN_STMP:-/scratch2/NCEPDEV/stmp1} + export OZN_STMP=${OZN_STMP:-/gpfs/dell2/stmp} export STMP_USER=${STMP_USER:-${OZN_STMP}/${LOGNAME}} @@ -111,9 +113,9 @@ export OZN_STMP=${OZN_STMP:-/scratch2/NCEPDEV/stmp1} # # Webserver settings # -export WEB_SVR=${WEB_SVR:-emcrzdm} -export WEB_USER=${WEB_USER:-esafford} -export WEB_DIR=${WEB_DIR:-/home/people/emc/www/htdocs/gmb/gdas/es_ozn/pngs} + export WEB_SVR=${WEB_SVR:-emcrzdm} + export WEB_USER=${WEB_USER:-esafford} + export WEB_DIR=${WEB_DIR:-/home/people/emc/www/htdocs/gmb/gdas/es_ozn/pngs} # @@ -122,26 +124,7 @@ export WEB_DIR=${WEB_DIR:-/home/people/emc/www/htdocs/gmb/gdas/es_ozn/pngs} export NCP=${NCP:-"/bin/cp -f"} export Z=${Z:-"gz"} - if [[ $MY_MACHINE = "wcoss" ]]; then - shell=sh - . /usrx/local/Modules/default/init/${shell} - module load lsf - module load prod_util - module load util_shared - module load GrADS - - export GRADS=`which grads` - export STNMAP=`which stnmap` - export SUB=`which bsub` - - export NWPROD=/nwprod - export NDATE=${NWPROD}/util/exec/ndate - export COMPRESS=${COMPRESS:-/bin/gzip} - export UNCOMPRESS=${UNCOMPRESS:-"/bin/gunzip -f"} - export RSYNC=`which rsync` - - - elif [[ $MY_MACHINE = "wcoss_d" ]]; then + if [[ $MY_MACHINE = "wcoss_d" ]]; then shell=sh source /usrx/local/prod/lmod/lmod/init/${shell} @@ -166,7 +149,7 @@ export WEB_DIR=${WEB_DIR:-/home/people/emc/www/htdocs/gmb/gdas/es_ozn/pngs} export GRADS=`which grads` export STNMAP=`which stnmap` - elif [[ $MY_MACHINE = "cray" ]]; then + elif [[ $MY_MACHINE = "wcoss_c" ]]; then . /opt/modules/3.2.6.7/init/sh module use -a /gpfs/hps/nco/ops/nwprod/modulefiles module use -a /usrx/local/dev/modulefiles diff --git a/util/Ozone_Monitor/parm/OznMon_user_settings b/util/Ozone_Monitor/parm/OznMon_user_settings index 70fbc1b9c4..864ed81c30 100644 --- a/util/Ozone_Monitor/parm/OznMon_user_settings +++ b/util/Ozone_Monitor/parm/OznMon_user_settings @@ -10,19 +10,19 @@ # ACCOUNT is used on zeus only for use with the qsub -a flag. It is # empty on other platforms. # -export ACCOUNT=${ACCOUNT:-fv3-cpu} +export ACCOUNT=${ACCOUNT:-} # # PROJECT is used on wcoss only with the bjob -P flag. It is # empty on other platforms. # -export PROJECT= +export PROJECT=${PROJECT:-GFS-DEV} # # JOB_QUEUE is used on wcoss only with the bjob -q flag. It is # empty on other platforms. # -export JOB_QUEUE= +export JOB_QUEUE=${JOB_QUEUE:-dev_shared} # # GLB_AREA is either 1 (global) or 0 (regional) @@ -37,7 +37,7 @@ export GLB_AREA=${GLB_AREA:-1} # horizontal data when it's needed rather than storing huge files all the # time). # -export OZNSTAT_LOCATION=${OZNSTAT_LOCATION:-/com2/gfs/prod} +export OZNSTAT_LOCATION=${OZNSTAT_LOCATION:-/gpfs/dell1/nco/ops/com/gfs/prod} # # USE_ANL switches on/off data extraction for analysis files (ges is always on) @@ -73,18 +73,23 @@ export OZN_USE_RUN=${OZN_USE_RUN:-1} # desirable. It is not normally necesary to apply this to parallels. # 0 = off, 1 = on # -export DO_DATA_RPT=${DO_DATA_RPT:-0} +export DO_DATA_RPT=${DO_DATA_RPT:-1} # MAIL_TO is the the primary recipient of generated email warning messages # (if DO_DATA_RPT = 1). # -export MAIL_TO=${MAIL_TO:-' '} +export MAIL_TO=${MAIL_TO:-'edward.safford@noaa.gov'} # MAIL_CC is the the cc list of recipients of generated email warning messages # (if DO_DATA_RPT = 1). # -export MAIL_CC=${MAIL_CC:-' '} +if [[ -e /u/${LOGNAME}/bin/get_cc_list.pl ]]; then + cc_list=`/u/${LOGNAME}/bin/get_cc_list.pl --nr ${OZNMON_SUFFIX}_${RUN} --mon OznMon` +else + cc_list="" +fi +export MAIL_CC=${MAIL_CC:=${cc_list}} # # RUN_ONLY_ON_DEV switches on/off the constraint to run only on the @@ -117,3 +122,11 @@ export REGIONAL_RR=${REGIONAL_RR:-0} # refresh sources. # export CYCLE_INTERVAL=${CYCLE_INTERVAL:-6} + + +# +# CLEAN_TANKDIR controls automatic removal of old data files in +# TANKDIR. +# +# 0 = no automatic removal, 1 = automatic removal +export CLEAN_TANKDIR=${CLEAN_TANKDIR:=1} diff --git a/util/Radiance_Monitor/CMakeLists.txt b/util/Radiance_Monitor/CMakeLists.txt index b45f577b90..707d286e6b 100644 --- a/util/Radiance_Monitor/CMakeLists.txt +++ b/util/Radiance_Monitor/CMakeLists.txt @@ -72,12 +72,6 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) # Set Host specific flags and options setHOST() - if(FIND_HDF5_HL) - find_package(HDF5 COMPONENTS C HL Fortran_HL ) - elseif(FIND_HDF5) - find_package(HDF5) - endif() - find_package(MPI REQUIRED) message("MPI version is ${MPI_Fortran_VERSION}") message("MPI f90 version is ${MPI_Fortran_HAVE_F90_MODULE}") @@ -86,14 +80,7 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) add_definitions(${MPI_Fortran_COMPILE_FLAGS}) include_directories(${MPI_Fortran_INCLUDE_DIRS} ${MPI_INCLUDE_PATH} "./" ${CMAKE_INCLUDE_OUTPUT_DIRECTORY}) link_directories(${MPI_Fortran_LIBRARIES} ${ARCHIVE_OUTPUT_PATH} ) - find_package( NetCDF REQUIRED) - if(NETCDF4) - if(CMAKE_MAJOR_VERSION GREATER 2) - find_package( ZLIB ) - endif() - find_package( CURL ) - endif() - + find_package( NetCDF COMPONENTS C Fortran REQUIRED) find_package( W3NCO ) set(BUILD_NCDIAG ON) @@ -103,10 +90,10 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) endif() -add_subdirectory(nwprod/radmon_shared.v3.0.0/sorc/verf_radang.fd) -add_subdirectory(nwprod/radmon_shared.v3.0.0/sorc/verf_radbcoef.fd) -add_subdirectory(nwprod/radmon_shared.v3.0.0/sorc/verf_radbcor.fd) -add_subdirectory(nwprod/radmon_shared.v3.0.0/sorc/verf_radtime.fd) +add_subdirectory(nwprod/radmon_shared/sorc/verf_radang.fd) +add_subdirectory(nwprod/radmon_shared/sorc/verf_radbcoef.fd) +add_subdirectory(nwprod/radmon_shared/sorc/verf_radbcor.fd) +add_subdirectory(nwprod/radmon_shared/sorc/verf_radtime.fd) add_subdirectory(data_extract/sorc/radmon_mk_base.fd) add_subdirectory(data_extract/sorc/radmon_validate_tm.fd) add_subdirectory(image_gen/src/radmon_ig_angle.fd) diff --git a/util/Radiance_Monitor/README b/util/Radiance_Monitor/README index b6ba015509..1159f284b6 100644 --- a/util/Radiance_Monitor/README +++ b/util/Radiance_Monitor/README @@ -6,11 +6,11 @@ javascript or optionally GrADS. The package also may optionally perform data validation and error checking and report problems using email. The package is supported on wcoss, theia, and the cray systems. -The package is organized in two main pieces, the data_extract and image_gen. There -is also an nwprod directory, which contains the major components of the -data_extract portion. Part of the data extraction has been incorporated into the -operational GFS and NAM. Those components are located within the package's nwprod -directory. +The package is organized in two main pieces, the data_extract and image_gen +(image generation). There is also an nwprod directory, which contains the major +components of the data_extract portion. Part of the data extraction has been +incorporated into the operational GFS. Those components are located within the +package's nwprod directory. The parm directory contains configuration files used by the entire package. The data_extract and image_gen directories also have parm diretories, @@ -33,34 +33,32 @@ the package. 2. Run the data extraction to create the binary data files. This can be done any time after the diagnostic file (radstat) is created. There are two ways to run the data -extraction. In RadMon/data_extract/ush/ there are two scripts named VrfyRad_glbl.sh and -VrfyRad_rgnl.sh. These can be run from a cron or command line. They function by -setting up the environment variables to run RadMon/nwprod/jobs/JGDAS_VRFYRAD.sms.prod. +extraction. In RadMon/data_extract/ush/ there are two scripts named RadMon_DE_glb.sh and +RadMon_DE_rgn.sh. These can be run from a cron or command line. They function by +setting up the environment variables to run RadMon/nwprod/gdas_radmon/jobs/JGDAS_ATMOS_VERFRAD. -Alternately the JGDAS_VRFYRAD.sms.prod job can be included in the vrfy.sh step in your +Alternately the JGDAS_ATMOS_VRFYRAD job can be included in the vrfy.sh step in your parallel. Instructions for this are included on the GSI trac page's wiki. 3. Go to the RadMon/image_gen/html directory and run Install_html.sh. This will build -the web site using the web settings specified in step 2, and the available -satellite/instrument sources from step 3. +the web site using the web settings specified in step 1, and the available +satellite/instrument sources from step 2. 4. Run the image generation. In RadMon/image_gen/ush there are two scripts, -CkPlt_glbl.sh and CkPlt_rgnl.sh. These can be run from the command line or as a cron. +RadMon_IG_glb.sh and RadMon_IG_rgn.sh. These can be run from the command line or as a cron. They create .txt files which are used to create interactive plots using javascript in the several .html files. If desired static plots may be created too using GrADS (see RadMon/parm/RadMon_user_settings for the static plot switch). All resulting .txt and .png files are moved to the $TANKDIR/imgn directory when the plotting scripts finish. -A third script, Plot.sh, is also available. It takes as input a specific start and -stop date/cycle so it can be used to plot a specific interval. - 5. If moving files from wcoss to the web server the image_gen/ush/Transfer.sh script may be used. It uses rsync to mirror the $TANKDIR/imgn/$suffix directory to the target -directory on the web server. +directory on the web server. This may be run automatically by the RadMon_IG script if +the RUN_TRANSFER switch in parm/RadMon_user_settings is set to 1. -If moving files from theia to emcrzdm, you need to manually move them first to wcoss and -then to the web server. Theia only allows file pulls, and emcrzdm is configured to -allow pushes only, and does not permit allow logins to other systems. +If moving files from hera to emcrzdm, you will need to manually move them first to wcoss +and then to the web server. Hera only allows file pulls, and emcrzdm is configured to +only permit pushes, and does not permit allow logins to other systems. 6. If you encounter problems please send me email and I'll be glad to help: edward.safford@noaa.gov diff --git a/util/Radiance_Monitor/RadMon_install.pl b/util/Radiance_Monitor/RadMon_install.pl index 1881da8506..4f655dfd4a 100755 --- a/util/Radiance_Monitor/RadMon_install.pl +++ b/util/Radiance_Monitor/RadMon_install.pl @@ -16,7 +16,7 @@ my $machine = `/usr/bin/perl get_hostname.pl`; my $my_machine="export MY_MACHINE=$machine"; - if( $machine ne "cray" && $machine ne "hera" && $machine ne "wcoss" && $machine ne "wcoss_d" ) { + if( $machine ne "wcoss_c" && $machine ne "hera" && $machine ne "wcoss_d" ) { die( "ERROR --- Unrecognized machine hostname, $machine. Exiting now...\n" ); } else { @@ -56,12 +56,9 @@ if( $machine eq "hera" ){ $tankdir = "/scratch1/NCEPDEV/da/$user_name/nbns"; } - elsif( $machine eq "cray" ){ + elsif( $machine eq "wcoss_c" ){ $tankdir = "/gpfs/hps/emc/da/noscrub/$user_name/nbns"; } - elsif( $machine eq "wcoss" ){ - $tankdir = "/global/save/$user_name/nbns"; - } elsif( $machine eq "wcoss_d" ){ $tankdir = "/gpfs/dell2/emc/modeling/noscrub/$user_name/nbns"; } @@ -149,61 +146,11 @@ my $my_ptmp; my $my_stmp; - if( $machine eq "wcoss" ) { - $ptmp = "/ptmpd1"; - print "Please specify PTMP location. This is used for temporary work space.\n"; - print " Available options are: \n"; - print " /ptmpd1 (default)\n"; - print " /ptmpd2\n"; - print " /ptmpd3\n"; - print " /ptmpp1\n"; - print " /ptmpp2\n"; - - print " Return to accept default location or enter new location now.\n"; - print "\n"; - print " Default PTMP: $ptmp \n"; - print " ?\n"; - my $new_ptmp = <>; - $new_ptmp =~ s/^\s+|\s+$//g; - - if( length($new_ptmp ) > 0 ) { - $ptmp = $new_ptmp; - } - $my_ptmp="export MY_PTMP=\${MY_PTMP:-$ptmp}"; - print "my_ptmp = $my_ptmp\n"; - print "\n\n"; - sleep( 1 ); - - $stmp = "/stmpd1"; - print "Please specify STMP location. This is used for temporary work space.\n"; - print " Available options are: \n"; - print " /stmpd1 (default)\n"; - print " /stmpd2\n"; - print " /stmpd3\n"; - print " /stmpp1\n"; - print " /stmpp2\n"; - - print " Return to accept default location or enter new location now.\n"; - print "\n"; - print " Default STMP: $stmp \n"; - print " ?\n"; - my $new_stmp = <>; - $new_stmp =~ s/^\s+|\s+$//g; - - if( length($new_stmp ) > 0 ) { - $stmp = $new_stmp; - } - $my_stmp="export MY_STMP=\${MY_STMP:-$stmp}"; - print "my_stmp = $my_stmp\n"; - print "\n\n"; - sleep( 1 ); - - } - elsif( $machine eq "wcoss_d" ){ + if( $machine eq "wcoss_d" ){ $my_ptmp="export MY_PTMP=\${MY_PTMP:-/gpfs/dell2/ptmp}"; $my_stmp="export MY_STMP=\${MY_STMP:-/gpfs/dell2/stmp}"; } - elsif( $machine eq "cray" ) { + elsif( $machine eq "wcoss_c" ) { $my_ptmp="export MY_PTMP=\${MY_PTMP:-/gpfs/hps/ptmp}"; $my_stmp="export MY_STMP=\${MY_STMP:-/gpfs/hps/stmp}"; } @@ -268,14 +215,14 @@ } my $project = "export PROJECT=\${PROJECT:-GDAS-T2O}"; - if( $machine ne "wcoss" && $machine ne "cray" && $machine ne "wcoss_d" ) { + if( $machine ne "wcoss_c" && $machine ne "wcoss_d" ) { $project="export PROJECT="; } my $job_queue="export JOB_QUEUE="; - if( $machine eq "cray" ) { + if( $machine eq "wcoss_c" ) { $job_queue="export JOB_QUEUE=\${JOB_QUEUE:-dev}"; - } elsif( $machine eq "wcoss" || $machine eq "wcoss_d" ){ + } elsif( $machine eq "wcoss_d" ){ $job_queue = "export JOB_QUEUE=\${JOB_QUEUE:-dev_shared}"; } diff --git a/util/Radiance_Monitor/build_RadMon_cmake.sh b/util/Radiance_Monitor/build_RadMon_cmake.sh index d323a354ab..596e8ce983 100755 --- a/util/Radiance_Monitor/build_RadMon_cmake.sh +++ b/util/Radiance_Monitor/build_RadMon_cmake.sh @@ -15,9 +15,14 @@ set -ax mode=${1:-} +MY_RADMON=${2:-} + top_level=${PWD} echo "top_level = ${top_level}" +export MY_RADMON=${MY_RADMON:-$top_level} +echo "MY_RADMON = ${MY_RADMON}" + if [[ -d /dcom && -d /hwrf ]] ; then . /usrx/local/Modules/3.2.10/init/sh target=wcoss @@ -31,6 +36,9 @@ elif [[ -d /ioddev_dell ]]; then elif [[ -d /scratch1 ]] ; then . /apps/lmod/lmod/init/sh target=hera +elif [[ -d /work ]]; then + . $MODULESHOME/init/sh + target=orion else echo "unknown target = $target" exit 9 @@ -59,7 +67,8 @@ fi #--------------------------------------------------- if [[ ${target} = "hera" || ${target} = "wcoss" \ - || ${target} = "wcoss_c" || ${target} = "wcoss_d" ]]; then + || ${target} = "wcoss_c" || ${target} = "wcoss_d" \ + || ${target} = "orion" ]]; then echo Building nwprod executables on ${target} echo @@ -74,7 +83,11 @@ if [[ ${target} = "hera" || ${target} = "wcoss" \ elif [ $target = wcoss -o $target = gaea ]; then module purge module load $dir_modules/modulefile.ProdGSI.$target - elif [ $target = hera -o $target = cheyenne ]; then + elif [ $target = hera -o $target = orion ]; then + module purge + module use $dir_modules + module load modulefile.ProdGSI.$target + elif [ $target = cheyenne ]; then module purge source $dir_modules/modulefile.ProdGSI.$target elif [ $target = wcoss_c ]; then diff --git a/util/Radiance_Monitor/data_extract/parm/data_extract_config b/util/Radiance_Monitor/data_extract/parm/data_extract_config deleted file mode 100755 index 0d257e813b..0000000000 --- a/util/Radiance_Monitor/data_extract/parm/data_extract_config +++ /dev/null @@ -1,26 +0,0 @@ -################################################################## -# -# data_extract_config -# -# This parameter file set up the environment variables used in -# data_extract scripts (in ush) to run the data extract and -# verification scripts and programs. -# -################################################################## - - echo "begin data_extract_config" - -# export HOMEverf_rad=${RADMON_DATA_EXTRACT} -# export TANKverf_rad=${MY_TANKDIR}/stats - -# export EXECverf_rad=${RADMON_DATA_EXTRACT}/exec -# export PARMverf_rad=${RADMON_DATA_EXTRACT}/parm -# export USHverf_rad=${RADMON_DATA_EXTRACT}/ush -# export SCRIPTS=${USHverf_rad} -# export LOGDIR=${LOGSverf_rad}/rad${RADMON_SUFFIX} - - - export DATA_EXTRACT_JOBNAME=${DATA_EXTRACT_JOBNAME:-RadMon_de_${RADMON_SUFFIX}} - - - echo "end data_extract_config" diff --git a/util/Radiance_Monitor/data_extract/sorc/radmon_validate_tm.fd/bad_obs.f90 b/util/Radiance_Monitor/data_extract/sorc/radmon_validate_tm.fd/bad_obs.f90 deleted file mode 100644 index 9962b00bb3..0000000000 --- a/util/Radiance_Monitor/data_extract/sorc/radmon_validate_tm.fd/bad_obs.f90 +++ /dev/null @@ -1,99 +0,0 @@ -!$$$ subprogram documentation block -! . . . -! subprogram: bad_obs build bad_obs.txt file -! prgmmr: safford date: 2009-11 -! -! abstract: This module contains code to build the bad_obs.txt file. -! The bad_obs.txt file reports the satellite and channel for -! which an unexpected number of observations were found in -! assimilated radiance data. -! -! program history log: -! 2009-11-23 safford - initial coding -! -! contains: -! -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ - -module bad_obs - - implicit none - - private - - public :: open_bad_obs_file - public :: write_bad_obs - public :: close_bad_obs_file - - integer, parameter :: funit = 10 - - contains - - - !------------------------------------------------------------- - ! create the bad_obs file - !------------------------------------------------------------- - - subroutine open_bad_obs_file( date, cycle, fios ) - - !--- interface - character(8), intent( in ) :: date - character(8), intent( in ) :: cycle - integer, intent( out ) :: fios - - !--- variables - logical :: lexist = .FALSE. - character(60) :: fname - - - write(*,*) '--> open_bad_obs_file, date, cycle = ', date, cycle - !--- build the file name - fname = 'bad_obs.' // trim(date) // trim(cycle) - - !--- open file and write the header - inquire(file=fname, exist=lexist) - if( lexist .eqv. .FALSE. ) then - write(*,*) ' opening new bad_obs file' - open( UNIT=funit, FILE=fname, STATUS='NEW', IOSTAT=fios ) - else - write(*,*) ' opening existing bad_obs.txt file' - open( UNIT=funit, FILE=fname, STATUS='OLD', POSITION='APPEND', IOSTAT=fios ) - end if - - end subroutine open_bad_obs_file - - - subroutine write_bad_obs( satname, channel, region, num_obs ) - - !--- interface - character(20), intent( in ) :: satname - integer, intent( in ) :: channel - integer, intent( in ) :: region - real, intent( in ) :: num_obs - - !--- variables - real :: count - - !--- -! if( num_obs < 0.0 ) then -! count = 0.0 -! else - count = num_obs -! end if - - write(funit,*) satname, 'channel= ', channel, ' region= ', region, ' num_obs= ', count - - end subroutine write_bad_obs - - - subroutine close_bad_obs_file( ) - write(*,*) '--> close_bad_obs_file' - close( funit ) - end subroutine close_bad_obs_file - -end module bad_obs diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radtime.fd/low_count.f90 b/util/Radiance_Monitor/data_extract/sorc/radmon_validate_tm.fd/low_count.f90 similarity index 100% rename from util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radtime.fd/low_count.f90 rename to util/Radiance_Monitor/data_extract/sorc/radmon_validate_tm.fd/low_count.f90 diff --git a/util/Radiance_Monitor/data_extract/sorc/radmon_validate_tm.fd/valid.f90 b/util/Radiance_Monitor/data_extract/sorc/radmon_validate_tm.fd/valid.f90 index ffae19c452..85a778969c 100755 --- a/util/Radiance_Monitor/data_extract/sorc/radmon_validate_tm.fd/valid.f90 +++ b/util/Radiance_Monitor/data_extract/sorc/radmon_validate_tm.fd/valid.f90 @@ -47,11 +47,24 @@ module valid contains - !------------------------------------------------------------- + !-------------------------------------------------------------------------- ! load the base file for the given satellite - !------------------------------------------------------------- + ! + ! Note a change in validation for iasi and cris sources. + ! Per Kristen (2/20/20): + ! With correlated error, the contribution to penalty calculation in the + ! radmon is no longer mathematically correct. The calculated penalty is + ! expected to be larger than what it actually is. Both IASI instruments + ! will use correlated error over land and sea, and both CrIS instruments + ! will use correlated error over sea in V16. You should therefore + ! suppress/modify the warnings for IASI and CrIS. + ! + ! The agreed upon solution is to multiply the historical max penalty + ! values, making iasi 5x and cris 6x. + !--------------------------------------------------------------------------- subroutine load_base( satname, iret ) + !--- interface character(20), intent( in ) :: satname @@ -62,7 +75,7 @@ subroutine load_base( satname, iret ) character(20) test_satname character(10) base_date - integer fios + integer fios, multiply_by integer chan, region logical fexist @@ -115,8 +128,26 @@ subroutine load_base( satname, iret ) end do end do -! write(*,*) 'chan 18, region 2, avg_count(18,1), sdv_count(18,1), avg_penalty(18,1), sdv_penalty(18,1) = ', & -! avg_count(18,1), sdv_count(18,1), avg_penalty(18,1), sdv_penalty(18,1) + !--------------------------------------------------- + ! adjust max_penalty values for iasi and cris + ! sources -- see explanation above + ! + +! multiply_by = 1 + +! if ( satname(1:4) == 'iasi' ) then +! multiply_by = 5 +! else if ( satname(1:4) == 'cris' ) then +! multiply_by = 6 +! end if + +! if ( multiply_by > 1 ) then +! do k=1,nregion +! do j=1,nchan +! max_penalty(j,k) = max_penalty(j,k) * multiply_by +! end do +! end do +! end if iret = 0 base_loaded = .TRUE. @@ -137,13 +168,14 @@ end subroutine load_base ! -2 = invalid region ! 1 = base file wasn't loaded, unable to validate !--------------------------------------------------------------- - subroutine validate_count( channel, region, count, valid, iret ) + subroutine validate_count( channel, region, count, valid, avg_cnt, iret ) !--- interface integer, intent( in ) :: channel integer, intent( in ) :: region real, intent( in ) :: count logical, intent( out ) :: valid + real, intent( out ) :: avg_cnt integer, intent( out ) :: iret !--- vars @@ -151,55 +183,62 @@ subroutine validate_count( channel, region, count, valid, iret ) write(*,*) '--> validate_count, channel, region, count ', channel, region, count !--- initialize vars - iret = 0 + iret = 0 cnt = count valid = .FALSE. + avg_cnt = 0.00 if( base_loaded .eqv. .TRUE. ) then + if( channel < 1 .OR. channel > nchan ) then iret = -1 - write(*,*) 'attempt to validate channel out of range', channel + write(*,*) 'Warning: In validate_count attempt to validate channel out of range', channel + valid = .TRUE. else if( region < 1 .OR. region > nregion ) then iret = -2 - write(*,*) 'attempt to validate region out of range', region + write(*,*) 'Warnig: In validate_count attempt to validate region out of range', region + valid = .TRUE. else - ! + !--------------------------------------------------------------------- ! all unassimilated channels in the base files will have an rmiss ! value and are considered valid for verification purposes ! + avg_cnt = avg_count( channel, region ) + if( avg_count(channel,region) < 0.0 ) then valid = .TRUE. else + !------------------------------------------------------------------ + ! Consider any count valid if: + ! cnt is within 2 sdvs from avg + ! Now trying cnt is < 67% of average. sdv2 = 2 * sdv_count( channel, region ) - hi = avg_count(channel,region) + sdv2 - lo = avg_count(channel,region) - sdv2 +! lo = avg_count(channel,region) - sdv2 + lo = avg_count(channel,region) * 0.67 - ! - ! Consider any count valid if: - ! cnt is 2 sdvs from avg or - ! cnt is within the established min/max range for chan,region - ! - if( cnt > 0.0 ) then + if( cnt >= lo ) then valid = .TRUE. - end if - !if( cnt <= hi .AND. cnt >= lo ) then - ! valid = .TRUE. - !else if( (cnt > 0) .AND. (cnt >= min_count( channel,region )) .AND. & - ! (cnt <= max_count( channel,region )) ) then - ! valid = .TRUE. - !end if + end if + + if( valid .eqv. .FALSE. ) then + write(*,*) 'LOW COUNT: cnt, lo, min_count, avg_cnt = ', & + cnt, lo, min_count(channel,region), avg_cnt + end if + end if end if - if ( valid .eqv. .FALSE. ) then - write(*,*) ' avg_count(channel,region), sdv2, hi, lo = ', avg_count(channel,region), sdv2, hi, lo - end if - write (*,*) '<-- valid, iret=', valid, iret + else - !--- base file was not loaded, so return a warning that validation isn't possible + !--------------------------------------------------------- + ! base file wasn't loaded, so validation wasn't possible + ! + write(*,*) 'base file not loaded, unable to validate count' iret = 1 end if + + write (*,*) '<-- valid, iret=', valid, iret end subroutine validate_count @@ -232,13 +271,15 @@ subroutine validate_penalty( channel, region, penalty, valid, bound, iret ) valid = .FALSE. bound = rmiss - if( base_loaded .eqv. .TRUE. ) then + if( base_loaded .eqv. .TRUE. .AND. nchan > 1 ) then if( channel < 1 .OR. channel > nchan ) then iret = -1 - write(*,*) 'attempt to validate channel out of range', channel + write(*,*) 'Warning: In validate_penalty attempt to validate channel out of range', channel + valid = .TRUE. else if( region < 1 .OR. region > nregion ) then iret = -2 - write(*,*) 'attempt to validate region out of range', region + write(*,*) 'Warning: In validate_penalty attempt to validate region out of range', region + valid = .TRUE. else ! ! all unassimilated channels in the base files will have an rmiss @@ -267,8 +308,6 @@ subroutine validate_penalty( channel, region, penalty, valid, bound, iret ) else if( (penalty > 0.0) .AND. & (penalty <= (max_penalty( channel,region )*1.2) ) ) then valid = .TRUE. - !else if( penalty > hi ) then - ! bound = max_penalty( channel,region ) end if end if @@ -279,7 +318,9 @@ subroutine validate_penalty( channel, region, penalty, valid, bound, iret ) end if write (*,*) '<-- valid, iret=', valid, iret else - !--- base file was not loaded, so return a warning that validation isn't possible + !--- base file was not loaded, or nchan was 0 so return + !--- a warning that validation isn't possible + write (*,*) 'Warning: base file not loaded or nchan < 1, nchan= ', nchan iret = 1 end if end subroutine validate_penalty diff --git a/util/Radiance_Monitor/data_extract/sorc/radmon_validate_tm.fd/validate_time.f90 b/util/Radiance_Monitor/data_extract/sorc/radmon_validate_tm.fd/validate_time.f90 index 7639ec2b38..b50e70c1c1 100755 --- a/util/Radiance_Monitor/data_extract/sorc/radmon_validate_tm.fd/validate_time.f90 +++ b/util/Radiance_Monitor/data_extract/sorc/radmon_validate_tm.fd/validate_time.f90 @@ -7,7 +7,7 @@ program time ! 08/2013 safford created from time.f90 !************************************************************************ - use bad_obs + use low_count use bad_penalty use bad_chan use valid @@ -25,12 +25,12 @@ program time integer :: ios = 0 integer :: iret - real bound + real bound, avg_cnt real rmiss real,allocatable,dimension(:,:):: count,penalty real,allocatable,dimension(:):: test_pen - logical valid_penalty + logical valid_penalty, valid_count integer :: nchanl integer,allocatable,dimension(:) :: test_iuse,test_chan @@ -91,10 +91,16 @@ program time date = stringd(2:9) cycle = stringd(10:11) write(6,*) 'date, cycle = ', date, cycle + call open_bad_penalty_file( date, cycle, ios ) write(6,*) 'open_bad_penalty_file = ', ios + + call open_low_count_file( date, cycle, ios ) + write(6,*) 'open_low_count_file = ', ios + call open_bad_chan_file( date, cycle, ios ) write(6,*) 'open_bad_chan_file = ', ios + call load_base( satname, ios ) write(6,*) 'load_base = ', ios @@ -103,9 +109,20 @@ program time ! validate penalty values if there is a valid count and if iuse flag=1 k=1 do j=1,nchanl + + + if ( test_iuse(j) == 1 ) then + call validate_count( j, k, count(j,k), valid_count, avg_cnt, iret) + write (*,*) ' valid_count, iret = ', valid_count, iret + + if ( (iret == 0) .AND. (valid_count .eqv. .FALSE.) ) then + write (*,*) ' calling write_low_count ' + call write_low_count( satname, test_chan(j), k, count(j,k), avg_cnt ) + end if + end if + if (count(j,k)>0 .AND. test_iuse(j) == 1 ) then test_pen(j)=penalty(j,k)/count(j,k) -! write(6,*) 'test_pen = ', j, test_pen(j) call validate_penalty( j, k, test_pen(j), valid_penalty, bound, iret ) write(6,*) ' valid_penalty, iret = ', valid_penalty, iret if( (iret == 0) .AND. (valid_penalty .eqv. .FALSE.) ) then @@ -120,6 +137,9 @@ program time write(6,*)'deallocate arrays' deallocate(test_iuse,test_chan,test_pen,count,penalty) + call close_low_count_file() + call close_bad_penalty_file() + call close_bad_chan_file() write(6,*) '<-- validate_time' stop diff --git a/util/Radiance_Monitor/data_extract/ush/AmIOnProd.sh b/util/Radiance_Monitor/data_extract/ush/AmIOnProd.sh deleted file mode 100755 index d5fff65b03..0000000000 --- a/util/Radiance_Monitor/data_extract/ush/AmIOnProd.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh - -# -# Check to determine if this maching is currently -# the production machine. -# -# Return values: -# 1 = prod -# 0 = dev -# - machine=`hostname | cut -c1` - prod=`cat /etc/prod | cut -c1` - iamprod=0 - - if [[ $machine = $prod ]]; then - iamprod=1 - fi - - echo $iamprod - exit diff --git a/util/Radiance_Monitor/data_extract/ush/Copy_glbl.sh b/util/Radiance_Monitor/data_extract/ush/Copy_glbl.sh deleted file mode 100755 index 3c5d57d61e..0000000000 --- a/util/Radiance_Monitor/data_extract/ush/Copy_glbl.sh +++ /dev/null @@ -1,465 +0,0 @@ -#!/bin/sh - -#-------------------------------------------------------------------- -# Copy_glbl.sh -# -# This script searches for new radmon output from the global GDAS -# and copies those filess to the user's $TANKDIR directory under -# the specified suffix argument. -# -# The bad_penalty findings and missing diag reports are -# reevaluated using local copies of the base file and satype -# files in the $TANKdir/$suffix/info directory. New missing diag -# and bad penalty reports are created and replace any existing -# ones in the cycle DE log file. -# -# Note that processing occurs within TANKdir, not in stmp space. -#-------------------------------------------------------------------- - -function usage { - echo "Usage: Copy_glbl.sh suffix date" - echo " File name for Copy_glbl.sh may be full or relative path" - echo " Suffix is the indentifier for this data source, and should" - echo " correspond to an entry in the ../../parm/data_map file." - echo " DATE is 10 digit yyyymmddhh string." -} - -set -ax -echo start Copy_glbl.sh -exit_value=0 - -nargs=$# -if [[ $nargs -ne 2 ]]; then - usage - exit 1 -fi - -this_file=`basename $0` -this_dir=`dirname $0` -no_diag_rpt=0 -no_error_rpt=0 - -export RADMON_SUFFIX=$1 -export DATE=$2 -RUN=${RUN:-gdas} - -export RAD_AREA=glb - -echo RADMON_SUFFIX = $RADMON_SUFFIX -echo DATE = $DATE - - -#-------------------------------------------------------------------- -# Set environment variables -#-------------------------------------------------------------------- - -top_parm=${this_dir}/../../parm -export RADMON_VERSION=${RADMON_VERSION:-${top_parm}/radmon.ver} -if [[ -s ${RADMON_VERSION} ]]; then - . ${RADMON_VERSION} -else - echo "Unable to source ${RADMON_VERSION} (radmon version) file" - exit 2 -fi - -export RADMON_CONFIG=${RADMON_CONFIG:-${top_parm}/RadMon_config} -if [[ -s ${RADMON_CONFIG} ]]; then - . ${RADMON_CONFIG} -else - echo "Unable to source ${RADMON_CONFIG} (radmon config) file" - exit 2 -fi - -if [[ -s ${RADMON_USER_SETTINGS} ]]; then - . ${RADMON_USER_SETTINGS} -else - echo "Unable to source ${RADMON_USER_SETTINGS} (radmon user settings) file" - exit 3 -fi - -export USHradmon=${USHradmon:-$HOMEradmon/ush} - - -#-------------------------------------------------------------------- -# Check setting of RUN_ONLY_ON_DEV and possible abort if on prod and -# not permitted to run there. -#-------------------------------------------------------------------- - -if [[ RUN_ONLY_ON_DEV -eq 1 ]]; then - is_prod=`${DE_SCRIPTS}/onprod.sh` - if [[ $is_prod = 1 ]]; then - exit 10 - fi -fi - - -#--------------------------------------------------------------- -# Create any missing directories. -#--------------------------------------------------------------- -mkdir -p $TANKverf -mkdir -p $LOGdir - -day=`echo $DATE|cut -c1-8` -cycle=`echo $DATE|cut -c9-10` -echo day = $day - -PDATE=${DATE} -echo PDATE = $PDATE - -prev=`$NDATE -06 $PDATE` -prev_day=`echo $prev|cut -c1-8` -prev_cyc=`echo $prev|cut -c9-10` -next=`$NDATE +06 $PDATE` -next_day=`echo $next|cut -c1-8` -next_cyc=`echo $next|cut -c9-10` - -echo prev_day, prev_cyc = $prev_day, $prev_cyc -echo next_day, next_cyc = $next_day, $next_cyc - -DATA=${DATA:-/gpfs/dell1/nco/ops/com/gfs/prod} - -if [[ $USE_HR -eq 1 ]]; then - DATDIR=${DATDIR:-${DATA}/${RUN}.${day}/${cycle}/radmon} -else - DATDIR=${DATDIR:-${DATA}/${RUN}.${day}/radmon} -fi - -LOGDIR=${LOGDIR:-/gpfs/dell1/nco/ops/com/output/prod} - -if [[ $TANK_USE_RUN -eq 1 ]]; then - test_dir=${TANKverf}/${RUN}.${day}/${cycle}/${MONITOR} -else - test_dir=${TANKverf}/radmon.${day} -fi - - -satype_file=${TANKverf}/info/${RUN}_radmon_satype.txt - -if [[ ! -s ${satype_file} ]]; then - satype_file=${FIXgdas}/gdas_radmon_satype.txt -fi - -if [[ ! -s ${satype_file} ]]; then - echo "WARNING: unable to locate ${satype_file}" -fi - - -nfile_src=`ls -l ${DATDIR}/*${PDATE}*ieee_d* | egrep -c '^-'` - -if [[ $nfile_src -gt 0 ]]; then - if [[ ! -d ${test_dir} ]]; then - mkdir -p ${test_dir} - fi - cd ${test_dir} - if [[ $RADMON_SUFFIX = "fv3rt1" ]]; then - $NCP $DE_SCRIPTS/ck_radstat.sh ${test_dir}/. - - radstat_file=${radstat_file:-${DATA}/${RUN}.${day}/${cycle}/gdas.t${cycle}z.radstat} - missing_from_radstat=`./ck_radstat.sh -s $satype_file -r $radstat_file` - fi - - type_list="angle bcoef bcor time" - - for type in ${type_list}; do - - file_list=`ls ${DATDIR}/${type}.*${PDATE}*ieee_d* ` - - - for file in ${file_list}; do - bfile=`basename ${file}` - echo "testing ${file}" - - if [[ ! -e ${test_dir}/${bfile} ]]; then - echo "copying file" - ${NCP} ${file} ${test_dir}/${bfile} - fi - done - done - - $NCP ${DATDIR}/*.ctl* ${test_dir}/. - -#----------------------------------------------------------- -# run validate.sh -# 1. copy validate.sh and validate_data.x locally -# 2. run validate.sh -# 3. clean up -# rm validate.sh, validate_data.x -# rm stdout files? -# make sure *.base and *.tar are removed -#----------------------------------------------------------- - if [[ $DO_DATA_RPT -eq 1 ]]; then - $NCP ${DE_EXEC}/radmon_validate_tm.x ${test_dir}/. - $NCP $DE_SCRIPTS/validate.sh ${test_dir}/. - ./validate.sh ${PDATE} - fi - -else - exit_value=5 -fi - - -if [[ $exit_value == 0 ]]; then - #-------------------------------------------------------------------- - # Tar up the stdout.validation files - #-------------------------------------------------------------------- - if [[ $DO_DATA_RPT -eq 1 ]]; then - - valid_tar=stdout.validate.tar - - if [[ $cycle -eq "00" ]]; then - tar -cvf ${valid_tar} stdout.validate.*.00 - else - tar -rvf ${valid_tar} stdout.validate.*.${cycle} - fi - - rm -f stdout.validate.*.${cycle} - - - #-------------------------------------------------------------------- - # Remove extra spaces in new bad_pen file - #-------------------------------------------------------------------- - bad_pen=bad_pen.${PDATE} - gawk '{$1=$1}1' $bad_pen > tmp.bad_pen - mv -f tmp.bad_pen $bad_pen - - #-------------------------------------------------------------------- - # Create a new penalty error report using the new bad_pen file - #-------------------------------------------------------------------- - $NCP $DE_SCRIPTS/radmon_err_rpt.sh ${test_dir}/. - if [[ -s $HOMEradmon/ush/radmon_getchgrp.pl ]]; then - $NCP $HOMEradmon/ush/radmon_getchgrp.pl ${test_dir}/. - fi - - if [[ $TANK_USE_RUN -eq 1 ]]; then - prev_bad_pen=${TANKverf}/${RUN}.${prev_day}/${prev_cyc}/${MONITOR}/bad_pen.${prev} - else - prev_bad_pen=${TANKverf}/radmon.${prev_day}/bad_pen.${prev} - fi - - bad_pen=bad_pen.${PDATE} - diag_rpt="diag.txt" - outfile="pen.${PDATE}.txt" - err_rpt="err.${PDATE}.txt" - - ./radmon_err_rpt.sh $prev_bad_pen $bad_pen pen ${prev} ${PDATE} $diag_rpt $outfile - - - #-------------------------------------------------------------------- - # Copy over the ${LOGDIR}/YYYYMMDD/gdas_verfrad_HH.o* log - # Note that the 18z cycle log file is found in the next day's - # directory. - # 1. Confirm that any entries in the Diagnostic file report - # are in the satype table. Remove any entries that are not - # valid and the entire report if none are valid. - # 2. Remove the existing bad penalty report - # 3. Add the output from the new penalty error report (if present) - # otherwise remove the entire penalty report. - # 4. put log in the /ptmp/logs/radopr/data_extract logs dir - #-------------------------------------------------------------------- - opr_log=opr_${PDATE}.log - tmp_log=tmp_${PDATE}.log - new_log=new_opr_${PDATE}.log -# if [[ $cycle = 18 ]]; then -# $NCP ${LOGDIR}/${next_day}/gdas_verfrad_${cycle}.o* ${opr_log} -# else -# $NCP ${LOGDIR}/${day}/gdas_verfrad_${cycle}.o* ${opr_log} -# fi - - #-------------------------------------------------------------------- - # Diag report processing - #-------------------------------------------------------------------- - tmp_diag="diag.tmp" - new_diag="diag.new" - opr_log_start=1 - - start=`grep -n 'cat diag_report.txt' ${opr_log}` - diag_start=`echo $start | sed 's/:/ /g' | gawk '{print $1}'` - echo diag_start = $diag_start - - if [[ $diag_start -gt 1 ]]; then - end=`grep -nx 'End Problem Reading Diagnostic File' ${opr_log}` - diag_end=`echo $end | sed 's/:/ /g' | gawk '{print $1}'` - echo diag_end = $diag_end - - gawk "NR>=$diag_start && NR<=$diag_end" ${opr_log} >> $tmp_diag - - reported_missing="" - while read line; do - new_sat=`echo $line | grep PROBLEM` - len=`expr length "$new_sat"` - if [[ $len -gt 0 ]]; then - sat=`echo $new_sat | gawk '{print $1}'` - - test_satype=`grep $sat ${satype_file}` - len_test=`expr length "$test_satype"` - if [[ $len_test -gt 0 ]]; then - echo $line >> $new_diag - reported_missing="$reported_missing $sat" - fi - else - echo $line >> $new_diag - fi - done <${tmp_diag} - - #------------------------------------------------------------------- - # now check the other direction, are all of the missing diag files - # reported in $missing_from_radstat in the report? - #------------------------------------------------------------------- - for mfr in $missing_from_radstat; do - test=`echo $reported_missing | grep $mfr` - len_test=`expr length "$test"` - if [[ $len_test -eq 0 ]]; then - line1=" $mfr ges ***PROBLEM reading diagnostic file." - line2=" $mfr anl ***PROBLEM reading diagnostic file." -# lines=`cat $new_diag | wc -l` -# echo "lines = $lines" - - sed "\$i $line1" ./$new_diag >fish.tmp - mv fish.tmp $new_diag - sed "\$i $line2" ./$new_diag >fish.tmp - mv fish.tmp $new_diag - - fi - - done - - - #-------------------------------------------------------------------- - # if $new_diag still contains errors with reading diag files - # then return $new_diag to the $opr_log - #-------------------------------------------------------------------- - test_new_diag=`cat $new_diag | grep "PROBLEM"` - - len_test_new_diag=`expr length "$test_new_diag"` - echo "test_new_diag, len = $test_new_diag, $len_test_new_diag" - - - l_end=`wc -l $opr_log` - log_end=`echo $l_end | sed 's/:/ /g' | gawk '{print $1}'` - - diag_start=`expr $diag_start - 1` - diag_end=`expr $diag_end + 1` - gawk "NR>=1 && NR<=$diag_start" ${opr_log} >> $tmp_log - - if [[ $len_test_new_diag -gt 0 ]]; then - cat $new_diag >> $tmp_log - fi - - gawk "NR>=$diag_end && NR<=$log_end" ${opr_log} >> $tmp_log - mv -f $opr_log opr_log.bu - $NCP $tmp_log $opr_log - - else - no_diag_rpt=1 - fi - - - #-------------------------------------------------------------------- - # Penalty report processing - #-------------------------------------------------------------------- - end=`grep -n '============ ======= ====== Cycle Penalty Bound' ${opr_log} | tail -1` - opr_log_end=`echo $end | sed 's/:/ /g' | gawk '{print $1}'` - - if [[ $opr_log_end -gt 1 ]]; then - opr_log_start=1 - - - #--------------------------------------------------------------------- - # If $outfile exists, replace existing penalty report with $outfile - # contents or remove the penalty report altogether if there is no - # $outfile - #--------------------------------------------------------------------- - if [[ -s $outfile ]]; then - echo "OUTFILE -s $outfile is TRUE" - opr_log_end=`expr $opr_log_end + 1` - gawk "NR>=$opr_log_start && NR<=$opr_log_end" ${opr_log} >> $new_log - cat $outfile >> $new_log - - echo "End Cycle Data Integrity Report" >> $new_log - else - echo "OUTFILE -s $outfile is FALSE" - opr_log_end=`expr $opr_log_end - 15` - gawk "NR>=$opr_log_start && NR<=$opr_log_end" ${opr_log} >> $new_log - no_error_rpt=1 - fi - - else - - if [[ -s $outfile ]]; then - rm -f report.txt - - cp $opr_log $new_log - - echo "Begin Cycle Data Integrity Report" > report.txt - - echo " " >> report.txt - echo "Cycle Data Integrity Report" >> report.txt - echo "${PDATE}" >> report.txt - echo " " >> report.txt - echo "Region Definitions:" >> report.txt - echo " " >> report.txt - - echo " 1 Global (90S-90N, 0-360E)" >> report.txt - echo " " >> report.txt - echo " " >> report.txt - echo "Penalty values outside of the established normal range were found" >> report.txt - echo "for these sensor/channel/regions in the past two cycles: " >> report.txt - echo " " >> report.txt - echo "Questionable Penalty Values " >> report.txt - echo "============ ======= ====== Cycle Penalty Bound" >> report.txt - echo " ----- ------- ----- " >> report.txt - echo " " >> report.txt - cat $outfile >> report.txt - echo " " >> report.txt - echo " " >> report.txt - echo " " >> report.txt - echo "End Cycle Data Integrity Report" >> report.txt - - cat report.txt >> $new_log - - else - mv $opr_log $new_log - fi - fi - - - if [[ $no_diag_rpt -eq 1 ]]; then - echo "NO DIAG REPORT" >> $new_log - fi - if [[ $no_error_rpt -eq 1 ]]; then - echo "NO ERROR REPORT" >> $new_log - fi - - $NCP ./$new_log ${LOGdir}/data_extract.${day}.${cycle}.log - - #rm -f $new_log - #rm -f $opr_log - #rm -f $new_diag $tmp_diag - #rm -f $tmp_log - - fi - - $COMPRESS *.ctl - - - #-------------------------------------------------------------------- - # Remove processing scripts/executables and exit. - #-------------------------------------------------------------------- - rm -f radmon_validate_tm.x - rm -f validate.sh - rm -f radmon_err_rpt.sh - rm -f radmon_getchgrp.pl - rm -f opr_log.bu - - nfile_dest=`ls -l ${test_dir}/*${PDATE}*ieee_d* | egrep -c '^-'` - - if [[ exit_value -eq 0 && $nfile_src -ne $nfile_dest ]]; then - exit_value=6 - fi - -fi - - -echo end Copy_glbl.sh -exit ${exit_value} - diff --git a/util/Radiance_Monitor/data_extract/ush/MkCtl_glbl.sh b/util/Radiance_Monitor/data_extract/ush/MkCtl_glbl.sh deleted file mode 100644 index c75ac8f92c..0000000000 --- a/util/Radiance_Monitor/data_extract/ush/MkCtl_glbl.sh +++ /dev/null @@ -1,177 +0,0 @@ -#!/bin/sh - -#-------------------------------------------------------------------- -# MkCtl_glbl.sh -# -# This script generates the control files for a given suffix -# (source), using the JGDAS_VERFRAD job. The resulting -# control files are stored in $TANKverf. -# -# This script is designed to be run manually, and should only be -# necessary if the user had previously overriden the default -# settings and switched off the control file generation done by -# the VrfyRad_*.sh scripts. -# -#-------------------------------------------------------------------- - -function usage { - echo "Usage: MkCtl_glbl.sh suffix" - echo " File name for MkCtl_glbl.sh may be full or relative path" - echo " Suffix is the indentifier for this data source" -} - -set -ax -echo start MkCtl_glbl.sh - -nargs=$# -if [[ $nargs -ne 1 ]]; then - usage - exit 1 -fi - -this_file=`basename $0` -this_dir=`dirname $0` - -export RADMON_SUFFIX=$1 -jobname=make_ctl_${RADMON_SUFFIX} - -echo RADMON_SUFFIX = $RADMON_SUFFIX -echo RUN_ENVIR = $RUN_ENVIR - -#-------------------------------------------------------------------- -# Set environment variables -#-------------------------------------------------------------------- - -top_parm=${this_dir}/../../parm -export RADMON_CONFIG=${RADMON_CONFIG:-${top_parm}/RadMon_config} -if [[ -s ${RADMON_VERSION} ]]; then - . ${RADMON_VERSION} -else - echo "Unable to source ${RADMON_VERSION} file" - exit 2 -fi - -if [[ -s ${RADMON_CONFIG} ]]; then - . ${RADMON_CONFIG} -else - echo "Unable to source ${RADMON_CONFIG} file" - exit 2 -fi - -if [[ -s ${RADMON_USER_SETTINGS} ]]; then - . ${RADMON_USER_SETTINGS} -else - echo "Unable to source ${RADMON_USER_SETTINGS} file" - exit 2 -fi - -. ${DE_PARM}/parm/data_extract_config - -#-------------------------------------------------------------------- -# Get the area (glb/rgn) for this suffix -#-------------------------------------------------------------------- -area=${RAD_AREA} -echo $area - -if [[ $area = glb ]]; then - export RAD_AREA=glb -elif [[ $area = rgn ]]; then - export RAD_AREA=rgn -else - echo "area = $area -- must be either glb or rgn" - exit 3 -fi - -mkdir -p $TANKverf -mkdir -p $LOGdir - -export MAKE_CTL=1 -export MAKE_DATA=0 -export RUN_ENVIR=dev - -#--------------------------------------------------------------- -# Get date of cycle to process. Start with the last processed -# date in the $TANKverf and work backwards until we find a -# valid radstat file or hit the limit on $ctr. -#--------------------------------------------------------------- -PDATE=`${DE_SCRIPTS}/find_cycle.pl 1 ${TANKverf}` -export DATDIR=$RADSTAT_LOCATION - -ctr=0 -need_radstat=1 -while [[ $need_radstat -eq 1 && $ctr -lt 10 ]]; do - - sdate=`echo $PDATE|cut -c1-8` - export CYA=`echo $PDATE|cut -c9-10` - testdir=${DATDIR}/gdas.$sdate - - #--------------------------------------------------------------- - # Locate required files or reset PDATE and try again. - #--------------------------------------------------------------- - if [[ -s $testdir/gdas1.t${CYA}z.radstat ]]; then - - export biascr=${testdir}/gdas1.t${CYA}z.abias - export radstat=${testdir}/gdas1.t${CYA}z.radstat - need_radstat=0 - elif [[ -s $testdir/radstat.gdas.${PDATE} ]]; then - export biascr=$DATDIR/biascr.gdas.${PDATE} - export radstat=$DATDIR/radstat.gdas.${PDATE} - need_radstat=0 - else - export PDATE=`$NDATE -06 $PDATE` - ctr=$(( $ctr + 1 )) - fi -done - -export PDY=`echo $PDATE|cut -c1-8` -export CYC=`echo $PDATE|cut -c9-10` - -#-------------------------------------------------------------------- -# Process if radstat file exists. -#-------------------------------------------------------------------- -data_available=0 -if [[ -s ${radstat} ]]; then - data_available=1 - - export MP_SHARED_MEMORY=yes - export MEMORY_AFFINITY=MCM - - export envir=prod - export RUN_ENVIR=dev - - export cyc=$CYC - export job=gdas_mkctl_${PDY}${cyc} - export SENDSMS=NO - export DATA_IN=${STMP_USER} - export DATA=${STMP_USER}/radmon - export jlogfile=${STMP_USER}/jlogfile - - export VERBOSE=YES - export satype_file=${TANKverf}/info/SATYPE.txt - - - #------------------------------------------------------------------ - # Submit data processing jobs. - #------------------------------------------------------------------ - if [[ $MY_MACHINE = "wcoss" ]]; then - $SUB -q $JOB_QUEUE -P $PROJECT -o $LOGdir/mk_ctl.${PDY}.${cyc}.log -M 40 -R affinity[core] -W 0:10 -J ${jobname} $HOMEradmon/jobs/JGDAS_VERFRAD - elif [[ $MY_MACHINE = "zeus" ]]; then - $SUB -A $ACCOUNT -l walltime=0:05:00 -V -j oe -o $LOGdir/make_ctl.${PDY}.${cyc}.log $HOMEradmon/jobs/JGDAS_VERFRAD - fi - - -fi - -#-------------------------------------------------------------------- -# Clean up and exit -#-------------------------------------------------------------------- - -exit_value=0 -if [[ ${data_available} -ne 1 ]]; then - exit_value=5 - echo No data available for ${RADMON_SUFFIX} -fi - -echo end MkCtl_glbl.sh -exit ${exit_value} - diff --git a/util/Radiance_Monitor/data_extract/ush/MkCtl_rgnl.sh b/util/Radiance_Monitor/data_extract/ush/MkCtl_rgnl.sh deleted file mode 100755 index aaf1ea8bc4..0000000000 --- a/util/Radiance_Monitor/data_extract/ush/MkCtl_rgnl.sh +++ /dev/null @@ -1,186 +0,0 @@ -#!/bin/sh - -#-------------------------------------------------------------------- -# MkCtl_rgnl.sh -# -# This script generates the control files for a given suffix -# (source), using the JGDAS_VERFRAD job. The resulting -# control files are stored in $TANKverf. -# -# This script is designed to be run manually, and should only be -# necessary if the user had previously overriden the default -# settings and switched off the control file generation done by -# the VrfyRad_*.sh scripts. -# -#-------------------------------------------------------------------- - -function usage { - echo "Usage: MkCtl_rgnl.sh suffix" - echo " File name for MkCtl_rgnl.sh may be full or relative path" - echo " Suffix is the indentifier for this data source." -} - - -set -ax -echo start MkCtl_rgnl.sh - -nargs=$# -if [[ $nargs -ne 1 ]]; then - usage - exit 1 -fi - - -this_file=`basename $0` -this_dir=`dirname $0` - -RADMON_SUFFIX=$1 -export RUN_ENVIR=dev - -echo RADMON_SUFFIX = $RADMON_SUFFIX -echo RUN_ENVIR = $RUN_ENVIR - - -jobname=make_ctl_${RADMON_SUFFIX} - -#-------------------------------------------------------------------- -# Set environment variables -#-------------------------------------------------------------------- -export RAD_AREA=rgn -export MAKE_CTL=1 -export MAKE_DATA=0 - -top_parm=${this_dir}/../../parm -export RADMON_CONFIG=${RADMON_CONFIG:-${top_parm}/RadMon_config} -if [[ -s ${RADMON_VERSION} ]]; then - . ${RADMON_VERSION} -else - echo "Unable to source ${RADMON_VERSION} file" - exit 2 -fi - -if [[ -s ${RADMON_CONFIG} ]]; then - . ${RADMON_CONFIG} -else - echo "Unable to source ${RADMON_CONFIG} file" - exit 2 -fi - -if [[ -s ${RADMON_USER_SETTINGS} ]]; then - . ${RADMON_USER_SETTINGS} -else - echo "Unable to source ${RADMON_USER_SETTINGS} file" - exit 2 -fi - -. ${DE_PARM}/data_extract_config - -mkdir -p $TANKverf -mkdir -p $LOGdir - - -tmpdir=${WORKverf_rad}/check_rad${RADMON_SUFFIX} -rm -rf $tmpdir -mkdir -p $tmpdir -cd $tmpdir - -#-------------------------------------------------------------------- -# Get date of cycle to process. Start with the last time in the -# $TANKverf and work backwards until we find a diag file to use -# or run out of the $ctr. -#-------------------------------------------------------------------- -export PDATE=`${DE_SCRIPTS}/find_cycle.pl 1 ${TANKverf}` - -#--------------------------------------------------------------- -# Locate radstat and biascr files. -#--------------------------------------------------------------- -export DATDIR=${PTMP_USER}/regional -export com=$RADSTAT_LOCATION - -biascr=$DATDIR/satbias.${PDATE} -radstat=$DATDIR/radstat.${PDATE} - -ctr=0 -need_radstat=1 -while [[ $need_radstat -eq 1 && $ctr -lt 10 ]]; do - - sdate=`echo $PDATE|cut -c1-8` - export CYA=`echo $PDATE|cut -c9-10` - /bin/sh ${DE_SCRIPTS}/getbestndas_radstat.sh ${PDATE} ${DATDIR} ${com} - - if [ -s $radstat -a -s $biascr ]; then - need_radstat=0 - else - export PDATE=`$NDATE -06 $PDATE` - ctr=$(( $ctr + 1 )) - fi - -done - - -export biascr=$biascr -export radstat=$radstat - -#-------------------------------------------------------------------- -# If data is available, export variables, and submit driver for -# radiance monitoring jobs. -#-------------------------------------------------------------------- - -data_available=0 - -if [ -s $radstat -a -s $biascr ]; then - data_available=1 - - export MP_SHARED_MEMORY=yes - export MEMORY_AFFINITY=MCM - - export envir=prod - export RUN_ENVIR=dev - export USE_ANL=0 - - export PDY=`echo $PDATE|cut -c1-8` - export CYC=`echo $PDATE|cut -c9-10` - export cyc=$CYC - - export job=ndas_make_ctl_${PDY}${cyc} - export SENDSMS=NO - export DATA_IN=${WORKverf_rad} - export DATA=${WORKverf_rad}/radmon_regional - export jlogfile=${WORKverf_rad}/jlogfile_${RADMON_SUFFIX} - export USER_CLASS=dev - export DO_DIAG_RPT=0 - export DO_DATA_RPT=0 - - export VERBOSE=YES - export satype_file=${TANKverf}/info/SATYPE.txt - if [[ -s ${TANKverf}/info/radmon_base.tar.Z ]]; then - export base_file=${TANKverf}/info/radmon_base.tar - fi - - - #------------------------------------------------------------------ - # Submit data processing jobs. - # - if [[ $MY_MACHINE = "wcoss" ]]; then - $SUB -q $JOB_QUEUE -P $PROJECT -o $LOGdir/mk_ctl.${RADMON_SUFFIX}.${PDY}.${cyc}.log -M 40 -R affinity[core] -W 0:10 -J ${jobname} $HOMEradmon/jobs/JGDAS_VERFRAD - elif [[ $MY_MACHINE = "zeus" ]]; then - $SUB -a $ACCOUNT -V -j ${jobname} -q dev -g ${USER_CLASS} -t 0:05:00 -o ${LOGdir}/make_ctl.${RADMON_SUFFIX}.${PDY}.${cyc}.log -v ${HOMEradmon}/jobs/JGDAS_VERFRAD - fi - -fi - -#-------------------------------------------------------------------- -# Clean up and exit -#-------------------------------------------------------------------- -#cd $tmpdir -#cd ../ -#rm -rf $tmpdir - -exit_value=0 -if [[ ${data_available} -ne 1 ]]; then - echo No data available for ${RADMON_SUFFIX} - exit_value=5 -fi - -echo end MkCtl_rgnl.sh -exit ${exit_value} diff --git a/util/Radiance_Monitor/data_extract/ush/RadMon_CP_glb.sh b/util/Radiance_Monitor/data_extract/ush/RadMon_CP_glb.sh new file mode 100755 index 0000000000..dd59ee8326 --- /dev/null +++ b/util/Radiance_Monitor/data_extract/ush/RadMon_CP_glb.sh @@ -0,0 +1,194 @@ +#!/bin/bash + +#-------------------------------------------------------------------- +# RadMon_CP_glb.sh +# +# This script searches for new radmon output from the global GDAS +# and copies those filess to the user's $TANKDIR directory under +# the specified suffix argument. +# +# The bad_penalty, low count, and missing diag reports are +# reevaluated using local copies of the base file and satype +# files in the $TANKdir/$suffix/info directory. +# +# Note that processing occurs within TANKdir, not in stmp space. +# +# The unified error report is journaled to warning.${PDY}${CYC}. +# +#-------------------------------------------------------------------- + +function usage { + echo "Usage: RadMon_CP_glb.sh suffix [-r|--run gdas|gfs -p|--pdate yyyymmddhh" + echo "" + echo " Suffix (NET) is the indentifier for this data source." + echo "" + echo " -r|--run is the run value, typically gdas or gfs. Default value is gdas." + echo "" + echo " -p|--pdate is 10 digit yyyymmddhh string of cycle to be copied." + echo " If not specified the pdate will be calculated by finding the latest" + echo " cycle time in $TANKverf and incrementing it by 6 hours." + echo "" + echo " -f|--radf parent directory to radstat file location. This will be extended by " + echo " $RUN.$PDY/$CYC/atmos/radmon and the files there copied to TANKverf." + echo "" + echo " -d|--dataf parent directory to extracted radstat data file location. This will be extended by " + echo " $RUN.$PDY/$CYC and the files there copied to TANKverf." + +} + + +echo start RadMon_CP_glb.sh +exit_value=0 + +nargs=$# +if [[ $nargs -le 0 || $nargs -gt 9 ]]; then + usage + exit 1 +fi + + +export RAD_AREA=glb + +#----------------------------------------------------------- +# Set default values and process command line arguments. +# +run=gdas + +while [[ $# -ge 1 ]] +do + key="$1" + echo $key + + case $key in + -p|--pdate) + pdate="$2" + shift # past argument + ;; + -r|--run) + run="$2" + shift # past argument + ;; + -f|--radf) + radstat_loc="$2" + shift # past argument + ;; + -d|--dataf) + data_file_loc="$2" + shift # past argument + ;; + *) + #any unspecified key is RADMON_SUFFIX + export RADMON_SUFFIX=$key + ;; + esac + + shift +done + +echo "RADMON_SUFFIX = $RADMON_SUFFIX" +echo "run = $run" +echo "pdate = $pdate" +echo "radstat_loc = ${radstat_loc}" +echo "data_file_loc = ${data_file_loc}" + +export RUN=${RUN:-${run}} + +set -ax + +#-------------------------------------------------------------------- +# Set environment variables +#-------------------------------------------------------------------- +this_dir=`dirname $0` + + +top_parm=${this_dir}/../../parm + +export RADMON_CONFIG=${RADMON_CONFIG:-${top_parm}/RadMon_config} +if [[ -s ${RADMON_CONFIG} ]]; then + . ${RADMON_CONFIG} +else + echo "Unable to source ${RADMON_CONFIG} (radmon config) file" + exit 2 +fi + +if [[ -s ${RADMON_USER_SETTINGS} ]]; then + . ${RADMON_USER_SETTINGS} +else + echo "Unable to source ${RADMON_USER_SETTINGS} (radmon user settings) file" + exit 3 +fi + +export USHradmon=${USHradmon:-$HOMEradmon/ush} + + +#--------------------------------------------------------------- +# Create any missing directories. +#--------------------------------------------------------------- +if [[ ! -d ${TANKverf} ]]; then + mkdir -p $TANKverf +fi +if [[ ! -d ${LOGdir} ]]; then + mkdir -p $LOGdir +fi + +#--------------------------------------------------------------- +# If the pdate (processing date) was not specified at the +# command line then set it by finding the latest cycle in +# $TANKverf and increment 6 hours. +#--------------------------------------------------------------- +if [[ $pdate = "" ]]; then + ldate=`${DE_SCRIPTS}/nu_find_cycle.pl --run $RUN --cyc 1 --dir ${TANKverf}` + pdate=`${NDATE} +06 ${ldate}` +fi +echo "pdate = $pdate" +export PDATE=${pdate} + +export PDY=`echo $PDATE|cut -c1-8` +export CYC=`echo $PDATE|cut -c9-10` + +#--------------------------------------------------------------- +# Set data and radstat locations +#--------------------------------------------------------------- +if [[ -n ${radstat_loc} ]]; then + export RADSTAT_LOCATION=${radstat_loc} +fi +export RADSTAT_LOCATION=${RADSTAT_LOCATION}/${RUN}.${PDY}/${CYC}/atmos + + +if [[ -n ${data_file_loc} ]]; then + export DATA_LOCATION=${data_file_loc}/${RUN}.${PDY} +else + export DATA_LOCATION=${RADSTAT_LOCATION}/radmon +fi + + +if [[ -d ${DATA_LOCATION} ]]; then + job=${DE_SCRIPTS}/radmon_copy.sh + jobname=RadMon_CP_${RADMON_SUFFIX} + logfile=${LOGdir}/CP.${PDY}.${CYC}.log + if [[ -e ${logfile} ]]; then + rm -f ${logfile} + fi + + + if [[ $MY_MACHINE = "wcoss_d" ]]; then + $SUB -q $JOB_QUEUE -P $PROJECT -o ${logfile} \ + -M 80 -R affinity[core] -W 0:10 -J ${jobname} -cwd ${PWD} ${job} + + elif [[ $MY_MACHINE = "wcoss_c" ]]; then + $SUB -q $JOB_QUEUE -P $PROJECT -o ${logfile} \ + -M 100 -W 0:20 -J ${jobname} -cwd ${PWD} ${job} + + elif [[ $MY_MACHINE = "hera" ]]; then + $SUB --account=${ACCOUNT} --time=10 -J ${jobname} -D . \ + -o ${logfile} --ntasks=1 --mem=5g ${job} + fi +else + echo "Unable to locate DATA_LOCATION: ${DATA_LOCATION}" + exit_value=4 +fi + + +echo end RadMon_CP_glb.sh +exit ${exit_value} + diff --git a/util/Radiance_Monitor/data_extract/ush/RadMon_DE_glb.sh b/util/Radiance_Monitor/data_extract/ush/RadMon_DE_glb.sh new file mode 100755 index 0000000000..43f67b58d7 --- /dev/null +++ b/util/Radiance_Monitor/data_extract/ush/RadMon_DE_glb.sh @@ -0,0 +1,256 @@ +#!/bin/sh + +#-------------------------------------------------------------------- +# RadMon_DE_glbl.sh +# +# Data extraction script for global (GDAS) radiance diagnostic data. +# +# This script verifies data is available and submits the +# JGDAS_ATMOS_VERFRAD job, which performs the data extraction and +# validation checks. +#-------------------------------------------------------------------- +echo start VrfyRad_glbl.sh + + +#-------------------------------------------------------------------- +# usage +#-------------------------------------------------------------------- +function usage { + echo "Usage: RadMon_DE_glbl.sh suffix [-p|--pdate -r|--run -s|--radstat]" + echo "" + echo " suffix is the indentifier for this data source." + echo " This is usually the same as the NET value." + echo "" + echo " -p|--pdate is the full YYYYMMDDHH cycle to run. If not specified" + echo " the TANKverf directory will be used to determine the next cycle time" + echo "" + echo " -r|--run is gdas|gfs. gdas is the default if not specified." + echo "" + echo " -s|--radstat is the location of the directory containing the radstat" + echo ' files. Note that this is the parent directory to the ${run}.${pdy} directory' +} + +#-------------------------------------------------------------------- +# RadMon_DE_glbl begins here. +#-------------------------------------------------------------------- +exit_value=0 + +nargs=$# +echo "nargs = $nargs" +if [[ $nargs -lt 1 || $nargs -gt 7 ]]; then + usage + exit 1 +fi + +#----------------------------------------------------------- +# Set default values and process command line arguments. +# +run=gdas +radstat_location=/gpfs/dell1/nco/ops/com/gfs/prod + +while [[ $# -ge 1 ]] +do + key="$1" + echo $key + + case $key in + -p|--pdate) + export PDATE="$2" + shift # past argument + ;; + -r|--run) + run="$2" + shift # past argument + ;; + -s|--radstat) + radstat_location="$2" + shift # past argument + ;; + *) + #any unspecified key is RADMON_SUFFIX + export RADMON_SUFFIX=$key + ;; + esac + + shift +done + +export RADSTAT_LOCATION=$radstat_location +export RUN=$run + +echo "RADMON_SUFFIX = $RADMON_SUFFIX" +echo "RUN = $RUN" +echo "PDATE = $PDATE" +echo "RADSTAT_LOCATION = $RADSTAT_LOCATION" + +set -ax + +this_file=`basename $0` +this_dir=`dirname $0` + + +#-------------------------------------------------------------------- +# Source config and user_settings files +#-------------------------------------------------------------------- + +top_parm=${this_dir}/../../parm + +export RADMON_CONFIG=${RADMON_CONFIG:-${top_parm}/RadMon_config} +if [[ -s ${RADMON_CONFIG} ]]; then + . ${RADMON_CONFIG} +else + echo "Unable to source ${RADMON_CONFIG} file" + exit 2 +fi + +if [[ -s ${RADMON_USER_SETTINGS} ]]; then + . ${RADMON_USER_SETTINGS} +else + echo "Unable to source ${RADMON_USER_SETTINGS} file" + exit 3 +fi + +#------------------------------------------------------- +# Create log and TANK directories if they don't exist +#------------------------------------------------------- +if [[ ! -d ${TANKverf} ]]; then + mkdir -p $TANKverf +fi +if [[ ! -d ${LOGdir} ]]; then + mkdir -p $LOGdir +fi + + +#--------------------------------------------------------------- +# Get date of cycle to process. If it hasn't been specified +# in the arugments get the last cycle processed and add 6 hrs. +#--------------------------------------------------------------- +if [[ $PDATE = "" ]]; then + idate=`${DE_SCRIPTS}/nu_find_cycle.pl --run $RUN --cyc 1 --dir ${TANKverf}` + + if [[ ${#idate} -ne 10 ]]; then + echo "ERROR: Unable to locate any previous cycle's data files" + echo " Please re-run this script with a specified starting cycle as the last argument" + exit 4 + fi + + export PDATE=`${NDATE} +06 $idate` +fi + +echo "PDATE = $PDATE" + +pdy=`echo $PDATE|cut -c1-8` +cyc=`echo $PDATE|cut -c9-10` +export PDY=${pdy} +export cyc=${cyc} + +#--------------------------------------------------------------- +# Locate radstat and biascr files. +#--------------------------------------------------------------- +component=atmos + +if [[ -d ${RADSTAT_LOCATION}/gdas.${pdy}/${cyc}/${component} ]]; then + echo "looking for radstat in default location" + + datadir=${RADSTAT_LOCATION}/gdas.${pdy}/${cyc}/${component} + export biascr=${datadir}/gdas.t${cyc}z.abias + export radstat=${datadir}/gdas.t${cyc}z.radstat + +elif [[ -d ${RADSTAT_LOCATION}/gdas.${pdy}/${cyc} ]]; then + echo "looking for radstat in secondary location" + + export datadir=${RADSTAT_LOCATION}/gdas.${pdy}/${cyc} + export biascr=${datadir}/gdas.t${cyc}z.abias + export radstat=${datadir}/gdas.t${cyc}z.radstat + +elif [[ -d ${RADSTAT_LOCATION} ]]; then + echo "looking for radstat in tertiary location" + + export datadir=${RADSTAT_LOCATION} + export biascr=${datadir}/gdas.t${cyc}z.abias + export radstat=${datadir}/gdas.t${cyc}z.radstat + +else + echo "unable to locate expected subdirectories in ${RADSTAT_LOCATION}" + exit 5 +fi + + +#-------------------------------------------------------------------- +# If data is available, export variables, and submit J-job. +#-------------------------------------------------------------------- + +if [[ -e ${radstat} && -e ${biascr} ]]; then + echo "FOUND radstat and biascr -- we are good to go" + + export jlogfile=${WORKverf_rad}/jlogfile_${RADMON_SUFFIX} + + export VERBOSE=${VERBOSE:-YES} + prev_day=`${NDATE} -06 $PDATE | cut -c1-8` + prev_cyc=`${NDATE} -06 $PDATE | cut -c9-10` + + if [[ -e ${TANKverf}/info/${run}_radmon_satype.txt ]]; then + export satype_file=${TANKverf}/info/${run}_radmon_satype.txt + fi + export TANKverf_rad=${TANKverf_rad:-${TANKverf}/${RUN}.${pdy}/${cyc}/${MONITOR}} + export TANKverf_radM1=${TANKverf_radM1:-${TANKverf}/${RUN}.${prev_day}/${prev_cyc}/${MONITOR}} + + if [[ $cyc = "00" ]]; then + echo "Making new day directory for 00 cycle" + mkdir -p ${TANKverf_rad} + fi + + + #------------------------------------------------------------------ + # Override the default base_file declaration if there is an + # available base file for this source. + #------------------------------------------------------------------ + if [[ -s ${TANKverf}/info/radmon_base.tar.${Z} || -s ${TANKverf}/info/radmon_base.tar ]]; then + export base_file=${TANKverf}/info/radmon_base.tar + fi + + export RAD_DATA_IN=${RAD_DATA_IN:-${DATAROOT}/DE.${pdy}${cyc}} + + if [[ -d ${RAD_DATA_IN} ]]; then + rm -rf ${RAD_DATA_IN} + mkdir -p ${RAD_DATA_IN} + fi + + job=${HOMEgdas}/jobs/JGDAS_ATMOS_VERFRAD + jobname=RadMon_DE_${RADMON_SUFFIX} + logfile=${LOGdir}/DE.${pdy}.${cyc}.log + if [[ -e ${logfile} ]]; then + rm -f ${logfile} + fi + + + if [[ $MY_MACHINE = "wcoss_d" ]]; then + $SUB -q $JOB_QUEUE -P $PROJECT -o ${logfile} \ + -M 100 -R affinity[core] -W 0:20 -J ${jobname} -cwd ${PWD} ${job} + + elif [[ $MY_MACHINE = "wcoss_c" ]]; then + $SUB -q $JOB_QUEUE -P $PROJECT -o ${logfile} \ + -M 100 -W 0:20 -J ${jobname} -cwd ${PWD} ${job} + + elif [[ $MY_MACHINE = "hera" ]]; then + $SUB --account=${ACCOUNT} --time=10 -J ${jobname} -D . \ + -o ${logfile} --ntasks=1 --mem=5g ${job} + fi + +else # radstat and/or biascr not found + + if [[ ! -e ${radstat} ]]; then + echo "${radstat} RADSTAT FILE NOT FOUND" + fi + if [[ ! -e ${biascr} ]]; then + echo "${biascr} BIASCR FILE NOT FOUND" + fi + exit 6 +fi + + +echo end VrfyRad_glbl.sh + + +exit ${exit_value} + diff --git a/util/Radiance_Monitor/data_extract/ush/RadMon_DE_rgn.sh b/util/Radiance_Monitor/data_extract/ush/RadMon_DE_rgn.sh new file mode 100755 index 0000000000..8a4bdc18e1 --- /dev/null +++ b/util/Radiance_Monitor/data_extract/ush/RadMon_DE_rgn.sh @@ -0,0 +1,296 @@ +#!/bin/sh + +#-------------------------------------------------------------------- +# RadMon_DE_rgn.sh +# +# Extract data for regional source. +#-------------------------------------------------------------------- +echo start RadMon_DE_rgn.sh + + + +#-------------------------------------------------------------------- +# useage function +#-------------------------------------------------------------------- +function usage { + echo "Usage: RadMon_DE_rgn.sh suffix " + echo "" + echo ' Suffix or $NET value is the indentifier for this data source.' + echo "" + echo " -p|--pdate Full YYYYMMDDHH cycle to run. This param is optional. If not" + echo ' supplied, $TANKverf will be checked and the next cycle time will be run' + echo "" + echo ' -r|--run $run value for this source. "nam" is the default.' + echo "" + echo " -s|--radstat Location of directory tree containing the radstat files." + echo ' This should point to the directory containing the $run.$pdy/*radstat* files.' + echo "" + echo " -i|--int Cycle interval in hours. Default is 1." + echo "" +} + + +#------------------------------------------------------------------------------ +# set_hr_tm() assigns the rgnTM and rgnHH vars which are file name components +# in the rapid refresh scheme the nam uses. +#------------------------------------------------------------------------------ +function set_hr_tm(){ + + case $hr in + 00) rgnHH=t00z + rgnTM=tm00;; + 01) rgnHH=t06z + rgnTM=tm05;; + 02) rgnHH=t06z + rgnTM=tm04;; + 03) rgnHH=t06z + rgnTM=tm03;; + 04) rgnHH=t06z + rgnTM=tm02;; + 05) rgnHH=t06z + rgnTM=tm01;; + 06) rgnHH=t06z + rgnTM=tm00;; + 07) rgnHH=t12z + rgnTM=tm05;; + 08) rgnHH=t12z + rgnTM=tm04;; + 09) rgnHH=t12z + rgnTM=tm03;; + 10) rgnHH=t12z + rgnTM=tm02;; + 11) rgnHH=t12z + rgnTM=tm01;; + 12) rgnHH=t12z + rgnTM=tm00;; + 13) rgnHH=t18z + rgnTM=tm05;; + 14) rgnHH=t18z + rgnTM=tm04;; + 15) rgnHH=t18z + rgnTM=tm03;; + 16) rgnHH=t18z + rgnTM=tm02;; + 17) rgnHH=t18z + rgnTM=tm01;; + 18) rgnHH=t18z + rgnTM=tm00;; + 19) rgnHH=t00z # This is where the day changes. + rgnTM=tm05 + incr=1;; + 20) rgnHH=t00z + rgnTM=tm04 + incr=1;; + 21) rgnHH=t00z + rgnTM=tm03 + incr=1;; + 22) rgnHH=t00z + rgnTM=tm02 + incr=1;; + 23) rgnHH=t00z + rgnTM=tm01 + incr=1;; + esac + +} + + +#-------------------------------------------------------------------- +# VrfyRad_rgnl.sh begins here +#-------------------------------------------------------------------- +nargs=$# +if [[ $nargs -lt 1 || $nags -gt 9 ]]; then + usage + exit 1 +fi + +this_file=`basename $0` +this_dir=`dirname $0` + +#----------------------------------------------------------- +# Prrocess command line arguments. +# +radstat_location=/gpfs/dell1/nco/ops/com/nam/prod +cycle_interval=1 +run=nam + +while [[ $# -ge 1 ]] +do + key="$1" + echo $key + + case $key in + -p|--pdate) + pdate="$2" + shift # past argument + ;; + -r|--run) + run="$2" + shift + ;; + -i|--int) # cycle interval + cycle_interval="$2" + shift # past argument + ;; + -s|--radstat) + radstat_location="$2" + shift # past argument + ;; + *) + #any unspecified key is CONMON_SUFFIX + export RADMON_SUFFIX=$key + ;; + esac + + shift +done + +echo "RADMON_SUFFIX = ${RADMON_SUFFIX}" +echo "pdate = ${pdate}" +echo "run = ${run}" +echo "radstat_location = ${radstat_location}" +echo "cycle_interval = ${cycle_interval}" + +set -ax + +export CYCLE_INTERVAL=${cycle_interval} +export NET=${RADMON_SUFFIX} +export RUN=${run} + +export RAD_AREA=rgn + + +top_parm=${this_dir}/../../parm +export RADMON_CONFIG=${RADMON_CONFIG:-${top_parm}/RadMon_config} + +if [[ -s ${RADMON_CONFIG} ]]; then + . ${RADMON_CONFIG} +else + echo "Unable to source ${RADMON_CONFIG} file" + exit 2 +fi +if [[ -s ${RADMON_USER_SETTINGS} ]]; then + . ${RADMON_USER_SETTINGS} +else + echo "Unable to source ${RADMON_USER_SETTINGS} file" + exit 3 +fi + +#--------------------------------------------- +# Create $TANKverf and/or $LOGdir if needed. +# +if [[ ! -d ${TANKverf} ]]; then + mkdir -p $TANKverf +fi + +if [[ ! -d ${LOGdir} ]]; then + mkdir -p $LOGdir +fi + + +jobname=${jobname:-RadMon_DE_${RADMON_SUFFIX}} + +#-------------------------------------------------------------------- +# Determine date of cycle to process. +# +# 1. Use the specified date from the command line, if provided. +# +# 2. Else determine the last processed date, add $CYCLE_INTERVAL +# hrs to determine the next cycle. +#-------------------------------------------------------------------- + +if [[ ${pdate} = "" ]]; then + ldate=`${DE_SCRIPTS}/find_cycle.pl --cyc 1 --dir ${TANKverf}` + + if [[ ${#ldate} -ne 10 ]]; then + echo "ERROR: Unable to locate any previous cycle's data files" + echo " Check location of ${TANKVERF}. If OK then try to" + echo " re-run this script using the -p|--pdate option." + exit 4 + fi + + + + pdate=`${NDATE} +${CYCLE_INTERVAL} $ldate` + echo "pdate set to ${pdate}" +fi + + +#-------------------------------------------------------------------------- +# Locate the correct radstat file +# +# Note: namrr is peculiar in that the day rolls over with the +# t00z.radstat.tm06 file, so cycle times of 18-23 hrs will be +# found in the t18z.radstat.tm00-06, which is in tomorrow's +# directory, or nam.$PDY+24 hrs. +# +pdy=`echo $pdate|cut -c1-8` +cyc=`echo $pdate|cut -c9-10` + +hr=${cyc} + +rgnHH='' +rgnTM='' +incr=0 + +set_hr_tm + +echo "incr = ${incr}" +echo "rgnHH, rgnTM = ${rgnHH}, ${rgnTM}" + +#------------------------------------------------------------------ +# If processing on of the last 5 cycles for the day, look for +# them in the next day's directory. +#------------------------------------------------------------------ +if [[ $rgnHH = "t00z" && $rgnTM != "tm00" ]]; then + echo " option 1" + pdate06=`${NDATE} +6 $pdate` + pdy06=`echo ${pdate06} | cut -c1-8` + export radstat=${radstat_location}/${run}.${pdy06}/${RADMON_SUFFIX}.${rgnHH}.radstat.${rgnTM} + export biascr=${radstat_location}/${run}.${pdy06}/${RADMON_SUFFIX}.${rgnHH}.satbias.${rgnTM} +else + echo " option 2" + export radstat=${radstat_location}/${run}.${pdy}/${RADMON_SUFFIX}.${rgnHH}.radstat.${rgnTM} + export biascr=${radstat_location}/${run}.${pdy}/${RADMON_SUFFIX}.${rgnHH}.satbias.${rgnTM} +fi + +if [[ ! -e ${radstat} ]]; then + echo "Unable to locate radstat file ${radstat}" + exit 5 +fi +if [[ ! -e ${biascr} ]]; then + echo "Unable to locate biascr file ${satbias}" + exit 6 +fi + +echo "radstat: ${radstat}" +echo "biascr: ${satbias}" + + + +export PDATE=${pdate} +export PDY=`echo $PDATE|cut -c1-8` +export cyc=`echo $PDATE|cut -c9-10` +export job=${RADMON_SUFFIX}_vrfyrad_${PDY}${cyc} + +export DATA=${DATA:-${STMP_USER}/${RADMON_SUFFIX}/${run}/radmon/DE_${PDATE}} # this should be WORKDIR +cd ${STMP_USER} +rm -rf ${DATA} +mkdir -p ${DATA} + +logfile=$LOGdir/DE.${PDY}.${cyc}.log + +if [[ $MY_MACHINE = "wcoss_d" ]]; then + $SUB -q $JOB_QUEUE -P $PROJECT -M 40 -R affinity[core] -o ${logfile} \ + -W 0:05 -J ${jobname} -cwd ${PWD} $HOMEnam/jobs/JNAM_VERFRAD +elif [[ $MY_MACHINE = "wcoss_c" ]]; then + $SUB -q $JOB_QUEUE -P $PROJECT -M 40 -o ${logfile} -W 0:10 \ + -J ${jobname} -cwd ${PWD} $HOMEnam/jobs/JNAM_VERFRAD +elif [[ $MY_MACHINE = "hera" ]]; then + $SUB -A $ACCOUNT -l procs=1,walltime=0:05:00 -N ${jobname} -V \ + -j oe -o ${logfile} ${HOMEnam}/jobs/JNAM_VERFRAD +fi + + +echo end RadMon_DE_rgn.sh +exit ${exit_value} diff --git a/util/Radiance_Monitor/data_extract/ush/RunCopy.sh b/util/Radiance_Monitor/data_extract/ush/RunCopy.sh deleted file mode 100755 index 89bc581795..0000000000 --- a/util/Radiance_Monitor/data_extract/ush/RunCopy.sh +++ /dev/null @@ -1,198 +0,0 @@ -#!/bin/sh - -#-------------------------------------------------------------------- -# RunCopy.sh -# -# Run the copy script. -# -# This script will run the data copy for a given source in a -# loop. The loop can be: -# 1) from the last proceessed date until the available radstat -# data is exhausted, -# 2) from the input start date until available data is exhausted, -# 3) from the start to the stop date. -# -#-------------------------------------------------------------------- - -function usage { - echo "Usage: RunCopy.sh suffix start_date [end_date]" - echo " File name for RunCopy.sh can be full or relative path" - echo " Suffix is the indentifier for this data source." - echo " Start_date is the optional starting cycle to process (YYYYMMDDHH format)." - echo " End_date is the optional ending cycle to process (YYYYMMDDHH format)." -} - -# -# with no data_map.xml we'll need to add glb/rgn as a parm -# - -set -ax -echo start RunCopy.sh - - -nargs=$# -if [[ $nargs -lt 1 ]]; then - usage - exit 1 -fi - -this_file=`basename $0` -this_dir=`dirname $0` - -RADMON_SUFFIX=$1 -START_DATE=$2 -END_DATE=$3 - -RUN_ENVIR=${RUN_ENVIR:-dev} -RAD_AREA=${RAD_AREA:-glb} - -echo RADMON_SUFFIX = $RADMON_SUFFIX -echo START_DATE = $START_DATE -echo END_DATE = $END_DATE - -#-------------------------------------------------------------------- -# Set environment variables -#-------------------------------------------------------------------- -top_parm=${this_dir}/../../parm -export RADMON_CONFIG=${RADMON_CONFIG:-${top_parm}/RadMon_config} - -if [[ -s ${RADMON_CONFIG} ]]; then - . ${RADMON_CONFIG} -else - echo "Unable to source ${RADMON_CONFIG} file" - exit 2 -fi - -if [[ -s ${RADMON_USER_SETTINGS} ]]; then - . ${RADMON_USER_SETTINGS} -else - echo "Unable to source ${RADMON_USER_SETTINGS} file" - exit 6 -fi - -. ${DE_PARM}/data_extract_config - -#-------------------------------------------------------------------- -# Check setting of RUN_ONLY_ON_DEV and possible abort if on prod and -# not permitted to run there. -#-------------------------------------------------------------------- - -if [[ RUN_ONLY_ON_DEV -eq 1 ]]; then - is_prod=`${DE_SCRIPTS}/onprod.sh` - if [[ $is_prod = 1 ]]; then - exit 10 - fi -fi - - -if [[ $RAD_AREA = glb ]]; then - copy_script=Copy_glbl.sh -elif [[ $RAD_AREA = rgn ]]; then - copy_script=Copy_rgnl.sh -else - exit 3 -fi - -#-------------------------------------------------------------------- -# Check for running on prod machine. -#-------------------------------------------------------------------- - -if [[ RUN_ON_PROD -eq 0 ]]; then - is_prod=`${DE_SCRIPTS}/onprod.sh` - if [[ $is_prod -eq 1 ]]; then - exit 10 - fi -fi - - -#-------------------------------------------------------------------- -# If end date was specified, confirm the start is before end date. -#-------------------------------------------------------------------- -end_len=`echo ${#END_DATE}` -if [[ ${end_len} -gt 0 ]]; then - if [[ $START_DATE -gt $END_DATE ]]; then - echo ERROR -- start date is greater then end date : $START_DATE $END_DATE - exit 1 - fi -fi - - -#-------------------------------------------------------------------- -# If we have a START_DATE then use it, otherwise use the -# find_cycle.pl script to determine the last copied cycle. -#-------------------------------------------------------------------- -start_len=`echo ${#START_DATE}` -if [[ ${start_len} -le 0 ]]; then - pdate=`${DE_SCRIPTS}/find_cycle.pl 1 ${TANKverf}` - pdate_len=`echo ${#pdate}` - if [[ ${pdate_len} -ne 10 ]]; then - exit 4 - fi - START_DATE=`${NDATE} +06 $pdate` -fi - -cdate=$START_DATE - -mkdir -p $LOGdir -#-------------------------------------------------------------------- -# Run in a loop until END_DATE is processed, or an error occurs, or -# we run out of data. -#-------------------------------------------------------------------- -done=0 -ctr=0 -while [[ $done -eq 0 ]]; do - - #-------------------------------------------------------------------- - # Check for running jobs - #-------------------------------------------------------------------- - if [[ $MY_MACHINE = "wcoss" ]]; then - running=`bjobs -l | grep data_extract_${RADMON_SUFFIX} | wc -l` - elif [[ $MY_MACHINE = "zeus" ]]; then - running=`qstat -u $LOGNAME | grep data_extract_${RADMON_SUFFIX} | wc -l` - fi - - if [[ $running -ne 0 ]]; then - #---------------------------------------------------- - # sleep or time-out after 30 tries. - #---------------------------------------------------- - ctr=$(( $ctr + 1 )) - if [[ $ctr -le 30 ]]; then - echo sleeping..... - sleep 60 - else - done=1 - fi - else - - #----------------------------------------------------------------- - # Run the copy script - #----------------------------------------------------------------- - log_file=${LOGdir}/CopyRad_${RADMON_SUFFIX}_${cdate}.log - err_file=${LOGdir}/CopyRad_${RADMON_SUFFIX}_${cdate}.err - - echo Processing ${cdate} - ${DE_SCRIPTS}/${copy_script} ${RADMON_SUFFIX} ${cdate} 1>${log_file} 2>${err_file} - - #----------------------------------------------------------------- - # done is true (1) if the copy_script produced an error code, or - # we're at END_DATE - #----------------------------------------------------------------- - rc=`echo $?` - if [[ $rc -ne 0 ]]; then - done=1 - elif [[ $cdate -eq $END_DATE ]]; then - done=1 - else - #-------------------------------------------------------------- - # If not done advance the cdate to the next cycle - #-------------------------------------------------------------- - cdate=`${NDATE} +06 $cdate` - ctr=0 - fi - fi - -done - - -echo "end RunCopy.sh" -exit diff --git a/util/Radiance_Monitor/data_extract/ush/RunVrfy.sh b/util/Radiance_Monitor/data_extract/ush/RunVrfy.sh deleted file mode 100755 index de45e4bdde..0000000000 --- a/util/Radiance_Monitor/data_extract/ush/RunVrfy.sh +++ /dev/null @@ -1,223 +0,0 @@ -#!/bin/sh - -#-------------------------------------------------------------------- -# RunVrfy.sh -# -# Run the verification and data extract. -# -# This script will run the data extraction for a given source in a -# loop. The loop can be from the last cycle processed (as -# determined by the contents of $TANKverf) until the available -# radstat data is exhausted, from the input start date until -# available data is exhausted, or from the start to the end date. -# -# The RAD_AREA defaults to glb (global). If you want to use this -# script to process regional data then export RAD_AREA=rgn in your -# shell and then run this script. -# -# Calling sequence is Suffix, Area, [start_date], [end_date} -# suffix = identifier for this data source -# start_date = optional starting cycle to process -# end_date = optional ending cycle to process -#-------------------------------------------------------------------- - -function usage { - echo "Usage: RunVrfy.sh suffix start_date [end_date]" - echo " Suffix is the indentifier for this data source." - echo " Start_date is the optional starting cycle to process (YYYYMMDDHH format)." - echo " End_date is the optional ending cycle to process (YYYYMMDDHH format)." - echo " RAD_AREA is set by default to glb (global). If you want to process" - echo " regional data export RAD_AREA=rgn in your shell and run this script." -} - -set -ax -echo start RunVrfy.sh - -nargs=$# -if [[ $nargs -lt 1 ]]; then - usage - exit 1 -fi - -# -# Check for my monitoring use. Abort if running on prod machine. -# - machine=`hostname | cut -c1` - prod=`cat /etc/prod | cut -c1` - - if [[ $machine = $prod ]]; then - exit 10 - fi -# -# End check. - -this_file=`basename $0` -this_dir=`dirname $0` - -RADMON_SUFFIX=$1 -START_DATE=$2 -END_DATE=$3 - -RUN_ENVIR=${RUN_ENVIR:-dev} -RAD_AREA=${RAD_AREA:-glb} - -echo RADMON_SUFFIX = $RADMON_SUFFIX -echo START_DATE = $START_DATE -echo END_DATE = $END_DATE - -#-------------------------------------------------------------------- -# Set environment variables -#-------------------------------------------------------------------- -top_parm=${this_dir}/../../parm - -export RADMON_VERSION=${RADMON_VERSION:-${top_parm}/radmon.ver} -if [[ -s ${RADMON_VERSION} ]]; then - . ${RADMON_VERSION} -else - echo "Unable to source ${RADMON_VERSION} file" - exit 2 -fi - -export RADMON_CONFIG=${RADMON_CONFIG:-${top_parm}/RadMon_config} - -if [[ -s ${RADMON_CONFIG} ]]; then - . ${RADMON_CONFIG} -else - echo "Unable to source ${RADMON_CONFIG} file" - exit 2 -fi - -if [[ -s ${RADMON_USER_SETTINGS} ]]; then - . ${RADMON_USER_SETTINGS} -else - echo "Unable to source ${RADMON_USER_SETTINGS} file" - exit 2 -fi - -. ${DE_PARM}/data_extract_config - -#-------------------------------------------------------------------- -# Check setting of RUN_ONLY_ON_DEV and possible abort if on prod and -# not permitted to run there. -#-------------------------------------------------------------------- - -if [[ RUN_ONLY_ON_DEV -eq 1 ]]; then - is_prod=`${DE_SCRIPTS}/onprod.sh` - if [[ $is_prod = 1 ]]; then - exit 10 - fi -fi - - -log_file=${LOGdir}/VrfyRad_${RADMON_SUFFIX}.log -err_file=${LOGdir}/VrfyRad_${RADMON_SUFFIX}.err - -if [[ $RAD_AREA = glb ]]; then - vrfy_script=VrfyRad_glbl.sh -elif [[ $RAD_AREA = rgn ]]; then - vrfy_script=VrfyRad_rgnl.sh -else - exit 3 -fi - - -#-------------------------------------------------------------------- -# If end date was specified, confirm the start is before end date. -#-------------------------------------------------------------------- -end_len=`echo ${#END_DATE}` -if [[ ${end_len} -gt 0 ]]; then - if [[ $START_DATE -gt $END_DATE ]]; then - echo "ERROR: start date is greater then end date : $START_DATE $END_DATE" - exit 1 - fi -fi - - -#-------------------------------------------------------------------- -# If we don't have a START_DATE the find the last processed cycle, -# and add 6 hrs to it. -#-------------------------------------------------------------------- -start_len=`echo ${#START_DATE}` -if [[ ${start_len} -gt 0 ]]; then - pdate=`${NDATE} -06 $START_DATE` -else - pdate=`${DE_SCRIPTS}/find_cycle.pl 1 ${TANKverf}` - pdate_len=`echo ${#pdate}` - START_DATE=`${NDATE} +06 $pdate` -fi - - -#-------------------------------------------------------------------- -# Run in a loop until END_DATE is processed, or an error occurs, or -# we run out of data. -#-------------------------------------------------------------------- -cdate=$START_DATE -done=0 -ctr=0 -jobname=$DATA_EXTRACT_JOBNAME - -while [[ $done -eq 0 ]]; do - - #-------------------------------------------------------------------- - # Check for running jobs - #-------------------------------------------------------------------- - if [[ $MY_MACHINE = "wcoss" ]]; then - running=`bjobs -l | grep de_${RADMON_SUFFIX} | wc -l` - elif [[ $MY_MACHINE = "zeus" ]]; then - running=1 - line=`qstat -u ${LOGNAME} | grep ${jobname}` - test=`echo $line | gawk '{print $10}'` - - total=`echo $line | grep ${jobname} | wc -l` - if [[ $test = "C" || $total -le 0 ]]; then - running=0 - fi - - fi - - if [[ $running -ne 0 ]]; then - #---------------------------------------------------- - # sleep or time-out after 30 tries. - #---------------------------------------------------- - ctr=$(( $ctr + 1 )) - if [[ $ctr -le 30 ]]; then - echo sleeping..... - sleep 60 - else - done=1 - fi - else - - #----------------------------------------------------------------- - # Run the verification/extraction script - #----------------------------------------------------------------- - echo Processing ${cdate} - ${DE_SCRIPTS}/${vrfy_script} ${RADMON_SUFFIX} ${RUN_ENVIR} ${cdate} 1>${log_file} 2>${err_file} - - #----------------------------------------------------------------- - # done is true (1) if the vrfy_script produced an error code, or - # we're at END_DATE - #----------------------------------------------------------------- - rc=`echo $?` - if [[ $rc -ne 0 ]]; then - done=1 - elif [[ $cdate -eq $END_DATE ]]; then - done=1 - else - #-------------------------------------------------------------- - # If not done advance the cdate to the next cycle. - # sleep is for zeus's job queue to catch up. - #-------------------------------------------------------------- - cdate=`${NDATE} +06 $cdate` - ctr=0 - if [[ $MY_MACHINE = "zeus" ]]; then - sleep 30 - fi - fi - fi - -done - - -echo "end RunVrfy.sh" -exit diff --git a/util/Radiance_Monitor/data_extract/ush/VrfyRad_glbl.sh b/util/Radiance_Monitor/data_extract/ush/VrfyRad_glbl.sh deleted file mode 100755 index 170b13589f..0000000000 --- a/util/Radiance_Monitor/data_extract/ush/VrfyRad_glbl.sh +++ /dev/null @@ -1,316 +0,0 @@ -#!/bin/sh - -#-------------------------------------------------------------------- -# VrfyRad_glbl.sh -# -# Verification and data extraction script for global (GDAS) radiance -# diagnostic data. -# -# This script verifies data is available and submits the -# JGDAS_VERFRAD job, which performs the data extraction and -# validation checks. -#-------------------------------------------------------------------- -set -ax -echo start VrfyRad_glbl.sh - - -#-------------------------------------------------------------------- -# usage -#-------------------------------------------------------------------- -function usage { - echo "Usage: VrfyRad_glbl.sh suffix [pdate]" - echo " Suffix is the indentifier for this data source." - echo " Pdate is the full YYYYMMDDHH cycle to run. This param is optional" -} - -#-------------------------------------------------------------------- -# VrfyRad_glbl.sh begins here -#-------------------------------------------------------------------- -nargs=$# -if [[ $nargs -lt 1 || $nargs -gt 3 ]]; then - usage - exit 1 -fi - - -this_file=`basename $0` -this_dir=`dirname $0` -num_flds=`echo ${this_dir} | awk -F'/' '{print NF}'` - -export KEEPDATA="YES" - -#-------------------------------------------------------------------- -# Eventually remove RUN_ENVIR argument but allow for it to possibly be -# present as $2 to ensure backward compatibility. -# -# if $COMOUT is defined then assume we're in a parallel. -#-------------------------------------------------------------------- -export RADMON_SUFFIX=$1 -export RUN_ENVIR="" - -if [[ $nargs -ge 2 ]]; then - if [[ $2 = "dev" || $2 = "para" ]]; then - export RUN_ENVIR=$2; - else - export PDATE=$2; - fi - - if [[ $nargs -eq 3 ]]; then - export PDATE=$3; - fi -fi - -if [[ $RUN_ENVIR = "" ]]; then - export RUN_ENVIR="para" - if [[ $COMOUT = "" ]]; then - export RUN_ENVIR="dev" - fi -fi - -echo RADMON_SUFFIX = $RADMON_SUFFIX -echo RUN_ENVIR = $RUN_ENVIR - - -#-------------------------------------------------------------------- -# Set environment variables -#-------------------------------------------------------------------- -export RAD_AREA=glb -export MAKE_CTL=${MAKE_CTL:-1} -export MAKE_DATA=${MAKE_DATA:-1} - -if [[ $RUN_ENVIR = para || $RUN_ENVIR = prod ]]; then - this_dir=${VRFYRAD_DIR} -fi - - -top_parm=${this_dir}/../../parm -export RADMON_VERSION=${RADMON_VERSION:-${top_parm}/radmon.ver} -if [[ -s ${RADMON_VERSION} ]]; then - . ${RADMON_VERSION} -else - echo "Unable to source ${RADMON_VERSION} file" - exit 2 -fi - -export RADMON_CONFIG=${RADMON_CONFIG:-${top_parm}/RadMon_config} -if [[ -s ${RADMON_CONFIG} ]]; then - . ${RADMON_CONFIG} -else - echo "Unable to source ${RADMON_CONFIG} file" - exit 2 -fi - -if [[ -s ${RADMON_USER_SETTINGS} ]]; then - . ${RADMON_USER_SETTINGS} -else - echo "Unable to source ${RADMON_USER_SETTINGS} file" - exit 3 -fi - -. ${DE_PARM}/data_extract_config - - -#-------------------------------------------------------------------- -# Check setting of RUN_ONLY_ON_DEV and possible abort if on prod and -# not permitted to run there. -#-------------------------------------------------------------------- - -if [[ RUN_ONLY_ON_DEV -eq 1 ]]; then - is_prod=`${DE_SCRIPTS}/onprod.sh` - if [[ $is_prod = 1 ]]; then - exit 10 - fi -fi - - -mkdir -p $TANKverf -mkdir -p $LOGdir - -jobname=$DATA_EXTRACT_JOBNAME - -#-------------------------------------------------------------------- -# Check status of monitoring job. Are any earlier verf jobs still -# running? If so, exit this script and wait for job to finish. -# -# If we're good to go clean out the $LOADLQ directory and proceed. -#-------------------------------------------------------------------- - -if [[ $RUN_ENVIR = dev ]]; then - if [[ $MY_MACHINE = "wcoss" ]]; then - total=`bjobs -l | grep ${jobname} | wc -l` - elif [[ $MY_MACHINE = "hera" || $MY_MACHINE = "theia" ]]; then - total=0 - line=`qstat -u ${LOGNAME} | grep ${jobname}` - test=`echo $line | gawk '{print $10}'` - - total=`echo $line | grep ${jobname} | wc -l` - if [[ $test = "C" && $total -eq "1" ]]; then - total=0 - fi - fi - - if [[ $total -gt 0 ]]; then - exit 4 - fi - -fi - - -#------------------------------------------------------------------ -# define data file sources depending on $RUN_ENVIR -# -# need to idenfity correct output location(s) for binary files -#------------------------------------------------------------------ -if [[ $RUN_ENVIR = dev ]]; then - - #--------------------------------------------------------------- - # Get date of cycle to process. - #--------------------------------------------------------------- - if [[ $PDATE = "" ]]; then - pdate=`${DE_SCRIPTS}/find_cycle.pl --cyc 1 --dir ${TANKverf}` - if [[ ${#pdate} -ne 10 ]]; then - echo "ERROR: Unable to locate any previous cycle's data files" - echo " Please re-run this script with a specified starting cycle as the last argument" - exit 5 - fi - qdate=`${NDATE} +06 $pdate` - export PDATE=${qdate} - fi - - export PDY=`echo $PDATE|cut -c1-8` - export CYC=`echo $PDATE|cut -c9-10` - - export DATDIR=${RADSTAT_LOCATION} - - #--------------------------------------------------------------- - # Locate required files. - #--------------------------------------------------------------- - if [[ -d ${DATDIR}/gdas.${PDY}/${CYC} ]]; then - export DATDIR=${DATDIR}/gdas.${PDY}/${CYC} - - export biascr=$DATDIR/gdas.t${CYC}z.abias - export radstat=$DATDIR/gdas.t${CYC}z.radstat - - elif [[ -d ${DATDIR}/gdas.$PDY ]]; then - export DATDIR=${DATDIR}/gdas.${PDY} - - export biascr=$DATDIR/gdas.t${CYC}z.abias - export radstat=$DATDIR/gdas.t${CYC}z.radstat - elif [[ -s ${DATDIR}/gdas.t${CYC}z.radstat ]]; then - - export biascr=$DATDIR/gdas.t${CYC}z.abias - export radstat=$DATDIR/gdas.t${CYC}z.radstat - - else - export biascr=$DATDIR/biascr.gdas.${PDATE} - export radstat=$DATDIR/radstat.gdas.${PDATE} - fi - -elif [[ $RUN_ENVIR = para ]]; then - - #--------------------------------------------------------------- - # Locate required files. - #--------------------------------------------------------------- - export DATDIR=$COMOUT - export PDATE=$CDATE - export PDY=`echo $PDATE|cut -c1-8` - export CYC=`echo $PDATE|cut -c9-10` - - export biascr=$DATDIR/biascr.gdas.${CDATE} - export radstat=$DATDIR/radstat.gdas.${CDATE} - - echo biascr = $biascr - echo radstat = $radstat - -else - echo "error RUN_ENVIR = $RUN_ENVIR, not dev or para" - exit 2 -fi - - -#-------------------------------------------------------------------- -# If data is available, export variables, and submit driver for -# radiance monitoring jobs. -#-------------------------------------------------------------------- -data_available=0 - -if [[ -e ${radstat} ]]; then - data_available=1 - - export MP_SHARED_MEMORY=yes - export MEMORY_AFFINITY=MCM - export envir=prod - - export cyc=$CYC - export job=gdas_vrfyrad_${PDY}${cyc} - export SENDSMS=${SENDSMS:-NO} - export DATA_IN=${WORKverf_rad} - export DATA=${DATA:-${STMP_USER}/radmon/${RADMON_SUFFIX}} - rm -rf ${DATA} - mkdir -p ${DATA} - export jlogfile=${WORKverf_rad}/jlogfile_${RADMON_SUFFIX} - - export VERBOSE=${VERBOSE:-YES} - prev_day=`${NDATE} -06 $PDATE | cut -c1-8` - - if [[ $TANK_USE_RUN -eq 0 ]]; then -# export TANKverf_rad=${TANKverf_rad:-${TANKverf}/${RUN}.${PDY}/${MONITOR}} -# export TANKverf_radM1=${TANKverf_radM1:-${TANKverf}/${RUN}.${prev_day}/${MONITOR}} -# else - export TANKverf_rad=${TANKverf_rad:-${TANKverf}/${MONITOR}.${PDY}} - export TANKverf_radM1=${TAKverf_radM1:-${TANKverf}/${MONITOR}.${prev_day}} - fi - - if [[ $CYC = "00" ]]; then - echo "Making new day directory for 00 cycle" - mkdir -p ${TANKverf_rad} - fi - - - #------------------------------------------------------------------ - # Override the default base_file declaration if there is an - # available base file for this source. - #------------------------------------------------------------------ - if [[ -s ${TANKverf}/info/radmon_base.tar.${Z} || -s ${TANKverf}/info/radmon_base.tar ]]; then - export base_file=${TANKverf}/info/radmon_base.tar - fi - - #------------------------------------------------------------------ - # Submit data processing jobs. - #------------------------------------------------------------------ - if [[ $MY_MACHINE = "wcoss" || $MY_MACHINE = "wcoss_d" ]]; then - $SUB -q $JOB_QUEUE -P $PROJECT -o $LOGdir/data_extract.${PDY}.${cyc}.log \ - -M 100 -R affinity[core] -W 0:20 -J ${jobname} -cwd ${PWD} \ - $HOMEgdas/jobs/JGDAS_VERFRAD - - elif [[ $MY_MACHINE = "cray" ]]; then - $SUB -q $JOB_QUEUE -P $PROJECT -o $LOGdir/data_extract.${PDY}.${cyc}.log \ - -M 100 -W 0:20 -J ${jobname} -cwd ${PWD} $HOMEgdas/jobs/JGDAS_VERFRAD - - elif [[ $MY_MACHINE = "hera" ]]; then - $SUB --account=${ACCOUNT} --time=10 -J ${jobname} -D . \ - -o ${LOGdir}/DE.${PDY}.${cyc}.log \ - --ntasks=1 --mem=5g \ - ${HOMEgdas}/jobs/JGDAS_VERFRAD - fi - -fi - -#-------------------------------------------------------------------- -# Clean up and exit -#-------------------------------------------------------------------- -cd $tmpdir -cd ../ -rm -rf $tmpdir - -exit_value=0 -if [[ ${data_available} -ne 1 ]]; then - exit_value=6 - echo No data available for ${RADMON_SUFFIX} -fi - -echo end VrfyRad_glbl.sh - - -exit ${exit_value} - diff --git a/util/Radiance_Monitor/data_extract/ush/VrfyRad_rgnl.sh b/util/Radiance_Monitor/data_extract/ush/VrfyRad_rgnl.sh deleted file mode 100755 index 6106cc6275..0000000000 --- a/util/Radiance_Monitor/data_extract/ush/VrfyRad_rgnl.sh +++ /dev/null @@ -1,477 +0,0 @@ -#!/bin/sh - -#-------------------------------------------------------------------- -# VrfyRad_rgnl -# -# Extract data for regional source. -#-------------------------------------------------------------------- -set -ax -echo start VrfyRad_rgnl.sh - - - -#-------------------------------------------------------------------- -# useage function -#-------------------------------------------------------------------- -function usage { - echo "Usage: VrfyRad_rgnl.sh suffix [pdate] " - echo " Suffix is the indentifier for this data source." - echo " Pdate is the full YYYYMMDDHH cycle to run. This param is optional" -} - - -#-------------------------------------------------------------------- -# VrfyRad_rgnl.sh begins here -#-------------------------------------------------------------------- -nargs=$# -if [[ $nargs -lt 1 || $nags -gt 3 ]]; then - usage - exit 1 -fi - -this_file=`basename $0` -this_dir=`dirname $0` - -#-------------------------------------------------------------------- -# Eventually remove RUN_ENVIR argument but allow for it to possibly be -# present as $2 to ensure backward compatibility. -# -# if $COMOUT is defined then assume we're in a parallel. -#-------------------------------------------------------------------- -export RADMON_SUFFIX=$1 -export RUN_ENVIR="" -increment=1 - -if [[ $nargs -ge 2 ]]; then - if [[ $2 = "dev" || $2 = "para" ]]; then - export RUN_ENVIR=$2; - else - export PDATE=$2; - fi - - if [[ $nargs -eq 3 ]]; then - export PDATE=$3; - fi -fi - -if [[ $RUN_ENVIR = "" ]]; then - export RUN_ENVIR="para" - if [[ $COMOUT = "" ]]; then - export RUN_ENVIR="dev" - fi -fi - -echo RADMON_SUFFIX = $RADMON_SUFFIX -echo RUN_ENVIR = $RUN_ENVIR - - -#-------------------------------------------------------------------- -# Set environment variables -#-------------------------------------------------------------------- -export RAD_AREA=rgn -export MAKE_CTL=${MAKE_CTL:-1} -export MAKE_DATA=${MAKE_DATE:-1} - -if [[ ${RUN_ENVIR} = para || ${RUN_ENVIR} = prod ]]; then - this_dir=${VRFYRAD_DIR} -fi - - -top_parm=${this_dir}/../../parm -export RADMON_VERSION=${RADMON_VERSION:-${top_parm}/radmon.ver} -if [[ -s ${RADMON_VERSION} ]]; then - . ${RADMON_VERSION} -else - echo "Unable to source ${RADMON_VERSION} file" - exit 2 -fi - -export RADMON_CONFIG=${RADMON_CONFIG:-${top_parm}/RadMon_config} - -if [[ -s ${RADMON_CONFIG} ]]; then - . ${RADMON_CONFIG} -else - echo "Unable to source ${RADMON_CONFIG} file" - exit 2 -fi -if [[ -s ${RADMON_USER_SETTINGS} ]]; then - . ${RADMON_USER_SETTINGS} -else - echo "Unable to source ${RADMON_USER_SETTINGS} file" - exit 3 -fi - -. ${DE_PARM}/data_extract_config - - -#-------------------------------------------------------------------- -# Check setting of RUN_ONLY_ON_DEV and possible abort if on prod and -# not permitted to run there. -#-------------------------------------------------------------------- - -if [[ RUN_ONLY_ON_DEV -eq 1 ]]; then - is_prod=`${DE_SCRIPTS}/onprod.sh` - if [[ $is_prod = 1 ]]; then - exit 10 - fi -fi - - -#-------------------------------------------------------------------- - -mkdir -p $TANKverf -mkdir -p $LOGdir - -jobname=$DATA_EXTRACT_JOBNAME - -#-------------------------------------------------------------------- -# Check status of monitoring job. Are any earlier verf jobs still -# running? If so, exit this script and wait for job to finish. -# -# If we're good to go, clean out the $LOADLQ directory and proceed. -#-------------------------------------------------------------------- - -if [[ ${RUN_ENVIR} = dev ]]; then - if [[ $MY_MACHINE = "wcoss" ]]; then - total=`bjobs -l | grep ${jobname} | wc -l` - elif [[ $MY_MACHINE = "hera" || $MY_MACHINE = "theia" ]]; then - total=0 - line=`qstat -u ${LOGNAME} | grep ${jobname}` - test=`echo $line | gawk '{print $10}'` - - total=`echo $line | grep ${jobname} | wc -l` - if [[ $test = "C" && $total -eq "1" ]]; then - total=0 - fi - fi - - if [[ $total -gt 0 ]]; then - exit 4 - fi -fi - -tmpdir=${WORKverf_rad}/check_rad${RADMON_SUFFIX} -rm -rf $tmpdir -mkdir -p $tmpdir -cd $tmpdir - -export REGIONAL_RR=${REGIONAL_RR:-0} # regional rapid refresh flag -echo "REGIONAL_RR = ${REGIONAL_RR}" - -#------------------------------------------------------------------ -# define data file sources depending on $RUN_ENVIR -# -# need to idenfity correct output location(s) for binary files -#------------------------------------------------------------------ -if [[ $RUN_ENVIR = dev ]]; then - - #-------------------------------------------------------------------- - # Get date of cycle to process. Use the specified date from the - # command line, if provided. - # - # If no date was provided then determine the last processed date - # ($pdate) and add 06 hrs to determine the next cycle ($qdate). - # Also run the find_ndas_radstat.pl script to determine the - # earliest date for which a radstat file exists ($fdate). - # Sometimes there are breaks in radstat file availability. If the - # next cycle is for a date less than the next available date, then - # we have to use the next available date. - #-------------------------------------------------------------------- - export DATDIR=${PTMP_USER}/regional - export com=${RADSTAT_LOCATION} - - if [[ $PDATE = "" ]]; then - pdate=`${DE_SCRIPTS}/find_cycle.pl --cyc 1 --dir ${TANKverf}` - - if [[ ${#pdate} -ne 10 ]]; then - echo "ERROR: Unable to locate any previous cycle's data files" - echo " Re-run this script with a specified starting cycle" - exit 5 - fi - - # -------------------------------------------------------------------- - # CYCLE_INTERVAL comes from the ../../parm/RadMon_user_settings file - # -------------------------------------------------------------------- - if [[ $REGIONAL_RR -eq 1 ]]; then - # if there is no $pdate we may or may not increment the $pdate - # depending on the rgnHH and rgnTM settings - # get PDY, rgnHH, rgnTM - - new_day=0 - hr=`echo $pdate|cut -c9-10` - if [[ $hr = "00" || $hr = "06" || $hr = "12" || $hr = "18" ]]; then - rgnHH=`${DE_SCRIPTS}/rr_get_tHHz.pl $pdate ${TANKverf}` - - if [[ $hr = "00" && $rgnHH = "t00z" ]]; then - increment=0 - rgnHH="t06z" - rgnTM="tm06" - elif [[ $hr = "06" && $rgnHH = "t06z" ]]; then - increment=0 - rgnHH="t12z" - rgnTM="tm06" - elif [[ $hr = "12" && $rgnHH = "t12z" ]]; then - increment=0 - rgnHH="t18z" - rgnTM="tm06" - elif [[ $hr = "18" && $rgnHH = "t18z" ]]; then - increment=0 - rgnHH="t00z" - rgnTM="tm06" - fi - fi - - if [[ $increment -eq 1 ]]; then - qdate=`${NDATE} +${CYCLE_INTERVAL} $pdate` # namrr is peculiar in that that -# elif [[ $new_day -eq 1 ]]; then # day rolls over with the -# qdate=`${NDATE} +24 $pdate` # t00z.radstat.tm06 file -# echo "ADVANCE from $pdate to $qdate" # t18z.radstat.tm00 was yesterday - else - qdate=$pdate - fi - - else - qdate=`${NDATE} +${CYCLE_INTERVAL} $pdate` - fi - - if [[ $REGIONAL_RR -eq 0 ]]; then - fdate=`${DE_SCRIPTS}/find_ndas_radstat.pl 0 $com` - echo $fdate - - if [[ $qdate -ge $fdate ]]; then - export PDATE=$qdate - else - export PDATE=$fdate - fi - else # REGIONAL_RR - export PDATE=$qdate - fi - fi - - sdate=`echo $PDATE|cut -c1-8` - export CYA=`echo $PDATE|cut -c9-10` - - #--------------------------------------------------------------- - # Locate required files. - #--------------------------------------------------------------- - echo $PDATE - - if [[ $REGIONAL_RR -eq 1 ]]; then - echo increment = $increment - - if [[ $increment -eq 1 ]]; then - PDY00=`echo $PDATE | cut -c 1-8` - HH00=`echo $PDATE | cut -c 9-10` - case $HH00 in - 00) export rgnHH=t00z - export rgnTM=tm00;; - 01) export rgnHH=t06z - export rgnTM=tm05;; - 02) export rgnHH=t06z - export rgnTM=tm04;; - 03) export rgnHH=t06z - export rgnTM=tm03;; - 04) export rgnHH=t06z - export rgnTM=tm02;; - 05) export rgnHH=t06z - export rgnTM=tm01;; - 06) export rgnHH=t06z - export rgnTM=tm00;; - 07) export rgnHH=t12z - export rgnTM=tm05;; - 08) export rgnHH=t12z - export rgnTM=tm04;; - 09) export rgnHH=t12z - export rgnTM=tm03;; - 10) export rgnHH=t12z - export rgnTM=tm02;; - 11) export rgnHH=t12z - export rgnTM=tm01;; - 12) export rgnHH=t12z - export rgnTM=tm00;; - 13) export rgnHH=t18z - export rgnTM=tm05;; - 14) export rgnHH=t18z - export rgnTM=tm04;; - 15) export rgnHH=t18z - export rgnTM=tm03;; - 16) export rgnHH=t18z - export rgnTM=tm02;; - 17) export rgnHH=t18z - export rgnTM=tm01;; - 18) export rgnHH=t18z # day changes here?! - export rgnTM=tm00;; - 19) export rgnHH=t00z - export rgnTM=tm05;; - 20) export rgnHH=t00z - export rgnTM=tm04;; - 21) export rgnHH=t00z - export rgnTM=tm03;; - 22) export rgnHH=t00z - export rgnTM=tm02;; - 23) export rgnHH=t00z - export rgnTM=tm01;; - esac - fi - - echo "PDATE = $PDATE" - echo "DATDIR = $DATDIR" - echo "com = $com" - echo "rgnHH = $rgnHH" - echo "rgnTM = $rgnTM" - /bin/sh ${DE_SCRIPTS}/getbestnamrr_radstat.sh ${PDATE} ${DATDIR} ${com} ${rgnHH} ${rgnTM} - - else - - /bin/sh ${DE_SCRIPTS}/getbestndas_radstat.sh ${PDATE} ${DATDIR} ${com} - fi - - echo RADSTAT = $radstat - echo BIASCR = $biascr - - - -elif [[ ${RUN_ENVIR} = para ]]; then - # need to change this logic in line with glbl version - # can't default to ndas - - #--------------------------------------------------------------- - # Locate required files. - #--------------------------------------------------------------- - - export DATDIR=${PTMP_USER}/regional - export com=`dirname ${COMOUT}` - export PDATE=${CDATE} - - sdate=`echo ${PDATE}|cut -c1-8` - export CYA=`echo ${PDATE}|cut -c9-10` - - /bin/sh ${DE_SCRIPTS}/getbestndas_radstat.sh $PDATE $DATDIR $com - -else - echo RUN_ENVIR = $RUN_ENVIR - exit 1 -fi - - -export biascr=$DATDIR/satbias.${PDATE} -export radstat=$DATDIR/radstat.${PDATE} - -#-------------------------------------------------------------------- -# If data is available, export variables, and submit driver for -# radiance monitoring jobs. -#-------------------------------------------------------------------- - -data_available=0 - -if [ -s $radstat -a -s $biascr ]; then - data_available=1 - - export MP_SHARED_MEMORY=yes - export MEMORY_AFFINITY=MCM - export envir=prod - - export PDY=`echo $PDATE|cut -c1-8` - export cyc=`echo $PDATE|cut -c9-10` - - export job=${RADMON_SUFFIX}_vrfyrad_${PDY}${cyc} - export SENDSMS=${SENDSMS:-NO} - export DATA_IN=${WORKverf_rad} - export DATA=${DATA:-${STMP_USER}/radmon_de_${RADMON_SUFFIX}} - cd ${STMP_USER} - rm -rf ${DATA} - mkdir ${DATA} - export jlogfile=${WORKverf_rad}/jlogfile_${RADMON_SUFFIX} - - export VERBOSE=${VERBOSE:-YES} - - - #---------------------------------------------------------------------------- - # Advance the satype file from previous day. - # If it isn't found then create one using the contents of the radstat file. - #---------------------------------------------------------------------------- - my_satype_file=${TANKverf}/radmon.${PDY}/${RADMON_SUFFIX}_radmon_satype.txt - - # logic here needs work. - # point TANKverf_rad to radmon.${next_day} for all of the t00z cycles - # maybe always try to make the directory just to be sure its there. - - if [[ $REGIONAL_RR -eq 1 ]]; then - if [[ $cyc -ge 18 ]]; then - echo "Making new day directory for 18 cycle" - next_day=`${NDATE} +06 $PDATE | cut -c1-8` - - export TANKverf_rad=${TANKverf}/radmon.${next_day} -# if [[ ! -d ${TANKverf_rad} ]]; then -# mkdir -p ${TANKverf_rad} -# fi - -# prev_day=`${NDATE} -06 $PDATE | cut -c1-8` - if [[ -s ${TANKverf}/radmon.${PDY}/${RADMON_SUFFIX}_radmon_satype.txt ]]; then - cp ${TANKverf}/radmon.${PDY}/${RADMON_SUFFIX}_radmon_satype.txt ${TANKverf}/radmon.${next_day}/. - fi - fi - else - if [[ $cyc = "00" ]]; then - echo "Making new day directory for 00 cycle" - mkdir -p ${TANKverf}/radmon.${PDY} - prev_day=`${NDATE} -06 $PDATE | cut -c1-8` - if [[ -s ${TANKverf}/radmon.${prev_day}/${RADMON_SUFFIX}_radmon_satype.txt ]]; then - cp ${TANKverf}/radmon.${prev_day}/${RADMON_SUFFIX}_radmon_satype.txt ${TANKverf}/radmon.${PDY}/. - fi - fi - fi - echo "TESTING for $my_satype_file" - if [[ -s ${my_satype_file} ]]; then - echo "${my_satype_file} is good to go" - else - echo "CREATING satype file" - radstat_satype=`tar -tvf $radstat | grep _ges | awk -F_ '{ print $2 "_" $3 }'` - echo $radstat_satype > ${my_satype_file} - echo "CREATED ${my_satype_file}" - fi - - - #------------------------------------------------------------------ - # Override the default base_file declaration if there is an - # available base file for this source. - #------------------------------------------------------------------ - if [[ -s ${TANKverf}/info/radmon_base.tar.${Z} || -s ${TANKverf}/info/radmon_base.tar ]]; then - export base_file=${TANKverf}/info/radmon_base.tar - fi - - - #------------------------------------------------------------------ - # Submit data processing jobs. - - logfile=$LOGdir/data_extract.${RADMON_SUFFIX}.${PDY}.${cyc}.log - - if [[ $MY_MACHINE = "wcoss" ]]; then - $SUB -q $JOB_QUEUE -P $PROJECT -M 40 -R affinity[core] -o ${logfile} \ - -W 0:10 -J ${jobname} -cwd ${PWD} $HOMEnam/jobs/JNAM_VERFRAD - elif [[ $MY_MACHINE = "cray" ]]; then - $SUB -q $JOB_QUEUE -P $PROJECT -M 40 -o ${logfile} -W 0:10 \ - -J ${jobname} -cwd ${PWD} $HOMEnam/jobs/JNAM_VERFRAD - elif [[ $MY_MACHINE = "hera" || $MY_MACHINE = "theia" ]]; then - $SUB -A $ACCOUNT -l procs=1,walltime=0:05:00 -N ${jobname} -V \ - -j oe -o ${logfile} ${HOMEnam}/jobs/JNAM_VERFRAD - fi - -fi - -#-------------------------------------------------------------------- -# Clean up and exit -#-------------------------------------------------------------------- -#cd $tmpdir -#cd ../ -#rm -rf $tmpdir - -exit_value=0 -if [[ ${data_available} -ne 1 ]]; then - echo No data available for ${RADMON_SUFFIX} - exit_value=6 -fi - - -echo end VrfyRad_rgn.sh -exit ${exit_value} diff --git a/util/Radiance_Monitor/data_extract/ush/getbestndas_radstat.sh b/util/Radiance_Monitor/data_extract/ush/getbestndas_radstat.sh deleted file mode 100755 index e5c303cd05..0000000000 --- a/util/Radiance_Monitor/data_extract/ush/getbestndas_radstat.sh +++ /dev/null @@ -1,54 +0,0 @@ -echo "start getbestndas_radstat.sh" -echo " RADMON_SUFFIX = ${RADMON_SUFFIX}" - -set -ax - -DATE=$1 -tmpdir=$2 -COM=$3 - -mkdir -p $tmpdir - -rm -f $tmpdir/radstat.* -rm -f $tmpdir/satbiasc.* - -rm -f datem00 -rm -f datem12 - -echo $DATE > $tmpdir/datem00 -DATEM12=`${NDATE} +12 $DATE` -echo $DATEM12 > $tmpdir/datem12 - -PDY00=`cut -c 1-8 $tmpdir/datem00` -HH00=`cut -c 9-10 $tmpdir/datem00` -PDY12=`cut -c 1-8 $tmpdir/datem12` -HH12=`cut -c 9-10 $tmpdir/datem12` - -rm -f $tmpdir/datem00 -rm -f $tmpdir/datem12 - -# -# $USE_TM is defined in the parm/RadMon_user_settings file as tm12. -# -case $HH00 in - 00) ndas1=$COM/${RADMON_SUFFIX}.$PDY12/${RADMON_SUFFIX}.t${HH12}z.radstat.${USE_TM} - bias1=$COM/${RADMON_SUFFIX}.$PDY12/${RADMON_SUFFIX}.t${HH12}z.satbiasc.${USE_TM};; - 06) ndas1=$COM/${RADMON_SUFFIX}.$PDY12/${RADMON_SUFFIX}.t${HH12}z.radstat.${USE_TM} - bias1=$COM/${RADMON_SUFFIX}.$PDY12/${RADMON_SUFFIX}.t${HH12}z.satbiasc.${USE_TM};; - 12) ndas1=$COM/${RADMON_SUFFIX}.$PDY12/${RADMON_SUFFIX}.t${HH12}z.radstat.${USE_TM} - bias1=$COM/${RADMON_SUFFIX}.$PDY12/${RADMON_SUFFIX}.t${HH12}z.satbiasc.${USE_TM};; - 18) ndas1=$COM/${RADMON_SUFFIX}.$PDY12/${RADMON_SUFFIX}.t${HH12}z.radstat.${USE_TM} - bias1=$COM/${RADMON_SUFFIX}.$PDY12/${RADMON_SUFFIX}.t${HH12}z.satbiasc.${USE_TM};; -esac - -if [ -s $ndas1 ] -then - cp $ndas1 $tmpdir/radstat.${DATE} - cp $bias1 $tmpdir/satbias.${DATE} -fi - - chmod 700 $tmpdir/* - -echo end getbestndas_radstat.sh - -exit diff --git a/util/Radiance_Monitor/data_extract/ush/query_data_map.pl b/util/Radiance_Monitor/data_extract/ush/query_data_map.pl deleted file mode 100755 index 1f5a13df2b..0000000000 --- a/util/Radiance_Monitor/data_extract/ush/query_data_map.pl +++ /dev/null @@ -1,73 +0,0 @@ -#! /usr/bin/perl - -#------------------------------------------------------------------- -# query_data_map.pl -# -# This script returns a requested field from the data_map.xml file. -# It takes three items as input: -# 1. data_map.xml file name (full or relative path) -# 2. suffix identifying the data source (an element in the -# data_map.xml file) -# 3. requested field, one of the xml child elements of the -# suffix element. -# -# If the xml element associated with the suffix does not have the -# requested field defined, then the default_global or -# default_regional element's corresponding field will be used. The -# default is default_global, but if the suffix contains an area of -# "rgn" then the regional_default element will be used. -# -# The contents of that field are echoed to stdout for the calling -# script to access. If the field is empty or missing nothing -# will be returned. The calling script should verify a value has -# been returned before use. -# -#------------------------------------------------------------------- - use strict; - use warnings; - use XML::LibXML; - - if( $#ARGV < 2 ) { - exit - } - - my $dmfile = $ARGV[0]; - my $source = $ARGV[1]; - my $field = $ARGV[2]; - my $default="global_default"; - use XML::LibXML; - - my $parser = XML::LibXML->new(); - my $doc = $parser->parse_file($dmfile); - -# Print the contents of the field if it's found in source. -# If the field is not found in source then use the default element -# and output it's value for the requested field. - - my @srcs = $doc->findnodes("/opt/$source"); - if( @srcs <= 0 ) { - @srcs = $doc->findnodes("/opt/$default"); - } - - if ( @srcs > 0 ) { - - my $src = $srcs[0]; - my($answer) = $src->findnodes("./$field"); - my($area) = $src->findnodes("./area"); - my $src_area = $area->to_literal; - - if( $answer ) { - print $answer->to_literal; - } - else { - if( $src_area eq "rgn" ) { - $default = "regional_default"; - } - my($def_src) = $src->findnodes("/opt/$default"); - my($def_answer) = $def_src->findnodes("./$field"); - if( $def_answer ) { - print $def_answer->to_literal; - } - } - } - diff --git a/util/Radiance_Monitor/data_extract/ush/radmon_copy.sh b/util/Radiance_Monitor/data_extract/ush/radmon_copy.sh new file mode 100755 index 0000000000..0c4f10882f --- /dev/null +++ b/util/Radiance_Monitor/data_extract/ush/radmon_copy.sh @@ -0,0 +1,260 @@ +#!/bin/bash + +#-------------------------------------------------------------------- +# radmon_copy.sh +# +# This script is run as a submitted job by RadMon_CP_glbl.sh and +# should not be run directly. +# +# This script searches for new radmon output and copies those +# filess to the user's $TANKDIR directory under the specified +# suffix argument. +# +# The bad_penalty, low count, and missing diag reports are +# reevaluated using local copies of the base file and satype +# files in the $TANKdir/$suffix/info directory. +# +# Note that processing occurs within TANKdir, not in stmp space. +# +# The unified error report is journaled to warning.${PDY}${CYC}. +# +#-------------------------------------------------------------------- + + +echo "" +echo "--> radmon_copy.sh" +echo "" +echo "RADMON_SUFFIX = $RADMON_SUFFIX" +echo "PDATE = $PDATE" +echo "RUN = $RUN" +echo "DATA_LOCATION = ${DATA_LOCATION}" + +exit_value=0 +monitor=radmon + +set -ax + +prev=`$NDATE -06 $PDATE` +prev_day=`echo $prev|cut -c1-8` +prev_cyc=`echo $prev|cut -c9-10` + +echo prev_day, prev_cyc = $prev_day, $prev_cyc + +dest_dir=${TANKverf}/${RUN}.${PDY}/${CYC}/radmon +echo "dest_dir = ${dest_dir}" +satype_file=${TANKverf}/info/${RUN}_radmon_satype.txt + +if [[ ! -s ${satype_file} ]]; then + satype_file=${FIXgdas}/gdas_radmon_satype.txt +fi + +if [[ ! -s ${satype_file} ]]; then + echo "WARNING: unable to locate ${satype_file}" +fi + + +#--------------------------------------------------- +# Check the number of files available to copy +# and the number of files < 30 min old. Abort the +# copy if any files are < 30 min old. This avoids +# incomplete results which can result in false +# 'drop out' plots. +# +nfile_src=`ls -l ${DATA_LOCATION}/*${PDATE}*ieee_d* | egrep -c '^-'` +echo "nfile_src = ${nfile_src}" + +nfile_thirty=`find ${DATA_LOCATION}/*${PDATE}*ieee_d* -maxdepth 0 -mmin -30` +echo "nfile_thirty = ${nfile_thirty}" + +if [[ ${nfile_src} -le 0 ]]; then + exit_value=5 +elif [[ ${nfile_thirty} != "" ]]; then + exit_value=4 +fi + +if [[ ${exit_value} -eq 0 ]]; then + if [[ ! -d ${dest_dir} ]]; then + mkdir -p ${dest_dir} + fi + cd ${dest_dir} + + type_list="angle bcoef bcor time" + + for type in ${type_list}; do + + file_list=`ls ${DATA_LOCATION}/${type}.*${PDATE}*ieee_d* ` + + for file in ${file_list}; do + bfile=`basename ${file}` + echo "testing ${file}" + + echo "target = ${dest_dir}/${bfile}" + if [[ ! -e ${dest_dir}/${bfile} ]]; then + echo "copying file" + ${NCP} ${file} ${dest_dir}/${bfile} + fi + done + done + + $NCP ${DATA_LOCATION}/*.ctl* ${dest_dir}/. + + + if [[ $DO_DATA_RPT -eq 1 ]]; then + + + #------------------------------------------------- + # run validate.sh + # + $NCP ${DE_EXEC}/radmon_validate_tm.x ${dest_dir}/. + $NCP $DE_SCRIPTS/validate.sh ${dest_dir}/. + echo "firing validate.sh" + + ./validate.sh ${PDATE} + + valid_tar=stdout.validate.tar + + if [[ $CYC -eq "00" ]]; then + tar -cvf ${valid_tar} stdout.validate.*.00 + else + tar -rvf ${valid_tar} stdout.validate.*.${CYC} + fi + + rm -f stdout.validate.*.${CYC} + + ls -la ./${valid_tar} + fi + + + if [[ ${CLEAN_TANKVERF} -eq 1 ]]; then + days_to_keep=40 + ${HOMEradmon}/ush/clean_tankdir.sh ${RAD_AREA} ${days_to_keep} + fi + +fi + +warn_msg="warning.${PDATE}" +warn_msg2="warning2.${PDATE}" + +echo "exit_value now = ${exit_value}" +if [[ $exit_value == 0 ]]; then + + #-------------------------------------------------------------------- + # Tar up the stdout.validation files + #-------------------------------------------------------------------- + if [[ $DO_DATA_RPT -eq 1 ]]; then + echo "begin DO_DATA_RPT" + + #-------------------------------------------------------------------- + # Remove extra spaces in new bad_pen and low_count files + #-------------------------------------------------------------------- + bad_pen=bad_pen.${PDATE} + gawk '{$1=$1}1' $bad_pen > tmp.bad_pen + mv -f tmp.bad_pen $bad_pen + + low_count=low_count.${PDATE} + gawk '{$1=$1}1' $low_count > tmp.low_count + mv -f tmp.low_count $low_count + + + #-------------------------------------------------------------------- + # Diag report processing + # + # New algorithm: + # + # 1. locate satype and radstat files, specify output file + # 2. run new radmon_diag_ck.sh script + # 3. build diag report from output file + # 4. move output file to target tankdir + #-------------------------------------------------------------------- + radstat=${radstat:-${RADSTAT_LOCATION}/${RUN}.t${CYC}z.radstat} + diag_out="bad_diag.${PDATE}" + + if [[ ! -e ${satype_file} ]]; then + echo "MISSING satype_file: ${satype_file}" + else + echo "satype_file is good to go: ${satype_file}" + fi + + if [[ ! -e ${radstat} ]]; then + echo "MISSING radstat_file: ${radstat}" + else + echo "radstat is good to go: ${radstat}" + fi + + + if [[ -e ${satype_file} && -e ${radstat} ]]; then + echo "satype = $satype_file" + echo "radstat = $radstat" + + ${DE_SCRIPTS}/radmon_diag_ck.sh --rad ${radstat} --sat ${satype_file} --out ${diag_out} + if [[ -e ${diag_out} ]]; then + $NCP ./${diag_out} ${TANKverf}/${RUN}.${day}/${cyc}/radmon/. + fi + fi + + + #-------------------------------------------------------------------- + # Create a new penalty error report using the new bad_pen file + #-------------------------------------------------------------------- + $NCP $DE_SCRIPTS/radmon_err_rpt.sh ${dest_dir}/. + + prev_bad_pen=${TANKverf}/${RUN}.${prev_day}/${prev_cyc}/${monitor}/bad_pen.${prev} + prev_low_count=${TANKverf}/${RUN}.${prev_day}/${prev_cyc}/${monitor}/low_count.${prev} + + bad_pen=bad_pen.${PDATE} + diag_rpt="diag.txt" + bad_pen_rpt="pen.${PDATE}.txt" + err_rpt="err.${PDATE}.txt" + low_obs_rpt="obs.${PDATE}.txt" + + ./radmon_err_rpt.sh $prev_bad_pen $bad_pen pen ${prev} ${PDATE} $diag_out $bad_pen_rpt + + ./radmon_err_rpt.sh $prev_low_count $low_count cnt ${prev} ${PDATE} $diag_out $low_obs_rpt + + + + #-------------------------- + # Build the $warn_msg file + # + if [[ -s $bad_pen_rpt || -s $low_obs_rpt || -s ${diag_out} ]]; then + + if [[ -s $bad_pen_rpt ]]; then + args="${args} --pen ${bad_pen_rpt}" + fi + + if [[ -s $low_obs_rpt ]]; then + args="${args} --obs ${low_obs_rpt}" + fi + + if [[ -s $diag_out ]]; then + args="${args} --diag ${diag_out}" + fi + + ${DE_SCRIPTS}/radmon_mk_warning.sh ${args} --out ${warn_msg} + + fi + + $COMPRESS *.ctl + + fi + + #-------------------------------------------------------------------- + # Remove processing scripts/executables and exit. + #-------------------------------------------------------------------- + rm -f radmon_validate_tm.x + rm -f validate.sh + rm -f radmon_err_rpt.sh + + nfile_dest=`ls -l ${dest_dir}/*${PDATE}*ieee_d* | egrep -c '^-'` + + if [[ exit_value -eq 0 && $nfile_src -ne $nfile_dest ]]; then + exit_value=6 + fi + +fi + +echo "" +echo "<-- radmon_copy.sh" +echo "" +exit ${exit_value} + diff --git a/util/Radiance_Monitor/data_extract/ush/radmon_diag_ck.sh b/util/Radiance_Monitor/data_extract/ush/radmon_diag_ck.sh new file mode 100755 index 0000000000..142e99f8c7 --- /dev/null +++ b/util/Radiance_Monitor/data_extract/ush/radmon_diag_ck.sh @@ -0,0 +1,175 @@ +#!/bin/bash + +#---------------------------------------------------------------- +# Check the contents of the radstat file and compare to +# the ${run}_radmon_satype.txt file. Report any missing +# or zero sized diag files. +# + + function usage { + echo "Usage: radmon_diag_ck.sh -rad radstat --sat satype --out output " + echo "" + echo " -r,--rad radstat file (required)" + echo " File name or path to radstat file." + echo "" + echo " -s,--sat satype file (required)" + echo " File name or path to satype file." + echo "" + echo " -o,--out output file name (required)" + echo " File name for missing diag file report." + } + + +echo "--> radmon_diag_ck.sh" + + +#-------------------------- +# Process input arguments +# + nargs=$# + if [[ $nargs -ne 6 ]]; then + usage + exit 1 + fi + + while [[ $# -ge 1 ]] + do + key="$1" + echo $key + + case $key in + -r|--rad) + radstat_file="$2" + shift # past argument + ;; + -s|--sat) + satype_file="$2" + shift # past argument + ;; + -o|--out) + output_file="$2" + shift # past argument + ;; + *) + #unspecified key + echo " unsupported key = $key" + ;; + esac + + shift + done + +# set -ax + + echo " radstat_file = ${radstat_file}" + echo " satype_file = ${satype_file}" + echo " output_file = ${output_file}" + + missing_diag="" + zero_len_diag="" + + #--------------------------------------------- + # get list of diag files in the radstat file + # + radstat_contents=`tar -tf ${radstat_file} | grep '_ges' | + gawk -F"diag_" '{print $2}' | + gawk -F"_ges" '{print $1}'` + + + #--------------------------------------------- + # load contents of satype_file into an array + # + satype_contents=`cat ${satype_file}` + + + #------------------------------------------------- + # compare $satype_contents and $radstat_contents + # report anything missing + # + for sat in $satype_contents; do + test=`echo $radstat_contents | grep $sat` + + if [[ ${#test} -le 0 ]]; then + missing_diag="${missing_diag} ${sat}" + fi + + done + + echo "" + echo "missing_diag = ${missing_diag}" + echo "" + + + #--------------------------------------------------------- + # Check for zero sized diag files. The diag files in + # the radstat file (which is a tar file) are gzipped. + # I find that 0 sized, gzipped file has a size of ~52 + # (I assume that's for header and block size). + # + # So for this check we'll assume anything in the radstat + # file with a size of > 1000 bytes is suspect. (That's + # overkill, 100 is probably sufficient, but I'm the + # nervous type.) So we'll extract, uncompress, and check + # the actual file size of those. Anything with an + # uncompressed size of 0 goes on the zero_len_diag list. + # + verbose_contents=`tar -tvf ${radstat_file} | grep '_ges'` + + + #------------------------------------------------------- + # note: need to reset the IFS to line breaks otherwise + # the $vc value in the for loop below will break + # on all white space, not the line break. + SAVEIFS=$IFS + IFS=$(echo -en "\n\b") + + + for vc in ${verbose_contents}; do + + gzip_len=`echo ${vc} | gawk '{print $3}'` + + if [[ ${gzip_len} -le 1000 ]]; then + test_file=`echo ${vc} | gawk '{print $6}'` + tar -xf ${radstat_file} ${test_file} + + gunzip ${test_file} + unzipped_file=`echo ${test_file%.*}` + + uz_file_size=`ls -la ${unzipped_file} | gawk '{print $5}'` + + if [[ ${uz_file_size} -le 0 ]]; then + sat=`echo ${unzipped_file} | gawk -F"diag_" '{print $2}' | + gawk -F"_ges" '{print $1}'` + + zero_len_diag="${zero_len_diag} ${sat}" + fi + + rm -f ${unzipped_file} + fi + done + + IFS=${SAVEIFS} # reset IFS to default (white space) + + echo "" + echo "zero_len_diag = ${zero_len_diag}" + echo "" + + + #----------------------------------------- + # Write results to $output_file + # + if [[ ${#zero_len_diag} -gt 0 ]]; then + for zld in ${zero_len_diag}; do + echo " Zero Length diagnostic file: $zld" >> $output_file + done + fi + + if [[ ${#missing_diag} -gt 0 ]]; then + for md in ${missing_diag}; do + echo " Missing diagnostic file : $md" >> $output_file + done + fi + + +echo "<-- radmon_diag_ck.sh" +exit diff --git a/util/Radiance_Monitor/data_extract/ush/radmon_err_rpt.sh b/util/Radiance_Monitor/data_extract/ush/radmon_err_rpt.sh index 37703ea848..1a4a5fe044 100755 --- a/util/Radiance_Monitor/data_extract/ush/radmon_err_rpt.sh +++ b/util/Radiance_Monitor/data_extract/ush/radmon_err_rpt.sh @@ -14,14 +14,11 @@ # All unique satellite instrument/channel/region combinations that appear # in both files are reported. # -# This script is a child script of radmon_verf_time.sh. The parent +# This script is run as a child script of radmon_verf_time.sh. The parent # script creates/copies the error files into a temporary working # directory before invoking this script. # # -# Script history log: -# 2012-02-02 Safford initial script -# # Usage: radmon_err_rpt.sh file1 file2 type cycle1 cycle2 diag_rpt outfile # # Input script positional parameters: @@ -30,7 +27,7 @@ # file2 obs, penalty, or channel error file # required # type type of error file -# choises are obs, pen, or chan; required +# choices are obs, pen, chan, or cnt; required # cycle1 first cycle processing date # yyyymmddcc format; required # cycle2 second cycle processing date @@ -40,55 +37,17 @@ # outfile output file name # required # -# Imported Shell Variables: -# -# HOMEradmon package's nwprod subdirectory -# defaults to pwd -# INISCRIPT preprocessing script -# defaults to none -# LOGSCRIPT log script -# defaults to none -# ERRSCRIPT error processing script -# defaults to 'eval [[ $err = 0 ]]' -# ENDSCRIPT postprocessing script -# defaults to none -# VERBOSE Verbose flag (YES or NO) -# defaults to NO -# -# Exported Shell Variables: -# err Last return code -# -# Modules and files referenced: -# scripts : $INISCRIPT -# $LOGSCRIPT -# $ERRSCRIPT -# $ENDSCRIPT -# -# programs : radmon_getchgrp.pl -# -# -# fixed data : $ctlfile -# -# input data : $file1 -# $file2 -# -# output data: $outfile -# # Remarks: # # Condition codes # 0 - no problem encountered # >0 - some problem encountered -# -# Control variable resolution priority -# 1 Command line argument. -# 2 Environment variable. -# 3 Inline default. -# -# Attributes: -# Language: POSIX shell -# Machine: IBM SP #################################################################### + +set -ax + +echo "--> radmon_err_rpt.sh" + # Command line arguments. file1=${1:-${file1:?}} file2=${2:-${file2:?}} @@ -101,12 +60,6 @@ outfile=${7:-${outfile:?}} # Directories HOMEradmon=${HOMEradmon:-$(pwd)} -# File names -INISCRIPT=${INISCRIPT:-} -LOGSCRIPT=${LOGSCRIPT:-} -ERRSCRIPT=${ERRSCRIPT:-} -ENDSCRIPT=${ENDSCRIPT:-} - # Other variables VERBOSE=${VERBOSE:-NO} err=0 @@ -117,34 +70,30 @@ if [[ "$VERBOSE" = "YES" ]]; then set -ax fi -#export list=$list0 - - have_diag_rpt=0 - if [[ -s $diag_rpt ]]; then - have_diag_rpt=1 - else - err=1 - fi +have_diag_rpt=0 +if [[ -s $diag_rpt ]]; then + have_diag_rpt=1 +else + err=1 +fi +echo "have_diag_rpt = $have_diag_rpt" #----------------------------------------------------------------------------- # read each line in the $file1 # search $file2 for the same satname, channel, and region # if same combination is in both files, add the values to the output file # - { while read myline;do - bound="" - - echo $myline - satname=`echo $myline | gawk '{print $1}'` - echo satname = $satname - channel=`echo $myline | gawk '{print $3}'` - echo channel = $channel - region=`echo $myline | gawk '{print $5}'` - echo region = $region - value1=`echo $myline | gawk '{print $7}'` - echo value1 = $value1 - bound=`echo $myline | gawk '{print $9}'` +{ while read myline; do + echo "myline = $myline" + bound="" + + echo $myline + satname=`echo $myline | gawk '{print $1}'` + channel=`echo $myline | gawk '{print $3}'` + region=`echo $myline | gawk '{print $5}'` + value1=`echo $myline | gawk '{print $7}'` + bound=`echo $myline | gawk '{print $9}'` # # Check findings against diag_report. If the satellite/instrument is on the @@ -153,107 +102,108 @@ fi # error checking for that source. Otherwise, evaluate as per normal. # - diag_match="" - diag_match_len=0 + diag_match="" + diag_match_len=0 - if [[ $have_diag_rpt == 1 ]]; then - diag_match=`gawk "/$satname/" $diag_rpt` - diag_match_len=`echo ${#diag_match}` - fi + if [[ $have_diag_rpt == 1 ]]; then + diag_match=`gawk "/$satname/" $diag_rpt` + diag_match_len=`echo ${#diag_match}` + fi - if [[ $diag_match_len == 0 ]]; then + if [[ $diag_match_len == 0 ]]; then + + if [[ $type == "chan" ]]; then + echo "looking for match for $satname and $channel" + { while read myline2; do + satname2=`echo $myline2 | gawk '{print $1}'` + channel2=`echo $myline2 | gawk '{print $3}'` + + if [[ $satname == $satname2 && $channel == $channel2 ]]; then + match="$satname channel= $channel" + echo "match from gawk = $match" + break; + else + match="" + fi + + done } < $file2 + + + else + match=`gawk "/$satname/ && /channel= $channel / && /region= $region /" $file2` + echo match = $match - if [[ $type == "chan" ]]; then - match=`gawk "/$satname/ && /channel= $channel/" $file2` - else - match=`gawk "/$satname/ && /channel= $channel / && /region= $region /" $file2` - echo match = $match - - match_len=`echo ${#match}` - if [[ $match_len > 0 ]]; then - channel2=`echo $match | gawk '{print $3}'` - echo channel2 = $channel2 - if [[ $channel2 != $channel ]]; then - match="" - fi - fi - echo match = $match - fi match_len=`echo ${#match}` - if [[ $match_len > 0 ]]; then - echo $match_len - value2=`echo $match | gawk '{print $7}'` - bound2=`echo $match | gawk '{print $9}'` + channel2=`echo $match | gawk '{print $3}'` - if [[ $type == "chan" ]]; then - tmpa="$satname channel= $channel" - tmpb="" + if [[ $channel2 != $channel ]]; then + match="" + fi + fi - elif [[ $type == "pen" ]]; then - tmpa="$satname channel= $channel region= $region" - tmpb="$cycle1 $value1 $bound" + fi + match_len=`echo ${#match}` + + if [[ $match_len > 0 ]]; then - else - tmpa="$satname channel= $channel region= $region" - tmpb="$cycle1: $type= $value1" - fi + value2=`echo $match | gawk '{print $7}'` + bound2=`echo $match | gawk '{print $9}'` - line1="$tmpa $tmpb" - echo "$line1" >> $outfile + if [[ $type == "chan" ]]; then + tmpa=" $satname channel= $channel" + tmpb="" - if [[ $type != "chan" ]]; then - tmpc=`echo $tmpa |sed 's/[a-z]/ /g' | sed 's/[0-9]/ /g' | sed 's/=/ /g' | sed 's/_/ /g' | sed 's/-/ /g'` + elif [[ $type == "pen" ]]; then + tmpa="$satname channel= $channel region= $region" + tmpb="$cycle1 $value1 $bound" - if [[ $type == "pen" ]]; then - line2=" $tmpc $cycle2 $value2 $bound2" - else - line2=" $tmpc $cycle2: $type= $value2" - fi + elif [[ $type == "cnt" ]]; then + tmpa="$satname channel= $channel region= $region" + tmpb="$cycle1 $value1 $bound" - echo "$line2" >> $outfile - fi + else + tmpa="$satname channel= $channel region= $region" + tmpb="$cycle1: $type= $value1" + fi - #---------------------------------------------------------- - # Access the control file to deterimine channel grouping - # number. Not all sources have consecutively numbered - # channels, and we need to map the channel to the correct - # grouping number in order to produce an accurate hyperlink. - # - # Update: with the new js plotting the actual channel number - # can be sent. This applies to all glb sources now; it's not - # yet implemented for regional sources. - if [[ $RAD_AREA == 'glb' ]]; then - changrp=${channel} - echo "for glb using actual channel as changrp value" - else - ctlfile="time.${satname}.ctl" - if [[ -s ${ctlfile}.Z || -s ${ctlfile}.gz ]]; then - uncompress ${ctlfile}.* - fi - changrp=`${HOMEradmon}/ush/radmon_getchgrp.pl ${ctlfile} ${channel}` - fi - echo changrp = $changrp + line1="$tmpa $tmpb" + echo "$line1" >> $outfile - line3=" http://www.emc.ncep.noaa.gov/gmb/gdas/radiance/esafford/${RADMON_SUFFIX}/index.html?sat=${satname}®ion=${region}&channel=${changrp}&stat=${type}" - if [[ $changrp -gt 0 ]]; then - echo "$line3" >> $outfile - echo "" >> $outfile - fi + if [[ $type != "chan" ]]; then + tmpc=`echo $tmpa |sed 's/[a-z]/ /g' | sed 's/[0-9]/ /g' | sed 's/=/ /g' | sed 's/_/ /g' | sed 's/-/ /g'` + + if [[ $type == "pen" || $type == "cnt" ]]; then + line2=" $tmpc $cycle2 $value2 $bound2" + else + line2=" $tmpc $cycle2: $type= $value2" + fi + + echo "$line2" >> $outfile + fi + + #----------------------------------------- + # add hyperlink to warning entry + # + line3=" http://www.emc.ncep.noaa.gov/gmb/gdas/radiance/es_rad/${RADMON_SUFFIX}/index.html?sat=${satname}®ion=${region}&channel=${channel}&stat=${type}" + if [[ $channel -gt 0 ]]; then + echo "$line3" >> $outfile + echo "" >> $outfile fi fi - done } < $file1 + fi +done } < $file1 ################################################################################ # Post processing -$ENDSCRIPT -set +x - if [[ "$VERBOSE" = "YES" ]]; then echo $(date) EXITING $0 with error code ${err} >&2 fi +echo "<-- radmon_err_rpt.sh" + +set +x exit ${err} diff --git a/util/Radiance_Monitor/data_extract/ush/radmon_mk_warning.sh b/util/Radiance_Monitor/data_extract/ush/radmon_mk_warning.sh new file mode 100755 index 0000000000..4cefc178e2 --- /dev/null +++ b/util/Radiance_Monitor/data_extract/ush/radmon_mk_warning.sh @@ -0,0 +1,163 @@ +#!/bin/bash + +#---------------------------------------------------------------- +# Check the contents of the radstat file and compare to +# the ${run}_radmon_satype.txt file. Report any missing +# or zero sized diag files. +# + + function usage { + echo "Usage: radmon_mk_warning -rad radstat --sat satype --out output " + echo "" + echo " --pen bad pen file " + echo "" + echo " --obs low count file " + echo "" + echo " --diag missing diag file" + echo "" + echo " -o,--out output file name (required)" + echo " File name for warning report." + } + + +echo "--> radmon_mk_warning.sh" + + +#-------------------------- +# Process input arguments +# + nargs=$# + if [[ $nargs -le 0 ]]; then + usage + exit 1 + fi + + while [[ $# -ge 1 ]] + do + key="$1" + echo $key + + case $key in + --pen) + bad_pen_file="$2" + shift # past argument + ;; + --obs) + low_obs_file="$2" + shift # past argument + ;; + --diag) + missing_diag_file="$2" + shift # past argument + ;; + -o|--out) + output_file="$2" + shift # past argument + ;; + *) + #unspecified key + echo " unsupported key = $key" + ;; + esac + + shift + done + +# set -ax + + echo " bad_pen_file = ${bad_pen_file}" + echo " missing_diag_file = ${missing_diag_file}" + echo " low_obs_file = ${low_obs_file}" + echo " output_file = ${output_file}" + + + #--------------------------- + # report header + # + echo "Radiance Monitor warning report" >> ${output_file} + echo "" >> ${output_file} + echo " Net: ${RADMON_SUFFIX}" >> ${output_file} + echo " RUN: ${RUN}" >> ${output_file} + echo " Cycle: ${PDATE}" >> ${output_file} + echo "" >> ${output_file} + echo "" >> ${output_file} + echo "=================================" >> ${output_file} + echo "" >> ${output_file} + echo "" >> ${output_file} + + #--------------------------- + # missing diag report + # + if [[ -s ${missing_diag_file} ]]; then + + echo "" >> ${output_file} + echo "Problem Reading Diagnostic File" >> ${output_file} + echo "" >> ${output_file} + + echo "Problems were encountered reading the diagnostic file for" >> ${output_file} + echo "the following sources:" >> ${output_file} + echo "" >> ${output_file} + cat ${missing_diag_file} >> ${output_file} + echo "" >> ${output_file} + echo "" >> ${output_file} + echo "=================================" >> ${output_file} + echo "" >> ${output_file} + echo "" >> ${output_file} + fi + + + #--------------------------- + # low count report + # + if [[ -s $low_obs_file ]]; then + + echo " " >> ${output_file} + echo "The following channels report abnormally low " >> ${output_file} + echo " observational counts in latest 2 cycles:" >> ${output_file} + echo " " >> ${output_file} + echo "Satellite/Instrument Obs Count Avg Count" >> ${output_file} + echo "==================== ========= =========" >> ${output_file} + + cat ${low_obs_file} >> ${output_file} + echo "=================================" >> ${output_file} + echo "" >> ${output_file} + echo "" >> ${output_file} + fi + + #--------------------------- + # penalty report + # + if [[ -s $bad_pen_file ]]; then + echo " " >> ${output_file} + echo " " >> ${output_file} + echo " " >> ${output_file} + + echo "Penalty values outside of the established normal range were found" >> ${output_file} + echo "for these sensor/channel/regions in the past two cycles: " >> ${output_file} + + echo " " >> ${output_file} + echo "Questionable Penalty Values " >> ${output_file} + echo "============ ======= ====== Cycle Penalty Bound " >> ${output_file} + echo " ----- ------- ----- " >> ${output_file} + echo " " >> ${output_file} + cat $bad_pen_file >> ${output_file} + echo " " >> ${output_file} + echo " " >> ${output_file} + echo " " >> ${output_file} + fi + + + #------------------- + # report footer + # + echo " " >> ${output_file} + echo " " >> ${output_file} + echo " " >> ${output_file} + echo "*********************** WARNING ***************************" >> ${output_file} + echo "This is an automated email. Replies to sender will not be" >> ${output_file} + echo "received. Please direct replies to edward.safford@noaa.gov" >> ${output_file} + echo "*********************** WARNING ***************************" >> ${output_file} + + +echo "<-- radmon_mk_warning.sh" +exit diff --git a/util/Radiance_Monitor/data_extract/ush/rr_set_tz.sh b/util/Radiance_Monitor/data_extract/ush/rr_set_tz.sh new file mode 100755 index 0000000000..5bc995ba24 --- /dev/null +++ b/util/Radiance_Monitor/data_extract/ush/rr_set_tz.sh @@ -0,0 +1,74 @@ +#!/bin/sh + +##################################################################################### +# rr_set_tz.sh +# +# Takes a cycle hour as input and sets (exports) the corresponding +# rgnHH and rgnTM values for that hour, as used by radpid refresh models (namrr). +##################################################################################### + +function usage { + echo "Usage: rr_get_tz.sh hh " + echo " hh is the 2 digit hour for a cycle in range 00 to 23" +} + +nargs=$# +if [[ $nargs -ne 1 ]]; then + usage + exit 1 +fi + +HH00=$1 +echo "rr_set_tz -- HH00 = $HH00" + +case $HH00 in + 00) export rgnHH=t00z + export rgnTM=tm00;; + 01) export rgnHH=t06z + export rgnTM=tm05;; + 02) export rgnHH=t06z + export rgnTM=tm04;; + 03) export rgnHH=t06z + export rgnTM=tm03;; + 04) export rgnHH=t06z + export rgnTM=tm02;; + 05) export rgnHH=t06z + export rgnTM=tm01;; + 06) export rgnHH=t06z + export rgnTM=tm00;; + 07) export rgnHH=t12z + export rgnTM=tm05;; + 08) export rgnHH=t12z + export rgnTM=tm04;; + 09) export rgnHH=t12z + export rgnTM=tm03;; + 10) export rgnHH=t12z + export rgnTM=tm02;; + 11) export rgnHH=t12z + export rgnTM=tm01;; + 12) export rgnHH=t12z + export rgnTM=tm00;; + 13) export rgnHH=t18z + export rgnTM=tm05;; + 14) export rgnHH=t18z + export rgnTM=tm04;; + 15) export rgnHH=t18z + export rgnTM=tm03;; + 16) export rgnHH=t18z + export rgnTM=tm02;; + 17) export rgnHH=t18z + export rgnTM=tm01;; + 18) export rgnHH=t18z # day directory changes here + export rgnTM=tm00;; + 19) export rgnHH=t00z + export rgnTM=tm05;; + 20) export rgnHH=t00z + export rgnTM=tm04;; + 21) export rgnHH=t00z + export rgnTM=tm03;; + 22) export rgnHH=t00z + export rgnTM=tm02;; + 23) export rgnHH=t00z + export rgnTM=tm01;; +esac + diff --git a/util/Radiance_Monitor/data_extract/ush/run_control_V02.sh b/util/Radiance_Monitor/data_extract/ush/run_control_V02.sh deleted file mode 100755 index 7d050ced55..0000000000 --- a/util/Radiance_Monitor/data_extract/ush/run_control_V02.sh +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/bash - -suffix=control_V02 -RUN=gdas -tank=/home/${LOGNAME}/nbns/stats/${suffix} - -export RADSTAT_LOCATION=/scratch4/NAGAPE/jcsda-datagap/Erin.Jones/ROTDIRS/noscrub/archive/control_V02/radstat - -export PROJECT=GDAS-T2O -export USE_ANL=1 -export JOB_QUEUE=dev_shared -export DO_DIAG_RPT=1 -export DO_DATA_RPT=1 -export RAD_AREA=glb -export CYCLE_INTERVAL=6 -export REGIONAL_RR=0 -export TANK_USE_RUN=1 - -export COMROOT=/com -export jlogfile=/ptmpp1/$LOGNAME/logs/fv3rt1/radmon/DE.log - -package=ProdGSI/util/Radiance_Monitor -#idev=`cat /etc/dev | cut -c1` -#iprod=`cat /etc/prod | cut -c1` - -#scripts=/gpfs/${idev}d2/emc/da/noscrub/Edward.Safford/${package}/data_extract/ush -scripts=/scratch4/NCEPDEV/da/noscrub/Edward.Safford/${package}/data_extract/ush - -#-------------------------------------------------------------------- -# Check for my monitoring use. Abort if running on prod machine. -#-------------------------------------------------------------------- - -#is_prod=`${scripts}/onprod.sh` -#if [[ $is_prod = 1 ]]; then -# exit 10 -#fi - -#-------------------------------------------------------------------- -#NDATE=/nwprod/util/exec/ndate -NDATE=/home/Edward.Safford/bin/ndate - -ldate=`${scripts}/nu_find_cycle.pl --run $RUN --cyc 1 --dir $tank` -echo "ldate = $ldate" - -pdate=`${NDATE} +6 ${ldate}` -#pdate=2018120100 -echo "processing pdate = $pdate" - -pdy=`echo $pdate | cut -c1-8` -cyc=`echo $pdate | cut -c9-10` - -export RADSTAT_LOCATION=${RADSTAT_LOCATION}/gdas.${pdy}/${cyc} -echo RADSTAT_LOCATION= $RADSTAT_LOCATION -ptmp_user=/scratch4/NCEPDEV/stmp4/Edward.Safford - -${scripts}/VrfyRad_glbl.sh ${suffix} ${pdate} 1>${ptmp_user}/logs/${suffix}/${RUN}/radmon/VrfyRad.log 2>${ptmp_user}/logs/${suffix}/${RUN}/radmon/VrfyRad.err - -exit diff --git a/util/Radiance_Monitor/data_extract/ush/run_cp_v16rt0.sh b/util/Radiance_Monitor/data_extract/ush/run_cp_v16rt0.sh deleted file mode 100755 index 9c1c9fed1e..0000000000 --- a/util/Radiance_Monitor/data_extract/ush/run_cp_v16rt0.sh +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/sh -set -ax - -export RADSTAT_LOCATION=/com2/gfs/prod -export SOURCE_DIR=/gpfs/dell2/emc/modeling/noscrub/emc.glopara/monitor/radmon/stats/v16rt0 - -export ACCOUNT=dev -export USE_ANL=1 -export DO_DIAG_RPT=1 -export DO_DATA_RPT=1 -export MAIL_TO="Edward.Safford@noaa.gov" -#export MAIL_CC="Russ.Treadon@noaa.gov" -export MAIL_CC="edward.c.safford@gmail.com" -export JOB_QUEUE=dev_shared - -me=`hostname | cut -c1` -package=ProdGSI/util/Radiance_Monitor -#package=RadMon -export TANK_USE_RUN=1 - -scripts=/gpfs/dell2/emc/modeling/noscrub/Edward.Safford/${package}/data_extract/ush - - -#-------------------------------------------------------------------- -# Check for my monitoring use. Abort if running on prod machine. -#-------------------------------------------------------------------- - -is_prod=`${scripts}/onprod.sh` -if [[ $is_prod = 1 ]]; then - exit 10 -fi - -#-------------------------------------------------------------------- -export RADMON_SUFFIX=v16rt0 -export RUN=gdas -export RAD_AREA=glb - -TANKverf=/u/Edward.Safford/nbns/stats -NDATE=/gpfs/dell1/nco/ops/nwprod/prod_util.v1.1.2/exec/ips/ndate - -ldate=`${scripts}/nu_find_cycle.pl --run $RUN --cyc 1 --dir ${TANKverf}/${RADMON_SUFFIX}` -echo "last cycle processed is $ldate" - -ldate_len=`echo ${#ldate}` -if [[ ${ldate_len} -ne 10 ]]; then - exit 1 -fi -START_DATE=`${NDATE} +06 $ldate` -#START_DATE=2019070100 - -day=`echo $START_DATE | cut -c1-8` -export DATDIR=/gpfs/dell2/emc/modeling/noscrub/emc.glopara/monitor/radmon/stats/v16rt0/gdas.${day} - -logs=/gpfs/dell2/ptmp/Edward.Safford/logs/${RADMON_SUFFIX}/${RUN}/radmon - -echo ldate, START_DATE = $ldate, $START_DATE - -${scripts}/Copy_glbl.sh \ - ${RADMON_SUFFIX} ${START_DATE} \ - 1>${logs}/CopyRad_${RADMON_SUFFIX}.log \ - 2>${logs}/CopyRad_${RADMON_SUFFIX}.err - -exit diff --git a/util/Radiance_Monitor/data_extract/ush/run_cp_wopr.sh b/util/Radiance_Monitor/data_extract/ush/run_cp_wopr.sh deleted file mode 100755 index 5c9923c287..0000000000 --- a/util/Radiance_Monitor/data_extract/ush/run_cp_wopr.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/sh -set -ax - -#export RADSTAT_LOCATION=/com2/gfs/prod -export SOURCE_DIR=/gpfs/dell1/nco/ops/com/gfs/prod -export ACCOUNT=dev -export USE_ANL=1 -export DO_DIAG_RPT=1 -export DO_DATA_RPT=1 -export MAIL_TO="Edward.Safford@noaa.gov" -#export MAIL_CC="Russ.Treadon@noaa.gov" -export MAIL_CC="edward.c.safford@gmail.com" -export JOB_QUEUE=dev_shared - -me=`hostname | cut -c1` -#package=ProdGSI/util/Radiance_Monitor -package=RadMon - -export TANK_USE_RUN=1 -export USE_HR=1 - -scripts=/gpfs/dell2/emc/modeling/noscrub/Edward.Safford/${package}/data_extract/ush - -#-------------------------------------------------------------------- -export RADMON_SUFFIX=GFS -export RUN=gdas -export RAD_AREA=glb - -TANKverf=/u/Edward.Safford/nbns/stats -NDATE=/gpfs/dell1/nco/ops/nwprod/prod_util.v1.1.2/exec/ips/ndate - -idate=`${scripts}/nu_find_cycle.pl --run $RUN --cyc 1 --dir ${TANKverf}/${RADMON_SUFFIX}` - -idate_len=`echo ${#idate}` -if [[ ${idate_len} -ne 10 ]]; then - exit 1 -fi -START_DATE=`${NDATE} +06 $idate` -#START_DATE=2019062900 - -echo idate, START_DATE = $idate, $START_DATE - -logdir=/gpfs/dell2/ptmp/Edward.Safford/logs/${RADMON_SUFFIX}/${RUN}/radmon - -${scripts}/Copy_glbl.sh \ - ${RADMON_SUFFIX} ${START_DATE} \ - 1>${logdir}/CopyRad_${RADMON_SUFFIX}.log \ - 2>${logdir}/CopyRad_${RADMON_SUFFIX}.err - -set +ax -exit diff --git a/util/Radiance_Monitor/data_extract/ush/run_nam.sh b/util/Radiance_Monitor/data_extract/ush/run_nam.sh deleted file mode 100755 index c9f9d9f612..0000000000 --- a/util/Radiance_Monitor/data_extract/ush/run_nam.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/sh - -export RADSTAT_LOCATION=/com2/nam/prod -export PROJECT=NDAS-T2O -export JOB_QUEUE=dev_shared - -export USE_ANL=1 -export DO_DIAG_RPT=1 -export DO_DATA_RPT=1 - -export RAD_AREA=rgn -export REGIONAL_RR=1 -export CYCLE_INTERVAL=1 -export TANK_USE_RUN=0 - -package=ProdGSI/util/Radiance_Monitor -idev=`cat /etc/dev | cut -c1` -iprod=`cat /etc/prod | cut -c1` - -export COMROOT=/com -export jlogfile=/ptmpp1/$LOGNAME/logs/nam/radmon/run_nrx.log - -scripts=/gpfs/${idev}d2/emc/da/noscrub/Edward.Safford/${package}/data_extract/ush - - -#-------------------------------------------------------------------- -# Check for my monitoring use. Abort if running on prod machine. -#-------------------------------------------------------------------- - -is_prod=`${scripts}/onprod.sh` -if [[ $is_prod = 1 ]]; then - exit 10 -fi - -#-------------------------------------------------------------------- - - -${scripts}/VrfyRad_rgnl.sh nam 1>/ptmpp1/Edward.Safford/logs/nam/radmon/VrfyRad_nam.log 2>/ptmpp1/Edward.Safford/logs/nam/radmon/VrfyRad_nam.err - -exit diff --git a/util/Radiance_Monitor/data_extract/ush/run_test.sh b/util/Radiance_Monitor/data_extract/ush/run_test.sh deleted file mode 100755 index 078d7678d8..0000000000 --- a/util/Radiance_Monitor/data_extract/ush/run_test.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/sh - -suffix=testrad -RUN=gdas -tank=/home/${LOGNAME}/nbns/stats/${suffix} - -export RADSTAT_LOCATION=/scratch4/NCEPDEV/da/noscrub/Edward.Safford/test_data -export PROJECT=GDAS-T2O -export USE_ANL=1 -export JOB_QUEUE=dev_shared -export DO_DIAG_RPT=1 -export DO_DATA_RPT=1 -export RAD_AREA=glb -export CYCLE_INTERVAL=6 -export REGIONAL_RR=0 -export TANK_USE_RUN=1 - -export COMROOT=/com -export jlogfile=/scratch4/NCEPDEV/stmp4/Edward.Safford/logs/${suffix}/radmon/DE.log - -package=ProdGSI/util/Radiance_Monitor -#idev=`cat /etc/dev | cut -c1` -#iprod=`cat /etc/prod | cut -c1` - -scripts=/scratch4/NCEPDEV/da/noscrub/Edward.Safford/${package}/data_extract/ush - -#-------------------------------------------------------------------- -# Check for my monitoring use. Abort if running on prod machine. -#-------------------------------------------------------------------- - -#is_prod=`${scripts}/onprod.sh` -#if [[ $is_prod = 1 ]]; then -# exit 10 -#fi - -#-------------------------------------------------------------------- -#NDATE=/nwprod/util/exec/ndate -#NDATE=/scratch4/NCEPDEV/global/save/glopara/nwpara/util/exec/ndate - -#ldate=`${scripts}/find_cycle.pl --run $RUN --cyc 1 --dir $tank` -#pdate=`${NDATE} +6 ${ldate}` -pdate=2018091700 - -pdy=`echo $pdate | cut -c1-8` -cyc=`echo $pdate | cut -c9-10` - -export RADSTAT_LOCATION=${RADSTAT_LOCATION}/gdas.${pdy}/${cyc} -echo RADSTAT_LOCATION= $RADSTAT_LOCATION -logs=/scratch4/NCEPDEV/stmp4/Edward.Safford/logs/${suffix} - -${scripts}/VrfyRad_glbl.sh ${suffix} ${pdate} 1>${logs}/${RUN}/radmon/VrfyRad.log 2>${logs}/${RUN}/radmon/VrfyRad.err - -exit diff --git a/util/Radiance_Monitor/data_extract/ush/update_data_map.pl b/util/Radiance_Monitor/data_extract/ush/update_data_map.pl deleted file mode 100755 index 5a28cd309d..0000000000 --- a/util/Radiance_Monitor/data_extract/ush/update_data_map.pl +++ /dev/null @@ -1,59 +0,0 @@ -#! /usr/bin/perl - -#------------------------------------------------------------------- -# update_data_map.pl -# -# This script updates a requested field in the data_map.xml file. If -# the requested field does not exist in but the parent node (suffix) -# is found then the requested field and value are added to the -# data_map.xml file. -# -# Calling sequence: -# >> update_data_map.pl ./path/to/data_map.xml suffix req_field new_val -# -# 1. data_map.xml file (full or relative path) -# 2. suffix identifying the data source (an element in the -# data_map.xml file) -# 3. requested field, one of the xml child elements of the -# suffix element. -# 4. new value for the requested field -# -# Return codes (sent to stdout): -# 0 update was successful -# 1 the suffix and/or field was not found. -# -# Note: Calling scripts generally assign a variable value to -# output from this script. If diagnostic print messages -# are left uncommented then results will become undefined. -#------------------------------------------------------------------- - use strict; - use warnings; - use XML::LibXML; - - my $dmfile = $ARGV[0]; - my $source = $ARGV[1]; - my $field = $ARGV[2]; - my $value = $ARGV[3]; - my $rc = "1"; - - my $parser = XML::LibXML->new(); - my $doc = $parser->parse_file($dmfile); - - my $query = "//$source/$field/text()"; - - my($node) = $doc->findnodes($query); - - if( $node ) { - $node->setData("$value" ); - $doc->toFile( $dmfile ); - $rc = "0"; - } - else { - my $new_query = "//$source"; - my ($src_node) = $doc->findnodes($new_query); - $src_node->appendTextChild( "$field", "$value" ); - $doc->toFile( $dmfile ); - $rc = "0"; - } - - print "$rc"; diff --git a/util/Radiance_Monitor/get_hostname.pl b/util/Radiance_Monitor/get_hostname.pl index ac3d971fcb..bd30491bc8 100755 --- a/util/Radiance_Monitor/get_hostname.pl +++ b/util/Radiance_Monitor/get_hostname.pl @@ -17,13 +17,12 @@ my $my_os = "export MY_OS=$arch"; # - # Determine if installation is on WCOSS, Theia, or Zeus. + # Determine if installation is on wcoss_c, wcoss_d, or hera # if( $arch ne "linux" && $arch ne "aix" ) { die( "only linux and aix are supported, $arch is not\n" ); } -# print "\n"; -# print "arch = $arch\n"; + my $machine = ""; @@ -32,7 +31,6 @@ # while ccs and (perhaps) wcoss return [hostname].ncep.noaa.gov. Keep only the # actual hostname and see if it matches the node names for zeus, tide, or gyre. # - my $host_zeus = 0; my $host = ""; $host = ` hostname `; chomp( $host ); @@ -46,14 +44,11 @@ $machine = "hera"; } elsif( $host =~ /login/ ) { - $machine = "cray"; + $machine = "wcoss_c"; } elsif( $host =~ /m/ || $host =~ /v/ ){ $machine = "wcoss_d"; # dell machines are mXXaY/vXXaY } - elsif( $host =~ /t/ || $host =~ /g/ ){ # wcoss nodes are tXXaY and gXXaY - $machine = "wcoss"; - } print "$machine"; diff --git a/util/Radiance_Monitor/image_gen/html/arrowleft.png b/util/Radiance_Monitor/image_gen/html/arrowleft.png new file mode 100644 index 0000000000..ef25991156 Binary files /dev/null and b/util/Radiance_Monitor/image_gen/html/arrowleft.png differ diff --git a/util/Radiance_Monitor/image_gen/html/arrowright.png b/util/Radiance_Monitor/image_gen/html/arrowright.png new file mode 100644 index 0000000000..9fd6b20c4b Binary files /dev/null and b/util/Radiance_Monitor/image_gen/html/arrowright.png differ diff --git a/util/Radiance_Monitor/image_gen/html/install_glb.sh b/util/Radiance_Monitor/image_gen/html/install_glb.sh index d2ff2c1b87..eb55e7c201 100755 --- a/util/Radiance_Monitor/image_gen/html/install_glb.sh +++ b/util/Radiance_Monitor/image_gen/html/install_glb.sh @@ -99,12 +99,14 @@ data_found=0 while [[ data_found -eq 0 && $PDATE -ge $limit ]]; do PDY=`echo $PDATE|cut -c1-8` - if [[ ${TANK_USE_RUN} -eq 1 ]]; then - test_dir=${TANKverf}/${RUN}.${PDY}/${MONITOR} - else + test_dir=${TANKverf}/${RUN}.${PDY}/${MONITOR} + if [[ ! -d ${test_dir} ]]; then + test_dir=${TANKverf}/${RUN}.${PDY} + fi + if [[ ! -d ${test_dir} ]]; then test_dir=${TANKverf}/${MONITOR}.${PDY} fi - + echo "test_dir = ${test_dir}" if [[ -d ${test_dir} ]]; then diff --git a/util/Radiance_Monitor/image_gen/parm/glbl_comp_conf b/util/Radiance_Monitor/image_gen/parm/glbl_comp_conf deleted file mode 100755 index d3ff40811e..0000000000 --- a/util/Radiance_Monitor/image_gen/parm/glbl_comp_conf +++ /dev/null @@ -1,20 +0,0 @@ -#---------------------------------------------------------------- -# -# glbl_comp_conf -# -# Contains configuration information for producing glbl -# comparision images from 2 different global data sources. -# -# Users may need to edit the SATYPE list and web server -# resources. -#---------------------------------------------------------------- - -# -# Reassign references for this RADMON_SUFFIX -# -#export LOGDIR=${LOGSverf_rad}/rad${RADMON_SUFFIX} -#export PLOT_WORK_DIR=${STMP_USER}/plot_comp_${RADMON_SUFFIX} - -#export TANKDIR=${MY_TANKDIR}/stats -#export IMGNDIR=${MY_TANKDIR}/imgn - diff --git a/util/Radiance_Monitor/image_gen/parm/glbl_conf b/util/Radiance_Monitor/image_gen/parm/glbl_conf index 6f5be7f675..44cf124b96 100755 --- a/util/Radiance_Monitor/image_gen/parm/glbl_conf +++ b/util/Radiance_Monitor/image_gen/parm/glbl_conf @@ -27,14 +27,9 @@ export TOP_ARCHIVE_DIR=${ARCHIVE_DIR} export ARCHIVE_DIR=${ARCHIVE_DIR}/${RADMON_SUFFIX} # -# set IMGNDIR for old or new image file location based -# on TANK_USE_RUN value +# top of image directory tree for this source # -IMGNDIR=${MY_TANKDIR}/imgn/${RADMON_SUFFIX} -if [[ $TANK_USE_RUN -eq 1 ]]; then - IMGNDIR=${IMGNDIR}/${RUN}/radmon -fi -export IMGNDIR=${IMGNDIR}/pngs +export IMGNDIR=${IMGNDIR:-${MY_TANKDIR}/imgn/${RADMON_SUFFIX}/${RUN}/radmon/pngs} # diff --git a/util/Radiance_Monitor/image_gen/parm/rgnl_comp_conf b/util/Radiance_Monitor/image_gen/parm/rgnl_comp_conf deleted file mode 100755 index 4674350948..0000000000 --- a/util/Radiance_Monitor/image_gen/parm/rgnl_comp_conf +++ /dev/null @@ -1,19 +0,0 @@ -#---------------------------------------------------------------- -# -# rgnl_comp_conf -# -# Contains configuration information for producing comparison -# images. -# -#---------------------------------------------------------------- - -# -# Reassign references for this RADMON_SUFFIX -# -export LOGDIR=${LOGSverf_rad}/rad${RADMON_SUFFIX} -export PLOT_WORK_DIR=${STMP_USER}/plot_comp_${RADMON_SUFFIX} - -export TANKDIR=${MY_TANKDIR}/stats/regional -export IMGNDIR=${MY_TANKDIR}/imgn/regional - - diff --git a/util/Radiance_Monitor/image_gen/parm/rgnl_conf b/util/Radiance_Monitor/image_gen/parm/rgnl_conf index 469d733d85..ff7f022684 100755 --- a/util/Radiance_Monitor/image_gen/parm/rgnl_conf +++ b/util/Radiance_Monitor/image_gen/parm/rgnl_conf @@ -18,7 +18,7 @@ export WEBDIR=${WEBDIR}/regional/${RADMON_SUFFIX}/pngs # internal package reference # export TOP_IMGNDIR=${MY_TANKDIR}/imgn/regional/${RADMON_SUFFIX} -export IMGNDIR=${MY_TANKDIR}/imgn/regional/${RADMON_SUFFIX}/pngs +export IMGNDIR=${MY_TANKDIR}/imgn/regional/${RADMON_SUFFIX}/radmon/pngs export TANKDIR=${MY_TANKDIR}/stats/regional/${RADMON_SUFFIX} export TOP_ARCHIVE_DIR=${ARCHIVE_DIR} export ARCHIVE_DIR=${ARCHIVE_DIR}/regional/${RADMON_SUFFIX} diff --git a/util/Radiance_Monitor/image_gen/src/radmon_ig_angle.fd/makefile.angle b/util/Radiance_Monitor/image_gen/src/radmon_ig_angle.fd/makefile.angle deleted file mode 100755 index 14daa53b03..0000000000 --- a/util/Radiance_Monitor/image_gen/src/radmon_ig_angle.fd/makefile.angle +++ /dev/null @@ -1,46 +0,0 @@ -# ***************************************************************** -# makefile.angle -# -# Make the angle.x executable. The executable will extract angle -# radiance data from an angle ieee_d file and write it to text -# files for use in the interactive angle plots. -# -# ***************************************************************** - -BINDIR = ../exec - -LIBS = $(W3NCO_LIB4) - -OBJS = angle.o avgsdv.o - -# -# ***************************************************************** -# - -CMD = angle.x - -all: $(CMD) - -clean: - rm -f *.o - rm -f *.mod - rm -f angle.x - -check_prereqs: - /nwprod/spa_util/check_libs.bash $(LIBS) - -install: - cp -f $(CMD) $(BINDIR)/ - -debug: FFLAGS = $(D_FFLAGS) -debug: $(CMD) - -$(CMD): $(OBJS) - $(CF) $(FFLAGS) $(LDFLAGS) -o $(@) $(OBJS) $(LIBS) - -angle.o : angle.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -avgsdv.o : avgsdv.f90 - $(CF) $(FFLAGS) -c $(*).f90 - diff --git a/util/Radiance_Monitor/image_gen/src/radmon_ig_bcoef.fd/makefile.bcoef b/util/Radiance_Monitor/image_gen/src/radmon_ig_bcoef.fd/makefile.bcoef deleted file mode 100755 index 5270255d7b..0000000000 --- a/util/Radiance_Monitor/image_gen/src/radmon_ig_bcoef.fd/makefile.bcoef +++ /dev/null @@ -1,43 +0,0 @@ -# ***************************************************************** -# makefile -# -# Make the radmon bcoef.x executable. -# -# ***************************************************************** - -BINDIR = ../exec - -LIBS = $(W3NCO_LIB4) - -OBJS = bcoef.o avgsdv.o - -# -# ***************************************************************** -# - -CMD = bcoef.x - -all: $(CMD) - -clean: - rm -f *.o - rm -f *.mod - rm -f time.x - -check_prereqs: - /nwprod/spa_util/check_libs.bash $(LIBS) - -install: - cp -f $(CMD) $(BINDIR)/ - -debug: FFLAGS = $(D_FFLAGS) -debug: $(CMD) - -$(CMD): $(OBJS) - $(CF) $(FFLAGS) $(LDFLAGS) -o $(@) $(OBJS) $(LIBS) - -bcoef.o : bcoef.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -avgsdv.o : avgsdv.f90 - $(CF) $(FFLAGS) -c $(*).f90 diff --git a/util/Radiance_Monitor/image_gen/src/radmon_ig_horiz.fd/CMakeLists.txt b/util/Radiance_Monitor/image_gen/src/radmon_ig_horiz.fd/CMakeLists.txt index 2efb30847b..d74885b276 100644 --- a/util/Radiance_Monitor/image_gen/src/radmon_ig_horiz.fd/CMakeLists.txt +++ b/util/Radiance_Monitor/image_gen/src/radmon_ig_horiz.fd/CMakeLists.txt @@ -7,7 +7,7 @@ cmake_minimum_required(VERSION 2.6) set_target_properties( radmon_ig_horiz.x PROPERTIES COMPILE_FLAGS ${RADMON_HORIZ_Fortran_FLAGS} ) set_target_properties( radmon_ig_horiz.x PROPERTIES Fortran_MODULE_DIRECTORY ${Util_MODULE_DIR} ) include_directories( ${CORE_INCS} ${NCDIAG_INCS} ) - target_link_libraries( radmon_ig_horiz.x ${W3NCO_4_LIBRARY} ${NCDIAG_LIBRARIES} ${NETCDF_LIBRARIES_F90} ${NETCDF_LIBRARIES} ${HDF5_Fortran_HL_LIBRARIES} ${HDF5_LIBRARIES} ${MPI_Fortran_LIBRARIES}) + target_link_libraries( radmon_ig_horiz.x ${W3NCO_4_LIBRARY} ${NCDIAG_LIBRARIES} ${NETCDF_Fortran_LIBRARIES} ${NETCDF_C_LIBRARIES} ${MPI_Fortran_LIBRARIES}) if(BUILD_W3NCO) add_dependencies( radmon_ig_horiz.x ${W3NCO_4_LIBRARY} ) endif() diff --git a/util/Radiance_Monitor/image_gen/src/radmon_ig_horiz.fd/makefile.horiz b/util/Radiance_Monitor/image_gen/src/radmon_ig_horiz.fd/makefile.horiz deleted file mode 100755 index 466babe999..0000000000 --- a/util/Radiance_Monitor/image_gen/src/radmon_ig_horiz.fd/makefile.horiz +++ /dev/null @@ -1,53 +0,0 @@ -# ***************************************************************** -# makefile.horiz -# -# Make the radmon horiz.x executable -# ***************************************************************** - -BINDIR = ../exec - -LIBS = $(W3NCO_LIB4) - -OBJS = kinds.o read_diag.o horiz.o create_ctl_horiz.o \ - update_ctl_horiz.o - -# -# ***************************************************************** -# - -CMD = horiz.x - -all: $(CMD) - -clean: - rm -f *.o - rm -f *.mod - rm -f *.x - -check_prereqs: - /nwprod/spa_util/check_libs.bash $(LIBS) - -install: - cp -f $(CMD) $(BINDIR)/ - -debug: FFLAGS = $(D_FFLAGS) -debug: $(CMD) - -$(CMD): $(OBJS) - $(CF) $(FFLAGS) $(LDFLAGS) -o $(@) $(OBJS) $(LIBS) - cp ${CMD} ../exec/. - -read_diag.o : read_diag.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -horiz.o : horiz.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -create_ctl_horiz.o : create_ctl_horiz.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -update_ctl_horiz.o : update_ctl_horiz.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -kinds.o : kinds.F90 - $(CF) $(FFLAGS) -c $(*).F90 diff --git a/util/Radiance_Monitor/image_gen/src/radmon_ig_summary.fd/makefile.summary b/util/Radiance_Monitor/image_gen/src/radmon_ig_summary.fd/makefile.summary deleted file mode 100755 index f5d76ab372..0000000000 --- a/util/Radiance_Monitor/image_gen/src/radmon_ig_summary.fd/makefile.summary +++ /dev/null @@ -1,44 +0,0 @@ -# ***************************************************************** -# makefile -# -# Make the summary.x executable. -# -# ***************************************************************** - -BINDIR = ../exec - -LIBS = $(W3NCO_LIB4) - -OBJS = summary.o avgsdv.o - -# -# ***************************************************************** -# - -CMD = summary.x - -all: $(CMD) - -clean: - rm -f *.o - rm -f *.mod - rm -f summary.x - -check_prereqs: - /nwprod/spa_util/check_libs.bash $(LIBS) - -install: - cp -f $(CMD) $(BINDIR)/ - -debug: FFLAGS = $(D_FFLAGS) -debug: $(CMD) - -$(CMD): $(OBJS) - $(CF) $(FFLAGS) $(LDFLAGS) -o $(@) $(OBJS) $(LIBS) - - -summary.o : summary.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -avgsdv.o : avgsdv.f90 - $(CF) $(FFLAGS) -c $(*).f90 diff --git a/util/Radiance_Monitor/image_gen/src/radmon_ig_time.fd/makefile.time b/util/Radiance_Monitor/image_gen/src/radmon_ig_time.fd/makefile.time deleted file mode 100755 index ba4c7d4226..0000000000 --- a/util/Radiance_Monitor/image_gen/src/radmon_ig_time.fd/makefile.time +++ /dev/null @@ -1,43 +0,0 @@ -# ***************************************************************** -# makefile -# -# Make the radmon time.x executable. -# -# ***************************************************************** - -BINDIR = ../exec - -LIBS = $(W3NCO_LIB4) - -OBJS = time.o avgsdv.o - -# -# ***************************************************************** -# - -CMD = time.x - -all: $(CMD) - -clean: - rm -f *.o - rm -f *.mod - rm -f time.x - -check_prereqs: - /nwprod/spa_util/check_libs.bash $(LIBS) - -install: - cp -f $(CMD) $(BINDIR)/ - -debug: FFLAGS = $(D_FFLAGS) -debug: $(CMD) - -$(CMD): $(OBJS) - $(CF) $(FFLAGS) $(LDFLAGS) -o $(@) $(OBJS) $(LIBS) - -time.o : time.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -avgsdv.o : avgsdv.f90 - $(CF) $(FFLAGS) -c $(*).f90 diff --git a/util/Radiance_Monitor/image_gen/ush/CkPlt_glbl.sh b/util/Radiance_Monitor/image_gen/ush/CkPlt_glbl.sh deleted file mode 100755 index 30950fbafd..0000000000 --- a/util/Radiance_Monitor/image_gen/ush/CkPlt_glbl.sh +++ /dev/null @@ -1,368 +0,0 @@ -#!/bin/sh -#-------------------------------------------------------------------- -# -# CkPlt_glbl.sh -# -# Check for new global data and if found call scripts to plot image -# files and transfer new images to web server. -# -# Note: this does not generate any data files. Those must be -# already created for this script to function correctly. -# -#-------------------------------------------------------------------- - - - -function usage { - echo "Usage: CkPlt_glbl.sh suffix [plot_date]" - echo " File name for CkPlt_glbl.sh may be full or relative path" - echo " Suffix is data source identifier that matches data in " - echo " the $TANKDIR/stats directory." - echo " Plot_date, format YYYYMMDDHH is optional. If included the plot" - echo " will be for the specified cycle, provided data files are available." - echo " If not included, the plot cycle will be for the latest cycle found" - echo " for this suffix." -} - -set -ax -echo start CkPlt_glbl.sh -echo -echo $PATH -echo - -nargs=$# -if [[ $nargs -lt 1 || $nargs -gt 2 ]]; then - usage - exit 1 -fi - -this_file=`basename $0` -this_dir=`dirname $0` - -RADMON_SUFFIX=$1 - -echo RADMON_SUFFIX = ${RADMON_SUFFIX} -RUN=${RUN:-gdas} - -#-------------------------------------------------------------------- -# Set plot_time if it is included as an argument. -#-------------------------------------------------------------------- -plot_time= -if [[ $nargs -eq 2 ]]; then - plot_time=$2 -fi - -#-------------------------------------------------------------------- -# Run config files to load environment variables, -# set default plot conditions -#-------------------------------------------------------------------- -RAD_AREA=glb - -top_parm=${this_dir}/../../parm - -export RADMON_VERSION=${RADMON_VERSION:-${top_parm}/radmon.ver} -if [[ -s ${RADMON_VERSION} ]]; then - . ${RADMON_VERSION} -else - echo "Unable to source ${RADMON_VERSION} file" - exit 2 -fi - -export RADMON_CONFIG=${RADMON_CONFIG:-${top_parm}/RadMon_config} - -if [[ -s ${RADMON_CONFIG} ]]; then - . ${RADMON_CONFIG} -else - echo "Unable to source ${RADMON_CONFIG}" - exit -fi - -if [[ -s ${RADMON_USER_SETTINGS} ]]; then - . ${RADMON_USER_SETTINGS} -else - echo "Unable to source ${RADMON_USER_SETTINGS}" - exit -fi - -. ${IG_PARM}/plot_rad_conf -. ${IG_PARM}/glbl_conf - - -#-------------------------------------------------------------------- -# Check for my monitoring use. Abort if running on prod machine. -#-------------------------------------------------------------------- - -if [[ RUN_ONLY_ON_DEV -eq 1 ]]; then - is_prod=`${IG_SCRIPTS}/onprod.sh` - if [[ $is_prod = 1 ]]; then - exit 10 - fi -fi - -#-------------------------------------------------------------------- - - -export PLOT=1 - - -#-------------------------------------------------------------------- -# Create tmpdir and LOGdir -#-------------------------------------------------------------------- - -tmpdir=${STMP_USER}/plot_rad${RADMON_SUFFIX} -rm -rf $tmpdir -mkdir -p $tmpdir -cd $tmpdir - -mkdir -p $LOGdir - - -#-------------------------------------------------------------------- -# Get date of cycle to process. Exit if available data has already -# been plotted ($PDATE -gt $PRODATE). -# -# If plot_time has been specified via command line argument, then -# set PDATE to it. Otherwise, determie the last cycle processed -# (into *.ieee_d files) and use that as the PDATE. -#-------------------------------------------------------------------- -if [[ $TANK_USE_RUN = 1 ]]; then - export PRODATE=`${IG_SCRIPTS}/nu_find_cycle.pl --cyc 1 --dir ${TANKDIR} --run ${RUN}` -else - export PRODATE=`${IG_SCRIPTS}/find_cycle.pl --cyc 1 --dir ${TANKDIR}` -fi - -if [[ $plot_time != "" ]]; then - export PDATE=$plot_time -else - export PDATE=$PRODATE -fi -echo $PRODATE $PDATE - -export NUM_CYCLES=${NUM_CYCLES:-121} -hrs=`expr $NUM_CYCLES \\* -6` -echo "hrs = $hrs" - -export START_DATE=`$NDATE ${hrs} $PDATE` -echo "start_date, prodate, pdate = $START_DATE $PRODATE $PDATE" - -sdate=`echo $PDATE|cut -c1-8` -export CYC=`echo $PDATE|cut -c9-10` -export PDY=`echo $PDATE|cut -c1-8` - - -#-------------------------------------------------------------------- -# Determine which directory structure is in use in $TANKDIR -# - -if [[ $TANK_USE_RUN -eq 1 ]]; then - ieee_src=${TANKverf}/${RUN}.${PDY}/${CYC}/${MONITOR} - if [[ ! -d ${ieee_src} ]]; then - ieee_src=${TANKverf}/${RUN}.${PDY}/${MONITOR} - fi -else - ieee_src=${TANKverf}/${MONITOR}.${PDY} - if [[ ! -d ${ieee_src} ]]; then - ieee_src=${TANKverf}/${RUN}.${PDY} - fi -fi - -if [[ ! -d ${ieee_src} ]]; then - echo "unable to set ieee_src, aborting plot" - exit -fi - - -#-------------------------------------------------------------------- -# $PRODATE may be set to "auto", meaning automatically advance -# if data is available (data is being processed by ops or by -# a parallel. We need to make sure the data for the next cycle -# is complete. Exit if proceed is set to "NO". -#-------------------------------------------------------------------- -proceed="NO" -if [[ "$PRODATE" == "auto" ]]; then - proceed=`${IG_SCRIPTS}/confirm_data.sh ${RADMON_SUFFIX} ${PDATE}` - -elif [[ $PDATE -le $PRODATE ]]; then - nfile_src=`ls -l ${ieee_src}/*${PDATE}*ieee_d* | egrep -c '^-'` - - if [[ $nfile_src -gt 0 ]]; then - proceed="YES" - fi -fi - -echo proceed = $proceed - -if [[ "$proceed" != "YES" ]]; then - cd $tmpdir - cd ../ - rm -rf $tmpdir - exit -fi - - - -echo plot = $PLOT, plot_horiz = $PLOT_HORIZ - -prev_cycle=`$NDATE -6 $PDATE` - -pid=${pid:-$$} -export PLOT_WORK_DIR=${PLOT_WORK_DIR}.${pid} - -if [[ -d $PLOT_WORK_DIR ]]; then - rm -rf $PLOT_WORK_DIR -fi -mkdir $PLOT_WORK_DIR -cd $PLOT_WORK_DIR - - -#------------------------------------------------------------- -# If USE_STATIC_SATYPE == 0 then assemble the SATYPE list from -# available data files in $TANKDIR/angle -# If USE_STATIC_SATYPE == 1 then load SATYPE from the SATYPE.txt -# file, or from fix/gdas_radmon_satype.txt. -#------------------------------------------------------------- -if [[ $USE_STATIC_SATYPE -eq 0 ]]; then - - test_list=`ls ${ieee_src}/angle.*${PDATE}.ieee_d*` - - for test in ${test_list}; do - this_file=`basename $test` - test_anl=`echo $this_file | grep "_anl"` - if [[ $test_anl = "" ]]; then - tmp=`echo "$this_file" | cut -d. -f2` - echo $tmp - SATYPE_LIST="$SATYPE_LIST $tmp" - fi - done - - SATYPE=$SATYPE_LIST - echo $SATYPE - -else - TANKDIR_INFO=${TANKDIR}/info - export STATIC_SATYPE_FILE=${STATIC_SATYPE_FILE:-${TANKDIR_INFO}/SATYPE.txt} - if [[ ! -e $STATIC_SATYPE_FILE ]]; then - export STATIC_SATYPE_FILE=${HOMEgdas}/fix/gdas_radmon_satype.txt - fi - - #------------------------------------------------------------- - # Load the SATYPE list from the STATIC_SATYPE_FILE or exit - # if unable to locate it. - #------------------------------------------------------------- - if [[ -s $STATIC_SATYPE_FILE ]]; then - SATYPE="" - SATYPE=`cat ${STATIC_SATYPE_FILE}` - echo $SATYPE - else - echo Unable to locate $STATIC_SATYPE_FILE, must exit. - cd $tmpdir - cd ../ - rm -rf $tmpdir - exit - fi -fi - - -#------------------------------------------------------------------ -# Start image plotting jobs. -#------------------------------------------------------------------ - -${IG_SCRIPTS}/mk_angle_plots.sh - -${IG_SCRIPTS}/mk_bcoef_plots.sh - -if [[ ${PLOT_STATIC_IMGS} -eq 1 ]]; then - ${IG_SCRIPTS}/mk_bcor_plots.sh -fi - -if [[ ${PLOT_HORIZ} -eq 1 ]] ; then - export datdir=${RADSTAT_LOCATION} - - jobname="plot_horiz_${RADMON_SUFFIX}" - logfile="${LOGdir}/horiz.log" - - if [[ $MY_MACHINE = "wcoss" || $MY_MACHINE = "wcoss_d" ]]; then - $SUB -P $PROJECT -q $JOB_QUEUE -o ${logfile} -M 80 -W 0:45 -cwd ${PWD} \ - -R affinity[core] -J ${jobname} ${IG_SCRIPTS}/mk_horiz_plots.sh - elif [[ $MY_MACHINE = "cray" ]]; then - $SUB -P $PROJECT -q $JOB_QUEUE -o ${logfile} -M 80 -W 0:45 -cwd ${PWD} \ - -J ${jobname} ${IG_SCRIPTS}/mk_horiz_plots.sh - elif [[ $MY_MACHINE = "theia" ]]; then - $SUB --account $ACCOUNT -o ${logfile} -D . -J ${jobname} --time 50 \ - ${IG_SCRIPTS}/mk_horiz_plots.sh - fi -fi - -${IG_SCRIPTS}/mk_time_plots.sh - - - -#------------------------------------------------------------------ -# Run the make_archive.sh script if $DO_ARCHIVE is switched on. -#------------------------------------------------------------------ -if [[ $DO_ARCHIVE = 1 ]]; then - ${IG_SCRIPTS}/nu_make_archive.sh -fi - -#-------------------------------------------------------------------- -# Check for log file and extract data for error report there -#-------------------------------------------------------------------- -if [[ $DO_DATA_RPT -eq 1 || $DO_DIAG_RPT -eq 1 ]]; then - - logfile=${LOGdir}/data_extract.${sdate}.${CYC}.log - - if [[ -s $logfile ]]; then - ${IG_SCRIPTS}/ck_missing_diags.sh ${PDATE} ${TANKDIR} - ${IG_SCRIPTS}/extract_err_rpts.sh ${sdate} ${CYC} ${logfile} - fi -fi - -#---------------------------------------------------------------------- -# Conditionally queue transfer to run -# -# None: The $run_time is a one-hour delay to the Transfer job -# to ensure the plots are all finished prior to transfer. -#---------------------------------------------------------------------- -if [[ $RUN_TRANSFER -eq 1 ]]; then - - if [[ $MY_MACHINE = "wcoss" || $MY_MACHINE = "wcoss_d" ]]; then - cmin=`date +%M` # minute (MM) - ctime=`date +%G%m%d%H` # YYYYMMDDHH - rtime=`$NDATE +1 $ctime` # ctime + 1 hour - - rhr=`echo $rtime|cut -c9-10` - run_time="$rhr:$cmin" # HH:MM format for lsf (bsub command) - - transfer_log=${LOGdir}/Transfer_${RADMON_SUFFIX}.log - - transfer_queue=transfer - if [[ $MY_MACHINE = "wcoss_d" ]]; then - transfer_queue=dev_transfer - fi - - jobname=transfer_${RADMON_SUFFIX} - job="${IG_SCRIPTS}/Transfer.sh --nosrc --area $RAD_AREA ${RADMON_SUFFIX}" - - if [[ $TANK_USE_RUN -eq 1 ]]; then - job="${job} --run $RUN" - fi - echo "job = $job" - - $SUB -P $PROJECT -q $transfer_queue -o ${transfer_log} -M 80 -W 0:45 -R affinity[core] -J ${jobname} -cwd ${PWD} -b $run_time ${job} - - else - ${IG_SCRIPTS}/Transfer.sh ${RADMON_SUFFIX} --nosrc \ - 1>/ptmpp1/Edward.Safford/logs/Transfer_${RADMON_SUFFIX}.log \ - 2>/ptmpp1/Edward.Safford/logs/Transfer_${RADMON_SUFFIX}.err - fi -fi - -#-------------------------------------------------------------------- -# Clean up and exit -#-------------------------------------------------------------------- -cd $tmpdir -cd ../ -rm -rf $tmpdir - -echo "exiting CkPlt_glbl.sh" -exit diff --git a/util/Radiance_Monitor/image_gen/ush/CkPlt_rgnl.sh b/util/Radiance_Monitor/image_gen/ush/CkPlt_rgnl.sh deleted file mode 100755 index 09af8cce59..0000000000 --- a/util/Radiance_Monitor/image_gen/ush/CkPlt_rgnl.sh +++ /dev/null @@ -1,326 +0,0 @@ -#!/bin/sh -#-------------------------------------------------------------------- -# -# CkPlt_rgnl.sh -# -# Check for new data and if found call scripts to plot image -# files and transfer new images to web server. -# -# Note: this does not generate any data files. Those must be -# already created for this script to function correctly. -# -#-------------------------------------------------------------------- - -function usage { - echo "Usage: CkPlt_rgnl.sh suffix [plot_date]" - echo " Suffix is data source identifier that matches data in" - echo " TANKDIR/stats/regional directory." - echo " Plot_date, format YYYYMMDDHH is optional. If included the plot" - echo " will be for the specified cycle, provided data files are available." - echo " If not included, the plot cycle will be the last processed cycle." -} - - -set -ax -echo start CkPlt_rgnl.sh - - - -nargs=$# -if [[ $nargs -lt 1 || $nargs -gt 2 ]]; then - usage - exit 1 -fi - - -this_file=`basename $0` -this_dir=`dirname $0` - -RADMON_SUFFIX=$1 -echo RADMON_SUFFIX = ${RADMON_SUFFIX} - -#-------------------------------------------------------------------- -# Set plot_time if it is included as an argument. -#-------------------------------------------------------------------- -plot_time= -if [[ $nargs -eq 2 ]]; then - plot_time=$2 -fi - - -#-------------------------------------------------------------------- -# Set environment variables -#-------------------------------------------------------------------- -export RAD_AREA=rgn -export PLOT_ALL_REGIONS= -export REGIONAL_RR=${REGIONAL_RR:-0} -echo REGIONAL_RR = ${REGIONAL_RR} - -top_parm=${this_dir}/../../parm -export RADMON_VERSION=${RADMON_VERSION:-${top_parm}/radmon.ver} -if [[ -s ${RADMON_VERSION} ]]; then - . ${RADMON_VERSION} -else - echo "Unable to source ${RADMON_VERSION} file" - exit 2 -fi - -export RADMON_CONFIG=${RADMON_CONFIG:-${top_parm}/RadMon_config} - -if [[ -s ${RADMON_CONFIG} ]]; then - . ${RADMON_CONFIG} -else - echo "Unable to source ${RADMON_CONFIG}" - exit -fi - -if [[ -s ${RADMON_USER_SETTINGS} ]]; then - . ${RADMON_USER_SETTINGS} -else - echo "Unable to source ${RADMON_USER_SETTINGS}" - exit -fi - -. ${IG_PARM}/plot_rad_conf -. ${IG_PARM}/rgnl_conf - - -#-------------------------------------------------------------------- -# Check setting of RUN_ONLY_ON_DEV and possible abort if on prod and -# not permitted to run there. -#-------------------------------------------------------------------- - -if [[ RUN_ONLY_ON_DEV -eq 1 ]]; then - is_prod=`${IG_SCRIPTS}/onprod.sh` - if [[ $is_prod = 1 ]]; then - exit 10 - fi -fi - -#-------------------------------------------------------------------- - - -tmpdir=${STMP_USER}/plot_rgnl_rad${RADMON_SUFFIX} -rm -rf $tmpdir -mkdir -p $tmpdir -cd $tmpdir - -export PLOT=0 - -mkdir -p $LOGdir - - -#-------------------------------------------------------------------- -# Check status of plot jobs. If any are still running then exit -# this script. If none are running then remove any old job records -# in the $LOADLQ directory. -#-------------------------------------------------------------------- - -running=0 -if [[ $MY_MACHINE = "wcoss" ]]; then - running=`bjobs -l | grep plot_${RADMON_SUFFIX} | wc -l` -else - running=`showq -n -u ${LOGNAME} | grep plot_${RADMON_SUFFIX} | wc -l` -fi - -if [[ $running -ne 0 ]]; then - echo plot jobs still running for $RADMON_SUFFIX, must exit - cd $tmpdir - cd ../ - rm -rf $tmpdir - exit -fi - - - -#-------------------------------------------------------------------- -# Get date of cycle to process. Exit if images are up to current -# $PRODATE. -# -# If plot_time has been specified via command line argument, then -# set PDATE to it. Otherwise, determine the last date processed -# (into *.ieee_d files) and use that as the PDATE. -#-------------------------------------------------------------------- -export PRODATE=`${IG_SCRIPTS}/find_cycle.pl --cyc 1 --dir ${TANKDIR}` - -if [[ $plot_time != "" ]]; then - export PDATE=$plot_time -else - export PDATE=$PRODATE -fi -export START_DATE=`$NDATE -720 $PDATE` -echo "START_DATE, PRODATE, PDATE = $START_DATE $PRODATE $PDATE" - - -#-------------------------------------------------------------------- -# Note: for REGIONAL_RR cases the 19z-00z data files are stored in -# the next day's radmon.yyyymmdd file. So for those cases -# add 6 hrs to pdate and then set the $PDY value. -# -sdate=`echo $PDATE|cut -c1-8` -export CYA=`echo $PDATE|cut -c9-10` -echo "sdate, CYA = $sdate, $CYA" - -if [[ $REGIONAL_RR -eq 1 ]]; then - echo "getting date for REGIONAL_RR model" - tdate=`$NDATE +6 $PDATE` - export PDY=`echo $tdate|cut -c1-8` -else - export PDY=`echo $PDATE|cut -c1-8` -fi - -#-------------------------------------------------------------------- -# exit if no new data is available - -if [[ $PDATE -gt $PRODATE ]]; then - cd $tmpdir - cd ../ - rm -rf $tmpdir - exit -fi - - -#-------------------------------------------------------------------- -# Plot all but horizontal data with each cycle. Plot horizontal -# data on 00z cycle. - -export PLOT=1 - -#if [[ "$CYA" = "00" ]];then -# export PLOT_HORIZ=1 -#fi - - -#-------------------------------------------------------------------- -# If data is available, export variables, and submit driver for -# radiance monitoring jobs. - -if [[ $PLOT -eq 1 ]]; then - - if [[ $USE_STATIC_SATYPE -eq 0 ]]; then - - if [[ -d ${TANKDIR}/radmon.${PDY} ]]; then - test_list=`ls ${TANKDIR}/radmon.${PDY}/*angle.*${PDATE}.ieee_d.*` - fi - - cut_grp=2 - if [[ $REGIONAL_RR -eq 1 ]]; then - cut_grp=3 - fi - - for test in ${test_list}; do - this_file=`basename $test` - test_anl=`echo $this_file | grep "_anl"` - if [[ $test_anl = "" ]]; then - tmp=`echo "$this_file" | cut -d. -f${cut_grp}` - echo $tmp - SATYPE_LIST="$SATYPE_LIST $tmp" - fi - done - - SATYPE=$SATYPE_LIST - - else - TANKDIR_INFO=${TANKDIR}/info - export STATIC_SATYPE_FILE=${STATIC_SATYPE_FILE:-${TANKDIR_INFO}/SATYPE.txt} - - if [[ ! -e $STATIC_SATYPE_FILE ]]; then - export STATIC_SATYPE_FILE=${HOMEnam}/fix/nam_radmon_satype.txt - fi - echo "STATIC_SATYPE_FILE = $STATIC_SATYPE_FILE" - - #------------------------------------------------------------- - # Load the SATYPE list from the STATIC_SATYPE_FILE or exit - # if unable to locate it. - #------------------------------------------------------------- - if [[ -s $STATIC_SATYPE_FILE ]]; then - SATYPE="" - SATYPE=`cat ${STATIC_SATYPE_FILE}` - echo $SATYPE - else - echo Unable to locate $STATIC_SATYPE_FILE, must exit. - cd $tmpdir - cd ../ - rm -rf $tmpdir - exit - fi - - fi - - - #------------------------------------------------------------------ - # Set environment variables. - - pid=${pid:-$$} - export PLOT_WORK_DIR=${STMP_USER}/plotjobs_${RADMON_SUFFIX}.${pid} - mkdir -p $PLOT_WORK_DIR - cd $PLOT_WORK_DIR - - - #-------------------------------------------------------------------- - # Set environment variables to export to subsequent scripts - if [[ $MY_MACHINE = "wcoss" ]]; then - `module load GrADS/2.0.1` - echo GADDIR = $GADDIR - fi - export datdir=$RADSTAT_LOCATION - - - #------------------------------------------------------------------ - # Submit plot jobs. - - if [[ $PLOT_HORIZ -eq 1 ]]; then - logfile=${LOGdir}/mk_horiz_plots.log - rm ${logfile} - - jobname=mk_plot_horiz_${RADMON_SUFFIX} - if [[ $MY_MACHINE = "wcoss" ]]; then - $SUB -q $JOB_QUEUE -P $PROJECT -M 80 -R affinity[core] -cwd ${PLOT_WORK_DIR} \ - -o ${logfile} -W 0:45 -J ${jobname} ${IG_SCRIPTS}/mk_horiz_plots.sh - elif [[ $MY_MACHINE = "cray" ]]; then - $SUB -q $JOB_QUEUE -P $PROJECT -M 80 -o ${logfile} -W 0:45 -cwd ${PLOT_WORK_DIR} \ - -J ${jobname} ${IG_SCRIPTS}/mk_horiz_plots.sh - else - $SUB -A $ACCOUNT -l procs=1,walltime=0:20:00 -N ${jobname} \ - -V -j oe -o $LOGdir/mk_horiz_plots.log $IG_SCRIPTS/mk_horiz_plots.sh - fi - fi - - ${IG_SCRIPTS}/mk_angle_plots.sh - - ${IG_SCRIPTS}/mk_bcoef_plots.sh - - if [[ ${PLOT_STATIC_IMGS} -eq 1 ]]; then - ${IG_SCRIPTS}/mk_bcor_plots.sh - fi - - ${IG_SCRIPTS}/mk_time_plots.sh - - #------------------------------------------------------------------ - # Run the make_archive.sh script if $DO_ARCHIVE is switched on. - #------------------------------------------------------------------ - if [[ $DO_ARCHIVE = 1 ]]; then - ${IG_SCRIPTS}/nu_make_archive.sh - fi - -fi - -#-------------------------------------------------------------------- -# Check for log file and extract data for error report there -#-------------------------------------------------------------------- -if [[ $DO_DATA_RPT -eq 1 || $DO_DIAG_RPT -eq 1 ]]; then - - logfile=${LOGdir}/data_extract.${RADMON_SUFFIX}.${sdate}.${CYA}.log - - if [[ -s $logfile ]]; then - ${IG_SCRIPTS}/extract_err_rpts.sh $sdate $CYA $logfile - fi -fi - -#-------------------------------------------------------------------- -# Clean up and exit -cd $tmpdir -cd ../ -rm -rf $tmpdir - -exit diff --git a/util/Radiance_Monitor/image_gen/ush/Plot.sh b/util/Radiance_Monitor/image_gen/ush/Plot.sh deleted file mode 100755 index 79bee1db52..0000000000 --- a/util/Radiance_Monitor/image_gen/ush/Plot.sh +++ /dev/null @@ -1,335 +0,0 @@ -#!/bin/sh -#-------------------------------------------------------------------- -# -# Plot.sh -# -# Plot a data source. -# -# calling sequence: Plot.sh suffix start_date end_date -# suffix -- data source identifier that matches data in the -# $TANKDIR/stats directory -# start_date -- format YYYYMMDDHH, first cycle the plot is to -# include -# end_date -- format YYYYMMDDHH, last cycle the plot is to -# include. This must be at least 2 cycles after -# the start date. -# -# Note: this does not generate any data files. Those must be -# already created for this script to function correctly. -# -#-------------------------------------------------------------------- - -function usage { - echo "Usage: Plot.sh suffix start_date end_date" - echo " File name for Plot.sh may be full or relative path" - echo " Suffix is data source identifier that matches data in " - echo " the $TANKDIR/stats directory." - echo " start_date and end_date are in the format YYYYMMDDHH." - echo " The start_date must be at least 2 cycles before end_date." -} - -set -ax -echo start Plot.sh -echo -echo $PATH -echo - -nargs=$# -if [[ $nargs -ne 3 ]]; then - usage - exit 1 -fi - -this_file=`basename $0` -this_dir=`dirname $0` - -RADMON_SUFFIX=$1 -start_dt=$2 -end_dt=$3 - -echo RADMON_SUFFIX = ${RADMON_SUFFIX} -echo start_dt = ${start_dt} -echo end_dt = ${end_dt} - -#-------------------------------------------------------------------- -# Verify start_dt and end_dt are the correct length. -#-------------------------------------------------------------------- - -if [[ ${#start_dt} -ne 10 ]]; then - echo ERROR: start_date is not in YYYYMMDDHH format, exiting. - exit 2 -elif [[ ${#end_dt} -ne 10 ]]; then - echo ERROR: end_date is not in YYYYMMDDHH format, exiting. - exit 3 -fi - - -#-------------------------------------------------------------------- -# Run config files to load environment variables, -# set default plot conditions -#-------------------------------------------------------------------- - -top_parm=${this_dir}/../../parm - -export RADMON_VERSION=${RADMON_VERSION:-${top_parm}/radmon.ver} -if [[ -s ${RADMON_VERSION} ]]; then - . ${RADMON_VERSION} -else - echo "Unable to source ${RADMON_VERSION} file" - exit 2 -fi - -export RADMON_CONFIG=${RADMON_CONFIG:-${top_parm}/RadMon_config} - -if [[ -s ${RADMON_CONFIG} ]]; then - . ${RADMON_CONFIG} -else - echo "Unable to source ${RADMON_CONFIG}" - exit 4 -fi - -if [[ -s ${RADMON_USER_SETTINGS} ]]; then - . ${RADMON_USER_SETTINGS} -else - echo "Unable to source ${RADMON_USER_SETTINGS}" - exit 6 -fi - -. ${IG_PARM}/plot_rad_conf - -if [[ $RAD_AREA = "glb" ]]; then - . ${IG_PARM}/glbl_conf -elif [[ $RAD_AREA = "rgn" ]]; then - . ${IG_PARM}/rgnl_conf -else - echo "ERROR: unable to determine RAD_AREA for $RADMON_SUFFIX" - exit 7 -fi - -#-------------------------------------------------------------------- -# Check setting of RUN_ONLY_ON_DEV and possible abort if on prod and -# not permitted to run there. -#-------------------------------------------------------------------- - -if [[ RUN_ONLY_ON_DEV -eq 1 ]]; then - is_prod=`${IG_SCRIPTS}/onprod.sh` - if [[ $is_prod = 1 ]]; then - exit 10 - fi -fi - -#-------------------------------------------------------------------- -# Deterine the number of cycles between start_dt and end_dt. -#-------------------------------------------------------------------- -export NUM_CYCLES=`${IG_SCRIPTS}/cycle_delta.pl ${start_dt} ${end_dt}` -echo NUM_CYCLES = $NUM_CYCLES - -if [[ $NUM_CYCLES -le 0 ]]; then - echo "ERROR: check input dates -- number of cycles is $NUM_CYCLES" - exit 5 -else - export NUM_CYCLES=`expr $NUM_CYCLES + 1` -fi - - -#-------------------------------------------------------------------- -# Determine the last processed cycle. At a minimum this must -# have a cycle delta of 1 from $start_dt. (Two cycles are necessary -# for grads to plot.) -#-------------------------------------------------------------------- -proc_dt=`${IG_SCRIPTS}/find_cycle.pl 1 ${TANKDIR}` -echo proc_date = $proc_dt -delta_proc_start=`${IG_SCRIPTS}/cycle_delta.pl ${start_dt} ${proc_dt}` -if [[ $delta_proc_start -le 0 ]]; then - echo "ERROR: no data available -- last processed date is ${proc_dt}" - echo " requested plot start date is ${start_dt}" - exit 6 -fi - - -export PLOT=1 -#-------------------------------------------------------------------- -# Check status of plot jobs. If any are still running then exit -# this script. If none are running then remove any old job records -# in the $LOADLQ directory. -# -# Also need to check verf jobs for suffix. Don't want to run until -# all verf jobs have been completed. -#-------------------------------------------------------------------- - -if [[ $MY_MACHINE = "wcoss" ]]; then - running=`bjobs -l | grep plot_${RADMON_SUFFIX} | wc -l` -else - running=`showq -n -u ${LOGNAME} | grep plot_${RADMON_SUFFIX} | wc -l` -fi - -if [[ $running -ne 0 ]]; then - echo "Plot jobs still running for $RADMON_SUFFIX, must exit" - exit -fi - - -#-------------------------------------------------------------------- -# Create tmpdir and LOGdir -#-------------------------------------------------------------------- - -tmpdir=${STMP_USER}/plot_rad${RADMON_SUFFIX} -rm -rf $tmpdir -mkdir -p $tmpdir -cd $tmpdir - -mkdir -p $LOGdir - - -#-------------------------------------------------------------------- -# Set up processing dates and data directories. -#-------------------------------------------------------------------- -export PDATE=${end_dt} -sdate=`echo $PDATE|cut -c1-8` -export CYA=`echo $PDATE|cut -c9-10` -export PDY=`echo $PDATE|cut -c1-8` - - -#-------------------------------------------------------------------- -# Make horizontal plots only on 00z cycle. All other plotting -# is done with each cycle. -#-------------------------------------------------------------------- -#if [[ "$CYA" = "00" ]];then -# export PLOT_HORIZ=1 -#fi - - -if [[ -d $PLOT_WORK_DIR ]]; then - rm -rf $PLOT_WORK_DIR -fi -mkdir $PLOT_WORK_DIR -cd $PLOT_WORK_DIR - - -#------------------------------------------------------------- -# If USE_STATIC_SATYPE == 0 then assemble the SATYPE list from -# available data files in $TANKDIR/angle -# If USE_STATIC_SATYPE == 1 then load SATYPE from the SATYPE.txt -# file. -#------------------------------------------------------------- -if [[ $USE_STATIC_SATYPE -eq 0 ]]; then - - ctr=$(($NUM_CYCLES)) - tdate=$end_dt - tdy=$PDY - - while [[ $ctr -ge 0 ]]; do - if [[ -d ${TANKDIR}/radmon.${tdy} ]]; then - test_list=`ls ${TANKDIR}/radmon.${tdy}/angle.*${tdate}.ieee_d*` - else - test_list=`ls ${TANKDIR}/angle/*.${tdate}.ieee_d*` - fi - - if [[ ${#test_list} -gt 0 ]]; then - for test in ${test_list}; do - this_file=`basename $test` - test_anl=`echo $this_file | grep "_anl"` - if [[ $test_anl = "" ]]; then - tmp=`echo "$this_file" | cut -d. -f2` - echo $tmp - SATYPE_LIST="$SATYPE_LIST $tmp" - fi - done - - break - fi - - tdate=`$NDATE -06 ${tdate}` - tdy=`echo $tdate|cut -c1-8` - ctr=$(($ctr-1)) - done - - SATYPE=$SATYPE_LIST - echo $SATYPE - -else - TANKDIR_INFO=${TANKDIR}/info - STATIC_SATYPE_FILE=${TANKDIR_INFO}/SATYPE.txt - - #------------------------------------------------------------- - # Load the SATYPE list from the STATIC_SATYPE_FILE or exit - # if unable to locate it. - #------------------------------------------------------------- - if [[ -s $STATIC_SATYPE_FILE ]]; then - SATYPE="" - SATYPE=`cat ${STATIC_SATYPE_FILE}` - echo $SATYPE - else - echo Unable to locate $STATIC_SATYPE_FILE, must exit. - cd $tmpdir - cd ../ - rm -rf $tmpdir - exit 7 - fi -fi - - -#------------------------------------------------------------------ -# Export variables -#------------------------------------------------------------------ -export START_DATE=${start_dt} - - -#------------------------------------------------------------------ -# Start image plotting jobs. -#------------------------------------------------------------------ -${IG_SCRIPTS}/mk_angle_plots.sh - -${IG_SCRIPTS}/mk_bcoef_plots.sh - -${IG_SCRIPTS}/mk_bcor_plots.sh - -if [[ ${PLOT_HORIZ} -eq 1 ]] ; then - export datdir=$RADSTAT_LOCATION - - jobname="plot_horiz_${RADMON_SUFFIX}" - logfile="${LOGdir}/horiz.log" - - if [[ $MY_MACHINE = "wcoss" ]]; then - $SUB -P $PROJECT -q $JOB_QUEUE -o ${logfile} -M 80 -W 0:45 -cwd ${PWD} \ - -J ${jobname} -R affinity[core] ${IG_SCRIPTS}/mk_horiz_plots.sh - elif [[ $MY_MACHINE = "cray" ]]; then - $SUB -P $PROJECT -q $JOB_QUEUE -o ${logfile} -M 80 -W 0:45 -cwd ${PWD} \ - -J ${jobname} ${IG_SCRIPTS}/mk_horiz_plots.sh - else - $SUB -A $ACCOUNT -l procs=1,walltime=0:20:00 -N ${jobname} \ - -V -j oe -o ${logfile} $IG_SCRIPTS/mk_horiz_plots.sh - fi -fi - -${IG_SCRIPTS}/mk_time_plots.sh - - -#-------------------------------------------------------------------- -# Check for log file and extract data for error report there -#-------------------------------------------------------------------- -do_diag_rpt=$DO_DIAG_RPT -do_data_rpt=$DO_DATA_RPT - -if [[ $do_data_rpt -eq 1 || $do_diag_rpt -eq 1 ]]; then - - logfile_dir=${LOGdir}/rad${RADMON_SUFFIX} - logfile=`ls ${logfile_dir}/${PDY}/gdas_verfrad_${CYA}.*` - if [[ ! -s $logfile ]]; then - logfile=${LOGdir}/data_extract.${sdate}.${CYA}.log - fi - - if [[ -s $logfile ]]; then - ${IG_SCRIPTS}/extract_err_rpts.sh $sdate $CYA $logfile - fi -fi - -#-------------------------------------------------------------------- -# Clean up and exit -#-------------------------------------------------------------------- -cd $tmpdir -cd ../ -rm -rf $tmpdir - -echo end Plot.sh -exit diff --git a/util/Radiance_Monitor/image_gen/ush/PlotComp.sh b/util/Radiance_Monitor/image_gen/ush/PlotComp.sh deleted file mode 100755 index e0bf400339..0000000000 --- a/util/Radiance_Monitor/image_gen/ush/PlotComp.sh +++ /dev/null @@ -1,160 +0,0 @@ -#!/bin/sh - -#-------------------------------------------------------------------- -# -# PlotComp.sh -# -# This script plots the requested comparision plots for the specified -# suffix (data sources). Data may be plotted from either global or -# regional sources. -# -# Supported plots include: -# plot_fs_obsnum_comp.sh (?) -# plot_comp.sh -# -# Note: this does not generate any data files (*.ieee_d). Those -# must be already created for this script to function correctly. -# -#-------------------------------------------------------------------- - -function usage { - echo "Usage: PlotComp.sh start_date end_date suffix1 suffix2" - echo " File name for PlotComp.sh may be full or relative path" - echo " Start Date for plot range (format: yyyymmddhh)" - echo " End Date for plot range (format yyyymmddhh)" - echo " Suffix1 data source identifier that corresponds to data" - echo " in the $TANKDIR/stats directory/suffix1" - echo " Suffix2 data source identifier that corresponds to data" - echo " in the $TANKDIR/stats directory/suffix2" -} - - -set -ax -echo start PlotComp.sh - -nargs=$# -if [[ $nargs -ne 4 ]]; then - usage - exit 1 -fi - -this_file=`basename $0` -this_dir=`dirname $0` - -export SDATE=$1 -export EDATE=$2 -export SUFFIX1=$3 -export SUFFIX2=$4 -export SUFFIX=$SUFFIX1 - -#-------------------------------------------------------------------- -# Set environment variables -#-------------------------------------------------------------------- - -top_parm=${this_dir}/../../parm -export RADMON_CONFIG=${RADMON_CONFIG:-${top_parm}/RadMon_config} - -if [[ -s ${RADMON_CONFIG} ]]; then - . ${RADMON_CONFIG} -else - echo "Unable to source ${RADMON_CONFIG}" - exit 2 -fi - -if [[ -s ${RADMON_USER_SETTINGS} ]]; then - . ${RADMON_USER_SETTINGS} -else - echo "Unable to source ${RADMON_USER_SETTINGS}" - exit 3 -fi - -. ${IG_PARM}/plot_rad_conf - -#-------------------------------------------------------------------- -# Check setting of RUN_ONLY_ON_DEV and possible abort if on prod and -# not permitted to run there. -#-------------------------------------------------------------------- - -if [[ RUN_ONLY_ON_DEV -eq 1 ]]; then - is_prod=`${IG_SCRIPTS}/onprod.sh` - if [[ $is_prod = 1 ]]; then - exit 10 - fi -fi - -#-------------------------------------------------------------------- -# Source necessary configuration files -#-------------------------------------------------------------------- -data="ges" - -echo $SDATE $EDATE $SUFFIX1, $SUFFIX2 - -if [[ -d ${MY_TANKDIR}/stats/${SUFFIX1} ]]; then - export RAD_AREA="glb" - export TANKDIR=${MY_TANKDIR}/stats - export IMGNDIR=${MY_TANKDIR}/imgn -elif [[ -d ${MY_TANKDIR}/stats/regional/${SUFFIX1} ]]; then - export RAD_AREA="rgn" - export TANKDIR=${MY_TANKDIR}/stats/regional - export IMGNDIR=${MY_TANKDIR}/imgn/regional -else - echo unable to locate $SUFFIX1 in $MY_TANKDIR tree - exit 4 -fi - -echo rad_area = $RAD_AREA - -mkdir -p $LOGdir - -if [[ -d $PLOT_WORK_DIR ]]; then - rm -rf $PLOT_WORK_DIR -fi -mkdir $PLOT_WORK_DIR - -#-------------------------------------------------------------- -# Set up SUFFIX, TANKDIR and IMGNDIR for this plot. -#-------------------------------------------------------------- -#export TANKDIR=${MY_TANKDIR}/stats -echo ${TANKDIR} -#export IMGNDIR=${MY_TANKDIR}/imgn -echo ${IMGNDIR} - -export TANKDIR1=${TANKDIR}/${SUFFIX1} -export IMGNDIR1=${IMGNDIR}/${SUFFIX1} -prodate1=`${IG_SCRIPTS}/find_cycle.pl 1 ${TANKDIR1}` -echo prodate1 = $prodate1 - -export TANKDIR2=${TANKDIR}/${SUFFIX2} -export IMGNDIR2=${IMGNDIR}/${SUFFIX2} -prodate2=`${IG_SCRIPTS}/find_cycle.pl 1 ${TANKDIR2}` -echo prodate2 = $prodate2 - -#------------------------------------------------------------- -# Build the SATYPE list using SUFFIX1 -#------------------------------------------------------------- - -PDY=`echo $EDATE|cut -c1-8` -if [[ -d ${TANKDIR1}/radmon.${PDY} ]]; then - test_list=`ls ${TANKDIR1}/radmon.${PDY}/time.*${EDATE}.ieee_d*` -else - test_list=`ls $TANKDIR1/time/*.${EDATE}.ieee_d*` -fi - -for test in ${test_list}; do - this_file=`basename $test` - tmp=`echo "$this_file" | cut -d. -f2` - echo $tmp - test_anl=`echo $this_file | grep "_anl"` - if [[ $test_anl = "" ]]; then - SATYPE_LIST="$SATYPE_LIST $tmp" - fi -done - -export SATYPE=$SATYPE_LIST -echo $SATYPE - -. ${IG_SCRIPTS}/mk_comp_plots.sh - -echo end PlotComp.sh - -exit diff --git a/util/Radiance_Monitor/image_gen/ush/Plot_comp_1_cycle.sh b/util/Radiance_Monitor/image_gen/ush/Plot_comp_1_cycle.sh deleted file mode 100755 index 0fd4e163c9..0000000000 --- a/util/Radiance_Monitor/image_gen/ush/Plot_comp_1_cycle.sh +++ /dev/null @@ -1,232 +0,0 @@ -#!/bin/sh - -#-------------------------------------------------------------------- -# -# Plot_comp.sh -# -# This script plots the requested comparision plots for the specified -# suffix (data sources). Data may be plotted from either global or -# regional sources. -# -# Supported plots include: -# plot_fs_obsnum_comp.sh -# -# Note: this does not generate any data files (*.ieee_d). Those -# must be already created for this script to function correctly. -# -#-------------------------------------------------------------------- - -function usage { - echo "Usage: Plot_comp.sh suffix" - echo " File name for CkPlt_glbl.sh may be full or relative path" - echo " Date in YYYYMMDDHH for plot" - echo " Suffix1 data source identifier that corresponds to data" - echo " in the $TANKDIR/stats directory/suffix1" - echo " Suffix2 data source identifier that corresponds to data" - echo " in the $TANKDIR/stats directory/suffix1" - echo " [Suffix3] optional data source identifier that corresponds to data" - echo " in the $TANKDIR/stats directory/suffix1" -} - - -set -ax -echo start CkPlt_comp.sh - -nargs=$# -if [[ $nargs -lt 3 ]]; then - usage - exit 1 -fi - -this_file=`basename $0` -this_dir=`dirname $0` - -export PDATE=$1 -export SUFFIX1=$2 -export SUFFIX2=$3 -export SUFFIX3=$4 -export SUFFIX=$SUFFIX1 - -#-------------------------------------------------------------------- -# Set environment variables -#-------------------------------------------------------------------- - -top_parm=${this_dir}/../../parm -export RADMON_CONFIG=${RADMON_CONFIG:-${top_parm}/RadMon_config} - -if [[ -s ${RADMON_CONFIG} ]]; then - . ${RADMON_CONFIG} -else - echo "Unable to source ${RADMON_CONFIG}" - exit 1 -fi - -if [[ -s ${RADMON_USER_SETTINGS} ]]; then - . ${RADMON_USER_SETTINGS} -else - echo "Unable to source ${RADMON_USER_SETTINGS}" - exit 2 -fi - -. ${IG_PARM}/plot_rad_conf - -#-------------------------------------------------------------------- -# Check setting of RUN_ONLY_ON_DEV and possible abort if on prod and -# not permitted to run there. -#-------------------------------------------------------------------- - -if [[ RUN_ONLY_ON_DEV -eq 1 ]]; then - is_prod=`${IG_SCRIPTS}/onprod.sh` - if [[ $is_prod = 1 ]]; then - exit 10 - fi -fi - -#-------------------------------------------------------------------- -# Source necessary configuration files -#-------------------------------------------------------------------- -data="ges" - -echo $SUFFIX2, $SUFFIX3, $last_plot - -if [[ $RAD_AREA == "glb" ]]; then - . ${RADMON_IMAGE_GEN}/parm/glbl_comp_conf -elif [[ $RAD_AREA == "rgn" ]]; then - . ${RADMON_IMAGE_GEN}/parm/rgnl_comp_conf -fi - -mkdir -p $LOGdir - -if [[ -d $PLOT_WORK_DIR ]]; then - rm -rf $PLOT_WORK_DIR -fi -mkdir $PLOT_WORK_DIR - -#-------------------------------------------------------------- -# Set up SUFFIX, TANKDIR and IMGNDIR for this plot. -#-------------------------------------------------------------- -export TANKDIR=${MY_TANKDIR}/stats -echo ${TANKDIR} -export IMGNDIR=${MY_TANKDIR}/imgn -echo ${IMGNDIR} - -export TANKDIR1=${TANKDIR}/${SUFFIX1} -export IMGNDIR1=${IMGNDIR}/${SUFFIX1} -prodate1=`${IG_SCRIPTS}/find_cycle.pl 1 ${TANKDIR1}` - -export TANKDIR2=${TANKDIR}/${SUFFIX2} -export IMGNDIR2=${IMGNDIR}/${SUFFIX2} -prodate2=`${IG_SCRIPTS}/find_cycle.pl 1 ${TANKDIR2}` - -#------------------------------------------------------------------- -# SUFFIX3 may or may not exist (plots can include 2 or 3 different -# data sources. The absence of SUFFIX3 is not an error condition. -#------------------------------------------------------------------- -suff3=`echo ${#SUFFIX3}` -if [[ $suff3 -gt 0 ]]; then - export TANKDIR3=${TANKDIR}/${SUFFIX3} - export IMGNDIR3=${IMGNDIR}/${SUFFIX3} - prodate3=`${IG_SCRIPTS}/find_cycle.pl 1 ${TANKDIR3}` -fi - -#-------------------------------------------------------------- -# Get date of cycle to process. Make sure all sources have -# data for the desired cycle. Exit if any have not processed -# the requested cycle. -#-------------------------------------------------------------- - - -abort_run=0 -if [[ ${prodate1} -lt $PDATE ]]; then - echo $SUFFIX1 processing date $prodate1 is not up to $PDATE - abort_run=1 -fi -if [[ ${prodate2} -lt $PDATE ]]; then - echo $SUFFIX2 processing date $prodate2 is not up to $PDATE - abort_run=1 -fi -if [[ $suff3 -gt 0 ]]; then - if [[ ${prodate3} -lt $PDATE ]]; then - echo $SUFFIX3 processing date $prodate3 is not up to $PDATE - abort_run=1 - fi -fi - -if [[ $abort_run -eq 1 ]]; then - exit 3 -fi - - -#------------------------------------------------------------- -# If USE_STATIC_SATYPE == 0 then assemble the SATYPE list from -# available data files in $TANKDIR1/angle -# If USE_STATIC_SATYPE == 1 then load SATYPE from the SATYPE.txt -# file. -#------------------------------------------------------------- -if [[ $USE_STATIC_SATYPE -eq 0 ]]; then - - PDY=`echo $PDATE|cut -c1-8` - if [[ -d ${TANKDIR1}/radmon.${PDY} ]]; then - test_list=`ls ${TANKDIR1}/radmon.${PDY}/angle.*${PDATE}.ieee_d*` - else - test_list=`ls $TANKDIR1/angle/*.${PDATE}.ieee_d*` - fi - - for test in ${test_list}; do - this_file=`basename $test` - tmp=`echo "$this_file" | cut -d. -f2` - echo $tmp - SATYPE_LIST="$SATYPE_LIST $tmp" - done - - SATYPE=$SATYPE_LIST - -else - - STATIC_SATYPE_FILE=${TANKDIR}/radmon.${PDY}/gdas_radmon_satype.txt - - #------------------------------------------------------------- - # Load the SATYPE list from the STATIC_SATYPE_FILE or exit - # if unable to locate it. - #------------------------------------------------------------- - if [[ -s $STATIC_SATYPE_FILE ]]; then - SATYPE="" - SATYPE=`cat ${STATIC_SATYPE_FILE}` - else - echo "Unable to locate $STATIC_SATYPE_FILE, must exit." - exit - fi -fi - -echo $SATYPE - - - -#------------------------------------------------------------------ -# submit plot script -#------------------------------------------------------------------ -plotfile=${IG_SCRIPTS}/plot_fs_obsnum_comp.sh -cmdfile=${PLOT_WORK_DIR}/cmdfile_comp_plot_${SUFFIX1} -jobname=plot_comp_${SUFFIX1} -logfile=${LOGdir}/plot_comp.log -rm -f $logfile -rm -f $cmdfile - -for type in ${SATYPE}; do - echo ${plotfile} ${type} ${data} >> $cmdfile -done - -ntasks=`cat $cmdfile|wc -l` -((nprocs=(ntasks+1)/2)) - -if [[ $MY_MACHINE = "wcoss" ]]; then - $SUB -P $PROJECT -q $JOB_QUEUE -M 80 -R affinity[core] -n 1,$ntasks -o ${logfile} -W 0:20 -J ${jobname} <$cmdfile -elif [[ $MY_MACHINE = "zeus" ]]; then - $SUB -A $ACCOUNT -l procs=1,walltime=0:20:00 -N $jobname -V -j oe -o $logfile $cmdfile -fi - - - -echo end CkPlt_comp.sh - -exit diff --git a/util/Radiance_Monitor/image_gen/ush/README b/util/Radiance_Monitor/image_gen/ush/README index ac09c73dee..3c44fb8199 100644 --- a/util/Radiance_Monitor/image_gen/ush/README +++ b/util/Radiance_Monitor/image_gen/ush/README @@ -11,10 +11,10 @@ camel case scripts; they should not be called directly by the user. There are two sets of scripts; one for the global, and one for the regional. They are similar, but not identical in function. -The top level scripts are CkPlt_glbl.sh and CkPlt_rgnl.sh scripts. This is +The top level scripts are RadMon_IG_glb.sh and RadMon_IG_rgn.sh scripts. This is and example of running them from the command line: -> ./CkPlt_glbl.sh mysfx 2013053100 +> ./RadMon_IG_glb.sh mysfx --pdate 2020123100 The "mysfx" is the identifying suffix. This must match data processed by the data_extract scripts, which should be in your $TANKDIR/stats/$SUFFIX directory. @@ -22,13 +22,6 @@ The date is optional. If provided, the plot will be run with for this cycle (using a 30 day period ending with this cycle). If no date is provided the last cycle processed will be used for the plot. -A second method of plotting is to use the Plot.sh script. The calling sequence -is: - -> ./Plot.sh mysfx 2013050118 2013052212 - -Here the plot will use the period cycle 2013050118 to 2013052212. - Assuming data is available and the top level plot scripts run the lower level scripts to set up the environement, move data and control files into work directories. The plot scripts now produce small .txt files which are used by @@ -46,24 +39,17 @@ the web server. The scp command has enough overhead though that the large numbe of transfers that the package performs can slow the web server. To prevent server slowdowns rsync is now used instead of scp. -Instead of pushing files the plot_* scripts now copy the image files to the $IMGNDIR -directory. The default location for this is ~/nbns/imgn/$SUFFIX (SUFFIX is the data -source identifier, such as mysfx), and it has subdirectories for angle, bcoef, -summary, and time. This is the same structure of the pngs directory on the -web server. The rsync utility can then be used to mirror the files in the $IMGNDIR -to the web server's pngs directory. - -The Transfer.sh script can be used to accomplish the rsync mirroring. It may be run -as a cron or from the command line, and takes a SUFFIX as it's only argument. When -run it will copy any files in $IMGNDIR that are newer than the web server's versions. -If there are no differences between the files in $IMGNDIR and the web server then no -file transfers are made. This is an example of a cron entry to run Transfer.sh once -an hour at 20 minutes after the hour (HH:20:00): - -20 * * * * /bin/sh /global/save/wx20es/RadMon_256/util/Radiance_Monitor/image_gen/ush/Transfer.sh opr 1>/ptmpp1/wx20es/logs/radopr/Transfer_opr.log 2>/ptmpp1/wx20es/logs/radopr/Transfer_opr.err +The plot_* scripts move the image files to the $IMGNDIR directory. The default +location for this is ~/nbns/imgn/$SUFFIX/$RUN/radmon/pngs (SUFFIX is the data +source identifier, such as mysfx, run is generally gdas|gfs). The rsync utility +can then be used to mirror the files in the $IMGNDIR to the web server's pngs directory. +The Transfer.sh script is automatically started by the plot script if $RUN_TRANSFER +in parm/RadMon_user_settings is set to 1. The Transfer.sh script can also be run +via cron or at the command line, though it's best to do this as a job submitted to +the dev_transfer queue. -Please note that scripted file transfers generally cannot be done from theia to the -web server. If you need to move files from theia you will have to resort to tarring them -up and moving them manually. You may be able to convince the theia admins to allow an +Please note that scripted file transfers generally cannot be done from hera to the +web server. If you need to move files from hera you will have to resort to tarring them +up and moving them manually. You may be able to convince the hera admins to allow an automated transfer but you will have to take that up with them. diff --git a/util/Radiance_Monitor/image_gen/ush/RadMon_IG_glb.sh b/util/Radiance_Monitor/image_gen/ush/RadMon_IG_glb.sh new file mode 100755 index 0000000000..0263d21801 --- /dev/null +++ b/util/Radiance_Monitor/image_gen/ush/RadMon_IG_glb.sh @@ -0,0 +1,335 @@ +#!/bin/sh +#-------------------------------------------------------------------- +# +# RadMon_IG_glb.sh +# +# RadMon image generation script for global data sources. +# This script queues the plot and transfer scripts. +# +#-------------------------------------------------------------------- + + +#-------------------------------------------------------------------- +# usage +#-------------------------------------------------------------------- +function usage { + echo "Usage: RadMon_IG_glb.sh suffix [-p|--pdate -r|--run ]" + echo "" + echo " suffix is the indentifier for this data source." + echo " This is usually the same as the NET value." + echo "" + echo " -p|--pdate is the full YYYYMMDDHH cycle to run. If not specified" + echo " the TANKverf directory will be used to determine the next cycle time" + echo "" + echo " -r|--run is gdas|gfs. gdas is the default if not specified." + echo "" +} + +echo start RadMon_IG_glb.sh +echo + +#-------------------------------------------------------------------- +# RadMon_DE_glb begins here. +#-------------------------------------------------------------------- +exit_value=0 + +nargs=$# +if [[ $nargs -lt 1 || $nargs -gt 5 ]]; then + usage + exit 1 +fi + +#----------------------------------------------------------- +# Set default values and process command line arguments. +# +run=gdas + +while [[ $# -ge 1 ]] +do + key="$1" + + case $key in + -p|--pdate) + pdate="$2" + shift # past argument + ;; + -r|--run) + run="$2" + shift # past argument + ;; + *) + #any unspecified key is RADMON_SUFFIX + export RADMON_SUFFIX=$key + ;; + esac + + shift +done + +export RUN=${run} + +echo "RADMON_SUFFIX = ${RADMON_SUFFIX}" +echo "RUN = ${RUN}" +echo "pdate = ${pdate}" + +set -ax + +#-------------------------------------------------------------------- +# Run config files to load environment variables, +# set default plot conditions +#-------------------------------------------------------------------- +rad_area=glb + +this_dir=`dirname $0` +top_parm=${this_dir}/../../parm + +export RADMON_CONFIG=${RADMON_CONFIG:-${top_parm}/RadMon_config} + +if [[ -s ${RADMON_CONFIG} ]]; then + . ${RADMON_CONFIG} +else + echo "Unable to source ${RADMON_CONFIG}" + exit 2 +fi + +if [[ -s ${RADMON_USER_SETTINGS} ]]; then + . ${RADMON_USER_SETTINGS} +else + echo "Unable to source ${RADMON_USER_SETTINGS}" + exit 3 +fi + +#. ${IG_PARM}/plot_rad_conf +. ${IG_PARM}/glbl_conf + +#-------------------------------------------------------------------- +# Determine cycle to plot. Exit if cycle is > last available +# data. +# +# PDATE can be set one of 3 ways. This is the order of priority: +# +# 1. Specified via command line argument +# 2. Read from ${TANKimg}/last_plot_time file and advanced +# one cycle. +# 3. Using the last available cycle for which there is +# data in ${TANKDIR}. +# +# If option 2 has been used the ${IMGNDIR}/last_plot_time file +# will be updated with ${PDATE} if the plot is able to run. +#-------------------------------------------------------------------- + +echo "TANKimg = ${TANKimg}" +last_plot_time=${TANKimg}/${RUN}/radmon/last_plot_time +echo "last_plot_time file = ${last_plot_time}" + +latest_data=`${IG_SCRIPTS}/nu_find_cycle.pl --cyc 1 \ + --dir ${TANKDIR} --run ${RUN}` +if [[ ${latest_data} = "" ]]; then + latest_data=`${IG_SCRIPTS}/find_cycle.pl --cyc 1 \ + --dir ${TANKDIR} --run ${RUN}` +fi + +if [[ ${pdate} = "" ]]; then + if [[ -e ${last_plot_time} ]]; then + echo " USING last_plot_time file" + last_plot=`cat ${last_plot_time}` + pdate=`$NDATE +6 ${last_plot}` + else + echo " USING nu_find_cycle file" + pdate=${latest_data} + fi +fi + + +if [[ ${pdate} -gt ${latest_data} ]]; then + echo " Unable to plot, pdate is > latest_data, ${pdate}, ${latest_data}" + exit 4 +else + echo " OK to plot" +fi + +export PDATE=${pdate} +echo "PDATE = ${PDATE}" + +#-------------------------------------------------------------------- +# Make sure $LOGdir exists +#-------------------------------------------------------------------- +echo "LOGdir = ${LOGdir}" +if [[ ! -e ${LOGdir} ]]; then + mkdir -p $LOGdir +fi + +#-------------------------------------------------------------------- +# Calculate start date (first cycle to be included in the plots -- +# PDATE is the latest/last cycle in the plots. +#-------------------------------------------------------------------- +export NUM_CYCLES=${NUM_CYCLES:-121} +hrs=`expr ${NUM_CYCLES} \\* -6` +echo "hrs = $hrs" + +export START_DATE=`${NDATE} ${hrs} ${PDATE}` +echo "span is start_date to pdate = ${START_DATE}, ${PDATE}" + +export CYC=`echo $PDATE|cut -c9-10` +export PDY=`echo $PDATE|cut -c1-8` + + +#-------------------------------------------------------------------- +# Locate ieee_src in $TANKDIR and verify data files are present +# + +ieee_src=${TANKverf}/${RUN}.${PDY}/${CYC}/${MONITOR} + +if [[ ! -d ${ieee_src} ]]; then + ieee_src=${TANKverf}/${RUN}.${PDY}/${MONITOR} + + if [[ ! -d ${ieee_src} ]]; then + ieee_src=${TANKverf}/${RUN}.${PDY} + fi +fi + +if [[ ! -d ${ieee_src} ]]; then + echo "Unable to set ieee_src, aborting plot" + exit 5 +fi + +nfile_src=`ls -l ${ieee_src}/*${PDATE}*ieee_d* | egrep -c '^-'` + +if [[ $nfile_src -le 0 ]]; then + echo " Missing ieee_src files, nfile_src = ${nfile_src}, aborting plot" + exit 6 +fi + +export PLOT_WORK_DIR=${PLOT_WORK_DIR}.${PDATE} + +if [[ -d $PLOT_WORK_DIR ]]; then + rm -rf $PLOT_WORK_DIR +fi +mkdir -p $PLOT_WORK_DIR +cd $PLOT_WORK_DIR + + +#------------------------------------------------------------- +# Locate the satype file or set SATYPE by assembling a list +# from available data files in $TANKDIR/angle. +#------------------------------------------------------------- +tankdir_info=${TANKDIR}/info +satype_file=${satype_file:-${tankdir_info}/gdas_radmon_satype.txt} +if [[ ! -e $satype_file ]]; then + satype_file=${HOMEgdas}/fix/gdas_radmon_satype.txt +fi +echo "using satype_file: ${satype_file}" + +if [[ -s ${satype_file} ]]; then + satype=`cat ${satype_file}` +else + echo "Unable to locate satype_file: ${satype_file}" +fi + +#------------------------------------------------------------- +# Add any satypes not in the $satype_file for which we have +# data. This will get us a list of satypes to plot even if +# the $satype_file can't be found. +# +test_list=`ls ${ieee_src}/angle.*${PDATE}.ieee_d*` + +for test in ${test_list}; do + this_file=`basename $test` + test_anl=`echo $this_file | grep "_anl"` + + if [[ $test_anl = "" ]]; then + tmp=`echo "$this_file" | cut -d. -f2` + test_satype=`echo ${satype} | grep ${tmp}` + + if [[ ${test_satype} = "" ]]; then + satype="${satype} ${tmp}" + echo "added ${tmp} to satype" + fi + fi +done + +export SATYPE=${satype} +echo $SATYPE + + +#------------------------------------------------------------------ +# Start plot scripts. +#------------------------------------------------------------------ +${IG_SCRIPTS}/mk_time_plots.sh + +${IG_SCRIPTS}/mk_bcoef_plots.sh + +${IG_SCRIPTS}/mk_angle_plots.sh + +if [[ ${PLOT_STATIC_IMGS} -eq 1 ]]; then + ${IG_SCRIPTS}/mk_bcor_plots.sh +fi + +#-------------------------------------------------------------------- +# Check for log file and extract data for error report there +#-------------------------------------------------------------------- +if [[ $DO_DATA_RPT -eq 1 || $DO_DIAG_RPT -eq 1 ]]; then + + warn_file=${TANKDIR}/${RUN}.${PDY}/${CYC}/${MONITOR}/warning.${PDATE} + if [[ -e ${warn_file} ]]; then + echo "mailing warning report" + /bin/mail -s "RadMon warning" -c "${MAIL_CC}" ${MAIL_TO} < ${warn_file} + fi + +fi + +#-------------------------------------------------------------------- +# Update the last_plot_time file if found +#-------------------------------------------------------------------- +if [[ -e ${last_plot_time} ]]; then + echo "update last_plot_time file" + echo ${PDATE} > ${last_plot_time} +fi + + +#-------------------------------------------------------------------- +# Remove all but the last 30 cycles worth of data image files. +#-------------------------------------------------------------------- +${IG_SCRIPTS}/rm_img_files.pl --dir ${TANKimg}/radmon/pngs --nfl 30 + + + +#---------------------------------------------------------------------- +# Conditionally queue transfer to run +# +# None: The $run_time is a one-hour delay to the Transfer job +# to ensure the plots are all finished prior to transfer. +#---------------------------------------------------------------------- +if [[ $RUN_TRANSFER -eq 1 ]]; then + + if [[ $MY_MACHINE = "wcoss_c" || $MY_MACHINE = "wcoss_d" ]]; then + cmin=`date +%M` # minute (MM) + ctime=`date +%G%m%d%H` # YYYYMMDDHH + rtime=`$NDATE +1 $ctime` # ctime + 1 hour + + rhr=`echo $rtime|cut -c9-10` + run_time="$rhr:$cmin" # HH:MM format for lsf (bsub command) + + transfer_log=${LOGdir}/Transfer_${RADMON_SUFFIX}.log + + transfer_queue=transfer + if [[ $MY_MACHINE = "wcoss_d" ]]; then + transfer_queue=dev_transfer + fi + + jobname=transfer_${RADMON_SUFFIX} + job="${IG_SCRIPTS}/Transfer.sh --nosrc --area ${rad_area} ${RADMON_SUFFIX}" + + if [[ $TANK_USE_RUN -eq 1 ]]; then + job="${job} --run $RUN" + fi + echo "job = $job" + + $SUB -P $PROJECT -q $transfer_queue -o ${transfer_log} -M 80 -W 0:45 -R affinity[core] -J ${jobname} -cwd ${PWD} -b $run_time ${job} + + fi +fi + + +echo "exiting RadMon_IG_glb.sh" +exit diff --git a/util/Radiance_Monitor/image_gen/ush/RadMon_IG_rgn.sh b/util/Radiance_Monitor/image_gen/ush/RadMon_IG_rgn.sh new file mode 100755 index 0000000000..df41a62fd1 --- /dev/null +++ b/util/Radiance_Monitor/image_gen/ush/RadMon_IG_rgn.sh @@ -0,0 +1,313 @@ +#!/bin/bash +#-------------------------------------------------------------------- +# +# RadMon_IG_rgn.sh +# +# Plot image files and queue transfer job. +# +#-------------------------------------------------------------------- + +#-------------------------------------------------------------------- +# usage +#-------------------------------------------------------------------- +function usage { + echo "Usage: RadMon_IG_rgn.sh suffix [-p|--pdate -r|--run ]" + echo "" + echo " suffix is the indentifier for this data source." + echo " This is usually the same as the NET value." + echo "" + echo " -p|--pdate is the full YYYYMMDDHH cycle to run. If not specified" + echo " the TANKverf directory will be used to determine the next cycle time" + echo "" + echo " -r|--run nam is the default if not specified." + echo "" +} + + +echo start RadMon_IG_rgn.sh + + +nargs=$# +if [[ $nargs -lt 1 || $nargs -gt 5 ]]; then + usage + exit 1 +fi + +#----------------------------------------------------------- +# Process command line arguments. +# +run=nam + +while [[ $# -ge 1 ]] +do + key="$1" + + case $key in + -p|--pdate) + pdate="$2" + shift # past argument + ;; + -r|--run) + run="$2" + shift # past argument + ;; + *) + #any unspecified key is RADMON_SUFFIX + export RADMON_SUFFIX=$key + ;; + esac + + shift +done + +export RUN=${run} + +echo "RADMON_SUFFIX = ${RADMON_SUFFIX}" +echo "RUN = ${RUN}" +echo "pdate = ${pdate}" + + +set -ax + +#-------------------------------------------------------------------- +# Set environment variables +#-------------------------------------------------------------------- +export RAD_AREA=rgn +export REGIONAL_RR=1 + +this_dir=`dirname $0` +top_parm=${this_dir}/../../parm + +export RADMON_CONFIG=${RADMON_CONFIG:-${top_parm}/RadMon_config} +if [[ -s ${RADMON_CONFIG} ]]; then + . ${RADMON_CONFIG} +else + echo "Unable to source ${RADMON_CONFIG}" + exit 1 +fi + +if [[ -s ${RADMON_USER_SETTINGS} ]]; then + . ${RADMON_USER_SETTINGS} +else + echo "Unable to source ${RADMON_USER_SETTINGS}" + exit 2 +fi + +. ${IG_PARM}/plot_rad_conf +. ${IG_PARM}/rgnl_conf + + +#-------------------------------------------------------------------- +# Make sure $LOGdir exists +#-------------------------------------------------------------------- +echo "LOGdir = ${LOGdir}" +if [[ -e ${LOGdir} ]]; then + mkdir -p $LOGdir +fi + +#-------------------------------------------------------------------- +# Determine cycle to plot. Exit if cycle is > last available +# data. +# +# PDATE can be set one of 3 ways. This is the order of priority: +# +# 1. Specified via command line argument +# 2. Read from ${TANKimg}/last_plot_time file and advanced +# one cycle. +# 3. Using the last available cycle for which there is +# data in ${TANKDIR}. +# +# If option 2 has been used the ${IMGNDIR}/last_plot_time file +# will be updated with ${PDATE} if the plot is able to run. +#-------------------------------------------------------------------- + +echo "TANKimg = ${TANKimg}" +last_plot_time=${TANKimg}/radmon/last_plot_time +echo "last_plot_time file = ${last_plot_time}" + +latest_data=`${IG_SCRIPTS}/find_cycle.pl --cyc 1 --dir ${TANKDIR}` + +if [[ ${pdate} = "" ]]; then + if [[ -e ${last_plot_time} ]]; then + echo " USING last_plot_time file" + last_plot=`cat ${last_plot_time}` + pdate=`$NDATE +${CYCLE_INTERVAL} ${last_plot}` + else + echo " USING find_cycle file" + pdate=${latest_data} + fi +fi + +if [[ ${pdate} -gt ${latest_data} ]]; then + echo " Unable to plot, pdate is > latest_data, ${pdate}, ${latest_data}" + exit 4 +else + echo " OK to plot" +fi + +export PDATE=${pdate} + +#-------------------------------------------------------------------- +# exit if no new data is available +# +if [[ ${PDATE} -gt ${latest_data} ]]; then + echo "requested plot date is later than available data, ${PDATE}, ${latest_data}" + exit 5 +fi + + +export NUM_CYCLES=${NUM_CYCLES:-120} +export START_DATE=`$NDATE -${NUM_CYCLES} $PDATE` + + +#-------------------------------------------------------------------- +# Note: for REGIONAL_RR cases the 19z-00z data files are stored in +# the next day's radmon.yyyymmdd file. So for those cases +# add 6 hrs to pdate and then set the $PDY value. +# +sdate=`echo $PDATE|cut -c1-8` +export CYA=`echo $PDATE|cut -c9-10` +echo "sdate, CYA = $sdate, $CYA" + +if [[ $REGIONAL_RR -eq 1 ]]; then + echo "getting date for REGIONAL_RR model" + tdate=`$NDATE +6 $PDATE` + export PDY=`echo $tdate|cut -c1-8` +else + export PDY=`echo $PDATE|cut -c1-8` +fi + +satype_file=${TANKDIR}/info/${TANKDIR_INFO}/nam_radmon_satype.txt + +if [[ ! -e $satype_file ]]; then + satype_file=${HOMEnam}/fix/nam_radmon_satype.txt +fi +if [[ -s $satype_file ]]; then + satype=`cat ${satype_file}` +fi + +echo "satype : ${satype}" + +#------------------------------------------------------------- +# Add any satypes not in the $satype_file for which we have +# data. This will get us a list of satypes to plot even if +# the $satype_file can't be found. +# +if [[ -d ${TANKDIR}/radmon.${PDY} ]]; then + test_list=`ls ${TANKDIR}/radmon.${PDY}/*angle.*${PDATE}.ieee_d.*` +fi + +for test in ${test_list}; do + this_file=`basename ${test}` + test_anl=`echo ${this_file} | grep "_anl"` + + if [[ ${test_anl} = "" ]]; then + tmp=`echo "${this_file}" | cut -d. -f2` + test_satype=`echo ${satype} | grep ${tmp}` + if [[ ${test_satype} = "" ]]; then + satype="${satype} ${tmp}" + echo "added ${tmp} to satype" + fi + fi +done + +export SATYPE=${satype} +echo $SATYPE + + +#------------------------------------------------------------------ +# Set environment variables. +# +pid=${pid:-$$} +export PLOT_WORK_DIR=${STMP_USER}/${RADMON_SUFFIX}/radmon/plotjobs.${pid} +mkdir -p $PLOT_WORK_DIR +#cd $PLOT_WORK_DIR +if [[ ! -d ${PLOT_WORK_DIR} ]]; then + echo "Unable to create PLOT_WORK_DIR: ${PLOT_WORK_DIR}" + exit 6 +fi + +#------------------------------------------------------------------ +# Submit plot jobs. +# +${IG_SCRIPTS}/mk_angle_plots.sh + +${IG_SCRIPTS}/mk_bcoef_plots.sh + +if [[ ${PLOT_STATIC_IMGS} -eq 1 ]]; then + ${IG_SCRIPTS}/mk_bcor_plots.sh +fi + +${IG_SCRIPTS}/mk_time_plots.sh + + +#-------------------------------------------------------------------- +# update last_plot_time if used +# +if [[ -e ${last_plot_time} ]]; then + echo ${PDATE} > ${last_plot_time} +fi + + +#---------------------------------------------------------------------- +# Conditionally queue transfer to run +# +# None: The $run_time is a one-hour delay to the Transfer job +# to ensure the plots are all finished prior to transfer. +#---------------------------------------------------------------------- +if [[ $RUN_TRANSFER -eq 1 ]]; then + + cyc=`echo $PDATE|cut -c9-10` + if [[ ${cyc} = "00" || ${cyc} = "06" || ${cyc} = "12" || ${cyc} = "18" ]]; then + + if [[ $MY_MACHINE = "wcoss_c" || $MY_MACHINE = "wcoss_d" ]]; then + cmin=`date +%M` # minute (MM) + ctime=`date +%G%m%d%H` # YYYYMMDDHH + rtime=`$NDATE +1 $ctime` # ctime + 1 hour + + rhr=`echo $rtime|cut -c9-10` + run_time="$rhr:$cmin" # HH:MM format for lsf (bsub command) + + transfer_log=${LOGdir}/Transfer_${RADMON_SUFFIX}.log + + transfer_queue=transfer + if [[ $MY_MACHINE = "wcoss_d" ]]; then + transfer_queue=dev_transfer + fi + + jobname=transfer_${RADMON_SUFFIX} + job="${IG_SCRIPTS}/Transfer.sh --nosrc --area ${RAD_AREA} ${RADMON_SUFFIX}" + + echo "job = $job" + + $SUB -P $PROJECT -q $transfer_queue -o ${transfer_log} -M 80 -W 0:45 \ + -R affinity[core] -J ${jobname} -cwd ${PWD} -b $run_time ${job} + + fi + fi +fi + + +#-------------------------------------------------------------------- +# remove all but the last 30 cycles of date image files. +#-------------------------------------------------------------------- +${IG_SCRIPTS}/rm_img_files.pl --dir ${TANKimg}/radmon/pngs --nfl 30 + + +#-------------------------------------------------------------------- +# Check for log file and extract data for error report there +#-------------------------------------------------------------------- +#if [[ $DO_DATA_RPT -eq 1 || $DO_DIAG_RPT -eq 1 ]]; then +# +# logfile=${LOGdir}/data_extract.${RADMON_SUFFIX}.${sdate}.${CYA}.log +# +# if [[ -s $logfile ]]; then +# ${IG_SCRIPTS}/extract_err_rpts.sh $sdate $CYA $logfile +# fi +#fi +# +#-------------------------------------------------------------------- + + +echo end RadMon_IG_rgn.sh +exit diff --git a/util/Radiance_Monitor/image_gen/ush/Transfer.sh b/util/Radiance_Monitor/image_gen/ush/Transfer.sh index 36cf3d8386..169a513b6b 100755 --- a/util/Radiance_Monitor/image_gen/ush/Transfer.sh +++ b/util/Radiance_Monitor/image_gen/ush/Transfer.sh @@ -97,27 +97,18 @@ if [[ $SOURCE_PARMS -eq 1 ]]; then fi -#-------------------------------------------------------------------- -# Check for my monitoring use. Abort if running on prod machine. -#-------------------------------------------------------------------- - -if [[ RUN_ONLY_ON_DEV -eq 1 ]]; then - is_prod=`${IG_SCRIPTS}/onprod.sh` - if [[ $is_prod = 1 ]]; then - exit 10 - fi -fi - #-------------------------------------------------------------------- log_file=${LOGdir}/Transfer_${RADMON_SUFFIX}.log err_file=${LOGdir}/Transfer_${RADMON_SUFFIX}.err +echo "IMGNDIR = ${IMGNDIR}" +echo "WEBDIR = ${WEBDIR}" + if [[ ${IMGNDIR} != "/" ]]; then - if [[ $MY_MACHINE = "wcoss" || $MY_MACHINE = "wcoss_d" || \ - $MY_MACHINE = "cray" ]]; then + if [[ $MY_MACHINE = "wcoss_d" || $MY_MACHINE = "wcoss_c" ]]; then /usr/bin/rsync -ave ssh --exclude *.ctl.${Z} \ - --exclude 'horiz' --exclude *.png ${IMGNDIR}/ \ + --exclude 'horiz' --exclude *.png --delete-during ${IMGNDIR}/ \ ${WEB_USER}@${WEB_SVR}.ncep.noaa.gov:${WEBDIR}/ fi fi diff --git a/util/Radiance_Monitor/image_gen/ush/confirm_data.sh b/util/Radiance_Monitor/image_gen/ush/confirm_data.sh deleted file mode 100755 index ed732d4c96..0000000000 --- a/util/Radiance_Monitor/image_gen/ush/confirm_data.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/sh -set -ax - -# -# confirm_data.sh -# -# Given a suffix and an $IMGDATE, determine if data for the next cycle -# is available and complete for this source. Return (echo) either YES -# or NO. -# - -function usage { - echo "Usage: confirm_data.sh suffix imgdate[yyyymmddcc]" - echo " Suffix is data source identifier that matches data in " - echo " the $TANKDIR/stats directory." - echo " The imgdate is the intended plotting data." -} - - -nargs=$# -if [[ $nargs -ne 2 ]]; then - usage - exit 1 -fi - - -suffix=$1 -pdate=$2 -CYA=`echo $pdate|cut -c9-10` -PDY=`echo $pdate|cut -c1-8` - -angle_cnt=`ls -la ${IEEE_SRC}/angle.*${pdate}.ieee_d* | wc -l` - -bcoef_cnt=`ls -la ${IEEE_SRC}/bcoef.*${pdate}.ieee_d* | wc -l` - -bcor_cnt=`ls -la ${IEEE_SRC}/bcor.*${pdate}.ieee_d* | wc -l` - -time_cnt=`ls -la ${IEEE_SRC}/time.*${pdate}.ieee_d* | wc -l` - -########################################### -# if all cnts -gt 0 and equal then proceed -########################################### -proceed="NO" - -if [[ $angle_cnt -gt 0 ]]; then - if [[ $angle_cnt -eq bcoef_cnt && $angle_cnt -eq $bcor_cnt && $angle_cnt -eq $time_cnt ]]; then - proceed="YES" - fi -fi - -echo $proceed -exit diff --git a/util/Radiance_Monitor/image_gen/ush/cycle_delta.pl b/util/Radiance_Monitor/image_gen/ush/cycle_delta.pl deleted file mode 100755 index 72b05e4ac9..0000000000 --- a/util/Radiance_Monitor/image_gen/ush/cycle_delta.pl +++ /dev/null @@ -1,95 +0,0 @@ -#! /usr/bin/perl - -#------------------------------------------------------------------- -# cycle_delta.pl -# -# This determines the delta in cycles between start date and end -# date, assuming 4 cycles per day. The input dates must be in -# YYYYMMDDHH format. The HH values should be in the set -# (00, 06, 12, 18), or the HH will be ignored and the returned -# delta value will only consider the YYYYMMDD. -# -# Calling sequence: -# -# cycle_delta.pl start_date end_date -# -# Return value: -# -# Cycle delta between the two input dates will be printed to -# stdout. If this value is negative then end date preceeds -# start date. -# -# If an error occurs there will be no output. -#------------------------------------------------------------------- - - use strict; - use warnings; - use Date::Calc qw( Delta_Days ); - - if( $#ARGV != 1 ){ - exit; - } - - my $start_dt = $ARGV[0]; - my $end_dt = $ARGV[1]; - -# parse start date -# - my $year1 = substr( $start_dt, 0, 4 ); - my $month1 = substr( $start_dt, 4, 2 ); - my $day1 = substr( $start_dt, 6, 2 ); - my $hr1 = substr( $start_dt, 8, 2 ); - - -# parse end date -# - my $year2 = substr( $end_dt, 0, 4 ); - my $month2 = substr( $end_dt, 4, 2 ); - my $day2 = substr( $end_dt, 6, 2 ); - my $hr2 = substr( $end_dt, 8, 2 ); - - my $Dy; - my $Dm; - my $Dd; - - -# convert the hour values into cycle numbers -# -# Note: any hour value not in the set (00, 06, 12, 18) is treated as -# zero. -# - my $cycle1 = 0; - my $cycle2 = 0; - - if( $hr1 eq "00" ){ - $cycle1 = 1; - } elsif( $hr1 eq "06" ){ - $cycle1 = 2; - } elsif( $hr1 eq "12" ){ - $cycle1 = 3; - } elsif( $hr1 eq "18" ){ - $cycle1 = 4; - } - - if( $hr2 eq "00" ){ - $cycle2 = 1; - } elsif( $hr2 eq "06" ){ - $cycle2 = 2; - } elsif( $hr2 eq "12" ){ - $cycle2 = 3; - } elsif( $hr2 eq "18" ){ - $cycle2 = 4; - } - - -# Cycle delta is delta in days * 4 plus the hr_delta. -# Print out cycle delta. -# - my $hr_delta = $cycle2 - $cycle1; - - ($Dy) = Delta_Days($year1,$month1,$day1, - $year2,$month2,$day2); - - my $cycle_delta = ($Dy * 4) + $hr_delta; - - print "$cycle_delta"; diff --git a/util/Radiance_Monitor/image_gen/ush/make_archive.sh b/util/Radiance_Monitor/image_gen/ush/make_archive.sh deleted file mode 100755 index 3f8fefa992..0000000000 --- a/util/Radiance_Monitor/image_gen/ush/make_archive.sh +++ /dev/null @@ -1,144 +0,0 @@ -#! /bin/ksh - -#------------------------------------------------------------------ -# -# make_archive.sh -# -# Archive the data files (*.ieee_d) to HPSS. -# -# Note that only full days are archived, so if running for the -# 00, 06, or 12z cycles the previous day will be archived. If -# PDATE = yyyymmdd18 then today (PDATE) will be last day archived. -#------------------------------------------------------------------ -set -ax -export list=$listvar - -#------------------------------------------------------------------ -# Determine last full day capable of archiving. -#------------------------------------------------------------------ -CYCLE=`echo $PDATE|cut -c9-10` -if [[ ${CYCLE} = "18" ]]; then - LASTARCH=$PDATE -else - LASTARCH=`$NDATE -24 $PDATE` -fi - -echo LASTARCH = $LASTARCH - - -#------------------------------------------------------------------ -# Determine the last archived date for this source. -#------------------------------------------------------------------ -shell=ksh -. /usrx/local/Modules/default/init/${shell} -`module load hpss` - -# -# Need better reference here! -if [[ $RADMON_SUFFIX = "wopr" ]]; then - HPSSDIR="/2year/NCEPDEV/emc-da/Edward.Safford/nbns/stats/wopr" -elif [[ $RADMON_SUFFIX = "pr4dev" ]]; then - HPSSDIR="/2year/NCEPDEV/emc-da/Edward.Safford/nbns/stats/pr4dev" -elif [[ $RADMON_SUFFIX = "nrx" ]]; then -# HPSSDIR="/NCEPDEV/hpssuser/g01/wx20es/nbns/stats/regional/nrx" - HPSSDIR="/2year/NCEPDEV/emc-da/Edward.Safford/nbns/stats/regional/nrx" -fi - -HTAR="/usrx/local/hpss/htar" -# -# - -TDATE=$LASTARCH -TDAY=`echo $TDATE|cut -c1-8` -tar_cnt=0 -cntr=0 -while [[ -d ${TANKDIR}/radmon.$TDAY && $tar_cnt < 5 && $cntr < 31 ]]; do - - tar_cnt=$( $HTAR -tf ${HPSSDIR}/radmon.${TDAY}.tar | wc -l ) - echo "tar_cnt = $tar_cnt" - - if [[ $tar_cnt < 5 ]] then - echo "adding $TDAY to list" - tar_list="$tar_list $TDAY" - fi - - TDATE=`$NDATE -24 $TDATE` - TDAY=`echo $TDATE|cut -c1-8` - - ((cntr=cntr+1)) -done - -#echo "tar_list = $tar_list" - -#------------------------------------------------------------------ -# Archive tar_list to hpss and the $ARCHIVE_DIR -#------------------------------------------------------------------ - -for tar_date in ${tar_list}; do - - $HTAR -cvf ${HPSSDIR}/radmon.${tar_date}.tar ${TANKDIR}/radmon.${tar_date} - -done - - -if [[ $MY_MACHINE = "wcoss" ]]; then - - #------------------------------------------------------------------ - # Determine the last date stored on /sss for this source. - #------------------------------------------------------------------ - ADATE=$LASTARCH - ADAY=`echo $ADATE|cut -c1-8` - cntr=0 - while [[ -d ${TANKDIR}/radmon.$ADAY && $cntr < 31 ]]; do - - if [[ ! -d ${ARCHIVE_DIR}/radmon.${ADAY} ]]; then -# echo "adding $ADAY to list" - arch_list="$arch_list $ADAY" - fi - - ADATE=`$NDATE -24 $ADATE` - ADAY=`echo $ADATE|cut -c1-8` - - ((cntr=cntr+1)) - done - - #------------------------------------------------------------------ - # Copy directories to the ${ARCHIVE_DIR} - #------------------------------------------------------------------ - for arch_date in ${arch_list}; do - cp -r ${TANKDIR}/radmon.${arch_date} ${ARCHIVE_DIR}/radmon.${arch_date} - done - - #------------------------------------------------------------------ - # Remove any directories in $ARCHIVE_DIR in excess of 30 - #------------------------------------------------------------------ - total=`ls -d1 ${ARCHIVE_DIR}/radmon.* | wc -l` - ((extra=total-31)) - - if [[ $extra -gt 0 ]]; then - `ls -d1 ${ARCHIVE_DIR}/radmon.* | head -n $extra | xargs rm -rf` - fi - - #------------------------------------------------------------------ - # Remove any directories in $TANKDIR in excess of 60 - #------------------------------------------------------------------ - total=`ls -d1 ${TANKDIR}/radmon.* | wc -l` - ((extra=total-61)) - - if [[ $extra -gt 0 ]]; then - `ls -d1 ${TANKDIR}/radmon.* | head -n $extra | xargs rm -rf` - fi - - - #------------------------------------------------------------------ - # Copy the data_map.xml file to the $TOP_ARCHIVE_DIR - #------------------------------------------------------------------ -# if [[ -e ${RADMON_PARM}/data_map.xml ]]; then -# cp -f ${RADMON_PARM}/data_map.xml ${TOP_ARCHIVE_DIR}/. -# fi - -fi - - -exit - diff --git a/util/Radiance_Monitor/image_gen/ush/mk_angle_plots.sh b/util/Radiance_Monitor/image_gen/ush/mk_angle_plots.sh index 80fff5b146..1d8f595606 100755 --- a/util/Radiance_Monitor/image_gen/ush/mk_angle_plots.sh +++ b/util/Radiance_Monitor/image_gen/ush/mk_angle_plots.sh @@ -1,4 +1,4 @@ -#!/bin/ksh +#!/bin/bash #------------------------------------------------------------------ # @@ -10,14 +10,17 @@ # 08/2010 safford initial coding (adapted from angle.sh). #------------------------------------------------------------------ -set -ax date +echo "" echo "Begin mk_angle_plots.sh" +echo "" -export NUM_CYCLES=${NUM_CYCLES:-121} +set -ax export CYCLE_INTERVAL=${CYCLE_INTERVAL:-6} +echo "START_DATE, CYCLE_INTERVAL = ${START_DATE}, ${CYCLE_INTERVAL}" + imgndir=${IMGNDIR}/angle tankdir=${TANKDIR}/angle @@ -25,8 +28,6 @@ if [[ ! -d ${imgndir} ]]; then mkdir -p ${imgndir} fi -#echo Z = $Z - #------------------------------------------------------------------- # Locate/update the control files in $TANKDIR/radmon.$PDY. $PDY # starts at END_DATE and walks back to START_DATE until ctl files @@ -34,7 +35,6 @@ fi # the log file and exit if no ctl files are found. # allmissing=1 -PDY=`echo $PDATE|cut -c1-8` cycdy=$((24/$CYCLE_INTERVAL)) # number cycles per day ndays=$(($NUM_CYCLES/$cycdy)) # number of days in plot period @@ -52,23 +52,20 @@ for type in ${SATYPE}; do if [[ $REGIONAL_RR -eq 1 ]]; then # REGIONAL_RR stores hrs 18-23 in next tdate=`$NDATE +6 ${test_day}` # day's radmon.yyymmdd directory pdy=`echo $test_day|cut -c1-8` + ieee_src=${TANKverf}/radmon.${pdy} else pdy=`echo $test_day|cut -c1-8` - fi - echo "testing with pdy = $pdy" - - if [[ $TANK_USE_RUN -eq 1 ]]; then - ieee_src=${TANKverf}/${RUN}.${PDY}/${CYC}/${MONITOR} + ieee_src=${TANKverf}/${RUN}.${pdy}/${CYC}/${MONITOR} if [[ ! -d ${ieee_src} ]]; then - ieee_src=${TANKverf}/${RUN}.${PDY}/${MONITOR} + ieee_src=${TANKverf}/${RUN}.${pdy}/${MONITOR} fi - else - ieee_src=${TANKverf}/${MONITOR}.${PDY} if [[ ! -d ${ieee_src} ]]; then - ieee_src=${TANKverf}/${RUN}.${PDY} + ieee_src=${TANKverf}/${RUN}.${pdy} fi fi + echo "ieee_src = with pdy = $pdy" + if [[ -s ${ieee_src}/angle.${type}.ctl.${Z} ]]; then $NCP ${ieee_src}/angle.${type}.ctl.${Z} ${imgndir}/${type}.ctl.${Z} if [[ -s ${ieee_src}/angle.${type}_anl.ctl.${Z} ]]; then @@ -102,32 +99,41 @@ done if [[ $allmissing = 1 ]]; then echo ERROR: Unable to plot. All angle control files are missing from ${TANKDIR} for requested date range. - exit + exit 2 fi + #------------------------------------------------------------------- # Update the time definition (tdef) line in the angle control -# files. Conditionally rm "cray_32bit_ieee" from the options line. - +# files. +# for type in ${SATYPE}; do if [[ -s ${imgndir}/${type}.ctl.${Z} ]]; then ${UNCOMPRESS} ${imgndir}/${type}.ctl.${Z} fi ${IG_SCRIPTS}/update_ctl_tdef.sh ${imgndir}/${type}.ctl ${START_DATE} ${NUM_CYCLES} - done +#------------------------------------------------------------------- +# Separate the sources with a large number of channels. These will +# be submitted in dedicated jobs, while the sources with a smaller +# number of channels will be submitted together. +# for sat in ${SATYPE}; do nchanl=`cat ${imgndir}/${sat}.ctl | gawk '/title/{print $NF}'` if [[ $nchanl -lt 100 ]]; then - SATLIST=" $sat $SATLIST " + satlist=" $sat $satlist " else - bigSATLIST=" $sat $bigSATLIST " + big_satlist=" $sat $big_satlist " fi done -${COMPRESS} -f ${imgndir}/*.ctl +echo "" +echo " satlist: ${satlist}" +echo "" +echo " big_satlist: ${big_satlist}" +echo "" #------------------------------------------------------------------- @@ -142,146 +148,107 @@ mkdir -p $PLOT_WORK_DIR cd $PLOT_WORK_DIR - #----------------------------------------------------------------- - # Loop over satellite types. Submit job to make plots. - # - +#----------------------------------------------------------------- +# Loop over satellite types. Submit job to make plots. +# list="count penalty omgnbc total omgbc fixang lapse lapse2 const scangl clw cos sin emiss ordang4 ordang3 ordang2 ordang1" - suffix=a - cmdfile=${PLOT_WORK_DIR}/cmdfile_pangle_${suffix} - jobname=plot_${RADMON_SUFFIX}_ang_${suffix} - logfile=$LOGdir/plot_angle_${suffix}.log +suffix=a +cmdfile=${PLOT_WORK_DIR}/cmdfile_pangle_${suffix} +jobname=plot_${RADMON_SUFFIX}_ang_${suffix} +logfile=${LOGdir}/plot_angle_${suffix}.log - rm -f $cmdfile - rm -f $logfile +rm -f ${cmdfile} +rm -f ${logfile} - rm $LOGdir/plot_angle_${suffix}.log +rm ${LOGdir}/plot_angle_${suffix}.log - #-------------------------------------------------- - # sbatch (slurm) requires a line number added - # to the cmdfile - ctr=0 - for type in ${SATLIST}; do - if [[ ${MY_MACHINE} = "hera" ]]; then - echo "${ctr} $IG_SCRIPTS/plot_angle.sh $type $suffix '$list'" >> $cmdfile +#-------------------------------------------------- +# sbatch (slurm) requires a line number added +# to the cmdfile +ctr=0 +for type in ${satlist}; do - else - echo "$IG_SCRIPTS/plot_angle.sh $type $suffix '$list'" >> $cmdfile - fi - ((ctr=ctr+1)) - done - - chmod 755 $cmdfile - echo "CMDFILE: $cmdfile" - - ntasks=`cat $cmdfile|wc -l ` + if [[ ${MY_MACHINE} = "hera" ]]; then + echo "${ctr} ${IG_SCRIPTS}/plot_angle.sh ${type} ${suffix} '${list}'" >> ${cmdfile} + else + echo "${IG_SCRIPTS}/plot_angle.sh ${type} ${suffix} '${list}'" >> ${cmdfile} + fi + ((ctr=ctr+1)) +done - if [[ $PLOT_ALL_REGIONS -eq 1 || $ndays -gt 30 ]]; then - wall_tm="2:30" - else - wall_tm="1:45" - fi +chmod 755 ${cmdfile} +echo "CMDFILE: ${cmdfile}" - if [[ ${MY_MACHINE} = "wcoss" ]]; then - $SUB -q $JOB_QUEUE -P $PROJECT -o ${logfile} -M 20000 -W ${wall_tm} \ - -R affinity[core] -J ${jobname} -cwd ${PWD} $cmdfile +ntasks=`cat $cmdfile|wc -l ` +wall_tm="0:20" - elif [[ ${MY_MACHINE} = "wcoss_d" ]]; then - $SUB -q $JOB_QUEUE -P $PROJECT -o ${logfile} -M 20000 -W ${wall_tm} \ - -R "affinity[core]" -J ${jobname} -cwd ${PWD} $cmdfile +if [[ ${MY_MACHINE} = "wcoss_d" ]]; then + $SUB -q $JOB_QUEUE -P $PROJECT -o ${logfile} -M 500 -W ${wall_tm} \ + -R "affinity[core]" -J ${jobname} -cwd ${PWD} $cmdfile - elif [[ ${MY_MACHINE} = "hera" ]]; then - $SUB --account ${ACCOUNT} -n $ctr -o ${logfile} -D . -J ${jobname} --time=2:00:00 \ +elif [[ ${MY_MACHINE} = "hera" ]]; then + $SUB --account ${ACCOUNT} -n $ctr -o ${logfile} -D . -J ${jobname} --time=30:00 \ --wrap "srun -l --multi-prog ${cmdfile}" - else # cray - $SUB -q $JOB_QUEUE -P $PROJECT -o ${logfile} -M 600 -W ${wall_tm} \ - -J ${jobname} -cwd ${PWD} $cmdfile - fi +elif [[ ${MY_MACHINE} = "wcoss_c" ]]; then + $SUB -q $JOB_QUEUE -P $PROJECT -o ${logfile} -M 600 -W ${wall_tm} \ + -J ${jobname} -cwd ${PWD} $cmdfile +fi #---------------------------------------------------------------------------- -# bigSATLIST +# big_satlist # # There is so much data for some sat/instrument sources that a separate # job for each is necessary. # -echo "starting $bigSATLIST" - -set -A list count penalty omgnbc total omgbc fixang lapse lapse2 const scangl clw cos sin emiss ordang4 ordang3 ordang2 ordang1 - -for sat in ${bigSATLIST}; do - echo processing $sat in $bigSATLIST - - #-------------------------------------------- - # wcoss submit 4 jobs for each $sat - # - if [[ $MY_MACHINE = "wcoss" || ${MY_MACHINE} = "wcoss_d" || $MY_MACHINE = "cray" ]]; then - batch=1 - - suffix="${sat}_${batch}" - cmdfile=${PLOT_WORK_DIR}/cmdfile_pangle_${suffix} - rm -f $cmdfile - jobname=plot_${RADMON_SUFFIX}_ang_${suffix} - logfile=${LOGdir}/plot_angle_${suffix}.log +echo "starting big_satlist" - ii=0 - while [[ $ii -le ${#list[@]}-1 ]]; do - - echo "$IG_SCRIPTS/plot_angle.sh $sat $suffix ${list[$ii]}" >> $cmdfile - chmod 755 $cmdfile - ntasks=`cat $cmdfile|wc -l ` - echo "ntasks = $ntasks" - - if [[ $PLOT_ALL_REGIONS -eq 1 || $ndays -gt 30 ]]; then - wall_tm="3:00" - else - wall_tm="1:00" - fi +for sat in ${big_satlist}; do + echo processing $sat in $big_satlist - if [[ $MY_MACHINE = "wcoss" ]]; then - mem="24000" - $SUB -q $JOB_QUEUE -P $PROJECT -o ${logfile} -M ${mem} -W ${wall_tm} \ - -R affinity[core] -J ${jobname} -cwd ${PWD} $cmdfile + if [[ ${MY_MACHINE} = "wcoss_d" || $MY_MACHINE = "wcoss_c" ]]; then - elif [[ $MY_MACHINE = "wcoss_d" ]]; then - mem="24000" - $SUB -q $JOB_QUEUE -P $PROJECT -o ${logfile} -M ${mem} -W ${wall_tm} \ - -R "affinity[core]" -J ${jobname} -cwd ${PWD} $cmdfile + cmdfile=${PLOT_WORK_DIR}/cmdfile_pangle_${sat} + if [[ -e ${cmdfile} ]]; then + rm -f $cmdfile + fi + echo "$IG_SCRIPTS/plot_angle.sh $sat $sat ${list}" >> $cmdfile + chmod 755 $cmdfile - else - $SUB -q $JOB_QUEUE -P $PROJECT -o ${logfile} -M 600 -W ${wall_tm} \ - -J ${jobname} -cwd ${PWD} $cmdfile - fi + jobname=plot_${RADMON_SUFFIX}_ang_${sat} + logfile=${LOGdir}/plot_angle_${sat}.log + ntasks=`cat $cmdfile|wc -l ` + echo "ntasks = $ntasks" - (( batch=batch+1 )) + wall_tm="0:30" - suffix="${sat}_${batch}" - cmdfile=${PLOT_WORK_DIR}/cmdfile_pangle_${suffix} - rm -f $cmdfile - jobname=plot_${RADMON_SUFFIX}_ang_${suffix} - logfile=${LOGdir}/plot_angle_${suffix}.log + if [[ $MY_MACHINE = "wcoss_d" ]]; then + mem="12000" + $SUB -q $JOB_QUEUE -P $PROJECT -o ${logfile} -M ${mem} -W ${wall_tm} \ + -R "affinity[core]" -J ${jobname} -cwd ${PWD} $cmdfile - (( ii=ii+1 )) - done + elif [[ $MY_MACHINE = "wcoss_c" ]]; then + $SUB -q $JOB_QUEUE -P $PROJECT -o ${logfile} -M 600 -W ${wall_tm} \ + -J ${jobname} -cwd ${PWD} $cmdfile + fi elif [[ $MY_MACHINE = "hera" ]]; then # hera, submit 1 job for each sat/list item ii=0 - suffix="${sat}" - logfile=${LOGdir}/plot_angle_${suffix}.log - cmdfile=${PLOT_WORK_DIR}/cmdfile_pangle_${suffix} + logfile=${LOGdir}/plot_angle_${sat}.log + cmdfile=${PLOT_WORK_DIR}/cmdfile_pangle_${sat} rm -f $cmdfile - logfile=${LOGdir}/plot_angle_${suffix}.log - jobname=plot_${RADMON_SUFFIX}_ang_${suffix} + logfile=${LOGdir}/plot_angle_${sat}.log + jobname=plot_${RADMON_SUFFIX}_ang_${sat} while [[ $ii -le ${#list[@]}-1 ]]; do - echo "${ii} ${IG_SCRIPTS}/plot_angle.sh $sat $suffix ${list[$ii]}" >> $cmdfile + echo "${ii} ${IG_SCRIPTS}/plot_angle.sh $sat $sat ${list[$ii]}" >> $cmdfile (( ii=ii+1 )) done @@ -293,5 +260,9 @@ for sat in ${bigSATLIST}; do done +echo "" echo "End mk_angle_plots.sh" +echo "" +echo "" + exit diff --git a/util/Radiance_Monitor/image_gen/ush/mk_bcoef_plots.sh b/util/Radiance_Monitor/image_gen/ush/mk_bcoef_plots.sh index e68549c469..c9e823013a 100755 --- a/util/Radiance_Monitor/image_gen/ush/mk_bcoef_plots.sh +++ b/util/Radiance_Monitor/image_gen/ush/mk_bcoef_plots.sh @@ -1,4 +1,4 @@ -#!/bin/ksh +#!/bin/bash #------------------------------------------------------------------ # @@ -12,8 +12,9 @@ set -ax date echo "begin mk_bcoef_plots.sh" -export NUM_CYCLES=${NUM_CYCLES:-121} -export CYCLE_INTERVAL=${CYCLE_INTERVAL:-6} +#export NUM_CYCLES=${NUM_CYCLES:-121} +#export CYCLE_INTERVAL=${CYCLE_INTERVAL:-6} +echo "NUM_CYCLES, CYCLE_INTERVAL = ${NUM_CYCLES}, ${CYCLE_INTERVAL}" imgndir="${IMGNDIR}/bcoef" tankdir="${TANKDIR}/bcoef" @@ -49,18 +50,18 @@ for type in ${SATYPE}; do pdy=`echo $test_day|cut -c1-8` fi - if [[ $TANK_USE_RUN -eq 1 ]]; then - ieee_src=${TANKverf}/${RUN}.${PDY}/${CYC}/${MONITOR} - if [[ ! -d ${ieee_src} ]]; then - ieee_src=${TANKverf}/${RUN}.${PDY}/${MONITOR} - fi - else + ieee_src=${TANKverf}/${RUN}.${PDY}/${CYC}/${MONITOR} + if [[ ! -d ${ieee_src} ]]; then + ieee_src=${TANKverf}/${RUN}.${PDY}/${MONITOR} + fi + if [[ ! -d ${ieee_src} ]]; then + ieee_src=${TANKverf}/${RUN}.${PDY} + fi + if [[ ! -d ${ieee_src} ]]; then ieee_src=${TANKverf}/${MONITOR}.${PDY} - if [[ ! -d ${ieee_src} ]]; then - ieee_src=${TANKverf}/${RUN}.${PDY} - fi fi + if [[ -s ${ieee_src}/bcoef.${type}.ctl.${Z} ]]; then $NCP ${ieee_src}/bcoef.${type}.ctl.${Z} ${imgndir}/${type}.ctl.${Z} if [[ -s ${ieee_src}/bcoef.${type}_anl.ctl.${Z} ]]; then @@ -93,9 +94,8 @@ for type in ${SATYPE}; do done if [[ $allmissing = 1 ]]; then - echo ERROR: Unable to plot. All bcoef control files are missing from ${TANKDIR} for requested - date range. - exit + echo "ERROR: Unable to plot. All bcoef control files are missing from ${TANKDIR} for requested date range." + exit 2 fi @@ -118,15 +118,11 @@ jobname="plot_${RADMON_SUFFIX}_bcoef" logfile="$LOGdir/plot_bcoef.log" rm ${logfile} -if [[ $MY_MACHINE = "wcoss" ]]; then - $SUB -q $JOB_QUEUE -P $PROJECT -o ${logfile} -M 80 -W 1:15 \ - -R affinity[core] -J ${jobname} -cwd ${PWD} $IG_SCRIPTS/plot_bcoef.sh - -elif [[ $MY_MACHINE = "wcoss_d" ]]; then +if [[ $MY_MACHINE = "wcoss_d" ]]; then $SUB -q $JOB_QUEUE -P $PROJECT -o ${logfile} -M 80 -W 1:15 \ -R "affinity[core]" -J ${jobname} -cwd ${PWD} $IG_SCRIPTS/plot_bcoef.sh -elif [[ $MY_MACHINE = "cray" ]]; then +elif [[ $MY_MACHINE = "wcoss_c" ]]; then $SUB -q $JOB_QUEUE -P $PROJECT -o ${logfile} -M 80 -W 1:15 \ -J ${jobname} -cwd ${PWD} $IG_SCRIPTS/plot_bcoef.sh diff --git a/util/Radiance_Monitor/image_gen/ush/mk_bcor_plots.sh b/util/Radiance_Monitor/image_gen/ush/mk_bcor_plots.sh index b385c0dd02..b20ee8cb76 100755 --- a/util/Radiance_Monitor/image_gen/ush/mk_bcor_plots.sh +++ b/util/Radiance_Monitor/image_gen/ush/mk_bcor_plots.sh @@ -14,8 +14,6 @@ set -ax date echo "begin mk_bcor_plots.sh" -export NUM_CYCLES=${NUM_CYCLES:-121} -export CYCLE_INTERVAL=${CYCLE_INTERVAL:-6} imgndir=${IMGNDIR}/bcor tankdir=${TANKDIR}/bcor @@ -26,13 +24,14 @@ fi #------------------------------------------------------------------- -# Locate/update the control files in $TANKDIR/radmon.$PDY. $PDY +# Locate/update the control files in $TANKDIR/radmon.$pdy. $pdy # starts at END_DATE and walks back to START_DATE until ctl files # are found or we run out of dates to check. Report an error to # the log file and exit if no ctl files are found. # allmissing=1 -PDY=`echo $PDATE|cut -c1-8` +pdy=`echo $PDATE|cut -c1-8` +cyc=`echo $PDATE|cut -c9-10` cycdy=$((24/$CYCLE_INTERVAL)) # number cycles per day ndays=$(($NUM_CYCLES/$cycdy)) # number days in plot period @@ -53,15 +52,21 @@ for type in ${SATYPE}; do pdy=`echo $test_day|cut -c1-8` fi - if [[ $TANK_USE_RUN -eq 1 ]]; then - ieee_src=${TANKverf}/${RUN}.${PDY}/${MONITOR} - else - ieee_src=${TANKverf}/${MONITOR}.${PDY} - if [[ ! -d ${ieee_src} ]]; then - ieee_src=${TANKverf}/${RUN}.${PDY} - fi - + ieee_src=${TANKverf}/${RUN}.${pdy}/${cyc}/${MONITOR} + if [[ ! -d ${ieee_src} ]]; then + ieee_src=${TANKverf}/${RUN}.${pdy}/${MONITOR} + fi + if [[ ! -d ${ieee_src} ]]; then + ieee_src=${TANKverf}/${MONITOR}.${pdy} + fi + if [[ ! -d ${ieee_src} ]]; then + ieee_src=${TANKverf}/${RUN}.${pdy} fi + if [[ ! -d ${ieee_src} ]]; then + echo "Unable to locate ieee_src directory, exiting mk_time_plots.sh." + exit 12 + fi + if [[ -s ${ieee_src}/bcor.${type}.ctl.${Z} ]]; then $NCP ${ieee_src}/bcor.${type}.ctl.${Z} ${imgndir}/${type}.ctl.${Z} @@ -90,34 +95,18 @@ for type in ${SATYPE}; do if [[ -s ${imgndir}/${type}.ctl.${Z} || -s ${imgndir}/${type}.ctl ]]; then allmissing=0 found=1 - -# elif [[ -s ${TANKDIR}/radmon.${PDY}/bcor.${type}.ctl || -s ${TANKDIR}/radmon.${PDY}/bcor.${type}.ctl.${Z} ]]; then -# $NCP ${TANKDIR}/radmon.${PDY}/bcor.${type}.ctl.${Z} ${imgndir}/${type}.ctl.${Z} -# if [[ ! -s ${imgndir}/${type}.ctl.${Z} ]]; then -# $NCP ${TANKDIR}/radmon.${PDY}/bcor.${type}.ctl ${imgndir}/${type}.ctl -# fi -# allmissing=0 -# found=1 -# -# elif [[ -s ${tankdir}/${type}.ctl.${Z} || -s ${tankdir}/${type}.ctl ]]; then -# $NCP ${tankdir}/${type}.ctl* ${imgndir}/. -# allmissing=0 -# found=1 -# -# else -# echo WARNING: unable to locate ${type}.ctl fi done if [[ $allmissing = 1 ]]; then echo ERROR: Unable to plot. All bcor control files are missing. - exit + exit 14 fi #------------------------------------------------------------------- # Update the time definition (tdef) line in the bcor control -# files. Conditionally rm cray_32bit_ieee from options line. +# files. for type in ${SATYPE}; do if [[ -s ${imgndir}/${type}.ctl.${Z} ]]; then @@ -142,117 +131,116 @@ ${COMPRESS} ${imgndir}/*.ctl #------------------------------------------------------------------ # Submit plot jobs # +plot_list="count total fixang lapse lapse2 const scangl clw cos sin emiss ordang4 ordang3 ordang2 ordang1" - plot_list="count total fixang lapse lapse2 const scangl clw cos sin emiss ordang4 ordang3 ordang2 ordang1" - - export PLOT_WORK_DIR=${PLOT_WORK_DIR}/plotbcor_${RADMON_SUFFIX} - if [[ -d ${PLOT_WORK_DIR} ]]; then - rm -f ${PLOT_WORK_DIR} - fi - mkdir -p ${PLOT_WORK_DIR} - cd ${PLOT_WORK_DIR} +export PLOT_WORK_DIR=${PLOT_WORK_DIR}/plotbcor_${RADMON_SUFFIX} +if [[ -d ${PLOT_WORK_DIR} ]]; then + rm -f ${PLOT_WORK_DIR} +fi +mkdir -p ${PLOT_WORK_DIR} +cd ${PLOT_WORK_DIR} - #------------------------------------------------------------------------- - # Loop over satellite/instruments. Submit poe job to make plots. Each task handles - # a single satellite/insrument. +#------------------------------------------------------------------------- +# Loop over satellite/instruments. Submit poe job to make plots. Each task handles +# a single satellite/insrument. - suffix=a - cmdfile=cmdfile_pbcor_${suffix} - jobname=plot_${RADMON_SUFFIX}_bcor_${suffix} - logfile=${LOGdir}/plot_bcor_${suffix}.log +suffix=a +cmdfile=cmdfile_pbcor_${suffix} +jobname=plot_${RADMON_SUFFIX}_bcor_${suffix} +logfile=${LOGdir}/plot_bcor_${suffix}.log - rm -f ${cmdfile} - rm -f ${logfile} +rm -f ${cmdfile} +rm -f ${logfile} >$cmdfile - ctr=0 - for sat in ${SATLIST}; do - if [[ $MY_MACHINE = "hera" ]]; then - echo "${ctr} $IG_SCRIPTS/plot_bcor.sh $sat $suffix '$plot_list'" >> $cmdfile - else - echo "$IG_SCRIPTS/plot_bcor.sh $sat $suffix '$plot_list'" >> $cmdfile - fi - ((ctr=ctr+1)) - done - - chmod 755 $cmdfile - - - if [[ $PLOT_ALL_REGIONS -eq 1 || $ndays -gt 30 ]]; then - wall_tm="2:30" - else - wall_tm="0:45" - fi - - if [[ $MY_MACHINE = "wcoss" || $MY_MACHINE = "wcoss_d" ]]; then - $SUB -q $JOB_QUEUE -P $PROJECT -M 80 -R affinity[core] -o ${logfile} \ - -W ${wall_tm} -J ${jobname} -cwd ${PWD} ./$cmdfile - - elif [[ $MY_MACHINE = "cray" ]]; then - $SUB -q $JOB_QUEUE -P $PROJECT -M 80 -o ${logfile} -W ${wall_tm} \ - -J ${jobname} -cwd ${PWD} ./$cmdfile - - elif [[ $MY_MACHINE = "hera" ]]; then - $SUB --account ${ACCOUNT} -n $ctr -o ${logfile} -D . -J ${jobname} \ - --time=2:00:00 --wrap "srun -l --multi-prog ${cmdfile}" - fi - - - #-------------------------------------------------------------------------- - # bigSATLIST - # - # Some satellite/instrument sources have so many channels that a separate - # job to handle each plot type is the fastest solution. - # - #-------------------------------------------------------------------------- - for sat in ${bigSATLIST}; do - echo "processing $sat" - suffix=$sat - - cmdfile=cmdfile_pbcor_${suffix} - jobname=plot_${RADMON_SUFFIX}_bcor_${suffix} - logfile=${LOGdir}/plot_bcor_${suffix}.log - - rm -f $cmdfile - rm ${logfile} +ctr=0 +for sat in ${SATLIST}; do + if [[ $MY_MACHINE = "hera" ]]; then + echo "${ctr} $IG_SCRIPTS/plot_bcor.sh $sat $suffix '$plot_list'" >> $cmdfile + else + echo "$IG_SCRIPTS/plot_bcor.sh $sat $suffix '$plot_list'" >> $cmdfile + fi + ((ctr=ctr+1)) +done + +chmod 755 $cmdfile + + +if [[ $PLOT_ALL_REGIONS -eq 1 || $ndays -gt 30 ]]; then + wall_tm="1:30" +else + wall_tm="0:45" +fi + +if [[ $MY_MACHINE = "wcoss_d" ]]; then + $SUB -q $JOB_QUEUE -P $PROJECT -M 80 -R affinity[core] -o ${logfile} \ + -W ${wall_tm} -J ${jobname} -cwd ${PWD} ./$cmdfile + +elif [[ $MY_MACHINE = "wcoss_c" ]]; then + $SUB -q $JOB_QUEUE -P $PROJECT -M 80 -o ${logfile} -W ${wall_tm} \ + -J ${jobname} -cwd ${PWD} ./$cmdfile + +elif [[ $MY_MACHINE = "hera" ]]; then + $SUB --account ${ACCOUNT} -n $ctr -o ${logfile} -D . -J ${jobname} \ + --time=2:00:00 --wrap "srun -l --multi-prog ${cmdfile}" +fi + + +#-------------------------------------------------------------------------- +# bigSATLIST +# +# Some satellite/instrument sources have so many channels that a separate +# job to handle each plot type is the fastest solution. +# +#-------------------------------------------------------------------------- +for sat in ${bigSATLIST}; do + echo "processing $sat" + suffix=$sat + + cmdfile=cmdfile_pbcor_${suffix} + jobname=plot_${RADMON_SUFFIX}_bcor_${suffix} + logfile=${LOGdir}/plot_bcor_${suffix}.log + + rm -f $cmdfile + rm ${logfile} >$cmdfile - ctr=0 - for var in $plot_list; do - if [[ $MY_MACHINE = "hera" ]]; then - echo "$ctr $IG_SCRIPTS/plot_bcor.sh $sat $var $var" >> $cmdfile - else - echo "$IG_SCRIPTS/plot_bcor.sh $sat $var $var" >> $cmdfile - fi - ((ctr=ctr+1)) - done + ctr=0 + for var in $plot_list; do + if [[ $MY_MACHINE = "hera" ]]; then + echo "$ctr $IG_SCRIPTS/plot_bcor.sh $sat $var $var" >> $cmdfile + else + echo "$IG_SCRIPTS/plot_bcor.sh $sat $var $var" >> $cmdfile + fi + ((ctr=ctr+1)) + done - chmod 755 $cmdfile + chmod 755 $cmdfile - if [[ $PLOT_ALL_REGIONS -eq 1 || $ndays -gt 30 ]]; then - wall_tm="2:30" - else - wall_tm="1:00" - fi + if [[ $PLOT_ALL_REGIONS -eq 1 || $ndays -gt 30 ]]; then + wall_tm="2:30" + else + wall_tm="1:00" + fi - if [[ $MY_MACHINE = "wcoss" || $MY_MACHINE = "wcoss_d" ]]; then - $SUB -q $JOB_QUEUE -P $PROJECT -M 80 -R affinity[core] -o ${logfile} \ - -W ${wall_tm} -J ${jobname} -cwd ${PWD} ./$cmdfile + if [[ $MY_MACHINE = "wcoss_d" ]]; then + $SUB -q $JOB_QUEUE -P $PROJECT -M 80 -R affinity[core] -o ${logfile} \ + -W ${wall_tm} -J ${jobname} -cwd ${PWD} ./$cmdfile - elif [[ $MY_MACHINE = "cray" ]]; then - $SUB -q $JOB_QUEUE -P $PROJECT -M 80 -o ${logfile} -W ${wall_tm} \ - -J ${jobname} -cwd ${PWD} ./$cmdfile + elif [[ $MY_MACHINE = "wcoss_c" ]]; then + $SUB -q $JOB_QUEUE -P $PROJECT -M 80 -o ${logfile} -W ${wall_tm} \ + -J ${jobname} -cwd ${PWD} ./$cmdfile - elif [[ $MY_MACHINE = "hera" ]]; then - $SUB --account ${ACCOUNT} -n $ctr -o ${logfile} -D . -J ${jobname} \ - --time=1:00:00 --wrap "srun -l --multi-prog ${cmdfile}" + elif [[ $MY_MACHINE = "hera" ]]; then + $SUB --account ${ACCOUNT} -n $ctr -o ${logfile} -D . -J ${jobname} \ + --time=1:00:00 --wrap "srun -l --multi-prog ${cmdfile}" - fi + fi - echo "submitted $sat" - done + echo "submitted $sat" +done - echo "end mk_bcor_plots.sh" -exit +echo "end mk_bcor_plots.sh" +exit 0 diff --git a/util/Radiance_Monitor/image_gen/ush/mk_comp_plots.sh b/util/Radiance_Monitor/image_gen/ush/mk_comp_plots.sh deleted file mode 100755 index 737e31aba9..0000000000 --- a/util/Radiance_Monitor/image_gen/ush/mk_comp_plots.sh +++ /dev/null @@ -1,157 +0,0 @@ -#!/bin/ksh - -#------------------------------------------------------------------- -# -# script: mk_comp_plots.sh -# -# submit plot jobs to make the comparison images. -# -#------------------------------------------------------------------- - -set -ax - -echo start mk_comp_plots.sh -date - -cd $PLOT_WORK_DIR -echo sdate = $SDATE, edate = $EDATE - -CYCLES=`${IG_SCRIPTS}/cycle_delta.pl ${SDATE} ${EDATE}` -export NUM_CYCLES=`expr $CYCLES + 1` - -echo NUM_CYCLES = $NUM_CYCLES - -imgndir1=${IMGNDIR}/${SUFFIX1}/pngs/comp -echo imgndir1 = $imgndir1 -imgndir2=${IMGNDIR}/${SUFFIX2}/pngs/comp -echo imgndir2 = $imgndir2 - -tankdir1=${TANKDIR}/${SUFFIX1} -echo tankdir1 = $tankdir1 -tankdir2=${TANKDIR}/${SUFFIX2} -echo tankdir2 = $tankdir2 - -if [[ ! -d ${imgndir1} ]]; then - mkdir -p ${imgndir1} -fi -if [[ ! -d ${imgndir2} ]]; then - mkdir -p ${imgndir2} -fi - -#------------------------------------------------------------------- -# Locate/update the control files. If no ctl file is available -# report a warning to the log file. Search order is $imgndir, -# the $TANKDIR/radmon.$PDY, then $tankdir. -# Note that the comparision plots use the time data and control -# files. - -allmissing=1 -PDY=`echo $EDATE|cut -c1-8` -ndays=$(($NUM_CYCLES/4)) -test_day=$EDATE - -for type in ${SATYPE}; do - found=0 - alldone=0 - test_day=$EDATE - ctr=$ndays - - while [[ $found -eq 0 && $alldone -ne 1 ]]; do - pdy=`echo $test_day|cut -c1-8` - if [[ -s ${TANKDIR1}/radmon.${pdy}/time.${type}.ctl.${Z} ]]; then - $NCP ${TANKDIR1}/radmon.${pdy}/time.${type}.ctl.${Z} ${imgndir1}/${type}.ctl.${Z} - found=1 - elif [[ -s ${TANKDIR1}/radmon.${pdy}/time.${type}.ctl ]]; then - $NCP ${TANKDIR1}/radmon.${pdy}/time.${type}.ctl ${imgndir1}/${type}.ctl - found=1 - fi - - if [[ $found -eq 0 ]]; then - if [[ $ctr -gt 0 ]]; then - test_day=`$NDATE -24 ${pdy}00` - ctr=$(($ctr-1)) - else - alldone=1 - fi - fi - done - - if [[ -s ${imgndir1}/${type}.ctl.${Z} || -s ${imgndir1}/${type}.ctl ]]; then - allmissing=0 - found=1 - fi -done - -if [[ $allmissing = 1 ]]; then - echo ERROR: Unable to plot. All time control files are missing. - exit -fi - - -#------------------------------------------------------------------- -# Copy all control files to $WORK_DIR. -# -# Update the time definition (tdef) line in the local control -# files and conditionally remove cray_32bit_ieee from the options line. - - for type in ${SATYPE}; do - $NCP ${imgndir1}/${type}.ctl* ${PLOT_WORK_DIR}/. - ${UNCOMPRESS} ${PLOT_WORK_DIR}/${type}.ctl.${Z} - - ${IG_SCRIPTS}/update_ctl_tdef.sh ${PLOT_WORK_DIR}/${type}.ctl ${SDATE} ${NUM_CYCLES} - - if [[ $MY_MACHINE = "wcoss" || $MY_MACHINE = "hera" || $MY_MACHINE = "theia" ]]; then - sed -e 's/cray_32bit_ieee/ /' ${PLOT_WORK_DIR}/${type}.ctl > ${PLOT_WORK_DIR}/tmp_${type}.ctl - sed -s 's/\^/\'"^${SUFFIX1}."'/1' ${PLOT_WORK_DIR}/tmp_${type}.ctl > ${PLOT_WORK_DIR}/${SUFFIX1}.${type}.ctl - sed -s 's/\^/\'"^${SUFFIX2}."'/1' ${PLOT_WORK_DIR}/tmp_${type}.ctl > ${PLOT_WORK_DIR}/${SUFFIX2}.${type}.ctl - - rm ${type}.ctl - rm tmp_${type}.ctl - fi - done - -# for sat in ${SATYPE}; do -# nchanl=`cat ${imgndir}/${sat}.ctl | gawk '/title/{print $NF}'` -# if [[ $nchanl -ge 100 ]]; then -# bigSATLIST=" $sat $bigSATLIST " -# else -# SATLIST=" $sat $SATLIST " -# fi -# done - - -#------------------------------------------------------------------- -# -# Submit the comparison plot jobs. -# -#------------------------------------------------------------------- - -# cmdfile=${PLOT_WORK_DIR}/cmdfile_pcomp - jobname=plot_${SUFFIX1}_comp - logfile=${LOGdir}/plot_${SUFFIX1}_comp.log - -# rm -f $cmdfile - rm ${logfile} - -#>$cmdfile -# for type in ${SATYPE}; do -# echo "$SCRIPTS/plot_comp.sh $type" >> $cmdfile -# done -# -# ntasks=`cat $cmdfile|wc -l ` -# ((nprocs=(ntasks+1)/2)) - - if [[ $MY_MACHINE = "wcoss" ]]; then - $SUB -q $JOB_QUEUE -P $PROJECT -M 40 -R affinity[core] -o ${logfile} \ - -W 0:20 -J ${jobname} -cwd ${PWD} $IG_SCRIPTS/plot_comp.sh - elif [[ $MY_MACHINE = "cray" ]]; then - $SUB -q $JOB_QUEUE -P $PROJECT -M 40 -o ${logfile} -W 0:20 \ - -J ${jobname} -cwd ${PWD} $IG_SCRIPTS/plot_comp.sh - elif [[ $MY_MACHINE = "hera" || $MY_MACHINE = "theia" ]]; then - $SUB -A $ACCOUNT -l procs=1,walltime=0:30:00 -N ${jobname} \ - -V -j oe -o ${logfile} $IG_SCRIPTS/plot_comp.sh - fi - -echo end mk_comp_plots.sh - -exit diff --git a/util/Radiance_Monitor/image_gen/ush/nu_plot_angle.sh b/util/Radiance_Monitor/image_gen/ush/mk_digital_ang.sh similarity index 66% rename from util/Radiance_Monitor/image_gen/ush/nu_plot_angle.sh rename to util/Radiance_Monitor/image_gen/ush/mk_digital_ang.sh index 23a3440136..73eb257056 100755 --- a/util/Radiance_Monitor/image_gen/ush/nu_plot_angle.sh +++ b/util/Radiance_Monitor/image_gen/ush/mk_digital_ang.sh @@ -1,40 +1,56 @@ -#! /bin/ksh +#! /bin/bash #------------------------------------------------------------------ # -# nu_plot_angle.sh +# mk_digital_ang.sh # -# This is designed to be called by the existing plot_angle.sh -# script. It produces [satype].[n].[ang_type].time.txt and one [satype].chan.txt -# files for each satype in the input SATYPE_LIST parameter. These -# files are then moved to the IMGNDIR/angle directory where they will -# eventually be mirrored to the webserver. +# This script is to be called by plot_angle.sh. It produces +# the following text files containing digital data for the +# js/html files to build images: +# [satype].[chan].[ang_plot_type].time.txt +# [satype].chan.txt +# +# These files are then moved to the IMGNDIR/angle directory where +# they will be mirrored to the webserver by the transfer scripts. # # Algorithm: # 1) Build these files: # input (namelist) -# times.txt (times of data files, newest to oldest, 1 per line, no delimiters) +# times.txt (times of data files, newest to oldest, 1 per +# line, no delimiters) # -# 2) Copy the chan.txt from the time directory and modify the ncycles (line 1) -# to nsteps. +# 2) Copy the chan.txt from the time directory and modify the +# ncycles (line 1) to nsteps. # -# 3) Run angle.x out +# 3) Run radmon_ig_angle.x out # # 4) Move [sat].[n].[ang_type].times.txt to ~/imgn/[source]/pngs/angle #------------------------------------------------------------------ + + +#------------------------------------------------------------ +# function large_mv() +# +# Requires subdirectory argument. +# +# In some cases there are too many files to load into a +# single command without exceeding the machine's argument +# limit. This function circumvents that problem. +#------------------------------------------------------------ +function large_mv () { + while read imgf; do + if [[ -s $imgf ]]; then + mv $imgf ${IMGNDIR}/$1/. + fi + done +} + + set -ax SATYPE_LIST=$1 -echo "Starting nu_plot_angle.sh" - -#-------------------------------------------- -# Make sure image repository exists. -# This is used to mirror to the web server. -# -if [[ ! -d ${IMGNDIR}/angle ]]; then - mkdir -p ${IMGNDIR}/angle -fi +echo "Starting mk_digital_ang.sh" #---------------------------------- @@ -59,6 +75,12 @@ tmp="tmp.txt" # copy over the scaninfo file # scaninfo="scaninfo.txt" +scaninfo_loc=${HOMEgdas/fix/gdas_radmon_scaninfo.txt} +if [[ ! -e ${scaninfo_loc} ]]; then + echo "Unable to locate scaninfo file: ${scaninfo_loc}" + exit 4 +fi + $NCP $HOMEgdas/fix/gdas_radmon_scaninfo.txt $scaninfo @@ -133,13 +155,13 @@ EOF #------------------------------ # mv output files to IMGNDIR # - cp -f ${type}.*.angle.txt ${IMGNDIR}/angle/. - cp -f ${type}.chan.txt ${IMGNDIR}/angle/. - cp -f ${type}.*.time.txt ${IMGNDIR}/time/. + ls -1 ${type}.*.angle.txt | large_mv angle + mv -f ${type}.chan.txt ${IMGNDIR}/angle/. + ls -1 ${type}.*.time.txt | large_mv time done -echo "Exiting nu_plot_angle.sh" +echo "Exiting mk_digital_ang.sh" exit diff --git a/util/Radiance_Monitor/image_gen/ush/nu_plot_bcoef.sh b/util/Radiance_Monitor/image_gen/ush/mk_digital_bcoef.sh similarity index 76% rename from util/Radiance_Monitor/image_gen/ush/nu_plot_bcoef.sh rename to util/Radiance_Monitor/image_gen/ush/mk_digital_bcoef.sh index ed1ce87b18..9db936a719 100755 --- a/util/Radiance_Monitor/image_gen/ush/nu_plot_bcoef.sh +++ b/util/Radiance_Monitor/image_gen/ush/mk_digital_bcoef.sh @@ -1,14 +1,12 @@ -#! /bin/ksh +#! /bin/bash #------------------------------------------------------------------ # -# nu_plot_bcoef.sh +# mk_digital_bcoef.sh # -# This is designed to be called by the existing plot_bcoef.sh -# script. It produces [satype].[n].time.txt files for each -# in the input SATYPE_LIST parameter. These files are then moved -# to the IMGNDIR/time directory where they will eventually be -# mirrored to the webserver. +# This script is to be called by plot_bcoef.sh. It produces +# [satype].[n].time.txt files for each in the input SATYPE_LIST. +# These files are then moved to the IMGNDIR/time directory. # # Algorithm: # 1) Build these files: @@ -23,18 +21,9 @@ set -ax SATYPE_LIST=$1 -echo "Starting nu_plot_bcoef.sh" +echo "Starting mk_digital_bcoef" echo " SATYPE_LIST = $1" -#-------------------------------------------- -# Make sure image repository exists. -# This is used to mirror to the web server. -# -#if [[ ! -d ${IMGNDIR}/time ]]; then -# mkdir -p ${IMGNDIR}/time -#fi - - #---------------------------------- # copy bcoef executable locally # @@ -104,6 +93,6 @@ EOF done -echo "Exiting nu_plot_bcoef.sh" +echo "Exiting mk_digital_bcoef" exit diff --git a/util/Radiance_Monitor/image_gen/ush/nu_plot_time.sh b/util/Radiance_Monitor/image_gen/ush/mk_digital_time.sh similarity index 85% rename from util/Radiance_Monitor/image_gen/ush/nu_plot_time.sh rename to util/Radiance_Monitor/image_gen/ush/mk_digital_time.sh index 68722d6484..35c8e8f831 100755 --- a/util/Radiance_Monitor/image_gen/ush/nu_plot_time.sh +++ b/util/Radiance_Monitor/image_gen/ush/mk_digital_time.sh @@ -1,14 +1,13 @@ -#! /bin/ksh +#! /bin/bash #------------------------------------------------------------------ # -# nu_plot_time.sh +# mk_digital_time.sh # -# This is designed to be called by the existing plot_time.sh -# script. It produces [satype].[n].time.txt and one [satype].chan.txt -# files for each satype in the input SATYPE_LIST parameter. These -# files are then moved to the IMGNDIR/time directory where they will -# eventually be mirrored to the webserver. +# This script is called by plot_time.sh. It produces +# [satype].[n].time.txt and one [satype].chan.txt files for each +# satype in the input SATYPE_LIST parameter. The files are then +# moved to the IMGNDIR/time directory. # # Algorithm: # 1) Build these files: @@ -25,7 +24,7 @@ set -ax SATYPE_LIST=$1 -echo "Starting nu_plot_time.sh" +echo "Starting mk_digital_time.sh" echo " SATYPE_LIST = $1" #-------------------------------------------- @@ -126,12 +125,12 @@ EOF #------------------------------ # mv output files to IMGNDIR - cp -f ${type}.*.time.txt ${IMGNDIR}/time/. - cp -f ${type}.chan.txt ${IMGNDIR}/time/. + mv -f ${type}.*.time.txt ${IMGNDIR}/time/. + mv -f ${type}.chan.txt ${IMGNDIR}/time/. done -echo "Exiting nu_plot_time.sh" +echo "Exiting mk_digital_time.sh" exit diff --git a/util/Radiance_Monitor/image_gen/ush/mk_horiz_plots.sh b/util/Radiance_Monitor/image_gen/ush/mk_horiz_plots.sh index bed88986fc..a49e54b2d1 100755 --- a/util/Radiance_Monitor/image_gen/ush/mk_horiz_plots.sh +++ b/util/Radiance_Monitor/image_gen/ush/mk_horiz_plots.sh @@ -4,6 +4,13 @@ # # mk_horiz_plots.sh # +# NOTE: Horiz plots were turned off by default somewhere around 2014. +# This script has been retained in case horiz plots are someday deemed +# worth the space and time, but note that the extraction executable which +# this script runs has not been updated to handle NetCDF formatted radstat +# files. I suspect that, if horiz plots are to be made in the future, +# Python will be the means to that end. +# -- E. Safford, 2/8/2021 #--------------------------------------------------------------------------- echo start mk_horiz_plots.sh @@ -119,7 +126,7 @@ fi for sat in ${SATYPE}; do - if [[ $MY_MACHINE = "wcoss" || $MY_MACHINE = "hera" || $MY_MACHINE = "theia" ]]; then + if [[ $MY_MACHINE = "wcoss_d" || $MY_MACHINE = "hera" || $MY_MACHINE = "wcoss_c" ]]; then sed -e 's/cray_32bit_ieee/ /' ${sat}.ctl > tmp_${type}.ctl mv -f tmp_${type}.ctl ${sat}.ctl fi @@ -153,7 +160,7 @@ done # submit the plot jobs # -if [[ $MY_MACHINE = "wcoss" || $MY_MACHINE = "cray" ]]; then +if [[ $MY_MACHINE = "wcoss_d" || $MY_MACHINE = "wcoss_c" ]]; then cmdfile="./cmdfile_horiz_${RADMON_SUFFIX}_${PID}" logfile=${LOGdir}/horiz_${PID}.log rm -f $cmdfile @@ -167,7 +174,7 @@ if [[ $MY_MACHINE = "wcoss" || $MY_MACHINE = "cray" ]]; then ntasks=`cat $cmdfile|wc -l` jobname=plot_${RADMON_SUFFIX}_hrz_${PID} - if [[ $MY_MACHINE = "wcoss" ]]; then + if [[ $MY_MACHINE = "wcoss_d" ]]; then $SUB -q $JOB_QUEUE -P $PROJECT -R affinity[core] -M 500 -o ${logfile} \ -W 0:45 -J ${jobname} -cwd ${PWD} $cmdfile else @@ -175,7 +182,7 @@ if [[ $MY_MACHINE = "wcoss" || $MY_MACHINE = "cray" ]]; then -J ${jobname} -cwd ${PWD} $cmdfile fi -else # zeus/linux +else # hera for sat in ${SATLIST}; do jobname=horiz_${sat} cmdfile="./cmdfile_horiz_${RADMON_SUFFIX}_${sat}" @@ -210,10 +217,10 @@ for sat in ${bigSATLIST}; do ntasks=`cat $cmdfile|wc -l` jobname=plot_${RADMON_SUFFIX}_hrz_${PID} - if [[ $MY_MACHINE = "wcoss" ]]; then + if [[ $MY_MACHINE = "wcoss_d" ]]; then $SUB -q $JOB_QUEUE -P $PROJECT -R affinity[core] -M 500 -o ${logfile} \ -W 2:45 -J ${jobname} -cwd ${PWD} $cmdfile - elif [[ $MY_MACHINE = "cray" ]]; then + elif [[ $MY_MACHINE = "wcoss_c" ]]; then $SUB -q $JOB_QUEUE -P $PROJECT -M 500 -o ${logfile} -W 2:45 \ -J ${jobname} -cwd ${PWD} $cmdfile else @@ -221,7 +228,6 @@ for sat in ${bigSATLIST}; do -V -j oe -o $LOGdir/horiz_${PID}.log $cmdfile fi -# -------- PID="${sat}_2" cmdfile="./cmdfile_horiz_${RADMON_SUFFIX}_${PID}" export PTYPE="obsges obsnbc" @@ -234,10 +240,10 @@ for sat in ${bigSATLIST}; do ntasks=`cat $cmdfile|wc -l` jobname=plot_${RADMON_SUFFIX}_hrz_${PID} - if [[ $MY_MACHINE = "wcoss" ]]; then + if [[ $MY_MACHINE = "wcoss_d" ]]; then $SUB -q $JOB_QUEUE -P $PROJECT -R affinity[core] -M 500 -o ${logfile} \ -W 2:45 -J ${jobname} -cwd ${PWD} $cmdfile - elif [[ $MY_MACHINE = "cray" ]]; then + elif [[ $MY_MACHINE = "wcoss_c" ]]; then $SUB -q $JOB_QUEUE -P $PROJECT -M 500 -o ${logfile} -W 2:45 \ -J ${jobname} -cwd ${PWD} $cmdfile else diff --git a/util/Radiance_Monitor/image_gen/ush/mk_time_plots.sh b/util/Radiance_Monitor/image_gen/ush/mk_time_plots.sh index 7ef701a56c..548b278902 100755 --- a/util/Radiance_Monitor/image_gen/ush/mk_time_plots.sh +++ b/util/Radiance_Monitor/image_gen/ush/mk_time_plots.sh @@ -1,4 +1,4 @@ -#!/bin/ksh +#!/bin/bash #------------------------------------------------------------------- # @@ -8,14 +8,11 @@ # #------------------------------------------------------------------- -set -ax date echo Start mk_time_plots.sh -echo USE_ANL = $USE_ANL -export NUM_CYCLES=${NUM_CYCLES:-121} -export CYCLE_INTERVAL=${CYCLE_INTERVAL:-6} +set -ax imgndir=${IMGNDIR}/time tankdir=${TANKDIR}/time @@ -27,10 +24,11 @@ fi #------------------------------------------------------------------- # Locate/update the control files. If no ctl file is available # report a warning to the log file. Search order is $imgndir, -# the $TANKDIR/radmon.$PDY, then $tankdir. +# the $TANKDIR/radmon.$pdy, then $tankdir. # allmissing=1 -PDY=`echo $PDATE|cut -c1-8` +pdy=`echo $PDATE|cut -c1-8` +cyc=`echo $PDATE|cut -c9-10` cycdy=$((24/$CYCLE_INTERVAL)) # number cycles per day ndays=$(($NUM_CYCLES/$cycdy)) # number days in plot period @@ -43,7 +41,8 @@ for type in ${SATYPE}; do test_day=$PDATE ctr=$ndays - while [[ found -eq 0 && $finished -ne 1 ]]; do + while [[ ${found} -eq 0 && $finished -ne 1 ]]; do + if [[ $REGIONAL_RR -eq 1 ]]; then # REGIONAL_RR stores hrs 18-23 in next tdate=`$NDATE +6 ${test_day}` # day's radmon.yyymmdd directory pdy=`echo $test_day|cut -c1-8` @@ -51,17 +50,15 @@ for type in ${SATYPE}; do pdy=`echo $test_day|cut -c1-8` fi - if [[ $TANK_USE_RUN -eq 1 ]]; then - ieee_src=${TANKverf}/${RUN}.${PDY}/${CYC}/${MONITOR} - if [[ ! -d ${ieee_src} ]]; then - ieee_src=${TANKverf}/${RUN}.${PDY}/${MONITOR} - fi - else - ieee_src=${TANKverf}/${MONITOR}.${PDY} - if [[ ! -d ${ieee_src} ]]; then - ieee_src=${TANKverf}/${RUN}.${PDY} - fi - + ieee_src=${TANKverf}/${RUN}.${pdy}/${cyc}/${MONITOR} + if [[ ! -d ${ieee_src} ]]; then + ieee_src=${TANKverf}/${RUN}.${pdy}/${MONITOR} + fi + if [[ ! -d ${ieee_src} ]]; then + ieee_src=${TANKverf}/${RUN}.${pdy} + fi + if [[ ! -d ${ieee_src} ]]; then + ieee_src=${TANKverf}/${MONITOR}.${pdy} fi if [[ -s ${ieee_src}/time.${type}.ctl.${Z} ]]; then @@ -78,7 +75,7 @@ for type in ${SATYPE}; do found=1 fi - if [[ $found -eq 0 ]]; then + if [[ ${found} -eq 0 ]]; then if [[ $ctr -gt 0 ]]; then test_day=`$NDATE -24 ${pdy}00` ctr=$(($ctr-1)) @@ -102,30 +99,29 @@ fi #------------------------------------------------------------------- # Update the time definition (tdef) line in the time control -# files. Conditionally remove cray_32bit_ieee from the options line. - - - for type in ${SATYPE}; do - if [[ -s ${imgndir}/${type}.ctl.${Z} ]]; then - ${UNCOMPRESS} ${imgndir}/${type}.ctl.${Z} - fi - ${IG_SCRIPTS}/update_ctl_tdef.sh ${imgndir}/${type}.ctl ${START_DATE} ${NUM_CYCLES} +# files. +# +for type in ${SATYPE}; do + if [[ -s ${imgndir}/${type}.ctl.${Z} ]]; then + ${UNCOMPRESS} ${imgndir}/${type}.ctl.${Z} + fi + ${IG_SCRIPTS}/update_ctl_tdef.sh ${imgndir}/${type}.ctl ${START_DATE} ${NUM_CYCLES} - if [[ -s ${imgndir}/${type}_anl.ctl ]]; then - ${IG_SCRIPTS}/update_ctl_tdef.sh ${imgndir}/${type}_anl.ctl ${START_DATE} ${NUM_CYCLES} - fi - done + if [[ -s ${imgndir}/${type}_anl.ctl ]]; then + ${IG_SCRIPTS}/update_ctl_tdef.sh ${imgndir}/${type}_anl.ctl ${START_DATE} ${NUM_CYCLES} + fi +done - for sat in ${SATYPE}; do - nchanl=`cat ${imgndir}/${sat}.ctl | gawk '/title/{print $NF}'` - if [[ $nchanl -ge 100 ]]; then - bigSATLIST=" $sat $bigSATLIST " - else - SATLIST=" $sat $SATLIST " - fi - done +for sat in ${SATYPE}; do + nchanl=`cat ${imgndir}/${sat}.ctl | gawk '/title/{print $NF}'` + if [[ $nchanl -ge 100 ]]; then + bigSATLIST=" $sat $bigSATLIST " + else + SATLIST=" $sat $SATLIST " + fi +done - ${COMPRESS} ${imgndir}/*.ctl +${COMPRESS} ${imgndir}/*.ctl #------------------------------------------------------------------- @@ -135,22 +131,23 @@ fi # #------------------------------------------------------------------- - jobname=plot_${RADMON_SUFFIX}_sum - logfile=${LOGdir}/plot_summary.log - rm ${logfile} +jobname=plot_${RADMON_SUFFIX}_sum +logfile=${LOGdir}/plot_summary.log +rm ${logfile} - if [[ $MY_MACHINE = "wcoss" || $MY_MACHINE = "wcoss_d" ]]; then - $SUB -q $JOB_QUEUE -P $PROJECT -M 100 -R affinity[core] -o ${logfile} \ - -W 1:00 -J ${jobname} -cwd ${PWD} $IG_SCRIPTS/plot_summary.sh +if [[ ${MY_MACHINE} = "wcoss_d" ]]; then + ${SUB} -q ${JOB_QUEUE} -P ${PROJECT} -M 100 -R affinity[core] -o ${logfile} \ + -W 1:00 -J ${jobname} -cwd ${PWD} ${IG_SCRIPTS}/plot_summary.sh - elif [[ $MY_MACHINE = "cray" ]]; then - $SUB -q $JOB_QUEUE -P $PROJECT -M 100 -o ${logfile} -W 1:00 \ - -J ${jobname} -cwd ${PWD} $IG_SCRIPTS/plot_summary.sh +elif [[ ${MY_MACHINE} = "wcoss_c" ]]; then + ${SUB} -q ${JOB_QUEUE} -P ${PROJECT} -M 100 -o ${logfile} -W 1:00 \ + -J ${jobname} -cwd ${PWD} ${IG_SCRIPTS}/plot_summary.sh + +elif [[ ${MY_MACHINE} = "hera" ]]; then + ${SUB} --account ${ACCOUNT} --ntasks=1 --mem=5g --time=1:00:00 -J ${jobname} \ + -o ${logfile} ${IG_SCRIPTS}/plot_summary.sh +fi - elif [[ $MY_MACHINE = "hera" ]]; then - $SUB --account $ACCOUNT --ntasks=1 --mem=5g --time=1:00:00 -J ${jobname} \ - -o ${logfile} $IG_SCRIPTS/plot_summary.sh - fi #------------------------------------------------------------------- #------------------------------------------------------------------- @@ -164,64 +161,63 @@ fi #------------------------------------------------------------------- # Rename PLOT_WORK_DIR to time subdir. # - export PLOT_WORK_DIR="${PLOT_WORK_DIR}/plottime_${RADMON_SUFFIX}" - if [ -d $PLOT_WORK_DIR ] ; then - rm -f $PLOT_WORK_DIR - fi - mkdir -p $PLOT_WORK_DIR - cd $PLOT_WORK_DIR +export PLOT_WORK_DIR="${PLOT_WORK_DIR}/plottime_${RADMON_SUFFIX}" +if [ -d $PLOT_WORK_DIR ] ; then + rm -f $PLOT_WORK_DIR +fi +mkdir -p $PLOT_WORK_DIR +cd $PLOT_WORK_DIR - list="count penalty omgnbc total omgbc" +list="count penalty omgnbc total omgbc" #------------------------------------------------------------------- -# Look over satellite types. Submit plot job for each type. +# Build command file and submit plot job for intruments not on +# the bigSAT list. # - if [[ $MY_MACHINE = "wcoss" || $MY_MACHINE = "wcoss_d" || \ - $MY_MACHINE = "cray" || $MY_MACHINE = "theia" ]]; then - suffix=a - cmdfile=${PLOT_WORK_DIR}/cmdfile_ptime_${suffix} - jobname=plot_${RADMON_SUFFIX}_tm_${suffix} - logfile=${LOGdir}/plot_time_${suffix}.log + suffix=a + cmdfile=${PLOT_WORK_DIR}/cmdfile_ptime_${suffix} + jobname=plot_${RADMON_SUFFIX}_tm_${suffix} + logfile=${LOGdir}/plot_time_${suffix}.log - rm -f $cmdfile - rm ${logfile} + rm -f $cmdfile + rm ${logfile} >$cmdfile - ctr=0 - - for sat in ${SATLIST}; do - if [[ ${MY_MACHINE} = "theia" ]]; then - echo "${ctr} $IG_SCRIPTS/plot_time.sh $sat $suffix '$list'" >> $cmdfile - else - echo "$IG_SCRIPTS/plot_time.sh $sat $suffix '$list'" >> $cmdfile - fi - ((ctr=ctr+1)) - done + ctr=0 - chmod 755 $cmdfile - - if [[ $PLOT_ALL_REGIONS -eq 1 || $ndays -gt 30 ]]; then - wall_tm="2:30" + for sat in ${SATLIST}; do + if [[ ${MY_MACHINE} = "hera" ]]; then + echo "${ctr} $IG_SCRIPTS/plot_time.sh $sat $suffix '$list'" >> $cmdfile else - wall_tm="0:45" + echo "$IG_SCRIPTS/plot_time.sh $sat $suffix '$list'" >> $cmdfile fi + ((ctr=ctr+1)) + done - if [[ $MY_MACHINE = "wcoss" || $MY_MACHINE = "wcoss_d" ]]; then - $SUB -q $JOB_QUEUE -P $PROJECT -M 500 -R affinity[core] -o ${logfile} \ - -W ${wall_tm} -J ${jobname} -cwd ${PWD} ${cmdfile} + chmod 755 $cmdfile - elif [[ $MY_MACHINE = "theia" ]]; then - $SUB --account ${ACCOUNT} -n $ctr -o ${logfile} -D . -J ${jobname} --time=1:00:00 \ - --wrap "srun -l --multi-prog ${cmdfile}" + if [[ $PLOT_ALL_REGIONS -eq 1 || $ndays -gt 30 ]]; then + wall_tm="2:30" + else + wall_tm="0:45" + fi - else - $SUB -q $JOB_QUEUE -P $PROJECT -M 500 -o ${logfile} -W ${wall_tm} \ - -J ${jobname} -cwd ${PWD} ${cmdfile} - fi - + if [[ $MY_MACHINE = "wcoss_d" ]]; then + $SUB -q $JOB_QUEUE -P $PROJECT -M 500 -R affinity[core] -o ${logfile} \ + -W ${wall_tm} -J ${jobname} -cwd ${PWD} ${cmdfile} + + elif [[ $MY_MACHINE = "hera" ]]; then + echo "using ctr = ${ctr}" + $SUB --account ${ACCOUNT} -n ${ctr} -o ${logfile} -D . -J ${jobname} --time=1:00:00 \ + --wrap "srun -l --multi-prog ${cmdfile}" + + elif [[ ${MY_MACHINE} = "wcoss_c" ]]; then + $SUB -q $JOB_QUEUE -P $PROJECT -M 500 -o ${logfile} -W ${wall_tm} \ + -J ${jobname} -cwd ${PWD} ${cmdfile} fi + #--------------------------------------------------------------------------- @@ -233,55 +229,43 @@ fi #--------------------------------------------------------------------------- for sat in ${bigSATLIST}; do - list="penalty count omgnbc total omgbc" + cmdfile=${PLOT_WORK_DIR}/cmdfile_ptime_${sat} + jobname=plot_${RADMON_SUFFIX}_tm_${sat} + logfile=${LOGdir}/plot_time_${sat}.log - if [[ $MY_MACHINE = "wcoss" || $MY_MACHINE = "wcoss_d" || $MY_MACHINE = "cray" ]]; then - cmdfile=${PLOT_WORK_DIR}/cmdfile_ptime_${sat} - jobname=plot_${RADMON_SUFFIX}_tm_${sat} - logfile=${LOGdir}/plot_time_${sat}.log - - rm -f ${logfile} - rm -f ${cmdfile} - - for var in $list; do - echo "$IG_SCRIPTS/plot_time.sh $sat $var $var" >> $cmdfile - done - chmod 755 $cmdfile + rm -f ${logfile} + rm -f ${cmdfile} - if [[ $PLOT_ALL_REGIONS -eq 1 || $ndays -gt 30 ]]; then - wall_tm="2:30" + ctr=0 + for var in $list; do + if [[ ${MY_MACHINE} = "hera" ]]; then + echo "${ctr} $IG_SCRIPTS/plot_time.sh $sat $var $var" >> $cmdfile else - wall_tm="1:00" - fi - if [[ $MY_MACHINE = "wcoss" || $MY_MACHINE = "wcoss_d" ]]; then - $SUB -q $JOB_QUEUE -P $PROJECT -M 500 -R affinity[core] -o ${logfile} \ - -W ${wall_tm} -J ${jobname} -cwd ${PWD} ${cmdfile} - else - $SUB -q $JOB_QUEUE -P $PROJECT -M 500 -o ${logfile} -W ${wall_tm} \ - -J ${jobname} -cwd ${PWD} ${cmdfile} + echo "$IG_SCRIPTS/plot_time.sh $sat $var $var" >> $cmdfile fi + ((ctr=ctr+1)) + done + chmod 755 $cmdfile - elif [[ $MY_MACHINE = "theia" ]]; then - - echo "bigSAT, theia, list = $list" - - cmdfile=${PLOT_WORK_DIR}/cmdfile_ptime_${sat} - jobname=plot_${RADMON_SUFFIX}_tm_${sat} - logfile=${LOGdir}/plot_time_${sat}.log - rm -f ${logfile} - rm -f ${cmdfile} - - ii=0 - while [[ $ii -le ${#list[@]}-1 ]]; do - echo "${ii} $IG_SCRIPTS/plot_time.sh $sat $sat '$list'" >> $cmdfile - (( ii=ii+1 )) - done + if [[ $PLOT_ALL_REGIONS -eq 1 || $ndays -gt 30 ]]; then + wall_tm="2:30" + else + wall_tm="1:00" + fi - $SUB --account ${ACCOUNT} -n $ii -o ${logfile} -D . -J ${jobname} --time=4:00:00 \ + if [[ $MY_MACHINE = "wcoss_d" ]]; then + $SUB -q $JOB_QUEUE -P $PROJECT -M 500 -R affinity[core] -o ${logfile} \ + -W ${wall_tm} -J ${jobname} -cwd ${PWD} ${cmdfile} + elif [[ ${MY_MACHINE} = "wcoss_c" ]]; then + $SUB -q $JOB_QUEUE -P $PROJECT -M 500 -o ${logfile} -W ${wall_tm} \ + -J ${jobname} -cwd ${PWD} ${cmdfile} + elif [[ $MY_MACHINE = "hera" ]]; then + $SUB --account ${ACCOUNT} -n ${ctr} -o ${logfile} -D . -J ${jobname} --time=4:00:00 \ --wrap "srun -l --multi-prog ${cmdfile}" - fi + done + echo End mk_time_plots.sh exit diff --git a/util/Radiance_Monitor/image_gen/ush/nu_make_archive.sh b/util/Radiance_Monitor/image_gen/ush/nu_make_archive.sh deleted file mode 100755 index e0b1910beb..0000000000 --- a/util/Radiance_Monitor/image_gen/ush/nu_make_archive.sh +++ /dev/null @@ -1,242 +0,0 @@ -#! /bin/ksh - -#------------------------------------------------------------------ -# -# nu_make_archive.sh -# -# Archive the data files (*.ieee_d) to HPSS. -# -# Note that only full days are archived, so if running for the -# 00, 06, or 12z cycles the previous day will be archived. If -# PDATE = yyyymmdd18 then today (PDATE) will be last day archived. -#------------------------------------------------------------------ - - -function usage { - echo "Usage: nu_make_archive.sh suffix" - echo "" - echo " Suffix is a required argument, matching a data source " - echo " identifier (generally the value of $NET) that matches " - echo " data in the $TANKDIR/stats directory." -} - - -set -ax -export list=$listvar -echo "Begin nu_make_archive.sh" - -RAD_AREA=${RAD_AREA:-glb} - -#---------------------------- -# parse command line input -#---------------------------- -echo num args = $# -if [[ $# -ne 1 ]]; then - usage; - exit -else - RADMON_SUFFIX=$1 -fi - - - -#-------------------------------------------------------------------- -# Run config files to load environment variables, -# set default plot conditions -#-------------------------------------------------------------------- - -#---------------------- -#TESTING BRACKET BEGIN -#---------------------- -PDATE=2018040206 -this_dir=`pwd` -top_parm=${this_dir}/../../parm - -export RADMON_VERSION=${RADMON_VERSION:-${top_parm}/radmon.ver} -if [[ -s ${RADMON_VERSION} ]]; then - . ${RADMON_VERSION} -else - echo "Unable to source ${RADMON_VERSION} file" - exit 2 -fi - -export RADMON_CONFIG=${RADMON_CONFIG:-${top_parm}/RadMon_config} - -if [[ -s ${RADMON_CONFIG} ]]; then - . ${RADMON_CONFIG} -else - echo "Unable to source ${RADMON_CONFIG}" - exit -fi - -if [[ -s ${RADMON_USER_SETTINGS} ]]; then - . ${RADMON_USER_SETTINGS} -else - echo "Unable to source ${RADMON_USER_SETTINGS}" - exit -fi -#---------------------- -#TESTING BRACKET END -#---------------------- - - -#------------------------------------------------------------------ -# Determine last full day capable of archiving. -#------------------------------------------------------------------ -CYCLE=`echo $PDATE|cut -c9-10` -if [[ ${CYCLE} = "18" ]]; then - LASTARCH=$PDATE -else - LASTARCH=`$NDATE -24 $PDATE` -fi - -LAST_DAY=`echo $LASTARCH|cut -c1-8` -echo LAST_DAY = $LAST_DAY - -#------------------------------------------------------------------ -# Determine the last archived date for this source. -#------------------------------------------------------------------ -shell=ksh -. /usrx/local/Modules/default/init/${shell} -`module load hpss` - -echo PATH = $PATH - -HTAR=`which htar` -if [[ $HTAR = "" ]]; then - if [[ $MY_MACHINE = "wcoss" ]]; then - HTAR=/usrx/local/hpss/htar - fi -fi -echo "HTAR = $HTAR" - - -HPSSDIR=${HPSSDIR:-/NCEPDEV/emc-da/2year/${LOGNAME}/nbns/stats} -if [[ $RAD_AREA = "rgn" ]]; then - HPSSDIR=${HPSSDIR}/regional -fi - -HPSSDIR=${HPSSDIR}/${RADMON_SUFFIX} - -TDATE=$LASTARCH -TDAY=`echo $TDATE|cut -c1-8` -tar_list="" -tar_cnt=0 -cntr=0 -max_cntr=31 -num_list=0 -max_list=5 - -while [[ -d ${TANKverf}/${RUN}.$TDAY && $num_list -lt $max_list && $cntr -lt $max_cntr ]]; do - - tar_cnt=$( $HTAR -tf ${HPSSDIR}/${RUN}.${TDAY}.tar | wc -l ) -# echo "tar_cnt = $tar_cnt" - - if [[ $tar_cnt -lt 5 ]] then - echo "adding $TDAY to list" - tar_list="$tar_list $TDAY" - ((num_list=num_list+1)) - fi - - TDATE=`$NDATE -24 $TDATE` - TDAY=`echo $TDATE|cut -c1-8` - - ((cntr=cntr+1)) -done - -echo "tar_list = $tar_list" - -#------------------------------------------------------------------ -# Archive tar_list to hpss and the $ARCHIVE_DIR -#------------------------------------------------------------------ - -for tar_date in ${tar_list}; do - echo "dry run:" - echo "command: $HTAR " - echo " new file: ${HPSSDIR}/${RUN}.${tar_date}.tar" - echo " nbns dir: ${TANKverf}/${RUN}.$tar_date} " - - $HTAR -cvf ${HPSSDIR}/${RUN}.${tar_date}.tar ${TANKverf}/${RUN}.${tar_date} - -done - - - -#------------------------------------------------------------------ -#------------------------------------------------------------------ -# Add new directories to the prod machine -#------------------------------------------------------------------ -#------------------------------------------------------------------ -#if [[ $MY_MACHINE = "wcoss" ]]; then - - #------------------------------------------------------------------ - # Generate lists of directories locally and on the prod machine - #------------------------------------------------------------------ -# PROD=`cat /etc/prod` -# dev_dirs=`ls $TANKverf` -# prod_dirs=`ssh $LOGNAME@$PROD "ls $TANKverf"` - - #------------------------------------------------------------------ - # Throw out anything later than LASTARCH in dev_dirs so we don't - # end up with a partial directory on the prod machine. - #------------------------------------------------------------------ -# nu_devdirs="" -# for tdir in ${dev_dirs}; do -# if [[ $tdir != "info" ]]; then -# test_date=`echo $tdir | gawk -F. '{print $2}'` -# echo test_date=$test_date -# if [[ $test_date -le $LAST_DAY ]]; then -# nu_devdirs="$nu_devdirs $tdir" -# fi -# fi -# done -# echo nu_devdirs = $nu_devdirs -# dev_dirs=$nu_devdirs - - #------------------------------------------------------------------ - # Compare dev_dirs and prod_dirs. Generate a list of any missing - # directories in prod_dirs. - #------------------------------------------------------------------ -# xfer_list="" -# for tdir in ${dev_dirs}; do -# test=`echo $prod_dirs | grep $tdir` -# if [[ $test = "" ]]; then -# xfer_list="$xfer_list $tdir" -# fi -# done -# echo "xfer_list = $xfer_list" - - #------------------------------------------------------------------ - # For all entries in the xfer_list tar the directory, copy it to - # the prod machine, unpack it, rm both copies of the tar file - #------------------------------------------------------------------ -# home=`pwd` -# cd $TANKverf - -# for tdir in ${xfer_list}; do -# tarfile="$tdir.tar" - -# tar -cvf $tarfile $tdir -# scp ./$tarfile ${LOGNAME}@${PROD}:${TANKverf}/$tarfile - -# ssh ${LOGNAME}@${PROD} "cd $TANKverf && tar -xvf ./$tarfile && rm -f ./$tarfile" -# rm ./$tarfile -# done -# cd $home - - #------------------------------------------------------------------ - # Remove any directories in $TANKDIR in excess of 120 - #------------------------------------------------------------------ -# total=`ls -d1 ${TANKDIR}/radmon.* | wc -l` -# ((extra=total-121)) - -# if [[ $extra -gt 0 ]]; then -# `ls -d1 ${TANKDIR}/radmon.* | head -n $extra | xargs rm -rf` -# fi -# -#fi - -echo "End nu_make_archive.sh" - -exit - diff --git a/util/Radiance_Monitor/image_gen/ush/onprod.sh b/util/Radiance_Monitor/image_gen/ush/onprod.sh deleted file mode 100755 index b709651389..0000000000 --- a/util/Radiance_Monitor/image_gen/ush/onprod.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh - -# -# Check to determine if this maching is currently -# the production machine. -# -# Return values: -# 1 = prod -# 0 = dev -# - iamprod=0 - machine=`hostname | cut -c1` - if [[ -e /etc/prod ]]; then - prod=`cat /etc/prod | cut -c1` - - if [[ $machine = $prod ]]; then - iamprod=1 - fi - fi - - echo $iamprod - exit diff --git a/util/Radiance_Monitor/image_gen/ush/plot_angle.sh b/util/Radiance_Monitor/image_gen/ush/plot_angle.sh index 6f34d32cb1..aa4a639bc1 100755 --- a/util/Radiance_Monitor/image_gen/ush/plot_angle.sh +++ b/util/Radiance_Monitor/image_gen/ush/plot_angle.sh @@ -1,4 +1,4 @@ -#! /bin/ksh +#! /bin/bash #------------------------------------------------------------------ # @@ -24,19 +24,19 @@ plot_angle_sep=plot_angle_sep.${RAD_AREA}.gs #------------------------------------------------------------------ -# Create $tmpdir. +# Create $wrkdir word_count=`echo $PTYPE | wc -w` echo word_count = $word_count if [[ $word_count -le 1 ]]; then - tmpdir=${PLOT_WORK_DIR}/plot_angle_${RADMON_SUFFIX}_${SATYPE2}.$PDATE.${PVAR}.${PTYPE} + wrkdir=${PLOT_WORK_DIR}/plot_angle_${RADMON_SUFFIX}_${SATYPE2}.$PDATE.${PVAR}.${PTYPE} else - tmpdir=${PLOT_WORK_DIR}/plot_angle_${RADMON_SUFFIX}_${SATYPE2}.$PDATE.${PVAR} + wrkdir=${PLOT_WORK_DIR}/plot_angle_${RADMON_SUFFIX}_${SATYPE2}.$PDATE.${PVAR} fi -rm -rf $tmpdir -mkdir -p $tmpdir -cd $tmpdir +rm -rf $wrkdir +mkdir -p $wrkdir +cd $wrkdir @@ -51,7 +51,7 @@ edate0=`echo $edate|cut -c1-8` #-------------------------------------------------------------------- -# Copy control files to $tmpdir +# Copy control files to $wrkdir imgdef=`echo ${#IMGNDIR}` if [[ $imgdef -gt 0 ]]; then @@ -70,12 +70,8 @@ ${UNCOMPRESS} *.ctl.${Z} #-------------------------------------------------------------------- # Loop over satellite types. Copy data files, create plots and -# place on the web server. +# move to $IMGNDIR. # -# Data file location may either be in angle, bcoef, bcor, and time -# subdirectories under $TANKDIR, or in the Operational organization -# of radmon.YYYYMMDD directories under $TANKDIR. - for type in ${SATYPE2}; do cdate=$bdate @@ -90,29 +86,31 @@ for type in ${SATYPE2}; do cyc=`echo $cdate | cut -c9-10` fi - if [[ $TANK_USE_RUN -eq 1 ]]; then - ieee_src=${TANKverf}/${RUN}.${day}/${cyc}/${MONITOR} - if [[ ! -d ${ieee_src} ]]; then - ieee_src=${TANKverf}/${RUN}.${day}/${MONITOR} - fi - else - ieee_src=${TANKverf}/${MONITOR}.${day} - if [[ ! -d ${ieee_src} ]]; then - ieee_src=${TANKverf}/${RUN}.${day} - fi + ieee_src=${TANKverf}/${RUN}.${day}/${cyc}/${MONITOR} + if [[ ! -d ${ieee_src} ]]; then + ieee_src=${TANKverf}/${RUN}.${day}/${MONITOR} + fi + if [[ ! -d ${ieee_src} ]]; then + ieee_src=${TANKverf}/${MONITOR}.${day} + fi + if [[ ! -d ${ieee_src} ]]; then + ieee_src=${TANKverf}/${RUN}.${day} fi + if [[ -d ${ieee_src} ]]; then if [[ $REGIONAL_RR -eq 1 ]]; then - test_file=${ieee_src}/${rgnHH}.angle.${type}.${cdate}.ieee_d.${rgnTM} +# test_file=${ieee_src}/${rgnHH}.angle.${type}.${cdate}.ieee_d.${rgnTM} + test_file=${ieee_src}/angle.${type}.${cdate}.ieee_d else test_file=${ieee_src}/angle.${type}.${cdate}.ieee_d fi if [[ $USE_ANL = 1 ]]; then if [[ $REGIONAL_RR -eq 1 ]]; then - test_file=${ieee_src}/${rgnHH}.angle.${type}_anl.${cdate}.ieee_d.${rgnTM} +# test_file=${ieee_src}/${rgnHH}.angle.${type}_anl.${cdate}.ieee_d.${rgnTM} + test_file=${ieee_src}/angle.${type}_anl.${cdate}.ieee_d else test_file2=${ieee_src}/angle.${type}_anl.${cdate}.ieee_d fi @@ -133,27 +131,29 @@ for type in ${SATYPE2}; do fi fi -# if [[ ! -s ${type}.${cdate}.ieee_d && ! -s ${type}.${cdate}.ieee_d.${Z} ]]; then -# $NCP $TANKDIR/angle/${type}.${cdate}.ieee_d* ./ -# fi adate=`$NDATE +${CYCLE_INTERVAL} $cdate` cdate=$adate done - ${UNCOMPRESS} $tmpdir/*.ieee_d.${Z} + ${UNCOMPRESS} $wrkdir/*.ieee_d.${Z} - #--------------------------------------------------------------------- - # nu_plot_angle.sh produces the text files used by the js/html files + #----------------------------------------------------------------------- + # mk_digital_ang.sh produces the text files used by the js/html files # to generate the interactive charts # - $NCP ${IG_SCRIPTS}/nu_plot_angle.sh . - ./nu_plot_angle.sh ${type} + $NCP ${IG_SCRIPTS}/mk_digital_ang.sh . + ./mk_digital_ang.sh ${type} - for var in ${PTYPE}; do - echo $var - if [ "$var" = 'count' ]; then + #-------------------------------------------------------------------- + # Conditionally execute GrADS plotting. + # + if [[ $PLOT_STATIC_IMGS -eq 1 ]]; then + for var in ${PTYPE}; do + echo $var + + if [ "$var" = 'count' ]; then cat << EOF > ${type}_${var}.gs 'open ${type}.ctl' @@ -161,75 +161,43 @@ cat << EOF > ${type}_${var}.gs 'quit' EOF - elif [ "$var" = 'penalty' ]; then + elif [ "$var" = 'penalty' ]; then cat << EOF > ${type}_${var}.gs 'open ${type}.ctl' 'run ${IG_GSCRIPTS}/${plot_angle_count} ${type} ${var} ${PLOT_ALL_REGIONS} ${PLOT_SUB_AVGS} x1100 y850' 'quit' EOF - else + else cat << EOF > ${type}_${var}.gs 'open ${type}.ctl' 'run ${IG_GSCRIPTS}/${plot_angle_sep} ${type} ${var} ${PLOT_ALL_REGIONS} ${PLOT_SUB_AVGS} x1100 y850' 'quit' EOF - fi - - #-------------------------------------------------------------------- - # execute the grads plotting - # This too is a temporary fix. Eventually it will be executed only - # when $PLOT_STATIC_IMGS is 1. At the moment regional sources only - # use some of the js plotting (summary and time). - # - if [[ $PLOT_STATIC_IMGS -eq 1 ]]; then - $GRADS -bpc "run ${tmpdir}/${type}_${var}.gs" - fi + fi - done + $GRADS -bpc "run ${wrkdir}/${type}_${var}.gs" + done -# rm -f ${type}*.ieee_d -# rm -f ${type}.ctl + fi done #-------------------------------------------------------------------- -# Copy image files to $IMGNDIR to set up for mirror to web server. -# Delete images and data files. - -if [[ ! -d ${IMGNDIR}/angle ]]; then - mkdir -p ${IMGNDIR}/angle -fi +# Copy image files to $IMGNDIR. +# if [[ ${RAD_AREA} = "rgn" || $PLOT_STATIC_IMGS -eq 1 ]]; then find . -name '*.png' -exec cp -pf {} ${IMGNDIR}/angle/ \; fi - #-------------------------------------------------------------------- -# Clean $tmpdir. - -echo Removing tmpdir = $tmpdir -cd $tmpdir +# Clean $wrkdir +# +echo Removing wrkdir = $wrkdir +cd $wrkdir cd ../ -rm -rf $tmpdir - - -#-------------------------------------------------------------------- -# If this is the last angle plot job to finish then rm PLOT_WORK_DIR. -# -#echo ${LOADLQ} - -#count=`ls ${LOADLQ}/*plot*_${RADMON_SUFFIX}* | wc -l` -#complete=`grep "COMPLETED" ${LOADLQ}/*plot*_${RADMON_SUFFIX}* | wc -l` - -#running=`expr $count - $complete` - -#if [[ $running -eq 1 ]]; then -# cd ${PLOT_WORK_DIR} -# cd ../ -# rm -rf ${PLOT_WORK_DIR} -#fi +rm -rf $wrkdir exit diff --git a/util/Radiance_Monitor/image_gen/ush/plot_bcoef.sh b/util/Radiance_Monitor/image_gen/ush/plot_bcoef.sh index 9a17b16ed0..f3b3260785 100755 --- a/util/Radiance_Monitor/image_gen/ush/plot_bcoef.sh +++ b/util/Radiance_Monitor/image_gen/ush/plot_bcoef.sh @@ -1,4 +1,4 @@ -#! /bin/ksh +#! /bin/bash #------------------------------------------------------------------ # @@ -54,7 +54,7 @@ echo ctldir = $ctldir # of radmon.YYYYMMDD directories under $TANKDIR. -$NCP ${IG_SCRIPTS}/nu_plot_bcoef.sh . +$NCP ${IG_SCRIPTS}/mk_digital_bcoef.sh . for type in ${SATYPE}; do @@ -73,29 +73,30 @@ for type in ${SATYPE}; do cyc=`echo $cdate | cut -c9-10` fi - if [[ $TANK_USE_RUN -eq 1 ]]; then - ieee_src=${TANKverf}/${RUN}.${day}/${cyc}/${MONITOR} - if [[ ! -d ${ieee_src} ]]; then - ieee_src=${TANKverf}/${RUN}.${day}/${MONITOR} - fi - else + ieee_src=${TANKverf}/${RUN}.${day}/${cyc}/${MONITOR} + if [[ ! -d ${ieee_src} ]]; then + ieee_src=${TANKverf}/${RUN}.${day}/${MONITOR} + fi + if [[ ! -d ${ieee_src} ]]; then ieee_src=${TANKverf}/${MONITOR}.${day} - if [[ ! -d ${ieee_src} ]]; then - ieee_src=${TANKverf}/${RUN}.${day} - fi + fi + if [[ ! -d ${ieee_src} ]]; then + ieee_src=${TANKverf}/${RUN}.${day} fi if [[ -d ${ieee_src} ]]; then if [[ $REGIONAL_RR -eq 1 ]]; then - test_file=${ieee_src}/${rgnHH}.bcoef.${type}.${cdate}.ieee_d.${rgnTM} +# test_file=${ieee_src}/${rgnHH}.bcoef.${type}.${cdate}.ieee_d.${rgnTM} + test_file=${ieee_src}/bcoef.${type}.${cdate}.ieee_d else test_file=${ieee_src}/bcoef.${type}.${cdate}.ieee_d fi if [[ $USE_ANL = 1 ]]; then if [[ $REGIONAL_RR -eq 1 ]]; then - test_file=${ieee_src}/${rgnHH}.bcoef.${type}_anl.${cdate}.ieee_d.${rgnTM} +# test_file=${ieee_src}/${rgnHH}.bcoef.${type}_anl.${cdate}.ieee_d.${rgnTM} + test_file=${ieee_src}/bcoef.${type}_anl.${cdate}.ieee_d else test_file2=${ieee_src}/bcoef.${type}_anl.${cdate}.ieee_d fi @@ -144,9 +145,9 @@ EOF #-------------------------------------------------------------------------- - # nu_plot_bcoef.sh produces the data files needed by the js/html files to - # generate the interactive charts - ./nu_plot_bcoef.sh ${type} + # mk_digital_bcoef.sh produces the data files needed by the js/html files + # to generate the interactive charts. + ./mk_digital_bcoef.sh ${type} diff --git a/util/Radiance_Monitor/image_gen/ush/plot_bcor.sh b/util/Radiance_Monitor/image_gen/ush/plot_bcor.sh index 101e7fd817..656bb465a5 100755 --- a/util/Radiance_Monitor/image_gen/ush/plot_bcor.sh +++ b/util/Radiance_Monitor/image_gen/ush/plot_bcor.sh @@ -75,30 +75,41 @@ for type in ${SATYPE2}; do if [[ $REGIONAL_RR -eq 1 ]]; then tdate=`$NDATE +6 $cdate` day=`echo $tdate | cut -c1-8 ` - hh=`echo $cdate | cut -c9-10` - . ${IG_SCRIPTS}/rr_set_tz.sh $hh + cyc=`echo $cdate | cut -c9-10` + . ${IG_SCRIPTS}/rr_set_tz.sh $cyc else day=`echo $cdate | cut -c1-8 ` + cyc=`echo $cdate | cut -c9-10 ` fi - source_dir=${IEEE_SRC} + ieee_src=${TANKverf}/${RUN}.${day}/${cyc}/${MONITOR} - nfile_src=`ls -l ${IEEE_SRC}/*${PDATE}*ieee_d* | egrep -c '^-'` + if [[ ! -d ${ieee_src} ]]; then + ieee_src=${TANKverf}/${RUN}.${day}/${MONITOR} + fi + if [[ ! -d ${ieee_src} ]]; then + ieee_src=${TANKverf}/${MONITOR}.${day} + fi + if [[ ! -d ${ieee_src} ]]; then + ieee_src=${TANKverf}/${RUN}.${day} + fi + + nfile_src=`ls -l ${ieee_src}/*${cdate}*ieee_d* | egrep -c '^-'` echo "nfile_src = $nfile_src" - if [[ -d ${IEEE_SRC} ]]; then + if [[ -d ${ieee_src} ]]; then if [[ $REGIONAL_RR -eq 1 ]]; then - test_file=${IEEE_SRC}/${rgnHH}.bcor.${type}.${cdate}.ieee_d.${rgnTM} + test_file=${ieee_src}/${rgnHH}.bcor.${type}.${cdate}.ieee_d.${rgnTM} else - test_file=${IEEE_SRC}/bcor.${type}.${cdate}.ieee_d + test_file=${ieee_src}/bcor.${type}.${cdate}.ieee_d fi if [[ $USE_ANL = 1 ]]; then if [[ $REGIONAL_RR -eq 1 ]]; then - test_file=${IEEE_SRC}/${rgnHH}.bcor.${type}_anl.${cdate}.ieee_d.${rgnTM} + test_file=${ieee_src}/${rgnHH}.bcor.${type}_anl.${cdate}.ieee_d.${rgnTM} else - test_file2=${IEEE_SRC}/bcor.${type}_anl.${cdate}.ieee_d + test_file2=${ieee_src}/bcor.${type}_anl.${cdate}.ieee_d fi else test_file2= diff --git a/util/Radiance_Monitor/image_gen/ush/plot_comp.sh b/util/Radiance_Monitor/image_gen/ush/plot_comp.sh deleted file mode 100755 index fea9cc9de5..0000000000 --- a/util/Radiance_Monitor/image_gen/ush/plot_comp.sh +++ /dev/null @@ -1,94 +0,0 @@ -#! /bin/ksh - -#------------------------------------------------------------------ -# -# plot_summary.sh -# -#------------------------------------------------------------------ - -set -ax -export list=$listvars - - -#------------------------------------------------------------------ -# Set environment variables. -tmpdir=${PLOT_WORK_DIR} -cd $tmpdir - -#------------------------------------------------------------------ -# Set dates - -bdate=${SDATE} -edate=${EDATE} -bdate0=`echo $bdate|cut -c1-8` -edate0=`echo $edate|cut -c1-8` - -#-------------------------------------------------------------------- -# Copy and rename data (*.ieee_d) files for both SUFFIX1 and SUFFIX2 - -for type in ${SATYPE}; do - - cdate=$bdate - - while [[ $cdate -le $edate ]]; do - day=`echo $cdate | cut -c1-8 ` - - if [[ -d ${TANKDIR1}/radmon.${day} ]]; then - test_file=${TANKDIR1}/radmon.${day}/time.${type}.${cdate}.ieee_d - if [[ -s $test_file ]]; then - $NCP ${test_file} ./${SUFFIX1}.${type}.${cdate}.ieee_d - elif [[ -s ${test_file}.${Z} ]]; then - $NCP ${test_file}.${Z} ./${SUFFIX1}.${type}.${cdate}.ieee_d.${Z} - fi - fi - - if [[ -d ${TANKDIR2}/radmon.${day} ]]; then - test_file=${TANKDIR2}/radmon.${day}/time.${type}.${cdate}.ieee_d - if [[ -s $test_file ]]; then - $NCP ${test_file} ./${SUFFIX2}.${type}.${cdate}.ieee_d - elif [[ -s ${test_file}.${Z} ]]; then - $NCP ${test_file}.${Z} ./${SUFFIX2}.${type}.${cdate}.ieee_d.${Z} - fi - fi - - adate=`$NDATE +6 $cdate` - cdate=$adate - done - ${UNCOMPRESS} *.ieee_d.${Z} - -cat << EOF > ${type}.gs -'open ${SUFFIX1}.${type}.ctl' -'open ${SUFFIX2}.${type}.ctl' -'run ${IG_GSCRIPTS}/plot_comp_summary.gs ${type} ${SUFFIX1} ${SUFFIX2} x1100 y850' -'quit' -EOF - - $GRADS -bpc "run ${tmpdir}/${type}.gs" - -# rm -f ${type}.ctl -# rm -f ${type}*.ieee_d - -done - -#-------------------------------------------------------------------- -# Copy image files to $IMGNDIR to set up for mirror to web server. -# Delete images and data files. - -if [[ ! -d ${IMGNDIR1}/pngs/comp ]]; then - mkdir -p ${IMGNDIR1}/pngs/comp -fi -$NCP -r *comp.png ${IMGNDIR1}/pngs/comp/. - -#rm -f *.comp.png - - -#-------------------------------------------------------------------- -# Clean $tmpdir. -# -#cd $tmpdir -#cd ../ -#rm -rf $tmpdir - - -exit - diff --git a/util/Radiance_Monitor/image_gen/ush/plot_fs_obsnum_comp.sh b/util/Radiance_Monitor/image_gen/ush/plot_fs_obsnum_comp.sh deleted file mode 100755 index 634dec7925..0000000000 --- a/util/Radiance_Monitor/image_gen/ush/plot_fs_obsnum_comp.sh +++ /dev/null @@ -1,190 +0,0 @@ -#!/bin/sh - -#-------------------------------------------------------------------- -# -# plot_fs_obsnum_comp.sh -# -# This script generates a comparison plot of observation counts and -# ges with bias correction from two or three data sources. -# -# Note: this does not generate any data files. Those must be -# already created for this script to function correctly. -# -# See the ../parm/plot_*_comp -#-------------------------------------------------------------------- -echo start plot_fs_obsnum_comp.sh - -set -ax -date -export list=$listvar - -type=$1 -data=$2 #ges or anl, ges is default - -# -# set anl if we're plotting analysis data -# -anl= -if [[ $data == "anl" ]]; then - anl=_anl -fi - -suff3=${#SUFFIX3} - - -workdir=${PLOT_WORK_DIR}/plot_fs_obsnum_${SUFFIX1}_${type}${anl} -mkdir -p ${workdir} -cd ${workdir} - - - -#------------------------------------------------------------------ -# Copy the data files over and rename according to SUFFIX -#------------------------------------------------------------------ -PDY=`echo $PDATE|cut -c1-8` - -target1=${TANKDIR1}/radmon.${PDY}/time.${type}.${PDATE}${anl}.ieee_d -dest1=${workdir}/${SUFFIX1}.${PDATE}.ieee_d -if [[ -s ${target1}.${Z} ]]; then - $NCP ${target1}.${Z} ${dest1}.${Z} -else - $NCP ${target1} ${dest1} -fi - -target2=${TANKDIR2}/radmon.${PDY}/time.${type}.${PDATE}${anl}.ieee_d -dest2=${workdir}/${SUFFIX2}.${PDATE}.ieee_d -if [[ -s ${target2}.${Z} ]]; then - $NCP ${target2}.${Z} ${dest2}.${Z} -else - $NCP ${target2} ${dest2} -fi - - -if [[ $suff3 -gt 0 ]]; then - target3=${TANKDIR3}/radmon.${PDY}/time.${type}.${PDATE}${anl}.ieee_d - dest3=${workdir}/${SUFFIX3}.${PDATE}.ieee_d - if [[ -s ${target3}.${Z} ]]; then - $NCP ${target3}.${Z} ${dest3}.${Z} - else - $NCP ${target3} ${dest3} - fi -fi - -${UNCOMPRESS} ${workdir}/*.${Z} - -#------------------------------------------------------------------ -# Copy a control file over, update the time, rename according -# to SUFFIX, and change the data file name according to SUFFIX. -#------------------------------------------------------------------ -ctldir= -if [[ -s ${IMGNDIR1}/time/${type}${anl}.ctl.${Z} || -s ${IMGNDIR1}/time/${type}${anl}.ctl ]]; then - ctldir="${IMGNDIR1}/time" -elif [[ -s ${TANKDIR1}/radmon.${PDY}/time.${type}${anl}.ctl.${Z} || -s ${TANKDIR1}/radmon.${PDY}/time.${type}${anl}.ctl ]]; then - ctldir=${TANKDIR1}/radmon.${PDY} -elif [[ -s ${TANKDIR1}/time/${type}${anl}.ctl.${Z} || -s ${TANKDIR1}/time/${type}${anl}.ctl ]]; then - ctldir=${TANKDIR1}/time -elif [[ -s ${IMGNDIR2}/time/${type}${anl}.ctl.${Z} || -s ${IMGNDIR2}/time/${type}${anl}.ctl ]]; then - ctldir=${IMGNDIR2}/time -elif [[ -s ${TANKDIR2}/radmon.${PDY}/time.${type}${anl}.ctl.${Z} || -s ${TANKDIR2}/radmon.${PDY}/time.${type}${anl}.ctl ]]; then - ctldir=${TANKDIR2}/radmon.${PDY} -elif [[ -s ${TANKDIR2}/time/${type}${anl}.ctl.${Z} || -s ${TANKDIR2}/time/${type}${anl}.ctl ]]; then - ctldir=${TANKDIR2}/time -elif [[ $suff3 -gt 0 ]]; then - if [[ -s ${IMGNDIR3}/time/${type}${anl}.ctl.${Z} || -s ${IMGNDIR3}/time/${type}${anl}.ctl ]]; then - ctldir=${IMGNDIR3}/time - elif [[ -s ${TANKDIR3}/radmon.${PDY}/time.${type}${anl}.ctl.${Z} || -s ${TANKDIR3}/radmon.${PDY}/time.${type}${anl}.ctl ]]; then - ctldir=${TANKDIR3}/radmon.${PDY} - elif [[ -s ${TANKDIR3}/time/${type}${anl}.ctl.${Z} || -s ${TANKDIR3}/time/${type}${anl}.ctl ]]; then - ctldir=${TANKDIR3}/time - fi -else - echo "Unable to locate any ctl file" -fi - -nctldir=${#ctldir} -if [[ ${nctldir} -gt 0 ]]; then - if [[ -s ${ctldir}/time.${type}${anl}.ctl.${Z} ]]; then - $NCP ${ctldir}/time.${type}${anl}.ctl.${Z} ${workdir}/${type}${anl}.ctl.${Z} - elif [[ -s ${ctldir}/time.${type}${anl}.ctl ]]; then - $NCP ${ctldir}/time.${type}${anl}.ctl ${workdir}/${type}${anl}.ctl - else - $NCP ${ctldir}/${type}${anl}.ctl* ${workdir}/. - fi - - if [[ -s ${workdir}/${type}${anl}.ctl.${Z} ]]; then - ${UNCOMPRESS} ${workdir}/${type}${anl}.ctl.${Z} - fi - - #------------------------------------------------------------------- - # Update the time definition (tdef) line in the angle control - # files. Conditionally rm "cray_32bit_ieee" from the options line. - - ctl_file=${type}${anl}.ctl - - ${IG_SCRIPTS}/update_ctl_tdef.sh ${ctl_file} ${PDATE} - - if [[ $MY_MACHINE = "wcoss" ]]; then - sed -e 's/cray_32bit_ieee/ /' ${ctl_file} > tmp_${type}.ctl - mv -f tmp_${type}.ctl ${ctl_file} - fi - - $NCP ${type}${anl}.ctl ${SUFFIX1}${anl}.ctl - ${IG_SCRIPTS}/update_ctl_fname.sh ${SUFFIX1}${anl}.ctl ${SUFFIX1} - - $NCP ${type}${anl}.ctl ${SUFFIX2}${anl}.ctl - ${IG_SCRIPTS}/update_ctl_fname.sh ${SUFFIX2}${anl}.ctl ${SUFFIX2} - - if [[ $suff3 -gt 0 ]]; then - $NCP ${type}${anl}.ctl ${SUFFIX3}${anl}.ctl - ${IG_SCRIPTS}/update_ctl_fname.sh ${SUFFIX3}${anl}.ctl ${SUFFIX3} - fi - - $NCP ${IG_GSCRIPTS}/setrange.gs ${workdir}/setrange.gs - - run_line="run ${IG_GSCRIPTS}/plot_fs_obsnum_comp.gs ${type} ${data} ${SUFFIX1} ${SUFFIX2}" - - - if [[ $suff3 -gt 0 ]]; then - plotscript=${type}_${SUFFIX1}_${SUFFIX2}_${SUFFIX3}${anl}.gs -cat << EOF > ${workdir}/${plotscript} -'open ${SUFFIX1}${anl}.ctl' -'open ${SUFFIX2}${anl}.ctl' -'open ${SUFFIX3}${anl}.ctl' -'run ${IG_GSCRIPTS}/plot_fs_obsnum_comp.gs ${type} ${data} ${SUFFIX1} ${SUFFIX2} ${SUFFIX3}' -'quit' -EOF - else - plotscript=${type}_${SUFFIX1}_${SUFFIX2}${anl}.gs -cat << EOF > ${workdir}/${plotscript} -'open ${SUFFIX1}${anl}.ctl' -'open ${SUFFIX2}${anl}.ctl' -'run ${IG_GSCRIPTS}/plot_fs_obsnum_comp.gs ${type} ${data} ${SUFFIX1} ${SUFFIX2}' -'quit' -EOF - fi - - $GRADS -bpc "run ${workdir}/${plotscript}" - - #------------------------------------------------------------------ - # copy to imgn mirror directory - #------------------------------------------------------------------ - imgndir=${IMGNDIR1}/pngs/comp - if [[ ! -d $imgndir ]]; then - mkdir -p $imgndir - fi - - $NCP *.png ${imgndir}/. - - #------------------------------------------------------------------ - # clean up files - #------------------------------------------------------------------ - cd ${workdir} - cd ../ - rm -rf $workdir - -fi - - -echo end plot_fs_obsnum_comp.sh - -exit diff --git a/util/Radiance_Monitor/image_gen/ush/plot_horiz.sh b/util/Radiance_Monitor/image_gen/ush/plot_horiz.sh index bfed9ca946..4d3ef29810 100755 --- a/util/Radiance_Monitor/image_gen/ush/plot_horiz.sh +++ b/util/Radiance_Monitor/image_gen/ush/plot_horiz.sh @@ -94,9 +94,9 @@ find . -name '*.png' -exec cp -pf {} ${IMGNDIR}/horiz/ \; # running). # -#cd $tmpdir -#cd .. -#rm -rf $tmpdir +cd $tmpdir +cd .. +rm -rf $tmpdir #cat ${LOADLQ}/plot_${RADMON_SUFFIX}_horiz* diff --git a/util/Radiance_Monitor/image_gen/ush/plot_summary.sh b/util/Radiance_Monitor/image_gen/ush/plot_summary.sh index e6a77b6882..14596039f9 100755 --- a/util/Radiance_Monitor/image_gen/ush/plot_summary.sh +++ b/util/Radiance_Monitor/image_gen/ush/plot_summary.sh @@ -1,4 +1,4 @@ -#! /bin/ksh +#! /bin/bash #------------------------------------------------------------------ # @@ -23,7 +23,7 @@ cd $tmpdir #------------------------------------------------------------------ # Set dates - +# bdate=${START_DATE} edate=$PDATE bdate0=`echo $bdate|cut -c1-8` @@ -31,7 +31,7 @@ edate0=`echo $edate|cut -c1-8` #-------------------------------------------------------------------- # Set ctldir to point to correct control file source - +# imgdef=`echo ${#IMGNDIR}` if [[ $imgdef -gt 0 ]]; then ctldir=$IMGNDIR/time @@ -72,54 +72,46 @@ for type in ${SATYPE2}; do cyc=`echo $cdate | cut -c9-10` fi - if [[ $TANK_USE_RUN -eq 1 ]]; then - ieee_src=${TANKverf}/${RUN}.${day}/${cyc}/${MONITOR} - if [[ ! -d ${ieee_src} ]]; then - ieee_src=${TANKverf}/${RUN}.${day}/${MONITOR} - fi - else + #---------------------------------------------------- + # Attempt to locate the extracted ieee data files. + # + ieee_src=${TANKverf}/${RUN}.${day}/${cyc}/${MONITOR} + if [[ ! -d ${ieee_src} ]]; then + ieee_src=${TANKverf}/${RUN}.${day}/${MONITOR} + fi + if [[ ! -d ${ieee_src} ]]; then ieee_src=${TANKverf}/${MONITOR}.${day} - if [[ ! -d ${ieee_src} ]]; then - ieee_src=${TANKverf}/${RUN}.${day} - fi + fi + if [[ ! -d ${ieee_src} ]]; then + ieee_src=${TANKverf}/${RUN}.${day} fi echo "rgnHH, rgnTM = $rgnHH, $rgnTM" + test_file=${ieee_src}/time.${type}.${cdate}.ieee_d - if [[ -d ${ieee_src} ]]; then - if [[ $REGIONAL_RR -eq 1 ]]; then - test_file=${ieee_src}/${rgnHH}.time.${type}.${cdate}.ieee_d.${rgnTM} - else - test_file=${ieee_src}/time.${type}.${cdate}.ieee_d - fi - - if [[ $USE_ANL = 1 ]]; then - if [[ $REGIONAL_RR -eq 1 ]]; then - test_file2=${ieee_src}/${rgnHH}.time.${type}_anl.${cdate}.ieee_d.${rgnTM} - else - test_file2=${ieee_src}/time.${type}_anl.${cdate}.ieee_d - fi - else - test_file2= - fi - - if [[ -s $test_file ]]; then - $NCP ${test_file} ./${type}.${cdate}.ieee_d - elif [[ -s ${test_file}.${Z} ]]; then - $NCP ${test_file}.${Z} ./${type}.${cdate}.ieee_d.${Z} - fi - - if [[ -s $test_file2 ]]; then - $NCP ${test_file2} ./${type}_anl.${cdate}.ieee_d - elif [[ -s ${test_file2}.${Z} ]]; then - $NCP ${test_file2}.${Z} ./${type}_anl.${cdate}.ieee_d.${Z} - fi + if [[ $USE_ANL = 1 ]]; then + test_file2=${ieee_src}/time.${type}_anl.${cdate}.ieee_d + else + test_file2= + fi + + if [[ -s $test_file ]]; then + $NCP ${test_file} ./${type}.${cdate}.ieee_d + elif [[ -s ${test_file}.${Z} ]]; then + $NCP ${test_file}.${Z} ./${type}.${cdate}.ieee_d.${Z} + fi + + if [[ -s $test_file2 ]]; then + $NCP ${test_file2} ./${type}_anl.${cdate}.ieee_d + elif [[ -s ${test_file2}.${Z} ]]; then + $NCP ${test_file2}.${Z} ./${type}_anl.${cdate}.ieee_d.${Z} fi adate=`$NDATE +${CYCLE_INTERVAL} ${cdate}` cdate=$adate done + ${UNCOMPRESS} *.ieee_d.${Z} @@ -148,21 +140,21 @@ EOF fi -#-------------------------------------------------------------------- -# Build new data file for server. -# This supports the javascript summary plot. -# -# Algorithm: -# 1. Copy summary.x locally -# 2. For each entry in SATYTPE -# 2) build the times.txt file from the data files -# 3) build the use.txt file from the ctl file -# 1) build the input file (namelist for summary.x) -# 4) run the summary.x executable -# 5) copy the [satype].sum.txt file to $TANKDIR/imgn/{suffix}/pngs/summary/. -# 6) clean up - - echo "BEGIN javascript file generation:" + #-------------------------------------------------------------------- + # Build data files for server. + # This supports the javascript summary plot. + # + # Algorithm: + # 1. Copy summary.x locally + # 2. For each entry in SATYTPE + # a) build the times.txt file from the data files + # b) build the use.txt file from the ctl file + # c) build the input file (namelist for summary.x) + # d) run the summary.x executable + # e) copy the [satype].sum.txt file to $TANKDIR/imgn/{suffix}/pngs/summary/. + # f) clean up + + echo "BEGIN data file generation:" rm -f $timesf if [[ ! -s summary.x ]]; then @@ -209,13 +201,13 @@ EOF rm -f input cp ${input} input ./summary.x < input > out.${type} - echo "END javascript file generation:" -# rm -f $timesf + echo "END data file generation:" rm -f ${input} done + #-------------------------------------------------------------------- # Copy image files to $IMGNDIR to set up for mirror to web server. # Delete images and data files. diff --git a/util/Radiance_Monitor/image_gen/ush/plot_time.sh b/util/Radiance_Monitor/image_gen/ush/plot_time.sh index ceab6deb68..8697966d7f 100755 --- a/util/Radiance_Monitor/image_gen/ush/plot_time.sh +++ b/util/Radiance_Monitor/image_gen/ush/plot_time.sh @@ -1,4 +1,4 @@ -#! /bin/ksh +#! /bin/bash #------------------------------------------------------------------ # @@ -15,35 +15,39 @@ PTYPE=$3 echo "Starting plot_time.sh" -#------------------------------------------------------------------ -# Set environment variables. +#----------------------------------------------- +# Make sure IMGNDIR/time directory exists and +# set necessary environment variables. +# +if [[ ! -d ${IMGNDIR}/time ]]; then + mkdir -p ${IMGNDIR}/time +fi tmpdir=${PLOT_WORK_DIR}/plot_time_${RADMON_SUFFIX}_${SATYPE2}.$PDATE.${PVAR} rm -rf $tmpdir mkdir -p $tmpdir cd $tmpdir plot_time_count=plot_time_count.${RAD_AREA}.gs -echo plot_time_count = $plot_time_count +echo plot_time_count = ${plot_time_count} plot_time_sep=plot_time_sep.${RAD_AREA}.gs -echo plot_time_sep = $plot_time_sep +echo plot_time_sep = ${plot_time_sep} -echo PLOT_WORK_DIR = $PLOT_WORK_DIR -echo tmpdir = $tmpdir +echo PLOT_WORK_DIR = ${PLOT_WORK_DIR} +echo tmpdir = ${tmpdir} #------------------------------------------------------------------ # Set dates - +# bdate=${START_DATE} -rdate=`$NDATE -72 $PDATE` edate=$PDATE bdate0=`echo $bdate|cut -c1-8` edate0=`echo $edate|cut -c1-8` #-------------------------------------------------------------------- # Set ctldir to point to correct control file source - +# imgdef=`echo ${#IMGNDIR}` if [[ $imgdef -gt 0 ]]; then ctldir=$IMGNDIR/time @@ -61,7 +65,7 @@ echo ctldir = $ctldir # Data file location may either be in angle, bcoef, bcor, and time # subdirectories under $TANKDIR, or in the Operational organization # of radmon.YYYYMMDD directories under $TANKDIR. - +# for type in ${SATYPE2}; do $NCP $ctldir/${type}.ctl* ./ @@ -87,31 +91,23 @@ for type in ${SATYPE2}; do cyc=`echo $cdate | cut -c9-10` fi - if [[ $TANK_USE_RUN -eq 1 ]]; then - ieee_src=${TANKverf}/${RUN}.${day}/${cyc}//${MONITOR} - if [[ ! -d ${ieee_src} ]]; then - ieee_src=${TANKverf}/${RUN}.${day}/${MONITOR} - fi - else + ieee_src=${TANKverf}/${RUN}.${day}/${cyc}/${MONITOR} + if [[ ! -d ${ieee_src} ]]; then + ieee_src=${TANKverf}/${RUN}.${day}/${MONITOR} + fi + if [[ ! -d ${ieee_src} ]]; then ieee_src=${TANKverf}/${MONITOR}.${day} - if [[ ! -d ${ieee_src} ]]; then - ieee_src=${TANKverf}/${RUN}.${day} - fi + fi + if [[ ! -d ${ieee_src} ]]; then + ieee_src=${TANKverf}/${RUN}.${day} fi + if [[ -d ${ieee_src} ]]; then - if [[ $REGIONAL_RR -eq 1 ]]; then - test_file=${ieee_src}/${rgnHH}.time.${type}.${cdate}.ieee_d.${rgnTM} - else - test_file=${ieee_src}/time.${type}.${cdate}.ieee_d - fi + test_file=${ieee_src}/time.${type}.${cdate}.ieee_d if [[ $USE_ANL = 1 ]]; then - if [[ $REGIONAL_RR -eq 1 ]]; then - test_file2=${ieee_src}/${rgnHH}.time.${type}_anl.${cdate}.ieee_d.${rgnTM} - else - test_file2=${ieee_src}/time.${type}_anl.${cdate}.ieee_d - fi + test_file2=${ieee_src}/time.${type}_anl.${cdate}.ieee_d else test_file2= fi @@ -164,23 +160,19 @@ EOF done fi - #------------------------------------------ - # nu_plot_time.sh creates the data files used by the html/js files - # for interactive chart generation. + #---------------------------------------------------------- + # mk_digital_time.sh creates the data files used by the + # html/js web files for interactive chart generation. # - $NCP ${IG_SCRIPTS}/nu_plot_time.sh . - ./nu_plot_time.sh ${type} - rm -f nu_plot_time.sh + $NCP ${IG_SCRIPTS}/mk_digital_time.sh . + ./mk_digital_time.sh ${type} + rm -f mk_digital_time.sh done #-------------------------------------------------------------------- -# Copy image files to $IMGNDIR to set up for mirror to web server. -# Delete images and data files. - -if [[ ! -d ${IMGNDIR}/time ]]; then - mkdir -p ${IMGNDIR}/time -fi +# Copy image files to $IMGNDIR. +# if [[ $PLOT_STATIC_IMGS -eq 1 ]]; then cp -f *.png ${IMGNDIR}/time fi diff --git a/util/Radiance_Monitor/image_gen/ush/plot_update.sh b/util/Radiance_Monitor/image_gen/ush/plot_update.sh deleted file mode 100755 index 14b443f49c..0000000000 --- a/util/Radiance_Monitor/image_gen/ush/plot_update.sh +++ /dev/null @@ -1,53 +0,0 @@ -#! /bin/ksh - -#------------------------------------------------------------------ -# -# plot_update.sh -# -# Update the imgdate post image generation. -# -#------------------------------------------------------------------ -set -ax -export list=$listvar - - -#------------------------------------------------------------------ -# Set environment variables. -#------------------------------------------------------------------ -tmpdir=${STMP_USER}/done_${RADMON_SUFFIX}.$PDATE -rm -rf $tmpdir -mkdir -p $tmpdir -cd $tmpdir - - -#------------------------------------------------------------------ -# Archive yesterday's files to hpss -# -# Do this after the 06 cycle; don't want to lengthen the 00 -# processing any further. -#------------------------------------------------------------------ - -CYCLE=`echo $PDATE|cut -c9-10` - -if [[ ${DO_ARCHIVE} = "1" && ${CYCLE} = "06" ]]; then - HPSSDIR=${HPSS_DIR}/${RADMON_SUFFIX} - - YSTRD=`$NDATE -24 $PDATE` - TARDATE=`echo $YSTRD|cut -c1-8` - -# ONEYEAR=`$NDATE -8760 $YSTRD` - DAY=`echo $PDATE|cut -c7-8` - - htar -cvf ${HPSSDIR}/radmon.${TARDATE}.tar ${TANKDIR}/radmon.${TARDATE} - -fi - -#------------------------------------------------------------------ -# Clean up and exit -#------------------------------------------------------------------ -cd $tmpdir -cd ../ -rm -rf $tmpdir - -exit - diff --git a/util/Radiance_Monitor/image_gen/ush/query_data_map.pl b/util/Radiance_Monitor/image_gen/ush/query_data_map.pl deleted file mode 120000 index a9bb178f3b..0000000000 --- a/util/Radiance_Monitor/image_gen/ush/query_data_map.pl +++ /dev/null @@ -1 +0,0 @@ -../../data_extract/ush/query_data_map.pl \ No newline at end of file diff --git a/util/Radiance_Monitor/image_gen/ush/rm_img_files.pl b/util/Radiance_Monitor/image_gen/ush/rm_img_files.pl new file mode 100755 index 0000000000..2b6e0ca5dc --- /dev/null +++ b/util/Radiance_Monitor/image_gen/ush/rm_img_files.pl @@ -0,0 +1,101 @@ +#!/usr/bin/perl +use strict; +use warnings; +use Getopt::Long; +use Scalar::Util qw(looks_like_number); + + +#------------------------------------------------------------------- +# +# Subroutine uniq +# +# Given an input array, return all unique values in an array. +# +#------------------------------------------------------------------- + sub uniq { + my %seen; + return grep { !$seen{$_}++ } @_; + } + + +#-------------------- +# Main begins here +#-------------------- + +print "--> rm_img_files.pl"; + +#-------------------------------- +# load command line argument(s) +#-------------------------------- +my $dir = './'; # directory to be cleaned up (~/nbns/imgn/NET/RUN/monitor/pngs) +my $nfl = 20; # number of files to keep + +GetOptions( 'dir=s' => \$dir, + 'nfl=i' => \$nfl ); + +#----------------------------------- +# get directory $dir/hist contents +#----------------------------------- +opendir my $target_dir, "$dir/summary" or die "Cannot open directory: $!"; +my @files = readdir $target_dir; +closedir $target_dir; + +#----------------------------------------------------- +# Break up file names and get the unique cycle times +# +# Sort the unique list in reverse order so the latest +# cycle time is first. +#----------------------------------------------------- +my @times = (); +foreach my $file ( @files ) { + my @spl = split( '\.', $file ); + if( looks_like_number( $spl[1] ) && length($spl[1] ) == 10 ) { + push( @times, $spl[1] ); + } +} + +my @unique = (); +if ( $#times >= 0 ) { + @unique = sort{ $b <=> $a }( uniq( @times )); +} + + +#------------------------------------- +# Identify cycle times to be removed +#------------------------------------- +my @del_list = (); +my @sdir_list = qw( summary ); + +if( $#unique >= $nfl ) { + my $ii = $nfl; + my $end = $#unique; + + foreach my $time ( @unique ) { + print "$time\n"; + } + print " ii, end = $ii, $end\n"; + + do { + push( @del_list, $unique[$ii] ); + $ii++; + } while $ii <= $end; + + + #--------------------------------------------- + # step through the del_list and dir_list to + # remove old image files + #--------------------------------------------- + print "del_list = @del_list\n"; + + foreach my $sdir ( @sdir_list ) { + + foreach my $del ( @del_list ) { + my $rm_cmd = "rm -f $dir/$sdir/*$del*"; + print "RM: $rm_cmd\n"; + system( $rm_cmd ) == 0 + or die "system $rm_cmd failed: $?"; + } + } +} + +print "<-- rm_img_files.pl"; diff --git a/util/Radiance_Monitor/image_gen/ush/run_plot_V02.sh b/util/Radiance_Monitor/image_gen/ush/run_plot_V02.sh deleted file mode 100755 index ca75695169..0000000000 --- a/util/Radiance_Monitor/image_gen/ush/run_plot_V02.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/sh - -# -# This is test plot script for use on theia -# - -set -ax -package=ProdGSI/util/Radiance_Monitor -idev=`cat /etc/dev | cut -c1` -iprod=`cat /etc/prod | cut -c1` - -#scripts=/gpfs/${idev}d2/emc/da/noscrub/Edward.Safford/${package}/image_gen/ush -scripts=/scratch4/NCEPDEV/da/noscrub/Edward.Safford/${package}/image_gen/ush - -export DO_DATA_RPT=0 -export DO_DIAG_RPT=0 -#export NDATE=/nwprod/util/exec/ndate -export DO_ARCHIVE=0 -export JOB_QUEUE=dev_shared -export NUM_CYCLES=360 - -export REGIONAL_RR=0 -export CYCLE_INTERVAL=6 -export TANK_USE_RUN=1 -export RUN_TRANSFER=0 -export PLOT_STATIC_IMGS=1 - -export RADMON_SUFFIX=control_V02 -export RUN=gdas - -#data_map=/gpfs/${idev}d2/emc/da/noscrub/Edward.Safford/${package}/parm/data_map.xml -data_map=/scratch4/NCEPDEV/da/noscrub/Edward.Safford/${package}/parm/data_map.xml - -#tankdir=/gpfs/${idev}d2/emc/da/noscrub/Edward.Safford/nbns/stats/${RADMON_SUFFIX} -tankdir=/home/Edward.Safford/nbns/stats/${RADMON_SUFFIX} - -#imgdate=`${scripts}/query_data_map.pl ${data_map} ${RADMON_SUFFIX}_${RUN} imgdate` -#idate=`$NDATE +${CYCLE_INTERVAL} $imgdate` -idate=2018121200 - -prodate=`${scripts}/nu_find_cycle.pl --dir ${tankdir} --cyc 1 --run ${RUN}` -#prodate=2018121200 -echo "imgdate, prodate = $imgdate, $prodate" - -if [[ $idate -le $prodate ]]; then - - logdir=/scratch4/NCEPDEV/stmp4/Edward.Safford/logs/${RADMON_SUFFIX}/${RUN}/radmon - echo " firing CkPlt_glbl.sh with ${RADMON_SUFFIX} $idate" - - ${scripts}/CkPlt_glbl.sh ${RADMON_SUFFIX} $idate 1>${logdir}/CkPlt_${RADMON_SUFFIX}_${RUN}.log 2>${logdir}/CkPlt_${RADMON_SUFFIX}_${RUN}.err - -# rc=`${scripts}/update_data_map.pl ${data_map} ${RADMON_SUFFIX}_${RUN} imgdate ${idate}` - -fi - - -exit diff --git a/util/Radiance_Monitor/image_gen/ush/run_plot_nam.sh b/util/Radiance_Monitor/image_gen/ush/run_plot_nam.sh deleted file mode 100755 index 75bcf66321..0000000000 --- a/util/Radiance_Monitor/image_gen/ush/run_plot_nam.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/sh - -echo starting run_plot_nam.sh - -idev=`cat /etc/dev | cut -c1` -iprod=`cat /etc/prod | cut -c1` - -export PROJECT=NDAS-T2O -export RADSTAT_LOCATION=/com/nam/prod -export DO_ARCHIVE=1 -export DO_DATA_RPT=1 -export DO_DIAG_RPT=1 -export JOB_QUEUE=dev_shared -export MAIL_TO="edward.safford@noaa.gov" -#export MAIL_CC="russ.treadon" -#export MAIL_CC="edward.c.safford@gmail.com" - -export RADMON_SUFFIX=nam -export TANK_USE_RUN=0 -export RUN="" -export RAD_AREA=rgn -export CYCLE_INTERVAL=1 -export USE_STATIC_SATYPE=1 -export REGIONAL_RR=1 - -package=ProdGSI/util/Radiance_Monitor -scripts=/gpfs/${idev}d2/emc/da/noscrub/Edward.Safford/${package}/image_gen/ush - -NDATE=/nwprod/util/exec/ndate -data_map=/gpfs/${idev}d2/emc/da/noscrub/Edward.Safford/${package}/parm/data_map.xml - -tankdir=/gpfs/${idev}d2/emc/da/noscrub/Edward.Safford/nbns/stats/regional/nam -imgdate=`${scripts}/query_data_map.pl ${data_map} nam imgdate` - -idate=`$NDATE +${CYCLE_INTERVAL} $imgdate` - -prodate=`${scripts}/find_cycle.pl --cyc 1 --dir ${tankdir}` - -echo idate, prodate = $idate, $prodate - -if [[ $idate -le $prodate ]]; then - - ${scripts}/CkPlt_rgnl.sh nam $idate 1>/ptmpp1/Edward.Safford/logs/${RADMON_SUFFIX}/radmon/CkPlt_nam.log 2>/ptmpp1/Edward.Safford/logs/${RADMON_SUFFIX}/radmon/CkPlt_nam.err - - rc=`${scripts}/update_data_map.pl ${data_map} nam imgdate ${idate}` - - scp ${data_map} gyre:/gpfs/td2/emc/da/noscrub/Edward.Safford/${package}/parm/data_map.xml -fi - - -echo exiting run_plot_nam.sh - -exit diff --git a/util/Radiance_Monitor/image_gen/ush/run_plot_testrad.sh b/util/Radiance_Monitor/image_gen/ush/run_plot_testrad.sh deleted file mode 100755 index 9bf504b9d9..0000000000 --- a/util/Radiance_Monitor/image_gen/ush/run_plot_testrad.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/sh - -# -# This is test plot script for use on theia -# - -set -ax -package=ProdGSI/util/Radiance_Monitor -idev=`cat /etc/dev | cut -c1` -iprod=`cat /etc/prod | cut -c1` - -#scripts=/gpfs/${idev}d2/emc/da/noscrub/Edward.Safford/${package}/image_gen/ush -scripts=/scratch4/NCEPDEV/da/noscrub/Edward.Safford/${package}/image_gen/ush - -export DO_DATA_RPT=0 -export DO_DIAG_RPT=0 -#export NDATE=/nwprod/util/exec/ndate -export DO_ARCHIVE=0 -export JOB_QUEUE=dev_shared -export NUM_CYCLES=360 - -export REGIONAL_RR=0 -export CYCLE_INTERVAL=6 -export TANK_USE_RUN=1 -export RUN_TRANSFER=0 - -export RADMON_SUFFIX=testrad -export RUN=gdas - -#data_map=/gpfs/${idev}d2/emc/da/noscrub/Edward.Safford/${package}/parm/data_map.xml -data_map=/scratch4/NCEPDEV/da/noscrub/Edward.Safford/${package}/parm/data_map.xml - -#tankdir=/gpfs/${idev}d2/emc/da/noscrub/Edward.Safford/nbns/stats/${RADMON_SUFFIX} -tankdir=/home/Edward.Safford/nbns/stats/${RADMON_SUFFIX} - -imgdate=`${scripts}/query_data_map.pl ${data_map} ${RADMON_SUFFIX}_${RUN} imgdate` - -#idate=`$NDATE +${CYCLE_INTERVAL} $imgdate` - -#prodate=`${scripts}/find_cycle.pl --dir ${tankdir} --cyc 1 --run ${RUN}` -prodate=2018091718 -echo "imgdate, prodate = $imgdate, $prodate" - -if [[ $idate -le $prodate ]]; then - - logdir=/scratch4/NCEPDEV/stmp4/Edward.Safford/logs/${RADMON_SUFFIX}/${RUN}/radmon - echo " firing CkPlt_glbl.sh with ${RADMON_SUFFIX} $idate" - - ${scripts}/CkPlt_glbl.sh ${RADMON_SUFFIX} $idate 1>${logdir}/CkPlt_${RADMON_SUFFIX}_${RUN}.log 2>${logdir}/CkPlt_${RADMON_SUFFIX}_${RUN}.err - -# rc=`${scripts}/update_data_map.pl ${data_map} ${RADMON_SUFFIX}_${RUN} imgdate ${idate}` - -fi - - -exit diff --git a/util/Radiance_Monitor/image_gen/ush/run_plot_wopr.sh b/util/Radiance_Monitor/image_gen/ush/run_plot_wopr.sh deleted file mode 100755 index 30cc6c28cd..0000000000 --- a/util/Radiance_Monitor/image_gen/ush/run_plot_wopr.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/sh - -set -ax -package=ProdGSI/util/Radiance_Monitor -idev=`cat /etc/dev | cut -c1` -iprod=`cat /etc/prod | cut -c1` - -scripts=/gpfs/${idev}d2/emc/da/noscrub/Edward.Safford/${package}/image_gen/ush - -export DO_DATA_RPT=1 -export DO_DIAG_RPT=1 -export NDATE=/nwprod/util/exec/ndate -export DO_ARCHIVE=0 -export JOB_QUEUE=dev_shared -export NUM_CYCLES=360 -export MAIL_CC="russ.treadon@noaa.gov, john.derber@noaa.gov, andrew.collard@noaa.gov" -#export MAIL_CC="edward.c.safford@gmail.com" - -export REGIONAL_RR=0 -export CYCLE_INTERVAL=6 -export TANK_USE_RUN=1 -export RUN_TRANSFER=1 - -export RADMON_SUFFIX=GFS -export RUN=gdas - -data_map=/gpfs/${idev}d2/emc/da/noscrub/Edward.Safford/${package}/parm/data_map.xml - -tankdir=/gpfs/${idev}d2/emc/da/noscrub/Edward.Safford/nbns/stats/${RADMON_SUFFIX} - -imgdate=`${scripts}/query_data_map.pl ${data_map} ${RADMON_SUFFIX}_${RUN} imgdate` - -idate=`$NDATE +${CYCLE_INTERVAL} $imgdate` - -prodate=`${scripts}/find_cycle.pl --dir ${tankdir} --cyc 1 --run ${RUN}` -echo "imgdate, prodate = $imgdate, $prodate" -if [[ $idate -le $prodate ]]; then - - echo " firing CkPlt_glbl.sh with ${RADMON_SUFFIX} $idate" - ${scripts}/CkPlt_glbl.sh ${RADMON_SUFFIX} $idate 1>/ptmpp1/Edward.Safford/logs/CkPlt_${RADMON_SUFFIX}_${RUN}.log 2>/ptmpp1/Edward.Safford/logs/CkPlt_${RADMON_SUFFIX}_${RUN}.err - - rc=`${scripts}/update_data_map.pl ${data_map} ${RADMON_SUFFIX}_${RUN} imgdate ${idate}` - -fi - - -exit diff --git a/util/Radiance_Monitor/image_gen/ush/run_transfer_nam.sh b/util/Radiance_Monitor/image_gen/ush/run_transfer_nam.sh deleted file mode 100755 index 95bb60b381..0000000000 --- a/util/Radiance_Monitor/image_gen/ush/run_transfer_nam.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/sh - -export RADMON_SUFFIX=nam - -package=ProdGSI/util/Radiance_Monitor -idev=`cat /etc/dev | cut -c1` - -scripts=/gpfs/${idev}d2/emc/da/noscrub/Edward.Safford/${package}/image_gen/ush - -export PROJECT=NDAS-T2O -export RAD_AREA=rgn -export MY_MACHINE=wcoss -export TANK_USE_RUN=0 - -data_map=/gpfs/${idev}d2/emc/da/noscrub/Edward.Safford/${package}/util/Radiance_Monitor/parm/data_map.xml -tankdir=/u/Edward.Safford/nbns/stats/regional/${RADMON_SUFFIX} - -export logfile=/ptmpp1/Edward.Safford/logs/Transfer_${RADMON_SUFFIX}.log -export JOB_QUEUE=transfer - -shell=sh -. /usrx/local/Modules/default/init/${shell} -module load lsf -export SUB=bsub - -export jobname=transfer_${RADMON_SUFFIX} - -if [[ $MY_MACHINE = "wcoss" ]]; then - $SUB -P $PROJECT -q $JOB_QUEUE -o ${logfile} -M 80 -W 0:45 \ - -R affinity[core] -J ${jobname} -cwd ${PWD} \ - ${scripts}/Transfer.sh ${RADMON_SUFFIX} --area ${RAD_AREA} - -else - ${scripts}/Transfer.sh ${RADMON_SUFFIX} --area ${RAD_AREA} \ - 1>/ptmpp1/Edward.Safford/logs/Transfer_${RADMON_SUFFIX}.log \ - 2>/ptmpp1/Edward.Safford/logs/Transfer_${RADMON_SUFFIX}.err - -fi - -exit diff --git a/util/Radiance_Monitor/image_gen/ush/run_transfer_wopr.sh b/util/Radiance_Monitor/image_gen/ush/run_transfer_wopr.sh deleted file mode 100755 index 8db3f10fd5..0000000000 --- a/util/Radiance_Monitor/image_gen/ush/run_transfer_wopr.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/sh - -package=ProdGSI/util/Radiance_Monitor -idev=`cat /etc/dev | cut -c1` - -scripts=/gpfs/${idev}d2/emc/da/noscrub/Edward.Safford/${package}/image_gen/ush - -export PROJECT=GDAS-T2O -export RAD_AREA=glb -export MY_MACHINE=wcoss - -export JOB_QUEUE=transfer - -shell=sh -. /usrx/local/Modules/default/init/${shell} -module load lsf -export SUB="bsub" - -export RADMON_SUFFIX=GFS -export jobname=transfer_${RADMON_SUFFIX} -export RUN=gdas -export TANK_USE_RUN=1 - -export logfile=/ptmpp1/Edward.Safford/logs/${RADMON_SUFFIX}/${RUN}/radmon/Transfer_wopr.log - -if [[ $MY_MACHINE = "wcoss" ]]; then - $SUB -P $PROJECT -q $JOB_QUEUE -o ${logfile} -M 80 -W 0:45 \ - -R affinity[core] -J ${jobname} -cwd ${PWD} \ - ${scripts}/Transfer.sh ${RADMON_SUFFIX} --run $RUN --area $RAD_AREA -else - - ${scripts}/Transfer.sh ${RADMON_SUFFIX} \ - 1>/ptmpp1/Edward.Safford/logs/Transfer_${RADMON_SUFFIX}.log \ - 2>/ptmpp1/Edward.Safford/logs/Transfer_${RADMON_SUFFIX}.err - -fi - -exit diff --git a/util/Radiance_Monitor/image_gen/ush/update_data_map.pl b/util/Radiance_Monitor/image_gen/ush/update_data_map.pl deleted file mode 100755 index 5a28cd309d..0000000000 --- a/util/Radiance_Monitor/image_gen/ush/update_data_map.pl +++ /dev/null @@ -1,59 +0,0 @@ -#! /usr/bin/perl - -#------------------------------------------------------------------- -# update_data_map.pl -# -# This script updates a requested field in the data_map.xml file. If -# the requested field does not exist in but the parent node (suffix) -# is found then the requested field and value are added to the -# data_map.xml file. -# -# Calling sequence: -# >> update_data_map.pl ./path/to/data_map.xml suffix req_field new_val -# -# 1. data_map.xml file (full or relative path) -# 2. suffix identifying the data source (an element in the -# data_map.xml file) -# 3. requested field, one of the xml child elements of the -# suffix element. -# 4. new value for the requested field -# -# Return codes (sent to stdout): -# 0 update was successful -# 1 the suffix and/or field was not found. -# -# Note: Calling scripts generally assign a variable value to -# output from this script. If diagnostic print messages -# are left uncommented then results will become undefined. -#------------------------------------------------------------------- - use strict; - use warnings; - use XML::LibXML; - - my $dmfile = $ARGV[0]; - my $source = $ARGV[1]; - my $field = $ARGV[2]; - my $value = $ARGV[3]; - my $rc = "1"; - - my $parser = XML::LibXML->new(); - my $doc = $parser->parse_file($dmfile); - - my $query = "//$source/$field/text()"; - - my($node) = $doc->findnodes($query); - - if( $node ) { - $node->setData("$value" ); - $doc->toFile( $dmfile ); - $rc = "0"; - } - else { - my $new_query = "//$source"; - my ($src_node) = $doc->findnodes($new_query); - $src_node->appendTextChild( "$field", "$value" ); - $doc->toFile( $dmfile ); - $rc = "0"; - } - - print "$rc"; diff --git a/util/Radiance_Monitor/makeall.sh b/util/Radiance_Monitor/makeall.sh deleted file mode 100755 index 970fa0f16a..0000000000 --- a/util/Radiance_Monitor/makeall.sh +++ /dev/null @@ -1,97 +0,0 @@ -#! /bin/bash - -#------------------------------------------------------------------ -# makeall -# -# This scripts makes all of the executables in the nwprod, -# data_extract and image_gen subdirectories and places the -# executables into the proper exec directories. -# -# An optional arguments to this script include "clean", "debug", -# and "check_prereqs". Do not use "install" as an optional -# argument -- this script will do that automatically. -# If no argument is included "all" and "install" are assumed. -#------------------------------------------------------------------ -set -ax - -mode=${1:-} -top_level=${PWD} -echo "top_level = ${top_level}" - -machine=`./get_hostname.pl` -echo "machine = $machine" - -#------------------------------ -# source RadMon_config -#------------------------------ -. ${top_level}/parm/RadMon_config -. ${top_level}/parm/radmon.ver - - -if [[ ${machine} = "theia" || ${machine} = "wcoss" || ${machine} = "wcoss_d" || ${machine} = "cray" ]]; then - echo Building executables on ${machine} - echo - - #------------------------------------------------------------------ - # make data extract executables - #------------------------------------------------------------------ - - module use -a ${HOMEradmon}/modulefiles/${machine} - module load RadMonBuild - - executables="angle bcoef bcor time" - echo "Making executables in nwprod/radmon_shared.${radmon_shared_ver}/sorc:" - for var in ${executables}; do - if [[ $var = "angle" ]]; then - cd ${top_level}/nwprod/radmon_shared.${radmon_shared_ver}/sorc/verf_radang.fd - else - cd ${top_level}/nwprod/radmon_shared.${radmon_shared_ver}/sorc/verf_rad${var}.fd - fi - - make ${mode} - if [[ $mode = "" ]]; then - make install - fi - - echo - - done - - cd ${top_level}/data_extract/sorc/make_base.fd - make ${mode} - if [[ $mode = "" ]]; then - make install - fi - - cd ${top_level}/data_extract/sorc/validate_time.fd - make ${mode} - if [[ $mode = "" ]]; then - make install - fi - - - #------------------------------------------------------------------ - # make image generation executables - #------------------------------------------------------------------ - executables="horiz summary time bcoef angle" - - cd ${top_level}/image_gen/src - echo "Making image_gen/src:" - for var in ${executables}; do - - make -f makefile.${var} ${mode} - if [[ $mode = "" ]]; then - make -f makefile.${var} install - fi - echo - done - - module unload RadMonBuild - set +x - -else - echo ${machine} is not supported -fi - -exit - diff --git a/util/Radiance_Monitor/nwprod/gdas_radmon.v2.0.2/driver/test_jgdas_verfrad.sh b/util/Radiance_Monitor/nwprod/gdas_radmon.v2.0.2/driver/test_jgdas_verfrad.sh deleted file mode 100755 index 32a4250a85..0000000000 --- a/util/Radiance_Monitor/nwprod/gdas_radmon.v2.0.2/driver/test_jgdas_verfrad.sh +++ /dev/null @@ -1,82 +0,0 @@ -#!/bin/ksh - -#BSUB -o gdas_verfrad.o%J -#BSUB -e gdas_verfrad.o%J -#BSUB -J gdas_verfrad -#BSUB -q dev_shared -#BSUB -n 1 -#BSUB -R affinity[core] -#BSUB -M 100 -#BSUB -W 00:20 -#BSUB -a poe -#BSUB -P GFS-T2O - -set -x - -export PDATE=2016022500 - -############################################################# -# Specify whether the run is production or development -############################################################# -export PDY=`echo $PDATE | cut -c1-8` -export cyc=`echo $PDATE | cut -c9-10` -export job=gdas_verfrad.${cyc} -export pid=${pid:-$$} -export jobid=${job}.${pid} -export envir=para -export DATAROOT=/ptmpp1/$LOGNAME/test_data -export COMROOT=/ptmpp1/$LOGNAME/com - - -############################################################# -# Specify versions -############################################################# -export gdas_ver=v13.0.0 -export global_shared_ver=v13.0.0 -export grib_util_ver=v1.0.1 -export prod_util_ver=v1.0.2 -export util_shared_ver=v1.0.2 -export gdas_radmon_ver=v2.0.0 -export radmon_shared_ver=v2.0.2 - - -############################################################# -# Load modules -############################################################# -. /usrx/local/Modules/3.2.9/init/ksh -module use /nwprod2/modulefiles -module load grib_util/$grib_util_ver -module load prod_util/$prod_util_ver -module load util_shared/$util_shared_ver - -module unload ics/12.1 -module load ics/15.0.3 - -module list - - -############################################################# -# WCOSS environment settings -############################################################# -export POE=YES - - -############################################################# -# Set user specific variables -############################################################# -export RADMON_SUFFIX=testrad -export NWTEST=/da/noscrub/${LOGNAME}/RadMon_545/util/Radiance_Monitor/nwprod -export HOMEgdas=${NWTEST}/gdas_radmon.${gdas_radmon_ver} -export JOBGLOBAL=${HOMEgdas}/jobs -export HOMEradmon=${NWTEST}/radmon_shared.${radmon_shared_ver} -export COM_IN=${DATAROOT} -export TANKverf=${COMROOT}/${RADMON_SUFFIX} - - -############################################################# -# Execute job -############################################################# -$JOBGLOBAL/JGDAS_VERFRAD - -exit - diff --git a/util/Radiance_Monitor/nwprod/gdas_radmon.v2.0.2/driver/test_jgdas_verfrad_cray.sh b/util/Radiance_Monitor/nwprod/gdas_radmon.v2.0.2/driver/test_jgdas_verfrad_cray.sh deleted file mode 100755 index 2d2bf8b290..0000000000 --- a/util/Radiance_Monitor/nwprod/gdas_radmon.v2.0.2/driver/test_jgdas_verfrad_cray.sh +++ /dev/null @@ -1,78 +0,0 @@ -#!/bin/ksh - -#BSUB -o gdas_verfrad.o%J -#BSUB -e gdas_verfrad.o%J -#BSUB -J gdas_verfrad -#BSUB -q dev -#BSUB -M 100 -#BSUB -W 00:20 -#BSUB -P GFS-T2O -#BSUB -R "select[mem>100] rusage[mem=100]" - -set -x - -export PDATE=2016022500 - -############################################################# -# Specify whether the run is production or development -############################################################# -export PDY=`echo $PDATE | cut -c1-8` -export cyc=`echo $PDATE | cut -c9-10` -export job=gdas_verfrad.${cyc} -export pid=${pid:-$$} -export jobid=${job}.${pid} -export envir=para - -############################################################# -# Specify versions -############################################################# -export gdas_ver=v13.1.0 -export global_shared_ver=v13.1.0 -export grib_util_ver=v1.0.1 -export prod_util_ver=1.0.3 -export util_shared_ver=v1.0.2 -export gdas_radmon_ver=v2.0.0 -export radmon_shared_ver=v2.0.2 - - -############################################################# -# Load modules -############################################################# -. $MODULESHOME/init/ksh - -module load prod_util/${prod_util_ver} -module load prod_envir -#module load PrgEnv-intel - -module list - - -############################################################# -# WCOSS environment settings -############################################################# -export POE=YES - - -############################################################# -# Set user specific variables -############################################################# -export DATAROOT=/gpfs/hps/emc/da/noscrub/$LOGNAME/test_data -export COMROOT=/gpfs/hps/ptmp/$LOGNAME/com -export RADMON_SUFFIX=testrad -export NWTEST=/gpfs/hps/emc/da/noscrub/${LOGNAME} -export HOMEgdas=${NWTEST}/gdas.${gdas_ver} -export JOBGLOBAL=${HOMEgdas}/jobs - -export HOMEradmon=${NWTEST}/global_shared.${global_shared_ver} - -export COM_IN=${DATAROOT} -export TANKverf=${COMROOT}/${RADMON_SUFFIX} - - -############################################################# -# Execute job -############################################################# -$JOBGLOBAL/JGDAS_VERFRAD - -exit - diff --git a/util/Radiance_Monitor/nwprod/gdas_radmon.v2.0.2/fix/gdas_radmon_satype.txt b/util/Radiance_Monitor/nwprod/gdas_radmon.v2.0.2/fix/gdas_radmon_satype.txt deleted file mode 100644 index ab3430db3b..0000000000 --- a/util/Radiance_Monitor/nwprod/gdas_radmon.v2.0.2/fix/gdas_radmon_satype.txt +++ /dev/null @@ -1 +0,0 @@ -airs_aqua amsua_aqua amsua_metop-a amsua_metop-b amsua_n15 amsua_n18 amsua_n19 hirs4_metop-a hirs4_metop-b hirs4_n19 iasi_metop-a iasi_metop-b mhs_metop-a mhs_metop-b mhs_n18 mhs_n19 atms_npp cris_npp seviri_m10 sndrd1_g15 sndrd2_g15 sndrd3_g15 sndrd4_g15 ssmis_f17 ssmis_f18 avhrr_metop-a avhrr_n18 diff --git a/util/Radiance_Monitor/nwprod/gdas_radmon.v2.0.2/fix/gdas_radmon_scaninfo.txt b/util/Radiance_Monitor/nwprod/gdas_radmon.v2.0.2/fix/gdas_radmon_scaninfo.txt deleted file mode 100644 index 59be4dc31f..0000000000 --- a/util/Radiance_Monitor/nwprod/gdas_radmon.v2.0.2/fix/gdas_radmon_scaninfo.txt +++ /dev/null @@ -1,47 +0,0 @@ - sndrd1_g13 0.00 1.00 65 - sndrd2_g13 0.00 1.00 65 - sndrd3_g13 0.00 1.00 65 - sndrd4_g13 0.00 1.00 65 - sndrd1_g14 0.00 1.00 65 - sndrd2_g14 0.00 1.00 65 - sndrd3_g14 0.00 1.00 65 - sndrd4_g14 0.00 1.00 65 - sndrd1_g15 0.00 1.00 65 - sndrd2_g15 0.00 1.00 65 - sndrd3_g15 0.00 1.00 65 - sndrd4_g15 0.00 1.00 65 - hirs3_n16 -49.50 1.80 56 - hirs3_n17 -49.50 1.80 56 - hirs4_n18 -49.50 1.80 56 - hirs4_n19 -49.50 1.80 56 - amsua_n15 -48.33 3.33 30 - amsua_n16 -48.33 3.33 30 - amsua_n17 -48.33 3.33 30 - amsua_n18 -48.33 3.33 30 - avhrr_n18 0.00 1.00 90 - amsub_n15 -48.95 1.10 90 - amsub_n16 -48.95 1.10 90 - amsub_n17 -48.95 1.10 90 - amsua_n19 -48.33 3.33 30 - mhs_n18 -48.95 1.10 90 - mhs_n19 -48.95 1.10 90 - airs_aqua -48.95 1.10 90 - amsua_aqua -48.33 3.33 30 - ssmis_f16 0.00 1.00 65 - ssmis_f17 0.00 1.00 65 - ssmis_f18 0.00 1.00 65 - ssmis_f19 0.00 1.00 65 - hirs4_metop-a -49.50 1.80 56 - amsua_metop-a -48.33 3.33 30 - ahvrr_metop-a 0.00 1.00 90 - mhs_metop-a -49.44 1.10 90 - iasi_metop-a -50.00 1.67 60 - hirs4_metop-b -49.50 1.80 56 - amsua_metop-b -48.33 3.33 30 - mhs_metop-b -49.44 1.10 90 - iasi_metop-b -50.00 1.67 60 - cris_npp -51.615 3.33 30 - atms_npp -52.725 1.11 96 - seviri_m09 0.00 1.00 90 - seviri_m10 0.00 1.00 90 -!sat_sis start step nstep diff --git a/util/Radiance_Monitor/nwprod/gdas_radmon.v2.0.2/jobs/JGDAS_VERFRAD b/util/Radiance_Monitor/nwprod/gdas_radmon.v2.0.2/jobs/JGDAS_VERFRAD deleted file mode 100755 index 46d4dee55a..0000000000 --- a/util/Radiance_Monitor/nwprod/gdas_radmon.v2.0.2/jobs/JGDAS_VERFRAD +++ /dev/null @@ -1,139 +0,0 @@ -#!/bin/sh -############################################################# -# Set up environment for GDAS Radiance Monitor job -############################################################# -set -xa -echo `date` $0 `date -u` begin -export PS4='$SECONDS + ' - -export RUN_ENVIR=${RUN_ENVIR:-nco} -export envir=${envir:-prod} - -############################### -# Specify NET and RUN name -############################## -export NET=${NET:-gfs} -export RUN=${RUN:-gdas} - -########################################################### -# obtain unique process id (pid) and make temp directories -########################################################### -export pid=$$ -export outid=${outid:-"LL$job"} -export jobid=${jobid:-"${outid}.o${pid}"} - -export DATAROOT=${DATAROOT:-/tmpnwprod2} -export DATA=${DATA:-${DATAROOT}/${jobid}} - -export RADMON_SUFFIX=${RADMON_SUFFIX:-${RUN}} - -mkdir -p $DATA -cd $DATA - -############################################################### -# This block can be modified for different test environment -############################################################### -if [ $RUN_ENVIR = nco -a $envir != prod ]; then - export SENDDBN=${SENDDBN:-NO} -fi - -#################################### -# File To Log Msgs -#################################### -export jlogfile=${jlogfile:-${COMROOT}/logs/jlogfiles/jlogfile.${job}.${pid}} - -#################################### -# Determine Job Output Name on System -#################################### -export pgmout="OUTPUT.${pid}" -export pgmerr=errfile -export cycle=t${cyc}z - -############################################## -# SENDECF - Flag Events on ECF -# SENDCOM - Copy Files From TMPDIR to $COMOUT -# SENDDBN - Issue DBNet Client Calls -# VERBOSE - Specify Verbose Output in exglobal -############################################## -export SENDCOM=${SENDCOM:-YES} -export SENDDBN=${SENDDBN:-NO} -export SENDECF=${SENDECF:-NO} -export VERBOSE=${VERBOSE:-YES} - -################################### -# Set up the UTILITIES -################################### -export utilscript=${utilscript:-${UTILROOT}/ush} -export utilexec=${utilexec:-${UTILROOT}/exec} - - -############################################## -# Specify Execution Areas -############################################## -export HOMEgdas=${HOMEgdas:-${NWROOT}/gdas_radmon.$gdas_ver} -export PARMgdas=${PARMgdas:-$HOMEgdas/parm} -export SCRgdas=${SCRgdas:-$HOMEgdas/scripts} -export FIXgdas=${FIXgdas:-$HOMEgdas/fix} - -export HOMEradmon=${HOMEradmon:-${NWROOT}/global_shared.${global_shared_ver}} -export EXECradmon=${EXECradmon:-$HOMEradmon/exec} -export FIXradmon=${FIXradmon:-${HOMEradmon}/fix} -export USHradmon=${USHradmon:-$HOMEradmon/ush} - - -################################### -# source the parm file -################################### -. ${PARMgdas}/gdas_radmon.parm - - -############################################# -# Run setpdy and initialize PDY variables -############################################# -setpdy.sh -. ./PDY - - -############################################# -# COMOUT - WHERE GSI OUTPUT RESIDES -# TANKverf - WHERE OUTPUT DATA WILL RESIDE -############################################# -export TANKverf=${TANKverf:-${COMROOT}/verf/${envir}} -export TANKverf_rad=${TANKverf}/radmon.${PDY} -export COM_IN=${COM_IN:-${COMROOT}/${NET}/${envir}} -export COMIN=${COMIN:-${COM_IN}/${RUN}.${PDY}} - -mkdir -p -m 775 $TANKverf_rad - -env - -######################################## -# Set necessary environment variables -######################################## -export RAD_AREA=${RAD_AREA:-glb} - -export biascr=${biascr:-$COMIN/gdas1.t${cyc}z.abias} -export radstat=${radstat:-$COMIN/gdas1.t${cyc}z.radstat} - -msg="JOB HAS STARTED" -postmsg "$jlogfile" "$msg" - -######################################################## -# Execute the script. -${RADMONSH:-${SCRgdas}/exgdas_vrfyrad.sh.ecf} ${PDY} ${cyc} -######################################################## - -msg="JOB COMPLETED NORMALLY" -postmsg "$jlogfile" "$msg" - -################################ -# Remove the Working Directory -################################ -KEEPDATA=${KEEPDATA:-NO} -cd $DATAROOT -if [ ${KEEPDATA} = NO ] ; then - rm -rf $DATA -fi - -date - diff --git a/util/Radiance_Monitor/nwprod/gdas_radmon.v2.0.2/parm/gdas_radmon.parm b/util/Radiance_Monitor/nwprod/gdas_radmon.v2.0.2/parm/gdas_radmon.parm deleted file mode 100644 index 906a1b588f..0000000000 --- a/util/Radiance_Monitor/nwprod/gdas_radmon.v2.0.2/parm/gdas_radmon.parm +++ /dev/null @@ -1,22 +0,0 @@ -################################## -# specify radmon_shared version -################################## -#export gdas_radmon_ver=2.0.0 -export radmon_shared_ver=2.0.2 - - -################################## -# specify radmon_shared location -################################## -export HOMEradmon=${HOMEradmon:-${NWROOT}/radmon_shared.v${radmon_shared_ver}} -export EXECradmon=${EXECradmon:-$HOMEradmon/exec} -export USHradmon=${USHradmon:-$HOMEradmon/ush} - - -################################## -# specify radmon utilities -################################## -export LITTLE_ENDIAN=${LITTLE_ENDIAN:-0} -export COMPRESS=${COMPRESS:-gzip} -export UNCOMPRESS=${UNCOMPRESS:-gunzip} -export Z=${Z:-gz} diff --git a/util/Radiance_Monitor/nwprod/gdas_radmon.v2.0.2/scripts/exgdas_vrfyrad.sh.ecf b/util/Radiance_Monitor/nwprod/gdas_radmon.v2.0.2/scripts/exgdas_vrfyrad.sh.ecf deleted file mode 100755 index 225e3dbaf9..0000000000 --- a/util/Radiance_Monitor/nwprod/gdas_radmon.v2.0.2/scripts/exgdas_vrfyrad.sh.ecf +++ /dev/null @@ -1,306 +0,0 @@ -#/bin/sh -################################################################################ -#### UNIX Script Documentation Block -# . . -# Script name: exgdas_vrfyrad.sh.ecf -# Script description: Runs data extract/validation for global radiance diag data -# -# Author: Ed Safford Org: NP23 Date: 2012-01-18 -# -# Abstract: This script runs the data extract/validation portion of the -# RadMon package. -# -# Script history log: -# 2012-01-18 Ed Safford -# -# Input script positional parameters: -# 1 Current analysis date in yyyymmddhh format -# defaults to PDY; required -# 2 cycle time in cc format -# defaults to cyc; required -# -# Imported Shell Variables: -# RAD_AREA flag for global or regional -# TANKDIR repository for radmon data files -# DATA data working space -# FIXgdas fixed file directory, gdas specific -# FIXradmon radmon fixed file directory -# USHradmon radmon scripts directory -# PDY processing day; -# overridden by 1 -# cyc processing cycle; -# overridden by 2 -# LITTLE_ENDIAN Flag to indicate LE machine -# defaults to 0 (big endian) -# -# Exported Shell Variables: -# RAD_AREA flag for global or regional -# PDATE Processing date -# MAKE_CTL Signal to make ctl files, set to 1 (on) -# MAKE_DATA Signal to make data files, set to 1 (on) -# USE_ANL Signal to use analysis input files -# in addition to ges files, set to 0 (off) -# USE_MAIL Signal to send error reports by mail, set to 0 (off) -# SATYPE list of satellite/instrument sources to process -# err last return code -# DO_DIAG_RPT Signal to build the diag report, set to 1 (on) -# DO_DATA_RPT Signal to build the data report, set to 1 (on) -# MAIL_TO Mail recipients list, set to "" (no recipients) -# MAIL_CC Mail cc recipients list, set to "" (no recipients) -# -# Modules and files referenced: -# scripts : ${USHradmon}/radmon_verf_angle.sh -# ${USHradmon}/radmon_verf_bcoef.sh -# ${USHradmon}/radmon_verf_bcor.sh -# ${USHradmon}/radmon_verf_time.sh -# -# programs : $NDATE -# -# fixed data : $SATANGL -# -# input data : $biascr -# $radstat -# $biascr -# -# output data: -# -# Remarks: -# -# Condition codes -# 0 - no problem encountered -# >0 - some problem encountered -# -################################################################################ -export scr=exgdas_vrfyrad.sh.ecf - -msg="${scr} HAS STARTED" -postmsg "$jlogfile" "$msg" - -################################################################################ -# Set environment -################################################################################ -export VERBOSE=${VERBOSE:-"NO"} -if [[ "$VERBOSE" = "YES" ]] -then - set -x -fi - - -export RUN_ENVIR=${RUN_ENVIR:-nco} -export NET=${NET:-gfs} -export RUN=${RUN:-gdas} -export envir=${envir:-prod} - -# Command line arguments -export PDY=${1:-${PDY:?}} -export cyc=${2:-${cyc:?}} - -# Directories -export DATA=${DATA:-$(pwd)} -export COM_IN=${COMROOT}/${NET}/${envir} -export COMIN=${COMIN:-$COM_IN/${RUN}.${PDY}} - -export HOMEgdas=${HOMEgdas:-${NWROOT}/gdas.${gdas_ver}} -export FIXgdas=${FIXgdas:-$HOMEgdas/fix} - -export HOMEradmon=${HOMEradmon:-/${NWROOT}/radmon_shared.v${radmon_shared_ver}} -export EXECradmon=${EXECradmon:-$HOMEradmon/exec} -export FIXradmon=${FIXradmon:-${HOMEradmon}/fix} -export USHradmon=${USHradmon:-$HOMEradmon/ush} - -export TANKverf=${TANKverf:-/com/verf/prod} -export TANKverf_rad=${TANKverf}/radmon.${PDY} - -# Filenames -export biascr=${biascr:-$COMIN/gdas1.t${cyc}z.abias} -export radstat=${radstat:-$COMIN/gdas1.t${cyc}z.radstat} -export satype_file=${satype_file:-gdas_radmon_satype.txt} - -# Other variables -export RAD_AREA=${RAD_AREA:-glb} -export MAKE_CTL=${MAKE_CTL:-1} -export MAKE_DATA=${MAKE_DATA:-1} -export USE_ANL=${USE_ANL:-1} -export PDATE=${PDY}${cyc} -export DO_DIAG_RPT=${DO_DIAG_RPT:-1} -export DO_DATA_RPT=${DO_DATA_RPT:-1} -export USE_MAIL=${USE_MAIL:-0} -export MAIL_TO=${MAIL_TO:-" "} -export MAIL_CC=${MAIL_CC:-" "} -export NCP=${NCP:-/bin/cp} -export NDATE=${NDATE:-/nwprod/util/exec/ndate} - -########################################################################### -# ensure work and TANK dirs exist, verify radstat and biascr are available -if [[ ! -d ${DATA} ]]; then - mkdir $DATA -fi -cd $DATA - -if [[ ! -d ${TANKverf_rad} ]]; then - mkdir -p $TANKverf_rad -fi - -if [[ "$VERBOSE" = "YES" ]]; then - if [[ -s ${radstat} ]]; then - echo ${radstat} is available - fi - if [[ -s ${biascr} ]]; then - echo ${biascr} is available - fi -fi -##################################################################### - -data_available=0 -if [[ -s ${radstat} && -s ${biascr} ]]; then - data_available=1 - - #------------------------------------------------------------------ - # Copy data files file to local data directory. - # Untar radstat file. - #------------------------------------------------------------------ - - $NCP $biascr ./biascr.$PDATE - $NCP $radstat ./radstat.$PDATE - - tar -xvf radstat.$PDATE - rm radstat.$PDATE - - #------------------------------------------------------------------ - # SATYPE is the list of expected satellite/instrument sources - # in the radstat file. It should be stored in the $TANKverf - # directory. If it isn't there then use the $FIXgdas copy. In all - # cases write it back out to the radmon.$PDY directory. Add any - # new sources to the list before writing back out. - #------------------------------------------------------------------ - - radstat_satype=`ls d*ges* | awk -F_ '{ print $2 "_" $3 }'` - if [[ "$VERBOSE" = "YES" ]]; then - echo $radstat_satype - fi - - echo satype_file = $satype_file - - #------------------------------------------------------------------ - # Get previous cycle's date, and look for the satype_file. Using - # the previous cycle will get us the previous day's directory if - # the cycle being processed is 00z. - #------------------------------------------------------------------ - if [[ $CYC = "00" ]]; then - pday=${PDYm1} - else - pday=${PDY} - fi - - if [[ ! -e ${TANKverf}/radmon.${pday}/${satype_file} ]]; then - if [[ ! -e ${FIXgdas}/${satype_file} ]]; then - export SATYPE=$radstat_satype - if [[ "$VERBOSE" = "YES" ]]; then - echo " ${satype_file} not found. Adding it now using radstat file contents." - fi - else - export SATYPE=`cat ${FIXgdas}/${satype_file}` - fi - else - export SATYPE=`cat ${TANKverf}/radmon.${pday}/${satype_file}` - fi - - - #------------------------------------------------------------- - # Update the SATYPE if any new sat/instrument was - # found in $radstat_satype. Write the SATYPE contents back - # to $TANKverf/radmon.$PDY. - #------------------------------------------------------------- - satype_changes=0 - new_satype=$SATYPE - for type in ${radstat_satype}; do - test=`echo $SATYPE | grep $type | wc -l` - - if [[ $test -eq 0 ]]; then - if [[ "$VERBOSE" = "YES" ]]; then - echo "Found $type in radstat file but not in SATYPE list. Adding it now." - fi - satype_changes=1 - new_satype="$new_satype $type" - fi - done - - #------------------------------------------------------------------ - # If there is no satype_file in the current day's radmon.${PDY} - # directory or if changes have occurred in the SATYPE list, then - # add/update the satype_file. - #------------------------------------------------------------------ - if [[ ! -s ${TANKverf}/radmon.${PDY}/${satype_file} || $satype_changes -eq 1 ]]; then - if [[ ! -d ${TANKverf}/radmon.${PDY} ]]; then - mkdir -f ${TANKverf}/radmon.${PDY} - fi - if [[ -e ${TANKverf}/radmon.${PDY}/${satype_file} ]]; then - rm -f ${TANKverf}/radmon.${PDY}/${satype_file} - fi - echo $new_satype > ${TANKverf}/radmon.${PDY}/${satype_file} - fi - - #------------------------------------------------------------------ - # Refresh SATYPE with any additions - #------------------------------------------------------------------ - - export SATYPE=$new_satype - - - #------------------------------------------------------------------ - # Rename the diag files and uncompress - #------------------------------------------------------------------ - - for type in ${SATYPE}; do - mv diag_${type}_ges.${PDATE}.${Z} ${type}.${Z} - ${UNCOMPRESS} ./${type}.${Z} - - if [[ $USE_ANL -eq 1 ]]; then - mv diag_${type}_anl.${PDATE}.${Z} ${type}_anl.${Z} - ${UNCOMPRESS} ./${type}_anl.${Z} - fi - done - - #------------------------------------------------------------------ - # Run the child sccripts. - #------------------------------------------------------------------ - ${USHradmon}/radmon_verf_angle.sh ${PDATE} - rc_angle=$? - - ${USHradmon}/radmon_verf_bcoef.sh ${PDATE} - rc_bcoef=$? - - ${USHradmon}/radmon_verf_bcor.sh ${PDATE} - rc_bcor=$? - - ${USHradmon}/radmon_verf_time.sh ${PDATE} - rc_time=$? - -fi - -##################################################################### -# Postprocessing - -err=0 -if [[ ${data_available} -ne 1 ]]; then - err=1 -elif [[ $rc_angle -ne 0 ]]; then - err=$rc_angle -elif [[ $rc_bcoef -ne 0 ]]; then - err=$rc_bcoef -elif [[ $rc_bcor -ne 0 ]]; then - err=$rc_bcor -elif [[ $rc_time -ne 0 ]]; then - err=$rc_time -fi - -if [[ "$VERBOSE" = "YES" ]]; then - echo "end exgdas_vrfyrad.sh.ecf, exit value = ${err}" -fi - -msg="${scr} HAS ENDED" -postmsg "$jlogfile" "$msg" - -set +x -exit ${err} - diff --git a/util/Radiance_Monitor/nwprod/gdas_radmon.v3.0.0/driver/test_jgdas_verfrad.sh b/util/Radiance_Monitor/nwprod/gdas_radmon.v3.0.0/driver/test_jgdas_verfrad.sh deleted file mode 100755 index 10ceb0465a..0000000000 --- a/util/Radiance_Monitor/nwprod/gdas_radmon.v3.0.0/driver/test_jgdas_verfrad.sh +++ /dev/null @@ -1,86 +0,0 @@ -#!/bin/ksh - -#BSUB -o gdas_verfrad.o%J -#BSUB -e gdas_verfrad.o%J -#BSUB -J gdas_verfrad -#BSUB -q dev_shared -#BSUB -n 1 -#BSUB -R affinity[core] -#BSUB -M 4000 -#BSUB -W 00:20 -#BSUB -a poe -#BSUB -P GFS-T2O - -set -x - -#export PDATE=2019061700 # binary radstat -export PDATE=2018110206 # netcdf radstat - -############################################################# -# Specify whether the run is production or development -############################################################# -export PDY=`echo $PDATE | cut -c1-8` -export cyc=`echo $PDATE | cut -c9-10` -export job=gdas_verfrad.${cyc} -export pid=${pid:-$$} -export jobid=${job}.${pid} -export envir=para -export DATAROOT=/gpfs/td2/emc/da/noscrub/${LOGNAME}/test_data -export COMROOT=/ptmpd1/$LOGNAME/com - -if [[ ! -d ${COMROOT}/logs/jlogfiles ]]; then - mkdir -p ${COMROOT}/logs/jlogfiles -fi - - -############################################################# -# Specify versions -############################################################# -export gdas_ver=v15.0.0 -export global_shared_ver=v15.0.0 -export gdas_radmon_ver=v3.0.0 -export radmon_shared_ver=v3.0.0 - - -############################################################# -# Load modules -############################################################# -. /usrx/local/Modules/3.2.9/init/ksh -module use /nwprod2/modulefiles -#module load grib_util -module load prod_util -#module load util_shared - -module list - - -############################################################# -# WCOSS environment settings -############################################################# -export POE=YES - - -############################################################# -# Set user specific variables -############################################################# -export RADMON_SUFFIX=testrad -export NWTEST=/gpfs/td2/emc/da/noscrub/Edward.Safford/ProdGSI/util/Radiance_Monitor/nwprod - -export HOMEgdas=${NWTEST}/gdas_radmon.${gdas_radmon_ver} -export HOMEgfs=${HOMEgdas} -export FIXgdas=${FIXgdas:-$HOMEgfs/fix} - -export JOBGLOBAL=${HOMEgdas}/jobs -export HOMEradmon=${NWTEST}/radmon_shared.${radmon_shared_ver} -export COM_IN=${DATAROOT} -export TANKverf=${COMROOT}/${RADMON_SUFFIX} - -export parm_file=${HOMEgdas}/parm/gdas_radmon.parm - -############################################################# -# Execute job -############################################################# -$JOBGLOBAL/JGDAS_VERFRAD - -exit - diff --git a/util/Radiance_Monitor/nwprod/gdas_radmon.v3.0.0/driver/test_jgdas_verfrad_theia.sh b/util/Radiance_Monitor/nwprod/gdas_radmon.v3.0.0/driver/test_jgdas_verfrad_theia.sh deleted file mode 100755 index fcd354e00b..0000000000 --- a/util/Radiance_Monitor/nwprod/gdas_radmon.v3.0.0/driver/test_jgdas_verfrad_theia.sh +++ /dev/null @@ -1,87 +0,0 @@ -#!/bin/ksh - -#SBATCH -o gdas_verfrad.o%j -#SBATCH -J gdas_verfrad -#SBATCH --ntasks=1 --mem=5g -#SBATCH --time=20 -#SBATCH --account=fv3-cpu -#SBATCH -D . - - -set -x - -#export PDATE=${PDATE:-2018091712} #binary -export PDATE=${PDATE:-2018110206} #NetCDF -############################################################# -# Specify whether the run is production or development -############################################################# -export PDY=`echo $PDATE | cut -c1-8` -export cyc=`echo $PDATE | cut -c9-10` -export job=gdas_verfrad.${cyc} -export pid=${pid:-$$} -export jobid=${job}.${pid} -export envir=para -export DATAROOT=${DATAROOT:-/scratch4/NCEPDEV/da/noscrub/Edward.Safford/test_data} -export COMROOT=${COMROOT:-/scratch4/NCEPDEV/stmp3/$LOGNAME/com} - - -############################################################# -# Specify versions -############################################################# -export gdas_ver=v14.1.0 -export global_shared_ver=v14.1.0 -export gdas_radmon_ver=v3.0.0 -export radmon_shared_ver=v3.0.0 - - -############################################################# -# Add nwpara tools to path -############################################################# -NWPROD=${NWPROD:-/scratch4/NCEPDEV/global/save/glopara/nwpara/util} -NWPRODush=${NWPRODush:=${NWPROD}/ush} -NWPRODexec=${NWPRODexec:=${NWPROD}/exec} -export PATH=${PATH}:${NWPRODush}:${NWPRODexec} - -############################################################# -# Set user specific variables -############################################################# - -export RADMON_SUFFIX=${RADMON_SUFFIX:-testrad} -#export NWTEST=${NWTEST:-/scratch4/NCEPDEV/da/noscrub/${LOGNAME}/gfs_q3fy17} -export NWTEST=${NWTEST:-/scratch4/NCEPDEV/da/noscrub/Edward.Safford/ProdGSI/util/Radiance_Monitor/nwprod} - -export HOMEgdas=${HOMEgdas:-${NWTEST}/gdas_radmon.${gdas_radmon_ver}} -export HOMEgfs=$HOMEgdas -export FIXgdas=${HOMEgdas}/fix - -export JOBGLOBAL=${JOBGLOBAL:-${HOMEgdas}/jobs} -export HOMEradmon=${HOMEradmon:-${NWTEST}/radmon_shared.${radmon_shared_ver}} -export COM_IN=${COM_IN:-${DATAROOT}} -export TANKverf=${TANKverf:-${COMROOT}/${RADMON_SUFFIX}} - -export SUB=${SUB:-/apps/torque/default/bin/qsub} -export NDATE=${NDATE:-ndate} - -export parm_file=${HOMEgdas}/parm/gdas_radmon.parm - -####################################################################### -# theia specific hacks for no prod_utils module & no setpdy.sh script -####################################################################### -export MY_MACHINE=theia -prevday=`$NDATE -24 $PDATE` -export PDYm1=`echo $prevday | cut -c1-8` -ln -s ${NWPRODush}/startmsg.sh ${COMROOT}/startmsg -ln -s ${NWPRODush}/postmsg.sh ${COMROOT}/postmsg -ln -s ${NWPRODush}/prep_step.sh ${COMROOT}/prep_step -ln -s ${NWPRODush}/err_chk.sh ${COMROOT}/err_chk -export PATH=$PATH:${COMROOT} -export utilscript=${utilscript:-${NWPRODush}} # err_chk calls postmsg.sh - # directly so need to override - # utilscript location for theia -############################################################# -# Execute job -############################################################# -$JOBGLOBAL/JGDAS_VERFRAD - -exit - diff --git a/util/Radiance_Monitor/nwprod/gdas_radmon.v3.0.0/fix/gdas_radmon_satype.txt b/util/Radiance_Monitor/nwprod/gdas_radmon.v3.0.0/fix/gdas_radmon_satype.txt deleted file mode 100644 index fd3b23aa55..0000000000 --- a/util/Radiance_Monitor/nwprod/gdas_radmon.v3.0.0/fix/gdas_radmon_satype.txt +++ /dev/null @@ -1,2 +0,0 @@ -abi_g16 abi_g17 ahi_himawari8 airs_aqua amsua_aqua amsua_metop-a amsua_metop-b amsua_metop-c amsua_n15 amsua_n18 amsua_n19 atms_npp atms_n20 avhrr_metop-a avhrr_metop-b avhrr_n18 avhrr_n19 cris-fsr_npp cris-fsr_n20 hirs4_metop-a hirs4_metop-b hirs4_n19 iasi_metop-a iasi_metop-b mhs_metop-a mhs_metop-b mhs_metop-c mhs_n19 saphir_meghat seviri_m08 seviri_m11 ssmis_f17 ssmis_f18 - diff --git a/util/Radiance_Monitor/nwprod/gdas_radmon/driver/test_jgdas_verfrad_hera.sh b/util/Radiance_Monitor/nwprod/gdas_radmon/driver/test_jgdas_verfrad_hera.sh new file mode 100755 index 0000000000..5096178f17 --- /dev/null +++ b/util/Radiance_Monitor/nwprod/gdas_radmon/driver/test_jgdas_verfrad_hera.sh @@ -0,0 +1,70 @@ +#!/bin/ksh + +#SBATCH -o gdas_verfrad.o%j +#SBATCH -J gdas_verfrad +#SBATCH --ntasks=1 --mem=5g +#SBATCH --time=20 +#SBATCH --account=fv3-cpu +#SBATCH -D . + + +set -x + +export MY_MACHINE=hera + +export PDATE=${PDATE:-2021022518} #binary +#export PDATE=${PDATE:-2021022800} #NetCDF + +############################################################# +# Specify whether the run is production or development +############################################################# +export PDY=`echo $PDATE | cut -c1-8` +export cyc=`echo $PDATE | cut -c9-10` +export job=gdas_verfrad.${cyc} +export pid=${pid:-$$} +export jobid=${job}.${pid} +export envir=para +export DATAROOT=${DATAROOT:-/scratch1/NCEPDEV/da/Edward.Safford/noscrub/test_data} +export COMROOT=${COMROOT:-/scratch2/NCEPDEV/stmp3/${LOGNAME}/com} + + +############################################################# +# Specify versions +############################################################# +export gdas_ver=v14.1.0 +export global_shared_ver=v14.1.0 + + +############################################################# +# Set user specific variables +############################################################# + +export RADMON_SUFFIX=${RADMON_SUFFIX:-testrad} +export NWTEST=${NWTEST:-/scratch1/NCEPDEV/da/Edward.Safford/noscrub/GSI/util/Radiance_Monitor/nwprod} + +export HOMEgdas=${HOMEgdas:-${NWTEST}/gdas_radmon} +export HOMEgfs=$HOMEgdas +export FIXgdas=${HOMEgdas}/fix + +export JOBGLOBAL=${JOBGLOBAL:-${HOMEgdas}/jobs} +export HOMEradmon=${HOMEradmon:-${NWTEST}/radmon_shared} +export COM_IN=${COM_IN:-${DATAROOT}} +export TANKverf=${TANKverf:-${COMROOT}/${RADMON_SUFFIX}} + +export SUB=${SUB:-/apps/slurm/default/bin/sbatch} +export NDATE=${NDATE:-/home/Edward.Safford/bin/ndate} + +export parm_file=${HOMEgdas}/parm/gdas_radmon.parm + + +prevday=`$NDATE -24 $PDATE` +export PDYm1=`echo $prevday | cut -c1-8` + + +############################################################# +# Execute job +# +$JOBGLOBAL/JGDAS_ATMOS_VERFRAD + +exit + diff --git a/util/Radiance_Monitor/nwprod/gdas_radmon.v3.0.0/driver/test_jgdas_verfrad_cray.sh b/util/Radiance_Monitor/nwprod/gdas_radmon/driver/test_jgdas_verfrad_wcoss_c.sh similarity index 78% rename from util/Radiance_Monitor/nwprod/gdas_radmon.v3.0.0/driver/test_jgdas_verfrad_cray.sh rename to util/Radiance_Monitor/nwprod/gdas_radmon/driver/test_jgdas_verfrad_wcoss_c.sh index 15b8124c74..a2548d562e 100755 --- a/util/Radiance_Monitor/nwprod/gdas_radmon.v3.0.0/driver/test_jgdas_verfrad_cray.sh +++ b/util/Radiance_Monitor/nwprod/gdas_radmon/driver/test_jgdas_verfrad_wcoss_c.sh @@ -21,7 +21,7 @@ set -x export MY_MACHINE=cray -export PDATE=${PDATE:-2016100206} +export PDATE=${PDATE:-2021030306} ############################################################# # Specify whether the run is production or development @@ -31,7 +31,7 @@ export cyc=`echo $PDATE | cut -c9-10` export job=gdas_verfrad.${cyc} export pid=${pid:-$$} export jobid=${job}.${pid} -export envir=para +#export envir=para ############################################################# # Specify versions @@ -39,8 +39,6 @@ export envir=para export gdas_ver=v15.0.0 export global_shared_ver=v15.0.0 -export gdas_radmon_ver=v3.0.0 -export radmon_shared_ver=v3.0.0 ############################################################# @@ -64,22 +62,26 @@ export POE=YES # Set user specific variables ############################################################# export DATAROOT=${DATAROOT:-/gpfs/hps3/emc/da/noscrub/$LOGNAME/test_data} -export COMROOT=${COMROOT:-/gpfs/hps2/ptmp/$LOGNAME/com} +export COMROOT=/gpfs/hps2/ptmp/$LOGNAME/com export RADMON_SUFFIX=${RADMON_SUFFIX:-testrad} -export NWTEST=${NWTEST:-/gpfs/hps3/emc/da/noscrub/${LOGNAME}/ProdGSI/util/Radiance_Monitor/nwprod} -export HOMEgdas=${NWTEST}/gdas_radmon.${gdas_radmon_ver} +export NWTEST=${NWTEST:-/gpfs/hps3/emc/da/noscrub/${LOGNAME}/GSI/util/Radiance_Monitor/nwprod} +export HOMEgdas=${NWTEST}/gdas_radmon export JOBGLOBAL=${HOMEgdas}/jobs -export HOMEradmon=${NWTEST}/radmon_shared.${radmon_shared_ver} +export HOMEgfs=${HOMEgdas} +export FIXgdas=${FIXgdas:-$HOMEgfs/fix} + +export HOMEradmon=${NWTEST}/radmon_shared export COM_IN=${DATAROOT} -export TANKverf=${TANKverf:-${COMROOT}/${RADMON_SUFFIX}} +export TANKverf=${COMROOT}/${RADMON_SUFFIX} +export parm_file=${HOMEgdas}/parm/gdas_radmon.parm ############################################################# # Execute job ############################################################# -$JOBGLOBAL/JGDAS_VERFRAD +$JOBGLOBAL/JGDAS_ATMOS_VERFRAD exit diff --git a/util/Radiance_Monitor/nwprod/gdas_radmon.v3.0.0/driver/test_jgdas_verfrad_wcoss_d.sh b/util/Radiance_Monitor/nwprod/gdas_radmon/driver/test_jgdas_verfrad_wcoss_d.sh similarity index 82% rename from util/Radiance_Monitor/nwprod/gdas_radmon.v3.0.0/driver/test_jgdas_verfrad_wcoss_d.sh rename to util/Radiance_Monitor/nwprod/gdas_radmon/driver/test_jgdas_verfrad_wcoss_d.sh index 97d841806e..3c398fa7a0 100755 --- a/util/Radiance_Monitor/nwprod/gdas_radmon.v3.0.0/driver/test_jgdas_verfrad_wcoss_d.sh +++ b/util/Radiance_Monitor/nwprod/gdas_radmon/driver/test_jgdas_verfrad_wcoss_d.sh @@ -25,9 +25,7 @@ export job=gdas_verfrad.${cyc} export pid=${pid:-$$} export jobid=${job}.${pid} export envir=prod -#export DATAROOT=/gpfs/dell2/emc/modeling/noscrub/${LOGNAME}/test_data -#export DATAROOT=/gpfs/dell3/ptmp/emc.glopara/ROTDIRS/v16rt0 -export DATAROOT=/gpfs/dell1/nco/ops/com/gfs/prod +export DATAROOT=/gpfs/dell2/emc/modeling/noscrub/${LOGNAME}/test_data export COMROOT=/gpfs/dell2/ptmp/${LOGNAME} if [[ ! -d ${COMROOT}/logs/jlogfiles ]]; then @@ -39,8 +37,6 @@ fi ############################################################# export gdas_ver=v15.0.0 export global_shared_ver=v15.0.0 -export gdas_radmon_ver=v3.0.0 -export radmon_shared_ver=v3.0.0 ############################################################# @@ -75,14 +71,14 @@ if [[ -d ${DATA} ]]; then fi export jlogfile=${COMROOT}/logs/jlogfiles/${RADMON_SUFFIX}_jlog -export NWTEST=/gpfs/dell2/emc/modeling/noscrub/Edward.Safford/ProdGSI/util/Radiance_Monitor/nwprod +export NWTEST=/gpfs/dell2/emc/modeling/noscrub/Edward.Safford/GSI/util/Radiance_Monitor/nwprod -export HOMEgdas=${NWTEST}/gdas_radmon.${gdas_radmon_ver} +export HOMEgdas=${NWTEST}/gdas_radmon export HOMEgfs=${HOMEgdas} export FIXgdas=${FIXgdas:-$HOMEgfs/fix} export JOBGLOBAL=${HOMEgdas}/jobs -export HOMEradmon=${NWTEST}/radmon_shared.${radmon_shared_ver} +export HOMEradmon=${NWTEST}/radmon_shared export COM_IN=${DATAROOT} export TANKverf=${COMROOT}/${RADMON_SUFFIX} @@ -91,7 +87,7 @@ export parm_file=${HOMEgdas}/parm/gdas_radmon.parm ############################################################# # Execute job ############################################################# -$JOBGLOBAL/JGDAS_VERFRAD +$JOBGLOBAL/JGDAS_ATMOS_VERFRAD exit diff --git a/util/Radiance_Monitor/nwprod/gdas_radmon/fix/gdas_radmon_base.tar b/util/Radiance_Monitor/nwprod/gdas_radmon/fix/gdas_radmon_base.tar new file mode 100644 index 0000000000..baffae06cb Binary files /dev/null and b/util/Radiance_Monitor/nwprod/gdas_radmon/fix/gdas_radmon_base.tar differ diff --git a/util/Radiance_Monitor/nwprod/gdas_radmon/fix/gdas_radmon_satype.txt b/util/Radiance_Monitor/nwprod/gdas_radmon/fix/gdas_radmon_satype.txt new file mode 100644 index 0000000000..e948315007 --- /dev/null +++ b/util/Radiance_Monitor/nwprod/gdas_radmon/fix/gdas_radmon_satype.txt @@ -0,0 +1,2 @@ +abi_g16 abi_g17 ahi_himawari8 amsua_metop-a amsua_metop-b amsua_metop-c amsua_n15 amsua_n18 amsua_n19 atms_npp atms_n20 avhrr_metop-a avhrr_metop-b avhrr_n18 avhrr_n19 cris-fsr_npp cris-fsr_n20 hirs4_metop-a hirs4_n19 iasi_metop-a iasi_metop-b mhs_metop-a mhs_metop-b mhs_metop-c mhs_n19 saphir_meghat seviri_m08 seviri_m11 ssmis_f17 ssmis_f18 + diff --git a/util/Radiance_Monitor/nwprod/gdas_radmon.v3.0.0/fix/gdas_radmon_scaninfo.txt b/util/Radiance_Monitor/nwprod/gdas_radmon/fix/gdas_radmon_scaninfo.txt similarity index 100% rename from util/Radiance_Monitor/nwprod/gdas_radmon.v3.0.0/fix/gdas_radmon_scaninfo.txt rename to util/Radiance_Monitor/nwprod/gdas_radmon/fix/gdas_radmon_scaninfo.txt diff --git a/util/Radiance_Monitor/nwprod/gdas_radmon.v3.0.0/jobs/JGDAS_VERFRAD b/util/Radiance_Monitor/nwprod/gdas_radmon/jobs/JGDAS_ATMOS_VERFRAD similarity index 79% rename from util/Radiance_Monitor/nwprod/gdas_radmon.v3.0.0/jobs/JGDAS_VERFRAD rename to util/Radiance_Monitor/nwprod/gdas_radmon/jobs/JGDAS_ATMOS_VERFRAD index 11f69731c6..44649df166 100755 --- a/util/Radiance_Monitor/nwprod/gdas_radmon.v3.0.0/jobs/JGDAS_VERFRAD +++ b/util/Radiance_Monitor/nwprod/gdas_radmon/jobs/JGDAS_ATMOS_VERFRAD @@ -7,23 +7,24 @@ echo `date` $0 `date -u` begin export PS4='$SECONDS + ' ############################### -# Specify NET and RUN name +# Specify NET, RUN, and COMPONENT name ############################## export NET=${NET:-gfs} export RUN=${RUN:-gdas} +export COMPONENT=${COMPONENT:-atmos} ########################################################### # obtain unique process id (pid) and make temp directories ########################################################### export pid=$$ export outid=${outid:-"LL$job"} -export DATA=${DATA:-${DATAROOT}/${jobid:?}} +export RAD_DATA_IN=${RAD_DATA_IN:-${DATAROOT}/${jobid:?}} export RADMON_SUFFIX=${RADMON_SUFFIX:-${RUN}} export CYCLE_INTERVAL=${CYCLE_INTERVAL:-6} -mkdir -p $DATA -cd $DATA +mkdir -p $RAD_DATA_IN +cd $RAD_DATA_IN #################################### # Determine Job Output Name on System @@ -77,10 +78,20 @@ export p_cyc=`echo ${cdate} | cut -c9-10` # TANKverf - WHERE OUTPUT DATA WILL RESIDE ############################################# export TANKverf=${TANKverf:-${COMROOT}/${NET}/${envir}} -export TANKverf_rad=${TANKverf_rad:-${TANKverf}/${RUN}.${PDY}/${cyc}/radmon} -export TANKverf_radM1=${TANKverf_radM1:-${TANKverf}/${RUN}.${P_PDY}/${p_cyc}/radmon} +export TANKverf_rad=${TANKverf_rad:-${TANKverf}/${RUN}.${PDY}/${cyc}/$COMPONENT/radmon} +export TANKverf_radM1=${TANKverf_radM1:-${TANKverf}/${RUN}.${P_PDY}/${p_cyc}/$COMPONENT/radmon} export COM_IN=${COM_IN:-${COMROOT}/${NET}/${envir}} -export COMIN=${COMIN:-${COM_IN}/${RUN}.${PDY}/${cyc}} +export COMIN=${COMIN:-${COM_IN}/${RUN}.${PDY}/${cyc}/$COMPONENT} + +################################ +# backwards compatibility for +# gfs v15 which doesn't have +# a $COMPONENT in output path +################################ +if [[ ! -d ${COMIN} ]]; then + export COMIN=${COM_IN}/${RUN}.${PDY}/${cyc} +fi + mkdir -p -m 775 $TANKverf_rad @@ -94,17 +105,23 @@ export RAD_AREA=${RAD_AREA:-glb} export biascr=${biascr:-$COMIN/gdas.t${cyc}z.abias} export radstat=${radstat:-$COMIN/gdas.t${cyc}z.radstat} -msg="JOB HAS STARTED" -postmsg "$jlogfile" "$msg" +echo " " +echo "JOB HAS STARTED" +echo " " + ######################################################## # Execute the script. -${RADMONSH:-${SCRgfs}/exgdas_vrfyrad.sh.ecf} ${PDY} ${cyc} +${RADMONSH:-${SCRgfs}/exgdas_atmos_verfrad.sh} ${PDY} ${cyc} err=$? -[[ $err -ne 0 ]] && exit $err -msg="JOB COMPLETED NORMALLY" -postmsg "$jlogfile" "$msg" +if [[ $err -ne 0 ]] ; then + exit $err +else + echo " " + echo "JOB HAS COMPLETED NORMALLY" + echo " " +fi ################################ # Remove the Working Directory @@ -112,7 +129,7 @@ postmsg "$jlogfile" "$msg" KEEPDATA=${KEEPDATA:-YES} cd $DATAROOT if [ ${KEEPDATA} = NO ] ; then - rm -rf $DATA + rm -rf $RAD_DATA_IN fi date diff --git a/util/Radiance_Monitor/nwprod/gdas_radmon.v3.0.0/parm/gdas_radmon.parm b/util/Radiance_Monitor/nwprod/gdas_radmon/parm/gdas_radmon.parm similarity index 100% rename from util/Radiance_Monitor/nwprod/gdas_radmon.v3.0.0/parm/gdas_radmon.parm rename to util/Radiance_Monitor/nwprod/gdas_radmon/parm/gdas_radmon.parm diff --git a/util/Radiance_Monitor/nwprod/gdas_radmon.v3.0.0/scripts/exgdas_vrfyrad.sh.ecf b/util/Radiance_Monitor/nwprod/gdas_radmon/scripts/exgdas_atmos_verfrad.sh similarity index 76% rename from util/Radiance_Monitor/nwprod/gdas_radmon.v3.0.0/scripts/exgdas_vrfyrad.sh.ecf rename to util/Radiance_Monitor/nwprod/gdas_radmon/scripts/exgdas_atmos_verfrad.sh index 9edf15d9db..06244e2c04 100755 --- a/util/Radiance_Monitor/nwprod/gdas_radmon.v3.0.0/scripts/exgdas_vrfyrad.sh.ecf +++ b/util/Radiance_Monitor/nwprod/gdas_radmon/scripts/exgdas_atmos_verfrad.sh @@ -2,7 +2,7 @@ ################################################################################ #### UNIX Script Documentation Block # . . -# Script name: exgdas_vrfyrad.sh.ecf +# Script name: exgdas_vrfyrad.sh # Script description: Runs data extract/validation for global radiance diag data # # Author: Ed Safford Org: NP23 Date: 2012-01-18 @@ -15,14 +15,9 @@ # >0 - some problem encountered # ################################################################################ -export scr=exgdas_vrfyrad.sh.ecf +scr=exgdas_vrfyrad.sh +echo "${scr} HAS STARTED" -msg="${scr} HAS STARTED" -postmsg "$jlogfile" "$msg" - -################################################################################ -# Set environment -################################################################################ export VERBOSE=${VERBOSE:-"NO"} if [[ "$VERBOSE" = "YES" ]] then @@ -34,21 +29,21 @@ export RUN_ENVIR=${RUN_ENVIR:-nco} export NET=${NET:-gfs} export RUN=${RUN:-gdas} export envir=${envir:-prod} +export COMPONENT=${COMPONENT:-atmos} # Command line arguments export PDY=${1:-${PDY:?}} export cyc=${2:-${cyc:?}} # Directories -export DATA=${DATA:-$(pwd)} export COM_IN=${COMROOT}/${NET}/${envir} -export COMIN=${COMIN:-$COM_IN/${RUN}.${PDY}} +export COMIN=${COMIN:-$COM_IN/${RUN}.${PDY}/${cyc}/$COMPONENT} # Filenames export biascr=${biascr:-$COMIN/gdas.t${cyc}z.abias} export radstat=${radstat:-$COMIN/gdas.t${cyc}z.radstat} -export satype_file=${satype_file:-gdas_radmon_satype.txt} +export satype_file=${satype_file:-${FIXgdas}/gdas_radmon_satype.txt} # Other variables export RAD_AREA=${RAD_AREA:-glb} @@ -65,12 +60,8 @@ export NCP=${NCP:-/bin/cp} export NDATE=${NDATE:-/nwprod/util/exec/ndate} ########################################################################### -# ensure work and TANK dirs exist, verify radstat and biascr are available -if [[ ! -d ${DATA} ]]; then - mkdir $DATA -fi -cd $DATA - +# ensure TANK dir exists, verify radstat and biascr are available +# if [[ ! -d ${TANKverf_rad} ]]; then mkdir -p $TANKverf_rad fi @@ -127,13 +118,8 @@ if [[ -s ${radstat} && -s ${biascr} ]]; then fi echo satype_file = $satype_file - if [[ -e ${FIXgdas}/${satype_file} ]]; then - echo "using SATYPE as cat ${FIXgdas}/${satype_file}" - export SATYPE=`cat ${FIXgdas}/${satype_file}` - else - echo "using SATYPE as $radstat_satype" - export SATYPE=$radstat_satype - fi + export SATYPE=`cat ${satype_file}` + #------------------------------------------------------------- # Update the SATYPE if any new sat/instrument was @@ -154,26 +140,6 @@ if [[ -s ${radstat} && -s ${biascr} ]]; then fi done - #------------------------------------------------------------------ - # If changes have occurred in the SATYPE list, then - # update the satype_file and journal a copy to TANKverf_rad. - #------------------------------------------------------------------ - if [[ $satype_changes -eq 1 ]]; then - if [[ ! -d ${TANKverf_rad} ]]; then - mkdir -f ${TANKverf_rad} - fi - if [[ -e ${TANKverf_rad}/${satype_file} ]]; then - rm -f ${TANKverf_rad}/${satype_file} - fi - echo $new_satype > ${TANKverf_rad}/${satype_file} - fi - - #------------------------------------------------------------------ - # Refresh SATYPE with any additions - #------------------------------------------------------------------ - - export SATYPE=$new_satype - #------------------------------------------------------------------ # Rename the diag files and uncompress @@ -213,8 +179,19 @@ if [[ -s ${radstat} && -s ${biascr} ]]; then ${USHradmon}/radmon_verf_time.sh ${PDATE} rc_time=$? + #-------------------------------------- + # optionally run clean_tankdir script + # + if [[ ${CLEAN_TANKVERF} -eq 1 ]]; then + ${USHradmon}/clean_tankdir.sh glb 40 + rc_clean_tankdir=$? + echo "rc_clean_tankdir = $rc_clean_tankdir" + fi + fi + + ##################################################################### # Postprocessing @@ -232,11 +209,11 @@ elif [[ $rc_time -ne 0 ]]; then fi if [[ "$VERBOSE" = "YES" ]]; then - echo "end exgdas_vrfyrad.sh.ecf, exit value = ${err}" + echo "end exgdas_vrfyrad.sh, exit value = ${err}" fi -msg="${scr} HAS ENDED" -postmsg "$jlogfile" "$msg" +echo "${scr} HAS ENDED" + set +x exit ${err} diff --git a/util/Radiance_Monitor/nwprod/nam_radmon.v2.0.0/fix/nam_radmon_satype.txt b/util/Radiance_Monitor/nwprod/nam_radmon.v2.0.0/fix/nam_radmon_satype.txt deleted file mode 100644 index 1a653c8751..0000000000 --- a/util/Radiance_Monitor/nwprod/nam_radmon.v2.0.0/fix/nam_radmon_satype.txt +++ /dev/null @@ -1 +0,0 @@ -sndrd1_g15 sndrd2_g15 sndrd3_g15 sndrd4_g15 amsua_n15 airs_aqua amsua_aqua hirs4_metop-a amsua_n18 amsua_metop-a mhs_n18 mhs_metop-a iasi_metop-a hirs4_n19 amsua_n19 mhs_n19 seviri_m10 cris_npp atms_npp hirs4_metop-b amsua_metop-b mhs_metop-b iasi_metop-b diff --git a/util/Radiance_Monitor/nwprod/nam_radmon.v2.0.0/driver/test_jnam_verfrad.sh b/util/Radiance_Monitor/nwprod/nam_radmon/driver/test_jnam_verfrad.sh similarity index 100% rename from util/Radiance_Monitor/nwprod/nam_radmon.v2.0.0/driver/test_jnam_verfrad.sh rename to util/Radiance_Monitor/nwprod/nam_radmon/driver/test_jnam_verfrad.sh diff --git a/util/Radiance_Monitor/nwprod/nam_radmon.v2.0.0/driver/test_jnam_verfrad_cray.sh b/util/Radiance_Monitor/nwprod/nam_radmon/driver/test_jnam_verfrad_cray.sh similarity index 100% rename from util/Radiance_Monitor/nwprod/nam_radmon.v2.0.0/driver/test_jnam_verfrad_cray.sh rename to util/Radiance_Monitor/nwprod/nam_radmon/driver/test_jnam_verfrad_cray.sh diff --git a/util/Radiance_Monitor/nwprod/nam_radmon.v2.0.0/driver/test_jnam_verfrad_theia.sh b/util/Radiance_Monitor/nwprod/nam_radmon/driver/test_jnam_verfrad_theia.sh similarity index 100% rename from util/Radiance_Monitor/nwprod/nam_radmon.v2.0.0/driver/test_jnam_verfrad_theia.sh rename to util/Radiance_Monitor/nwprod/nam_radmon/driver/test_jnam_verfrad_theia.sh diff --git a/util/Radiance_Monitor/nwprod/nam_radmon/fix/nam_radmon_satype.txt b/util/Radiance_Monitor/nwprod/nam_radmon/fix/nam_radmon_satype.txt new file mode 100644 index 0000000000..cab5bae0e2 --- /dev/null +++ b/util/Radiance_Monitor/nwprod/nam_radmon/fix/nam_radmon_satype.txt @@ -0,0 +1,2 @@ +airs_aqua amsua_aqua amsua_n18 amsua_metop-a amsua_metop-b amsua_n19 iasi_metop-a iasi_metop-b hirs4_n19 mhs_metop-a mhs_metop-b mhs_npp mhs_n19 seviri_m08 seviri_m10 + diff --git a/util/Radiance_Monitor/nwprod/nam_radmon.v2.0.0/fix/nam_radmon_scaninfo.txt b/util/Radiance_Monitor/nwprod/nam_radmon/fix/nam_radmon_scaninfo.txt similarity index 68% rename from util/Radiance_Monitor/nwprod/nam_radmon.v2.0.0/fix/nam_radmon_scaninfo.txt rename to util/Radiance_Monitor/nwprod/nam_radmon/fix/nam_radmon_scaninfo.txt index 59be4dc31f..d0f55bf792 100644 --- a/util/Radiance_Monitor/nwprod/nam_radmon.v2.0.0/fix/nam_radmon_scaninfo.txt +++ b/util/Radiance_Monitor/nwprod/nam_radmon/fix/nam_radmon_scaninfo.txt @@ -1,17 +1,3 @@ - sndrd1_g13 0.00 1.00 65 - sndrd2_g13 0.00 1.00 65 - sndrd3_g13 0.00 1.00 65 - sndrd4_g13 0.00 1.00 65 - sndrd1_g14 0.00 1.00 65 - sndrd2_g14 0.00 1.00 65 - sndrd3_g14 0.00 1.00 65 - sndrd4_g14 0.00 1.00 65 - sndrd1_g15 0.00 1.00 65 - sndrd2_g15 0.00 1.00 65 - sndrd3_g15 0.00 1.00 65 - sndrd4_g15 0.00 1.00 65 - hirs3_n16 -49.50 1.80 56 - hirs3_n17 -49.50 1.80 56 hirs4_n18 -49.50 1.80 56 hirs4_n19 -49.50 1.80 56 amsua_n15 -48.33 3.33 30 @@ -42,6 +28,6 @@ iasi_metop-b -50.00 1.67 60 cris_npp -51.615 3.33 30 atms_npp -52.725 1.11 96 - seviri_m09 0.00 1.00 90 + seviri_m08 0.00 1.00 90 seviri_m10 0.00 1.00 90 !sat_sis start step nstep diff --git a/util/Radiance_Monitor/nwprod/nam_radmon.v2.0.0/jobs/JNAM_VERFRAD b/util/Radiance_Monitor/nwprod/nam_radmon/jobs/JNAM_VERFRAD similarity index 95% rename from util/Radiance_Monitor/nwprod/nam_radmon.v2.0.0/jobs/JNAM_VERFRAD rename to util/Radiance_Monitor/nwprod/nam_radmon/jobs/JNAM_VERFRAD index ae136f0fc2..676ea56e65 100755 --- a/util/Radiance_Monitor/nwprod/nam_radmon.v2.0.0/jobs/JNAM_VERFRAD +++ b/util/Radiance_Monitor/nwprod/nam_radmon/jobs/JNAM_VERFRAD @@ -23,7 +23,7 @@ export pid=$$ export outid=${outid:-"LL$job"} export jobid=${jobid:-"${outid}.o${pid}"} -export RADMON_SUFFIX=${RADMON_SUFFIX:-$RUN} +export RADMON_SUFFIX=${RADMON_SUFFIX:-$NET} export DATAROOT=${DATAROOT:-/tmpnwprod2} export DATA=${DATA:-${DATAROOT}/${jobid}} @@ -183,18 +183,12 @@ export biascr=${biascr:-$COMIN/${RADMON_SUFFIX}.${rgnHH}.satbiasc.${rgnTM}} export radstat=${radstat:-$COMIN/${RADMON_SUFFIX}.${rgnHH}.radstat.${rgnTM}} -msg="JOB HAS STARTED" -postmsg "$jlogfile" "$msg" - ######################################################## # Execute the script. -echo "EXECUTING ${SCRnam}/exnam_vrfyrad.sh.ecf" -${RADMONSH:-${SCRnam}/exnam_vrfyrad.sh.ecf} ${PDY} ${cyc} +echo "EXECUTING ${SCRnam}/exnam_verfrad.sh" +${RADMONSH:-${SCRnam}/exnam_verfrad.sh} ${PDY} ${cyc} ######################################################## -msg="JOB COMPLETED NORMALLY" -postmsg "$jlogfile" "$msg" - ################################ # Remove the Working Directory ################################ diff --git a/util/Radiance_Monitor/nwprod/nam_radmon.v2.0.0/parm/nam_radmon.parm b/util/Radiance_Monitor/nwprod/nam_radmon/parm/nam_radmon.parm similarity index 100% rename from util/Radiance_Monitor/nwprod/nam_radmon.v2.0.0/parm/nam_radmon.parm rename to util/Radiance_Monitor/nwprod/nam_radmon/parm/nam_radmon.parm diff --git a/util/Radiance_Monitor/nwprod/nam_radmon.v2.0.0/scripts/exnam_vrfyrad.sh.ecf b/util/Radiance_Monitor/nwprod/nam_radmon/scripts/exnam_verfrad.sh similarity index 81% rename from util/Radiance_Monitor/nwprod/nam_radmon.v2.0.0/scripts/exnam_vrfyrad.sh.ecf rename to util/Radiance_Monitor/nwprod/nam_radmon/scripts/exnam_verfrad.sh index 6baad5143e..dd2ae7770c 100755 --- a/util/Radiance_Monitor/nwprod/nam_radmon.v2.0.0/scripts/exnam_vrfyrad.sh.ecf +++ b/util/Radiance_Monitor/nwprod/nam_radmon/scripts/exnam_verfrad.sh @@ -1,4 +1,4 @@ -#/bin/sh +#/bin/bash ################################################################################ #### UNIX Script Documentation Block # . . @@ -72,9 +72,6 @@ ################################################################################ export scr=exnam_vrfyrad.sh.ecf -msg="${scr} HAS STARTED" -postmsg "$jlogfile" "$msg" - ################################################################################ # Set environment ################################################################################ @@ -139,10 +136,6 @@ export UNCOMPRESS=${UNCOMPRESS:-"gunzip -f"} # t00z.radstat.tm01 contents is dated 2016031723 # t00z.radstat.tm00 contents is dated 2016031800 # -# I'm going to override the TANKverf_rad defition in my VrfyRad_rgnl.sh -# script for the moment. I'll ask Jacob what the parallel job uses for -# a PDY definition so I may not have to modify the output. -# export TANKverf=${TANKverf:-/com/${NET}/prod} export TANKverf_rad=${TANKverf_rad:-${TANKverf}/radmon.${PDY}} @@ -176,10 +169,10 @@ if [[ -s ${radstat} && -s ${biascr} ]]; then # Untar radstat file. #------------------------------------------------------------------ - $NCP $biascr ./biascr.$PDATE - $NCP $radstat ./radstat.$PDATE + ${NCP} ${biascr} ./biascr.${PDATE} + ${NCP} ${radstat} ./radstat.${PDATE} - tar -xvf radstat.$PDATE + tar -xvf radstat.${PDATE} # rm radstat.$PDATE #------------------------------------------------------------------ @@ -191,11 +184,11 @@ if [[ -s ${radstat} && -s ${biascr} ]]; then #------------------------------------------------------------------ radstat_satype=`ls d*ges* | awk -F_ '{ print $2 "_" $3 }'` - if [[ "$VERBOSE" = "YES" ]]; then - echo $radstat_satype + if [[ "${VERBOSE}" = "YES" ]]; then + echo ${radstat_satype} fi - echo satype_file = $satype_file + echo satype_file = ${satype_file} #------------------------------------------------------------------ # Get previous cycle's date, and look for the satype_file. Using @@ -212,7 +205,7 @@ if [[ -s ${radstat} && -s ${biascr} ]]; then if [[ ! -e ${TANKverf}/radmon.${pday}/${satype_file} ]]; then if [[ ! -e ${FIXnam}/${satype_file} ]]; then - export SATYPE=$radstat_satype + export SATYPE=${radstat_satype} if [[ "$VERBOSE" = "YES" ]]; then echo " ${satype_file} not found. Adding it now using radstat file contents." fi @@ -226,66 +219,57 @@ if [[ -s ${radstat} && -s ${biascr} ]]; then #------------------------------------------------------------- # Update the SATYPE if any new sat/instrument was - # found in $radstat_satype. Write the SATYPE contents back - # to $TANKverf/radmon.$PDY. + # found in $radstat_satype. #------------------------------------------------------------- satype_changes=0 - new_satype=$SATYPE + new_satype=${SATYPE} for type in ${radstat_satype}; do - test=`echo $SATYPE | grep $type | wc -l` + test=`echo ${SATYPE} | grep ${type} | wc -l` - if [[ $test -eq 0 ]]; then + if [[ ${test} -eq 0 ]]; then if [[ "$VERBOSE" = "YES" ]]; then - echo "Found $type in radstat file but not in SATYPE list. Adding it now." + echo "FOUND ${type} in radstat file but not in SATYPE list. Adding it now." fi satype_changes=1 - new_satype="$new_satype $type" + new_satype="${new_satype} ${type}" fi done - #------------------------------------------------------------------ - # If there is no satype_file in the current day's radmon.${PDY} - # directory or if changes have occurred in the SATYPE list, then - # add/update the satype_file. - #------------------------------------------------------------------ - if [[ ! -s ${TANKverf}/radmon.${PDY}/${satype_file} || $satype_changes -eq 1 ]]; then - if [[ ! -d ${TANKverf}/radmon.${PDY} ]]; then - mkdir -f ${TANKverf}/radmon.${PDY} - fi - if [[ -e ${TANKverf}/radmon.${PDY}/${satype_file} ]]; then - rm -f ${TANKverf}/radmon.${PDY}/${satype_file} - fi - echo $new_satype > ${TANKverf}/radmon.${PDY}/${satype_file} + if [[ ${satype_changes} -eq 1 ]]; then + SATYPE=${new_satype} fi - - #------------------------------------------------------------------ - # Refresh SATYPE with any additions - #------------------------------------------------------------------ - - export SATYPE=$new_satype + export SATYPE=${SATYPE} #------------------------------------------------------------------ - # Rename the diag files and uncompress + # Determine bin or nc4 diag files, rename, and uncompress #------------------------------------------------------------------ + netcdf=0 + for type in ${SATYPE}; do - if [[ ! -e diag_${type}_ges.${PDATE}.${Z} ]]; then + if [[ -e ./diag_${type}_ges.${PDATE}.nc4.${Z} ]]; then + netcdf=1 + exit + fi + done + export RADMON_NETCDF=$netcdf - edited_satype="$(echo $SATYPE | tr ' ' '\n' | sed "/${type}/d")" + for type in ${SATYPE}; do + if [[ ! -e ./diag_${type}_ges.${PDATE}.${Z} ]]; then + + edited_satype="$(echo $SATYPE | tr ' ' '\n' | sed "/${type}/d")" echo "REMOVED: $type from SATYPE" -# echo "edited_satype: $edited_satype" export SATYPE=${edited_satype} -# echo "SATYPE = $SATYPE" else - mv diag_${type}_ges.${PDATE}.${Z} ${type}.${Z} + mv ./diag_${type}_ges.${PDATE}*.${Z} ${type}.${Z} ${UNCOMPRESS} ./${type}.${Z} if [[ $USE_ANL -eq 1 ]]; then - mv diag_${type}_anl.${PDATE}.${Z} ${type}_anl.${Z} + mv ./diag_${type}_anl.${PDATE}.*${Z} ${type}_anl.${Z} ${UNCOMPRESS} ./${type}_anl.${Z} fi fi @@ -310,6 +294,15 @@ if [[ -s ${radstat} && -s ${biascr} ]]; then ${USHradmon}/radmon_verf_time.sh ${PDATE} rc_time=$? + #-------------------------------------- + # optionally run clean_tankdir script + # + if [[ ${CLEAN_TANKVERF} -eq 1 ]]; then + ${USHradmon}/clean_tankdir.sh rgn 10 + rc_clean_tankdir=$? + echo "rc_clean_tankdir = $rc_clean_tankdir" + fi + fi ##################################################################### @@ -332,8 +325,6 @@ if [[ "$VERBOSE" = "YES" ]]; then echo "end exnam_vrfyrad.sh.ecf, exit value = ${err}" fi -msg="${scr} HAS ENDED" -postmsg "$jlogfile" "$msg" set +x exit ${err} diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radang.fd/Makefile.conf b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radang.fd/Makefile.conf deleted file mode 100755 index 9cba163a3e..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radang.fd/Makefile.conf +++ /dev/null @@ -1,26 +0,0 @@ -# This config file contains the compile options for compilation -# of the RadMon code on WCOSS. - -# ---------------------------------- -# Redefine variables for WCOSS -# ---------------------------------- - CORELIB = /nwprod/lib - W3NCO_VER = v2.0.6 - W3NCO_LIB4=$(CORELIB)/w3nco/$(W3NCO_VER)/libw3nco_$(W3NCO_VER)_4.a - -# ---------------------------- -# Fortran compiler and options -# ---------------------------- - - CF = ifort - FC = $(CF) - - FFLAGS = -O3 -fp-model strict -D_REAL8_ -traceback -convert big_endian -assume byterecl - -# ------------------ -# Linker and options -# ------------------ - - LIBS = $(W3NCO_LIB4) - LDFLAGS = - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radang.fd/angle_bias.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radang.fd/angle_bias.f90 deleted file mode 100755 index de2175a3d3..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radang.fd/angle_bias.f90 +++ /dev/null @@ -1,698 +0,0 @@ -program angle - use read_diag - - implicit none - integer ntype,mregion,mstep,surf_nregion,max_surf_region - parameter (ntype=35,mregion=25,mstep=100,max_surf_region=5) - integer iglobal, iland, iwater, isnowice, imixed - parameter (iglobal=1, iland=2, iwater=3, isnowice=4, imixed=5) - - character(10),dimension(ntype):: ftype - character(8) stid - character(20) satname,stringd - character(10) satype,dplat - character(20) dum,satsis,satscan_sis - character(40) string,diag_rad,data_file,dfile,ctl_file - character(40),dimension(max_surf_region):: surf_region - character(8) date,suffix,cycle - character(len=1024) :: command - - integer luname,lungrd,lndiag,lunang,lunctl - integer iyy,imm,idd,ihh,idhh,incr,iread,iflag,ipos - integer n_chan,j,i,k,ii,nsub,jiter,jj - integer,dimension(mregion):: jsub - integer,allocatable,dimension(:):: io_chan,nu_chan - integer imatch, npred_radiag, angord - - real start,step - integer nstep,iscan - character(1) cflg - real rang,pen - real weight,rlat,rlon,rmiss,obs,biascor,obsges,obsgesnbc,rterm,rread - real,dimension(2):: cor_tot,nbc_omg,bc_omg - real,dimension(2):: cor_fixang,cor_lapse,cor_lapse2,cor_const,cor_scangl,cor_clw - real,dimension(2):: cor_cos,cor_sin,cor_emiss - real,dimension(2):: cor_ordang4,cor_ordang3,cor_ordang2,cor_ordang1 - real,dimension(max_surf_region):: surf_rlatmin,surf_rlatmax,surf_rlonmin,surf_rlonmax - - real,allocatable,dimension(:):: wavenumbr,error,use,frequency - real,allocatable,dimension(:,:):: timang - real,allocatable,dimension(:,:,:):: count,penalty - real,allocatable,dimension(:,:,:,:):: tot_cor,omg_nbc,omg_bc - real,allocatable,dimension(:,:,:,:):: fixang_cor,lapse_cor,lapse2_cor - real,allocatable,dimension(:,:,:,:):: const_cor,scangl_cor,clw_cor - real,allocatable,dimension(:,:,:,:):: cos_cor,sin_cor,emiss_cor - real,allocatable,dimension(:,:,:,:):: ordang4_cor,ordang3_cor,ordang2_cor,ordang1_cor - -! Variables for reading satellite data - type(diag_header_fix_list ) :: header_fix - type(diag_header_chan_list),allocatable :: header_chan(:) - type(diag_data_name_list ) :: data_name - type(diag_data_fix_list ) :: data_fix - type(diag_data_chan_list ),allocatable :: data_chan(:) - type(diag_data_extra_list) ,allocatable :: data_extra(:,:) - - integer nsnow, nland, nwater, nice, nmixed, ntotal - integer nnsnow, nnland, nnwater, nnmixed, nntotal - -! Namelist with defaults - logical :: retrieval = .false. - integer :: nchanl = 19 - integer :: imkctl = 1 - integer :: imkdata = 1 - character(3) :: gesanl = 'ges' - integer :: little_endian = 1 - character(3) :: rad_area = 'glb' - namelist /input/ satname,iyy,imm,idd,ihh,idhh,incr,nchanl,& - suffix,imkctl,imkdata,retrieval,gesanl,little_endian,rad_area - - data luname,lungrd,lunctl,lndiag,iscan / 5, 51, 52, 21, 31 / - data lunang / 22 / - data rmiss /-999./ - data stringd / '.%y4%m2%d2%h2' / - data ftype / 'satang', 'count', 'penalty', & - 'omgnbc', 'total', 'omgbc', & - 'fixang', 'lapse', 'lapse2', & - 'const', 'scangl', 'clw', & - 'cos','sin','emiss','ordang4',& - 'ordang3','ordang2','ordang1',& - 'omgnbc_2', 'total_2', 'omgbc_2', & - 'fixang_2', 'lapse_2', 'lapse2_2', & - 'const_2', 'scangl_2', 'clw_2', & - 'cos_2', 'sin_2', 'emiss_2', & - 'ordang4_2','ordang3_2','ordang2_2', & - 'ordang1_2' / - data surf_region / 'global', 'land', 'water', 'ice/snow', 'mixed'/ - data surf_rlonmin / -180., -180., -180., -180., -180./ - data surf_rlonmax / 180., 180., 180., 180., 180./ - data surf_rlatmin / -90., -90., -90., -90., -90./ - data surf_rlatmax / 90., 90., 90., 90., 90./ -!************************************************************************ -! -! Initialize variables - iread=0 - npred_radiag = 12 - -! Read namelist input - read(luname,input) - write(6,input) - write(6,*)' ' - write(6,*)'gesanl = ', gesanl - write(6,*)'rad_area = ', rad_area - - surf_nregion = 5 - if ( trim(rad_area) == 'rgn' ) then - surf_nregion = 1 - endif - - if ( trim(gesanl) == 'anl' ) then - ftype(4) = 'omanbc' - ftype(6) = 'omabc' - ftype(13) = 'omanbc_2' - ftype(15) = 'omabc_2' - endif - -! Ensure number of requested regions does not exceed specified upper limit - if (surf_nregion>mregion) then - write(6,*)'***ERROR*** too many regions specified' - write(6,*)' maximum allowed: mregion=',mregion - write(6,*)' user requested: surf_nregion=',surf_nregion - call errexit(91) - endif - - date = stringd(2:9) - cycle = stringd(10:11) - -! Create filenames for diagnostic input, binary output files - write(stringd,100) iyy,imm,idd,ihh -100 format('.',i4.4,3i2.2) - - if ( trim(gesanl) == 'ges' ) then - diag_rad = trim(satname) - data_file= trim(satname) // trim(stringd) // '.ieee_d' - ctl_file = trim(satname) // '.ctl' - else - diag_rad = trim(satname) // '_anl' - data_file= trim(satname) // '_anl' // trim(stringd) // '.ieee_d' - ctl_file = trim(satname) // '_anl.ctl' - endif - - - write(6,*)'diag_rad =',diag_rad - write(6,*)'data_file=',data_file - write(6,*)'suffix =',suffix - write(6,*)'ctl_file =',ctl_file - write(6,*)'imkctl =',imkctl - write(6,*)'imkdata =',imkdata - write(6,*)'little_endian =', little_endian - - -! Open unit to diagnostic file. Read portion of -! header to see if file exists - open(lndiag,file=diag_rad,form='unformatted') - read(lndiag,err=900,end=900) dum - rewind lndiag - -! File exists. Read header - write(6,*)'call read_diag_header' - call read_radiag_header( lndiag, npred_radiag, retrieval,& - header_fix, header_chan, data_name, iflag ) -! -! If there was an error reading the header try to convert from little endian -! and re-read. If that fails exit. -! - if( iflag/=0 ) then - write(6,*)'***ERROR*** problem reading diag file header, iflag=',iflag - call errexit(91) - endif - - -! Extract observation type, satellite id, and number of channels - satype = header_fix%obstype - satsis = header_fix%isis - dplat = header_fix%id - n_chan = header_fix%nchan - jiter = header_fix%jiter - angord = header_fix%angord - - write(6,*)'satype,satid,n_chan,angord=',satype,' ',dplat,' ',n_chan,' ',angord - - string = trim(satype) //'_'// trim(dplat) - write(6,*)'string,satname=',string,' ',satname - if ( trim(string) /= trim(satname) ) then - write(6,*)'***ERROR*** inconsistent instrument types' - write(6,*)' satname,string =',satname,' ',string - call errexit(92) - endif - -! open scan info file compiled in the source directory - open(iscan,file='scaninfo.txt',form='formatted') - do - read(iscan,1000,IOSTAT=iflag) cflg,satscan_sis,start,step,nstep - write(6,*) 'satscan_sis,start,step,nstep=',satscan_sis,start,step,nstep - if( iflag /= 0 ) exit - if(trim(satname) == trim(satscan_sis)) exit - enddo -!1000 format(a1,a20,2f10.2,i10) -1000 format(a1,a20,2f10.3,i10) - - write(6,*) 'satscan_sis,start,step,nstep=',satscan_sis,start,step,nstep - - -! Allocate arrays to hold observational information - write(6,*)' ' - write(6,*)'allocate arrays' - allocate (io_chan(n_chan), nu_chan(n_chan), wavenumbr(n_chan), & - error(n_chan), use(n_chan), frequency(n_chan)) - allocate (timang(mstep,n_chan)) - allocate (tot_cor(mstep,n_chan,surf_nregion,2), & - omg_nbc(mstep,n_chan,surf_nregion,2), & - omg_bc(mstep,n_chan,surf_nregion,2), & - count(mstep,n_chan,surf_nregion), & - penalty(mstep,n_chan,surf_nregion),& - fixang_cor(mstep,n_chan,surf_nregion,2),lapse_cor(mstep,n_chan,surf_nregion,2),& - lapse2_cor(mstep,n_chan,surf_nregion,2),clw_cor(mstep,n_chan,surf_nregion,2),& - const_cor(mstep,n_chan,surf_nregion,2), scangl_cor(mstep,n_chan,surf_nregion,2),& - cos_cor(mstep,n_chan,surf_nregion,2), sin_cor(mstep,n_chan,surf_nregion,2),& - emiss_cor(mstep,n_chan,surf_nregion,2), ordang4_cor(mstep,n_chan,surf_nregion,2),& - ordang3_cor(mstep,n_chan,surf_nregion,2), ordang2_cor(mstep,n_chan,surf_nregion,2),& - ordang1_cor(mstep,n_chan,surf_nregion,2)) - -! Zero accumulator arrays - do ii=1,2 - do k=1,surf_nregion - do j=1,n_chan - do i=1,mstep - if (ii==1) then - count(i,j,k) = 0.0 - penalty(i,j,k) = 0.0 - endif - tot_cor(i,j,k,ii) = 0.0 - omg_nbc(i,j,k,ii) = 0.0 - omg_bc(i,j,k,ii) = 0.0 - fixang_cor(i,j,k,ii) = 0.0 - lapse_cor(i,j,k,ii) = 0.0 - lapse2_cor(i,j,k,ii) = 0.0 - clw_cor(i,j,k,ii) = 0.0 - const_cor(i,j,k,ii) = 0.0 - scangl_cor(i,j,k,ii) = 0.0 - cos_cor(i,j,k,ii) = 0.0 - sin_cor(i,j,k,ii) = 0.0 - emiss_cor(i,j,k,ii) = 0.0 - ordang4_cor(i,j,k,ii) = 0.0 - ordang3_cor(i,j,k,ii) = 0.0 - ordang2_cor(i,j,k,ii) = 0.0 - ordang1_cor(i,j,k,ii) = 0.0 - end do - end do - end do - end do - -! Note: timang has been deprecated and the satang file is no longer -! used. See the plot_angle_sep.*.gs scripts for how the timang -! values are derived from the diagnostic file contents. The -! timang variable has been kept to avoid making a change in -! ieee_d file format. - do j=1,n_chan - do i=1,mstep - timang(i,j) = rmiss - end do - end do - -! Extract satinfo relative index - do j=1,n_chan - nu_chan(j) = real( header_chan(j)%nuchan, 4 ) - io_chan(j) = real( header_chan(j)%iochan, 4 ) - wavenumbr(j) = real( header_chan(j)%wave, 4 ) - error(j) = real( header_chan(j)%varch, 4) - use(j) = real( header_chan(j)%iuse, 4 ) - frequency(j) = real( header_chan(j)%freq, 4) -! print *,nu_chan(j),io_chan(j),wavenumbr(j),error(j),use(j),frequency(j) - end do - - - - write(6,*)'beginning read entries in diag file' - nwater = 0; nnwater=0 - nice = 0 - nsnow = 0; nnsnow=0 - nland = 0; nnland=0 - nmixed = 0; nnmixed=0; - ntotal = 0; - -! Loop to read entries in diagnostic file - iflag = 0 - loopd: do while (iflag == 0) - -! Read a record. If read flag, iflag does not equal zero, exit loopd - call read_radiag_data( lndiag, header_fix, retrieval, data_fix, data_chan,& - data_extra, iflag ) - if( iflag /= 0 ) exit loopd - iread=iread+1 - -! Extract observation location, scan position, and mpi weight. -! Convert (0-360) lon to (-180,180) - rlat = data_fix%lat - rlon = data_fix%lon - ipos = data_fix%senscn_pos !! sensor scan position(integer) - rang = data_fix%satzen_ang !! satellite zenith angle (deg) - - ntotal = ntotal + 1 - jsub(1)=iglobal - - if ( surf_nregion > 1 ) then - if ( data_fix%water_frac > 0.99 ) then - nwater = nwater + 1 - else if ( data_fix%land_frac > 0.99 ) then - nland = nland + 1 - else if ( data_fix%snow_frac > 0.99 ) then - nsnow = nsnow + 1 - else if ( data_fix%ice_frac > 0.99 ) then - nice = nice + 1 - else - nmixed = nmixed + 1 - end if - - - if (rlon>180.) rlon = rlon - 360. - if (ipos<1) then - write(6,*)'scan position less than 1. ipos=',ipos - ipos=1 - endif - if (ipos>nstep) then - write(6,*)'scan position > nstep. ipos,nstep,',& - ipos,nstep - ipos=nstep - endif - rread = rread + 1.0 - - -! Detemine which subdomains the observation falls into -! These are now based on surface type, not geography. All -! obs match global (surf_region 1). -! - ii=0; jsub=0; - jsub(1)=iglobal - if ( data_fix%land_frac > 0.99 ) then - jsub(2)=iland - nsub=2 - nnland=nnland+1 - else if ( data_fix%water_frac > 0.99 ) then - jsub(2)=iwater - nsub=2 - nnwater=nnwater+1 - else if (( data_fix%snow_frac > 0.99 ) .OR. ( data_fix%ice_frac > 0.99 )) then - jsub(2)=isnowice - nsub=2 - nnsnow=nnsnow+1 - else - jsub(2)=imixed - nsub=2 - nnmixed=nnmixed+1 - write(6,*)'data_fix%land_frac,water,snow,ice = ',data_fix%land_frac, data_fix%water_frac, data_fix%snow_frac, data_fix%ice_frac - end if - end if - - -! Channel loop - do j = 1, n_chan - -! If observation was assimilated, accumulate sums for appropriate -! scan angle and regions - cor_cos = 0.0 - cor_sin = 0.0 - cor_emiss = 0.0 - cor_ordang4 = 0.0 - cor_ordang3 = 0.0 - cor_ordang2 = 0.0 - cor_ordang1 = 0.0 - - if (data_chan(j)%errinv > 1.e-6) then - pen = data_chan(j)%errinv*(data_chan(j)%omgbc)**2 - cor_tot(1) = (data_chan(j)%omgnbc - data_chan(j)%omgbc) - nbc_omg(1) = - (data_chan(j)%omgnbc) - bc_omg(1) = - (data_chan(j)%omgbc) - - - if ( trim(rad_area) == 'rgn' ) then - write(6,*) 'chan,pen,cor_tot(1),nbc_omg(1),bc_omb(1) = ', j,pen,cor_tot(1),nbc_omg(1),bc_omg(1) - endif - - cor_tot(2) = (data_chan(j)%omgnbc - data_chan(j)%omgbc)**2 - nbc_omg(2) = (data_chan(j)%omgnbc)**2 - bc_omg(2) = (data_chan(j)%omgbc)**2 - - cor_fixang(1) = data_chan(j)%bifix(angord+1) - cor_lapse(1) = data_chan(j)%bilap - cor_lapse2(1) = data_chan(j)%bilap2 - cor_const(1) = data_chan(j)%bicons - cor_scangl(1) = data_chan(j)%biang - cor_clw(1) = data_chan(j)%biclw - cor_cos(1) = data_chan(j)%bicos - cor_sin(1) = data_chan(j)%bisin - cor_emiss(1) = data_chan(j)%biemis - if (angord >= 4 ) then - cor_ordang4(1) = data_chan(j)%bifix(1) - cor_ordang3(1) = data_chan(j)%bifix(2) - cor_ordang2(1) = data_chan(j)%bifix(3) - cor_ordang1(1) = data_chan(j)%bifix(4) - else - cor_ordang4(1) = 0.0 - cor_ordang3(1) = 0.0 - cor_ordang2(1) = 0.0 - cor_ordang1(1) = 0.0 - endif - - cor_fixang(2) = (data_chan(j)%bifix(angord+1))**2 - cor_lapse(2) = (data_chan(j)%bilap)**2 - cor_lapse2(2) = (data_chan(j)%bilap2)**2 - cor_const(2) = (data_chan(j)%bicons)**2 - cor_scangl(2) = (data_chan(j)%biang)**2 - cor_clw(2) = (data_chan(j)%biclw)**2 - cor_cos(2) = (data_chan(j)%bicos)**2 - cor_sin(2) = (data_chan(j)%bisin)**2 - cor_emiss(2) = (data_chan(j)%biemis)**2 - if (angord >= 4 ) then - cor_ordang4(2) = (data_chan(j)%bifix(1))**2 - cor_ordang3(2) = (data_chan(j)%bifix(2))**2 - cor_ordang2(2) = (data_chan(j)%bifix(3))**2 - cor_ordang1(2) = (data_chan(j)%bifix(4))**2 - else - cor_ordang4(2) = 0.0 - cor_ordang3(2) = 0.0 - cor_ordang2(2) = 0.0 - cor_ordang1(2) = 0.0 - endif - - - if ( trim(rad_area) == 'rgn' ) then - nsub = 1 - endif - do i=1,nsub - if ( trim(rad_area) == 'rgn' ) then - write(6,*) 'INSIDE i 1 to nsub do loop' - endif - k=jsub(i) - count(ipos,j,k) = count(ipos,j,k) + 1.0 - penalty(ipos,j,k) = penalty(ipos,j,k) + pen - - do ii=1,2 - tot_cor(ipos,j,k,ii) = tot_cor(ipos,j,k,ii) + cor_tot(ii) - omg_nbc(ipos,j,k,ii) = omg_nbc(ipos,j,k,ii) + nbc_omg(ii) - omg_bc(ipos,j,k,ii) = omg_bc(ipos,j,k,ii) + bc_omg(ii) - fixang_cor(ipos,j,k,ii) = fixang_cor(ipos,j,k,ii) + cor_fixang(ii) - lapse_cor(ipos,j,k,ii) = lapse_cor(ipos,j,k,ii) + cor_lapse(ii) - lapse2_cor(ipos,j,k,ii) = lapse2_cor(ipos,j,k,ii) + cor_lapse2(ii) - const_cor(ipos,j,k,ii) = const_cor(ipos,j,k,ii) + cor_const(ii) - scangl_cor(ipos,j,k,ii) = scangl_cor(ipos,j,k,ii) + cor_scangl(ii) - clw_cor(ipos,j,k,ii) = clw_cor(ipos,j,k,ii) + cor_clw(ii) - cos_cor(ipos,j,k,ii) = cos_cor(ipos,j,k,ii) + cor_cos(ii) - sin_cor(ipos,j,k,ii) = sin_cor(ipos,j,k,ii) + cor_sin(ii) - emiss_cor(ipos,j,k,ii) = emiss_cor(ipos,j,k,ii) + cor_emiss(ii) - ordang4_cor(ipos,j,k,ii) = ordang4_cor(ipos,j,k,ii) + cor_ordang4(ii) - ordang3_cor(ipos,j,k,ii) = ordang3_cor(ipos,j,k,ii) + cor_ordang3(ii) - ordang2_cor(ipos,j,k,ii) = ordang2_cor(ipos,j,k,ii) + cor_ordang2(ii) - ordang1_cor(ipos,j,k,ii) = ordang1_cor(ipos,j,k,ii) + cor_ordang1(ii) - - end do - end do - - endif - - enddo ! channel loop - -! End of loop over diagnostic file - enddo loopd - close(lndiag) - write(6,*)' ' - write(6,*)'read in ',iread,' obs ',rread - write(6,*)' ' - - write(6,*)'nwater, nland, nice, nsnow, nmixed, ntotal = ', nwater, nland, nice, nsnow, nmixed, ntotal - nntotal=nnwater+nnland+nnsnow+nnmixed - write(6,*)'nnwater, nnland, nnsnow, nnmixed, nntotal = ', nnwater, nnland, nnsnow, nnmixed, nntotal - - - ! Create Control file - if ( imkctl == 1 ) then - write(6,*)'call create_ctl_angle' - if ( trim(gesanl) == 'ges' ) then - dfile = trim(satname) - else - dfile = trim(satname) // '_anl' - endif - - call create_ctl_angle(ntype,ftype,n_chan,iyy,imm,idd,ihh,& - ctl_file,lunctl,rmiss,dfile,satype,dplat,surf_nregion,& - surf_region,surf_rlonmin,surf_rlonmax,surf_rlatmin,surf_rlatmax,& - nu_chan,use, error, frequency,wavenumbr,nstep,start,step, little_endian) - else - write(6,*) 'imkctl =',imkctl - endif - - -! Write output to data file - if ( imkdata == 1 ) then - write(6,*)' ' - open(lungrd,file=data_file,form='unformatted') - write(lungrd) ((timang(i,j),i=1,nstep),j=1,n_chan) - do k=1,surf_nregion - write(lungrd) ((count(i,j,k),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd) ((penalty(i,j,k),i=1,nstep),j=1,n_chan) - end do - do ii=1,2 - do k=1,surf_nregion - write(lungrd)((omg_nbc(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((tot_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((omg_bc(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((fixang_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((lapse_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((lapse2_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((const_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((scangl_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((clw_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((cos_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((sin_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((emiss_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((ordang4_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((ordang3_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((ordang2_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((ordang1_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - end do - write(6,*)'write output to lungrd=',lungrd,', file=',trim(data_file) - close(lungrd) - else - write(6,*) 'imkctl =',imkctl - endif - - -! Deallocate arrays - write(6,*)' ' - write(6,*)'deallocate arrays' - deallocate(penalty,io_chan,nu_chan,wavenumbr,error,use,frequency) - deallocate(timang,tot_cor,omg_nbc,omg_bc,count) - goto 950 - - -! Jump to here if eof or error reading diagnostic file. -900 continue - write(6,*)'***PROBLEM reading diagnostic file. diag_rad=',diag_rad - close(lndiag) - - n_chan=nchanl - if (n_chan<=0) then - write(6,*)'***ERROR*** invalid nchanl=',nchanl,' STOP program' - call errexit(93) - endif - - allocate(timang(mstep,n_chan)) - allocate(count(mstep,n_chan,surf_nregion),& - penalty(mstep,n_chan,surf_nregion),& - omg_nbc(mstep,n_chan,surf_nregion,2),& - tot_cor(mstep,n_chan,surf_nregion,2),& - omg_bc(mstep,n_chan,surf_nregion,2)) - -! -! Initialze all output variables to rmiss -! -! - do j=1,n_chan - do i=1,mstep - timang(i,j) = rmiss - end do - end do - - write(6,*)'load missing value ',rmiss,' into output arrays. ',& - nstep,surf_nregion,n_chan - do ii=1,2 - do k=1,surf_nregion - do j=1,n_chan - do i=1,mstep - if (ii==1) then - count(i,j,k) = rmiss - penalty(i,j,k)= rmiss - endif - omg_nbc(i,j,k,ii) = rmiss - tot_cor(i,j,k,ii) = rmiss - omg_bc(i,j,k,ii) = rmiss - fixang_cor(i,j,k,ii) = rmiss - lapse_cor(i,j,k,ii) = rmiss - lapse2_cor(i,j,k,ii) = rmiss - clw_cor(i,j,k,ii) = rmiss - const_cor(i,j,k,ii) = rmiss - scangl_cor(i,j,k,ii) = rmiss - cos_cor(i,j,k,ii) = rmiss - sin_cor(i,j,k,ii) = rmiss - emiss_cor(i,j,k,ii) = rmiss - ordang4_cor(i,j,k,ii) = rmiss - ordang3_cor(i,j,k,ii) = rmiss - ordang2_cor(i,j,k,ii) = rmiss - ordang1_cor(i,j,k,ii) = rmiss - end do - end do - end do - end do - - if ( imkdata == 1 ) then - open(lungrd,file=data_file,form='unformatted') - write(lungrd) ((timang(i,j),i=1,nstep),j=1,n_chan) - do k=1,surf_nregion - write(lungrd) ((count(i,j,k),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd) ((penalty(i,j,k),i=1,nstep),j=1,n_chan) - end do - do ii=1,2 - do k=1,surf_nregion - write(lungrd)((omg_nbc(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((tot_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((omg_bc(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((fixang_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((lapse_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((lapse2_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((const_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((scangl_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((clw_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((cos_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((sin_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((emiss_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((ordang4_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((ordang3_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((ordang2_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((ordang1_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - end do - write(6,*)'write output to lungrd=',lungrd,', file=',trim(data_file) - close(lungrd) - endif - deallocate(timang,count,penalty,omg_nbc,omg_bc,tot_cor,& - fixang_cor,lapse_cor,lapse2_cor,const_cor,scangl_cor,clw_cor) - deallocate(cos_cor,sin_cor,emiss_cor,ordang1_cor,ordang2_cor,ordang3_cor,ordang4_cor) - -! End of program -950 continue - stop -end program angle diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radang.fd/create_ctl_angle.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radang.fd/create_ctl_angle.f90 deleted file mode 100755 index 6077ac6c1b..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radang.fd/create_ctl_angle.f90 +++ /dev/null @@ -1,176 +0,0 @@ -subroutine create_ctl_angle(ntype,ftype,n_chan,iyy,imm,idd,ihh,& - ctl_file,lunctl,rmiss,satname,satype,dplat,nregion,& - region,rlonmin,rlonmax,rlatmin,rlatmax,nu_chan,use,error,& - frequency,wavenumbr,nstep,start,step, little_endian) - - implicit none - - integer ntype - - character(2) cword - character(3),dimension(12):: mon - character(3):: clatmin,clatmax - character(4):: clonmin,clonmax - character(10),dimension(ntype):: ftype - character(13) stringd - character(20) satname - character(10) satype,dplat - character(40) ctl_file,grad_file - character(80) string - character(40),dimension(nregion):: region - character(80),dimension(nregion):: stringr - - integer nregion,iuse,klev,nstep - integer lunctl,iyy,imm,idd,ihh,j,i,n_chan,idhh,incr - integer iyy2,imm2,idd2,ihh2,ntime - integer, dimension(8):: ida,jda - integer,dimension(n_chan):: nu_chan - integer little_endian - - real rmiss,wavelength,start,step - real,dimension(5):: fha - real,dimension(n_chan):: error,use,frequency,wavenumbr - real,dimension(nregion):: rlonmin,rlonmax,rlatmin,rlatmax - - data stringd / '.%y4%m2%d2%h2' / - data mon / 'jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', & - 'aug', 'sep', 'oct', 'nov', 'dec' / - -!************************************************************************** - - write(6,*)'start create_ctl_angle' - write(6,*)' n_chan = ', n_chan - -! Create date for tdef based on given date and hour offset - - idhh=-720 ! this is 30 days back in hours. - incr=6 ! cycle interval - - fha=0.0; ida=0; jda=0; ntime=0 - iyy2=iyy; imm2=imm; idd2=idd; ihh2=ihh - if (idhh/=0) then - ntime = abs(idhh)/incr - fha(2)=idhh - ida(1)=iyy - ida(2)=imm - ida(3)=idd - ida(4)=0 - ida(5)=ihh - call w3movdat(fha,ida,jda) - iyy2=jda(1) - imm2=jda(2) - idd2=jda(3) - ihh2=jda(5) - endif - ntime=ntime+1 - -! Open unit to GrADS control file - open(lunctl,file=ctl_file,form='formatted') - -!******************************************************************* -! Construct the region strings if this is for a global source, -! which is defined as nregion > 1. -! - if (nregion > 1) then - do i=1,nregion - if (rlatmin(i)>0.) then - write(clatmin,10) int(rlatmin(i)) - else - write(clatmin,20) abs(int(rlatmin(i))) - endif - if (rlatmax(i)>0.) then - write(clatmax,10) int(rlatmax(i)) - else - write(clatmax,20) abs(int(rlatmax(i))) - endif - if (rlonmin(i)>0.) then - write(clonmin,30) int(rlonmin(i)) - else - write(clonmin,40) abs(int(rlonmin(i))) - endif - if (rlonmax(i)>0.) then - write(clonmax,30) int(rlonmax(i)) - else - write(clonmax,40) abs(int(rlonmax(i))) - endif - stringr(i) = trim(region(i)) // ' (' // & - trim(clonmin) // '-' // trim(clonmax) // ', ' // & - trim(clatmin) // '-' // trim(clatmax) // ')' - end do - endif -10 format(i2,'N') -20 format(i2,'S') -30 format(i3,'E') -40 format(i3,'W') - -! Write header information - grad_file = trim(satname) // stringd // '.ieee_d' - write(lunctl,100) grad_file - if (little_endian == 1 ) then - write( lunctl,112 ) - else - write( lunctl,110 ) - endif - write(lunctl,120) rmiss - write(lunctl,130) adjustl(satype),dplat,n_chan - write(lunctl,132) - write(lunctl,134) - do i=1,n_chan - iuse = nint(use(i)) - wavelength = 10000./wavenumbr(i) - write(lunctl,136) i,nu_chan(i),iuse,error(i),wavelength,frequency(i) - end do - write(lunctl,138) - - if (nregion > 1) then - do i=1,nregion - write(cword,'(i2)') i - string = '* region=' // cword // ' ' // trim(stringr(i)) - write(lunctl,140) string - end do - endif - write(lunctl,145) nstep,start,step - write(lunctl,150) n_chan - write(lunctl,160) nregion - write(lunctl,170) ntime,ihh2,idd2,mon(imm2),iyy2 - write(lunctl,180) ntype - -100 format('dset ^',a40) -110 format('options template big_endian sequential') -112 format('options template little_endian sequential') -120 format('undef ',f5.0) -130 format('title ',a10,1x,a10,1x,i4) -132 format('*XDEF is scan position') -134 format('*YDEF is channel number') -136 format('* y= ',i4,', channel= ',i4,' , iuse= ',i2,' , error= ',f8.3,& - ' , wlth= ',f9.2,' , freq= ',f9.2) -138 format('*ZDEF is geographic region') -140 format(a80) -145 format('xdef ',i3,' linear ',f5.1,1x,f5.1) -150 format('ydef ',i4,' linear 1.0 1.0') -160 format('zdef ',i2,' linear 1.0 1.0') -170 format('tdef ',i4,' linear ',i2.2,'Z',i2.2,a3,i4.4,' 06hr') -180 format('vars ',i7) - -! Write data portion of GraDS control file - do i=1,ntype - string = trim(ftype(i)) - klev=nregion - if (i==1) klev=1 - write(lunctl,190) adjustl(string),klev,trim(ftype(i)) -190 format(a10,1x,i2,' 0 ',a10) - end do - -! Write trminating "endvars" record - write(lunctl,200) -200 format('endvars') - - -! Close ctl file - close(lunctl) - - write(6,*)'finish create_ctl_angle' - -! Return - return -end subroutine create_ctl_angle diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radang.fd/makefile b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radang.fd/makefile deleted file mode 100755 index 7c7e319401..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radang.fd/makefile +++ /dev/null @@ -1,51 +0,0 @@ -# ***************************************************************** -# makefile.angle_bias -# -# Make the radmon_angle.glb executable. The executable will -# extract angle radiance data from a diagnostic file from a -# global run. -# -# ***************************************************************** - -SHELL=/bin/sh -SRCS = kinds.F90 read_diag.f90 angle_bias.f90 \ - create_ctl_angle.f90 - -OBJS = kinds.o read_diag.o angle_bias.o \ - create_ctl_angle.o - -# -# ***************************************************************** -# - -#------------ -# Include machine dependent compile & load options -#------------ -MAKE_CONF = Makefile.conf -include $(MAKE_CONF) - - -CMD = radmon_angle - -all: $(CMD) - -clean: - rm -f *.o - rm -f *.mod - rm -f radmon_angle - -$(CMD): $(OBJS) - $(CF) $(FFLAGS) $(LDFLAGS) -o $(@) $(OBJS) $(LIBS) - -kinds.o : kinds.F90 - $(CF) $(FFLAGS) -c $(*).F90 - -read_diag.o : read_diag.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -angle_bias.o : angle_bias.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -create_ctl_angle.o : create_ctl_angle.f90 - $(CF) $(FFLAGS) -c $(*).f90 - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radang.fd/read_diag.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radang.fd/read_diag.f90 deleted file mode 100755 index 7a4d6cdc49..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radang.fd/read_diag.f90 +++ /dev/null @@ -1,659 +0,0 @@ -!$$$ subprogram documentation block -! . . . . -! subprogram: read_raddiag read rad diag file -! prgmmr: tahara org: np20 date: 2003-01-01 -! -! abstract: This module contains code to process radiance -! diagnostic files. The module defines structures -! to contain information from the radiance -! diagnostic files and then provides two routines -! to access contents of the file. -! -! program history log: -! 2005-07-22 treadon - add this doc block -! 2010-10-05 treadon - refactor code to GSI standard -! 2010-10-08 zhu - use data_tmp to handle various npred values -! 2011-02-22 kleist - changes related to memory allocate/deallocate -! 2011-04-08 li - add tref, dtw, dtc to diag_data_fix_list, add tb_tz to diag_data_chan_list -! - correspondingly, change ireal_radiag (26 -> 30) and ipchan_radiag (7 -> 8) -! 2011-07-24 safford - make structure size for reading data_fix data version dependent -! 2013-11-21 todling - revisit how versions are set (add set/get_radiag) -! 2014-01-27 todling - add ob sensitivity index -! -! contains -! read_radiag_header - read radiance diagnostic file header -! read_radiag_data - read radiance diagnostic file data -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ - -module read_diag - - use kinds, only: i_kind,r_single - implicit none - -! Declare public and private - private - - public :: diag_header_fix_list - public :: diag_header_chan_list - public :: diag_data_name_list - public :: diag_data_fix_list - public :: diag_data_chan_list - public :: diag_data_extra_list - public :: read_radiag_header - public :: read_radiag_data -! public :: iversion_radiag -! public :: iversion_radiag_1 -! public :: iversion_radiag_2 -! public :: iversion_radiag_3 -! public :: iversion_radiag_4 - public :: ireal_radiag - public :: ipchan_radiag - public :: set_radiag - public :: get_radiag - - interface set_radiag - module procedure set_radiag_int_ ! internal procedure for integers - end interface - interface get_radiag - module procedure get_radiag_int_ ! internal procedure for integers - end interface - - integer(i_kind),parameter :: ireal_radiag = 30 ! number of real entries per spot in radiance diagnostic file - integer(i_kind),parameter :: ireal_old_radiag = 26 ! number of real entries per spot in versions older than iversion_radiag_2 - integer(i_kind),parameter :: ipchan_radiag = 8 ! number of entries per channel per spot in radiance diagnostic file - -! Declare structures for radiance diagnostic file information - type diag_header_fix_list - character(len=20) :: isis ! sat and sensor type - character(len=10) :: id ! sat type - character(len=10) :: obstype ! observation type - integer(i_kind) :: jiter ! outer loop counter - integer(i_kind) :: nchan ! number of channels in the sensor - integer(i_kind) :: npred ! number of updating bias correction predictors - integer(i_kind) :: idate ! time (yyyymmddhh) - integer(i_kind) :: ireal ! # of real elements in the fix part of a data record - integer(i_kind) :: ipchan ! # of elements for each channel except for bias correction terms - integer(i_kind) :: iextra ! # of extra elements for each channel - integer(i_kind) :: jextra ! # of extra elements - integer(i_kind) :: idiag ! first dimension of diag_data_chan - integer(i_kind) :: angord ! order of polynomial for adp_anglebc option - integer(i_kind) :: iversion ! radiance diagnostic file version number - integer(i_kind) :: inewpc ! indicator of newpc4pred (1 on, 0 off) - integer(i_kind) :: isens ! sensitivity index - end type diag_header_fix_list - - type diag_data_name_list - character(len=10),dimension(ireal_radiag) :: fix - character(len=10),dimension(:),allocatable :: chn - end type diag_data_name_list - - type diag_header_chan_list - real(r_single) :: freq ! frequency (Hz) - real(r_single) :: polar ! polarization - real(r_single) :: wave ! wave number (cm^-1) - real(r_single) :: varch ! error variance (or SD error?) - real(r_single) :: tlapmean ! mean lapse rate - integer(i_kind):: iuse ! use flag - integer(i_kind):: nuchan ! sensor relative channel number - integer(i_kind):: iochan ! satinfo relative channel number - end type diag_header_chan_list - - type diag_data_fix_list - real(r_single) :: lat ! latitude (deg) - real(r_single) :: lon ! longitude (deg) - real(r_single) :: zsges ! guess elevation at obs location (m) - real(r_single) :: obstime ! observation time relative to analysis - real(r_single) :: senscn_pos ! sensor scan position (integer(i_kind)) - real(r_single) :: satzen_ang ! satellite zenith angle (deg) - real(r_single) :: satazm_ang ! satellite azimuth angle (deg) - real(r_single) :: solzen_ang ! solar zenith angle (deg) - real(r_single) :: solazm_ang ! solar azimumth angle (deg) - real(r_single) :: sungln_ang ! sun glint angle (deg) - real(r_single) :: water_frac ! fractional coverage by water - real(r_single) :: land_frac ! fractional coverage by land - real(r_single) :: ice_frac ! fractional coverage by ice - real(r_single) :: snow_frac ! fractional coverage by snow - real(r_single) :: water_temp ! surface temperature over water (K) - real(r_single) :: land_temp ! surface temperature over land (K) - real(r_single) :: ice_temp ! surface temperature over ice (K) - real(r_single) :: snow_temp ! surface temperature over snow (K) - real(r_single) :: soil_temp ! soil temperature (K) - real(r_single) :: soil_mois ! soil moisture - real(r_single) :: land_type ! land type (integer(i_kind)) - real(r_single) :: veg_frac ! vegetation fraction - real(r_single) :: snow_depth ! snow depth - real(r_single) :: sfc_wndspd ! surface wind speed - real(r_single) :: qcdiag1 ! ir=cloud fraction, mw=cloud liquid water - real(r_single) :: qcdiag2 ! ir=cloud top pressure, mw=total column water - real(r_single) :: tref ! reference temperature (Tr) in NSST - real(r_single) :: dtw ! dt_warm at zob - real(r_single) :: dtc ! dt_cool at zob - real(r_single) :: tz_tr ! d(Tz)/d(Tr) - end type diag_data_fix_list - - type diag_data_chan_list - real(r_single) :: tbobs ! Tb (obs) (K) - real(r_single) :: omgbc ! Tb_(obs) - Tb_(simulated w/ bc) (K) - real(r_single) :: omgnbc ! Tb_(obs) - Tb_(simulated_w/o bc) (K) - real(r_single) :: errinv ! inverse error (K**(-1)) - real(r_single) :: qcmark ! quality control mark - real(r_single) :: emiss ! surface emissivity - real(r_single) :: tlap ! temperature lapse rate - real(r_single) :: tb_tz ! d(Tb)/d(Tz) - real(r_single) :: bicons ! constant bias correction term - real(r_single) :: biang ! scan angle bias correction term - real(r_single) :: biclw ! CLW bias correction term - real(r_single) :: bilap2 ! square lapse rate bias correction term - real(r_single) :: bilap ! lapse rate bias correction term - real(r_single) :: bicos ! node*cos(lat) bias correction term - real(r_single) :: bisin ! sin(lat) bias correction term - real(r_single) :: biemis ! emissivity sensitivity bias correction term - real(r_single),dimension(:),allocatable :: bifix ! angle dependent bias - real(r_single) :: bisst ! SST bias correction term - end type diag_data_chan_list - - type diag_data_extra_list - real(r_single) :: extra ! extra information - end type diag_data_extra_list - - integer(i_kind),save :: iversion_radiag ! Current version (see set routine) - integer(i_kind),parameter:: iversion_radiag_1 = 11104 ! Version when bias-correction entries were modified - integer(i_kind),parameter:: iversion_radiag_2 = 13784 ! Version when NSST entries were added - integer(i_kind),parameter:: iversion_radiag_3 = 19180 ! Version when SSMIS added - integer(i_kind),parameter:: iversion_radiag_4 = 30303 ! Version when emissivity predictor added - - real(r_single),parameter:: rmiss_radiag = -9.9e11_r_single - -contains - -subroutine set_radiag_int_ (what,iv,ier) -character(len=*),intent(in) :: what -integer(i_kind),intent(in) :: iv -integer(i_kind),intent(out):: ier -ier=-1 -if(trim(what)=='version') then - iversion_radiag = iv - ier=0 -endif -end subroutine set_radiag_int_ - -subroutine get_radiag_int_ (what,iv,ier) -character(len=*),intent(in) :: what -integer(i_kind),intent(out):: iv -integer(i_kind),intent(out):: ier -ier=-1 -if(trim(what)=='version') then - iv = iversion_radiag - ier=0 -endif -end subroutine get_radiag_int_ - -subroutine read_radiag_header(ftin,npred_radiag,retrieval,header_fix,header_chan,data_name,iflag,lverbose) -! . . . . -! subprogram: read_diag_header read rad diag header -! prgmmr: tahara org: np20 date: 2003-01-01 -! -! abstract: This routine reads the header record from a radiance -! diagnostic file -! -! program history log: -! 2010-10-05 treadon - add this doc block -! 2011-02-22 kleist - changes related to memory allocation and standard output -! -! input argument list: -! ftin - unit number connected to diagnostic file -! npred_radiag - number of bias correction terms -! retrieval - .true. if sst retrieval -! -! output argument list: -! header_fix - header information structure -! header_chan - channel information structure -! data_name - diag file data names -! iflag - error code -! lverbose - optional flag to turn off default output to standard out -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ - -! Declare passed arguments - integer(i_kind),intent(in) :: ftin - integer(i_kind),intent(in) :: npred_radiag - logical,intent(in) :: retrieval - type(diag_header_fix_list ),intent(out):: header_fix - type(diag_header_chan_list),allocatable :: header_chan(:) - type(diag_data_name_list) :: data_name - integer(i_kind),intent(out) :: iflag - logical,optional,intent(in) :: lverbose - -! Declare local variables - character(len=2):: string - character(len=10):: satid,sentype - character(len=20):: sensat - integer(i_kind) :: i,ich - integer(i_kind):: jiter,nchanl,npred,ianldate,ireal,ipchan,iextra,jextra - integer(i_kind):: idiag,angord,iversion,inewpc,isens - integer(i_kind):: iuse_tmp,nuchan_tmp,iochan_tmp - real(r_single) :: freq_tmp,polar_tmp,wave_tmp,varch_tmp,tlapmean_tmp - logical loutall - - loutall=.true. - if(present(lverbose)) loutall=lverbose - -! Read header (fixed_part). - read(ftin,IOSTAT=iflag) sensat,satid,sentype,jiter,nchanl,npred,ianldate,& - ireal,ipchan,iextra,jextra,idiag,angord,iversion,inewpc,isens - if (iflag/=0) then - rewind(ftin) - read(ftin,IOSTAT=iflag) sensat,satid,sentype,jiter,nchanl,npred,ianldate,& - ireal,ipchan,iextra,jextra,idiag,angord,iversion,inewpc - isens=0 - end if - - if (iflag/=0) then - rewind(ftin) - read(ftin,IOSTAT=iflag) sensat,satid,sentype,jiter,nchanl,npred,ianldate,& - ireal,ipchan,iextra,jextra - idiag=ipchan+npred+1 - angord=0 - iversion=0 - inewpc=0 - isens=0 - if (iflag/=0) then - write(6,*)'READ_RADIAG_HEADER: ***ERROR*** Unknown file format. Cannot read' - return - endif - endif - - header_fix%isis = sensat - header_fix%id = satid - header_fix%obstype = sentype - header_fix%jiter = jiter - header_fix%nchan = nchanl - header_fix%npred = npred - header_fix%idate = ianldate - header_fix%ireal = ireal - header_fix%ipchan = ipchan - header_fix%iextra = iextra - header_fix%jextra = jextra - header_fix%idiag = idiag - header_fix%angord = angord - header_fix%iversion= iversion - header_fix%inewpc = inewpc - header_fix%isens = isens - - if (loutall) then - write(6,*)'READ_RADIAG_HEADER: isis=',header_fix%isis,& - ' nchan=',header_fix%nchan,& - ' npred=',header_fix%npred,& - ' angord=',header_fix%angord,& - ' idiag=',header_fix%idiag,& - ' iversion=',header_fix%iversion,& - ' inewpc=',header_fix%inewpc,& - ' isens=',header_fix%isens - - if ( header_fix%iextra /= 0) & - write(6,*)'READ_RADIAG_HEADER: extra diagnostic information available, ',& - 'iextra=',header_fix%iextra - end if - - if (header_fix%npred /= npred_radiag) & - write(6,*) 'READ_RADIAG_HEADER: **WARNING** header_fix%npred,npred=',& - header_fix%npred,npred_radiag - -! Allocate and initialize as needed - if (allocated(header_chan)) deallocate(header_chan) - if (allocated(data_name%chn)) deallocate(data_name%chn) - - allocate(header_chan( header_fix%nchan)) - allocate(data_name%chn(header_fix%idiag)) - - data_name%fix(1) ='lat ' - data_name%fix(2) ='lon ' - data_name%fix(3) ='zsges ' - data_name%fix(4) ='obstim ' - data_name%fix(5) ='scanpos ' - data_name%fix(6) ='satzen ' - data_name%fix(7) ='satazm ' - data_name%fix(8) ='solzen ' - data_name%fix(9) ='solazm ' - data_name%fix(10)='sungln ' - data_name%fix(11)='fwater ' - data_name%fix(12)='fland ' - data_name%fix(13)='fice ' - data_name%fix(14)='fsnow ' - data_name%fix(15)='twater ' - data_name%fix(16)='tland ' - data_name%fix(17)='tice ' - data_name%fix(18)='tsnow ' - data_name%fix(19)='tsoil ' - data_name%fix(20)='soilmoi ' - data_name%fix(21)='landtyp ' - data_name%fix(22)='vegfrac ' - data_name%fix(23)='snowdep ' - data_name%fix(24)='wndspd ' - data_name%fix(25)='qc1 ' - data_name%fix(26)='qc2 ' - data_name%fix(27)='tref ' - data_name%fix(28)='dtw ' - data_name%fix(29)='dtc ' - data_name%fix(30)='tz_tr ' - - data_name%chn(1)='obs ' - data_name%chn(2)='omgbc ' - data_name%chn(3)='omgnbc ' - data_name%chn(4)='errinv ' - data_name%chn(5)='qcmark ' - data_name%chn(6)='emiss ' - data_name%chn(7)='tlap ' - data_name%chn(8)='tb_tz ' - - if (header_fix%iversion < iversion_radiag_1) then - data_name%chn( 8)= 'bifix ' - data_name%chn( 9)= 'bilap ' - data_name%chn(10)= 'bilap2 ' - data_name%chn(11)= 'bicons ' - data_name%chn(12)= 'biang ' - data_name%chn(13)= 'biclw ' - if (retrieval) data_name%chn(13)= 'bisst ' - elseif ( header_fix%iversion < iversion_radiag_2 .and. header_fix%iversion >= iversion_radiag_1 ) then - data_name%chn( 8)= 'bicons ' - data_name%chn( 9)= 'biang ' - data_name%chn(10)= 'biclw ' - data_name%chn(11)= 'bilap2 ' - data_name%chn(12)= 'bilap ' - do i=1,header_fix%angord - write(string,'(i2.2)') header_fix%angord-i+1 - data_name%chn(12+i)= 'bifix' // string - end do - data_name%chn(12+header_fix%angord+1)= 'bifix ' - data_name%chn(12+header_fix%angord+2)= 'bisst ' - elseif ( header_fix%iversion < iversion_radiag_3 .and. header_fix%iversion >= iversion_radiag_2 ) then - data_name%chn( 9)= 'bicons ' - data_name%chn(10)= 'biang ' - data_name%chn(11)= 'biclw ' - data_name%chn(12)= 'bilap2 ' - data_name%chn(13)= 'bilap ' - do i=1,header_fix%angord - write(string,'(i2.2)') header_fix%angord-i+1 - data_name%chn(13+i)= 'bifix' // string - end do - data_name%chn(13+header_fix%angord+1)= 'bifix ' - data_name%chn(13+header_fix%angord+2)= 'bisst ' - elseif ( header_fix%iversion < iversion_radiag_4 .and. header_fix%iversion >= iversion_radiag_3 ) then - data_name%chn( 9)= 'bicons ' - data_name%chn(10)= 'biang ' - data_name%chn(11)= 'biclw ' - data_name%chn(12)= 'bilap2 ' - data_name%chn(13)= 'bilap ' - data_name%chn(14)= 'bicos ' - data_name%chn(15)= 'bisin ' - do i=1,header_fix%angord - write(string,'(i2.2)') header_fix%angord-i+1 - data_name%chn(15+i)= 'bifix' // string - end do - data_name%chn(15+header_fix%angord+1)= 'bifix ' - data_name%chn(15+header_fix%angord+2)= 'bisst ' - else - data_name%chn( 9)= 'bicons ' - data_name%chn(10)= 'biang ' - data_name%chn(11)= 'biclw ' - data_name%chn(12)= 'bilap2 ' - data_name%chn(13)= 'bilap ' - data_name%chn(14)= 'bicos ' - data_name%chn(15)= 'bisin ' - data_name%chn(16)= 'biemis ' - do i=1,header_fix%angord - write(string,'(i2.2)') header_fix%angord-i+1 - data_name%chn(16+i)= 'bifix' // string - end do - data_name%chn(16+header_fix%angord+1)= 'bifix ' - data_name%chn(16+header_fix%angord+2)= 'bisst ' - endif - -! Read header (channel part) - do ich=1, header_fix%nchan - read(ftin,IOSTAT=iflag) freq_tmp,polar_tmp,wave_tmp,varch_tmp,tlapmean_tmp,iuse_tmp,nuchan_tmp,iochan_tmp - header_chan(ich)%freq = freq_tmp - header_chan(ich)%polar = polar_tmp - header_chan(ich)%wave = wave_tmp - header_chan(ich)%varch = varch_tmp - header_chan(ich)%tlapmean = tlapmean_tmp - header_chan(ich)%iuse = iuse_tmp - header_chan(ich)%nuchan = nuchan_tmp - header_chan(ich)%iochan = iochan_tmp - if (iflag/=0) return - end do - -! Construct array containing menonics for data record entries - - -end subroutine read_radiag_header - -subroutine read_radiag_data(ftin,header_fix,retrieval,data_fix,data_chan,data_extra,iflag ) -! . . . . -! subprogram: read_radiag_dat read rad diag data -! prgmmr: tahara org: np20 date: 2003-01-01 -! -! abstract: This routine reads the data record from a radiance -! diagnostic file -! -! program history log: -! 2010-10-05 treadon - add this doc block -! 2011-02-22 kleist - changes related to memory allocation -! -! input argument list: -! ftin - unit number connected to diagnostic file -! header_fix - header information structure -! -! output argument list: -! data_fix - spot header information structure -! data_chan - spot channel information structure -! data_extra - spot extra information -! iflag - error code -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ - - -! Declare passed arguments - integer(i_kind),intent(in) :: ftin - type(diag_header_fix_list ),intent(in) :: header_fix - logical,intent(in) :: retrieval - type(diag_data_fix_list) ,intent(out):: data_fix - type(diag_data_chan_list) ,allocatable :: data_chan(:) - type(diag_data_extra_list) ,allocatable :: data_extra(:,:) - integer(i_kind),intent(out) :: iflag - - integer(i_kind) :: ich,iang,i,j - real(r_single),dimension(:,:),allocatable :: data_tmp - real(r_single),dimension(:),allocatable :: fix_tmp - real(r_single),dimension(:,:),allocatable :: extra_tmp - -! Allocate arrays as needed - if (allocated(data_chan)) deallocate(data_chan) - allocate(data_chan(header_fix%nchan)) - - do ich=1,header_fix%nchan - if (allocated(data_chan(ich)%bifix)) deallocate(data_chan(ich)%bifix) - allocate(data_chan(ich)%bifix(header_fix%angord+1)) - end do - - if (header_fix%iextra > 0) then - if (allocated(data_extra)) deallocate(data_extra) - allocate(data_extra(header_fix%iextra,header_fix%jextra)) - allocate(extra_tmp(header_fix%iextra,header_fix%jextra)) - end if - -! Allocate arrays to hold data record - allocate(data_tmp(header_fix%idiag,header_fix%nchan)) - - if (header_fix%iversion < iversion_radiag_2) then - allocate( fix_tmp( ireal_old_radiag ) ) - else - allocate( fix_tmp( ireal_radiag ) ) - end if - -! Read data record - - if (header_fix%iextra == 0) then - read(ftin,IOSTAT=iflag) fix_tmp, data_tmp - else - read(ftin,IOSTAT=iflag) fix_tmp, data_tmp, extra_tmp - endif - - -! Transfer fix_tmp record to output structure - data_fix%lat = fix_tmp(1) - data_fix%lon = fix_tmp(2) - data_fix%zsges = fix_tmp(3) - data_fix%obstime = fix_tmp(4) - data_fix%senscn_pos = fix_tmp(5) - data_fix%satzen_ang = fix_tmp(6) - data_fix%satazm_ang = fix_tmp(7) - data_fix%solzen_ang = fix_tmp(8) - data_fix%solazm_ang = fix_tmp(9) - data_fix%sungln_ang = fix_tmp(10) - data_fix%water_frac = fix_tmp(11) - data_fix%land_frac = fix_tmp(12) - data_fix%ice_frac = fix_tmp(13) - data_fix%snow_frac = fix_tmp(14) - data_fix%water_temp = fix_tmp(15) - data_fix%land_temp = fix_tmp(16) - data_fix%ice_temp = fix_tmp(17) - data_fix%snow_temp = fix_tmp(18) - data_fix%soil_temp = fix_tmp(19) - data_fix%soil_mois = fix_tmp(20) - data_fix%land_type = fix_tmp(21) - data_fix%veg_frac = fix_tmp(22) - data_fix%snow_depth = fix_tmp(23) - data_fix%sfc_wndspd = fix_tmp(24) - data_fix%qcdiag1 = fix_tmp(25) - data_fix%qcdiag2 = fix_tmp(26) - - if ( header_fix%iversion <= iversion_radiag_1 ) then - data_fix%tref = rmiss_radiag - data_fix%dtw = rmiss_radiag - data_fix%dtc = rmiss_radiag - data_fix%tz_tr = rmiss_radiag - else - data_fix%tref = fix_tmp(27) - data_fix%dtw = fix_tmp(28) - data_fix%dtc = fix_tmp(29) - data_fix%tz_tr = fix_tmp(30) - end if - - -! Transfer data record to output structure - do ich=1,header_fix%nchan - data_chan(ich)%tbobs =data_tmp(1,ich) - data_chan(ich)%omgbc =data_tmp(2,ich) - data_chan(ich)%omgnbc=data_tmp(3,ich) - data_chan(ich)%errinv=data_tmp(4,ich) - data_chan(ich)%qcmark=data_tmp(5,ich) - data_chan(ich)%emiss =data_tmp(6,ich) - data_chan(ich)%tlap =data_tmp(7,ich) - data_chan(ich)%tb_tz =data_tmp(8,ich) - end do - if (header_fix%iversion < iversion_radiag_1) then - do ich=1,header_fix%nchan - data_chan(ich)%bifix(1)=data_tmp(8,ich) - data_chan(ich)%bilap =data_tmp(9,ich) - data_chan(ich)%bilap2 =data_tmp(10,ich) - data_chan(ich)%bicons =data_tmp(11,ich) - data_chan(ich)%biang =data_tmp(12,ich) - data_chan(ich)%biclw =data_tmp(13,ich) - data_chan(ich)%bisst = rmiss_radiag - if (retrieval) then - data_chan(ich)%biclw =rmiss_radiag - data_chan(ich)%bisst =data_tmp(13,ich) - endif - end do - elseif ( header_fix%iversion < iversion_radiag_2 .and. header_fix%iversion >= iversion_radiag_1 ) then - do ich=1,header_fix%nchan - data_chan(ich)%bicons=data_tmp(8,ich) - data_chan(ich)%biang =data_tmp(9,ich) - data_chan(ich)%biclw =data_tmp(10,ich) - data_chan(ich)%bilap2=data_tmp(11,ich) - data_chan(ich)%bilap =data_tmp(12,ich) - end do - do ich=1,header_fix%nchan - do iang=1,header_fix%angord+1 - data_chan(ich)%bifix(iang)=data_tmp(12+iang,ich) - end do - data_chan(ich)%bisst = data_tmp(12+header_fix%angord+2,ich) - end do - elseif ( header_fix%iversion < iversion_radiag_3 .and. header_fix%iversion >= iversion_radiag_2 ) then - do ich=1,header_fix%nchan - data_chan(ich)%bicons=data_tmp(9,ich) - data_chan(ich)%biang =data_tmp(10,ich) - data_chan(ich)%biclw =data_tmp(11,ich) - data_chan(ich)%bilap2=data_tmp(12,ich) - data_chan(ich)%bilap =data_tmp(13,ich) - end do - do ich=1,header_fix%nchan - do iang=1,header_fix%angord+1 - data_chan(ich)%bifix(iang)=data_tmp(13+iang,ich) - end do - data_chan(ich)%bisst = data_tmp(13+header_fix%angord+2,ich) - end do - elseif ( header_fix%iversion < iversion_radiag_4 .and. header_fix%iversion >= iversion_radiag_3 ) then - do ich=1,header_fix%nchan - data_chan(ich)%bicons=data_tmp(9,ich) - data_chan(ich)%biang =data_tmp(10,ich) - data_chan(ich)%biclw =data_tmp(11,ich) - data_chan(ich)%bilap2=data_tmp(12,ich) - data_chan(ich)%bilap =data_tmp(13,ich) - data_chan(ich)%bicos =data_tmp(14,ich) ! 1st bias correction term node*cos(lat) for SSMIS - data_chan(ich)%bisin =data_tmp(15,ich) ! 2nd bias correction term sin(lat) for SSMI - end do - do ich=1,header_fix%nchan - do iang=1,header_fix%angord+1 - data_chan(ich)%bifix(iang)=data_tmp(15+iang,ich) - end do - data_chan(ich)%bisst = data_tmp(15+header_fix%angord+2,ich) - end do - else - do ich=1,header_fix%nchan - data_chan(ich)%bicons=data_tmp(9,ich) - data_chan(ich)%biang =data_tmp(10,ich) - data_chan(ich)%biclw =data_tmp(11,ich) - data_chan(ich)%bilap2=data_tmp(12,ich) - data_chan(ich)%bilap =data_tmp(13,ich) - data_chan(ich)%bicos =data_tmp(14,ich) - data_chan(ich)%bisin =data_tmp(15,ich) - data_chan(ich)%biemis=data_tmp(16,ich) - end do - do ich=1,header_fix%nchan - do iang=1,header_fix%angord+1 - data_chan(ich)%bifix(iang)=data_tmp(16+iang,ich) - end do - data_chan(ich)%bisst = data_tmp(16+header_fix%angord+2,ich) - end do - endif - - if (header_fix%iextra > 0) then - do j=1,header_fix%jextra - do i=1,header_fix%iextra - data_extra(i,j)%extra=extra_tmp(i,j) - end do - end do - endif - - deallocate(data_tmp, fix_tmp) - if (header_fix%iextra > 0) deallocate(extra_tmp) - -end subroutine read_radiag_data - -end module read_diag - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radbcoef.fd/Makefile.conf b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radbcoef.fd/Makefile.conf deleted file mode 100755 index 9cba163a3e..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radbcoef.fd/Makefile.conf +++ /dev/null @@ -1,26 +0,0 @@ -# This config file contains the compile options for compilation -# of the RadMon code on WCOSS. - -# ---------------------------------- -# Redefine variables for WCOSS -# ---------------------------------- - CORELIB = /nwprod/lib - W3NCO_VER = v2.0.6 - W3NCO_LIB4=$(CORELIB)/w3nco/$(W3NCO_VER)/libw3nco_$(W3NCO_VER)_4.a - -# ---------------------------- -# Fortran compiler and options -# ---------------------------- - - CF = ifort - FC = $(CF) - - FFLAGS = -O3 -fp-model strict -D_REAL8_ -traceback -convert big_endian -assume byterecl - -# ------------------ -# Linker and options -# ------------------ - - LIBS = $(W3NCO_LIB4) - LDFLAGS = - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radbcoef.fd/bcoef.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radbcoef.fd/bcoef.f90 deleted file mode 100755 index aff0547f8d..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radbcoef.fd/bcoef.f90 +++ /dev/null @@ -1,354 +0,0 @@ -program bcoef - use read_diag - use kinds, only: r_kind,i_kind,r_quad - - implicit none - integer ntype,maxpred - parameter (ntype=13) - parameter (maxpred=12) - - logical eof - - character(10),dimension(ntype):: ftype - character(20) dum,satname,stringd,satsis,isis,mod_satname - character(10) satype,dplat - character(40) string,diag_rad,data_file,ctl_file - character(10) suffix - - integer luname,lungrd,lunctl,lncoef,lndiag,ich - integer iyy,imm,idd,ihh,idhh,incr,iread,iflag - integer n_chan,j,i,k,idum,ichan - integer,allocatable,dimension(:):: io_chan,nu_chan - integer npred_radiag - integer(i_kind) angord,ntlapupdate - - real pen,rmiss,weight,rread - real,allocatable,dimension(:):: wavenumbr,count,error,& - use,frequency,penalty,predr - real,allocatable,dimension(:,:):: coefs - real(r_kind) tlapm, tsum - -! Variables for reading satellite data - type(diag_header_fix_list ) :: header_fix - type(diag_header_chan_list),allocatable :: header_chan(:) - type(diag_data_name_list ) :: data_name - type(diag_data_fix_list ) :: data_fix - type(diag_data_chan_list ),allocatable :: data_chan(:) - type(diag_data_extra_list ),allocatable :: data_extra(:,:) - -! Namelist with defaults - integer :: npredr = 12 - logical :: retrieval = .false. - integer :: nchanl = 19 - integer :: imkctl = 1 - integer :: imkdata = 1 - character(3) :: gesanl ='ges' - integer :: little_endian = 1 - namelist /input/ satname,npredr,nchanl,iyy,imm,idd,ihh,idhh,& - incr,suffix,imkctl,imkdata,retrieval,gesanl,little_endian - - data luname,lungrd,lunctl / 5, 51, 52 / - data lncoef,lndiag / 21, 22 / - data rmiss /-999./ - data stringd / '.%y4%m2%d2%h2' / -!************************************************************************ -! Explanation of the fype array -! These are values used within the generated GrADS control file -! (bcoef.ctl). A fuller discription of the terms is thus: -! -! mean pred(1) = global offset (mean) -! atmpath pred(2) = not used when adp_anglebc=.true. and newpc4pred=.true. -! clw pred(3) = cloud liquid water term -! lapse2 pred(4) = (temperature lapse rate)**2 -! lapse pred(5) = temperature lapse rate -! cos_ssmis pred(6) = cosine term for SSMIS -! sin_ssmis pred(7) = sine term for SSMIS -! emiss pred(8) = emissivity sensitivity term -! ordang4 pred(9) = 4th order angle term -! ordang3 pred(10) = 3rd order angle term -! ordang2 pred(11) = 2nd order angle term -! ordang1 pred(12) = 1st order angle term -! -! Note that the npred namelist indicates how many of these terms -! will to be processed by this program. The default value is 12, -! meaning all will be processed. Earlier versions processed only the -! first 5. In all cases 12 values will be written to the resulting -! data file though if npred < 12 then the unprocessed values will -! all be set to rmiss. -!************************************************************************ - data ftype / 'penalty','mean','atmpath','clw','lapse2','lapse',& - 'cos_ssmis','sin_ssmis','emiss','ordang4','ordang3',& - 'ordang2','ordang1' / -!************************************************************************ -! - - -!************************************************************************ -! -! Initialize variables - iread=0 - npred_radiag = 12 - angord = 0 - -! Read namelist input - read(luname,input) - write(6,input) - write(6,*)'gesanl = ', gesanl - write(6,*)' ' - -! Check for user requests exceeding assumed limits - if (npredr>maxpred) then - write(6,*)' ' - write(6,*)'***ERROR*** user specified predictors > maximum allowed' - write(6,*)' npredr,maxpred=',npredr,maxpred - call errexit(91) - endif - - -! Set satellite id for specified satellite/sensor - write(6,*)'satname ',satname - - -! Create filenames for diagnostic input, binary output file - write(stringd,100) iyy,imm,idd,ihh -100 format('.',i4.4,3i2.2) - - if ( trim(gesanl) == 'ges' ) then - diag_rad = trim(satname) - data_file= trim(satname) // trim(stringd) // '.ieee_d' - ctl_file = trim(satname) // '.ctl' - else - diag_rad = trim(satname) // '_anl' - data_file= trim(satname) // '_anl' // trim(stringd) // '.ieee_d' - ctl_file = trim(satname) // '_anl.ctl' - endif - - write(6,*)'diag_rad =',diag_rad - write(6,*)'data_file=',data_file - write(6,*)'ctl_file =',ctl_file - write(6,*)'suffix =',suffix - - -! Open unit to diagnostic file. Read portion of header to -! see if file exists - open(lndiag,file=diag_rad,form='unformatted') - read(lndiag,err=900,end=900) dum - rewind lndiag - -! File exists. Read header - write(6,*)'call read_diag_header' - call read_radiag_header( lndiag, npred_radiag, retrieval, header_fix,& - header_chan, data_name, iflag ) - if( iflag/=0 ) then - write(6,*)'***ERROR*** problem reading diag file header, iflag=',iflag - call errexit(91) - endif - -! Extract observation type, satellite id, and number of channels - satype = header_fix%obstype - satsis = header_fix%isis - dplat = header_fix%id - n_chan = header_fix%nchan - angord = header_fix%angord - - if (angord == 4 ) then - npredr = 12 - endif - - write(6,*)'satype,n_chan=',satype,' ',dplat,n_chan - write(6,*)'angord = ', angord - - string = trim(satype)//'_'//trim(dplat) - write(6,*)'string,satname=',string,' ',satname - if ( trim(string) /= trim(satname) ) then - write(6,*)'***ERROR*** inconsistent instrument types' - write(6,*)' satname,string =',satname,' ',string - call errexit(93) - endif - - -! Allocate arrays to hold observational information - write(6,*)' ' - write(6,*)'allocate arrays' - allocate (io_chan(n_chan), nu_chan(n_chan), wavenumbr(n_chan)) - allocate (count(n_chan), penalty(n_chan), use(n_chan), & - frequency(n_chan)) - allocate(coefs(n_chan,maxpred)) - -! Zero accumulator arrays - do j=1,n_chan - count(j) = 0.0 - penalty(j) = 0.0 - end do - coefs = rmiss - - -! Extract satinfo relative index - do j=1,n_chan - nu_chan(j) = real( header_chan(j)%nuchan, 4 ) - io_chan(j) = real( header_chan(j)%iochan, 4 ) - wavenumbr(j) = real( header_chan(j)%wave, 4 ) - use(j) = real( header_chan(j)%iuse, 4 ) - frequency(j) = real( header_chan(j)%freq, 4) - end do - -! Loop to read entries in diagnostic file - iflag = 0 - loopd: do while (iflag == 0) - -! Read a record. If read flag, iflag does not equal zero, exit loopd - call read_radiag_data( lndiag, header_fix, retrieval, data_fix, data_chan,& - data_extra, iflag ) - if( iflag /= 0 ) exit loopd - iread=iread+1 - rread=rread+1.0 - - -! Channel loop - do j = 1, n_chan - -! If observation was assimilated, accumulate sum - if (data_chan(j)%errinv > 1.e-6) then - pen = data_chan(j)%errinv*(data_chan(j)%omgbc)**2 - count(j) = count(j) + 1.0 - penalty(j) = penalty(j) + pen - endif - - enddo ! channel loop - -! End of loop over diagnostic file - enddo loopd - close(lndiag) - write(6,*)' ' - write(6,*)'read in ',iread,' obs ',rread - write(6,*)' ' - -! Compute average. - do j=1,n_chan - if (count(j)>0) then - penalty(j)=penalty(j)/count(j) - else - count(j)=rmiss - penalty(j)=rmiss - endif - end do - - -! Open unit to input data file. See if file exists - open(lncoef,file='biascr.txt',form='formatted') - if (angord == 4 ) then - read(lncoef,122,end=920,err=920) idum - else - read(lncoef,120,end=920,err=920) idum - endif - rewind(lncoef) -120 format(I5,1x,A20,1x,I5,10f12.6) -122 format(I5,1x,A20,1x,I5,2e15.6,1x,I5/2(4x,10f12.6/)) - -!read(lunin,'(I5,1x,A20,1x,I5,2e15.6,1x,I5/2(4x,10f12.6/))',iostat=istat,end=1333) -!ich,isis,& ichan,tlapm,tsum,ntlapupdate,(predr(ip),ip=1,npred), where npred=12 - -! Read coefficient file - allocate(predr(npredr)) - i=0 - k=1 - eof=.false. - do - if (angord /= 4 ) then - read(lncoef,120,IOSTAT=iflag) ich,isis,ichan,(predr(j),j=1,npredr) - else - read(lncoef,122,IOSTAT=iflag) ich,isis,ichan, tlapm,tsum,ntlapupdate,(predr(j),j=1,npredr) - endif - if(iflag /=0) exit - if (trim(isis)==trim(satsis)) then - io_chan(k)=ichan - do j=1,npredr - coefs(k,j)=predr(j) - end do - k=k+1 - cycle - endif - end do - close(lncoef) - deallocate(predr) - - ! Create Control file - if ( imkctl == 1 ) then - write(6,*)'call create_ctl_bcoef' - - if ( trim(gesanl) == 'ges' ) then - mod_satname = trim(satname) - else - mod_satname = trim(satname) // '_anl' - endif - - call create_ctl_bcoef(ntype,ftype,n_chan,iyy,imm,idd,ihh,idhh,& - incr,ctl_file,lunctl,rmiss,mod_satname,satype,dplat,& - nu_chan,use,penalty,frequency,wavenumbr,little_endian) - else - write(6,*) 'imkctl =',imkctl - endif - - -! Write data to binary output file - if ( imkdata == 1 ) then - write(6,*)'write data to lungrd=',lungrd - open(lungrd,file=data_file,form='unformatted') - write(lungrd) (penalty(k),k=1,n_chan) - do j=1,maxpred - write(lungrd) (coefs(k,j),k=1,n_chan) - end do - close(lungrd) - endif - -! Deallocate arrays - write(6,*)'deallocate arrays' - deallocate(coefs,io_chan,nu_chan,wavenumbr,count,penalty,use,frequency) - goto 950 - - -! Jump here if problem reading diagnostic file -900 continue - write(6,*)'***PROBLEM*** reading diagnostic file' - - n_chan=nchanl - if (n_chan<=0) then - write(6,*)'***ERROR*** invalid nchanl=',nchanl,' STOP program' - call errexit(94) - endif - - write(6,*)'load missing value ',rmiss,' into output arrays. ',& - n_chan,npredr - allocate(penalty(n_chan),coefs(n_chan,npredr)) - do k=1,n_chan - penalty(k)=rmiss - end do - do j=1,npredr - do k=1,n_chan - coefs(k,j)=rmiss - end do - end do - - if ( imkdata == 1 ) then - open(lungrd,file=data_file,form='unformatted') - write(lungrd) (penalty(k),k=1,n_chan) - do j=1,npredr - write(lungrd) (coefs(k,j),k=1,n_chan) - end do - write(6,*)'write output to lungrd=',lungrd,', file=',trim(data_file) - close(lungrd) - endif - deallocate(penalty,coefs) - - goto 950 - - -! Jump here if problem reading coefficient file -920 continue - write(6,*)'***PROBLEM*** reading coefficient file' - - -! End of program -950 continue - stop -end program bcoef diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radbcoef.fd/create_ctl_bcoef.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radbcoef.fd/create_ctl_bcoef.f90 deleted file mode 100755 index f8f785dcc6..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radbcoef.fd/create_ctl_bcoef.f90 +++ /dev/null @@ -1,147 +0,0 @@ -subroutine create_ctl_bcoef(ntype,ftype,n_chan,iyy,imm,idd,ihh,idhh,& - incr,ctl_file,lunctl,rmiss,satname,satype,dplat,& - nu_chan,use,ratio,frequency,wavenumbr,little_endian) - - implicit none - - integer ntype - - character(2) cword - character(3),dimension(12):: mon - character(3):: clatmin,clatmax - character(4):: clonmin,clonmax - character(10),dimension(ntype):: ftype - character(13) stringd - character(20) satname - character(10) satype,dplat - character(40) ctl_file,grad_file - character(80) string - - integer idsat,iuse,little_endian - integer lunctl,iyy,imm,idd,ihh,j,i,n_chan,idhh,incr - integer iyy2,imm2,idd2,ihh2,ntime - integer,dimension(8):: ida,jda - integer,dimension(n_chan):: nu_chan - - real rmiss,wavelength - real,dimension(5):: fha - real,dimension(n_chan):: ratio,use,frequency,wavenumbr - - data stringd / '.%y4%m2%d2%h2' / - data mon / 'jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', & - 'aug', 'sep', 'oct', 'nov', 'dec' / - -!************************************************************************** -! Create date for tdef based on given date and hour offset - fha=0.0; ida=0; jda=0; ntime=0 - iyy2=iyy; imm2=imm; idd2=idd; ihh2=ihh - if (idhh/=0) then - ntime = abs(idhh)/incr - fha(2)=idhh - ida(1)=iyy - ida(2)=imm - ida(3)=idd - ida(4)=0 - ida(5)=ihh - call w3movdat(fha,ida,jda) - iyy2=jda(1) - imm2=jda(2) - idd2=jda(3) - ihh2=jda(5) - endif - ntime=ntime+1 - -! Open unit to GrADS control file - open(lunctl,file=ctl_file,form='formatted') - - -! Write header information - grad_file = trim(satname) // stringd // '.ieee_d' - write(lunctl,100) grad_file - if ( little_endian == 1 ) then - write(lunctl,112) - else - write(lunctl,110) - endif - write(lunctl,120) rmiss - write(lunctl,130) adjustl(satype),dplat,n_chan - write(lunctl,132) - do i=1,n_chan - iuse = nint(use(i)) - wavelength = 10000./wavenumbr(i) - write(lunctl,134) i,nu_chan(i),iuse,ratio(i),wavelength,frequency(i) - end do - - write(lunctl,210) - write(lunctl,211) - write(lunctl,212) - write(lunctl,213) - write(lunctl,214) - write(lunctl,215) - write(lunctl,216) - write(lunctl,217) - write(lunctl,218) - write(lunctl,219) - write(lunctl,220) - write(lunctl,221) - write(lunctl,222) - write(lunctl,223) - write(lunctl,224) - write(lunctl,210) - - write(lunctl,140) n_chan - write(lunctl,150) - write(lunctl,160) - write(lunctl,170) ntime,ihh2,idd2,mon(imm2),iyy2 - write(lunctl,180) ntype - -100 format('dset ^',a40) -110 format('options template big_endian sequential') -112 format('options template little_endian sequential') -120 format('undef ',f5.0) -130 format('title ',a10,1x,a10,1x,i4) -132 format('*XDEF is channel number') -134 format('* x= ',i4,', channel= ',i4,' , iuse= ',i2,' , ratio= ',f8.3,& - ' , wlth= ',f9.2,' , freq= ',f9.2) -136 format('* ',a70) -140 format('xdef ',i4,' linear 1.0 1.0') -150 format('ydef 1 linear 1.0 1.0') -160 format('zdef 1 linear 1.0 1.0') -170 format('tdef ',i4,' linear ',i2.2,'Z',i2.2,a3,i4.4,' 06hr') -180 format('vars ',i7) - -210 format('*') -211 format('* Explanation of data terms:') -212 format('* penalty penalty value') -213 format('* mean global offset (mean)') -214 format('* atmpath not used when adp_anglebc=.true. and newpc4pred=.true.') -215 format('* clw cloud liquid water term') -216 format('* lapse2 temperature lapse rate**2') -217 format('* lapse temperature lapse rate') -218 format('* cos_ssmis cosine term for SSMIS') -219 format('* sin_ssmis sine term for SSMIS') -220 format('* emiss emissivity sensitivity term') -221 format('* 4ordang 4th order angle term') -222 format('* 3ordang 3rd order angle term') -223 format('* 2ordang 2nd order angle term') -224 format('* 1ordang 1st order angle term') - - -! Write data portion of GraDS control file - do i=1,ntype - string = trim(ftype(i)) - write(lunctl,190) adjustl(string),trim(ftype(i)) -190 format(a10,' 0 0 ',a10) - end do - -! Write trminating "endvars" record - write(lunctl,200) -200 format('endvars') - - -! Close ctl file - close(lunctl) - -! Return - return -end subroutine create_ctl_bcoef diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radbcoef.fd/kinds.F90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radbcoef.fd/kinds.F90 deleted file mode 120000 index 78e1895b5d..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radbcoef.fd/kinds.F90 +++ /dev/null @@ -1 +0,0 @@ -../verf_radang.fd/kinds.F90 \ No newline at end of file diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radbcoef.fd/makefile b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radbcoef.fd/makefile deleted file mode 100755 index 549d0ea1ae..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radbcoef.fd/makefile +++ /dev/null @@ -1,48 +0,0 @@ -# ***************************************************************** -# makefile.bcoef -# -# Make the radmon_bcoef.glb executable. The executable will extract -# bcoef radiance data from a diagnostic file from a global run. -# -# ***************************************************************** - -SHELL=/bin/sh -SRCS = kinds.F90 read_diag.f90 bcoef.f90 create_ctl_bcoef.f90 - -OBJS = kinds.o read_diag.o bcoef.o create_ctl_bcoef.o - -# -# ***************************************************************** -# - -#------------ -# Include machine dependent compile & load options -#------------ -MAKE_CONF = Makefile.conf -include $(MAKE_CONF) - - - -CMD = radmon_bcoef - -all: $(CMD) - -clean: - rm -f *.o - rm -f *.mod - rm -f radmon_bcoef - -$(CMD): $(OBJS) - $(CF) $(FFLAGS) $(LDFLAGS) -o $(@) $(OBJS) $(LIBS) - -read_diag.o : read_diag.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -bcoef.o : bcoef.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -create_ctl_bcoef.o : create_ctl_bcoef.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -kinds.o : kinds.F90 - $(CF) $(FFLAGS) -c $(*).F90 diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radbcoef.fd/read_diag.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radbcoef.fd/read_diag.f90 deleted file mode 120000 index 22c276c64e..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radbcoef.fd/read_diag.f90 +++ /dev/null @@ -1 +0,0 @@ -../verf_radang.fd/read_diag.f90 \ No newline at end of file diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radbcor.fd/Makefile.conf b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radbcor.fd/Makefile.conf deleted file mode 100755 index 9cba163a3e..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radbcor.fd/Makefile.conf +++ /dev/null @@ -1,26 +0,0 @@ -# This config file contains the compile options for compilation -# of the RadMon code on WCOSS. - -# ---------------------------------- -# Redefine variables for WCOSS -# ---------------------------------- - CORELIB = /nwprod/lib - W3NCO_VER = v2.0.6 - W3NCO_LIB4=$(CORELIB)/w3nco/$(W3NCO_VER)/libw3nco_$(W3NCO_VER)_4.a - -# ---------------------------- -# Fortran compiler and options -# ---------------------------- - - CF = ifort - FC = $(CF) - - FFLAGS = -O3 -fp-model strict -D_REAL8_ -traceback -convert big_endian -assume byterecl - -# ------------------ -# Linker and options -# ------------------ - - LIBS = $(W3NCO_LIB4) - LDFLAGS = - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radbcor.fd/bcor.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radbcor.fd/bcor.f90 deleted file mode 100755 index b0d72dc6b3..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radbcor.fd/bcor.f90 +++ /dev/null @@ -1,561 +0,0 @@ -! -! bcor.f90 -! -program bcor - use read_diag - - implicit none - integer ntype,mregion,surf_nregion,max_surf_region - parameter (ntype=30,mregion=25,max_surf_region=5) - integer iglobal, iland, iwater, isnowice, imixed - parameter( iglobal=1, iland=2, iwater=3, isnowice=4, imixed=5 ) - - character(10),dimension(ntype):: ftype - character(20) satname,stringd,satsis,mod_satname - character(10) dum,satype,dplat - character(40) string,diag_rad,data_file,ctl_file - character(40),dimension(max_surf_region):: region - character(10) suffix - - integer luname,lungrd,lunctl,lndiag - integer iyy,imm,idd,ihh,idhh,incr,iread,iflag - integer n_chan,j,idsat,i,k,ii,nsub - integer,dimension(mregion):: jsub - integer,allocatable,dimension(:):: io_chan,nu_chan - integer npred_radiag,angord - - real pen,rread - real weight,rlat,rlon,rmiss,obs,biascor,obsges,obsgesnbc,rterm - real,dimension(2):: cor_total,cor_fixang,cor_lapse,cor_lapse2,& - cor_const,cor_scangl,cor_clw,cor_cos_ssmis,cor_sin_ssmis,& - cor_emiss,cor_ordang4,cor_ordang3,cor_ordang2,cor_ordang1 - - real,dimension(max_surf_region):: rlatmin,rlatmax,rlonmin,rlonmax - - real,allocatable,dimension(:):: wavenumbr - real,allocatable,dimension(:,:):: count,error,use,frequency,penalty - real,allocatable,dimension(:,:,:):: total_cor,fixang_cor,lapse_cor,& - lapse2_cor,const_cor,scangl_cor,clw_cor,cos_ssmis_cor,sin_ssmis_cor,& - emiss_cor,ordang4_cor,ordang3_cor,ordang2_cor,ordang1_cor - - logical no_obs - -! Variables for reading satellite data - type(diag_header_fix_list ) :: header_fix - type(diag_header_chan_list),allocatable :: header_chan(:) - type(diag_data_name_list ) :: data_name - type(diag_data_fix_list ) :: data_fix - type(diag_data_chan_list ),allocatable :: data_chan(:) - type(diag_data_extra_list) ,allocatable :: data_extra(:,:) - - integer nsnow, nland, nwater, nice, nmixed, ntotal - integer nnsnow, nnland, nnwater, nnmixed, nntotal - -! Namelist with defaults - logical :: retrieval = .false. - integer :: nchanl = 19 - integer :: imkctl = 1 - integer :: imkdata = 1 - character(3) :: gesanl = 'ges' - integer :: little_endian = 1 - character(3) :: rad_area = 'glb' - namelist /input/ satname,iyy,imm,idd,ihh,idhh,incr,nchanl,& - suffix,imkctl,imkdata,retrieval,gesanl,little_endian,rad_area - - data luname,lungrd,lunctl,lndiag / 5, 51, 52, 21 / - data rmiss /-999./ - data stringd / '.%y4%m2%d2%h2' / - data ftype / 'count', 'penalty', & - 'avgtotal', 'avgfixang', 'avglapse', 'avglapse2', & - 'avgconst', 'avgscangl', 'avgclw', & - 'avgcos', 'avgsin', 'avgemiss', 'avgordang4', & - 'avgordang3', 'avgordang2', 'avgordang1', & - 'sdvtotal', 'sdvfixang', 'sdvlapse', 'sdvlapse2', & - 'sdvconst', 'sdvscangl', 'sdvclw', & - 'sdvcos', 'sdvsin', 'sdvemiss', 'sdvordang4',& - 'sdvordang3', 'sdvordang2', 'sdvordang1' / - data region / 'global', 'land', 'water', 'ice/snow', 'mixed'/ - data rlonmin / -180., -180., -180., -180., -180./ - data rlonmax / 180., 180., 180., 180., 180./ - data rlatmin / -90., -90., -90., -90., -90./ - data rlatmax / 90., 90., 90., 90., 90./ - - - -!************************************************************************ -! -! Initialize variables - iread=0 - npred_radiag = 12 - -! Read namelist input - read(luname,input) - write(6,input) - write(6,*)'gesanl = ', gesanl - write(6,*)'rad_area = ', rad_area - write(6,*)' ' - - surf_nregion = 5 - if ( trim(rad_area) == 'rgn' ) then - surf_nregion = 1 - endif - - write(6,*)'surf_nregion = ', surf_nregion - - -! Ensure number of requested regions does not exceed specified upper limit - if (surf_nregion>mregion) then - write(6,*)'***ERROR*** too many regions specified' - write(6,*)' maximum allowed: mregion=',mregion - write(6,*)' user requested: surf_nregion=',surf_nregion - call errexit(91) - endif - - -! Create filenames for diagnostic input, binary output file - write(stringd,100) iyy,imm,idd,ihh -100 format('.',i4.4,3i2.2) - - if ( trim(gesanl) == 'ges' ) then - diag_rad = trim(satname) - data_file= trim(satname) // trim(stringd) // '.ieee_d' - ctl_file = trim(satname) // '.ctl' - else - diag_rad = trim(satname) // '_anl' - data_file= trim(satname) // '_anl' // trim(stringd) // '.ieee_d' - ctl_file = trim(satname) // '_anl.ctl' - endif - - write(6,*)'diag_rad =',diag_rad - write(6,*)'data_file=',data_file - write(6,*)'ctl_file =',ctl_file - write(6,*)'suffix =',suffix - - -! Open unit to diagnostic file. Read portion of header to -! see if file exists - open(lndiag,file=diag_rad,form='unformatted') - read(lndiag,err=900,end=900) dum - rewind lndiag - -! File exists. Read header - write(6,*)'call read_diag_header' - call read_radiag_header( lndiag, npred_radiag, retrieval, header_fix,& - header_chan, data_name, iflag ) - if( iflag/=0 ) then - write(6,*)'***ERROR*** problem reading diag file header, iflag=',iflag - call errexit(91) - endif - -! Extract observation type, satellite id, and number of channels - satype = header_fix%obstype - satsis = header_fix%isis - dplat = header_fix%id - n_chan = header_fix%nchan - angord = header_fix%angord - - write(6,*)'satype,dplat,n_chan,angord=',satype,' ',dplat,n_chan,angord - - string = trim(satype)//'_'//trim(dplat) - write(6,*)'string,satname=',string,' ',satname - if ( trim(string) /= trim(satname) ) then - write(6,*)'***ERROR*** inconsistent instrument types' - write(6,*)' satname,string =',satname,' ',string - call errexit(92) - endif - - -! Allocate arrays to hold observational information - write(6,*)' ' - write(6,*)'allocate arrays' - allocate (io_chan(n_chan), nu_chan(n_chan), wavenumbr(n_chan)) - allocate (total_cor(n_chan,mregion,2), fixang_cor(n_chan,mregion,2), & - lapse_cor(n_chan,mregion,2), lapse2_cor(n_chan,mregion,2), & - const_cor(n_chan,mregion,2), scangl_cor(n_chan,mregion,2), & - clw_cor(n_chan,mregion,2), cos_ssmis_cor(n_chan,mregion,2), & - sin_ssmis_cor(n_chan,mregion,2), emiss_cor(n_chan,mregion,2), & - ordang4_cor(n_chan,mregion,2), ordang3_cor(n_chan,mregion,2), & - ordang2_cor(n_chan,mregion,2), ordang1_cor(n_chan,mregion,2), & - count(n_chan,mregion), penalty(n_chan,mregion), & - error(n_chan,mregion), use(n_chan,mregion), & - frequency(n_chan,mregion)) - -! Zero accumulator arrays - do ii=1,2 - do k=1,mregion - do j=1,n_chan - if (ii==1) then - count(j,k) = 0.0 - penalty(j,k) = 0.0 - endif - total_cor(j,k,ii) = 0.0 - fixang_cor(j,k,ii) = 0.0 - lapse_cor(j,k,ii) = 0.0 - lapse2_cor(j,k,ii) = 0.0 - const_cor(j,k,ii) = 0.0 - scangl_cor(j,k,ii) = 0.0 - clw_cor(j,k,ii) = 0.0 - cos_ssmis_cor(j,k,ii) = 0.0 - sin_ssmis_cor(j,k,ii) = 0.0 - emiss_cor(j,k,ii) = 0.0 - ordang4_cor(j,k,ii) = 0.0 - ordang3_cor(j,k,ii) = 0.0 - ordang2_cor(j,k,ii) = 0.0 - ordang1_cor(j,k,ii) = 0.0 - end do - end do - end do - - -! Extract satinfo relative index - do j=1,n_chan - nu_chan(j) = real( header_chan(j)%nuchan, 4 ) - io_chan(j) = real( header_chan(j)%iochan, 4 ) - wavenumbr(j) = real( header_chan(j)%wave, 4 ) - end do - do k=1,mregion - do j=1,n_chan - error(j,k) = real( header_chan(j)%varch, 4) - use(j,k) = real( header_chan(j)%iuse, 4 ) - frequency(j,k) = real( header_chan(j)%freq, 4) - end do - end do - - -! Create GrADS control file - if ( imkctl == 1 ) then - write(6,*)'call create_ctl_bcor' - - if ( trim(gesanl) == 'ges' ) then - mod_satname = trim(satname) - else - mod_satname = trim(satname) // '_anl' - endif - - - call create_ctl_bcor(ntype,ftype,n_chan,iyy,imm,idd,ihh,idhh,& - incr,ctl_file,lunctl,rmiss,mod_satname,satype,dplat,surf_nregion,& - region,rlonmin,rlonmax,rlatmin,rlatmax,nu_chan,use(1,1),error(1,1),& - frequency(1,1),wavenumbr,little_endian) - - endif - - nwater = 0; nnwater = 0 - nland = 0; nnland = 0 - nsnow = 0; nnsnow = 0 - nice = 0 - nmixed = 0; nnmixed = 0 - ntotal = 0 - -! Loop to read entries in diagnostic file - if ( imkdata == 1 ) then - iflag = 0 - loopd: do while (iflag == 0) - -! Read a record. If read flag, iflag does not equal zero, exit loopd - call read_radiag_data( lndiag, header_fix, retrieval, data_fix, data_chan,& - data_extra, iflag ) - if( iflag /= 0 ) exit loopd - iread=iread+1 - -! Extract obervation location and mpi weight. Convert (0-360) lon to (-180,180) - rlat = data_fix%lat - rlon = data_fix%lon - if (rlon>180.) rlon = rlon - 360. - rread = rread + 1.0 - - ntotal = ntotal + 1 - jsub(1)= iglobal - nsub = 1 - - if ( surf_nregion > 1 ) then - if ( data_fix%water_frac > 0.99 ) then - nwater = nwater + 1 - else if ( data_fix%land_frac > 0.99 ) then - nland = nland + 1 - else if ( data_fix%snow_frac > 0.99 ) then - nsnow = nsnow + 1 - else if ( data_fix%ice_frac > 0.99 ) then - nice = nice + 1 - else - nmixed = nmixed + 1 - end if - - - -! Detemine into which subdomains the observation falls. -! These are now based on surface type, not geography. All -! obs match global (surf_region 1). -! - ii=0; -!jsub=0; - if ( data_fix%land_frac > 0.99 ) then - jsub(2)=iland - nsub=2 - nnland=nnland+1 - else if ( data_fix%water_frac > 0.99 ) then - jsub(2)=iwater - nsub=2 - nnwater=nnwater+1 - else if (( data_fix%snow_frac > 0.99 ) .OR. ( data_fix%ice_frac > 0.99 )) then - jsub(2)=isnowice - nsub=2 - nnsnow=nnsnow+1 - else - jsub(2)=imixed - nsub=2 - nnmixed=nnmixed+1 - write(6,*)'data_fix%land_frac,water,snow,ice = ',data_fix%land_frac, data_fix%water_frac, data_fix%snow_frac, data_fix%ice_frac - end if - end if - - -! Channel loop - do j = 1, n_chan - -! If observation was assimilated, accumulate sums in appropriate regions - if (data_chan(j)%errinv > 1.e-6) then - pen = data_chan(j)%errinv*(data_chan(j)%omgbc)**2 - cor_total(1) = (data_chan(j)%omgnbc - data_chan(j)%omgbc) - cor_fixang(1) = data_chan(j)%bifix(angord+1) - cor_lapse(1) = data_chan(j)%bilap - cor_lapse2(1) = data_chan(j)%bilap2 - cor_const(1) = data_chan(j)%bicons - cor_scangl(1) = data_chan(j)%biang - cor_clw(1) = data_chan(j)%biclw - cor_cos_ssmis(1) = data_chan(j)%bicos - cor_sin_ssmis(1) = data_chan(j)%bisin - cor_emiss(1) = data_chan(j)%biemis - if (angord >= 4 ) then - cor_ordang4(1) = data_chan(j)%bifix(1) - cor_ordang3(1) = data_chan(j)%bifix(2) - cor_ordang2(1) = data_chan(j)%bifix(3) - cor_ordang1(1) = data_chan(j)%bifix(4) - else - cor_ordang4(1) = 0.0 - cor_ordang3(1) = 0.0 - cor_ordang2(1) = 0.0 - cor_ordang1(1) = 0.0 - endif -! do i=1,angord -! cor_ordang4 -! write(string,'(i2.2)') header_fix%angord-i+1 -! data_name%chn(15+i)= 'bifix' // string -! end do - - - cor_total(2) = (data_chan(j)%omgnbc - data_chan(j)%omgbc)**2 - cor_fixang(2) = (data_chan(j)%bifix(angord+1))**2 - cor_lapse(2) = (data_chan(j)%bilap)**2 - cor_lapse2(2) = (data_chan(j)%bilap2)**2 - cor_const(2) = (data_chan(j)%bicons)**2 - cor_scangl(2) = (data_chan(j)%biang)**2 - cor_clw(2) = (data_chan(j)%biclw)**2 - cor_cos_ssmis(2) = data_chan(j)%bicos**2 - cor_sin_ssmis(2) = data_chan(j)%bisin**2 - cor_emiss(2) = data_chan(j)%biemis**2 - if (angord >= 4 ) then - cor_ordang4(1) = data_chan(j)%bifix(1)**2 - cor_ordang3(1) = data_chan(j)%bifix(2)**2 - cor_ordang2(1) = data_chan(j)%bifix(3)**2 - cor_ordang1(1) = data_chan(j)%bifix(4)**2 - else - cor_ordang4(2) = 0.0 - cor_ordang3(2) = 0.0 - cor_ordang2(2) = 0.0 - cor_ordang1(2) = 0.0 - end if - - do i=1,nsub - k=jsub(i) - count(j,k) = count(j,k) +1.0 - penalty(j,k) = penalty(j,k) + pen - - do ii=1,2 - total_cor(j,k,ii) = total_cor(j,k,ii) + cor_total(ii) - fixang_cor(j,k,ii) = fixang_cor(j,k,ii) + cor_fixang(ii) - lapse_cor(j,k,ii) = lapse_cor(j,k,ii) + cor_lapse(ii) - lapse2_cor(j,k,ii) = lapse2_cor(j,k,ii) + cor_lapse2(ii) - const_cor(j,k,ii) = const_cor(j,k,ii) + cor_const(ii) - scangl_cor(j,k,ii) = scangl_cor(j,k,ii) + cor_scangl(ii) - clw_cor(j,k,ii) = clw_cor(j,k,ii) + cor_clw(ii) - cos_ssmis_cor(j,k,ii) = cos_ssmis_cor(j,k,ii) + cor_cos_ssmis(ii) - sin_ssmis_cor(j,k,ii) = sin_ssmis_cor(j,k,ii) + cor_sin_ssmis(ii) - emiss_cor(j,k,ii) = emiss_cor(j,k,ii) + cor_emiss(ii) - ordang4_cor(j,k,ii) = ordang4_cor(j,k,ii) + cor_ordang4(ii) - ordang3_cor(j,k,ii) = ordang3_cor(j,k,ii) + cor_ordang3(ii) - ordang2_cor(j,k,ii) = ordang2_cor(j,k,ii) + cor_ordang2(ii) - ordang1_cor(j,k,ii) = ordang1_cor(j,k,ii) + cor_ordang1(ii) - end do - - end do - endif - - enddo ! channel loop - -! End of loop over diagnostic file - enddo loopd - close(lndiag) - write(6,*)' ' - write(6,*)'read in ',iread,' obs ',rread - write(6,*)' ' - - write(6,*)'nwater, nland, nice, nsnow, nmixed, ntotal = ', nwater, nland, nice, nsnow, nmixed, ntotal - nntotal=nnwater+nnland+nnsnow+nnmixed - write(6,*)'nnwater, nnland, nnsnow, nnmixed, nntotal = ', nnwater, nnland, nnsnow, nnmixed, nntotal - -! Compute average and standard deviation - do k=1,surf_nregion - do j=1,n_chan - call avgsdv(count(j,k),total_cor(j,k,1), total_cor(j,k,2), rmiss) - call avgsdv(count(j,k),fixang_cor(j,k,1), fixang_cor(j,k,2), rmiss) - call avgsdv(count(j,k),lapse_cor(j,k,1), lapse_cor(j,k,2), rmiss) - call avgsdv(count(j,k),lapse2_cor(j,k,1), lapse2_cor(j,k,2), rmiss) - call avgsdv(count(j,k),const_cor(j,k,1), const_cor(j,k,2), rmiss) - call avgsdv(count(j,k),scangl_cor(j,k,1), scangl_cor(j,k,2), rmiss) - call avgsdv(count(j,k),clw_cor(j,k,1), clw_cor(j,k,2), rmiss) - call avgsdv(count(j,k),cos_ssmis_cor(j,k,1), cos_ssmis_cor(j,k,2), rmiss) - call avgsdv(count(j,k),sin_ssmis_cor(j,k,1), sin_ssmis_cor(j,k,2), rmiss) - call avgsdv(count(j,k),emiss_cor(j,k,1), emiss_cor(j,k,2), rmiss) - call avgsdv(count(j,k),ordang4_cor(j,k,1), ordang4_cor(j,k,2), rmiss) - call avgsdv(count(j,k),ordang3_cor(j,k,1), ordang3_cor(j,k,2), rmiss) - call avgsdv(count(j,k),ordang2_cor(j,k,1), ordang2_cor(j,k,2), rmiss) - call avgsdv(count(j,k),ordang1_cor(j,k,1), ordang1_cor(j,k,2), rmiss) - - if (count(j,k)>0) then - penalty(j,k)=penalty(j,k)/count(j,k) - else - count(j,k)=rmiss - penalty(j,k)=rmiss - endif - end do - end do - -! Write output to binary output file - write(6,*)' ' - open(lungrd,file=data_file,form='unformatted') - write(lungrd) ((count(j,k),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((penalty(j,k),j=1,n_chan),k=1,surf_nregion) - do ii=1,2 - write(lungrd) ((total_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((fixang_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((lapse_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((lapse2_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((const_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((scangl_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((clw_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((cos_ssmis_cor(j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((sin_ssmis_cor(j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((emiss_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((ordang4_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((ordang3_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((ordang2_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((ordang1_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - end do - write(6,*)'write output to lungrd=',lungrd,', file=',trim(data_file) - close(lungrd) - endif - -! Deallocate arrays - write(6,*)' ' - write(6,*)'deallocate arrays' - if(allocated(io_chan)) deallocate (io_chan) - if(allocated(nu_chan)) deallocate (nu_chan) - if(allocated(wavenumbr)) deallocate (wavenumbr) - if(allocated(total_cor)) deallocate (total_cor) - if(allocated(fixang_cor)) deallocate (fixang_cor) - if(allocated(lapse_cor)) deallocate (lapse_cor) - if(allocated(lapse2_cor)) deallocate (lapse2_cor) - if(allocated(const_cor)) deallocate (const_cor) - if(allocated(scangl_cor)) deallocate (scangl_cor) - if(allocated(clw_cor)) deallocate (clw_cor) - if(allocated(cos_ssmis_cor)) deallocate (cos_ssmis_cor) - if(allocated(sin_ssmis_cor)) deallocate (sin_ssmis_cor) - if(allocated(emiss_cor)) deallocate (emiss_cor) - if(allocated(ordang4_cor)) deallocate (ordang4_cor) - if(allocated(ordang3_cor)) deallocate (ordang3_cor) - if(allocated(ordang2_cor)) deallocate (ordang2_cor) - if(allocated(ordang1_cor)) deallocate (ordang1_cor) - if(allocated(count)) deallocate (count) - if(allocated(penalty)) deallocate (penalty) - if(allocated(error)) deallocate (error) - if(allocated(use)) deallocate (use) - if(allocated(frequency)) deallocate (frequency) - - -! deallocate(io_chan,nu_chan,wavenumbr,total_cor,fixang_cor,lapse_cor,& -! lapse2_cor,const_cor,scangl_cor,clw_cor,count,penalty,error,use,& -! frequency) - - write(6,*)'deallocated arrays' - goto 950 - -! Jump to here if eof or error reading diagnostic file. -900 continue - write(6,*)'***PROBLEM reading diagnostic file. diag_rad=',diag_rad - close(lndiag) - - n_chan=nchanl - if (n_chan<=0) then - write(6,*)'***ERROR*** invalid nchanl=',nchanl,' STOP program' - call errexit(93) - endif - - write(6,*)'load missing value ',rmiss,' into output arrays. ',& - surf_nregion,n_chan - allocate(count(n_chan,surf_nregion),penalty(n_chan,surf_nregion)) - allocate(total_cor(n_chan,mregion,2), fixang_cor(n_chan,mregion,2), & - lapse_cor(n_chan,mregion,2), lapse2_cor(n_chan,mregion,2), & - const_cor(n_chan,mregion,2), scangl_cor(n_chan,mregion,2), & - clw_cor(n_chan,mregion,2)) - - write(6,*)'load missing value ',rmiss,' into output arrays' - do ii=1,2 - do k=1,surf_nregion - do j=1,n_chan - if (ii==1) then - count(j,k) =rmiss - penalty(j,k)=rmiss - endif - total_cor(j,k,ii) =rmiss - fixang_cor(j,k,ii)=rmiss - lapse_cor(j,k,ii) =rmiss - lapse2_cor(j,k,ii)=rmiss - const_cor(j,k,ii) =rmiss - scangl_cor(j,k,ii)=rmiss - clw_cor(j,k,ii) =rmiss - end do - end do - end do - - if ( imkdata == 1 ) then - open(lungrd,file=data_file,form='unformatted') - write(lungrd) ((count(j,k),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((penalty(j,k),j=1,n_chan),k=1,surf_nregion) - do ii=1,2 - write(lungrd) ((total_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((fixang_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((lapse_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((lapse2_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((const_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((scangl_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((clw_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((cos_ssmis_cor(j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((sin_ssmis_cor(j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((emiss_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((ordang4_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((ordang3_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((ordang2_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((ordang1_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - end do - write(6,*)'write output to lungrd=',lungrd,', file=',trim(data_file) - close(lungrd) - endif - deallocate(count,penalty,total_cor,fixang_cor,lapse_cor,lapse2_cor,& - const_cor,scangl_cor,clw_cor) - -! End of program -950 continue - write(6,*) 'exiting program bcor' - stop -end program bcor diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radbcor.fd/create_ctl_bcor.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radbcor.fd/create_ctl_bcor.f90 deleted file mode 100755 index e312247953..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radbcor.fd/create_ctl_bcor.f90 +++ /dev/null @@ -1,163 +0,0 @@ -subroutine create_ctl_bcor(ntype,ftype,n_chan,iyy,imm,idd,ihh,idhh,& - incr,ctl_file,lunctl,rmiss,satname,satype,dplat,nregion,& - region,rlonmin,rlonmax,rlatmin,rlatmax,nu_chan,use,error,& - frequency,wavenumbr,little_endian) - - implicit none - - integer ntype - - character(2) cword - character(3),dimension(12):: mon - character(3):: clatmin,clatmax - character(4):: clonmin,clonmax - character(10),dimension(ntype):: ftype - character(13) stringd - character(20) satname - character(10) satype,dplat - character(40) ctl_file,grad_file - character(80) string - character(40),dimension(nregion):: region - character(80),dimension(nregion):: stringr - - integer idsat,nregion,iuse,little_endian - integer lunctl,iyy,imm,idd,ihh,j,i,n_chan,idhh,incr - integer iyy2,imm2,idd2,ihh2,ntime - integer,dimension(8):: ida,jda - integer,dimension(n_chan):: nu_chan - - real rmiss,wavelength - real,dimension(5):: fha - real,dimension(n_chan):: error,use,frequency,wavenumbr - real,dimension(nregion):: rlonmin,rlonmax,rlatmin,rlatmax - - data stringd / '.%y4%m2%d2%h2' / - data mon / 'jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', & - 'aug', 'sep', 'oct', 'nov', 'dec' / - -!************************************************************************** -! Create date for tdef based on given date and hour offset - fha=0.0; ida=0; jda=0; ntime=0 - iyy2=iyy; imm2=imm; idd2=idd; ihh2=ihh - if (idhh/=0) then - ntime = abs(idhh)/incr - fha(2)=idhh - ida(1)=iyy - ida(2)=imm - ida(3)=idd - ida(4)=0 - ida(5)=ihh - call w3movdat(fha,ida,jda) - iyy2=jda(1) - imm2=jda(2) - idd2=jda(3) - ihh2=jda(5) - endif - ntime=ntime+1 - -! Open unit to GrADS control file - open(lunctl,file=ctl_file,form='formatted') - -!******************************************************************* -! Construct the region strings if this is for a global source, -! which is defined as nregion > 1. -! - if (nregion > 1) then - - do i=1,nregion - if (rlatmin(i)>0.) then - write(clatmin,10) int(rlatmin(i)) - else - write(clatmin,20) abs(int(rlatmin(i))) - endif - if (rlatmax(i)>0.) then - write(clatmax,10) int(rlatmax(i)) - else - write(clatmax,20) abs(int(rlatmax(i))) - endif - if (rlonmin(i)>0.) then - write(clonmin,30) int(rlonmin(i)) - else - write(clonmin,40) abs(int(rlonmin(i))) - endif - if (rlonmax(i)>0.) then - write(clonmax,30) int(rlonmax(i)) - else - write(clonmax,40) abs(int(rlonmax(i))) - endif - stringr(i) = trim(region(i)) // ' (' // & - trim(clonmin) // '-' // trim(clonmax) // ', ' // & - trim(clatmin) // '-' // trim(clatmax) // ')' - end do - endif -10 format(i2,'N') -20 format(i2,'S') -30 format(i3,'E') -40 format(i3,'W') - -! Write header information - grad_file = trim(satname) // stringd // '.ieee_d' - write(lunctl,100) grad_file - if ( little_endian == 1 ) then - write(lunctl,112) - else - write(lunctl,110) - endif - write(lunctl,120) rmiss - write(lunctl,130) adjustl(satype),dplat,n_chan - write(lunctl,132) - do i=1,n_chan - iuse = nint(use(i)) - wavelength = 10000./wavenumbr(i) - write(lunctl,134) i,nu_chan(i),iuse,error(i),wavelength,frequency(i) - end do - write(lunctl,136) - - if (nregion > 1) then - do i=1,nregion - write(cword,'(i2)') i - string = '* region=' // cword // ' ' // trim(stringr(i)) - write(lunctl,138) string - end do - endif - - write(lunctl,140) n_chan - write(lunctl,150) nregion - write(lunctl,160) - write(lunctl,170) ntime,ihh2,idd2,mon(imm2),iyy2 - write(lunctl,180) ntype - -100 format('dset ^',a40) -110 format('options template big_endian sequential') -112 format('options template little_endian sequential') -120 format('undef ',f5.0) -130 format('title ',a10,1x,a10,1x,i4) -132 format('*XDEF is channel number') -134 format('* x= ',i4,', channel= ',i4,' , iuse= ',i2,' , error= ',f8.3,& - ' , wlth= ',f9.2,' , freq= ',f9.2) -136 format('*YDEF is geographic region') -138 format(a80) -140 format('xdef ',i4,' linear 1.0 1.0') -150 format('ydef ',i2,' linear 1.0 1.0') -160 format('zdef 1 linear 1.0 1.0') -170 format('tdef ',i4,' linear ',i2.2,'Z',i2.2,a3,i4.4,' 06hr') -180 format('vars ',i7) - -! Write data portion of GraDS control file - do i=1,ntype - string = trim(ftype(i)) - write(lunctl,190) adjustl(string),trim(ftype(i)) -190 format(a10,' 0 0 ',a10) - end do - -! Write trminating "endvars" record - write(lunctl,200) -200 format('endvars') - - -! Close ctl file - close(lunctl) - -! Return - return -end subroutine create_ctl_bcor diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radbcor.fd/kinds.F90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radbcor.fd/kinds.F90 deleted file mode 120000 index 78e1895b5d..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radbcor.fd/kinds.F90 +++ /dev/null @@ -1 +0,0 @@ -../verf_radang.fd/kinds.F90 \ No newline at end of file diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radbcor.fd/makefile b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radbcor.fd/makefile deleted file mode 100755 index 6b9b22d1ae..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radbcor.fd/makefile +++ /dev/null @@ -1,50 +0,0 @@ -# ***************************************************************** -# makefile.bcor -# -# Make the radmon_bcor.glb executable. The executable will extract -# bcor radiance data from a diagnostic file from a global run. -# -# ***************************************************************** - -SHELL=/bin/sh -SRCS = kinds.F90 read_diag.f90 bcor.f90 avgsdv.f90 create_ctl_bcor.f90 - -OBJS = kinds.o read_diag.o bcor.o avgsdv.o create_ctl_bcor.o - -# -# ***************************************************************** -# - -#------------ -# Include machine dependent compile & load options -#------------ -MAKE_CONF = Makefile.conf -include $(MAKE_CONF) - - -CMD = radmon_bcor - -all: $(CMD) - -clean: - rm -f *.o - rm -f *.mod - rm -f radmon_bcor - -$(CMD): $(OBJS) - $(CF) $(FFLAGS) $(LDFLAGS) -o $(@) $(OBJS) $(LIBS) - -read_diag.o : read_diag.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -bcor.o : bcor.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -avgsdv.o : avgsdv.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -create_ctl_bcor.o : create_ctl_bcor.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -kinds.o : kinds.F90 - $(CF) $(FFLAGS) -c $(*).F90 diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radbcor.fd/read_diag.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radbcor.fd/read_diag.f90 deleted file mode 120000 index 22c276c64e..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radbcor.fd/read_diag.f90 +++ /dev/null @@ -1 +0,0 @@ -../verf_radang.fd/read_diag.f90 \ No newline at end of file diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radtime.fd/Makefile.conf b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radtime.fd/Makefile.conf deleted file mode 100755 index 9cba163a3e..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radtime.fd/Makefile.conf +++ /dev/null @@ -1,26 +0,0 @@ -# This config file contains the compile options for compilation -# of the RadMon code on WCOSS. - -# ---------------------------------- -# Redefine variables for WCOSS -# ---------------------------------- - CORELIB = /nwprod/lib - W3NCO_VER = v2.0.6 - W3NCO_LIB4=$(CORELIB)/w3nco/$(W3NCO_VER)/libw3nco_$(W3NCO_VER)_4.a - -# ---------------------------- -# Fortran compiler and options -# ---------------------------- - - CF = ifort - FC = $(CF) - - FFLAGS = -O3 -fp-model strict -D_REAL8_ -traceback -convert big_endian -assume byterecl - -# ------------------ -# Linker and options -# ------------------ - - LIBS = $(W3NCO_LIB4) - LDFLAGS = - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radtime.fd/bad_obs.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radtime.fd/bad_obs.f90 deleted file mode 100644 index 9962b00bb3..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radtime.fd/bad_obs.f90 +++ /dev/null @@ -1,99 +0,0 @@ -!$$$ subprogram documentation block -! . . . -! subprogram: bad_obs build bad_obs.txt file -! prgmmr: safford date: 2009-11 -! -! abstract: This module contains code to build the bad_obs.txt file. -! The bad_obs.txt file reports the satellite and channel for -! which an unexpected number of observations were found in -! assimilated radiance data. -! -! program history log: -! 2009-11-23 safford - initial coding -! -! contains: -! -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ - -module bad_obs - - implicit none - - private - - public :: open_bad_obs_file - public :: write_bad_obs - public :: close_bad_obs_file - - integer, parameter :: funit = 10 - - contains - - - !------------------------------------------------------------- - ! create the bad_obs file - !------------------------------------------------------------- - - subroutine open_bad_obs_file( date, cycle, fios ) - - !--- interface - character(8), intent( in ) :: date - character(8), intent( in ) :: cycle - integer, intent( out ) :: fios - - !--- variables - logical :: lexist = .FALSE. - character(60) :: fname - - - write(*,*) '--> open_bad_obs_file, date, cycle = ', date, cycle - !--- build the file name - fname = 'bad_obs.' // trim(date) // trim(cycle) - - !--- open file and write the header - inquire(file=fname, exist=lexist) - if( lexist .eqv. .FALSE. ) then - write(*,*) ' opening new bad_obs file' - open( UNIT=funit, FILE=fname, STATUS='NEW', IOSTAT=fios ) - else - write(*,*) ' opening existing bad_obs.txt file' - open( UNIT=funit, FILE=fname, STATUS='OLD', POSITION='APPEND', IOSTAT=fios ) - end if - - end subroutine open_bad_obs_file - - - subroutine write_bad_obs( satname, channel, region, num_obs ) - - !--- interface - character(20), intent( in ) :: satname - integer, intent( in ) :: channel - integer, intent( in ) :: region - real, intent( in ) :: num_obs - - !--- variables - real :: count - - !--- -! if( num_obs < 0.0 ) then -! count = 0.0 -! else - count = num_obs -! end if - - write(funit,*) satname, 'channel= ', channel, ' region= ', region, ' num_obs= ', count - - end subroutine write_bad_obs - - - subroutine close_bad_obs_file( ) - write(*,*) '--> close_bad_obs_file' - close( funit ) - end subroutine close_bad_obs_file - -end module bad_obs diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radtime.fd/create_ctl_time.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radtime.fd/create_ctl_time.f90 deleted file mode 100755 index a5be776d16..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radtime.fd/create_ctl_time.f90 +++ /dev/null @@ -1,162 +0,0 @@ -subroutine create_ctl_time(ntype,ftype,n_chan,iyy,imm,idd,ihh,idhh,& - incr,ctl_file,lunctl,rmiss,satname,satype,dplat,nregion,& - region,rlonmin,rlonmax,rlatmin,rlatmax,nu_chan,use,error,& - frequency,wavenumbr,little_endian) - - implicit none - - integer ntype - - character(2) cword - character(3),dimension(12):: mon - character(3):: clatmin,clatmax - character(4):: clonmin,clonmax - character(10),dimension(ntype):: ftype - character(13) stringd - character(20) satname,satsis - character(10) satype,dplat - character(40) ctl_file,grad_file - character(80) string - character(40),dimension(nregion):: region - character(80),dimension(nregion):: stringr - - integer idsat,nregion,iuse,little_endian - integer lunctl,iyy,imm,idd,ihh,j,i,n_chan,idhh,incr - integer iyy2,imm2,idd2,ihh2,ntime - integer,dimension(8):: ida,jda - integer,dimension(n_chan):: nu_chan - - real rmiss,wavelength - real,dimension(5):: fha - real,dimension(n_chan):: error,use,frequency,wavenumbr - real,dimension(nregion):: rlonmin,rlonmax,rlatmin,rlatmax - - data stringd / '.%y4%m2%d2%h2' / - data mon / 'jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', & - 'aug', 'sep', 'oct', 'nov', 'dec' / - -!************************************************************************** -! Create date for tdef based on given date and hour offset - fha=0.0; ida=0; jda=0; ntime=0 - iyy2=iyy; imm2=imm; idd2=idd; ihh2=ihh - if (idhh/=0) then - ntime = abs(idhh)/incr - fha(2)=idhh - ida(1)=iyy - ida(2)=imm - ida(3)=idd - ida(4)=0 - ida(5)=ihh - call w3movdat(fha,ida,jda) - iyy2=jda(1) - imm2=jda(2) - idd2=jda(3) - ihh2=jda(5) - endif - ntime=ntime+1 - -! Open unit to GrADS control file - open(lunctl,file=ctl_file,form='formatted') - -!******************************************************************* -! Construct the region strings if this is for a global source, -! which is defined as nregion > 1. -! - if (nregion > 1) then - do i=1,nregion - if (rlatmin(i)>0.) then - write(clatmin,10) int(rlatmin(i)) - else - write(clatmin,20) abs(int(rlatmin(i))) - endif - if (rlatmax(i)>0.) then - write(clatmax,10) int(rlatmax(i)) - else - write(clatmax,20) abs(int(rlatmax(i))) - endif - if (rlonmin(i)>0.) then - write(clonmin,30) int(rlonmin(i)) - else - write(clonmin,40) abs(int(rlonmin(i))) - endif - if (rlonmax(i)>0.) then - write(clonmax,30) int(rlonmax(i)) - else - write(clonmax,40) abs(int(rlonmax(i))) - endif - stringr(i) = trim(region(i)) // ' (' // & - trim(clonmin) // '-' // trim(clonmax) // ', ' // & - trim(clatmin) // '-' // trim(clatmax) // ')' - end do - endif -10 format(i2,'N') -20 format(i2,'S') -30 format(i3,'E') -40 format(i3,'W') - -! Write header information - grad_file = trim(satname) // stringd // '.ieee_d' - write(lunctl,100) grad_file - if ( little_endian == 1 ) then - write(lunctl,112) - else - write(lunctl,110) - endif - write(lunctl,120) rmiss - write(lunctl,130) adjustl(satype),dplat,n_chan - write(lunctl,132) - do i=1,n_chan - iuse = nint(use(i)) - wavelength = 10000./wavenumbr(i) - write(lunctl,134) i,nu_chan(i),iuse,error(i),wavelength,frequency(i) - end do - write(lunctl,136) - - if (nregion > 1) then - do i=1,nregion - write(cword,'(i2)') i - string = '* region=' // cword // ' ' // trim(stringr(i)) - write(lunctl,138) string - end do - endif - - write(lunctl,140) n_chan - write(lunctl,150) nregion - write(lunctl,160) - write(lunctl,170) ntime,ihh2,idd2,mon(imm2),iyy2 - write(lunctl,180) ntype - -100 format('dset ^',a40) -110 format('options template big_endian sequential') -112 format('options template little_endian sequential') -120 format('undef ',f5.0) -130 format('title ',a10,1x,a10,1x,i4) -132 format('*XDEF is channel number') -134 format('* x= ',i4,', channel= ',i4,' , iuse= ',i2,' , error= ',f8.3,& - ' , wlth= ',f9.2,' , freq= ',f9.2) -136 format('*YDEF is geographic region') -138 format(a80) -140 format('xdef ',i4,' linear 1.0 1.0') -150 format('ydef ',i2,' linear 1.0 1.0') -160 format('zdef 1 linear 1.0 1.0') -170 format('tdef ',i4,' linear ',i2.2,'Z',i2.2,a3,i4.4,' 06hr') -180 format('vars ',i7) - -! Write data portion of GraDS control file - do i=1,ntype - string = trim(ftype(i)) - write(lunctl,190) adjustl(string),trim(ftype(i)) -190 format(a10,' 0 0 ',a10) - end do - -! Write trminating "endvars" record - write(lunctl,200) -200 format('endvars') - - -! Close ctl file - close(lunctl) - -! Return - return -end subroutine create_ctl_time diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radtime.fd/kinds.F90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radtime.fd/kinds.F90 deleted file mode 120000 index 78e1895b5d..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radtime.fd/kinds.F90 +++ /dev/null @@ -1 +0,0 @@ -../verf_radang.fd/kinds.F90 \ No newline at end of file diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radtime.fd/makefile b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radtime.fd/makefile deleted file mode 100755 index 2f6b028688..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radtime.fd/makefile +++ /dev/null @@ -1,60 +0,0 @@ -# ***************************************************************** -# makefile -# -# Make the radmon_time.glb executable. The executable will extract -# time radiance data from a diagnostic file from a global run. -# -# ***************************************************************** -SHELL=/bin/sh -SRCS = kinds.F90 read_diag.f90 bad_obs.f90 bad_penalty.f90 bad_chan.f90 \ - valid.f90 time.f90 create_ctl_time.f90 - -OBJS = kinds.o read_diag.o bad_obs.o bad_penalty.o bad_chan.o valid.o \ - time.o create_ctl_time.o - -# -# ***************************************************************** -# - -#------------ -# Include machine dependent compile & load options -#------------ -MAKE_CONF = Makefile.conf -include $(MAKE_CONF) - - -CMD = radmon_time - -all: $(CMD) - -clean: - rm -f *.o - rm -f *.mod - rm -f radmon_time - -$(CMD): $(OBJS) - $(CF) $(FFLAGS) $(LDFLAGS) -o $(@) $(OBJS) $(LIBS) - -read_diag.o : read_diag.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -bad_obs.o : bad_obs.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -bad_penalty.o : bad_penalty.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -bad_chan.o : bad_chan.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -valid.o : valid.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -time.o : time.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -create_ctl_time.o : create_ctl_time.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -kinds.o : kinds.F90 - $(CF) $(FFLAGS) -c $(*).F90 diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radtime.fd/read_diag.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radtime.fd/read_diag.f90 deleted file mode 120000 index 22c276c64e..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radtime.fd/read_diag.f90 +++ /dev/null @@ -1 +0,0 @@ -../verf_radang.fd/read_diag.f90 \ No newline at end of file diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radtime.fd/time.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radtime.fd/time.f90 deleted file mode 100755 index 5cf23a9aba..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radtime.fd/time.f90 +++ /dev/null @@ -1,492 +0,0 @@ -program time -!************************************************************************ -! -! time.f90 -! -! log -! 05/2010 safford reduce validation to just region 1 (global) -! 07/2010 safford redefine regions to surface types -!************************************************************************ - - use read_diag - use bad_obs - use bad_penalty - use bad_chan - use valid - - implicit none - integer ntype,mregion,surf_nregion,max_surf_region - parameter (ntype=8,mregion=25, max_surf_region=5) - integer iglobal, iland, iwater, isnowice, imixed - parameter (iglobal=1, iland=2, iwater=3, isnowice=4, imixed=5) - - character(10),dimension(ntype):: ftype - character(8) stid - character(20) satname,stringd,satsis - character(10) dum,satype,dplat - character(40) string,diag_rad,data_file,dfile,ctl_file - character(40),dimension(max_surf_region):: region - character(40),dimension(mregion):: surf_region - character :: command - character(8) date,suffix,cycle - - integer luname,lungrd,lunctl,lndiag,nregion - integer iyy,imm,idd,ihh,idhh,incr,iread,iflag - integer n_chan,j,idsat,i,k,ii,nreg - integer,dimension(mregion):: jsub - integer,allocatable,dimension(:):: io_chan,nu_chan - integer :: ios = 0 - integer :: channel_obs - integer :: iret, ier, ver - integer npred_radiag - - real rread, pen, bound - real rlat, rlon, rmiss, obs - real,dimension(2):: cor_tot,nbc_omg,bc_omg - real,dimension(max_surf_region):: rlatmin,rlatmax,rlonmin,rlonmax - - real,allocatable,dimension(:):: wavenumbr,channel_count - real,allocatable,dimension(:,:):: count,error,use,frequency,penalty,test_pen - real,allocatable,dimension(:,:,:):: tot_cor,omg_nbc,omg_bc - -! Variables for reading satellite data - type(diag_header_fix_list ) :: header_fix - type(diag_header_chan_list),allocatable :: header_chan(:) - type(diag_data_name_list ) :: data_name - type(diag_data_fix_list ) :: data_fix - type(diag_data_chan_list ),allocatable :: data_chan(:) - type(diag_data_extra_list) ,allocatable :: data_extra(:,:) - - logical valid_count, valid_penalty - integer nsnow, nland, nwater, nice, nmixed, ntotal - integer nnsnow, nnland, nnwater, nnmixed, nntotal - -! Namelist with defaults - logical :: retrieval = .false. - integer :: nchanl = 19 - integer :: imkctl = 1 - integer :: imkdata = 1 - character(3) :: gesanl = 'ges' - integer :: little_endian = 1 - character(3) :: rad_area = 'glb' - namelist /input/ satname,iyy,imm,idd,ihh,idhh,incr,nchanl,& - suffix,imkctl,imkdata,retrieval,gesanl,little_endian,rad_area - - data luname,lungrd,lunctl,lndiag / 5, 51, 52, 21 / - data rmiss /-999./ - data stringd / '.%y4%m2%d2%h2' / - data ftype / 'count','penalty','omgnbc','total','omgbc','omgnbc2','total2','omgbc2'/ - data region / 'global', 'land', 'water', 'ice/snow', 'mixed'/ - data rlonmin / -180., -180., -180., -180., -180./ - data rlonmax / 180., 180., 180., 180., 180./ - data rlatmin / -90., -90., -90., -90., -90./ - data rlatmax / 90., 90., 90., 90., 90./ - - -!************************************************************************ -! -! Initialize variables - iread=0 - npred_radiag = 12 - -! Read namelist input - read(luname,input) - write(6,input) - write(6,*)' ' - write(6,*)'gesanl = ', gesanl - write(6,*)'imkdata = ', imkdata - - if ( trim(gesanl) == 'anl' ) then - ftype(3) = 'omanbc' - ftype(5) = 'omabc' - ftype(6) = 'omanbc2' - ftype(8) = 'omabc2' - endif - - surf_nregion = 5 - if ( trim(rad_area) == 'rgn' ) then - surf_nregion = 1 - endif - - nregion=surf_nregion - write(6,*)'surf_nregion = ', surf_nregion - - - nregion=surf_nregion - -! Ensure number of requested regions does not exceed specified upper limit - if (nregion>mregion) then - write(6,*)'***ERROR*** too many regions specified' - write(6,*)' maximum allowed: mregion=',mregion - write(6,*)' user requested: nregion=',nregion - call errexit(91) - endif - - -! Create filenames for diagnostic input, binary output file - write(stringd,100) iyy,imm,idd,ihh -100 format('.',i4.4,3i2.2) - - if ( trim(gesanl) == 'ges' ) then - diag_rad = trim(satname) - data_file= trim(satname) // trim(stringd) // '.ieee_d' - ctl_file = trim(satname) // '.ctl' - else - diag_rad = trim(satname) // '_anl' - data_file= trim(satname) // '_anl' // trim(stringd) // '.ieee_d' - ctl_file = trim(satname) // '_anl.ctl' - endif - - write(6,*)'diag_rad =',diag_rad - write(6,*)'data_file=',data_file - write(6,*)'ctl_file =',ctl_file - write(6,*)'suffix =',suffix - -! Open unit to diagnostic file. Read portion of -! header to see if file exists - open(lndiag,file=diag_rad,form='unformatted') - read(lndiag,err=900,end=900) dum - rewind lndiag - -! File exists. Read header - call get_radiag ('version',ver,ier) - write(6,*)'read_diag version = ', ver, ier - - write(6,*)'call read_diag_header' - call read_radiag_header( lndiag, npred_radiag, retrieval, header_fix,& - header_chan, data_name, iflag ) - if( iflag/=0 ) then - write(6,*)'***ERROR*** problem reading diag file header, iflag=',iflag - call errexit(91) - endif - -! Extract observation type, satellite id, and number of channels - satype = header_fix%obstype - satsis = header_fix%isis - dplat = header_fix%id - n_chan = header_fix%nchan - - string = trim(satype)//'_'//trim(dplat) - write(6,*)'string,satname=',string,' ',satname - if ( trim(string) /= trim(satname) ) then - write(6,*)'***ERROR*** inconsistent instrument types' - write(6,*)' satname,string =',satname,' ',string - call errexit(92) - endif - -! -! initialize data integrity check flags, open output file for email warning(s) -! - date = stringd(2:9) - cycle = stringd(10:11) - -! call open_bad_obs_file( date, cycle, ios ) - if ( trim(gesanl) == 'ges' ) then - call open_bad_penalty_file( date, cycle, ios ) - call open_bad_chan_file( date, cycle, ios ) - - call load_base( satname, ios ) - endif - - -! Allocate arrays to hold observational information - allocate (io_chan(n_chan), nu_chan(n_chan), wavenumbr(n_chan)) - allocate (tot_cor(n_chan,mregion,2), omg_nbc(n_chan,mregion,2), & - omg_bc(n_chan,mregion,2), count(n_chan,mregion), & - penalty(n_chan,mregion), test_pen(n_chan,mregion), & - error(n_chan,mregion), use(n_chan,mregion), & - frequency(n_chan,mregion), channel_count(n_chan)) - -! Zero accumulator arrays - do ii=1,2 - do k=1,mregion - do j=1,n_chan - if (ii==1) then - count(j,k) = 0.0 - penalty(j,k) = 0.0 - if( j==1) then - channel_count = 0.0 - endif - endif - tot_cor(j,k,ii) = 0.0 - omg_nbc(j,k,ii) = 0.0 - omg_bc(j,k,ii) = 0.0 - end do - end do - end do - - -! Extract satinfo relative index - do j=1,n_chan - nu_chan(j) = real( header_chan(j)%nuchan, 4 ) - io_chan(j) = real( header_chan(j)%iochan, 4 ) - wavenumbr(j) = real( header_chan(j)%wave, 4 ) - end do - do k=1,mregion - do j=1,n_chan - error(j,k) = real( header_chan(j)%varch, 4) - use(j,k) = real( header_chan(j)%iuse, 4 ) - frequency(j,k) = real( header_chan(j)%freq, 4) - end do - end do - - -! Create control file - if ( imkctl == 1 ) then - write(6,*)'call create_ctl_time' - - if ( trim(gesanl) == 'ges' ) then - dfile = trim(satname) - else - dfile = trim(satname) // '_anl' - endif - - call create_ctl_time(ntype,ftype,n_chan,iyy,imm,idd,ihh,idhh,& - incr,ctl_file,lunctl,rmiss,dfile,satype,dplat,nregion,& - region,rlonmin,rlonmax,rlatmin,rlatmax,nu_chan,use(1,1),& - error(1,1),frequency(1,1),wavenumbr,little_endian) - endif - - nwater = 0; nnwater=0 - nice = 0 - nsnow = 0; nnsnow=0 - nland = 0; nnland=0 - nmixed = 0; nnmixed=0 - ntotal = 0 - -! Loop to read entries in diagnostic file - if ( imkdata == 1 ) then - iflag = 0 - loopd: do while (iflag == 0) - -! Read a record. If read flag, iflag does not equal zero, exit loopd - call read_radiag_data( lndiag, header_fix, retrieval, data_fix, data_chan,& - data_extra, iflag ) - if( iflag /= 0 ) exit loopd - iread=iread+1 - -! Extract observation location. -! Convert (0-360) lon to (-180,180) - rlat = data_fix%lat - rlon = data_fix%lon - if (rlon>180.) rlon = rlon - 360. - rread = rread +1.0 - -! Detemine which subdomains the observation falls into. -! These are now based on surface type, not geography. All -! obs match global (surf_region 1). - - ii=0; jsub=0; - jsub(1)=iglobal - nreg=1 - - if ( nregion > 1 ) then - if ( data_fix%land_frac > 0.99 ) then - jsub(2)=iland - nreg=2 - nnland=nnland+1 - else if ( data_fix%water_frac > 0.99 ) then - jsub(2)=iwater - nreg=2 - nnwater=nnwater+1 - else if (( data_fix%snow_frac > 0.99 ) .OR. ( data_fix%ice_frac > 0.99 )) then - jsub(2)=isnowice - nreg=2 - nnsnow=nnsnow+1 - else - jsub(2)=imixed - nreg=2 - nnmixed=nnmixed+1 - write(6,*)'data_fix%land_frac,water,snow,ice = ',data_fix%land_frac, data_fix%water_frac, data_fix%snow_frac, data_fix%ice_frac - end if - end if - - -! Channel loop - do j = 1, n_chan - -! If observation was assimilated, accumulate sums in appropriate regions - if (data_chan(j)%errinv > 1.e-6) then - pen = data_chan(j)%errinv*(data_chan(j)%omgbc)**2 - cor_tot(1) = (data_chan(j)%omgnbc - data_chan(j)%omgbc) - nbc_omg(1) = - data_chan(j)%omgnbc - bc_omg(1) = - data_chan(j)%omgbc - - cor_tot(2) = (data_chan(j)%omgnbc - data_chan(j)%omgbc)**2 - nbc_omg(2) = (data_chan(j)%omgnbc)**2 - bc_omg(2) = (data_chan(j)%omgbc)**2 - - do i=1,nreg - k=jsub(i) - - count(j,k) = count(j,k) + 1.0 - penalty(j,k) = penalty(j,k) + pen - channel_count(j) = channel_count(j) + 1.0 - - do ii=1,2 - tot_cor(j,k,ii) = tot_cor(j,k,ii) + cor_tot(ii) - omg_nbc(j,k,ii) = omg_nbc(j,k,ii) + nbc_omg(ii) - omg_bc(j,k,ii) = omg_bc(j,k,ii) + bc_omg(ii) - end do - - end do - - endif - - enddo ! channel loop - - -! End of loop over diagnostic file - enddo loopd - - - write(6,*)' ' - write(6,*)'read in ',iread,' obs ',rread - write(6,*)' ' - -! -! Compute average and standard deviation -! - do k=1,nregion - do j=1,n_chan - - ! --- validate the count value for region 1 (global) - ! -! if ( use(j,k) > 0.0 .AND. k == 1 .AND. imkdata == 1 ) then -! call validate_count( j, k, count(j,k), valid_count, iret ) -! write (*,*) ' valid_count, iret = ', valid_count, iret -! if ( (iret == 0) .AND. (valid_count .eqv. .FALSE.) ) then -! write (*,*) ' calling write_bad_obs ' -! call write_bad_obs( satname, nu_chan(j), k, count(j,k) ) -! end if -! end if - - if (count(j,k)>0) then - test_pen(j,k)=penalty(j,k)/count(j,k) - - !--- check for valid penalty value for region 1 (global) - ! - if ( use(j,k) > 0.0 .AND. k == 1 .AND. imkdata == 1 .AND. trim(gesanl) == 'ges' ) then - call validate_penalty( j, k, test_pen(j,k), valid_penalty, bound, iret ) - if( (iret == 0) .AND. (valid_penalty .eqv. .FALSE.) ) then - call write_bad_penalty( satname, nu_chan(j), k, test_pen(j,k), bound ) - endif - endif - - else - count(j,k)=rmiss - penalty(j,k)=rmiss - endif - - end do - end do - -! -! Check each assimilated channel to see if we -! have a 0 count (no obs) for that channel. If so, report -! it using write_bad_chan(). -! - -! -! This is for testing purposes only -! channel_count(1) = 0.0 -! write(6,*)' header_chan(j)%iuse, channel_count(1) = ', header_chan(1)%iuse, channel_count(1) -! - do j=1,n_chan -! write(6,*)' j, header_chan(j)%iuse, channel_count(j) = ', j, header_chan(j)%iuse, channel_count(j) -! if( header_chan(j)%iuse > 0.0 ) then -! write(6,*)' header_chan(j)%iuse > 0.0', header_chan(j)%iuse -! else -! write(6,*)' header_chan(j)%iuse <= 0.0', header_chan(j)%iuse -! endif - -! if( channel_count(j) < 1.0 ) then -! write(6,*)' channel_count(j) < 1.0', channel_count(j) -! else -! write(6,*)' channel_count(j) >= 1.0', channel_count(j) -! endif - - if( header_chan(j)%iuse > 0.0 .and. channel_count(j) < 1.0 .AND. trim(gesanl) == 'ges' ) then - write(6,*)' calling write_bad_chan, satname, j, nu_chan(j) = ', satname, j, nu_chan(j) - call write_bad_chan( satname, nu_chan(j) ) - end if ! if header_chan%iuse - - end do ! channel loop - - if ( trim(gesanl) == 'ges' ) then -! call close_bad_obs_file() - call close_bad_penalty_file() - call close_bad_chan_file() - endif - - -! Write output to binary output file - - write(6,*)' ' - open(lungrd,file=data_file,form='unformatted') - write(lungrd) ((count(j,k),j=1,n_chan),k=1,nregion) - write(lungrd) ((penalty(j,k),j=1,n_chan),k=1,nregion) - do ii=1,2 - write(lungrd) ((omg_nbc(j,k,ii),j=1,n_chan),k=1,nregion) - write(lungrd) ((tot_cor(j,k,ii),j=1,n_chan),k=1,nregion) - write(lungrd) ((omg_bc (j,k,ii),j=1,n_chan),k=1,nregion) - end do - write(6,*)'write output to lungrd=',lungrd,', file=',trim(data_file) - close(lungrd) - endif - -! Deallocate arrays - write(6,*)' ' - write(6,*)'deallocate arrays' - deallocate(io_chan,nu_chan,wavenumbr,tot_cor,omg_nbc,omg_bc,count,& - penalty,error,use,frequency) - goto 950 - -! Jump to here if eof or error reading diagnostic file. -900 continue - write(6,*)'***PROBLEM reading diagnostic file. diag_rad=',diag_rad - close(lndiag) - - n_chan=nchanl - if (n_chan<=0) then - write(6,*)'***ERROR*** invalid nchanl=',nchanl,' STOP program' - call errexit(93) - endif - - write(6,*)'load missing value ',rmiss,' into output arrays. ',& - nregion,n_chan - allocate(count(n_chan,nregion),penalty(n_chan,nregion),& - omg_nbc(n_chan,nregion,2),tot_cor(n_chan,nregion,2),& - omg_bc(n_chan,nregion,2)) - do ii=1,2 - do k=1,nregion - do j=1,n_chan - if (ii==1) then - count(j,k) = rmiss - penalty(j,k)= rmiss - endif - omg_nbc(j,k,ii) = rmiss - tot_cor(j,k,ii) = rmiss - omg_bc(j,k,ii) = rmiss - end do - end do - end do - - if ( imkdata == 1 ) then - open(lungrd,file=data_file,form='unformatted') - write(lungrd) ((count(j,k),j=1,n_chan),k=1,nregion) - write(lungrd) ((penalty(j,k),j=1,n_chan),k=1,nregion) - do ii=1,2 - write(lungrd) ((omg_nbc(j,k,ii),j=1,n_chan),k=1,nregion) - write(lungrd) ((tot_cor(j,k,ii),j=1,n_chan),k=1,nregion) - write(lungrd) ((omg_bc (j,k,ii),j=1,n_chan),k=1,nregion) - end do - write(6,*)'write output to lungrd=',lungrd,', file=',trim(data_file) - close(lungrd) - endif - deallocate(count,penalty,omg_nbc,tot_cor,omg_bc) - -! End of program -950 continue - stop -end program time diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radtime.fd/valid.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radtime.fd/valid.f90 deleted file mode 100755 index ffae19c452..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radtime.fd/valid.f90 +++ /dev/null @@ -1,288 +0,0 @@ -!$$$ subprogram documentation block -! . . . -! subprogram: valid validate the obs and penalty values -! prgmmr: safford date: 2009-12 -! -! abstract: This module contains code to read a given satellite's -! base file and then validate new obs(count) and penalty -! values by comparing them to the baseline values. -! -! program history log: -! 2009-12-07 safford - initial coding -! -! contains: -! -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ - -module valid - - implicit none - - private - -! --- module routines - public :: load_base - public :: validate_count - public :: validate_penalty - -! --- module parameters - integer, parameter :: funit = 17 - real,parameter :: rmiss = -999.0 - -! --- module vars - logical :: base_loaded = .FALSE. - integer :: nchan, nregion, j, k, dummy - - real,allocatable,dimension(:,:):: avg_count, sdv_count - real,allocatable,dimension(:,:):: min_count, max_count - real,allocatable,dimension(:,:):: avg_penalty, sdv_penalty - real,allocatable,dimension(:,:):: min_penalty, max_penalty - - integer,allocatable,dimension(:):: nu_chan - - contains - - !------------------------------------------------------------- - ! load the base file for the given satellite - !------------------------------------------------------------- - - subroutine load_base( satname, iret ) - - !--- interface - character(20), intent( in ) :: satname - integer, intent( out ) :: iret - - !--- variables - character(20) fname - character(20) test_satname - character(10) base_date - - integer fios - integer chan, region - - logical fexist - - - !--- initialization - iret = -1 - fname = trim(satname) // '.base' - fexist = .FALSE. - - write(*,*) '--> valid, satname, fname = ', satname, fname - - !--- verify file exists and open the file - inquire( file = fname, exist = fexist ) - if( fexist .eqv. .FALSE. ) then - fios = -1 - else - open( UNIT=funit, FILE=fname, IOSTAT=fios ) - write(*,*) ' fios = ', fios - end if - - if( fios == 0 ) then - !--- read the file header - read(funit,*) test_satname, base_date, nchan, nregion - write(*,*) ' test_satname, base_date, nchan, nregion = ', test_satname, base_date, nchan, nregion - - allocate( avg_count(nchan,nregion), sdv_count(nchan,nregion), & - avg_penalty(nchan,nregion), sdv_penalty(nchan,nregion), & - min_count(nchan,nregion), max_count(nchan,nregion), & - min_penalty(nchan,nregion), max_penalty(nchan,nregion) ) - - ! --- set all missing - do k=1,nregion - do j=1,nchan - avg_count(j,k) = rmiss - sdv_count(j,k) = rmiss - min_count(j,k) = rmiss - max_count(j,k) = rmiss - avg_penalty(j,k) = rmiss - sdv_penalty(j,k) = rmiss - min_penalty(j,k) = rmiss - max_penalty(j,k) = rmiss - end do - end do - - do k=1,nregion - do j=1,nchan - read(funit,*) chan, region, avg_count(j,k), sdv_count(j,k), min_count(j,k), max_count(j,k), & - avg_penalty(j,k), sdv_penalty(j,k), min_penalty(j,k), max_penalty(j,k) - end do - end do - -! write(*,*) 'chan 18, region 2, avg_count(18,1), sdv_count(18,1), avg_penalty(18,1), sdv_penalty(18,1) = ', & -! avg_count(18,1), sdv_count(18,1), avg_penalty(18,1), sdv_penalty(18,1) - - iret = 0 - base_loaded = .TRUE. - else - write(*,*) 'unable to load fname for data error checking' - end if - - end subroutine load_base - - - !--------------------------------------------------------------- - ! validate a count - ! given a count value for a channel and region, determine - ! if the count is within +/- 2*sdv - ! - ! iret 0 = normal - ! -1 = invalid channel - ! -2 = invalid region - ! 1 = base file wasn't loaded, unable to validate - !--------------------------------------------------------------- - subroutine validate_count( channel, region, count, valid, iret ) - - !--- interface - integer, intent( in ) :: channel - integer, intent( in ) :: region - real, intent( in ) :: count - logical, intent( out ) :: valid - integer, intent( out ) :: iret - - !--- vars - real cnt, hi, lo, sdv2 - - write(*,*) '--> validate_count, channel, region, count ', channel, region, count - !--- initialize vars - iret = 0 - cnt = count - valid = .FALSE. - - if( base_loaded .eqv. .TRUE. ) then - if( channel < 1 .OR. channel > nchan ) then - iret = -1 - write(*,*) 'attempt to validate channel out of range', channel - else if( region < 1 .OR. region > nregion ) then - iret = -2 - write(*,*) 'attempt to validate region out of range', region - else - ! - ! all unassimilated channels in the base files will have an rmiss - ! value and are considered valid for verification purposes - ! - if( avg_count(channel,region) < 0.0 ) then - valid = .TRUE. - else - sdv2 = 2 * sdv_count( channel, region ) - hi = avg_count(channel,region) + sdv2 - lo = avg_count(channel,region) - sdv2 - - ! - ! Consider any count valid if: - ! cnt is 2 sdvs from avg or - ! cnt is within the established min/max range for chan,region - ! - if( cnt > 0.0 ) then - valid = .TRUE. - end if - !if( cnt <= hi .AND. cnt >= lo ) then - ! valid = .TRUE. - !else if( (cnt > 0) .AND. (cnt >= min_count( channel,region )) .AND. & - ! (cnt <= max_count( channel,region )) ) then - ! valid = .TRUE. - !end if - end if - - end if - - if ( valid .eqv. .FALSE. ) then - write(*,*) ' avg_count(channel,region), sdv2, hi, lo = ', avg_count(channel,region), sdv2, hi, lo - end if - write (*,*) '<-- valid, iret=', valid, iret - else - !--- base file was not loaded, so return a warning that validation isn't possible - iret = 1 - end if - end subroutine validate_count - - - !------------------------------------------------------------- - ! validate a penalty value - ! given a penalty value for a channel and region, determine - ! if the penalty is within +/- 2*sdv - ! - ! iret 0 = normal - ! -1 = invalid channel - ! -2 = invalid region - !------------------------------------------------------------- - subroutine validate_penalty( channel, region, penalty, valid, bound, iret ) - - !--- interface - integer, intent( in ) :: channel - integer, intent( in ) :: region - real, intent( in ) :: penalty - logical, intent( out ) :: valid - real, intent( out ) :: bound - integer, intent( out ) :: iret - - !--- vars - real hi, lo, sdv2 - - write(*,*) '--> validate_penalty, channel, region, penalty ', channel, region, penalty - - !--- initialize vars - iret = 0 - valid = .FALSE. - bound = rmiss - - if( base_loaded .eqv. .TRUE. ) then - if( channel < 1 .OR. channel > nchan ) then - iret = -1 - write(*,*) 'attempt to validate channel out of range', channel - else if( region < 1 .OR. region > nregion ) then - iret = -2 - write(*,*) 'attempt to validate region out of range', region - else - ! - ! all unassimilated channels in the base files will have an rmiss - ! value and are considered valid for verification purposes - ! - bound = max_penalty( channel,region ) - - if( avg_penalty(channel,region) < 0.0 ) then - valid = .TRUE. - else - sdv2 = 2 * sdv_penalty( channel, region ) - hi = avg_penalty(channel,region) + sdv2 - lo = avg_penalty(channel,region) - sdv2 - - ! - ! Consider any penalty value valid if: - ! penalty is 2 sdvs from avg or - ! penalty is greater than the established max range for - ! chan,region by 20% or more --> idea here is to stage - ! two levels of warning, say a 20% exceedence and then - ! maybe a 25% or 30% exceedence for a yellow and red - ! level warning. - ! - if( (penalty >= 0.0) .AND. penalty <= hi ) then - valid = .TRUE. - else if( (penalty > 0.0) .AND. & - (penalty <= (max_penalty( channel,region )*1.2) ) ) then - valid = .TRUE. - !else if( penalty > hi ) then - ! bound = max_penalty( channel,region ) - end if - - end if - end if - - if ( valid .eqv. .FALSE. ) then - write(*,*) ' BAD: penalty, avg_penalty(channel,region), sdv2, hi, lo, bound = ', penalty, avg_penalty(channel,region), sdv2, hi, lo, bound - end if - write (*,*) '<-- valid, iret=', valid, iret - else - !--- base file was not loaded, so return a warning that validation isn't possible - iret = 1 - end if - end subroutine validate_penalty - - -end module valid diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/ush/radmon_ck_stdout.sh b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/ush/radmon_ck_stdout.sh deleted file mode 100755 index 6e408a0c72..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/ush/radmon_ck_stdout.sh +++ /dev/null @@ -1,126 +0,0 @@ -#!/bin/ksh - -################################################################################ -#### UNIX Script Documentation Block -# . . -# Script name: radmon_ck_stdout.sh -# Script description: Scan stdout files for problems reading the diagnostic -# files. -# -# Author: Ed Safford Org: NP23 Date: 2012-02-02 -# -# Abstract: This script scans the stdout files produced by the radmon_time -# executable for problems reading the diagnostic files. -# -# This script is a child script of radmon_verf_time.sh. The parent -# script generates the stdout files which this script examines. -# -# -# Script history log: -# 2012-02-02 Safford initial script -# -# Usage: radmon_ck_stdout.sh outfile -# -# Input script positional parameters: -# outfile output file name -# required -# -# Imported Shell Variables: -# SATYPE list of satellite/instrument sources -# defaults to none -# INISCRIPT preprocessing script -# defaults to none -# LOGSCRIPT log script -# defaults to none -# ERRSCRIPT error processing script -# defaults to 'eval [[ $err = 0 ]]' -# ENDSCRIPT postprocessing script -# defaults to none -# VERBOSE Verbose flag (YES or NO) -# defaults to NO -# -# Exported Shell Variables: -# err Last return code -# -# Modules and files referenced: -# scripts : $INISCRIPT -# $LOGSCRIPT -# $ERRSCRIPT -# $ENDSCRIPT -# -# programs : -# -# fixed data : -# -# input data : $data_file -# -# output data: $outfile -# -# Remarks: -# -# Condition codes -# 0 - no problem encountered -# >0 - some problem encountered -# -# Control variable resolution priority -# 1 Command line argument. -# 2 Environment variable. -# 3 Inline default. -# -# Attributes: -# Language: POSIX shell -# Machine: IBM SP -#################################################################### -# Command line arguments. -outfile=${1:-${outfile:?}} - -# Directories -# File names -INISCRIPT=${INISCRIPT:-} -LOGSCRIPT=${LOGSCRIPT:-} -ERRSCRIPT=${ERRSCRIPT:-} -ENDSCRIPT=${ENDSCRIPT:-} - -# Other variables -SATYPE=${SATYPE:-} -err=0 - -if [[ "$VERBOSE" = "YES" ]]; then - set -ax - echo "$(date) executing $0 $* >&2" -fi -################################################################################ -# Preprocessing -$INISCRIPT -$LOGSCRIPT - -outfile=$1 -error_msg="PROBLEM reading diagnostic file" - -for type in ${SATYPE}; do - if [[ "$VERBOSE" = "YES" ]]; then - echo ${type} - fi - if [[ -s "stdout.${type}" ]]; then - if [[ "$VERBOSE" = "YES" ]]; then - echo stdout.${type} - fi - match=`gawk "/$error_msg/" stdout.$type` - - match_len=`echo ${#match}` - if [[ $match_len > 0 ]]; then - echo "${type} ${match}" >> $outfile - fi - fi -done - -################################################################################ -# Post processing -$ENDSCRIPT -set +x - -if [[ "$VERBOSE" = "YES" ]]; then - echo $(date) EXITING $0 with error code ${err} >&2 -fi - -exit ${err} diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/ush/radmon_err_rpt.sh b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/ush/radmon_err_rpt.sh deleted file mode 100755 index 00d9709bea..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/ush/radmon_err_rpt.sh +++ /dev/null @@ -1,249 +0,0 @@ -#!/bin/ksh - -################################################################################ -#### UNIX Script Documentation Block -# . . -# Script name: radmon_err_rpt.sh -# Script description: Compare the contents of error files from two different -# cycles. -# -# Author: Ed Safford Org: NP23 Date: 2012-02-02 -# -# Abstract: This script compares the contents of two error files from two different -# sets of radiance diagnostic files (which are an output from GSI runs). -# All unique satellite instrument/channel/region combinations that appear -# in both files are reported. -# -# This script is a child script of radmon_verf_time.sh. The parent -# script creates/copies the error files into a temporary working -# directory before invoking this script. -# -# -# Script history log: -# 2012-02-02 Safford initial script -# -# Usage: radmon_err_rpt.sh file1 file2 type cycle1 cycle2 diag_rpt outfile -# -# Input script positional parameters: -# file1 obs, penalty, or channel error file -# required -# file2 obs, penalty, or channel error file -# required -# type type of error file -# choises are obs, pen, or chan; required -# cycle1 first cycle processing date -# yyyymmddcc format; required -# cycle2 second cycle processing date -# yyyymmddcc format; required -# diag_rpt diagnostic report text file -# required -# outfile output file name -# required -# -# Imported Shell Variables: -# -# USHradmon scripts directory -# defaults to pwd -# INISCRIPT preprocessing script -# defaults to none -# LOGSCRIPT log script -# defaults to none -# ERRSCRIPT error processing script -# defaults to 'eval [[ $err = 0 ]]' -# ENDSCRIPT postprocessing script -# defaults to none -# VERBOSE Verbose flag (YES or NO) -# defaults to NO -# -# Exported Shell Variables: -# err Last return code -# -# Modules and files referenced: -# scripts : $INISCRIPT -# $LOGSCRIPT -# $ERRSCRIPT -# $ENDSCRIPT -# -# programs : radmon_getchgrp.pl -# -# -# fixed data : $ctlfile -# -# input data : $file1 -# $file2 -# -# output data: $outfile -# -# Remarks: -# -# Condition codes -# 0 - no problem encountered -# >0 - some problem encountered -# -# Control variable resolution priority -# 1 Command line argument. -# 2 Environment variable. -# 3 Inline default. -# -# Attributes: -# Language: POSIX shell -# Machine: IBM SP -#################################################################### -# Command line arguments. -file1=${1:-${file1:?}} -file2=${2:-${file2:?}} -type=${3:-${type:?}} -cycle1=${4:-${cycle1:?}} -cycle2=${5:-${cycle2:?}} -diag_rpt=${6:-${diag_rpt:?}} -outfile=${7:-${outfile:?}} - -# Directories -USHradmon=${USHradmon:-$(pwd)} - -# File names -INISCRIPT=${INISCRIPT:-} -LOGSCRIPT=${LOGSCRIPT:-} -ERRSCRIPT=${ERRSCRIPT:-} -ENDSCRIPT=${ENDSCRIPT:-} - -# Other variables -VERBOSE=${VERBOSE:-NO} -err=0 - -if [[ "$VERBOSE" = "YES" ]]; then - echo EXECUTING $0 $* >&2 - set -ax -fi - -#export list=$list0 - - have_diag_rpt=0 - if [[ -s $diag_rpt ]]; then - have_diag_rpt=1 - else - err=1 - fi - - -#----------------------------------------------------------------------------- -# read each line in the $file1 -# search $file2 for the same satname, channel, and region -# if same combination is in both files, add the values to the output file -# - { while read myline;do - bound="" - - echo $myline - satname=`echo $myline | gawk '{print $1}'` - echo satname = $satname - channel=`echo $myline | gawk '{print $3}'` - echo channel = $channel - region=`echo $myline | gawk '{print $5}'` - echo region = $region - value1=`echo $myline | gawk '{print $7}'` - echo value1 = $value1 - bound=`echo $myline | gawk '{print $9}'` - -# -# Check findings against diag_report. If the satellite/instrument is on the -# diagnostic report it means the diagnostic file file for the -# satelite/instrument is missing for this cycle, so skip any additional -# error checking for that source. Otherwise, evaluate as per normal. -# - - diag_match="" - diag_match_len=0 - - if [[ $have_diag_rpt == 1 ]]; then - diag_match=`gawk "/$satname/" $diag_rpt` - diag_match_len=`echo ${#diag_match}` - fi - - - if [[ $diag_match_len == 0 ]]; then - - if [[ $type == "chan" ]]; then - match=`gawk "/$satname/ && /channel= $channel/" $file2` - else - match=`gawk "/$satname/ && /channel= $channel / && /region= $region /" $file2` - echo match = $match - - match_len=`echo ${#match}` - if [[ $match_len > 0 ]]; then - channel2=`echo $match | gawk '{print $3}'` - echo channel2 = $channel2 - if [[ $channel2 != $channel ]]; then - match="" - fi - fi - echo match = $match - fi - match_len=`echo ${#match}` - - if [[ $match_len > 0 ]]; then - echo $match_len - value2=`echo $match | gawk '{print $7}'` - bound2=`echo $match | gawk '{print $9}'` - - if [[ $type == "chan" ]]; then - tmpa="$satname channel= $channel" - tmpb="" - - elif [[ $type == "pen" ]]; then - tmpa="$satname channel= $channel region= $region" - tmpb="$cycle1 $value1 $bound" - - else - tmpa="$satname channel= $channel region= $region" - tmpb="$cycle1: $type= $value1" - fi - - line1="$tmpa $tmpb" - echo "$line1" >> $outfile - - if [[ $type != "chan" ]]; then - tmpc=`echo $tmpa |sed 's/[a-z]/ /g' | sed 's/[0-9]/ /g' | sed 's/=/ /g' | sed 's/_/ /g' | sed 's/-/ /g'` - - if [[ $type == "pen" ]]; then - line2=" $tmpc $cycle2 $value2 $bound2" - else - line2=" $tmpc $cycle2: $type= $value2" - fi - - echo "$line2" >> $outfile - fi - - #---------------------------------------------------------- - # Access the control file to deterimine channel grouping - # number. Not all sources have consecutively numbered - # channels, and we need to map the channel to the correct - # grouping number in order to produce an accurate hyperlink. - # - ctlfile="time.${satname}.ctl" - if [[ -s ${ctlfile}.Z || -s ${ctlfile}.gz ]]; then - uncompress ${ctlfile}.* - fi - changrp=`${USHradmon}/radmon_getchgrp.pl ${ctlfile} ${channel}` - echo changrp = $changrp - line3=" http://www.emc.ncep.noaa.gov/gmb/gdas/radiance/esafford/opr/index.html?sat=${satname}®ion=${region}&channel=${changrp}&stat=${type}" - if [[ $changrp -gt 0 ]]; then - echo "$line3" >> $outfile - echo "" >> $outfile - fi - fi - fi - done } < $file1 - - -################################################################################ -# Post processing -$ENDSCRIPT -set +x - -if [[ "$VERBOSE" = "YES" ]]; then - echo $(date) EXITING $0 with error code ${err} >&2 -fi - -exit ${err} - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/ush/radmon_getchgrp.pl b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/ush/radmon_getchgrp.pl deleted file mode 100755 index 890beb15a7..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/ush/radmon_getchgrp.pl +++ /dev/null @@ -1,82 +0,0 @@ -#! /usr/bin/perl - -################################################################################ -#### Perl Script Documentation Block -# . . -# Script name: radmon_getchgrp.pl -# Script description: Find the channel grouping number for a given setllite and -# channel. -# -# Author: Ed Safford Org: NP23 Date: 2012-02-02 -# -# Abstract: This script determines the channel grouping number for a given -# satellite and channel number. Most, but not all satellite sources -# have consecutively numbered channels. This script locates the -# channel and determines in which block of images that channel would be -# located. -# -# -# Script history log: -# 2012-02-02 Safford initial script -# -# Usage: radmon_getchgrp.pl ctl_file channel -# -# Input script positional parameters: -# ctl_file meta-data file -# required -# channel satellite/instrument channel number -# required -# -# output data: $chan_grp -# -# -# Remarks: -# -# Condition codes -# 0 - no problem encountered -# >0 - some problem encountered -# -# Control variable resolution priority -# 1 Command line argument. -# -# Attributes: -# Language: Perl script -# Machine: IBM SP -#################################################################### - -$numArgs = $#ARGV + 1; - -if( $numArgs < 2 ) { - print" Usage: \n"; - print" radmon_gtchgrp.pl sat_control_file, channel \n"; - exit(1); -} -else { - $ctl_file = @ARGV[0]; - $channel = @ARGV[1]; -} - -#---------------------------------------------------------- -# Load the control file -#---------------------------------------------------------- -open( CTLFILE, $ctl_file ) or die "Can't open $ctl_file \n"; - -$chan_grp = 0; -$ctr = 0; - -while( $line = ) { - if ( $line =~ m/iuse/ ) { - $ctr+=1; - @fields = split ' ', $line; - if( $fields[4] == $channel ) { - $chan_grp = int( $ctr/4 ); - if( $ctr % 4 > 0 ) { - $chan_grp +=1; - break; - } - } - } -} - -print "$chan_grp\n"; -close CTLFILE; diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/ush/radmon_verf_angle.sh b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/ush/radmon_verf_angle.sh deleted file mode 100755 index 9c43020d8f..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/ush/radmon_verf_angle.sh +++ /dev/null @@ -1,245 +0,0 @@ -#!/bin/ksh - -################################################################################ -#### UNIX Script Documentation Block -# . . -# Script name: radmon_verf_angle.sh -# Script description: Extract angle dependent data from radiance -# diagnostic files. -# -# Author: Ed Safford Org: NP23 Date: 2012-02-02 -# -# Abstract: This script extracts angle dependent data from radiance -# diagnostic files (which are an output from GSI runs), -# storing the extracted data in small binary files. -# -# This script is a child script of exgdas_vrfyrad.sh.sms. The parent -# script opens and uncompresses the radiance diagnostic file and copies -# other supporting files into a temporary working directory. -# -# -# Script history log: -# 2012-02-02 Safford initial script -# -# Usage: radmon_verf_angle.sh PDATE -# -# Input script positional parameters: -# PDATE processing date -# yyyymmddcc format; required -# -# Imported Shell Variables: -# SUFFIX data source suffix -# defauls to opr -# MAKE_CTL switch to construct the meta-data control file -# defaults to 1 (on) -# MAKE_DATA switch to construct the binary data file -# defaults to 1 (on) -# EXECradmon executable directory -# defaults to current directory -# FIXradmon fixed data directory -# defaults to current directory -# RAD_AREA global or regional flag -# defaults to global -# TANKverf_rad data repository -# defaults to current directory -# SATYPE list of satellite/instrument sources -# defaults to none -# INISCRIPT preprocessing script -# defaults to none -# LOGSCRIPT log script -# defaults to none -# ERRSCRIPT error processing script -# defaults to 'eval [[ $err = 0 ]]' -# ENDSCRIPT postprocessing script -# defaults to none -# VERBOSE Verbose flag (YES or NO) -# defaults to NO -# LITTLE_ENDIAN flag to indicate LE machine -# defaults to 0 (big endian) -# USE_ANL use analysis files as inputs in addition to -# the ges files. Default is 0 (ges only) -# -# Exported Shell Variables: -# err Last return code -# -# Modules and files referenced: -# scripts : $INISCRIPT -# $LOGSCRIPT -# $ERRSCRIPT -# $ENDSCRIPT -# -# programs : $NCP -# $angle_exec -# -# fixed data : $scaninfo -# -# input data : $data_file -# -# output data: $angle_file -# $angle_ctl -# $angle_stdout -# -# Remarks: -# -# Condition codes -# 0 - no problem encountered -# >0 - some problem encountered -# -# Control variable resolution priority -# 1 Command line argument. -# 2 Environment variable. -# 3 Inline default. -# -# Attributes: -# Language: POSIX shell -# Machine: IBM SP -#################################################################### -# Command line arguments. -export PDATE=${1:-${PDATE:?}} - -# Directories -FIXradmon=${FIXradmon:-$(pwd)} -EXECradmon=${EXECradmon:-$(pwd)} -TANKverf_rad=${TANKverf_rad:-$(pwd)} - -# File names -INISCRIPT=${INISCRIPT:-} -LOGSCRIPT=${LOGSCRIPT:-} -ERRSCRIPT=${ERRSCRIPT:-} -ENDSCRIPT=${ENDSCRIPT:-} - -# Other variables -MAKE_CTL=${MAKE_CTL:-1} -MAKE_DATA=${MAKE_DATA:-1} -RAD_AREA=${RAD_AREA:-glb} -SATYPE=${SATYPE:-} -VERBOSE=${VERBOSE:-NO} -LITTLE_ENDIAN=${LITTLE_ENDIAN:-0} -USE_ANL=${USE_ANL:-0} - -if [[ $USE_ANL -eq 1 ]]; then - gesanl="ges anl" -else - gesanl="ges" -fi - -err=0 -angle_exec=radmon_angle -scaninfo=scaninfo.txt - -if [[ "$VERBOSE" = "YES" ]]; then - set -ax - echo "$(date) executing $0 $* >&2" -fi -################################################################################ -# Preprocessing -$INISCRIPT -$LOGSCRIPT - - -#-------------------------------------------------------------------- -# Copy extraction program and supporting files to working directory - -$NCP ${EXECradmon}/${angle_exec} ./ -$NCP $FIXradmon/gdas_radmon_scaninfo.txt ./${scaninfo} - -if [[ ! -s ./${angle_exec} || ! -s ./${scaninfo} ]]; then - err=2 -else -#-------------------------------------------------------------------- -# Run program for given time - - iyy=`echo $PDATE | cut -c1-4` - imm=`echo $PDATE | cut -c5-6` - idd=`echo $PDATE | cut -c7-8` - ihh=`echo $PDATE | cut -c9-10` - - ctr=0 - fail=0 - - for type in ${SATYPE}; do - - for dtype in ${gesanl}; do - - ctr=`expr $ctr + 1` - - if [[ $dtype == "anl" ]]; then - data_file=${type}_anl.${PDATE}.ieee_d - angl_file=angle.${data_file} - ctl_file=${type}_anl.ctl - angl_ctl=angle.${ctl_file} - stdout_file=stdout.${type}_anl - angl_stdout=angle.${stdout_file} - else - data_file=${type}.${PDATE}.ieee_d - angl_file=angle.${data_file} - ctl_file=${type}.ctl - angl_ctl=angle.${ctl_file} - stdout_file=stdout.${type} - angl_stdout=angle.${stdout_file} - fi - - rm input - - nchanl=-999 -cat << EOF > input - &INPUT - satname='${type}', - iyy=${iyy}, - imm=${imm}, - idd=${idd}, - ihh=${ihh}, - idhh=-720, - incr=6, - nchanl=${nchanl}, - suffix='${SUFFIX}', - imkctl=${MAKE_CTL}, - imkdata=${MAKE_DATA}, - gesanl='${dtype}', - little_endian=${LITTLE_ENDIAN}, - rad_area='${RAD_AREA}', - / -EOF - $TIMEX ./${angle_exec} < input > ${stdout_file} - if [[ $? -ne 0 ]]; then - fail=`expr $fail + 1` - fi -#------------------------------------------------------------------- -# move data, control, and stdout files to $TANKverf_rad and compress -# - if [[ -s ${data_file} ]]; then - mv ${data_file} ${angl_file} - mv ${angl_file} $TANKverf_rad/. - ${COMPRESS} -f $TANKverf_rad/${angl_file} - fi - - if [[ -s ${ctl_file} ]]; then - mv ${ctl_file} ${angl_ctl} - mv ${angl_ctl} ${TANKverf_rad}/. - ${COMPRESS} -f ${TANKverf_rad}/${angl_ctl} - fi - - if [[ -s ${stdout_file} ]]; then - mv ${stdout_file} ${angl_stdout} - mv ${angl_stdout} ${TANKverf_rad}/. - ${COMPRESS} -f ${TANKverf_rad}/${angl_stdout} - fi - - done # for dtype in ${gesanl} loop - done # for type in ${SATYPE} loop - - if [[ $fail -eq $ctr || $fail -gt $ctr ]]; then - err=3 - fi -fi - -################################################################################ -# Post processing -$ENDSCRIPT -set +x - -if [[ "$VERBOSE" = "YES" ]]; then - echo $(date) EXITING $0 error code ${err} >&2 -fi - -exit ${err} diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/ush/radmon_verf_bcoef.sh b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/ush/radmon_verf_bcoef.sh deleted file mode 100755 index ab63eeb1c8..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/ush/radmon_verf_bcoef.sh +++ /dev/null @@ -1,247 +0,0 @@ -#!/bin/ksh - -################################################################################ -#### UNIX Script Documentation Block -# . . -# Script name: radmon_verf_bcoef.sh -# Script description: Extract bias correction coefficients data from radiance -# diagnostic files. -# -# Author: Ed Safford Org: NP23 Date: 2012-02-02 -# -# Abstract: This script extracts bias correction coefficient related data from -# radiance diagnostic files (which are an output from GSI runs), -# storing the extracted data in small binary files. -# -# This script is a child script of exgdas_vrfyrad.sh.sms. The parent -# script opens and uncompresses the radiance diagnostic file and copies -# other supporting files into a temporary working directory. -# -# -# Script history log: -# 2012-02-02 Safford initial script -# -# Usage: radmon_verf_bcoef.sh PDATE -# -# Input script positional parameters: -# PDATE processing date -# yyyymmddcc format; required -# -# Imported Shell Variables: -# SUFFIX data source suffix -# defauls to opr -# MAKE_CTL switch to construct the meta-data control file -# defaults to 1 (on) -# MAKE_DATA switch to construct the binary data file -# defaults to 1 (on) -# EXECradmon executable directory -# defaults to current directory -# FIXradmon fixed data directory -# defaults to current directory -# RAD_AREA global or regional flag -# defaults to global -# TANKverf_rad data repository -# defaults to current directory -# SATYPE list of satellite/instrument sources -# defaults to none -# INISCRIPT preprocessing script -# defaults to none -# LOGSCRIPT log script -# defaults to none -# ERRSCRIPT error processing script -# defaults to 'eval [[ $err = 0 ]]' -# ENDSCRIPT postprocessing script -# defaults to none -# VERBOSE Verbose flag (YES or NO) -# defaults to NO -# LITTLE_ENDIAN flag for LE machine -# defaults to 0 (big endian) -# -# Exported Shell Variables: -# err Last return code -# -# Modules and files referenced: -# scripts : $INISCRIPT -# $LOGSCRIPT -# $ERRSCRIPT -# $ENDSCRIPT -# -# programs : $NCP -# $bcoef_exec -# -# fixed data : $biascr -# -# input data : $data_file -# -# output data: $bcoef_file -# $bcoef_ctl -# $bcoef_stdout -# -# Remarks: -# -# Condition codes -# 0 - no problem encountered -# >0 - some problem encountered -# -# Control variable resolution priority -# 1 Command line argument. -# 2 Environment variable. -# 3 Inline default. -# -# Attributes: -# Language: POSIX shell -# Machine: IBM SP -#################################################################### -# Command line arguments. -export PDATE=${1:-${PDATE:?}} - -# Directories -FIXradmon=${FIXradmon:-$(pwd)} -EXECradmon=${EXECradmon:-$(pwd)} -TANKverf_rad=${TANKverf_rad:-$(pwd)} - -# File names -INISCRIPT=${INISCRIPT:-} -LOGSCRIPT=${LOGSCRIPT:-} -ERRSCRIPT=${ERRSCRIPT:-} -ENDSCRIPT=${ENDSCRIPT:-} - -# Other variables -MAKE_CTL=${MAKE_CTL:-1} -MAKE_DATA=${MAKE_DATA:-1} -RAD_AREA=${RAD_AREA:-glb} -SATYPE=${SATYPE:-} -VERBOSE=${VERBOSE:-NO} -LITTLE_ENDIAN=${LITTLE_ENDIAN:-0} -USE_ANL=${USE_ANL:-0} -err=0 -#bcoef_exec=radmon_bcoef.${RAD_AREA} -bcoef_exec=radmon_bcoef - -if [[ "$VERBOSE" = "YES" ]]; then - set -ax - echo "$(date) executing $0 $* >&2" -fi -################################################################################ -# Preprocessing -$INISCRIPT -$LOGSCRIPT - -if [[ $USE_ANL -eq 1 ]]; then - gesanl="ges anl" -else - gesanl="ges" -fi - -#-------------------------------------------------------------------- -# Copy extraction program and supporting files to working directory - -$NCP $EXECradmon/${bcoef_exec} ./${bcoef_exec} -$NCP ${biascr} ./biascr.txt - -if [[ ! -s ./${bcoef_exec} || ! -s ./biascr.txt ]]; then - err=4 -else - - -#-------------------------------------------------------------------- -# Run program for given time - - iyy=`echo $PDATE | cut -c1-4` - imm=`echo $PDATE | cut -c5-6` - idd=`echo $PDATE | cut -c7-8` - ihh=`echo $PDATE | cut -c9-10` - - ctr=0 - fail=0 - - for type in ${SATYPE}; do - for dtype in ${gesanl}; do - ctr=`expr $ctr + 1` - - if [[ $dtype == "anl" ]]; then - data_file=${type}_anl.${PDATE}.ieee_d - bcoef_file=bcoef.${data_file} - ctl_file=${type}_anl.ctl - bcoef_ctl=bcoef.${ctl_file} - stdout_file=stdout.${type}_anl - bcoef_stdout=bcoef.${stdout_file} - else - data_file=${type}.${PDATE}.ieee_d - bcoef_file=bcoef.${data_file} - ctl_file=${type}.ctl - bcoef_ctl=bcoef.${ctl_file} - stdout_file=stdout.${type} - bcoef_stdout=bcoef.${stdout_file} - fi - - rm input - - nchanl=-999 - npredr=5 - -cat << EOF > input - &INPUT - satname='${type}', - npredr=${npredr}, - nchanl=${nchanl}, - iyy=${iyy}, - imm=${imm}, - idd=${idd}, - ihh=${ihh}, - idhh=-720, - incr=6, - suffix='${SUFFIX}', - imkctl=${MAKE_CTL}, - imkdata=${MAKE_DATA}, - gesanl='${dtype}', - little_endian=${LITTLE_ENDIAN}, - / -EOF - $TIMEX ./${bcoef_exec} < input > ${stdout_file} - if [[ $? -ne 0 ]]; then - fail=`expr $fail + 1` - fi - - -#------------------------------------------------------------------- -# move data, control, and stdout files to $TANKverf_rad and compress -# - - if [[ -s ${data_file} ]]; then - mv ${data_file} ${bcoef_file} - mv ${bcoef_file} $TANKverf_rad/. - ${COMPRESS} -f $TANKverf_rad/${bcoef_file} - fi - - if [[ -s ${ctl_file} ]]; then - mv ${ctl_file} ${bcoef_ctl} - mv ${bcoef_ctl} ${TANKverf_rad}/. - ${COMPRESS} -f ${TANKverf_rad}/${bcoef_ctl} - fi - - if [[ -s ${stdout_file} ]]; then - mv ${stdout_file} ${bcoef_stdout} - mv ${bcoef_stdout} ${TANKverf_rad}/. - ${COMPRESS} -f ${TANKverf_rad}/${bcoef_stdout} - fi - - done # dtype in $gesanl loop - done # type in $SATYPE loop - - if [[ $fail -eq $ctr || $fail -gt $ctr ]]; then - err=5 - fi -fi - - -################################################################################ -# Post processing -$ENDSCRIPT -set +x - -if [[ "$VERBOSE" = "YES" ]]; then - echo $(date) EXITING $0 with error code ${err} >&2 -fi - -exit ${err} diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/ush/radmon_verf_bcor.sh b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/ush/radmon_verf_bcor.sh deleted file mode 100755 index ce2b7a08b9..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/ush/radmon_verf_bcor.sh +++ /dev/null @@ -1,251 +0,0 @@ -#!/bin/ksh - -################################################################################ -#### UNIX Script Documentation Block -# . . -# Script name: radmon_verf_bcor.sh -# Script description: Extract bias correction data from radiance diagnostic -# files. -# -# Author: Ed Safford Org: NP23 Date: 2012-02-02 -# -# Abstract: This script extracts bias correction related data from radiance -# diagnostic files (which are an output from GSI runs), storing the -# extracted data in small binary files. -# -# This script is a child script of exgdas_vrfyrad.sh.sms. The parent -# script opens and uncompresses the radiance diagnostic file and copies -# other supporting files into a temporary working directory. -# -# -# Script history log: -# 2012-02-02 Safford initial script -# -# Usage: radmon_verf_bcor.sh PDATE -# -# Input script positional parameters: -# PDATE processing date -# yyyymmddcc format; required -# -# Imported Shell Variables: -# SUFFIX data source suffix -# defauls to opr -# MAKE_CTL switch to construct the meta-data control file -# defaults to 1 (on) -# MAKE_DATA switch to construct the binary data file -# defaults to 1 (on) -# EXECradmon executable directory -# defaults to current directory -# FIXradmon fixed data directory -# defaults to current directory -# RAD_AREA global or regional flag -# defaults to global -# TANKverf_rad data repository -# defaults to current directory -# SATYPE list of satellite/instrument sources -# defaults to none -# INISCRIPT preprocessing script -# defaults to none -# LOGSCRIPT log script -# defaults to none -# ERRSCRIPT error processing script -# defaults to 'eval [[ $err = 0 ]]' -# ENDSCRIPT postprocessing script -# defaults to none -# VERBOSE Verbose flag (YES or NO) -# defaults to NO -# LITTLE_ENDIAN flag for little endian machine -# defaults to 0 (big endian) -# -# Exported Shell Variables: -# err Last return code -# -# Modules and files referenced: -# scripts : $INISCRIPT -# $LOGSCRIPT -# $ERRSCRIPT -# $ENDSCRIPT -# -# programs : $NCP -# $bcor_exec -# -# fixed data : none -# -# input data : $data_file -# -# output data: $bcor_file -# $bcor_ctl -# $bcor_stdout -# -# Remarks: -# -# Condition codes -# 0 - no problem encountered -# >0 - some problem encountered -# -# Control variable resolution priority -# 1 Command line argument. -# 2 Environment variable. -# 3 Inline default. -# -# Attributes: -# Language: POSIX shell -# Machine: IBM SP -#################################################################### - -# Command line arguments. -export PDATE=${1:-${PDATE:?}} - -# Directories -FIXradmon=${FIXradmon:-$(pwd)} -EXECradmon=${EXECradmon:-$(pwd)} -TANKverf_rad=${TANKverf_rad:-$(pwd)} - -# File names -INISCRIPT=${INISCRIPT:-} -LOGSCRIPT=${LOGSCRIPT:-} -ERRSCRIPT=${ERRSCRIPT:-} -ENDSCRIPT=${ENDSCRIPT:-} - -# Other variables -MAKE_CTL=${MAKE_CTL:-1} -MAKE_DATA=${MAKE_DATA:-1} -RAD_AREA=${RAD_AREA:-glb} -SATYPE=${SATYPE:-} -VERBOSE=${VERBOSE:-NO} -LITTLE_ENDIAN=${LITTLE_ENDIAN:-0} -USE_ANL=${USE_ANL:-0} -#bcor_exec=radmon_bcor.${RAD_AREA} -bcor_exec=radmon_bcor -err=0 - -if [[ "$VERBOSE" = "YES" ]]; then - set -ax - echo "$(date) executing $0 $* >&2" -fi - -################################################################################ -# Preprocessing -$INISCRIPT -$LOGSCRIPT - -if [[ $USE_ANL -eq 1 ]]; then - gesanl="ges anl" -else - gesanl="ges" -fi - - -#-------------------------------------------------------------------- -# Copy extraction program to working directory - -$NCP ${EXECradmon}/${bcor_exec} ./${bcor_exec} - -if [[ ! -s ./${bcor_exec} ]]; then - err=6 -else - - -#-------------------------------------------------------------------- -# Run program for given time - - iyy=`echo $PDATE | cut -c1-4` - imm=`echo $PDATE | cut -c5-6` - idd=`echo $PDATE | cut -c7-8` - ihh=`echo $PDATE | cut -c9-10` - - ctr=0 - fail=0 - - for type in ${SATYPE}; do - - for dtype in ${gesanl}; do - - ctr=`expr $ctr + 1` - - if [[ $dtype == "anl" ]]; then - data_file=${type}_anl.${PDATE}.ieee_d - bcor_file=bcor.${data_file} - ctl_file=${type}_anl.ctl - bcor_ctl=bcor.${ctl_file} - stdout_file=stdout.${type}_anl - bcor_stdout=bcor.${stdout_file} - else - data_file=${type}.${PDATE}.ieee_d - bcor_file=bcor.${data_file} - ctl_file=${type}.ctl - bcor_ctl=bcor.${ctl_file} - stdout_file=stdout.${type} - bcor_stdout=bcor.${stdout_file} - fi - rm input - - nchanl=-999 - -cat << EOF > input - &INPUT - satname='${type}', - iyy=${iyy}, - imm=${imm}, - idd=${idd}, - ihh=${ihh}, - idhh=-720, - incr=6, - nchanl=${nchanl}, - suffix='${SUFFIX}', - imkctl=${MAKE_CTL}, - imkdata=${MAKE_DATA}, - gesanl='${dtype}', - little_endian=${LITTLE_ENDIAN}, - rad_area='${RAD_AREA}', - / -EOF - $TIMEX ./${bcor_exec} < input > stdout.$type - ./${bcor_exec} < input > stdout.$type - if [[ $? -ne 0 ]]; then - fail=`expr $fail + 1` - fi - - -#------------------------------------------------------------------- -# move data, control, and stdout files to $TANKverf_rad and compress -# - - if [[ -s ${data_file} ]]; then - mv ${data_file} ${bcor_file} - mv ${bcor_file} $TANKverf_rad/. - ${COMPRESS} -f $TANKverf_rad/${bcor_file} - fi - - if [[ -s ${ctl_file} ]]; then - mv ${ctl_file} ${bcor_ctl} - mv ${bcor_ctl} ${TANKverf_rad}/. - ${COMPRESS} -f ${TANKverf_rad}/${bcor_ctl} - fi - - if [[ -s ${stdout_file} ]]; then - mv ${stdout_file} ${bcor_stdout} - mv ${bcor_stdout} ${TANKverf_rad}/. - ${COMPRESS} -f ${TANKverf_rad}/${bcor_stdout} - fi - - done # dtype in $gesanl loop - done # type in $SATYPE loop - - - if [[ $fail -eq $ctr || $fail -gt $ctr ]]; then - err=7 - fi -fi - -################################################################################ -# Post processing -$ENDSCRIPT -set +x - -if [[ "$VERBOSE" = "YES" ]]; then - echo $(date) EXITING $0 error code ${err} >&2 -fi - -exit ${err} - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/ush/radmon_verf_time.sh b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/ush/radmon_verf_time.sh deleted file mode 100755 index 5006e2c034..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/ush/radmon_verf_time.sh +++ /dev/null @@ -1,520 +0,0 @@ -#!/bin/ksh - -################################################################################ -#### UNIX Script Documentation Block -# . . -# Script name: radmon_verf_time.sh -# Script description: Extract time data from radiance diagnostic files, -# perform data integrity checks. -# -# Author: Ed Safford Org: NP23 Date: 2012-02-02 -# -# Abstract: This script extracts time related data from radiance diagnostic -# files (which are an output from GSI runs), storing the extracted -# data in small binary files. Data integrity checks are performed -# on the data and mail messages are sent if potential errors are -# detected. -# -# This script is a child script of exgdas_vrfyrad.sh.sms. The parent -# script opens and uncompresses the radiance diagnostic file and copies -# other supporting files into a temporary working directory. -# -# -# Script history log: -# 2012-02-02 Safford initial script -# -# Usage: radmon_verf_time.sh PDATE -# -# Input script positional parameters: -# PDATE processing date -# yyyymmddcc format; required -# -# Imported Shell Variables: -# DO_DIAG_RPT switch to build the diagnostic report -# defaults to 1 (on) -# DO_DATA_RPT switch to build the data report -# defaults to 1 (on) -# SUFFIX data source suffix -# defauls to opr -# MAKE_CTL switch to construct the meta-data control file -# defaults to 1 (on) -# MAKE_DATA switch to construct the binary data file -# defaults to 1 (on) -# EXECradmon executable directory -# defaults to current directory -# FIXradmon fixed data directory -# defaults to current directory -# RAD_AREA global or regional flag -# defaults to global -# TANKverf_rad data repository -# defaults to current directory -# SATYPE list of satellite/instrument sources -# defaults to none -# MAIL_TO email recipients -# defaults to none -# MAIL_CC email cc recipients -# defaults to none -# INISCRIPT preprocessing script -# defaults to none -# LOGSCRIPT log script -# defaults to none -# ERRSCRIPT error processing script -# defaults to 'eval [[ $err = 0 ]]' -# ENDSCRIPT postprocessing script -# defaults to none -# VERBOSE Verbose flag (YES or NO) -# defaults to NO -# LITTLE_ENDIAN flag for little endian machine -# defaults to 0 (big endian) -# -# Exported Shell Variables: -# err Last return code -# -# Modules and files referenced: -# scripts : $INISCRIPT -# $LOGSCRIPT -# $ERRSCRIPT -# $ENDSCRIPT -# -# programs : $NCP -# $time_exec -# -# fixed data : gdas_radmon_base.tar -# -# input data : $data_file -# -# output data: $time_file -# $time_ctl -# $time_stdout -# $bad_pen -# $bad_chan -# $report -# $diag_report -# -# -# Remarks: -# -# Condition codes -# 0 - no problem encountered -# >0 - some problem encountered -# -# Control variable resolution priority -# 1 Command line argument. -# 2 Environment variable. -# 3 Inline default. -# -# Attributes: -# Language: POSIX shell -# Machine: IBM SP -# -#################################################################### - -# Command line arguments. -export PDATE=${1:-${PDATE:?}} - -# Directories -FIXradmon=${FIXradmon:-$(pwd)} -EXECradmon=${EXECradmon:-$(pwd)} -TANKverf_rad=${TANKverf_rad:-$(pwd)} - -# File names -INISCRIPT=${INISCRIPT:-} -LOGSCRIPT=${LOGSCRIPT:-} -ERRSCRIPT=${ERRSCRIPT:-} -ENDSCRIPT=${ENDSCRIPT:-} - -radmon_err_rpt=${radmon_err_rpt:-${USHradmon}/radmon_err_rpt.sh} -base_file=${base_file:-$FIXradmon/gdas_radmon_base.tar} -report=report.txt -disclaimer=disclaimer.txt -region=region.txt -diag_report=diag_report.txt -diag_hdr=diag_hdr.txt -diag=diag.txt -obs_err=obs_err.txt -obs_hdr=obs_hdr.txt -pen_err=pen_err.txt -pen_hdr=pen_hdr.txt -chan_err=chan_err.txt -chan_hdr=chan_hdr.txt - -# Other variables -DO_DIAG_RPT=${DO_DIAG_RPT:-1} -DO_DATA_RPT=${DO_DATA_RPT:-1} -SUFFIX=${SUFFIX:-opr} -MAKE_CTL=${MAKE_CTL:-1} -MAKE_DATA=${MAKE_DATA:-1} -RAD_AREA=${RAD_AREA:-glb} -SATYPE=${SATYPE:-} -MAIL_TO=${MAIL_TO:-} -MAIL_CC=${MAIL_CC:-} -VERBOSE=${VERBOSE:-NO} -LITTLE_ENDIAN=${LITTLE_ENDIAN:-0} -time_exec=radmon_time -USE_ANL=${USE_ANL:-0} -err=0 - -if [[ "$VERBOSE" = "YES" ]]; then - set -ax - echo "$(date) executing $0 $* >&2" -fi - -################################################################################ -# Preprocessing -$INISCRIPT -$LOGSCRIPT - -if [[ $USE_ANL -eq 1 ]]; then - gesanl="ges anl" -else - gesanl="ges" -fi - -iyy=`echo $PDATE | cut -c1-4` -imm=`echo $PDATE | cut -c5-6` -idd=`echo $PDATE | cut -c7-8` -ihh=`echo $PDATE | cut -c9-10` -cyc=$ihh -CYCLE=$cyc - -#-------------------------------------------------------------------- -# Copy extraction program and base files to working directory -#------------------------------------------------------------------- -$NCP ${EXECradmon}/${time_exec} ./ -if [[ ! -s ./${time_exec} ]]; then - err=8 -fi - -if [[ $DO_DATA_RPT -eq 1 ]]; then - $NCP ${base_file}* ./ - if [[ -e ${base_file}.${Z} ]]; then - ${UNCOMPRESS} ${base_file}.${Z} - fi - tar -xf ${base_file} - if [[ ! -s ${base_file} ]]; then - err=9 - fi -fi - -if [[ $err -eq 0 ]]; then - ctr=0 - fail=0 - -#-------------------------------------------------------------------- -# Loop over each entry in SATYPE -#-------------------------------------------------------------------- - for type in ${SATYPE}; do - ctr=`expr $ctr + 1` - - for dtype in ${gesanl}; do - rm input - - if [[ $dtype == "anl" ]]; then - data_file=${type}_anl.${PDATE}.ieee_d - time_file=time.${data_file} - ctl_file=${type}_anl.ctl - time_ctl=time.${ctl_file} - stdout_file=stdout.${type}_anl - time_stdout=time.${stdout_file} - else - data_file=${type}.${PDATE}.ieee_d - time_file=time.${data_file} - ctl_file=${type}.ctl - time_ctl=time.${ctl_file} - stdout_file=stdout.${type} - time_stdout=time.${stdout_file} - fi -#-------------------------------------------------------------------- -# Run program for given satellite/instrument -#-------------------------------------------------------------------- - nchanl=-999 -cat << EOF > input - &INPUT - satname='${type}', - iyy=${iyy}, - imm=${imm}, - idd=${idd}, - ihh=${ihh}, - idhh=-720 - incr=6 - nchanl=${nchanl}, - suffix='${SUFFIX}', - imkctl=${MAKE_CTL}, - imkdata=${MAKE_DATA}, - gesanl='${dtype}', - little_endian=${LITTLE_ENDIAN}, - rad_area='${RAD_AREA}', - / -EOF - $TIMEX ./${time_exec} < input > ${stdout_file} - if [[ $? -ne 0 ]]; then - fail=`expr $fail + 1` - fi - -#------------------------------------------------------------------- -# move data, control, and stdout files to $TANKverf_rad and compress -#------------------------------------------------------------------- - - if [[ -s ${data_file} ]]; then - mv ${data_file} ${time_file} - mv ${time_file} $TANKverf_rad/. - ${COMPRESS} -f $TANKverf_rad/${time_file} - fi - - if [[ -s ${ctl_file} ]]; then - $NCP ${ctl_file} ${time_ctl} - $NCP ${time_ctl} ${TANKverf_rad}/. - ${COMPRESS} -f ${TANKverf_rad}/${time_ctl} - fi - - if [[ -s ${stdout_file} ]]; then - $NCP ${stdout_file} ${time_stdout} - mv ${time_stdout} ${TANKverf_rad}/. - ${COMPRESS} -f ${TANKverf_rad}/${time_stdout} - fi - - done - done - if [[ $fail -eq $ctr || $fail -gt $ctr ]]; then - err=10 - fi - -fi - - - -#################################################################### -#------------------------------------------------------------------- -# Begin error analysis and reporting -#------------------------------------------------------------------- -#################################################################### - -if [[ $DO_DIAG_RPT -eq 1 ]]; then - -# build the disclaimer and region files - - cat << EOF > ${disclaimer} - - -*********************** WARNING *************************** -THIS IS AN AUTOMATED EMAIL. REPLIES TO SENDER WILL NOT BE -RECEIVED. PLEASE DIRECT REPLIES TO edward.safford@noaa.gov -*********************** WARNING *************************** -EOF - - cat << EOF > ${region} - Region Definitions: - - 1 Global (90S-90N, 0-360E) -EOF - - -#------------------------------------------------------------------- -# Check stdout file for any reported problem(s) reading the -# diagnostic file by calling ck_stdout.sh -# - ${USHradmon}/radmon_ck_stdout.sh ${diag} - - if [[ -s ${diag} ]]; then - cat << EOF > ${diag_hdr} - -Problem Reading Diagnostic File - - $PDATE - - Problems were encountered reading the diagnostic file for - the following sources: - -EOF - - cat ${diag_hdr} >> ${diag_report} - cat ${diag} >> ${diag_report} - if [[ $USE_MAIL -eq 1 ]]; then - cat ${disclaimer} >> ${diag_report} - else - echo End Problem Reading Diagnostic File >> ${diag_report} - echo >> ${diag_report} - fi - rm ${diag} ${diag_hdr} - fi - -#------------------------------------------------------------------- -# mail error notifications or dump to log file - - if [[ -s ${diag_report} ]]; then - lines=`wc -l <${diag_report}` - if [[ $lines -gt 1 ]]; then - - if [[ $USE_MAIL -eq 1 ]]; then - if [[ $MAIL_CC == "" ]]; then - /bin/mail -v -s diagnostic_error_report ${MAIL_TO}< ${diag_report} - else - /bin/mail -v -s diagnostic_error_report -c "${MAIL_CC}" ${MAIL_TO}< ${diag_report} - fi - else - - cat ${diag_report} - fi - fi - fi - -fi - - -#------------------------------------------------------------------- -# Assemble the bad penalty/channel report - -if [[ $DO_DATA_RPT -eq 1 ]]; then - - #---------------------------------------------------------------- - # Identify bad_pen and bad_chan files for this cycle and - # previous cycle - - bad_pen=bad_pen.${PDATE} - bad_chan=bad_chan.${PDATE} - - qdate=`$NDATE -06 $PDATE` - pday=`echo $qdate | cut -c1-8` - - prev_bad_pen=bad_pen.${qdate} - prev_bad_chan=bad_chan.${qdate} - - do_rpt=0 - if [[ -s $bad_pen && -s ${TANKverf}/radmon.${pday}/$prev_bad_pen ]]; then - do_rpt=1 - fi - if [[ -s $bad_chan && -s ${TANKverf}/radmon.${pday}/$prev_bad_chan ]]; then - do_rpt=1 - fi - -#-------------------------------------------------------------------- -# Remove extra spaces in new bad_pen file -# - gawk '{$1=$1}1' $bad_pen > tmp.bad_pen - mv -f tmp.bad_pen $bad_pen - - - if [[ $do_rpt -eq 1 ]]; then -#------------------------------------------------------------------- -# copy previous cycle's bad_chan and bad_pen files -# - $NCP ${TANKverf}/radmon.${pday}/${prev_bad_pen} ./ - $NCP ${TANKverf}/radmon.${pday}/${prev_bad_chan} ./ - -#------------------------------------------------------------------- -# run radmon_err_rpt.sh for chan and pen to create the error files -# -# ${USHradmon}/radmon_err_rpt.sh ${prev_bad_pen} ${bad_pen} pen ${qdate} ${PDATE} ${diag_report} ${pen_err} - ${radmon_err_rpt} ${prev_bad_pen} ${bad_pen} pen ${qdate} ${PDATE} ${diag_report} ${pen_err} - - -#------------------------------------------------------------------- -# put together the unified error report with any obs, chan, and -# penalty problems and mail it - - if [[ -s ${obs_err} || -s ${pen_err} || -s ${chan_err} ]]; then - - echo DOING ERROR REPORTING - - echo "Begin Cycle Data Integrity Report" > $report - - cat << EOF >> $report -Cycle Data Integrity Report - $PDATE - -EOF - - cat ${region} >> $report - - if [[ -s ${chan_err} ]]; then - - echo OUTPUTING CHAN_ERR - - cat << EOF > ${chan_hdr} - - The following channels report 0 observational counts over the past two cycles: - - Satellite/Instrument Channel - ==================== ======= - -EOF - - cat ${chan_hdr} >> $report - cat ${chan_err} >> $report - - fi - - if [[ -s ${pen_err} ]]; then - - cat << EOF > ${pen_hdr} - - - Penalty values outside of the established normal range were found - for these sensor/channel/regions in the past two cycles: - - Questionable Penalty Values - ============ ======= ====== Cycle Penalty Bound - ----- ------- ----- -EOF - cat ${pen_hdr} >> $report - cat ${pen_err} >> $report - rm ${pen_hdr} ${pen_err} - fi - - if [[ $USE_MAIL -eq 1 ]]; then - cat ${disclaimer} >> $report - else - echo End Cycle Data Integrity Report >> $report - echo >> $report - fi - fi - -#------------------------------------------------------------------- -# mail error notifications or dump to log file -# - if [[ -s ${report} ]]; then - lines=`wc -l <${report}` - if [[ $lines -gt 2 ]]; then - if [[ $USE_MAIL -eq 1 ]]; then - if [[ $MAIL_CC == "" ]]; then - /bin/mail -v -s cycle_report ${MAIL_TO}< ${report} - else - /bin/mail -v -s cycle_report -c "${MAIL_CC}" ${MAIL_TO}< ${report} - fi - else - cat ${report} - fi - fi - fi - - fi - -#------------------------------------------------------------------- -# copy new bad_pen and bad_chan files to $TANKverf_rad - - if [[ -s ${bad_chan} ]]; then - $NCP ${bad_chan} ${TANKverf_rad}/. - fi - - if [[ -s ${bad_pen} ]]; then - $NCP ${bad_pen} ${TANKverf_rad}/. - fi - -fi - -################################################################################ -#------------------------------------------------------------------- -# end error reporting section -#------------------------------------------------------------------- -################################################################################ - -################################################################################ -# Post processing -$ENDSCRIPT -set +x - -if [[ "$VERBOSE" = "YES" ]]; then - echo $(date) EXITING $0 error code ${err} >&2 -fi - -exit ${err} diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radang.fd/Makefile.conf b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radang.fd/Makefile.conf deleted file mode 100755 index 9cba163a3e..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radang.fd/Makefile.conf +++ /dev/null @@ -1,26 +0,0 @@ -# This config file contains the compile options for compilation -# of the RadMon code on WCOSS. - -# ---------------------------------- -# Redefine variables for WCOSS -# ---------------------------------- - CORELIB = /nwprod/lib - W3NCO_VER = v2.0.6 - W3NCO_LIB4=$(CORELIB)/w3nco/$(W3NCO_VER)/libw3nco_$(W3NCO_VER)_4.a - -# ---------------------------- -# Fortran compiler and options -# ---------------------------- - - CF = ifort - FC = $(CF) - - FFLAGS = -O3 -fp-model strict -D_REAL8_ -traceback -convert big_endian -assume byterecl - -# ------------------ -# Linker and options -# ------------------ - - LIBS = $(W3NCO_LIB4) - LDFLAGS = - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radang.fd/angle_bias.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radang.fd/angle_bias.f90 deleted file mode 100755 index de2175a3d3..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radang.fd/angle_bias.f90 +++ /dev/null @@ -1,698 +0,0 @@ -program angle - use read_diag - - implicit none - integer ntype,mregion,mstep,surf_nregion,max_surf_region - parameter (ntype=35,mregion=25,mstep=100,max_surf_region=5) - integer iglobal, iland, iwater, isnowice, imixed - parameter (iglobal=1, iland=2, iwater=3, isnowice=4, imixed=5) - - character(10),dimension(ntype):: ftype - character(8) stid - character(20) satname,stringd - character(10) satype,dplat - character(20) dum,satsis,satscan_sis - character(40) string,diag_rad,data_file,dfile,ctl_file - character(40),dimension(max_surf_region):: surf_region - character(8) date,suffix,cycle - character(len=1024) :: command - - integer luname,lungrd,lndiag,lunang,lunctl - integer iyy,imm,idd,ihh,idhh,incr,iread,iflag,ipos - integer n_chan,j,i,k,ii,nsub,jiter,jj - integer,dimension(mregion):: jsub - integer,allocatable,dimension(:):: io_chan,nu_chan - integer imatch, npred_radiag, angord - - real start,step - integer nstep,iscan - character(1) cflg - real rang,pen - real weight,rlat,rlon,rmiss,obs,biascor,obsges,obsgesnbc,rterm,rread - real,dimension(2):: cor_tot,nbc_omg,bc_omg - real,dimension(2):: cor_fixang,cor_lapse,cor_lapse2,cor_const,cor_scangl,cor_clw - real,dimension(2):: cor_cos,cor_sin,cor_emiss - real,dimension(2):: cor_ordang4,cor_ordang3,cor_ordang2,cor_ordang1 - real,dimension(max_surf_region):: surf_rlatmin,surf_rlatmax,surf_rlonmin,surf_rlonmax - - real,allocatable,dimension(:):: wavenumbr,error,use,frequency - real,allocatable,dimension(:,:):: timang - real,allocatable,dimension(:,:,:):: count,penalty - real,allocatable,dimension(:,:,:,:):: tot_cor,omg_nbc,omg_bc - real,allocatable,dimension(:,:,:,:):: fixang_cor,lapse_cor,lapse2_cor - real,allocatable,dimension(:,:,:,:):: const_cor,scangl_cor,clw_cor - real,allocatable,dimension(:,:,:,:):: cos_cor,sin_cor,emiss_cor - real,allocatable,dimension(:,:,:,:):: ordang4_cor,ordang3_cor,ordang2_cor,ordang1_cor - -! Variables for reading satellite data - type(diag_header_fix_list ) :: header_fix - type(diag_header_chan_list),allocatable :: header_chan(:) - type(diag_data_name_list ) :: data_name - type(diag_data_fix_list ) :: data_fix - type(diag_data_chan_list ),allocatable :: data_chan(:) - type(diag_data_extra_list) ,allocatable :: data_extra(:,:) - - integer nsnow, nland, nwater, nice, nmixed, ntotal - integer nnsnow, nnland, nnwater, nnmixed, nntotal - -! Namelist with defaults - logical :: retrieval = .false. - integer :: nchanl = 19 - integer :: imkctl = 1 - integer :: imkdata = 1 - character(3) :: gesanl = 'ges' - integer :: little_endian = 1 - character(3) :: rad_area = 'glb' - namelist /input/ satname,iyy,imm,idd,ihh,idhh,incr,nchanl,& - suffix,imkctl,imkdata,retrieval,gesanl,little_endian,rad_area - - data luname,lungrd,lunctl,lndiag,iscan / 5, 51, 52, 21, 31 / - data lunang / 22 / - data rmiss /-999./ - data stringd / '.%y4%m2%d2%h2' / - data ftype / 'satang', 'count', 'penalty', & - 'omgnbc', 'total', 'omgbc', & - 'fixang', 'lapse', 'lapse2', & - 'const', 'scangl', 'clw', & - 'cos','sin','emiss','ordang4',& - 'ordang3','ordang2','ordang1',& - 'omgnbc_2', 'total_2', 'omgbc_2', & - 'fixang_2', 'lapse_2', 'lapse2_2', & - 'const_2', 'scangl_2', 'clw_2', & - 'cos_2', 'sin_2', 'emiss_2', & - 'ordang4_2','ordang3_2','ordang2_2', & - 'ordang1_2' / - data surf_region / 'global', 'land', 'water', 'ice/snow', 'mixed'/ - data surf_rlonmin / -180., -180., -180., -180., -180./ - data surf_rlonmax / 180., 180., 180., 180., 180./ - data surf_rlatmin / -90., -90., -90., -90., -90./ - data surf_rlatmax / 90., 90., 90., 90., 90./ -!************************************************************************ -! -! Initialize variables - iread=0 - npred_radiag = 12 - -! Read namelist input - read(luname,input) - write(6,input) - write(6,*)' ' - write(6,*)'gesanl = ', gesanl - write(6,*)'rad_area = ', rad_area - - surf_nregion = 5 - if ( trim(rad_area) == 'rgn' ) then - surf_nregion = 1 - endif - - if ( trim(gesanl) == 'anl' ) then - ftype(4) = 'omanbc' - ftype(6) = 'omabc' - ftype(13) = 'omanbc_2' - ftype(15) = 'omabc_2' - endif - -! Ensure number of requested regions does not exceed specified upper limit - if (surf_nregion>mregion) then - write(6,*)'***ERROR*** too many regions specified' - write(6,*)' maximum allowed: mregion=',mregion - write(6,*)' user requested: surf_nregion=',surf_nregion - call errexit(91) - endif - - date = stringd(2:9) - cycle = stringd(10:11) - -! Create filenames for diagnostic input, binary output files - write(stringd,100) iyy,imm,idd,ihh -100 format('.',i4.4,3i2.2) - - if ( trim(gesanl) == 'ges' ) then - diag_rad = trim(satname) - data_file= trim(satname) // trim(stringd) // '.ieee_d' - ctl_file = trim(satname) // '.ctl' - else - diag_rad = trim(satname) // '_anl' - data_file= trim(satname) // '_anl' // trim(stringd) // '.ieee_d' - ctl_file = trim(satname) // '_anl.ctl' - endif - - - write(6,*)'diag_rad =',diag_rad - write(6,*)'data_file=',data_file - write(6,*)'suffix =',suffix - write(6,*)'ctl_file =',ctl_file - write(6,*)'imkctl =',imkctl - write(6,*)'imkdata =',imkdata - write(6,*)'little_endian =', little_endian - - -! Open unit to diagnostic file. Read portion of -! header to see if file exists - open(lndiag,file=diag_rad,form='unformatted') - read(lndiag,err=900,end=900) dum - rewind lndiag - -! File exists. Read header - write(6,*)'call read_diag_header' - call read_radiag_header( lndiag, npred_radiag, retrieval,& - header_fix, header_chan, data_name, iflag ) -! -! If there was an error reading the header try to convert from little endian -! and re-read. If that fails exit. -! - if( iflag/=0 ) then - write(6,*)'***ERROR*** problem reading diag file header, iflag=',iflag - call errexit(91) - endif - - -! Extract observation type, satellite id, and number of channels - satype = header_fix%obstype - satsis = header_fix%isis - dplat = header_fix%id - n_chan = header_fix%nchan - jiter = header_fix%jiter - angord = header_fix%angord - - write(6,*)'satype,satid,n_chan,angord=',satype,' ',dplat,' ',n_chan,' ',angord - - string = trim(satype) //'_'// trim(dplat) - write(6,*)'string,satname=',string,' ',satname - if ( trim(string) /= trim(satname) ) then - write(6,*)'***ERROR*** inconsistent instrument types' - write(6,*)' satname,string =',satname,' ',string - call errexit(92) - endif - -! open scan info file compiled in the source directory - open(iscan,file='scaninfo.txt',form='formatted') - do - read(iscan,1000,IOSTAT=iflag) cflg,satscan_sis,start,step,nstep - write(6,*) 'satscan_sis,start,step,nstep=',satscan_sis,start,step,nstep - if( iflag /= 0 ) exit - if(trim(satname) == trim(satscan_sis)) exit - enddo -!1000 format(a1,a20,2f10.2,i10) -1000 format(a1,a20,2f10.3,i10) - - write(6,*) 'satscan_sis,start,step,nstep=',satscan_sis,start,step,nstep - - -! Allocate arrays to hold observational information - write(6,*)' ' - write(6,*)'allocate arrays' - allocate (io_chan(n_chan), nu_chan(n_chan), wavenumbr(n_chan), & - error(n_chan), use(n_chan), frequency(n_chan)) - allocate (timang(mstep,n_chan)) - allocate (tot_cor(mstep,n_chan,surf_nregion,2), & - omg_nbc(mstep,n_chan,surf_nregion,2), & - omg_bc(mstep,n_chan,surf_nregion,2), & - count(mstep,n_chan,surf_nregion), & - penalty(mstep,n_chan,surf_nregion),& - fixang_cor(mstep,n_chan,surf_nregion,2),lapse_cor(mstep,n_chan,surf_nregion,2),& - lapse2_cor(mstep,n_chan,surf_nregion,2),clw_cor(mstep,n_chan,surf_nregion,2),& - const_cor(mstep,n_chan,surf_nregion,2), scangl_cor(mstep,n_chan,surf_nregion,2),& - cos_cor(mstep,n_chan,surf_nregion,2), sin_cor(mstep,n_chan,surf_nregion,2),& - emiss_cor(mstep,n_chan,surf_nregion,2), ordang4_cor(mstep,n_chan,surf_nregion,2),& - ordang3_cor(mstep,n_chan,surf_nregion,2), ordang2_cor(mstep,n_chan,surf_nregion,2),& - ordang1_cor(mstep,n_chan,surf_nregion,2)) - -! Zero accumulator arrays - do ii=1,2 - do k=1,surf_nregion - do j=1,n_chan - do i=1,mstep - if (ii==1) then - count(i,j,k) = 0.0 - penalty(i,j,k) = 0.0 - endif - tot_cor(i,j,k,ii) = 0.0 - omg_nbc(i,j,k,ii) = 0.0 - omg_bc(i,j,k,ii) = 0.0 - fixang_cor(i,j,k,ii) = 0.0 - lapse_cor(i,j,k,ii) = 0.0 - lapse2_cor(i,j,k,ii) = 0.0 - clw_cor(i,j,k,ii) = 0.0 - const_cor(i,j,k,ii) = 0.0 - scangl_cor(i,j,k,ii) = 0.0 - cos_cor(i,j,k,ii) = 0.0 - sin_cor(i,j,k,ii) = 0.0 - emiss_cor(i,j,k,ii) = 0.0 - ordang4_cor(i,j,k,ii) = 0.0 - ordang3_cor(i,j,k,ii) = 0.0 - ordang2_cor(i,j,k,ii) = 0.0 - ordang1_cor(i,j,k,ii) = 0.0 - end do - end do - end do - end do - -! Note: timang has been deprecated and the satang file is no longer -! used. See the plot_angle_sep.*.gs scripts for how the timang -! values are derived from the diagnostic file contents. The -! timang variable has been kept to avoid making a change in -! ieee_d file format. - do j=1,n_chan - do i=1,mstep - timang(i,j) = rmiss - end do - end do - -! Extract satinfo relative index - do j=1,n_chan - nu_chan(j) = real( header_chan(j)%nuchan, 4 ) - io_chan(j) = real( header_chan(j)%iochan, 4 ) - wavenumbr(j) = real( header_chan(j)%wave, 4 ) - error(j) = real( header_chan(j)%varch, 4) - use(j) = real( header_chan(j)%iuse, 4 ) - frequency(j) = real( header_chan(j)%freq, 4) -! print *,nu_chan(j),io_chan(j),wavenumbr(j),error(j),use(j),frequency(j) - end do - - - - write(6,*)'beginning read entries in diag file' - nwater = 0; nnwater=0 - nice = 0 - nsnow = 0; nnsnow=0 - nland = 0; nnland=0 - nmixed = 0; nnmixed=0; - ntotal = 0; - -! Loop to read entries in diagnostic file - iflag = 0 - loopd: do while (iflag == 0) - -! Read a record. If read flag, iflag does not equal zero, exit loopd - call read_radiag_data( lndiag, header_fix, retrieval, data_fix, data_chan,& - data_extra, iflag ) - if( iflag /= 0 ) exit loopd - iread=iread+1 - -! Extract observation location, scan position, and mpi weight. -! Convert (0-360) lon to (-180,180) - rlat = data_fix%lat - rlon = data_fix%lon - ipos = data_fix%senscn_pos !! sensor scan position(integer) - rang = data_fix%satzen_ang !! satellite zenith angle (deg) - - ntotal = ntotal + 1 - jsub(1)=iglobal - - if ( surf_nregion > 1 ) then - if ( data_fix%water_frac > 0.99 ) then - nwater = nwater + 1 - else if ( data_fix%land_frac > 0.99 ) then - nland = nland + 1 - else if ( data_fix%snow_frac > 0.99 ) then - nsnow = nsnow + 1 - else if ( data_fix%ice_frac > 0.99 ) then - nice = nice + 1 - else - nmixed = nmixed + 1 - end if - - - if (rlon>180.) rlon = rlon - 360. - if (ipos<1) then - write(6,*)'scan position less than 1. ipos=',ipos - ipos=1 - endif - if (ipos>nstep) then - write(6,*)'scan position > nstep. ipos,nstep,',& - ipos,nstep - ipos=nstep - endif - rread = rread + 1.0 - - -! Detemine which subdomains the observation falls into -! These are now based on surface type, not geography. All -! obs match global (surf_region 1). -! - ii=0; jsub=0; - jsub(1)=iglobal - if ( data_fix%land_frac > 0.99 ) then - jsub(2)=iland - nsub=2 - nnland=nnland+1 - else if ( data_fix%water_frac > 0.99 ) then - jsub(2)=iwater - nsub=2 - nnwater=nnwater+1 - else if (( data_fix%snow_frac > 0.99 ) .OR. ( data_fix%ice_frac > 0.99 )) then - jsub(2)=isnowice - nsub=2 - nnsnow=nnsnow+1 - else - jsub(2)=imixed - nsub=2 - nnmixed=nnmixed+1 - write(6,*)'data_fix%land_frac,water,snow,ice = ',data_fix%land_frac, data_fix%water_frac, data_fix%snow_frac, data_fix%ice_frac - end if - end if - - -! Channel loop - do j = 1, n_chan - -! If observation was assimilated, accumulate sums for appropriate -! scan angle and regions - cor_cos = 0.0 - cor_sin = 0.0 - cor_emiss = 0.0 - cor_ordang4 = 0.0 - cor_ordang3 = 0.0 - cor_ordang2 = 0.0 - cor_ordang1 = 0.0 - - if (data_chan(j)%errinv > 1.e-6) then - pen = data_chan(j)%errinv*(data_chan(j)%omgbc)**2 - cor_tot(1) = (data_chan(j)%omgnbc - data_chan(j)%omgbc) - nbc_omg(1) = - (data_chan(j)%omgnbc) - bc_omg(1) = - (data_chan(j)%omgbc) - - - if ( trim(rad_area) == 'rgn' ) then - write(6,*) 'chan,pen,cor_tot(1),nbc_omg(1),bc_omb(1) = ', j,pen,cor_tot(1),nbc_omg(1),bc_omg(1) - endif - - cor_tot(2) = (data_chan(j)%omgnbc - data_chan(j)%omgbc)**2 - nbc_omg(2) = (data_chan(j)%omgnbc)**2 - bc_omg(2) = (data_chan(j)%omgbc)**2 - - cor_fixang(1) = data_chan(j)%bifix(angord+1) - cor_lapse(1) = data_chan(j)%bilap - cor_lapse2(1) = data_chan(j)%bilap2 - cor_const(1) = data_chan(j)%bicons - cor_scangl(1) = data_chan(j)%biang - cor_clw(1) = data_chan(j)%biclw - cor_cos(1) = data_chan(j)%bicos - cor_sin(1) = data_chan(j)%bisin - cor_emiss(1) = data_chan(j)%biemis - if (angord >= 4 ) then - cor_ordang4(1) = data_chan(j)%bifix(1) - cor_ordang3(1) = data_chan(j)%bifix(2) - cor_ordang2(1) = data_chan(j)%bifix(3) - cor_ordang1(1) = data_chan(j)%bifix(4) - else - cor_ordang4(1) = 0.0 - cor_ordang3(1) = 0.0 - cor_ordang2(1) = 0.0 - cor_ordang1(1) = 0.0 - endif - - cor_fixang(2) = (data_chan(j)%bifix(angord+1))**2 - cor_lapse(2) = (data_chan(j)%bilap)**2 - cor_lapse2(2) = (data_chan(j)%bilap2)**2 - cor_const(2) = (data_chan(j)%bicons)**2 - cor_scangl(2) = (data_chan(j)%biang)**2 - cor_clw(2) = (data_chan(j)%biclw)**2 - cor_cos(2) = (data_chan(j)%bicos)**2 - cor_sin(2) = (data_chan(j)%bisin)**2 - cor_emiss(2) = (data_chan(j)%biemis)**2 - if (angord >= 4 ) then - cor_ordang4(2) = (data_chan(j)%bifix(1))**2 - cor_ordang3(2) = (data_chan(j)%bifix(2))**2 - cor_ordang2(2) = (data_chan(j)%bifix(3))**2 - cor_ordang1(2) = (data_chan(j)%bifix(4))**2 - else - cor_ordang4(2) = 0.0 - cor_ordang3(2) = 0.0 - cor_ordang2(2) = 0.0 - cor_ordang1(2) = 0.0 - endif - - - if ( trim(rad_area) == 'rgn' ) then - nsub = 1 - endif - do i=1,nsub - if ( trim(rad_area) == 'rgn' ) then - write(6,*) 'INSIDE i 1 to nsub do loop' - endif - k=jsub(i) - count(ipos,j,k) = count(ipos,j,k) + 1.0 - penalty(ipos,j,k) = penalty(ipos,j,k) + pen - - do ii=1,2 - tot_cor(ipos,j,k,ii) = tot_cor(ipos,j,k,ii) + cor_tot(ii) - omg_nbc(ipos,j,k,ii) = omg_nbc(ipos,j,k,ii) + nbc_omg(ii) - omg_bc(ipos,j,k,ii) = omg_bc(ipos,j,k,ii) + bc_omg(ii) - fixang_cor(ipos,j,k,ii) = fixang_cor(ipos,j,k,ii) + cor_fixang(ii) - lapse_cor(ipos,j,k,ii) = lapse_cor(ipos,j,k,ii) + cor_lapse(ii) - lapse2_cor(ipos,j,k,ii) = lapse2_cor(ipos,j,k,ii) + cor_lapse2(ii) - const_cor(ipos,j,k,ii) = const_cor(ipos,j,k,ii) + cor_const(ii) - scangl_cor(ipos,j,k,ii) = scangl_cor(ipos,j,k,ii) + cor_scangl(ii) - clw_cor(ipos,j,k,ii) = clw_cor(ipos,j,k,ii) + cor_clw(ii) - cos_cor(ipos,j,k,ii) = cos_cor(ipos,j,k,ii) + cor_cos(ii) - sin_cor(ipos,j,k,ii) = sin_cor(ipos,j,k,ii) + cor_sin(ii) - emiss_cor(ipos,j,k,ii) = emiss_cor(ipos,j,k,ii) + cor_emiss(ii) - ordang4_cor(ipos,j,k,ii) = ordang4_cor(ipos,j,k,ii) + cor_ordang4(ii) - ordang3_cor(ipos,j,k,ii) = ordang3_cor(ipos,j,k,ii) + cor_ordang3(ii) - ordang2_cor(ipos,j,k,ii) = ordang2_cor(ipos,j,k,ii) + cor_ordang2(ii) - ordang1_cor(ipos,j,k,ii) = ordang1_cor(ipos,j,k,ii) + cor_ordang1(ii) - - end do - end do - - endif - - enddo ! channel loop - -! End of loop over diagnostic file - enddo loopd - close(lndiag) - write(6,*)' ' - write(6,*)'read in ',iread,' obs ',rread - write(6,*)' ' - - write(6,*)'nwater, nland, nice, nsnow, nmixed, ntotal = ', nwater, nland, nice, nsnow, nmixed, ntotal - nntotal=nnwater+nnland+nnsnow+nnmixed - write(6,*)'nnwater, nnland, nnsnow, nnmixed, nntotal = ', nnwater, nnland, nnsnow, nnmixed, nntotal - - - ! Create Control file - if ( imkctl == 1 ) then - write(6,*)'call create_ctl_angle' - if ( trim(gesanl) == 'ges' ) then - dfile = trim(satname) - else - dfile = trim(satname) // '_anl' - endif - - call create_ctl_angle(ntype,ftype,n_chan,iyy,imm,idd,ihh,& - ctl_file,lunctl,rmiss,dfile,satype,dplat,surf_nregion,& - surf_region,surf_rlonmin,surf_rlonmax,surf_rlatmin,surf_rlatmax,& - nu_chan,use, error, frequency,wavenumbr,nstep,start,step, little_endian) - else - write(6,*) 'imkctl =',imkctl - endif - - -! Write output to data file - if ( imkdata == 1 ) then - write(6,*)' ' - open(lungrd,file=data_file,form='unformatted') - write(lungrd) ((timang(i,j),i=1,nstep),j=1,n_chan) - do k=1,surf_nregion - write(lungrd) ((count(i,j,k),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd) ((penalty(i,j,k),i=1,nstep),j=1,n_chan) - end do - do ii=1,2 - do k=1,surf_nregion - write(lungrd)((omg_nbc(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((tot_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((omg_bc(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((fixang_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((lapse_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((lapse2_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((const_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((scangl_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((clw_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((cos_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((sin_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((emiss_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((ordang4_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((ordang3_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((ordang2_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((ordang1_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - end do - write(6,*)'write output to lungrd=',lungrd,', file=',trim(data_file) - close(lungrd) - else - write(6,*) 'imkctl =',imkctl - endif - - -! Deallocate arrays - write(6,*)' ' - write(6,*)'deallocate arrays' - deallocate(penalty,io_chan,nu_chan,wavenumbr,error,use,frequency) - deallocate(timang,tot_cor,omg_nbc,omg_bc,count) - goto 950 - - -! Jump to here if eof or error reading diagnostic file. -900 continue - write(6,*)'***PROBLEM reading diagnostic file. diag_rad=',diag_rad - close(lndiag) - - n_chan=nchanl - if (n_chan<=0) then - write(6,*)'***ERROR*** invalid nchanl=',nchanl,' STOP program' - call errexit(93) - endif - - allocate(timang(mstep,n_chan)) - allocate(count(mstep,n_chan,surf_nregion),& - penalty(mstep,n_chan,surf_nregion),& - omg_nbc(mstep,n_chan,surf_nregion,2),& - tot_cor(mstep,n_chan,surf_nregion,2),& - omg_bc(mstep,n_chan,surf_nregion,2)) - -! -! Initialze all output variables to rmiss -! -! - do j=1,n_chan - do i=1,mstep - timang(i,j) = rmiss - end do - end do - - write(6,*)'load missing value ',rmiss,' into output arrays. ',& - nstep,surf_nregion,n_chan - do ii=1,2 - do k=1,surf_nregion - do j=1,n_chan - do i=1,mstep - if (ii==1) then - count(i,j,k) = rmiss - penalty(i,j,k)= rmiss - endif - omg_nbc(i,j,k,ii) = rmiss - tot_cor(i,j,k,ii) = rmiss - omg_bc(i,j,k,ii) = rmiss - fixang_cor(i,j,k,ii) = rmiss - lapse_cor(i,j,k,ii) = rmiss - lapse2_cor(i,j,k,ii) = rmiss - clw_cor(i,j,k,ii) = rmiss - const_cor(i,j,k,ii) = rmiss - scangl_cor(i,j,k,ii) = rmiss - cos_cor(i,j,k,ii) = rmiss - sin_cor(i,j,k,ii) = rmiss - emiss_cor(i,j,k,ii) = rmiss - ordang4_cor(i,j,k,ii) = rmiss - ordang3_cor(i,j,k,ii) = rmiss - ordang2_cor(i,j,k,ii) = rmiss - ordang1_cor(i,j,k,ii) = rmiss - end do - end do - end do - end do - - if ( imkdata == 1 ) then - open(lungrd,file=data_file,form='unformatted') - write(lungrd) ((timang(i,j),i=1,nstep),j=1,n_chan) - do k=1,surf_nregion - write(lungrd) ((count(i,j,k),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd) ((penalty(i,j,k),i=1,nstep),j=1,n_chan) - end do - do ii=1,2 - do k=1,surf_nregion - write(lungrd)((omg_nbc(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((tot_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((omg_bc(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((fixang_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((lapse_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((lapse2_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((const_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((scangl_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((clw_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((cos_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((sin_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((emiss_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((ordang4_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((ordang3_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((ordang2_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((ordang1_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - end do - write(6,*)'write output to lungrd=',lungrd,', file=',trim(data_file) - close(lungrd) - endif - deallocate(timang,count,penalty,omg_nbc,omg_bc,tot_cor,& - fixang_cor,lapse_cor,lapse2_cor,const_cor,scangl_cor,clw_cor) - deallocate(cos_cor,sin_cor,emiss_cor,ordang1_cor,ordang2_cor,ordang3_cor,ordang4_cor) - -! End of program -950 continue - stop -end program angle diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radang.fd/create_ctl_angle.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radang.fd/create_ctl_angle.f90 deleted file mode 100755 index 6077ac6c1b..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radang.fd/create_ctl_angle.f90 +++ /dev/null @@ -1,176 +0,0 @@ -subroutine create_ctl_angle(ntype,ftype,n_chan,iyy,imm,idd,ihh,& - ctl_file,lunctl,rmiss,satname,satype,dplat,nregion,& - region,rlonmin,rlonmax,rlatmin,rlatmax,nu_chan,use,error,& - frequency,wavenumbr,nstep,start,step, little_endian) - - implicit none - - integer ntype - - character(2) cword - character(3),dimension(12):: mon - character(3):: clatmin,clatmax - character(4):: clonmin,clonmax - character(10),dimension(ntype):: ftype - character(13) stringd - character(20) satname - character(10) satype,dplat - character(40) ctl_file,grad_file - character(80) string - character(40),dimension(nregion):: region - character(80),dimension(nregion):: stringr - - integer nregion,iuse,klev,nstep - integer lunctl,iyy,imm,idd,ihh,j,i,n_chan,idhh,incr - integer iyy2,imm2,idd2,ihh2,ntime - integer, dimension(8):: ida,jda - integer,dimension(n_chan):: nu_chan - integer little_endian - - real rmiss,wavelength,start,step - real,dimension(5):: fha - real,dimension(n_chan):: error,use,frequency,wavenumbr - real,dimension(nregion):: rlonmin,rlonmax,rlatmin,rlatmax - - data stringd / '.%y4%m2%d2%h2' / - data mon / 'jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', & - 'aug', 'sep', 'oct', 'nov', 'dec' / - -!************************************************************************** - - write(6,*)'start create_ctl_angle' - write(6,*)' n_chan = ', n_chan - -! Create date for tdef based on given date and hour offset - - idhh=-720 ! this is 30 days back in hours. - incr=6 ! cycle interval - - fha=0.0; ida=0; jda=0; ntime=0 - iyy2=iyy; imm2=imm; idd2=idd; ihh2=ihh - if (idhh/=0) then - ntime = abs(idhh)/incr - fha(2)=idhh - ida(1)=iyy - ida(2)=imm - ida(3)=idd - ida(4)=0 - ida(5)=ihh - call w3movdat(fha,ida,jda) - iyy2=jda(1) - imm2=jda(2) - idd2=jda(3) - ihh2=jda(5) - endif - ntime=ntime+1 - -! Open unit to GrADS control file - open(lunctl,file=ctl_file,form='formatted') - -!******************************************************************* -! Construct the region strings if this is for a global source, -! which is defined as nregion > 1. -! - if (nregion > 1) then - do i=1,nregion - if (rlatmin(i)>0.) then - write(clatmin,10) int(rlatmin(i)) - else - write(clatmin,20) abs(int(rlatmin(i))) - endif - if (rlatmax(i)>0.) then - write(clatmax,10) int(rlatmax(i)) - else - write(clatmax,20) abs(int(rlatmax(i))) - endif - if (rlonmin(i)>0.) then - write(clonmin,30) int(rlonmin(i)) - else - write(clonmin,40) abs(int(rlonmin(i))) - endif - if (rlonmax(i)>0.) then - write(clonmax,30) int(rlonmax(i)) - else - write(clonmax,40) abs(int(rlonmax(i))) - endif - stringr(i) = trim(region(i)) // ' (' // & - trim(clonmin) // '-' // trim(clonmax) // ', ' // & - trim(clatmin) // '-' // trim(clatmax) // ')' - end do - endif -10 format(i2,'N') -20 format(i2,'S') -30 format(i3,'E') -40 format(i3,'W') - -! Write header information - grad_file = trim(satname) // stringd // '.ieee_d' - write(lunctl,100) grad_file - if (little_endian == 1 ) then - write( lunctl,112 ) - else - write( lunctl,110 ) - endif - write(lunctl,120) rmiss - write(lunctl,130) adjustl(satype),dplat,n_chan - write(lunctl,132) - write(lunctl,134) - do i=1,n_chan - iuse = nint(use(i)) - wavelength = 10000./wavenumbr(i) - write(lunctl,136) i,nu_chan(i),iuse,error(i),wavelength,frequency(i) - end do - write(lunctl,138) - - if (nregion > 1) then - do i=1,nregion - write(cword,'(i2)') i - string = '* region=' // cword // ' ' // trim(stringr(i)) - write(lunctl,140) string - end do - endif - write(lunctl,145) nstep,start,step - write(lunctl,150) n_chan - write(lunctl,160) nregion - write(lunctl,170) ntime,ihh2,idd2,mon(imm2),iyy2 - write(lunctl,180) ntype - -100 format('dset ^',a40) -110 format('options template big_endian sequential') -112 format('options template little_endian sequential') -120 format('undef ',f5.0) -130 format('title ',a10,1x,a10,1x,i4) -132 format('*XDEF is scan position') -134 format('*YDEF is channel number') -136 format('* y= ',i4,', channel= ',i4,' , iuse= ',i2,' , error= ',f8.3,& - ' , wlth= ',f9.2,' , freq= ',f9.2) -138 format('*ZDEF is geographic region') -140 format(a80) -145 format('xdef ',i3,' linear ',f5.1,1x,f5.1) -150 format('ydef ',i4,' linear 1.0 1.0') -160 format('zdef ',i2,' linear 1.0 1.0') -170 format('tdef ',i4,' linear ',i2.2,'Z',i2.2,a3,i4.4,' 06hr') -180 format('vars ',i7) - -! Write data portion of GraDS control file - do i=1,ntype - string = trim(ftype(i)) - klev=nregion - if (i==1) klev=1 - write(lunctl,190) adjustl(string),klev,trim(ftype(i)) -190 format(a10,1x,i2,' 0 ',a10) - end do - -! Write trminating "endvars" record - write(lunctl,200) -200 format('endvars') - - -! Close ctl file - close(lunctl) - - write(6,*)'finish create_ctl_angle' - -! Return - return -end subroutine create_ctl_angle diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radang.fd/makefile b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radang.fd/makefile deleted file mode 100755 index 7c7e319401..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radang.fd/makefile +++ /dev/null @@ -1,51 +0,0 @@ -# ***************************************************************** -# makefile.angle_bias -# -# Make the radmon_angle.glb executable. The executable will -# extract angle radiance data from a diagnostic file from a -# global run. -# -# ***************************************************************** - -SHELL=/bin/sh -SRCS = kinds.F90 read_diag.f90 angle_bias.f90 \ - create_ctl_angle.f90 - -OBJS = kinds.o read_diag.o angle_bias.o \ - create_ctl_angle.o - -# -# ***************************************************************** -# - -#------------ -# Include machine dependent compile & load options -#------------ -MAKE_CONF = Makefile.conf -include $(MAKE_CONF) - - -CMD = radmon_angle - -all: $(CMD) - -clean: - rm -f *.o - rm -f *.mod - rm -f radmon_angle - -$(CMD): $(OBJS) - $(CF) $(FFLAGS) $(LDFLAGS) -o $(@) $(OBJS) $(LIBS) - -kinds.o : kinds.F90 - $(CF) $(FFLAGS) -c $(*).F90 - -read_diag.o : read_diag.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -angle_bias.o : angle_bias.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -create_ctl_angle.o : create_ctl_angle.f90 - $(CF) $(FFLAGS) -c $(*).f90 - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radang.fd/read_diag.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radang.fd/read_diag.f90 deleted file mode 100755 index 7a4d6cdc49..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radang.fd/read_diag.f90 +++ /dev/null @@ -1,659 +0,0 @@ -!$$$ subprogram documentation block -! . . . . -! subprogram: read_raddiag read rad diag file -! prgmmr: tahara org: np20 date: 2003-01-01 -! -! abstract: This module contains code to process radiance -! diagnostic files. The module defines structures -! to contain information from the radiance -! diagnostic files and then provides two routines -! to access contents of the file. -! -! program history log: -! 2005-07-22 treadon - add this doc block -! 2010-10-05 treadon - refactor code to GSI standard -! 2010-10-08 zhu - use data_tmp to handle various npred values -! 2011-02-22 kleist - changes related to memory allocate/deallocate -! 2011-04-08 li - add tref, dtw, dtc to diag_data_fix_list, add tb_tz to diag_data_chan_list -! - correspondingly, change ireal_radiag (26 -> 30) and ipchan_radiag (7 -> 8) -! 2011-07-24 safford - make structure size for reading data_fix data version dependent -! 2013-11-21 todling - revisit how versions are set (add set/get_radiag) -! 2014-01-27 todling - add ob sensitivity index -! -! contains -! read_radiag_header - read radiance diagnostic file header -! read_radiag_data - read radiance diagnostic file data -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ - -module read_diag - - use kinds, only: i_kind,r_single - implicit none - -! Declare public and private - private - - public :: diag_header_fix_list - public :: diag_header_chan_list - public :: diag_data_name_list - public :: diag_data_fix_list - public :: diag_data_chan_list - public :: diag_data_extra_list - public :: read_radiag_header - public :: read_radiag_data -! public :: iversion_radiag -! public :: iversion_radiag_1 -! public :: iversion_radiag_2 -! public :: iversion_radiag_3 -! public :: iversion_radiag_4 - public :: ireal_radiag - public :: ipchan_radiag - public :: set_radiag - public :: get_radiag - - interface set_radiag - module procedure set_radiag_int_ ! internal procedure for integers - end interface - interface get_radiag - module procedure get_radiag_int_ ! internal procedure for integers - end interface - - integer(i_kind),parameter :: ireal_radiag = 30 ! number of real entries per spot in radiance diagnostic file - integer(i_kind),parameter :: ireal_old_radiag = 26 ! number of real entries per spot in versions older than iversion_radiag_2 - integer(i_kind),parameter :: ipchan_radiag = 8 ! number of entries per channel per spot in radiance diagnostic file - -! Declare structures for radiance diagnostic file information - type diag_header_fix_list - character(len=20) :: isis ! sat and sensor type - character(len=10) :: id ! sat type - character(len=10) :: obstype ! observation type - integer(i_kind) :: jiter ! outer loop counter - integer(i_kind) :: nchan ! number of channels in the sensor - integer(i_kind) :: npred ! number of updating bias correction predictors - integer(i_kind) :: idate ! time (yyyymmddhh) - integer(i_kind) :: ireal ! # of real elements in the fix part of a data record - integer(i_kind) :: ipchan ! # of elements for each channel except for bias correction terms - integer(i_kind) :: iextra ! # of extra elements for each channel - integer(i_kind) :: jextra ! # of extra elements - integer(i_kind) :: idiag ! first dimension of diag_data_chan - integer(i_kind) :: angord ! order of polynomial for adp_anglebc option - integer(i_kind) :: iversion ! radiance diagnostic file version number - integer(i_kind) :: inewpc ! indicator of newpc4pred (1 on, 0 off) - integer(i_kind) :: isens ! sensitivity index - end type diag_header_fix_list - - type diag_data_name_list - character(len=10),dimension(ireal_radiag) :: fix - character(len=10),dimension(:),allocatable :: chn - end type diag_data_name_list - - type diag_header_chan_list - real(r_single) :: freq ! frequency (Hz) - real(r_single) :: polar ! polarization - real(r_single) :: wave ! wave number (cm^-1) - real(r_single) :: varch ! error variance (or SD error?) - real(r_single) :: tlapmean ! mean lapse rate - integer(i_kind):: iuse ! use flag - integer(i_kind):: nuchan ! sensor relative channel number - integer(i_kind):: iochan ! satinfo relative channel number - end type diag_header_chan_list - - type diag_data_fix_list - real(r_single) :: lat ! latitude (deg) - real(r_single) :: lon ! longitude (deg) - real(r_single) :: zsges ! guess elevation at obs location (m) - real(r_single) :: obstime ! observation time relative to analysis - real(r_single) :: senscn_pos ! sensor scan position (integer(i_kind)) - real(r_single) :: satzen_ang ! satellite zenith angle (deg) - real(r_single) :: satazm_ang ! satellite azimuth angle (deg) - real(r_single) :: solzen_ang ! solar zenith angle (deg) - real(r_single) :: solazm_ang ! solar azimumth angle (deg) - real(r_single) :: sungln_ang ! sun glint angle (deg) - real(r_single) :: water_frac ! fractional coverage by water - real(r_single) :: land_frac ! fractional coverage by land - real(r_single) :: ice_frac ! fractional coverage by ice - real(r_single) :: snow_frac ! fractional coverage by snow - real(r_single) :: water_temp ! surface temperature over water (K) - real(r_single) :: land_temp ! surface temperature over land (K) - real(r_single) :: ice_temp ! surface temperature over ice (K) - real(r_single) :: snow_temp ! surface temperature over snow (K) - real(r_single) :: soil_temp ! soil temperature (K) - real(r_single) :: soil_mois ! soil moisture - real(r_single) :: land_type ! land type (integer(i_kind)) - real(r_single) :: veg_frac ! vegetation fraction - real(r_single) :: snow_depth ! snow depth - real(r_single) :: sfc_wndspd ! surface wind speed - real(r_single) :: qcdiag1 ! ir=cloud fraction, mw=cloud liquid water - real(r_single) :: qcdiag2 ! ir=cloud top pressure, mw=total column water - real(r_single) :: tref ! reference temperature (Tr) in NSST - real(r_single) :: dtw ! dt_warm at zob - real(r_single) :: dtc ! dt_cool at zob - real(r_single) :: tz_tr ! d(Tz)/d(Tr) - end type diag_data_fix_list - - type diag_data_chan_list - real(r_single) :: tbobs ! Tb (obs) (K) - real(r_single) :: omgbc ! Tb_(obs) - Tb_(simulated w/ bc) (K) - real(r_single) :: omgnbc ! Tb_(obs) - Tb_(simulated_w/o bc) (K) - real(r_single) :: errinv ! inverse error (K**(-1)) - real(r_single) :: qcmark ! quality control mark - real(r_single) :: emiss ! surface emissivity - real(r_single) :: tlap ! temperature lapse rate - real(r_single) :: tb_tz ! d(Tb)/d(Tz) - real(r_single) :: bicons ! constant bias correction term - real(r_single) :: biang ! scan angle bias correction term - real(r_single) :: biclw ! CLW bias correction term - real(r_single) :: bilap2 ! square lapse rate bias correction term - real(r_single) :: bilap ! lapse rate bias correction term - real(r_single) :: bicos ! node*cos(lat) bias correction term - real(r_single) :: bisin ! sin(lat) bias correction term - real(r_single) :: biemis ! emissivity sensitivity bias correction term - real(r_single),dimension(:),allocatable :: bifix ! angle dependent bias - real(r_single) :: bisst ! SST bias correction term - end type diag_data_chan_list - - type diag_data_extra_list - real(r_single) :: extra ! extra information - end type diag_data_extra_list - - integer(i_kind),save :: iversion_radiag ! Current version (see set routine) - integer(i_kind),parameter:: iversion_radiag_1 = 11104 ! Version when bias-correction entries were modified - integer(i_kind),parameter:: iversion_radiag_2 = 13784 ! Version when NSST entries were added - integer(i_kind),parameter:: iversion_radiag_3 = 19180 ! Version when SSMIS added - integer(i_kind),parameter:: iversion_radiag_4 = 30303 ! Version when emissivity predictor added - - real(r_single),parameter:: rmiss_radiag = -9.9e11_r_single - -contains - -subroutine set_radiag_int_ (what,iv,ier) -character(len=*),intent(in) :: what -integer(i_kind),intent(in) :: iv -integer(i_kind),intent(out):: ier -ier=-1 -if(trim(what)=='version') then - iversion_radiag = iv - ier=0 -endif -end subroutine set_radiag_int_ - -subroutine get_radiag_int_ (what,iv,ier) -character(len=*),intent(in) :: what -integer(i_kind),intent(out):: iv -integer(i_kind),intent(out):: ier -ier=-1 -if(trim(what)=='version') then - iv = iversion_radiag - ier=0 -endif -end subroutine get_radiag_int_ - -subroutine read_radiag_header(ftin,npred_radiag,retrieval,header_fix,header_chan,data_name,iflag,lverbose) -! . . . . -! subprogram: read_diag_header read rad diag header -! prgmmr: tahara org: np20 date: 2003-01-01 -! -! abstract: This routine reads the header record from a radiance -! diagnostic file -! -! program history log: -! 2010-10-05 treadon - add this doc block -! 2011-02-22 kleist - changes related to memory allocation and standard output -! -! input argument list: -! ftin - unit number connected to diagnostic file -! npred_radiag - number of bias correction terms -! retrieval - .true. if sst retrieval -! -! output argument list: -! header_fix - header information structure -! header_chan - channel information structure -! data_name - diag file data names -! iflag - error code -! lverbose - optional flag to turn off default output to standard out -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ - -! Declare passed arguments - integer(i_kind),intent(in) :: ftin - integer(i_kind),intent(in) :: npred_radiag - logical,intent(in) :: retrieval - type(diag_header_fix_list ),intent(out):: header_fix - type(diag_header_chan_list),allocatable :: header_chan(:) - type(diag_data_name_list) :: data_name - integer(i_kind),intent(out) :: iflag - logical,optional,intent(in) :: lverbose - -! Declare local variables - character(len=2):: string - character(len=10):: satid,sentype - character(len=20):: sensat - integer(i_kind) :: i,ich - integer(i_kind):: jiter,nchanl,npred,ianldate,ireal,ipchan,iextra,jextra - integer(i_kind):: idiag,angord,iversion,inewpc,isens - integer(i_kind):: iuse_tmp,nuchan_tmp,iochan_tmp - real(r_single) :: freq_tmp,polar_tmp,wave_tmp,varch_tmp,tlapmean_tmp - logical loutall - - loutall=.true. - if(present(lverbose)) loutall=lverbose - -! Read header (fixed_part). - read(ftin,IOSTAT=iflag) sensat,satid,sentype,jiter,nchanl,npred,ianldate,& - ireal,ipchan,iextra,jextra,idiag,angord,iversion,inewpc,isens - if (iflag/=0) then - rewind(ftin) - read(ftin,IOSTAT=iflag) sensat,satid,sentype,jiter,nchanl,npred,ianldate,& - ireal,ipchan,iextra,jextra,idiag,angord,iversion,inewpc - isens=0 - end if - - if (iflag/=0) then - rewind(ftin) - read(ftin,IOSTAT=iflag) sensat,satid,sentype,jiter,nchanl,npred,ianldate,& - ireal,ipchan,iextra,jextra - idiag=ipchan+npred+1 - angord=0 - iversion=0 - inewpc=0 - isens=0 - if (iflag/=0) then - write(6,*)'READ_RADIAG_HEADER: ***ERROR*** Unknown file format. Cannot read' - return - endif - endif - - header_fix%isis = sensat - header_fix%id = satid - header_fix%obstype = sentype - header_fix%jiter = jiter - header_fix%nchan = nchanl - header_fix%npred = npred - header_fix%idate = ianldate - header_fix%ireal = ireal - header_fix%ipchan = ipchan - header_fix%iextra = iextra - header_fix%jextra = jextra - header_fix%idiag = idiag - header_fix%angord = angord - header_fix%iversion= iversion - header_fix%inewpc = inewpc - header_fix%isens = isens - - if (loutall) then - write(6,*)'READ_RADIAG_HEADER: isis=',header_fix%isis,& - ' nchan=',header_fix%nchan,& - ' npred=',header_fix%npred,& - ' angord=',header_fix%angord,& - ' idiag=',header_fix%idiag,& - ' iversion=',header_fix%iversion,& - ' inewpc=',header_fix%inewpc,& - ' isens=',header_fix%isens - - if ( header_fix%iextra /= 0) & - write(6,*)'READ_RADIAG_HEADER: extra diagnostic information available, ',& - 'iextra=',header_fix%iextra - end if - - if (header_fix%npred /= npred_radiag) & - write(6,*) 'READ_RADIAG_HEADER: **WARNING** header_fix%npred,npred=',& - header_fix%npred,npred_radiag - -! Allocate and initialize as needed - if (allocated(header_chan)) deallocate(header_chan) - if (allocated(data_name%chn)) deallocate(data_name%chn) - - allocate(header_chan( header_fix%nchan)) - allocate(data_name%chn(header_fix%idiag)) - - data_name%fix(1) ='lat ' - data_name%fix(2) ='lon ' - data_name%fix(3) ='zsges ' - data_name%fix(4) ='obstim ' - data_name%fix(5) ='scanpos ' - data_name%fix(6) ='satzen ' - data_name%fix(7) ='satazm ' - data_name%fix(8) ='solzen ' - data_name%fix(9) ='solazm ' - data_name%fix(10)='sungln ' - data_name%fix(11)='fwater ' - data_name%fix(12)='fland ' - data_name%fix(13)='fice ' - data_name%fix(14)='fsnow ' - data_name%fix(15)='twater ' - data_name%fix(16)='tland ' - data_name%fix(17)='tice ' - data_name%fix(18)='tsnow ' - data_name%fix(19)='tsoil ' - data_name%fix(20)='soilmoi ' - data_name%fix(21)='landtyp ' - data_name%fix(22)='vegfrac ' - data_name%fix(23)='snowdep ' - data_name%fix(24)='wndspd ' - data_name%fix(25)='qc1 ' - data_name%fix(26)='qc2 ' - data_name%fix(27)='tref ' - data_name%fix(28)='dtw ' - data_name%fix(29)='dtc ' - data_name%fix(30)='tz_tr ' - - data_name%chn(1)='obs ' - data_name%chn(2)='omgbc ' - data_name%chn(3)='omgnbc ' - data_name%chn(4)='errinv ' - data_name%chn(5)='qcmark ' - data_name%chn(6)='emiss ' - data_name%chn(7)='tlap ' - data_name%chn(8)='tb_tz ' - - if (header_fix%iversion < iversion_radiag_1) then - data_name%chn( 8)= 'bifix ' - data_name%chn( 9)= 'bilap ' - data_name%chn(10)= 'bilap2 ' - data_name%chn(11)= 'bicons ' - data_name%chn(12)= 'biang ' - data_name%chn(13)= 'biclw ' - if (retrieval) data_name%chn(13)= 'bisst ' - elseif ( header_fix%iversion < iversion_radiag_2 .and. header_fix%iversion >= iversion_radiag_1 ) then - data_name%chn( 8)= 'bicons ' - data_name%chn( 9)= 'biang ' - data_name%chn(10)= 'biclw ' - data_name%chn(11)= 'bilap2 ' - data_name%chn(12)= 'bilap ' - do i=1,header_fix%angord - write(string,'(i2.2)') header_fix%angord-i+1 - data_name%chn(12+i)= 'bifix' // string - end do - data_name%chn(12+header_fix%angord+1)= 'bifix ' - data_name%chn(12+header_fix%angord+2)= 'bisst ' - elseif ( header_fix%iversion < iversion_radiag_3 .and. header_fix%iversion >= iversion_radiag_2 ) then - data_name%chn( 9)= 'bicons ' - data_name%chn(10)= 'biang ' - data_name%chn(11)= 'biclw ' - data_name%chn(12)= 'bilap2 ' - data_name%chn(13)= 'bilap ' - do i=1,header_fix%angord - write(string,'(i2.2)') header_fix%angord-i+1 - data_name%chn(13+i)= 'bifix' // string - end do - data_name%chn(13+header_fix%angord+1)= 'bifix ' - data_name%chn(13+header_fix%angord+2)= 'bisst ' - elseif ( header_fix%iversion < iversion_radiag_4 .and. header_fix%iversion >= iversion_radiag_3 ) then - data_name%chn( 9)= 'bicons ' - data_name%chn(10)= 'biang ' - data_name%chn(11)= 'biclw ' - data_name%chn(12)= 'bilap2 ' - data_name%chn(13)= 'bilap ' - data_name%chn(14)= 'bicos ' - data_name%chn(15)= 'bisin ' - do i=1,header_fix%angord - write(string,'(i2.2)') header_fix%angord-i+1 - data_name%chn(15+i)= 'bifix' // string - end do - data_name%chn(15+header_fix%angord+1)= 'bifix ' - data_name%chn(15+header_fix%angord+2)= 'bisst ' - else - data_name%chn( 9)= 'bicons ' - data_name%chn(10)= 'biang ' - data_name%chn(11)= 'biclw ' - data_name%chn(12)= 'bilap2 ' - data_name%chn(13)= 'bilap ' - data_name%chn(14)= 'bicos ' - data_name%chn(15)= 'bisin ' - data_name%chn(16)= 'biemis ' - do i=1,header_fix%angord - write(string,'(i2.2)') header_fix%angord-i+1 - data_name%chn(16+i)= 'bifix' // string - end do - data_name%chn(16+header_fix%angord+1)= 'bifix ' - data_name%chn(16+header_fix%angord+2)= 'bisst ' - endif - -! Read header (channel part) - do ich=1, header_fix%nchan - read(ftin,IOSTAT=iflag) freq_tmp,polar_tmp,wave_tmp,varch_tmp,tlapmean_tmp,iuse_tmp,nuchan_tmp,iochan_tmp - header_chan(ich)%freq = freq_tmp - header_chan(ich)%polar = polar_tmp - header_chan(ich)%wave = wave_tmp - header_chan(ich)%varch = varch_tmp - header_chan(ich)%tlapmean = tlapmean_tmp - header_chan(ich)%iuse = iuse_tmp - header_chan(ich)%nuchan = nuchan_tmp - header_chan(ich)%iochan = iochan_tmp - if (iflag/=0) return - end do - -! Construct array containing menonics for data record entries - - -end subroutine read_radiag_header - -subroutine read_radiag_data(ftin,header_fix,retrieval,data_fix,data_chan,data_extra,iflag ) -! . . . . -! subprogram: read_radiag_dat read rad diag data -! prgmmr: tahara org: np20 date: 2003-01-01 -! -! abstract: This routine reads the data record from a radiance -! diagnostic file -! -! program history log: -! 2010-10-05 treadon - add this doc block -! 2011-02-22 kleist - changes related to memory allocation -! -! input argument list: -! ftin - unit number connected to diagnostic file -! header_fix - header information structure -! -! output argument list: -! data_fix - spot header information structure -! data_chan - spot channel information structure -! data_extra - spot extra information -! iflag - error code -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ - - -! Declare passed arguments - integer(i_kind),intent(in) :: ftin - type(diag_header_fix_list ),intent(in) :: header_fix - logical,intent(in) :: retrieval - type(diag_data_fix_list) ,intent(out):: data_fix - type(diag_data_chan_list) ,allocatable :: data_chan(:) - type(diag_data_extra_list) ,allocatable :: data_extra(:,:) - integer(i_kind),intent(out) :: iflag - - integer(i_kind) :: ich,iang,i,j - real(r_single),dimension(:,:),allocatable :: data_tmp - real(r_single),dimension(:),allocatable :: fix_tmp - real(r_single),dimension(:,:),allocatable :: extra_tmp - -! Allocate arrays as needed - if (allocated(data_chan)) deallocate(data_chan) - allocate(data_chan(header_fix%nchan)) - - do ich=1,header_fix%nchan - if (allocated(data_chan(ich)%bifix)) deallocate(data_chan(ich)%bifix) - allocate(data_chan(ich)%bifix(header_fix%angord+1)) - end do - - if (header_fix%iextra > 0) then - if (allocated(data_extra)) deallocate(data_extra) - allocate(data_extra(header_fix%iextra,header_fix%jextra)) - allocate(extra_tmp(header_fix%iextra,header_fix%jextra)) - end if - -! Allocate arrays to hold data record - allocate(data_tmp(header_fix%idiag,header_fix%nchan)) - - if (header_fix%iversion < iversion_radiag_2) then - allocate( fix_tmp( ireal_old_radiag ) ) - else - allocate( fix_tmp( ireal_radiag ) ) - end if - -! Read data record - - if (header_fix%iextra == 0) then - read(ftin,IOSTAT=iflag) fix_tmp, data_tmp - else - read(ftin,IOSTAT=iflag) fix_tmp, data_tmp, extra_tmp - endif - - -! Transfer fix_tmp record to output structure - data_fix%lat = fix_tmp(1) - data_fix%lon = fix_tmp(2) - data_fix%zsges = fix_tmp(3) - data_fix%obstime = fix_tmp(4) - data_fix%senscn_pos = fix_tmp(5) - data_fix%satzen_ang = fix_tmp(6) - data_fix%satazm_ang = fix_tmp(7) - data_fix%solzen_ang = fix_tmp(8) - data_fix%solazm_ang = fix_tmp(9) - data_fix%sungln_ang = fix_tmp(10) - data_fix%water_frac = fix_tmp(11) - data_fix%land_frac = fix_tmp(12) - data_fix%ice_frac = fix_tmp(13) - data_fix%snow_frac = fix_tmp(14) - data_fix%water_temp = fix_tmp(15) - data_fix%land_temp = fix_tmp(16) - data_fix%ice_temp = fix_tmp(17) - data_fix%snow_temp = fix_tmp(18) - data_fix%soil_temp = fix_tmp(19) - data_fix%soil_mois = fix_tmp(20) - data_fix%land_type = fix_tmp(21) - data_fix%veg_frac = fix_tmp(22) - data_fix%snow_depth = fix_tmp(23) - data_fix%sfc_wndspd = fix_tmp(24) - data_fix%qcdiag1 = fix_tmp(25) - data_fix%qcdiag2 = fix_tmp(26) - - if ( header_fix%iversion <= iversion_radiag_1 ) then - data_fix%tref = rmiss_radiag - data_fix%dtw = rmiss_radiag - data_fix%dtc = rmiss_radiag - data_fix%tz_tr = rmiss_radiag - else - data_fix%tref = fix_tmp(27) - data_fix%dtw = fix_tmp(28) - data_fix%dtc = fix_tmp(29) - data_fix%tz_tr = fix_tmp(30) - end if - - -! Transfer data record to output structure - do ich=1,header_fix%nchan - data_chan(ich)%tbobs =data_tmp(1,ich) - data_chan(ich)%omgbc =data_tmp(2,ich) - data_chan(ich)%omgnbc=data_tmp(3,ich) - data_chan(ich)%errinv=data_tmp(4,ich) - data_chan(ich)%qcmark=data_tmp(5,ich) - data_chan(ich)%emiss =data_tmp(6,ich) - data_chan(ich)%tlap =data_tmp(7,ich) - data_chan(ich)%tb_tz =data_tmp(8,ich) - end do - if (header_fix%iversion < iversion_radiag_1) then - do ich=1,header_fix%nchan - data_chan(ich)%bifix(1)=data_tmp(8,ich) - data_chan(ich)%bilap =data_tmp(9,ich) - data_chan(ich)%bilap2 =data_tmp(10,ich) - data_chan(ich)%bicons =data_tmp(11,ich) - data_chan(ich)%biang =data_tmp(12,ich) - data_chan(ich)%biclw =data_tmp(13,ich) - data_chan(ich)%bisst = rmiss_radiag - if (retrieval) then - data_chan(ich)%biclw =rmiss_radiag - data_chan(ich)%bisst =data_tmp(13,ich) - endif - end do - elseif ( header_fix%iversion < iversion_radiag_2 .and. header_fix%iversion >= iversion_radiag_1 ) then - do ich=1,header_fix%nchan - data_chan(ich)%bicons=data_tmp(8,ich) - data_chan(ich)%biang =data_tmp(9,ich) - data_chan(ich)%biclw =data_tmp(10,ich) - data_chan(ich)%bilap2=data_tmp(11,ich) - data_chan(ich)%bilap =data_tmp(12,ich) - end do - do ich=1,header_fix%nchan - do iang=1,header_fix%angord+1 - data_chan(ich)%bifix(iang)=data_tmp(12+iang,ich) - end do - data_chan(ich)%bisst = data_tmp(12+header_fix%angord+2,ich) - end do - elseif ( header_fix%iversion < iversion_radiag_3 .and. header_fix%iversion >= iversion_radiag_2 ) then - do ich=1,header_fix%nchan - data_chan(ich)%bicons=data_tmp(9,ich) - data_chan(ich)%biang =data_tmp(10,ich) - data_chan(ich)%biclw =data_tmp(11,ich) - data_chan(ich)%bilap2=data_tmp(12,ich) - data_chan(ich)%bilap =data_tmp(13,ich) - end do - do ich=1,header_fix%nchan - do iang=1,header_fix%angord+1 - data_chan(ich)%bifix(iang)=data_tmp(13+iang,ich) - end do - data_chan(ich)%bisst = data_tmp(13+header_fix%angord+2,ich) - end do - elseif ( header_fix%iversion < iversion_radiag_4 .and. header_fix%iversion >= iversion_radiag_3 ) then - do ich=1,header_fix%nchan - data_chan(ich)%bicons=data_tmp(9,ich) - data_chan(ich)%biang =data_tmp(10,ich) - data_chan(ich)%biclw =data_tmp(11,ich) - data_chan(ich)%bilap2=data_tmp(12,ich) - data_chan(ich)%bilap =data_tmp(13,ich) - data_chan(ich)%bicos =data_tmp(14,ich) ! 1st bias correction term node*cos(lat) for SSMIS - data_chan(ich)%bisin =data_tmp(15,ich) ! 2nd bias correction term sin(lat) for SSMI - end do - do ich=1,header_fix%nchan - do iang=1,header_fix%angord+1 - data_chan(ich)%bifix(iang)=data_tmp(15+iang,ich) - end do - data_chan(ich)%bisst = data_tmp(15+header_fix%angord+2,ich) - end do - else - do ich=1,header_fix%nchan - data_chan(ich)%bicons=data_tmp(9,ich) - data_chan(ich)%biang =data_tmp(10,ich) - data_chan(ich)%biclw =data_tmp(11,ich) - data_chan(ich)%bilap2=data_tmp(12,ich) - data_chan(ich)%bilap =data_tmp(13,ich) - data_chan(ich)%bicos =data_tmp(14,ich) - data_chan(ich)%bisin =data_tmp(15,ich) - data_chan(ich)%biemis=data_tmp(16,ich) - end do - do ich=1,header_fix%nchan - do iang=1,header_fix%angord+1 - data_chan(ich)%bifix(iang)=data_tmp(16+iang,ich) - end do - data_chan(ich)%bisst = data_tmp(16+header_fix%angord+2,ich) - end do - endif - - if (header_fix%iextra > 0) then - do j=1,header_fix%jextra - do i=1,header_fix%iextra - data_extra(i,j)%extra=extra_tmp(i,j) - end do - end do - endif - - deallocate(data_tmp, fix_tmp) - if (header_fix%iextra > 0) deallocate(extra_tmp) - -end subroutine read_radiag_data - -end module read_diag - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radbcoef.fd/Makefile.conf b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radbcoef.fd/Makefile.conf deleted file mode 100755 index 9cba163a3e..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radbcoef.fd/Makefile.conf +++ /dev/null @@ -1,26 +0,0 @@ -# This config file contains the compile options for compilation -# of the RadMon code on WCOSS. - -# ---------------------------------- -# Redefine variables for WCOSS -# ---------------------------------- - CORELIB = /nwprod/lib - W3NCO_VER = v2.0.6 - W3NCO_LIB4=$(CORELIB)/w3nco/$(W3NCO_VER)/libw3nco_$(W3NCO_VER)_4.a - -# ---------------------------- -# Fortran compiler and options -# ---------------------------- - - CF = ifort - FC = $(CF) - - FFLAGS = -O3 -fp-model strict -D_REAL8_ -traceback -convert big_endian -assume byterecl - -# ------------------ -# Linker and options -# ------------------ - - LIBS = $(W3NCO_LIB4) - LDFLAGS = - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radbcoef.fd/bcoef.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radbcoef.fd/bcoef.f90 deleted file mode 100755 index aff0547f8d..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radbcoef.fd/bcoef.f90 +++ /dev/null @@ -1,354 +0,0 @@ -program bcoef - use read_diag - use kinds, only: r_kind,i_kind,r_quad - - implicit none - integer ntype,maxpred - parameter (ntype=13) - parameter (maxpred=12) - - logical eof - - character(10),dimension(ntype):: ftype - character(20) dum,satname,stringd,satsis,isis,mod_satname - character(10) satype,dplat - character(40) string,diag_rad,data_file,ctl_file - character(10) suffix - - integer luname,lungrd,lunctl,lncoef,lndiag,ich - integer iyy,imm,idd,ihh,idhh,incr,iread,iflag - integer n_chan,j,i,k,idum,ichan - integer,allocatable,dimension(:):: io_chan,nu_chan - integer npred_radiag - integer(i_kind) angord,ntlapupdate - - real pen,rmiss,weight,rread - real,allocatable,dimension(:):: wavenumbr,count,error,& - use,frequency,penalty,predr - real,allocatable,dimension(:,:):: coefs - real(r_kind) tlapm, tsum - -! Variables for reading satellite data - type(diag_header_fix_list ) :: header_fix - type(diag_header_chan_list),allocatable :: header_chan(:) - type(diag_data_name_list ) :: data_name - type(diag_data_fix_list ) :: data_fix - type(diag_data_chan_list ),allocatable :: data_chan(:) - type(diag_data_extra_list ),allocatable :: data_extra(:,:) - -! Namelist with defaults - integer :: npredr = 12 - logical :: retrieval = .false. - integer :: nchanl = 19 - integer :: imkctl = 1 - integer :: imkdata = 1 - character(3) :: gesanl ='ges' - integer :: little_endian = 1 - namelist /input/ satname,npredr,nchanl,iyy,imm,idd,ihh,idhh,& - incr,suffix,imkctl,imkdata,retrieval,gesanl,little_endian - - data luname,lungrd,lunctl / 5, 51, 52 / - data lncoef,lndiag / 21, 22 / - data rmiss /-999./ - data stringd / '.%y4%m2%d2%h2' / -!************************************************************************ -! Explanation of the fype array -! These are values used within the generated GrADS control file -! (bcoef.ctl). A fuller discription of the terms is thus: -! -! mean pred(1) = global offset (mean) -! atmpath pred(2) = not used when adp_anglebc=.true. and newpc4pred=.true. -! clw pred(3) = cloud liquid water term -! lapse2 pred(4) = (temperature lapse rate)**2 -! lapse pred(5) = temperature lapse rate -! cos_ssmis pred(6) = cosine term for SSMIS -! sin_ssmis pred(7) = sine term for SSMIS -! emiss pred(8) = emissivity sensitivity term -! ordang4 pred(9) = 4th order angle term -! ordang3 pred(10) = 3rd order angle term -! ordang2 pred(11) = 2nd order angle term -! ordang1 pred(12) = 1st order angle term -! -! Note that the npred namelist indicates how many of these terms -! will to be processed by this program. The default value is 12, -! meaning all will be processed. Earlier versions processed only the -! first 5. In all cases 12 values will be written to the resulting -! data file though if npred < 12 then the unprocessed values will -! all be set to rmiss. -!************************************************************************ - data ftype / 'penalty','mean','atmpath','clw','lapse2','lapse',& - 'cos_ssmis','sin_ssmis','emiss','ordang4','ordang3',& - 'ordang2','ordang1' / -!************************************************************************ -! - - -!************************************************************************ -! -! Initialize variables - iread=0 - npred_radiag = 12 - angord = 0 - -! Read namelist input - read(luname,input) - write(6,input) - write(6,*)'gesanl = ', gesanl - write(6,*)' ' - -! Check for user requests exceeding assumed limits - if (npredr>maxpred) then - write(6,*)' ' - write(6,*)'***ERROR*** user specified predictors > maximum allowed' - write(6,*)' npredr,maxpred=',npredr,maxpred - call errexit(91) - endif - - -! Set satellite id for specified satellite/sensor - write(6,*)'satname ',satname - - -! Create filenames for diagnostic input, binary output file - write(stringd,100) iyy,imm,idd,ihh -100 format('.',i4.4,3i2.2) - - if ( trim(gesanl) == 'ges' ) then - diag_rad = trim(satname) - data_file= trim(satname) // trim(stringd) // '.ieee_d' - ctl_file = trim(satname) // '.ctl' - else - diag_rad = trim(satname) // '_anl' - data_file= trim(satname) // '_anl' // trim(stringd) // '.ieee_d' - ctl_file = trim(satname) // '_anl.ctl' - endif - - write(6,*)'diag_rad =',diag_rad - write(6,*)'data_file=',data_file - write(6,*)'ctl_file =',ctl_file - write(6,*)'suffix =',suffix - - -! Open unit to diagnostic file. Read portion of header to -! see if file exists - open(lndiag,file=diag_rad,form='unformatted') - read(lndiag,err=900,end=900) dum - rewind lndiag - -! File exists. Read header - write(6,*)'call read_diag_header' - call read_radiag_header( lndiag, npred_radiag, retrieval, header_fix,& - header_chan, data_name, iflag ) - if( iflag/=0 ) then - write(6,*)'***ERROR*** problem reading diag file header, iflag=',iflag - call errexit(91) - endif - -! Extract observation type, satellite id, and number of channels - satype = header_fix%obstype - satsis = header_fix%isis - dplat = header_fix%id - n_chan = header_fix%nchan - angord = header_fix%angord - - if (angord == 4 ) then - npredr = 12 - endif - - write(6,*)'satype,n_chan=',satype,' ',dplat,n_chan - write(6,*)'angord = ', angord - - string = trim(satype)//'_'//trim(dplat) - write(6,*)'string,satname=',string,' ',satname - if ( trim(string) /= trim(satname) ) then - write(6,*)'***ERROR*** inconsistent instrument types' - write(6,*)' satname,string =',satname,' ',string - call errexit(93) - endif - - -! Allocate arrays to hold observational information - write(6,*)' ' - write(6,*)'allocate arrays' - allocate (io_chan(n_chan), nu_chan(n_chan), wavenumbr(n_chan)) - allocate (count(n_chan), penalty(n_chan), use(n_chan), & - frequency(n_chan)) - allocate(coefs(n_chan,maxpred)) - -! Zero accumulator arrays - do j=1,n_chan - count(j) = 0.0 - penalty(j) = 0.0 - end do - coefs = rmiss - - -! Extract satinfo relative index - do j=1,n_chan - nu_chan(j) = real( header_chan(j)%nuchan, 4 ) - io_chan(j) = real( header_chan(j)%iochan, 4 ) - wavenumbr(j) = real( header_chan(j)%wave, 4 ) - use(j) = real( header_chan(j)%iuse, 4 ) - frequency(j) = real( header_chan(j)%freq, 4) - end do - -! Loop to read entries in diagnostic file - iflag = 0 - loopd: do while (iflag == 0) - -! Read a record. If read flag, iflag does not equal zero, exit loopd - call read_radiag_data( lndiag, header_fix, retrieval, data_fix, data_chan,& - data_extra, iflag ) - if( iflag /= 0 ) exit loopd - iread=iread+1 - rread=rread+1.0 - - -! Channel loop - do j = 1, n_chan - -! If observation was assimilated, accumulate sum - if (data_chan(j)%errinv > 1.e-6) then - pen = data_chan(j)%errinv*(data_chan(j)%omgbc)**2 - count(j) = count(j) + 1.0 - penalty(j) = penalty(j) + pen - endif - - enddo ! channel loop - -! End of loop over diagnostic file - enddo loopd - close(lndiag) - write(6,*)' ' - write(6,*)'read in ',iread,' obs ',rread - write(6,*)' ' - -! Compute average. - do j=1,n_chan - if (count(j)>0) then - penalty(j)=penalty(j)/count(j) - else - count(j)=rmiss - penalty(j)=rmiss - endif - end do - - -! Open unit to input data file. See if file exists - open(lncoef,file='biascr.txt',form='formatted') - if (angord == 4 ) then - read(lncoef,122,end=920,err=920) idum - else - read(lncoef,120,end=920,err=920) idum - endif - rewind(lncoef) -120 format(I5,1x,A20,1x,I5,10f12.6) -122 format(I5,1x,A20,1x,I5,2e15.6,1x,I5/2(4x,10f12.6/)) - -!read(lunin,'(I5,1x,A20,1x,I5,2e15.6,1x,I5/2(4x,10f12.6/))',iostat=istat,end=1333) -!ich,isis,& ichan,tlapm,tsum,ntlapupdate,(predr(ip),ip=1,npred), where npred=12 - -! Read coefficient file - allocate(predr(npredr)) - i=0 - k=1 - eof=.false. - do - if (angord /= 4 ) then - read(lncoef,120,IOSTAT=iflag) ich,isis,ichan,(predr(j),j=1,npredr) - else - read(lncoef,122,IOSTAT=iflag) ich,isis,ichan, tlapm,tsum,ntlapupdate,(predr(j),j=1,npredr) - endif - if(iflag /=0) exit - if (trim(isis)==trim(satsis)) then - io_chan(k)=ichan - do j=1,npredr - coefs(k,j)=predr(j) - end do - k=k+1 - cycle - endif - end do - close(lncoef) - deallocate(predr) - - ! Create Control file - if ( imkctl == 1 ) then - write(6,*)'call create_ctl_bcoef' - - if ( trim(gesanl) == 'ges' ) then - mod_satname = trim(satname) - else - mod_satname = trim(satname) // '_anl' - endif - - call create_ctl_bcoef(ntype,ftype,n_chan,iyy,imm,idd,ihh,idhh,& - incr,ctl_file,lunctl,rmiss,mod_satname,satype,dplat,& - nu_chan,use,penalty,frequency,wavenumbr,little_endian) - else - write(6,*) 'imkctl =',imkctl - endif - - -! Write data to binary output file - if ( imkdata == 1 ) then - write(6,*)'write data to lungrd=',lungrd - open(lungrd,file=data_file,form='unformatted') - write(lungrd) (penalty(k),k=1,n_chan) - do j=1,maxpred - write(lungrd) (coefs(k,j),k=1,n_chan) - end do - close(lungrd) - endif - -! Deallocate arrays - write(6,*)'deallocate arrays' - deallocate(coefs,io_chan,nu_chan,wavenumbr,count,penalty,use,frequency) - goto 950 - - -! Jump here if problem reading diagnostic file -900 continue - write(6,*)'***PROBLEM*** reading diagnostic file' - - n_chan=nchanl - if (n_chan<=0) then - write(6,*)'***ERROR*** invalid nchanl=',nchanl,' STOP program' - call errexit(94) - endif - - write(6,*)'load missing value ',rmiss,' into output arrays. ',& - n_chan,npredr - allocate(penalty(n_chan),coefs(n_chan,npredr)) - do k=1,n_chan - penalty(k)=rmiss - end do - do j=1,npredr - do k=1,n_chan - coefs(k,j)=rmiss - end do - end do - - if ( imkdata == 1 ) then - open(lungrd,file=data_file,form='unformatted') - write(lungrd) (penalty(k),k=1,n_chan) - do j=1,npredr - write(lungrd) (coefs(k,j),k=1,n_chan) - end do - write(6,*)'write output to lungrd=',lungrd,', file=',trim(data_file) - close(lungrd) - endif - deallocate(penalty,coefs) - - goto 950 - - -! Jump here if problem reading coefficient file -920 continue - write(6,*)'***PROBLEM*** reading coefficient file' - - -! End of program -950 continue - stop -end program bcoef diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radbcoef.fd/create_ctl_bcoef.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radbcoef.fd/create_ctl_bcoef.f90 deleted file mode 100755 index f8f785dcc6..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radbcoef.fd/create_ctl_bcoef.f90 +++ /dev/null @@ -1,147 +0,0 @@ -subroutine create_ctl_bcoef(ntype,ftype,n_chan,iyy,imm,idd,ihh,idhh,& - incr,ctl_file,lunctl,rmiss,satname,satype,dplat,& - nu_chan,use,ratio,frequency,wavenumbr,little_endian) - - implicit none - - integer ntype - - character(2) cword - character(3),dimension(12):: mon - character(3):: clatmin,clatmax - character(4):: clonmin,clonmax - character(10),dimension(ntype):: ftype - character(13) stringd - character(20) satname - character(10) satype,dplat - character(40) ctl_file,grad_file - character(80) string - - integer idsat,iuse,little_endian - integer lunctl,iyy,imm,idd,ihh,j,i,n_chan,idhh,incr - integer iyy2,imm2,idd2,ihh2,ntime - integer,dimension(8):: ida,jda - integer,dimension(n_chan):: nu_chan - - real rmiss,wavelength - real,dimension(5):: fha - real,dimension(n_chan):: ratio,use,frequency,wavenumbr - - data stringd / '.%y4%m2%d2%h2' / - data mon / 'jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', & - 'aug', 'sep', 'oct', 'nov', 'dec' / - -!************************************************************************** -! Create date for tdef based on given date and hour offset - fha=0.0; ida=0; jda=0; ntime=0 - iyy2=iyy; imm2=imm; idd2=idd; ihh2=ihh - if (idhh/=0) then - ntime = abs(idhh)/incr - fha(2)=idhh - ida(1)=iyy - ida(2)=imm - ida(3)=idd - ida(4)=0 - ida(5)=ihh - call w3movdat(fha,ida,jda) - iyy2=jda(1) - imm2=jda(2) - idd2=jda(3) - ihh2=jda(5) - endif - ntime=ntime+1 - -! Open unit to GrADS control file - open(lunctl,file=ctl_file,form='formatted') - - -! Write header information - grad_file = trim(satname) // stringd // '.ieee_d' - write(lunctl,100) grad_file - if ( little_endian == 1 ) then - write(lunctl,112) - else - write(lunctl,110) - endif - write(lunctl,120) rmiss - write(lunctl,130) adjustl(satype),dplat,n_chan - write(lunctl,132) - do i=1,n_chan - iuse = nint(use(i)) - wavelength = 10000./wavenumbr(i) - write(lunctl,134) i,nu_chan(i),iuse,ratio(i),wavelength,frequency(i) - end do - - write(lunctl,210) - write(lunctl,211) - write(lunctl,212) - write(lunctl,213) - write(lunctl,214) - write(lunctl,215) - write(lunctl,216) - write(lunctl,217) - write(lunctl,218) - write(lunctl,219) - write(lunctl,220) - write(lunctl,221) - write(lunctl,222) - write(lunctl,223) - write(lunctl,224) - write(lunctl,210) - - write(lunctl,140) n_chan - write(lunctl,150) - write(lunctl,160) - write(lunctl,170) ntime,ihh2,idd2,mon(imm2),iyy2 - write(lunctl,180) ntype - -100 format('dset ^',a40) -110 format('options template big_endian sequential') -112 format('options template little_endian sequential') -120 format('undef ',f5.0) -130 format('title ',a10,1x,a10,1x,i4) -132 format('*XDEF is channel number') -134 format('* x= ',i4,', channel= ',i4,' , iuse= ',i2,' , ratio= ',f8.3,& - ' , wlth= ',f9.2,' , freq= ',f9.2) -136 format('* ',a70) -140 format('xdef ',i4,' linear 1.0 1.0') -150 format('ydef 1 linear 1.0 1.0') -160 format('zdef 1 linear 1.0 1.0') -170 format('tdef ',i4,' linear ',i2.2,'Z',i2.2,a3,i4.4,' 06hr') -180 format('vars ',i7) - -210 format('*') -211 format('* Explanation of data terms:') -212 format('* penalty penalty value') -213 format('* mean global offset (mean)') -214 format('* atmpath not used when adp_anglebc=.true. and newpc4pred=.true.') -215 format('* clw cloud liquid water term') -216 format('* lapse2 temperature lapse rate**2') -217 format('* lapse temperature lapse rate') -218 format('* cos_ssmis cosine term for SSMIS') -219 format('* sin_ssmis sine term for SSMIS') -220 format('* emiss emissivity sensitivity term') -221 format('* 4ordang 4th order angle term') -222 format('* 3ordang 3rd order angle term') -223 format('* 2ordang 2nd order angle term') -224 format('* 1ordang 1st order angle term') - - -! Write data portion of GraDS control file - do i=1,ntype - string = trim(ftype(i)) - write(lunctl,190) adjustl(string),trim(ftype(i)) -190 format(a10,' 0 0 ',a10) - end do - -! Write trminating "endvars" record - write(lunctl,200) -200 format('endvars') - - -! Close ctl file - close(lunctl) - -! Return - return -end subroutine create_ctl_bcoef diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radbcoef.fd/makefile b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radbcoef.fd/makefile deleted file mode 100755 index 549d0ea1ae..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radbcoef.fd/makefile +++ /dev/null @@ -1,48 +0,0 @@ -# ***************************************************************** -# makefile.bcoef -# -# Make the radmon_bcoef.glb executable. The executable will extract -# bcoef radiance data from a diagnostic file from a global run. -# -# ***************************************************************** - -SHELL=/bin/sh -SRCS = kinds.F90 read_diag.f90 bcoef.f90 create_ctl_bcoef.f90 - -OBJS = kinds.o read_diag.o bcoef.o create_ctl_bcoef.o - -# -# ***************************************************************** -# - -#------------ -# Include machine dependent compile & load options -#------------ -MAKE_CONF = Makefile.conf -include $(MAKE_CONF) - - - -CMD = radmon_bcoef - -all: $(CMD) - -clean: - rm -f *.o - rm -f *.mod - rm -f radmon_bcoef - -$(CMD): $(OBJS) - $(CF) $(FFLAGS) $(LDFLAGS) -o $(@) $(OBJS) $(LIBS) - -read_diag.o : read_diag.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -bcoef.o : bcoef.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -create_ctl_bcoef.o : create_ctl_bcoef.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -kinds.o : kinds.F90 - $(CF) $(FFLAGS) -c $(*).F90 diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radbcoef.fd/read_diag.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radbcoef.fd/read_diag.f90 deleted file mode 100755 index 7a4d6cdc49..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radbcoef.fd/read_diag.f90 +++ /dev/null @@ -1,659 +0,0 @@ -!$$$ subprogram documentation block -! . . . . -! subprogram: read_raddiag read rad diag file -! prgmmr: tahara org: np20 date: 2003-01-01 -! -! abstract: This module contains code to process radiance -! diagnostic files. The module defines structures -! to contain information from the radiance -! diagnostic files and then provides two routines -! to access contents of the file. -! -! program history log: -! 2005-07-22 treadon - add this doc block -! 2010-10-05 treadon - refactor code to GSI standard -! 2010-10-08 zhu - use data_tmp to handle various npred values -! 2011-02-22 kleist - changes related to memory allocate/deallocate -! 2011-04-08 li - add tref, dtw, dtc to diag_data_fix_list, add tb_tz to diag_data_chan_list -! - correspondingly, change ireal_radiag (26 -> 30) and ipchan_radiag (7 -> 8) -! 2011-07-24 safford - make structure size for reading data_fix data version dependent -! 2013-11-21 todling - revisit how versions are set (add set/get_radiag) -! 2014-01-27 todling - add ob sensitivity index -! -! contains -! read_radiag_header - read radiance diagnostic file header -! read_radiag_data - read radiance diagnostic file data -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ - -module read_diag - - use kinds, only: i_kind,r_single - implicit none - -! Declare public and private - private - - public :: diag_header_fix_list - public :: diag_header_chan_list - public :: diag_data_name_list - public :: diag_data_fix_list - public :: diag_data_chan_list - public :: diag_data_extra_list - public :: read_radiag_header - public :: read_radiag_data -! public :: iversion_radiag -! public :: iversion_radiag_1 -! public :: iversion_radiag_2 -! public :: iversion_radiag_3 -! public :: iversion_radiag_4 - public :: ireal_radiag - public :: ipchan_radiag - public :: set_radiag - public :: get_radiag - - interface set_radiag - module procedure set_radiag_int_ ! internal procedure for integers - end interface - interface get_radiag - module procedure get_radiag_int_ ! internal procedure for integers - end interface - - integer(i_kind),parameter :: ireal_radiag = 30 ! number of real entries per spot in radiance diagnostic file - integer(i_kind),parameter :: ireal_old_radiag = 26 ! number of real entries per spot in versions older than iversion_radiag_2 - integer(i_kind),parameter :: ipchan_radiag = 8 ! number of entries per channel per spot in radiance diagnostic file - -! Declare structures for radiance diagnostic file information - type diag_header_fix_list - character(len=20) :: isis ! sat and sensor type - character(len=10) :: id ! sat type - character(len=10) :: obstype ! observation type - integer(i_kind) :: jiter ! outer loop counter - integer(i_kind) :: nchan ! number of channels in the sensor - integer(i_kind) :: npred ! number of updating bias correction predictors - integer(i_kind) :: idate ! time (yyyymmddhh) - integer(i_kind) :: ireal ! # of real elements in the fix part of a data record - integer(i_kind) :: ipchan ! # of elements for each channel except for bias correction terms - integer(i_kind) :: iextra ! # of extra elements for each channel - integer(i_kind) :: jextra ! # of extra elements - integer(i_kind) :: idiag ! first dimension of diag_data_chan - integer(i_kind) :: angord ! order of polynomial for adp_anglebc option - integer(i_kind) :: iversion ! radiance diagnostic file version number - integer(i_kind) :: inewpc ! indicator of newpc4pred (1 on, 0 off) - integer(i_kind) :: isens ! sensitivity index - end type diag_header_fix_list - - type diag_data_name_list - character(len=10),dimension(ireal_radiag) :: fix - character(len=10),dimension(:),allocatable :: chn - end type diag_data_name_list - - type diag_header_chan_list - real(r_single) :: freq ! frequency (Hz) - real(r_single) :: polar ! polarization - real(r_single) :: wave ! wave number (cm^-1) - real(r_single) :: varch ! error variance (or SD error?) - real(r_single) :: tlapmean ! mean lapse rate - integer(i_kind):: iuse ! use flag - integer(i_kind):: nuchan ! sensor relative channel number - integer(i_kind):: iochan ! satinfo relative channel number - end type diag_header_chan_list - - type diag_data_fix_list - real(r_single) :: lat ! latitude (deg) - real(r_single) :: lon ! longitude (deg) - real(r_single) :: zsges ! guess elevation at obs location (m) - real(r_single) :: obstime ! observation time relative to analysis - real(r_single) :: senscn_pos ! sensor scan position (integer(i_kind)) - real(r_single) :: satzen_ang ! satellite zenith angle (deg) - real(r_single) :: satazm_ang ! satellite azimuth angle (deg) - real(r_single) :: solzen_ang ! solar zenith angle (deg) - real(r_single) :: solazm_ang ! solar azimumth angle (deg) - real(r_single) :: sungln_ang ! sun glint angle (deg) - real(r_single) :: water_frac ! fractional coverage by water - real(r_single) :: land_frac ! fractional coverage by land - real(r_single) :: ice_frac ! fractional coverage by ice - real(r_single) :: snow_frac ! fractional coverage by snow - real(r_single) :: water_temp ! surface temperature over water (K) - real(r_single) :: land_temp ! surface temperature over land (K) - real(r_single) :: ice_temp ! surface temperature over ice (K) - real(r_single) :: snow_temp ! surface temperature over snow (K) - real(r_single) :: soil_temp ! soil temperature (K) - real(r_single) :: soil_mois ! soil moisture - real(r_single) :: land_type ! land type (integer(i_kind)) - real(r_single) :: veg_frac ! vegetation fraction - real(r_single) :: snow_depth ! snow depth - real(r_single) :: sfc_wndspd ! surface wind speed - real(r_single) :: qcdiag1 ! ir=cloud fraction, mw=cloud liquid water - real(r_single) :: qcdiag2 ! ir=cloud top pressure, mw=total column water - real(r_single) :: tref ! reference temperature (Tr) in NSST - real(r_single) :: dtw ! dt_warm at zob - real(r_single) :: dtc ! dt_cool at zob - real(r_single) :: tz_tr ! d(Tz)/d(Tr) - end type diag_data_fix_list - - type diag_data_chan_list - real(r_single) :: tbobs ! Tb (obs) (K) - real(r_single) :: omgbc ! Tb_(obs) - Tb_(simulated w/ bc) (K) - real(r_single) :: omgnbc ! Tb_(obs) - Tb_(simulated_w/o bc) (K) - real(r_single) :: errinv ! inverse error (K**(-1)) - real(r_single) :: qcmark ! quality control mark - real(r_single) :: emiss ! surface emissivity - real(r_single) :: tlap ! temperature lapse rate - real(r_single) :: tb_tz ! d(Tb)/d(Tz) - real(r_single) :: bicons ! constant bias correction term - real(r_single) :: biang ! scan angle bias correction term - real(r_single) :: biclw ! CLW bias correction term - real(r_single) :: bilap2 ! square lapse rate bias correction term - real(r_single) :: bilap ! lapse rate bias correction term - real(r_single) :: bicos ! node*cos(lat) bias correction term - real(r_single) :: bisin ! sin(lat) bias correction term - real(r_single) :: biemis ! emissivity sensitivity bias correction term - real(r_single),dimension(:),allocatable :: bifix ! angle dependent bias - real(r_single) :: bisst ! SST bias correction term - end type diag_data_chan_list - - type diag_data_extra_list - real(r_single) :: extra ! extra information - end type diag_data_extra_list - - integer(i_kind),save :: iversion_radiag ! Current version (see set routine) - integer(i_kind),parameter:: iversion_radiag_1 = 11104 ! Version when bias-correction entries were modified - integer(i_kind),parameter:: iversion_radiag_2 = 13784 ! Version when NSST entries were added - integer(i_kind),parameter:: iversion_radiag_3 = 19180 ! Version when SSMIS added - integer(i_kind),parameter:: iversion_radiag_4 = 30303 ! Version when emissivity predictor added - - real(r_single),parameter:: rmiss_radiag = -9.9e11_r_single - -contains - -subroutine set_radiag_int_ (what,iv,ier) -character(len=*),intent(in) :: what -integer(i_kind),intent(in) :: iv -integer(i_kind),intent(out):: ier -ier=-1 -if(trim(what)=='version') then - iversion_radiag = iv - ier=0 -endif -end subroutine set_radiag_int_ - -subroutine get_radiag_int_ (what,iv,ier) -character(len=*),intent(in) :: what -integer(i_kind),intent(out):: iv -integer(i_kind),intent(out):: ier -ier=-1 -if(trim(what)=='version') then - iv = iversion_radiag - ier=0 -endif -end subroutine get_radiag_int_ - -subroutine read_radiag_header(ftin,npred_radiag,retrieval,header_fix,header_chan,data_name,iflag,lverbose) -! . . . . -! subprogram: read_diag_header read rad diag header -! prgmmr: tahara org: np20 date: 2003-01-01 -! -! abstract: This routine reads the header record from a radiance -! diagnostic file -! -! program history log: -! 2010-10-05 treadon - add this doc block -! 2011-02-22 kleist - changes related to memory allocation and standard output -! -! input argument list: -! ftin - unit number connected to diagnostic file -! npred_radiag - number of bias correction terms -! retrieval - .true. if sst retrieval -! -! output argument list: -! header_fix - header information structure -! header_chan - channel information structure -! data_name - diag file data names -! iflag - error code -! lverbose - optional flag to turn off default output to standard out -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ - -! Declare passed arguments - integer(i_kind),intent(in) :: ftin - integer(i_kind),intent(in) :: npred_radiag - logical,intent(in) :: retrieval - type(diag_header_fix_list ),intent(out):: header_fix - type(diag_header_chan_list),allocatable :: header_chan(:) - type(diag_data_name_list) :: data_name - integer(i_kind),intent(out) :: iflag - logical,optional,intent(in) :: lverbose - -! Declare local variables - character(len=2):: string - character(len=10):: satid,sentype - character(len=20):: sensat - integer(i_kind) :: i,ich - integer(i_kind):: jiter,nchanl,npred,ianldate,ireal,ipchan,iextra,jextra - integer(i_kind):: idiag,angord,iversion,inewpc,isens - integer(i_kind):: iuse_tmp,nuchan_tmp,iochan_tmp - real(r_single) :: freq_tmp,polar_tmp,wave_tmp,varch_tmp,tlapmean_tmp - logical loutall - - loutall=.true. - if(present(lverbose)) loutall=lverbose - -! Read header (fixed_part). - read(ftin,IOSTAT=iflag) sensat,satid,sentype,jiter,nchanl,npred,ianldate,& - ireal,ipchan,iextra,jextra,idiag,angord,iversion,inewpc,isens - if (iflag/=0) then - rewind(ftin) - read(ftin,IOSTAT=iflag) sensat,satid,sentype,jiter,nchanl,npred,ianldate,& - ireal,ipchan,iextra,jextra,idiag,angord,iversion,inewpc - isens=0 - end if - - if (iflag/=0) then - rewind(ftin) - read(ftin,IOSTAT=iflag) sensat,satid,sentype,jiter,nchanl,npred,ianldate,& - ireal,ipchan,iextra,jextra - idiag=ipchan+npred+1 - angord=0 - iversion=0 - inewpc=0 - isens=0 - if (iflag/=0) then - write(6,*)'READ_RADIAG_HEADER: ***ERROR*** Unknown file format. Cannot read' - return - endif - endif - - header_fix%isis = sensat - header_fix%id = satid - header_fix%obstype = sentype - header_fix%jiter = jiter - header_fix%nchan = nchanl - header_fix%npred = npred - header_fix%idate = ianldate - header_fix%ireal = ireal - header_fix%ipchan = ipchan - header_fix%iextra = iextra - header_fix%jextra = jextra - header_fix%idiag = idiag - header_fix%angord = angord - header_fix%iversion= iversion - header_fix%inewpc = inewpc - header_fix%isens = isens - - if (loutall) then - write(6,*)'READ_RADIAG_HEADER: isis=',header_fix%isis,& - ' nchan=',header_fix%nchan,& - ' npred=',header_fix%npred,& - ' angord=',header_fix%angord,& - ' idiag=',header_fix%idiag,& - ' iversion=',header_fix%iversion,& - ' inewpc=',header_fix%inewpc,& - ' isens=',header_fix%isens - - if ( header_fix%iextra /= 0) & - write(6,*)'READ_RADIAG_HEADER: extra diagnostic information available, ',& - 'iextra=',header_fix%iextra - end if - - if (header_fix%npred /= npred_radiag) & - write(6,*) 'READ_RADIAG_HEADER: **WARNING** header_fix%npred,npred=',& - header_fix%npred,npred_radiag - -! Allocate and initialize as needed - if (allocated(header_chan)) deallocate(header_chan) - if (allocated(data_name%chn)) deallocate(data_name%chn) - - allocate(header_chan( header_fix%nchan)) - allocate(data_name%chn(header_fix%idiag)) - - data_name%fix(1) ='lat ' - data_name%fix(2) ='lon ' - data_name%fix(3) ='zsges ' - data_name%fix(4) ='obstim ' - data_name%fix(5) ='scanpos ' - data_name%fix(6) ='satzen ' - data_name%fix(7) ='satazm ' - data_name%fix(8) ='solzen ' - data_name%fix(9) ='solazm ' - data_name%fix(10)='sungln ' - data_name%fix(11)='fwater ' - data_name%fix(12)='fland ' - data_name%fix(13)='fice ' - data_name%fix(14)='fsnow ' - data_name%fix(15)='twater ' - data_name%fix(16)='tland ' - data_name%fix(17)='tice ' - data_name%fix(18)='tsnow ' - data_name%fix(19)='tsoil ' - data_name%fix(20)='soilmoi ' - data_name%fix(21)='landtyp ' - data_name%fix(22)='vegfrac ' - data_name%fix(23)='snowdep ' - data_name%fix(24)='wndspd ' - data_name%fix(25)='qc1 ' - data_name%fix(26)='qc2 ' - data_name%fix(27)='tref ' - data_name%fix(28)='dtw ' - data_name%fix(29)='dtc ' - data_name%fix(30)='tz_tr ' - - data_name%chn(1)='obs ' - data_name%chn(2)='omgbc ' - data_name%chn(3)='omgnbc ' - data_name%chn(4)='errinv ' - data_name%chn(5)='qcmark ' - data_name%chn(6)='emiss ' - data_name%chn(7)='tlap ' - data_name%chn(8)='tb_tz ' - - if (header_fix%iversion < iversion_radiag_1) then - data_name%chn( 8)= 'bifix ' - data_name%chn( 9)= 'bilap ' - data_name%chn(10)= 'bilap2 ' - data_name%chn(11)= 'bicons ' - data_name%chn(12)= 'biang ' - data_name%chn(13)= 'biclw ' - if (retrieval) data_name%chn(13)= 'bisst ' - elseif ( header_fix%iversion < iversion_radiag_2 .and. header_fix%iversion >= iversion_radiag_1 ) then - data_name%chn( 8)= 'bicons ' - data_name%chn( 9)= 'biang ' - data_name%chn(10)= 'biclw ' - data_name%chn(11)= 'bilap2 ' - data_name%chn(12)= 'bilap ' - do i=1,header_fix%angord - write(string,'(i2.2)') header_fix%angord-i+1 - data_name%chn(12+i)= 'bifix' // string - end do - data_name%chn(12+header_fix%angord+1)= 'bifix ' - data_name%chn(12+header_fix%angord+2)= 'bisst ' - elseif ( header_fix%iversion < iversion_radiag_3 .and. header_fix%iversion >= iversion_radiag_2 ) then - data_name%chn( 9)= 'bicons ' - data_name%chn(10)= 'biang ' - data_name%chn(11)= 'biclw ' - data_name%chn(12)= 'bilap2 ' - data_name%chn(13)= 'bilap ' - do i=1,header_fix%angord - write(string,'(i2.2)') header_fix%angord-i+1 - data_name%chn(13+i)= 'bifix' // string - end do - data_name%chn(13+header_fix%angord+1)= 'bifix ' - data_name%chn(13+header_fix%angord+2)= 'bisst ' - elseif ( header_fix%iversion < iversion_radiag_4 .and. header_fix%iversion >= iversion_radiag_3 ) then - data_name%chn( 9)= 'bicons ' - data_name%chn(10)= 'biang ' - data_name%chn(11)= 'biclw ' - data_name%chn(12)= 'bilap2 ' - data_name%chn(13)= 'bilap ' - data_name%chn(14)= 'bicos ' - data_name%chn(15)= 'bisin ' - do i=1,header_fix%angord - write(string,'(i2.2)') header_fix%angord-i+1 - data_name%chn(15+i)= 'bifix' // string - end do - data_name%chn(15+header_fix%angord+1)= 'bifix ' - data_name%chn(15+header_fix%angord+2)= 'bisst ' - else - data_name%chn( 9)= 'bicons ' - data_name%chn(10)= 'biang ' - data_name%chn(11)= 'biclw ' - data_name%chn(12)= 'bilap2 ' - data_name%chn(13)= 'bilap ' - data_name%chn(14)= 'bicos ' - data_name%chn(15)= 'bisin ' - data_name%chn(16)= 'biemis ' - do i=1,header_fix%angord - write(string,'(i2.2)') header_fix%angord-i+1 - data_name%chn(16+i)= 'bifix' // string - end do - data_name%chn(16+header_fix%angord+1)= 'bifix ' - data_name%chn(16+header_fix%angord+2)= 'bisst ' - endif - -! Read header (channel part) - do ich=1, header_fix%nchan - read(ftin,IOSTAT=iflag) freq_tmp,polar_tmp,wave_tmp,varch_tmp,tlapmean_tmp,iuse_tmp,nuchan_tmp,iochan_tmp - header_chan(ich)%freq = freq_tmp - header_chan(ich)%polar = polar_tmp - header_chan(ich)%wave = wave_tmp - header_chan(ich)%varch = varch_tmp - header_chan(ich)%tlapmean = tlapmean_tmp - header_chan(ich)%iuse = iuse_tmp - header_chan(ich)%nuchan = nuchan_tmp - header_chan(ich)%iochan = iochan_tmp - if (iflag/=0) return - end do - -! Construct array containing menonics for data record entries - - -end subroutine read_radiag_header - -subroutine read_radiag_data(ftin,header_fix,retrieval,data_fix,data_chan,data_extra,iflag ) -! . . . . -! subprogram: read_radiag_dat read rad diag data -! prgmmr: tahara org: np20 date: 2003-01-01 -! -! abstract: This routine reads the data record from a radiance -! diagnostic file -! -! program history log: -! 2010-10-05 treadon - add this doc block -! 2011-02-22 kleist - changes related to memory allocation -! -! input argument list: -! ftin - unit number connected to diagnostic file -! header_fix - header information structure -! -! output argument list: -! data_fix - spot header information structure -! data_chan - spot channel information structure -! data_extra - spot extra information -! iflag - error code -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ - - -! Declare passed arguments - integer(i_kind),intent(in) :: ftin - type(diag_header_fix_list ),intent(in) :: header_fix - logical,intent(in) :: retrieval - type(diag_data_fix_list) ,intent(out):: data_fix - type(diag_data_chan_list) ,allocatable :: data_chan(:) - type(diag_data_extra_list) ,allocatable :: data_extra(:,:) - integer(i_kind),intent(out) :: iflag - - integer(i_kind) :: ich,iang,i,j - real(r_single),dimension(:,:),allocatable :: data_tmp - real(r_single),dimension(:),allocatable :: fix_tmp - real(r_single),dimension(:,:),allocatable :: extra_tmp - -! Allocate arrays as needed - if (allocated(data_chan)) deallocate(data_chan) - allocate(data_chan(header_fix%nchan)) - - do ich=1,header_fix%nchan - if (allocated(data_chan(ich)%bifix)) deallocate(data_chan(ich)%bifix) - allocate(data_chan(ich)%bifix(header_fix%angord+1)) - end do - - if (header_fix%iextra > 0) then - if (allocated(data_extra)) deallocate(data_extra) - allocate(data_extra(header_fix%iextra,header_fix%jextra)) - allocate(extra_tmp(header_fix%iextra,header_fix%jextra)) - end if - -! Allocate arrays to hold data record - allocate(data_tmp(header_fix%idiag,header_fix%nchan)) - - if (header_fix%iversion < iversion_radiag_2) then - allocate( fix_tmp( ireal_old_radiag ) ) - else - allocate( fix_tmp( ireal_radiag ) ) - end if - -! Read data record - - if (header_fix%iextra == 0) then - read(ftin,IOSTAT=iflag) fix_tmp, data_tmp - else - read(ftin,IOSTAT=iflag) fix_tmp, data_tmp, extra_tmp - endif - - -! Transfer fix_tmp record to output structure - data_fix%lat = fix_tmp(1) - data_fix%lon = fix_tmp(2) - data_fix%zsges = fix_tmp(3) - data_fix%obstime = fix_tmp(4) - data_fix%senscn_pos = fix_tmp(5) - data_fix%satzen_ang = fix_tmp(6) - data_fix%satazm_ang = fix_tmp(7) - data_fix%solzen_ang = fix_tmp(8) - data_fix%solazm_ang = fix_tmp(9) - data_fix%sungln_ang = fix_tmp(10) - data_fix%water_frac = fix_tmp(11) - data_fix%land_frac = fix_tmp(12) - data_fix%ice_frac = fix_tmp(13) - data_fix%snow_frac = fix_tmp(14) - data_fix%water_temp = fix_tmp(15) - data_fix%land_temp = fix_tmp(16) - data_fix%ice_temp = fix_tmp(17) - data_fix%snow_temp = fix_tmp(18) - data_fix%soil_temp = fix_tmp(19) - data_fix%soil_mois = fix_tmp(20) - data_fix%land_type = fix_tmp(21) - data_fix%veg_frac = fix_tmp(22) - data_fix%snow_depth = fix_tmp(23) - data_fix%sfc_wndspd = fix_tmp(24) - data_fix%qcdiag1 = fix_tmp(25) - data_fix%qcdiag2 = fix_tmp(26) - - if ( header_fix%iversion <= iversion_radiag_1 ) then - data_fix%tref = rmiss_radiag - data_fix%dtw = rmiss_radiag - data_fix%dtc = rmiss_radiag - data_fix%tz_tr = rmiss_radiag - else - data_fix%tref = fix_tmp(27) - data_fix%dtw = fix_tmp(28) - data_fix%dtc = fix_tmp(29) - data_fix%tz_tr = fix_tmp(30) - end if - - -! Transfer data record to output structure - do ich=1,header_fix%nchan - data_chan(ich)%tbobs =data_tmp(1,ich) - data_chan(ich)%omgbc =data_tmp(2,ich) - data_chan(ich)%omgnbc=data_tmp(3,ich) - data_chan(ich)%errinv=data_tmp(4,ich) - data_chan(ich)%qcmark=data_tmp(5,ich) - data_chan(ich)%emiss =data_tmp(6,ich) - data_chan(ich)%tlap =data_tmp(7,ich) - data_chan(ich)%tb_tz =data_tmp(8,ich) - end do - if (header_fix%iversion < iversion_radiag_1) then - do ich=1,header_fix%nchan - data_chan(ich)%bifix(1)=data_tmp(8,ich) - data_chan(ich)%bilap =data_tmp(9,ich) - data_chan(ich)%bilap2 =data_tmp(10,ich) - data_chan(ich)%bicons =data_tmp(11,ich) - data_chan(ich)%biang =data_tmp(12,ich) - data_chan(ich)%biclw =data_tmp(13,ich) - data_chan(ich)%bisst = rmiss_radiag - if (retrieval) then - data_chan(ich)%biclw =rmiss_radiag - data_chan(ich)%bisst =data_tmp(13,ich) - endif - end do - elseif ( header_fix%iversion < iversion_radiag_2 .and. header_fix%iversion >= iversion_radiag_1 ) then - do ich=1,header_fix%nchan - data_chan(ich)%bicons=data_tmp(8,ich) - data_chan(ich)%biang =data_tmp(9,ich) - data_chan(ich)%biclw =data_tmp(10,ich) - data_chan(ich)%bilap2=data_tmp(11,ich) - data_chan(ich)%bilap =data_tmp(12,ich) - end do - do ich=1,header_fix%nchan - do iang=1,header_fix%angord+1 - data_chan(ich)%bifix(iang)=data_tmp(12+iang,ich) - end do - data_chan(ich)%bisst = data_tmp(12+header_fix%angord+2,ich) - end do - elseif ( header_fix%iversion < iversion_radiag_3 .and. header_fix%iversion >= iversion_radiag_2 ) then - do ich=1,header_fix%nchan - data_chan(ich)%bicons=data_tmp(9,ich) - data_chan(ich)%biang =data_tmp(10,ich) - data_chan(ich)%biclw =data_tmp(11,ich) - data_chan(ich)%bilap2=data_tmp(12,ich) - data_chan(ich)%bilap =data_tmp(13,ich) - end do - do ich=1,header_fix%nchan - do iang=1,header_fix%angord+1 - data_chan(ich)%bifix(iang)=data_tmp(13+iang,ich) - end do - data_chan(ich)%bisst = data_tmp(13+header_fix%angord+2,ich) - end do - elseif ( header_fix%iversion < iversion_radiag_4 .and. header_fix%iversion >= iversion_radiag_3 ) then - do ich=1,header_fix%nchan - data_chan(ich)%bicons=data_tmp(9,ich) - data_chan(ich)%biang =data_tmp(10,ich) - data_chan(ich)%biclw =data_tmp(11,ich) - data_chan(ich)%bilap2=data_tmp(12,ich) - data_chan(ich)%bilap =data_tmp(13,ich) - data_chan(ich)%bicos =data_tmp(14,ich) ! 1st bias correction term node*cos(lat) for SSMIS - data_chan(ich)%bisin =data_tmp(15,ich) ! 2nd bias correction term sin(lat) for SSMI - end do - do ich=1,header_fix%nchan - do iang=1,header_fix%angord+1 - data_chan(ich)%bifix(iang)=data_tmp(15+iang,ich) - end do - data_chan(ich)%bisst = data_tmp(15+header_fix%angord+2,ich) - end do - else - do ich=1,header_fix%nchan - data_chan(ich)%bicons=data_tmp(9,ich) - data_chan(ich)%biang =data_tmp(10,ich) - data_chan(ich)%biclw =data_tmp(11,ich) - data_chan(ich)%bilap2=data_tmp(12,ich) - data_chan(ich)%bilap =data_tmp(13,ich) - data_chan(ich)%bicos =data_tmp(14,ich) - data_chan(ich)%bisin =data_tmp(15,ich) - data_chan(ich)%biemis=data_tmp(16,ich) - end do - do ich=1,header_fix%nchan - do iang=1,header_fix%angord+1 - data_chan(ich)%bifix(iang)=data_tmp(16+iang,ich) - end do - data_chan(ich)%bisst = data_tmp(16+header_fix%angord+2,ich) - end do - endif - - if (header_fix%iextra > 0) then - do j=1,header_fix%jextra - do i=1,header_fix%iextra - data_extra(i,j)%extra=extra_tmp(i,j) - end do - end do - endif - - deallocate(data_tmp, fix_tmp) - if (header_fix%iextra > 0) deallocate(extra_tmp) - -end subroutine read_radiag_data - -end module read_diag - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radbcor.fd/Makefile.conf b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radbcor.fd/Makefile.conf deleted file mode 100755 index 9cba163a3e..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radbcor.fd/Makefile.conf +++ /dev/null @@ -1,26 +0,0 @@ -# This config file contains the compile options for compilation -# of the RadMon code on WCOSS. - -# ---------------------------------- -# Redefine variables for WCOSS -# ---------------------------------- - CORELIB = /nwprod/lib - W3NCO_VER = v2.0.6 - W3NCO_LIB4=$(CORELIB)/w3nco/$(W3NCO_VER)/libw3nco_$(W3NCO_VER)_4.a - -# ---------------------------- -# Fortran compiler and options -# ---------------------------- - - CF = ifort - FC = $(CF) - - FFLAGS = -O3 -fp-model strict -D_REAL8_ -traceback -convert big_endian -assume byterecl - -# ------------------ -# Linker and options -# ------------------ - - LIBS = $(W3NCO_LIB4) - LDFLAGS = - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radbcor.fd/avgsdv.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radbcor.fd/avgsdv.f90 deleted file mode 100755 index 44d1103a97..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radbcor.fd/avgsdv.f90 +++ /dev/null @@ -1,31 +0,0 @@ -subroutine avgsdv(count,sum1,sum2,rmiss) - implicit none - real count,sum1,sum2,rmiss - real avg,sdv,rterm1,rterm2,svar - - if (count>0.) then - rterm1 = 1./count - avg = rterm1*sum1 - if (count>1.) then - rterm2 = 1./(count-1.) - svar = (count*sum2-sum1*sum1)*rterm1*rterm2 - if (svar>0.) then - sdv = sqrt(svar) - else - sdv = rmiss - endif - else - sdv = rmiss - endif - else - count = rmiss - avg = rmiss - sdv = rmiss - endif - - sum1=avg - sum2=sdv - - return -end subroutine avgsdv - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radbcor.fd/bcor.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radbcor.fd/bcor.f90 deleted file mode 100755 index b0d72dc6b3..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radbcor.fd/bcor.f90 +++ /dev/null @@ -1,561 +0,0 @@ -! -! bcor.f90 -! -program bcor - use read_diag - - implicit none - integer ntype,mregion,surf_nregion,max_surf_region - parameter (ntype=30,mregion=25,max_surf_region=5) - integer iglobal, iland, iwater, isnowice, imixed - parameter( iglobal=1, iland=2, iwater=3, isnowice=4, imixed=5 ) - - character(10),dimension(ntype):: ftype - character(20) satname,stringd,satsis,mod_satname - character(10) dum,satype,dplat - character(40) string,diag_rad,data_file,ctl_file - character(40),dimension(max_surf_region):: region - character(10) suffix - - integer luname,lungrd,lunctl,lndiag - integer iyy,imm,idd,ihh,idhh,incr,iread,iflag - integer n_chan,j,idsat,i,k,ii,nsub - integer,dimension(mregion):: jsub - integer,allocatable,dimension(:):: io_chan,nu_chan - integer npred_radiag,angord - - real pen,rread - real weight,rlat,rlon,rmiss,obs,biascor,obsges,obsgesnbc,rterm - real,dimension(2):: cor_total,cor_fixang,cor_lapse,cor_lapse2,& - cor_const,cor_scangl,cor_clw,cor_cos_ssmis,cor_sin_ssmis,& - cor_emiss,cor_ordang4,cor_ordang3,cor_ordang2,cor_ordang1 - - real,dimension(max_surf_region):: rlatmin,rlatmax,rlonmin,rlonmax - - real,allocatable,dimension(:):: wavenumbr - real,allocatable,dimension(:,:):: count,error,use,frequency,penalty - real,allocatable,dimension(:,:,:):: total_cor,fixang_cor,lapse_cor,& - lapse2_cor,const_cor,scangl_cor,clw_cor,cos_ssmis_cor,sin_ssmis_cor,& - emiss_cor,ordang4_cor,ordang3_cor,ordang2_cor,ordang1_cor - - logical no_obs - -! Variables for reading satellite data - type(diag_header_fix_list ) :: header_fix - type(diag_header_chan_list),allocatable :: header_chan(:) - type(diag_data_name_list ) :: data_name - type(diag_data_fix_list ) :: data_fix - type(diag_data_chan_list ),allocatable :: data_chan(:) - type(diag_data_extra_list) ,allocatable :: data_extra(:,:) - - integer nsnow, nland, nwater, nice, nmixed, ntotal - integer nnsnow, nnland, nnwater, nnmixed, nntotal - -! Namelist with defaults - logical :: retrieval = .false. - integer :: nchanl = 19 - integer :: imkctl = 1 - integer :: imkdata = 1 - character(3) :: gesanl = 'ges' - integer :: little_endian = 1 - character(3) :: rad_area = 'glb' - namelist /input/ satname,iyy,imm,idd,ihh,idhh,incr,nchanl,& - suffix,imkctl,imkdata,retrieval,gesanl,little_endian,rad_area - - data luname,lungrd,lunctl,lndiag / 5, 51, 52, 21 / - data rmiss /-999./ - data stringd / '.%y4%m2%d2%h2' / - data ftype / 'count', 'penalty', & - 'avgtotal', 'avgfixang', 'avglapse', 'avglapse2', & - 'avgconst', 'avgscangl', 'avgclw', & - 'avgcos', 'avgsin', 'avgemiss', 'avgordang4', & - 'avgordang3', 'avgordang2', 'avgordang1', & - 'sdvtotal', 'sdvfixang', 'sdvlapse', 'sdvlapse2', & - 'sdvconst', 'sdvscangl', 'sdvclw', & - 'sdvcos', 'sdvsin', 'sdvemiss', 'sdvordang4',& - 'sdvordang3', 'sdvordang2', 'sdvordang1' / - data region / 'global', 'land', 'water', 'ice/snow', 'mixed'/ - data rlonmin / -180., -180., -180., -180., -180./ - data rlonmax / 180., 180., 180., 180., 180./ - data rlatmin / -90., -90., -90., -90., -90./ - data rlatmax / 90., 90., 90., 90., 90./ - - - -!************************************************************************ -! -! Initialize variables - iread=0 - npred_radiag = 12 - -! Read namelist input - read(luname,input) - write(6,input) - write(6,*)'gesanl = ', gesanl - write(6,*)'rad_area = ', rad_area - write(6,*)' ' - - surf_nregion = 5 - if ( trim(rad_area) == 'rgn' ) then - surf_nregion = 1 - endif - - write(6,*)'surf_nregion = ', surf_nregion - - -! Ensure number of requested regions does not exceed specified upper limit - if (surf_nregion>mregion) then - write(6,*)'***ERROR*** too many regions specified' - write(6,*)' maximum allowed: mregion=',mregion - write(6,*)' user requested: surf_nregion=',surf_nregion - call errexit(91) - endif - - -! Create filenames for diagnostic input, binary output file - write(stringd,100) iyy,imm,idd,ihh -100 format('.',i4.4,3i2.2) - - if ( trim(gesanl) == 'ges' ) then - diag_rad = trim(satname) - data_file= trim(satname) // trim(stringd) // '.ieee_d' - ctl_file = trim(satname) // '.ctl' - else - diag_rad = trim(satname) // '_anl' - data_file= trim(satname) // '_anl' // trim(stringd) // '.ieee_d' - ctl_file = trim(satname) // '_anl.ctl' - endif - - write(6,*)'diag_rad =',diag_rad - write(6,*)'data_file=',data_file - write(6,*)'ctl_file =',ctl_file - write(6,*)'suffix =',suffix - - -! Open unit to diagnostic file. Read portion of header to -! see if file exists - open(lndiag,file=diag_rad,form='unformatted') - read(lndiag,err=900,end=900) dum - rewind lndiag - -! File exists. Read header - write(6,*)'call read_diag_header' - call read_radiag_header( lndiag, npred_radiag, retrieval, header_fix,& - header_chan, data_name, iflag ) - if( iflag/=0 ) then - write(6,*)'***ERROR*** problem reading diag file header, iflag=',iflag - call errexit(91) - endif - -! Extract observation type, satellite id, and number of channels - satype = header_fix%obstype - satsis = header_fix%isis - dplat = header_fix%id - n_chan = header_fix%nchan - angord = header_fix%angord - - write(6,*)'satype,dplat,n_chan,angord=',satype,' ',dplat,n_chan,angord - - string = trim(satype)//'_'//trim(dplat) - write(6,*)'string,satname=',string,' ',satname - if ( trim(string) /= trim(satname) ) then - write(6,*)'***ERROR*** inconsistent instrument types' - write(6,*)' satname,string =',satname,' ',string - call errexit(92) - endif - - -! Allocate arrays to hold observational information - write(6,*)' ' - write(6,*)'allocate arrays' - allocate (io_chan(n_chan), nu_chan(n_chan), wavenumbr(n_chan)) - allocate (total_cor(n_chan,mregion,2), fixang_cor(n_chan,mregion,2), & - lapse_cor(n_chan,mregion,2), lapse2_cor(n_chan,mregion,2), & - const_cor(n_chan,mregion,2), scangl_cor(n_chan,mregion,2), & - clw_cor(n_chan,mregion,2), cos_ssmis_cor(n_chan,mregion,2), & - sin_ssmis_cor(n_chan,mregion,2), emiss_cor(n_chan,mregion,2), & - ordang4_cor(n_chan,mregion,2), ordang3_cor(n_chan,mregion,2), & - ordang2_cor(n_chan,mregion,2), ordang1_cor(n_chan,mregion,2), & - count(n_chan,mregion), penalty(n_chan,mregion), & - error(n_chan,mregion), use(n_chan,mregion), & - frequency(n_chan,mregion)) - -! Zero accumulator arrays - do ii=1,2 - do k=1,mregion - do j=1,n_chan - if (ii==1) then - count(j,k) = 0.0 - penalty(j,k) = 0.0 - endif - total_cor(j,k,ii) = 0.0 - fixang_cor(j,k,ii) = 0.0 - lapse_cor(j,k,ii) = 0.0 - lapse2_cor(j,k,ii) = 0.0 - const_cor(j,k,ii) = 0.0 - scangl_cor(j,k,ii) = 0.0 - clw_cor(j,k,ii) = 0.0 - cos_ssmis_cor(j,k,ii) = 0.0 - sin_ssmis_cor(j,k,ii) = 0.0 - emiss_cor(j,k,ii) = 0.0 - ordang4_cor(j,k,ii) = 0.0 - ordang3_cor(j,k,ii) = 0.0 - ordang2_cor(j,k,ii) = 0.0 - ordang1_cor(j,k,ii) = 0.0 - end do - end do - end do - - -! Extract satinfo relative index - do j=1,n_chan - nu_chan(j) = real( header_chan(j)%nuchan, 4 ) - io_chan(j) = real( header_chan(j)%iochan, 4 ) - wavenumbr(j) = real( header_chan(j)%wave, 4 ) - end do - do k=1,mregion - do j=1,n_chan - error(j,k) = real( header_chan(j)%varch, 4) - use(j,k) = real( header_chan(j)%iuse, 4 ) - frequency(j,k) = real( header_chan(j)%freq, 4) - end do - end do - - -! Create GrADS control file - if ( imkctl == 1 ) then - write(6,*)'call create_ctl_bcor' - - if ( trim(gesanl) == 'ges' ) then - mod_satname = trim(satname) - else - mod_satname = trim(satname) // '_anl' - endif - - - call create_ctl_bcor(ntype,ftype,n_chan,iyy,imm,idd,ihh,idhh,& - incr,ctl_file,lunctl,rmiss,mod_satname,satype,dplat,surf_nregion,& - region,rlonmin,rlonmax,rlatmin,rlatmax,nu_chan,use(1,1),error(1,1),& - frequency(1,1),wavenumbr,little_endian) - - endif - - nwater = 0; nnwater = 0 - nland = 0; nnland = 0 - nsnow = 0; nnsnow = 0 - nice = 0 - nmixed = 0; nnmixed = 0 - ntotal = 0 - -! Loop to read entries in diagnostic file - if ( imkdata == 1 ) then - iflag = 0 - loopd: do while (iflag == 0) - -! Read a record. If read flag, iflag does not equal zero, exit loopd - call read_radiag_data( lndiag, header_fix, retrieval, data_fix, data_chan,& - data_extra, iflag ) - if( iflag /= 0 ) exit loopd - iread=iread+1 - -! Extract obervation location and mpi weight. Convert (0-360) lon to (-180,180) - rlat = data_fix%lat - rlon = data_fix%lon - if (rlon>180.) rlon = rlon - 360. - rread = rread + 1.0 - - ntotal = ntotal + 1 - jsub(1)= iglobal - nsub = 1 - - if ( surf_nregion > 1 ) then - if ( data_fix%water_frac > 0.99 ) then - nwater = nwater + 1 - else if ( data_fix%land_frac > 0.99 ) then - nland = nland + 1 - else if ( data_fix%snow_frac > 0.99 ) then - nsnow = nsnow + 1 - else if ( data_fix%ice_frac > 0.99 ) then - nice = nice + 1 - else - nmixed = nmixed + 1 - end if - - - -! Detemine into which subdomains the observation falls. -! These are now based on surface type, not geography. All -! obs match global (surf_region 1). -! - ii=0; -!jsub=0; - if ( data_fix%land_frac > 0.99 ) then - jsub(2)=iland - nsub=2 - nnland=nnland+1 - else if ( data_fix%water_frac > 0.99 ) then - jsub(2)=iwater - nsub=2 - nnwater=nnwater+1 - else if (( data_fix%snow_frac > 0.99 ) .OR. ( data_fix%ice_frac > 0.99 )) then - jsub(2)=isnowice - nsub=2 - nnsnow=nnsnow+1 - else - jsub(2)=imixed - nsub=2 - nnmixed=nnmixed+1 - write(6,*)'data_fix%land_frac,water,snow,ice = ',data_fix%land_frac, data_fix%water_frac, data_fix%snow_frac, data_fix%ice_frac - end if - end if - - -! Channel loop - do j = 1, n_chan - -! If observation was assimilated, accumulate sums in appropriate regions - if (data_chan(j)%errinv > 1.e-6) then - pen = data_chan(j)%errinv*(data_chan(j)%omgbc)**2 - cor_total(1) = (data_chan(j)%omgnbc - data_chan(j)%omgbc) - cor_fixang(1) = data_chan(j)%bifix(angord+1) - cor_lapse(1) = data_chan(j)%bilap - cor_lapse2(1) = data_chan(j)%bilap2 - cor_const(1) = data_chan(j)%bicons - cor_scangl(1) = data_chan(j)%biang - cor_clw(1) = data_chan(j)%biclw - cor_cos_ssmis(1) = data_chan(j)%bicos - cor_sin_ssmis(1) = data_chan(j)%bisin - cor_emiss(1) = data_chan(j)%biemis - if (angord >= 4 ) then - cor_ordang4(1) = data_chan(j)%bifix(1) - cor_ordang3(1) = data_chan(j)%bifix(2) - cor_ordang2(1) = data_chan(j)%bifix(3) - cor_ordang1(1) = data_chan(j)%bifix(4) - else - cor_ordang4(1) = 0.0 - cor_ordang3(1) = 0.0 - cor_ordang2(1) = 0.0 - cor_ordang1(1) = 0.0 - endif -! do i=1,angord -! cor_ordang4 -! write(string,'(i2.2)') header_fix%angord-i+1 -! data_name%chn(15+i)= 'bifix' // string -! end do - - - cor_total(2) = (data_chan(j)%omgnbc - data_chan(j)%omgbc)**2 - cor_fixang(2) = (data_chan(j)%bifix(angord+1))**2 - cor_lapse(2) = (data_chan(j)%bilap)**2 - cor_lapse2(2) = (data_chan(j)%bilap2)**2 - cor_const(2) = (data_chan(j)%bicons)**2 - cor_scangl(2) = (data_chan(j)%biang)**2 - cor_clw(2) = (data_chan(j)%biclw)**2 - cor_cos_ssmis(2) = data_chan(j)%bicos**2 - cor_sin_ssmis(2) = data_chan(j)%bisin**2 - cor_emiss(2) = data_chan(j)%biemis**2 - if (angord >= 4 ) then - cor_ordang4(1) = data_chan(j)%bifix(1)**2 - cor_ordang3(1) = data_chan(j)%bifix(2)**2 - cor_ordang2(1) = data_chan(j)%bifix(3)**2 - cor_ordang1(1) = data_chan(j)%bifix(4)**2 - else - cor_ordang4(2) = 0.0 - cor_ordang3(2) = 0.0 - cor_ordang2(2) = 0.0 - cor_ordang1(2) = 0.0 - end if - - do i=1,nsub - k=jsub(i) - count(j,k) = count(j,k) +1.0 - penalty(j,k) = penalty(j,k) + pen - - do ii=1,2 - total_cor(j,k,ii) = total_cor(j,k,ii) + cor_total(ii) - fixang_cor(j,k,ii) = fixang_cor(j,k,ii) + cor_fixang(ii) - lapse_cor(j,k,ii) = lapse_cor(j,k,ii) + cor_lapse(ii) - lapse2_cor(j,k,ii) = lapse2_cor(j,k,ii) + cor_lapse2(ii) - const_cor(j,k,ii) = const_cor(j,k,ii) + cor_const(ii) - scangl_cor(j,k,ii) = scangl_cor(j,k,ii) + cor_scangl(ii) - clw_cor(j,k,ii) = clw_cor(j,k,ii) + cor_clw(ii) - cos_ssmis_cor(j,k,ii) = cos_ssmis_cor(j,k,ii) + cor_cos_ssmis(ii) - sin_ssmis_cor(j,k,ii) = sin_ssmis_cor(j,k,ii) + cor_sin_ssmis(ii) - emiss_cor(j,k,ii) = emiss_cor(j,k,ii) + cor_emiss(ii) - ordang4_cor(j,k,ii) = ordang4_cor(j,k,ii) + cor_ordang4(ii) - ordang3_cor(j,k,ii) = ordang3_cor(j,k,ii) + cor_ordang3(ii) - ordang2_cor(j,k,ii) = ordang2_cor(j,k,ii) + cor_ordang2(ii) - ordang1_cor(j,k,ii) = ordang1_cor(j,k,ii) + cor_ordang1(ii) - end do - - end do - endif - - enddo ! channel loop - -! End of loop over diagnostic file - enddo loopd - close(lndiag) - write(6,*)' ' - write(6,*)'read in ',iread,' obs ',rread - write(6,*)' ' - - write(6,*)'nwater, nland, nice, nsnow, nmixed, ntotal = ', nwater, nland, nice, nsnow, nmixed, ntotal - nntotal=nnwater+nnland+nnsnow+nnmixed - write(6,*)'nnwater, nnland, nnsnow, nnmixed, nntotal = ', nnwater, nnland, nnsnow, nnmixed, nntotal - -! Compute average and standard deviation - do k=1,surf_nregion - do j=1,n_chan - call avgsdv(count(j,k),total_cor(j,k,1), total_cor(j,k,2), rmiss) - call avgsdv(count(j,k),fixang_cor(j,k,1), fixang_cor(j,k,2), rmiss) - call avgsdv(count(j,k),lapse_cor(j,k,1), lapse_cor(j,k,2), rmiss) - call avgsdv(count(j,k),lapse2_cor(j,k,1), lapse2_cor(j,k,2), rmiss) - call avgsdv(count(j,k),const_cor(j,k,1), const_cor(j,k,2), rmiss) - call avgsdv(count(j,k),scangl_cor(j,k,1), scangl_cor(j,k,2), rmiss) - call avgsdv(count(j,k),clw_cor(j,k,1), clw_cor(j,k,2), rmiss) - call avgsdv(count(j,k),cos_ssmis_cor(j,k,1), cos_ssmis_cor(j,k,2), rmiss) - call avgsdv(count(j,k),sin_ssmis_cor(j,k,1), sin_ssmis_cor(j,k,2), rmiss) - call avgsdv(count(j,k),emiss_cor(j,k,1), emiss_cor(j,k,2), rmiss) - call avgsdv(count(j,k),ordang4_cor(j,k,1), ordang4_cor(j,k,2), rmiss) - call avgsdv(count(j,k),ordang3_cor(j,k,1), ordang3_cor(j,k,2), rmiss) - call avgsdv(count(j,k),ordang2_cor(j,k,1), ordang2_cor(j,k,2), rmiss) - call avgsdv(count(j,k),ordang1_cor(j,k,1), ordang1_cor(j,k,2), rmiss) - - if (count(j,k)>0) then - penalty(j,k)=penalty(j,k)/count(j,k) - else - count(j,k)=rmiss - penalty(j,k)=rmiss - endif - end do - end do - -! Write output to binary output file - write(6,*)' ' - open(lungrd,file=data_file,form='unformatted') - write(lungrd) ((count(j,k),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((penalty(j,k),j=1,n_chan),k=1,surf_nregion) - do ii=1,2 - write(lungrd) ((total_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((fixang_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((lapse_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((lapse2_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((const_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((scangl_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((clw_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((cos_ssmis_cor(j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((sin_ssmis_cor(j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((emiss_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((ordang4_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((ordang3_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((ordang2_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((ordang1_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - end do - write(6,*)'write output to lungrd=',lungrd,', file=',trim(data_file) - close(lungrd) - endif - -! Deallocate arrays - write(6,*)' ' - write(6,*)'deallocate arrays' - if(allocated(io_chan)) deallocate (io_chan) - if(allocated(nu_chan)) deallocate (nu_chan) - if(allocated(wavenumbr)) deallocate (wavenumbr) - if(allocated(total_cor)) deallocate (total_cor) - if(allocated(fixang_cor)) deallocate (fixang_cor) - if(allocated(lapse_cor)) deallocate (lapse_cor) - if(allocated(lapse2_cor)) deallocate (lapse2_cor) - if(allocated(const_cor)) deallocate (const_cor) - if(allocated(scangl_cor)) deallocate (scangl_cor) - if(allocated(clw_cor)) deallocate (clw_cor) - if(allocated(cos_ssmis_cor)) deallocate (cos_ssmis_cor) - if(allocated(sin_ssmis_cor)) deallocate (sin_ssmis_cor) - if(allocated(emiss_cor)) deallocate (emiss_cor) - if(allocated(ordang4_cor)) deallocate (ordang4_cor) - if(allocated(ordang3_cor)) deallocate (ordang3_cor) - if(allocated(ordang2_cor)) deallocate (ordang2_cor) - if(allocated(ordang1_cor)) deallocate (ordang1_cor) - if(allocated(count)) deallocate (count) - if(allocated(penalty)) deallocate (penalty) - if(allocated(error)) deallocate (error) - if(allocated(use)) deallocate (use) - if(allocated(frequency)) deallocate (frequency) - - -! deallocate(io_chan,nu_chan,wavenumbr,total_cor,fixang_cor,lapse_cor,& -! lapse2_cor,const_cor,scangl_cor,clw_cor,count,penalty,error,use,& -! frequency) - - write(6,*)'deallocated arrays' - goto 950 - -! Jump to here if eof or error reading diagnostic file. -900 continue - write(6,*)'***PROBLEM reading diagnostic file. diag_rad=',diag_rad - close(lndiag) - - n_chan=nchanl - if (n_chan<=0) then - write(6,*)'***ERROR*** invalid nchanl=',nchanl,' STOP program' - call errexit(93) - endif - - write(6,*)'load missing value ',rmiss,' into output arrays. ',& - surf_nregion,n_chan - allocate(count(n_chan,surf_nregion),penalty(n_chan,surf_nregion)) - allocate(total_cor(n_chan,mregion,2), fixang_cor(n_chan,mregion,2), & - lapse_cor(n_chan,mregion,2), lapse2_cor(n_chan,mregion,2), & - const_cor(n_chan,mregion,2), scangl_cor(n_chan,mregion,2), & - clw_cor(n_chan,mregion,2)) - - write(6,*)'load missing value ',rmiss,' into output arrays' - do ii=1,2 - do k=1,surf_nregion - do j=1,n_chan - if (ii==1) then - count(j,k) =rmiss - penalty(j,k)=rmiss - endif - total_cor(j,k,ii) =rmiss - fixang_cor(j,k,ii)=rmiss - lapse_cor(j,k,ii) =rmiss - lapse2_cor(j,k,ii)=rmiss - const_cor(j,k,ii) =rmiss - scangl_cor(j,k,ii)=rmiss - clw_cor(j,k,ii) =rmiss - end do - end do - end do - - if ( imkdata == 1 ) then - open(lungrd,file=data_file,form='unformatted') - write(lungrd) ((count(j,k),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((penalty(j,k),j=1,n_chan),k=1,surf_nregion) - do ii=1,2 - write(lungrd) ((total_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((fixang_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((lapse_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((lapse2_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((const_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((scangl_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((clw_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((cos_ssmis_cor(j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((sin_ssmis_cor(j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((emiss_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((ordang4_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((ordang3_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((ordang2_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((ordang1_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - end do - write(6,*)'write output to lungrd=',lungrd,', file=',trim(data_file) - close(lungrd) - endif - deallocate(count,penalty,total_cor,fixang_cor,lapse_cor,lapse2_cor,& - const_cor,scangl_cor,clw_cor) - -! End of program -950 continue - write(6,*) 'exiting program bcor' - stop -end program bcor diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radbcor.fd/create_ctl_bcor.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radbcor.fd/create_ctl_bcor.f90 deleted file mode 100755 index e312247953..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radbcor.fd/create_ctl_bcor.f90 +++ /dev/null @@ -1,163 +0,0 @@ -subroutine create_ctl_bcor(ntype,ftype,n_chan,iyy,imm,idd,ihh,idhh,& - incr,ctl_file,lunctl,rmiss,satname,satype,dplat,nregion,& - region,rlonmin,rlonmax,rlatmin,rlatmax,nu_chan,use,error,& - frequency,wavenumbr,little_endian) - - implicit none - - integer ntype - - character(2) cword - character(3),dimension(12):: mon - character(3):: clatmin,clatmax - character(4):: clonmin,clonmax - character(10),dimension(ntype):: ftype - character(13) stringd - character(20) satname - character(10) satype,dplat - character(40) ctl_file,grad_file - character(80) string - character(40),dimension(nregion):: region - character(80),dimension(nregion):: stringr - - integer idsat,nregion,iuse,little_endian - integer lunctl,iyy,imm,idd,ihh,j,i,n_chan,idhh,incr - integer iyy2,imm2,idd2,ihh2,ntime - integer,dimension(8):: ida,jda - integer,dimension(n_chan):: nu_chan - - real rmiss,wavelength - real,dimension(5):: fha - real,dimension(n_chan):: error,use,frequency,wavenumbr - real,dimension(nregion):: rlonmin,rlonmax,rlatmin,rlatmax - - data stringd / '.%y4%m2%d2%h2' / - data mon / 'jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', & - 'aug', 'sep', 'oct', 'nov', 'dec' / - -!************************************************************************** -! Create date for tdef based on given date and hour offset - fha=0.0; ida=0; jda=0; ntime=0 - iyy2=iyy; imm2=imm; idd2=idd; ihh2=ihh - if (idhh/=0) then - ntime = abs(idhh)/incr - fha(2)=idhh - ida(1)=iyy - ida(2)=imm - ida(3)=idd - ida(4)=0 - ida(5)=ihh - call w3movdat(fha,ida,jda) - iyy2=jda(1) - imm2=jda(2) - idd2=jda(3) - ihh2=jda(5) - endif - ntime=ntime+1 - -! Open unit to GrADS control file - open(lunctl,file=ctl_file,form='formatted') - -!******************************************************************* -! Construct the region strings if this is for a global source, -! which is defined as nregion > 1. -! - if (nregion > 1) then - - do i=1,nregion - if (rlatmin(i)>0.) then - write(clatmin,10) int(rlatmin(i)) - else - write(clatmin,20) abs(int(rlatmin(i))) - endif - if (rlatmax(i)>0.) then - write(clatmax,10) int(rlatmax(i)) - else - write(clatmax,20) abs(int(rlatmax(i))) - endif - if (rlonmin(i)>0.) then - write(clonmin,30) int(rlonmin(i)) - else - write(clonmin,40) abs(int(rlonmin(i))) - endif - if (rlonmax(i)>0.) then - write(clonmax,30) int(rlonmax(i)) - else - write(clonmax,40) abs(int(rlonmax(i))) - endif - stringr(i) = trim(region(i)) // ' (' // & - trim(clonmin) // '-' // trim(clonmax) // ', ' // & - trim(clatmin) // '-' // trim(clatmax) // ')' - end do - endif -10 format(i2,'N') -20 format(i2,'S') -30 format(i3,'E') -40 format(i3,'W') - -! Write header information - grad_file = trim(satname) // stringd // '.ieee_d' - write(lunctl,100) grad_file - if ( little_endian == 1 ) then - write(lunctl,112) - else - write(lunctl,110) - endif - write(lunctl,120) rmiss - write(lunctl,130) adjustl(satype),dplat,n_chan - write(lunctl,132) - do i=1,n_chan - iuse = nint(use(i)) - wavelength = 10000./wavenumbr(i) - write(lunctl,134) i,nu_chan(i),iuse,error(i),wavelength,frequency(i) - end do - write(lunctl,136) - - if (nregion > 1) then - do i=1,nregion - write(cword,'(i2)') i - string = '* region=' // cword // ' ' // trim(stringr(i)) - write(lunctl,138) string - end do - endif - - write(lunctl,140) n_chan - write(lunctl,150) nregion - write(lunctl,160) - write(lunctl,170) ntime,ihh2,idd2,mon(imm2),iyy2 - write(lunctl,180) ntype - -100 format('dset ^',a40) -110 format('options template big_endian sequential') -112 format('options template little_endian sequential') -120 format('undef ',f5.0) -130 format('title ',a10,1x,a10,1x,i4) -132 format('*XDEF is channel number') -134 format('* x= ',i4,', channel= ',i4,' , iuse= ',i2,' , error= ',f8.3,& - ' , wlth= ',f9.2,' , freq= ',f9.2) -136 format('*YDEF is geographic region') -138 format(a80) -140 format('xdef ',i4,' linear 1.0 1.0') -150 format('ydef ',i2,' linear 1.0 1.0') -160 format('zdef 1 linear 1.0 1.0') -170 format('tdef ',i4,' linear ',i2.2,'Z',i2.2,a3,i4.4,' 06hr') -180 format('vars ',i7) - -! Write data portion of GraDS control file - do i=1,ntype - string = trim(ftype(i)) - write(lunctl,190) adjustl(string),trim(ftype(i)) -190 format(a10,' 0 0 ',a10) - end do - -! Write trminating "endvars" record - write(lunctl,200) -200 format('endvars') - - -! Close ctl file - close(lunctl) - -! Return - return -end subroutine create_ctl_bcor diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radbcor.fd/makefile b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radbcor.fd/makefile deleted file mode 100755 index 6b9b22d1ae..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radbcor.fd/makefile +++ /dev/null @@ -1,50 +0,0 @@ -# ***************************************************************** -# makefile.bcor -# -# Make the radmon_bcor.glb executable. The executable will extract -# bcor radiance data from a diagnostic file from a global run. -# -# ***************************************************************** - -SHELL=/bin/sh -SRCS = kinds.F90 read_diag.f90 bcor.f90 avgsdv.f90 create_ctl_bcor.f90 - -OBJS = kinds.o read_diag.o bcor.o avgsdv.o create_ctl_bcor.o - -# -# ***************************************************************** -# - -#------------ -# Include machine dependent compile & load options -#------------ -MAKE_CONF = Makefile.conf -include $(MAKE_CONF) - - -CMD = radmon_bcor - -all: $(CMD) - -clean: - rm -f *.o - rm -f *.mod - rm -f radmon_bcor - -$(CMD): $(OBJS) - $(CF) $(FFLAGS) $(LDFLAGS) -o $(@) $(OBJS) $(LIBS) - -read_diag.o : read_diag.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -bcor.o : bcor.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -avgsdv.o : avgsdv.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -create_ctl_bcor.o : create_ctl_bcor.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -kinds.o : kinds.F90 - $(CF) $(FFLAGS) -c $(*).F90 diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radbcor.fd/read_diag.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radbcor.fd/read_diag.f90 deleted file mode 100755 index 7a4d6cdc49..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radbcor.fd/read_diag.f90 +++ /dev/null @@ -1,659 +0,0 @@ -!$$$ subprogram documentation block -! . . . . -! subprogram: read_raddiag read rad diag file -! prgmmr: tahara org: np20 date: 2003-01-01 -! -! abstract: This module contains code to process radiance -! diagnostic files. The module defines structures -! to contain information from the radiance -! diagnostic files and then provides two routines -! to access contents of the file. -! -! program history log: -! 2005-07-22 treadon - add this doc block -! 2010-10-05 treadon - refactor code to GSI standard -! 2010-10-08 zhu - use data_tmp to handle various npred values -! 2011-02-22 kleist - changes related to memory allocate/deallocate -! 2011-04-08 li - add tref, dtw, dtc to diag_data_fix_list, add tb_tz to diag_data_chan_list -! - correspondingly, change ireal_radiag (26 -> 30) and ipchan_radiag (7 -> 8) -! 2011-07-24 safford - make structure size for reading data_fix data version dependent -! 2013-11-21 todling - revisit how versions are set (add set/get_radiag) -! 2014-01-27 todling - add ob sensitivity index -! -! contains -! read_radiag_header - read radiance diagnostic file header -! read_radiag_data - read radiance diagnostic file data -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ - -module read_diag - - use kinds, only: i_kind,r_single - implicit none - -! Declare public and private - private - - public :: diag_header_fix_list - public :: diag_header_chan_list - public :: diag_data_name_list - public :: diag_data_fix_list - public :: diag_data_chan_list - public :: diag_data_extra_list - public :: read_radiag_header - public :: read_radiag_data -! public :: iversion_radiag -! public :: iversion_radiag_1 -! public :: iversion_radiag_2 -! public :: iversion_radiag_3 -! public :: iversion_radiag_4 - public :: ireal_radiag - public :: ipchan_radiag - public :: set_radiag - public :: get_radiag - - interface set_radiag - module procedure set_radiag_int_ ! internal procedure for integers - end interface - interface get_radiag - module procedure get_radiag_int_ ! internal procedure for integers - end interface - - integer(i_kind),parameter :: ireal_radiag = 30 ! number of real entries per spot in radiance diagnostic file - integer(i_kind),parameter :: ireal_old_radiag = 26 ! number of real entries per spot in versions older than iversion_radiag_2 - integer(i_kind),parameter :: ipchan_radiag = 8 ! number of entries per channel per spot in radiance diagnostic file - -! Declare structures for radiance diagnostic file information - type diag_header_fix_list - character(len=20) :: isis ! sat and sensor type - character(len=10) :: id ! sat type - character(len=10) :: obstype ! observation type - integer(i_kind) :: jiter ! outer loop counter - integer(i_kind) :: nchan ! number of channels in the sensor - integer(i_kind) :: npred ! number of updating bias correction predictors - integer(i_kind) :: idate ! time (yyyymmddhh) - integer(i_kind) :: ireal ! # of real elements in the fix part of a data record - integer(i_kind) :: ipchan ! # of elements for each channel except for bias correction terms - integer(i_kind) :: iextra ! # of extra elements for each channel - integer(i_kind) :: jextra ! # of extra elements - integer(i_kind) :: idiag ! first dimension of diag_data_chan - integer(i_kind) :: angord ! order of polynomial for adp_anglebc option - integer(i_kind) :: iversion ! radiance diagnostic file version number - integer(i_kind) :: inewpc ! indicator of newpc4pred (1 on, 0 off) - integer(i_kind) :: isens ! sensitivity index - end type diag_header_fix_list - - type diag_data_name_list - character(len=10),dimension(ireal_radiag) :: fix - character(len=10),dimension(:),allocatable :: chn - end type diag_data_name_list - - type diag_header_chan_list - real(r_single) :: freq ! frequency (Hz) - real(r_single) :: polar ! polarization - real(r_single) :: wave ! wave number (cm^-1) - real(r_single) :: varch ! error variance (or SD error?) - real(r_single) :: tlapmean ! mean lapse rate - integer(i_kind):: iuse ! use flag - integer(i_kind):: nuchan ! sensor relative channel number - integer(i_kind):: iochan ! satinfo relative channel number - end type diag_header_chan_list - - type diag_data_fix_list - real(r_single) :: lat ! latitude (deg) - real(r_single) :: lon ! longitude (deg) - real(r_single) :: zsges ! guess elevation at obs location (m) - real(r_single) :: obstime ! observation time relative to analysis - real(r_single) :: senscn_pos ! sensor scan position (integer(i_kind)) - real(r_single) :: satzen_ang ! satellite zenith angle (deg) - real(r_single) :: satazm_ang ! satellite azimuth angle (deg) - real(r_single) :: solzen_ang ! solar zenith angle (deg) - real(r_single) :: solazm_ang ! solar azimumth angle (deg) - real(r_single) :: sungln_ang ! sun glint angle (deg) - real(r_single) :: water_frac ! fractional coverage by water - real(r_single) :: land_frac ! fractional coverage by land - real(r_single) :: ice_frac ! fractional coverage by ice - real(r_single) :: snow_frac ! fractional coverage by snow - real(r_single) :: water_temp ! surface temperature over water (K) - real(r_single) :: land_temp ! surface temperature over land (K) - real(r_single) :: ice_temp ! surface temperature over ice (K) - real(r_single) :: snow_temp ! surface temperature over snow (K) - real(r_single) :: soil_temp ! soil temperature (K) - real(r_single) :: soil_mois ! soil moisture - real(r_single) :: land_type ! land type (integer(i_kind)) - real(r_single) :: veg_frac ! vegetation fraction - real(r_single) :: snow_depth ! snow depth - real(r_single) :: sfc_wndspd ! surface wind speed - real(r_single) :: qcdiag1 ! ir=cloud fraction, mw=cloud liquid water - real(r_single) :: qcdiag2 ! ir=cloud top pressure, mw=total column water - real(r_single) :: tref ! reference temperature (Tr) in NSST - real(r_single) :: dtw ! dt_warm at zob - real(r_single) :: dtc ! dt_cool at zob - real(r_single) :: tz_tr ! d(Tz)/d(Tr) - end type diag_data_fix_list - - type diag_data_chan_list - real(r_single) :: tbobs ! Tb (obs) (K) - real(r_single) :: omgbc ! Tb_(obs) - Tb_(simulated w/ bc) (K) - real(r_single) :: omgnbc ! Tb_(obs) - Tb_(simulated_w/o bc) (K) - real(r_single) :: errinv ! inverse error (K**(-1)) - real(r_single) :: qcmark ! quality control mark - real(r_single) :: emiss ! surface emissivity - real(r_single) :: tlap ! temperature lapse rate - real(r_single) :: tb_tz ! d(Tb)/d(Tz) - real(r_single) :: bicons ! constant bias correction term - real(r_single) :: biang ! scan angle bias correction term - real(r_single) :: biclw ! CLW bias correction term - real(r_single) :: bilap2 ! square lapse rate bias correction term - real(r_single) :: bilap ! lapse rate bias correction term - real(r_single) :: bicos ! node*cos(lat) bias correction term - real(r_single) :: bisin ! sin(lat) bias correction term - real(r_single) :: biemis ! emissivity sensitivity bias correction term - real(r_single),dimension(:),allocatable :: bifix ! angle dependent bias - real(r_single) :: bisst ! SST bias correction term - end type diag_data_chan_list - - type diag_data_extra_list - real(r_single) :: extra ! extra information - end type diag_data_extra_list - - integer(i_kind),save :: iversion_radiag ! Current version (see set routine) - integer(i_kind),parameter:: iversion_radiag_1 = 11104 ! Version when bias-correction entries were modified - integer(i_kind),parameter:: iversion_radiag_2 = 13784 ! Version when NSST entries were added - integer(i_kind),parameter:: iversion_radiag_3 = 19180 ! Version when SSMIS added - integer(i_kind),parameter:: iversion_radiag_4 = 30303 ! Version when emissivity predictor added - - real(r_single),parameter:: rmiss_radiag = -9.9e11_r_single - -contains - -subroutine set_radiag_int_ (what,iv,ier) -character(len=*),intent(in) :: what -integer(i_kind),intent(in) :: iv -integer(i_kind),intent(out):: ier -ier=-1 -if(trim(what)=='version') then - iversion_radiag = iv - ier=0 -endif -end subroutine set_radiag_int_ - -subroutine get_radiag_int_ (what,iv,ier) -character(len=*),intent(in) :: what -integer(i_kind),intent(out):: iv -integer(i_kind),intent(out):: ier -ier=-1 -if(trim(what)=='version') then - iv = iversion_radiag - ier=0 -endif -end subroutine get_radiag_int_ - -subroutine read_radiag_header(ftin,npred_radiag,retrieval,header_fix,header_chan,data_name,iflag,lverbose) -! . . . . -! subprogram: read_diag_header read rad diag header -! prgmmr: tahara org: np20 date: 2003-01-01 -! -! abstract: This routine reads the header record from a radiance -! diagnostic file -! -! program history log: -! 2010-10-05 treadon - add this doc block -! 2011-02-22 kleist - changes related to memory allocation and standard output -! -! input argument list: -! ftin - unit number connected to diagnostic file -! npred_radiag - number of bias correction terms -! retrieval - .true. if sst retrieval -! -! output argument list: -! header_fix - header information structure -! header_chan - channel information structure -! data_name - diag file data names -! iflag - error code -! lverbose - optional flag to turn off default output to standard out -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ - -! Declare passed arguments - integer(i_kind),intent(in) :: ftin - integer(i_kind),intent(in) :: npred_radiag - logical,intent(in) :: retrieval - type(diag_header_fix_list ),intent(out):: header_fix - type(diag_header_chan_list),allocatable :: header_chan(:) - type(diag_data_name_list) :: data_name - integer(i_kind),intent(out) :: iflag - logical,optional,intent(in) :: lverbose - -! Declare local variables - character(len=2):: string - character(len=10):: satid,sentype - character(len=20):: sensat - integer(i_kind) :: i,ich - integer(i_kind):: jiter,nchanl,npred,ianldate,ireal,ipchan,iextra,jextra - integer(i_kind):: idiag,angord,iversion,inewpc,isens - integer(i_kind):: iuse_tmp,nuchan_tmp,iochan_tmp - real(r_single) :: freq_tmp,polar_tmp,wave_tmp,varch_tmp,tlapmean_tmp - logical loutall - - loutall=.true. - if(present(lverbose)) loutall=lverbose - -! Read header (fixed_part). - read(ftin,IOSTAT=iflag) sensat,satid,sentype,jiter,nchanl,npred,ianldate,& - ireal,ipchan,iextra,jextra,idiag,angord,iversion,inewpc,isens - if (iflag/=0) then - rewind(ftin) - read(ftin,IOSTAT=iflag) sensat,satid,sentype,jiter,nchanl,npred,ianldate,& - ireal,ipchan,iextra,jextra,idiag,angord,iversion,inewpc - isens=0 - end if - - if (iflag/=0) then - rewind(ftin) - read(ftin,IOSTAT=iflag) sensat,satid,sentype,jiter,nchanl,npred,ianldate,& - ireal,ipchan,iextra,jextra - idiag=ipchan+npred+1 - angord=0 - iversion=0 - inewpc=0 - isens=0 - if (iflag/=0) then - write(6,*)'READ_RADIAG_HEADER: ***ERROR*** Unknown file format. Cannot read' - return - endif - endif - - header_fix%isis = sensat - header_fix%id = satid - header_fix%obstype = sentype - header_fix%jiter = jiter - header_fix%nchan = nchanl - header_fix%npred = npred - header_fix%idate = ianldate - header_fix%ireal = ireal - header_fix%ipchan = ipchan - header_fix%iextra = iextra - header_fix%jextra = jextra - header_fix%idiag = idiag - header_fix%angord = angord - header_fix%iversion= iversion - header_fix%inewpc = inewpc - header_fix%isens = isens - - if (loutall) then - write(6,*)'READ_RADIAG_HEADER: isis=',header_fix%isis,& - ' nchan=',header_fix%nchan,& - ' npred=',header_fix%npred,& - ' angord=',header_fix%angord,& - ' idiag=',header_fix%idiag,& - ' iversion=',header_fix%iversion,& - ' inewpc=',header_fix%inewpc,& - ' isens=',header_fix%isens - - if ( header_fix%iextra /= 0) & - write(6,*)'READ_RADIAG_HEADER: extra diagnostic information available, ',& - 'iextra=',header_fix%iextra - end if - - if (header_fix%npred /= npred_radiag) & - write(6,*) 'READ_RADIAG_HEADER: **WARNING** header_fix%npred,npred=',& - header_fix%npred,npred_radiag - -! Allocate and initialize as needed - if (allocated(header_chan)) deallocate(header_chan) - if (allocated(data_name%chn)) deallocate(data_name%chn) - - allocate(header_chan( header_fix%nchan)) - allocate(data_name%chn(header_fix%idiag)) - - data_name%fix(1) ='lat ' - data_name%fix(2) ='lon ' - data_name%fix(3) ='zsges ' - data_name%fix(4) ='obstim ' - data_name%fix(5) ='scanpos ' - data_name%fix(6) ='satzen ' - data_name%fix(7) ='satazm ' - data_name%fix(8) ='solzen ' - data_name%fix(9) ='solazm ' - data_name%fix(10)='sungln ' - data_name%fix(11)='fwater ' - data_name%fix(12)='fland ' - data_name%fix(13)='fice ' - data_name%fix(14)='fsnow ' - data_name%fix(15)='twater ' - data_name%fix(16)='tland ' - data_name%fix(17)='tice ' - data_name%fix(18)='tsnow ' - data_name%fix(19)='tsoil ' - data_name%fix(20)='soilmoi ' - data_name%fix(21)='landtyp ' - data_name%fix(22)='vegfrac ' - data_name%fix(23)='snowdep ' - data_name%fix(24)='wndspd ' - data_name%fix(25)='qc1 ' - data_name%fix(26)='qc2 ' - data_name%fix(27)='tref ' - data_name%fix(28)='dtw ' - data_name%fix(29)='dtc ' - data_name%fix(30)='tz_tr ' - - data_name%chn(1)='obs ' - data_name%chn(2)='omgbc ' - data_name%chn(3)='omgnbc ' - data_name%chn(4)='errinv ' - data_name%chn(5)='qcmark ' - data_name%chn(6)='emiss ' - data_name%chn(7)='tlap ' - data_name%chn(8)='tb_tz ' - - if (header_fix%iversion < iversion_radiag_1) then - data_name%chn( 8)= 'bifix ' - data_name%chn( 9)= 'bilap ' - data_name%chn(10)= 'bilap2 ' - data_name%chn(11)= 'bicons ' - data_name%chn(12)= 'biang ' - data_name%chn(13)= 'biclw ' - if (retrieval) data_name%chn(13)= 'bisst ' - elseif ( header_fix%iversion < iversion_radiag_2 .and. header_fix%iversion >= iversion_radiag_1 ) then - data_name%chn( 8)= 'bicons ' - data_name%chn( 9)= 'biang ' - data_name%chn(10)= 'biclw ' - data_name%chn(11)= 'bilap2 ' - data_name%chn(12)= 'bilap ' - do i=1,header_fix%angord - write(string,'(i2.2)') header_fix%angord-i+1 - data_name%chn(12+i)= 'bifix' // string - end do - data_name%chn(12+header_fix%angord+1)= 'bifix ' - data_name%chn(12+header_fix%angord+2)= 'bisst ' - elseif ( header_fix%iversion < iversion_radiag_3 .and. header_fix%iversion >= iversion_radiag_2 ) then - data_name%chn( 9)= 'bicons ' - data_name%chn(10)= 'biang ' - data_name%chn(11)= 'biclw ' - data_name%chn(12)= 'bilap2 ' - data_name%chn(13)= 'bilap ' - do i=1,header_fix%angord - write(string,'(i2.2)') header_fix%angord-i+1 - data_name%chn(13+i)= 'bifix' // string - end do - data_name%chn(13+header_fix%angord+1)= 'bifix ' - data_name%chn(13+header_fix%angord+2)= 'bisst ' - elseif ( header_fix%iversion < iversion_radiag_4 .and. header_fix%iversion >= iversion_radiag_3 ) then - data_name%chn( 9)= 'bicons ' - data_name%chn(10)= 'biang ' - data_name%chn(11)= 'biclw ' - data_name%chn(12)= 'bilap2 ' - data_name%chn(13)= 'bilap ' - data_name%chn(14)= 'bicos ' - data_name%chn(15)= 'bisin ' - do i=1,header_fix%angord - write(string,'(i2.2)') header_fix%angord-i+1 - data_name%chn(15+i)= 'bifix' // string - end do - data_name%chn(15+header_fix%angord+1)= 'bifix ' - data_name%chn(15+header_fix%angord+2)= 'bisst ' - else - data_name%chn( 9)= 'bicons ' - data_name%chn(10)= 'biang ' - data_name%chn(11)= 'biclw ' - data_name%chn(12)= 'bilap2 ' - data_name%chn(13)= 'bilap ' - data_name%chn(14)= 'bicos ' - data_name%chn(15)= 'bisin ' - data_name%chn(16)= 'biemis ' - do i=1,header_fix%angord - write(string,'(i2.2)') header_fix%angord-i+1 - data_name%chn(16+i)= 'bifix' // string - end do - data_name%chn(16+header_fix%angord+1)= 'bifix ' - data_name%chn(16+header_fix%angord+2)= 'bisst ' - endif - -! Read header (channel part) - do ich=1, header_fix%nchan - read(ftin,IOSTAT=iflag) freq_tmp,polar_tmp,wave_tmp,varch_tmp,tlapmean_tmp,iuse_tmp,nuchan_tmp,iochan_tmp - header_chan(ich)%freq = freq_tmp - header_chan(ich)%polar = polar_tmp - header_chan(ich)%wave = wave_tmp - header_chan(ich)%varch = varch_tmp - header_chan(ich)%tlapmean = tlapmean_tmp - header_chan(ich)%iuse = iuse_tmp - header_chan(ich)%nuchan = nuchan_tmp - header_chan(ich)%iochan = iochan_tmp - if (iflag/=0) return - end do - -! Construct array containing menonics for data record entries - - -end subroutine read_radiag_header - -subroutine read_radiag_data(ftin,header_fix,retrieval,data_fix,data_chan,data_extra,iflag ) -! . . . . -! subprogram: read_radiag_dat read rad diag data -! prgmmr: tahara org: np20 date: 2003-01-01 -! -! abstract: This routine reads the data record from a radiance -! diagnostic file -! -! program history log: -! 2010-10-05 treadon - add this doc block -! 2011-02-22 kleist - changes related to memory allocation -! -! input argument list: -! ftin - unit number connected to diagnostic file -! header_fix - header information structure -! -! output argument list: -! data_fix - spot header information structure -! data_chan - spot channel information structure -! data_extra - spot extra information -! iflag - error code -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ - - -! Declare passed arguments - integer(i_kind),intent(in) :: ftin - type(diag_header_fix_list ),intent(in) :: header_fix - logical,intent(in) :: retrieval - type(diag_data_fix_list) ,intent(out):: data_fix - type(diag_data_chan_list) ,allocatable :: data_chan(:) - type(diag_data_extra_list) ,allocatable :: data_extra(:,:) - integer(i_kind),intent(out) :: iflag - - integer(i_kind) :: ich,iang,i,j - real(r_single),dimension(:,:),allocatable :: data_tmp - real(r_single),dimension(:),allocatable :: fix_tmp - real(r_single),dimension(:,:),allocatable :: extra_tmp - -! Allocate arrays as needed - if (allocated(data_chan)) deallocate(data_chan) - allocate(data_chan(header_fix%nchan)) - - do ich=1,header_fix%nchan - if (allocated(data_chan(ich)%bifix)) deallocate(data_chan(ich)%bifix) - allocate(data_chan(ich)%bifix(header_fix%angord+1)) - end do - - if (header_fix%iextra > 0) then - if (allocated(data_extra)) deallocate(data_extra) - allocate(data_extra(header_fix%iextra,header_fix%jextra)) - allocate(extra_tmp(header_fix%iextra,header_fix%jextra)) - end if - -! Allocate arrays to hold data record - allocate(data_tmp(header_fix%idiag,header_fix%nchan)) - - if (header_fix%iversion < iversion_radiag_2) then - allocate( fix_tmp( ireal_old_radiag ) ) - else - allocate( fix_tmp( ireal_radiag ) ) - end if - -! Read data record - - if (header_fix%iextra == 0) then - read(ftin,IOSTAT=iflag) fix_tmp, data_tmp - else - read(ftin,IOSTAT=iflag) fix_tmp, data_tmp, extra_tmp - endif - - -! Transfer fix_tmp record to output structure - data_fix%lat = fix_tmp(1) - data_fix%lon = fix_tmp(2) - data_fix%zsges = fix_tmp(3) - data_fix%obstime = fix_tmp(4) - data_fix%senscn_pos = fix_tmp(5) - data_fix%satzen_ang = fix_tmp(6) - data_fix%satazm_ang = fix_tmp(7) - data_fix%solzen_ang = fix_tmp(8) - data_fix%solazm_ang = fix_tmp(9) - data_fix%sungln_ang = fix_tmp(10) - data_fix%water_frac = fix_tmp(11) - data_fix%land_frac = fix_tmp(12) - data_fix%ice_frac = fix_tmp(13) - data_fix%snow_frac = fix_tmp(14) - data_fix%water_temp = fix_tmp(15) - data_fix%land_temp = fix_tmp(16) - data_fix%ice_temp = fix_tmp(17) - data_fix%snow_temp = fix_tmp(18) - data_fix%soil_temp = fix_tmp(19) - data_fix%soil_mois = fix_tmp(20) - data_fix%land_type = fix_tmp(21) - data_fix%veg_frac = fix_tmp(22) - data_fix%snow_depth = fix_tmp(23) - data_fix%sfc_wndspd = fix_tmp(24) - data_fix%qcdiag1 = fix_tmp(25) - data_fix%qcdiag2 = fix_tmp(26) - - if ( header_fix%iversion <= iversion_radiag_1 ) then - data_fix%tref = rmiss_radiag - data_fix%dtw = rmiss_radiag - data_fix%dtc = rmiss_radiag - data_fix%tz_tr = rmiss_radiag - else - data_fix%tref = fix_tmp(27) - data_fix%dtw = fix_tmp(28) - data_fix%dtc = fix_tmp(29) - data_fix%tz_tr = fix_tmp(30) - end if - - -! Transfer data record to output structure - do ich=1,header_fix%nchan - data_chan(ich)%tbobs =data_tmp(1,ich) - data_chan(ich)%omgbc =data_tmp(2,ich) - data_chan(ich)%omgnbc=data_tmp(3,ich) - data_chan(ich)%errinv=data_tmp(4,ich) - data_chan(ich)%qcmark=data_tmp(5,ich) - data_chan(ich)%emiss =data_tmp(6,ich) - data_chan(ich)%tlap =data_tmp(7,ich) - data_chan(ich)%tb_tz =data_tmp(8,ich) - end do - if (header_fix%iversion < iversion_radiag_1) then - do ich=1,header_fix%nchan - data_chan(ich)%bifix(1)=data_tmp(8,ich) - data_chan(ich)%bilap =data_tmp(9,ich) - data_chan(ich)%bilap2 =data_tmp(10,ich) - data_chan(ich)%bicons =data_tmp(11,ich) - data_chan(ich)%biang =data_tmp(12,ich) - data_chan(ich)%biclw =data_tmp(13,ich) - data_chan(ich)%bisst = rmiss_radiag - if (retrieval) then - data_chan(ich)%biclw =rmiss_radiag - data_chan(ich)%bisst =data_tmp(13,ich) - endif - end do - elseif ( header_fix%iversion < iversion_radiag_2 .and. header_fix%iversion >= iversion_radiag_1 ) then - do ich=1,header_fix%nchan - data_chan(ich)%bicons=data_tmp(8,ich) - data_chan(ich)%biang =data_tmp(9,ich) - data_chan(ich)%biclw =data_tmp(10,ich) - data_chan(ich)%bilap2=data_tmp(11,ich) - data_chan(ich)%bilap =data_tmp(12,ich) - end do - do ich=1,header_fix%nchan - do iang=1,header_fix%angord+1 - data_chan(ich)%bifix(iang)=data_tmp(12+iang,ich) - end do - data_chan(ich)%bisst = data_tmp(12+header_fix%angord+2,ich) - end do - elseif ( header_fix%iversion < iversion_radiag_3 .and. header_fix%iversion >= iversion_radiag_2 ) then - do ich=1,header_fix%nchan - data_chan(ich)%bicons=data_tmp(9,ich) - data_chan(ich)%biang =data_tmp(10,ich) - data_chan(ich)%biclw =data_tmp(11,ich) - data_chan(ich)%bilap2=data_tmp(12,ich) - data_chan(ich)%bilap =data_tmp(13,ich) - end do - do ich=1,header_fix%nchan - do iang=1,header_fix%angord+1 - data_chan(ich)%bifix(iang)=data_tmp(13+iang,ich) - end do - data_chan(ich)%bisst = data_tmp(13+header_fix%angord+2,ich) - end do - elseif ( header_fix%iversion < iversion_radiag_4 .and. header_fix%iversion >= iversion_radiag_3 ) then - do ich=1,header_fix%nchan - data_chan(ich)%bicons=data_tmp(9,ich) - data_chan(ich)%biang =data_tmp(10,ich) - data_chan(ich)%biclw =data_tmp(11,ich) - data_chan(ich)%bilap2=data_tmp(12,ich) - data_chan(ich)%bilap =data_tmp(13,ich) - data_chan(ich)%bicos =data_tmp(14,ich) ! 1st bias correction term node*cos(lat) for SSMIS - data_chan(ich)%bisin =data_tmp(15,ich) ! 2nd bias correction term sin(lat) for SSMI - end do - do ich=1,header_fix%nchan - do iang=1,header_fix%angord+1 - data_chan(ich)%bifix(iang)=data_tmp(15+iang,ich) - end do - data_chan(ich)%bisst = data_tmp(15+header_fix%angord+2,ich) - end do - else - do ich=1,header_fix%nchan - data_chan(ich)%bicons=data_tmp(9,ich) - data_chan(ich)%biang =data_tmp(10,ich) - data_chan(ich)%biclw =data_tmp(11,ich) - data_chan(ich)%bilap2=data_tmp(12,ich) - data_chan(ich)%bilap =data_tmp(13,ich) - data_chan(ich)%bicos =data_tmp(14,ich) - data_chan(ich)%bisin =data_tmp(15,ich) - data_chan(ich)%biemis=data_tmp(16,ich) - end do - do ich=1,header_fix%nchan - do iang=1,header_fix%angord+1 - data_chan(ich)%bifix(iang)=data_tmp(16+iang,ich) - end do - data_chan(ich)%bisst = data_tmp(16+header_fix%angord+2,ich) - end do - endif - - if (header_fix%iextra > 0) then - do j=1,header_fix%jextra - do i=1,header_fix%iextra - data_extra(i,j)%extra=extra_tmp(i,j) - end do - end do - endif - - deallocate(data_tmp, fix_tmp) - if (header_fix%iextra > 0) deallocate(extra_tmp) - -end subroutine read_radiag_data - -end module read_diag - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radtime.fd/Makefile.conf b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radtime.fd/Makefile.conf deleted file mode 100755 index 9cba163a3e..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radtime.fd/Makefile.conf +++ /dev/null @@ -1,26 +0,0 @@ -# This config file contains the compile options for compilation -# of the RadMon code on WCOSS. - -# ---------------------------------- -# Redefine variables for WCOSS -# ---------------------------------- - CORELIB = /nwprod/lib - W3NCO_VER = v2.0.6 - W3NCO_LIB4=$(CORELIB)/w3nco/$(W3NCO_VER)/libw3nco_$(W3NCO_VER)_4.a - -# ---------------------------- -# Fortran compiler and options -# ---------------------------- - - CF = ifort - FC = $(CF) - - FFLAGS = -O3 -fp-model strict -D_REAL8_ -traceback -convert big_endian -assume byterecl - -# ------------------ -# Linker and options -# ------------------ - - LIBS = $(W3NCO_LIB4) - LDFLAGS = - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radtime.fd/bad_chan.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radtime.fd/bad_chan.f90 deleted file mode 100644 index eaac10cff6..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radtime.fd/bad_chan.f90 +++ /dev/null @@ -1,94 +0,0 @@ -!$$$ subprogram documentation block -! . . . -! subprogram: bad_chan build bad_chan.txt file -! prgmmr: safford date: 2009-11 -! -! abstract: This module contains code to build the bad_chan.txt file. -! The bad_chan.txt file reports the satellite and channel for -! which zero obs were found on a channel that is set for use -! and normally has data. -! -! program history log: -! 2009-12-22 safford - initial coding -! -! contains: -! -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ - -module bad_chan - - implicit none - - private - - public :: open_bad_chan_file - public :: write_bad_chan - public :: close_bad_chan_file - - integer, parameter :: funit = 14 - - contains - - - !------------------------------------------------------------- - ! create the bad_chan file - !------------------------------------------------------------- - - subroutine open_bad_chan_file( date, cycle, fios ) - - !--- interface - character(8), intent( in ) :: date - character(8), intent( in ) :: cycle - integer, intent( out ) :: fios - - !--- variables - logical :: lexist = .FALSE. - character(60) :: fname - - -! write(*,*) '--> open_bad_chan_file, date, cycle = ', date, cycle - !--- build the file name - fname = 'bad_chan.' // trim(date) // trim(cycle) - - write(*,*) ' fname = ', fname - - !--- open file and write the header - inquire(file=fname, exist=lexist) - if( lexist .eqv. .FALSE. ) then - write(6,*) ' opening new bad_chan file' - open( UNIT=funit, FILE=fname, STATUS='NEW', IOSTAT=fios ) - else - write(6,*) ' opening existing bad_chan.txt file' - open( UNIT=funit, FILE=fname, STATUS='OLD', POSITION='APPEND', IOSTAT=fios ) - end if - - end subroutine open_bad_chan_file - - - subroutine write_bad_chan( satname, channel ) - - !--- interface - character(20), intent( in ) :: satname - integer, intent( in ) :: channel - - !--- variables - real :: count - - write(6,*) 'write_bad_chan, satname, channel', satname, channel - - write(funit,*) satname, 'channel= ', channel - - end subroutine write_bad_chan - - - subroutine close_bad_chan_file( ) -! write(6,*) '--> close_bad_chan_file' - close( funit ) - end subroutine close_bad_chan_file - -end module bad_chan diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radtime.fd/bad_obs.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radtime.fd/bad_obs.f90 deleted file mode 100644 index 9962b00bb3..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radtime.fd/bad_obs.f90 +++ /dev/null @@ -1,99 +0,0 @@ -!$$$ subprogram documentation block -! . . . -! subprogram: bad_obs build bad_obs.txt file -! prgmmr: safford date: 2009-11 -! -! abstract: This module contains code to build the bad_obs.txt file. -! The bad_obs.txt file reports the satellite and channel for -! which an unexpected number of observations were found in -! assimilated radiance data. -! -! program history log: -! 2009-11-23 safford - initial coding -! -! contains: -! -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ - -module bad_obs - - implicit none - - private - - public :: open_bad_obs_file - public :: write_bad_obs - public :: close_bad_obs_file - - integer, parameter :: funit = 10 - - contains - - - !------------------------------------------------------------- - ! create the bad_obs file - !------------------------------------------------------------- - - subroutine open_bad_obs_file( date, cycle, fios ) - - !--- interface - character(8), intent( in ) :: date - character(8), intent( in ) :: cycle - integer, intent( out ) :: fios - - !--- variables - logical :: lexist = .FALSE. - character(60) :: fname - - - write(*,*) '--> open_bad_obs_file, date, cycle = ', date, cycle - !--- build the file name - fname = 'bad_obs.' // trim(date) // trim(cycle) - - !--- open file and write the header - inquire(file=fname, exist=lexist) - if( lexist .eqv. .FALSE. ) then - write(*,*) ' opening new bad_obs file' - open( UNIT=funit, FILE=fname, STATUS='NEW', IOSTAT=fios ) - else - write(*,*) ' opening existing bad_obs.txt file' - open( UNIT=funit, FILE=fname, STATUS='OLD', POSITION='APPEND', IOSTAT=fios ) - end if - - end subroutine open_bad_obs_file - - - subroutine write_bad_obs( satname, channel, region, num_obs ) - - !--- interface - character(20), intent( in ) :: satname - integer, intent( in ) :: channel - integer, intent( in ) :: region - real, intent( in ) :: num_obs - - !--- variables - real :: count - - !--- -! if( num_obs < 0.0 ) then -! count = 0.0 -! else - count = num_obs -! end if - - write(funit,*) satname, 'channel= ', channel, ' region= ', region, ' num_obs= ', count - - end subroutine write_bad_obs - - - subroutine close_bad_obs_file( ) - write(*,*) '--> close_bad_obs_file' - close( funit ) - end subroutine close_bad_obs_file - -end module bad_obs diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radtime.fd/bad_penalty.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radtime.fd/bad_penalty.f90 deleted file mode 100644 index 55c822c7e8..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radtime.fd/bad_penalty.f90 +++ /dev/null @@ -1,100 +0,0 @@ -!$$$ subprogram documentation block -! . . . -! subprogram: penalty build penalty.txt file -! prgmmr: safford date: 2009-11 -! -! abstract: This module contains code to build the penalty.txt file. -! The penalty.txt file reports the satellite and channel for -! which a penalty value is likely out of range. -! -! program history log: -! 2009-11-23 safford - initial coding -! -! contains: -! -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ - -module bad_penalty - - implicit none - - private - - public :: open_bad_penalty_file - public :: write_bad_penalty - public :: close_bad_penalty_file - - integer, parameter :: funit = 11 - - contains - - - !------------------------------------------------------------- - ! open the bad_pen file - !------------------------------------------------------------- - - subroutine open_bad_penalty_file( date, cycle, fios ) - - !--- interface - character(8), intent( in ) :: date - character(8), intent( in ) :: cycle - integer, intent( out ) :: fios - - !--- variables - logical :: lexist = .FALSE. - character(60) :: fname - -! write(*,*) '--> open_bad_penalty_file, date, cycle = ', date, cycle - - !--- build the file name - fname= 'bad_pen.' // trim(date) // trim(cycle) - write(*,*) ' fname = ', fname - - !--- open file and write the header - inquire(file=fname, exist=lexist) - if( lexist .eqv. .FALSE. ) then - write(*,*) ' opening new bad_pen file' - open( UNIT=funit, FILE=fname, STATUS='NEW', IOSTAT=fios ) - else - write(*,*) ' opening existing bad_penalty.txt file' - open( UNIT=funit, FILE=fname, STATUS='OLD', POSITION='APPEND', IOSTAT=fios ) - end if - - end subroutine open_bad_penalty_file - - - !------------------------------------------------------------- - ! add an entry to the bad_penalty.txt file - !------------------------------------------------------------- - subroutine write_bad_penalty( satname, channel, region, penalty, bound ) - - !--- interface - character(20), intent( in ) :: satname - integer, intent( in ) :: channel - integer, intent( in ) :: region - real, intent( in ) :: penalty - real, intent( in ) :: bound - character(60) :: myformat - - myformat = "(A20,A10,I5,A9,I1,A10,ES15.7E2,A8,ES15.7E2)" - - - write(funit,myformat) satname, ' channel= ',channel, ' region= ', region, ' penalty= ', penalty, ' bound= ', bound - - end subroutine write_bad_penalty - - - !------------------------------------------------------------- - ! close the bad_penalty.txt file - !------------------------------------------------------------- - subroutine close_bad_penalty_file( ) -! write(*,*) '--> close_bad_penalty_file' - close( funit ) - end subroutine close_bad_penalty_file - -end module bad_penalty diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radtime.fd/create_ctl_time.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radtime.fd/create_ctl_time.f90 deleted file mode 100755 index a5be776d16..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radtime.fd/create_ctl_time.f90 +++ /dev/null @@ -1,162 +0,0 @@ -subroutine create_ctl_time(ntype,ftype,n_chan,iyy,imm,idd,ihh,idhh,& - incr,ctl_file,lunctl,rmiss,satname,satype,dplat,nregion,& - region,rlonmin,rlonmax,rlatmin,rlatmax,nu_chan,use,error,& - frequency,wavenumbr,little_endian) - - implicit none - - integer ntype - - character(2) cword - character(3),dimension(12):: mon - character(3):: clatmin,clatmax - character(4):: clonmin,clonmax - character(10),dimension(ntype):: ftype - character(13) stringd - character(20) satname,satsis - character(10) satype,dplat - character(40) ctl_file,grad_file - character(80) string - character(40),dimension(nregion):: region - character(80),dimension(nregion):: stringr - - integer idsat,nregion,iuse,little_endian - integer lunctl,iyy,imm,idd,ihh,j,i,n_chan,idhh,incr - integer iyy2,imm2,idd2,ihh2,ntime - integer,dimension(8):: ida,jda - integer,dimension(n_chan):: nu_chan - - real rmiss,wavelength - real,dimension(5):: fha - real,dimension(n_chan):: error,use,frequency,wavenumbr - real,dimension(nregion):: rlonmin,rlonmax,rlatmin,rlatmax - - data stringd / '.%y4%m2%d2%h2' / - data mon / 'jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', & - 'aug', 'sep', 'oct', 'nov', 'dec' / - -!************************************************************************** -! Create date for tdef based on given date and hour offset - fha=0.0; ida=0; jda=0; ntime=0 - iyy2=iyy; imm2=imm; idd2=idd; ihh2=ihh - if (idhh/=0) then - ntime = abs(idhh)/incr - fha(2)=idhh - ida(1)=iyy - ida(2)=imm - ida(3)=idd - ida(4)=0 - ida(5)=ihh - call w3movdat(fha,ida,jda) - iyy2=jda(1) - imm2=jda(2) - idd2=jda(3) - ihh2=jda(5) - endif - ntime=ntime+1 - -! Open unit to GrADS control file - open(lunctl,file=ctl_file,form='formatted') - -!******************************************************************* -! Construct the region strings if this is for a global source, -! which is defined as nregion > 1. -! - if (nregion > 1) then - do i=1,nregion - if (rlatmin(i)>0.) then - write(clatmin,10) int(rlatmin(i)) - else - write(clatmin,20) abs(int(rlatmin(i))) - endif - if (rlatmax(i)>0.) then - write(clatmax,10) int(rlatmax(i)) - else - write(clatmax,20) abs(int(rlatmax(i))) - endif - if (rlonmin(i)>0.) then - write(clonmin,30) int(rlonmin(i)) - else - write(clonmin,40) abs(int(rlonmin(i))) - endif - if (rlonmax(i)>0.) then - write(clonmax,30) int(rlonmax(i)) - else - write(clonmax,40) abs(int(rlonmax(i))) - endif - stringr(i) = trim(region(i)) // ' (' // & - trim(clonmin) // '-' // trim(clonmax) // ', ' // & - trim(clatmin) // '-' // trim(clatmax) // ')' - end do - endif -10 format(i2,'N') -20 format(i2,'S') -30 format(i3,'E') -40 format(i3,'W') - -! Write header information - grad_file = trim(satname) // stringd // '.ieee_d' - write(lunctl,100) grad_file - if ( little_endian == 1 ) then - write(lunctl,112) - else - write(lunctl,110) - endif - write(lunctl,120) rmiss - write(lunctl,130) adjustl(satype),dplat,n_chan - write(lunctl,132) - do i=1,n_chan - iuse = nint(use(i)) - wavelength = 10000./wavenumbr(i) - write(lunctl,134) i,nu_chan(i),iuse,error(i),wavelength,frequency(i) - end do - write(lunctl,136) - - if (nregion > 1) then - do i=1,nregion - write(cword,'(i2)') i - string = '* region=' // cword // ' ' // trim(stringr(i)) - write(lunctl,138) string - end do - endif - - write(lunctl,140) n_chan - write(lunctl,150) nregion - write(lunctl,160) - write(lunctl,170) ntime,ihh2,idd2,mon(imm2),iyy2 - write(lunctl,180) ntype - -100 format('dset ^',a40) -110 format('options template big_endian sequential') -112 format('options template little_endian sequential') -120 format('undef ',f5.0) -130 format('title ',a10,1x,a10,1x,i4) -132 format('*XDEF is channel number') -134 format('* x= ',i4,', channel= ',i4,' , iuse= ',i2,' , error= ',f8.3,& - ' , wlth= ',f9.2,' , freq= ',f9.2) -136 format('*YDEF is geographic region') -138 format(a80) -140 format('xdef ',i4,' linear 1.0 1.0') -150 format('ydef ',i2,' linear 1.0 1.0') -160 format('zdef 1 linear 1.0 1.0') -170 format('tdef ',i4,' linear ',i2.2,'Z',i2.2,a3,i4.4,' 06hr') -180 format('vars ',i7) - -! Write data portion of GraDS control file - do i=1,ntype - string = trim(ftype(i)) - write(lunctl,190) adjustl(string),trim(ftype(i)) -190 format(a10,' 0 0 ',a10) - end do - -! Write trminating "endvars" record - write(lunctl,200) -200 format('endvars') - - -! Close ctl file - close(lunctl) - -! Return - return -end subroutine create_ctl_time diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radtime.fd/makefile b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radtime.fd/makefile deleted file mode 100755 index 2f6b028688..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radtime.fd/makefile +++ /dev/null @@ -1,60 +0,0 @@ -# ***************************************************************** -# makefile -# -# Make the radmon_time.glb executable. The executable will extract -# time radiance data from a diagnostic file from a global run. -# -# ***************************************************************** -SHELL=/bin/sh -SRCS = kinds.F90 read_diag.f90 bad_obs.f90 bad_penalty.f90 bad_chan.f90 \ - valid.f90 time.f90 create_ctl_time.f90 - -OBJS = kinds.o read_diag.o bad_obs.o bad_penalty.o bad_chan.o valid.o \ - time.o create_ctl_time.o - -# -# ***************************************************************** -# - -#------------ -# Include machine dependent compile & load options -#------------ -MAKE_CONF = Makefile.conf -include $(MAKE_CONF) - - -CMD = radmon_time - -all: $(CMD) - -clean: - rm -f *.o - rm -f *.mod - rm -f radmon_time - -$(CMD): $(OBJS) - $(CF) $(FFLAGS) $(LDFLAGS) -o $(@) $(OBJS) $(LIBS) - -read_diag.o : read_diag.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -bad_obs.o : bad_obs.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -bad_penalty.o : bad_penalty.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -bad_chan.o : bad_chan.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -valid.o : valid.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -time.o : time.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -create_ctl_time.o : create_ctl_time.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -kinds.o : kinds.F90 - $(CF) $(FFLAGS) -c $(*).F90 diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radtime.fd/read_diag.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radtime.fd/read_diag.f90 deleted file mode 100755 index 7a4d6cdc49..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radtime.fd/read_diag.f90 +++ /dev/null @@ -1,659 +0,0 @@ -!$$$ subprogram documentation block -! . . . . -! subprogram: read_raddiag read rad diag file -! prgmmr: tahara org: np20 date: 2003-01-01 -! -! abstract: This module contains code to process radiance -! diagnostic files. The module defines structures -! to contain information from the radiance -! diagnostic files and then provides two routines -! to access contents of the file. -! -! program history log: -! 2005-07-22 treadon - add this doc block -! 2010-10-05 treadon - refactor code to GSI standard -! 2010-10-08 zhu - use data_tmp to handle various npred values -! 2011-02-22 kleist - changes related to memory allocate/deallocate -! 2011-04-08 li - add tref, dtw, dtc to diag_data_fix_list, add tb_tz to diag_data_chan_list -! - correspondingly, change ireal_radiag (26 -> 30) and ipchan_radiag (7 -> 8) -! 2011-07-24 safford - make structure size for reading data_fix data version dependent -! 2013-11-21 todling - revisit how versions are set (add set/get_radiag) -! 2014-01-27 todling - add ob sensitivity index -! -! contains -! read_radiag_header - read radiance diagnostic file header -! read_radiag_data - read radiance diagnostic file data -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ - -module read_diag - - use kinds, only: i_kind,r_single - implicit none - -! Declare public and private - private - - public :: diag_header_fix_list - public :: diag_header_chan_list - public :: diag_data_name_list - public :: diag_data_fix_list - public :: diag_data_chan_list - public :: diag_data_extra_list - public :: read_radiag_header - public :: read_radiag_data -! public :: iversion_radiag -! public :: iversion_radiag_1 -! public :: iversion_radiag_2 -! public :: iversion_radiag_3 -! public :: iversion_radiag_4 - public :: ireal_radiag - public :: ipchan_radiag - public :: set_radiag - public :: get_radiag - - interface set_radiag - module procedure set_radiag_int_ ! internal procedure for integers - end interface - interface get_radiag - module procedure get_radiag_int_ ! internal procedure for integers - end interface - - integer(i_kind),parameter :: ireal_radiag = 30 ! number of real entries per spot in radiance diagnostic file - integer(i_kind),parameter :: ireal_old_radiag = 26 ! number of real entries per spot in versions older than iversion_radiag_2 - integer(i_kind),parameter :: ipchan_radiag = 8 ! number of entries per channel per spot in radiance diagnostic file - -! Declare structures for radiance diagnostic file information - type diag_header_fix_list - character(len=20) :: isis ! sat and sensor type - character(len=10) :: id ! sat type - character(len=10) :: obstype ! observation type - integer(i_kind) :: jiter ! outer loop counter - integer(i_kind) :: nchan ! number of channels in the sensor - integer(i_kind) :: npred ! number of updating bias correction predictors - integer(i_kind) :: idate ! time (yyyymmddhh) - integer(i_kind) :: ireal ! # of real elements in the fix part of a data record - integer(i_kind) :: ipchan ! # of elements for each channel except for bias correction terms - integer(i_kind) :: iextra ! # of extra elements for each channel - integer(i_kind) :: jextra ! # of extra elements - integer(i_kind) :: idiag ! first dimension of diag_data_chan - integer(i_kind) :: angord ! order of polynomial for adp_anglebc option - integer(i_kind) :: iversion ! radiance diagnostic file version number - integer(i_kind) :: inewpc ! indicator of newpc4pred (1 on, 0 off) - integer(i_kind) :: isens ! sensitivity index - end type diag_header_fix_list - - type diag_data_name_list - character(len=10),dimension(ireal_radiag) :: fix - character(len=10),dimension(:),allocatable :: chn - end type diag_data_name_list - - type diag_header_chan_list - real(r_single) :: freq ! frequency (Hz) - real(r_single) :: polar ! polarization - real(r_single) :: wave ! wave number (cm^-1) - real(r_single) :: varch ! error variance (or SD error?) - real(r_single) :: tlapmean ! mean lapse rate - integer(i_kind):: iuse ! use flag - integer(i_kind):: nuchan ! sensor relative channel number - integer(i_kind):: iochan ! satinfo relative channel number - end type diag_header_chan_list - - type diag_data_fix_list - real(r_single) :: lat ! latitude (deg) - real(r_single) :: lon ! longitude (deg) - real(r_single) :: zsges ! guess elevation at obs location (m) - real(r_single) :: obstime ! observation time relative to analysis - real(r_single) :: senscn_pos ! sensor scan position (integer(i_kind)) - real(r_single) :: satzen_ang ! satellite zenith angle (deg) - real(r_single) :: satazm_ang ! satellite azimuth angle (deg) - real(r_single) :: solzen_ang ! solar zenith angle (deg) - real(r_single) :: solazm_ang ! solar azimumth angle (deg) - real(r_single) :: sungln_ang ! sun glint angle (deg) - real(r_single) :: water_frac ! fractional coverage by water - real(r_single) :: land_frac ! fractional coverage by land - real(r_single) :: ice_frac ! fractional coverage by ice - real(r_single) :: snow_frac ! fractional coverage by snow - real(r_single) :: water_temp ! surface temperature over water (K) - real(r_single) :: land_temp ! surface temperature over land (K) - real(r_single) :: ice_temp ! surface temperature over ice (K) - real(r_single) :: snow_temp ! surface temperature over snow (K) - real(r_single) :: soil_temp ! soil temperature (K) - real(r_single) :: soil_mois ! soil moisture - real(r_single) :: land_type ! land type (integer(i_kind)) - real(r_single) :: veg_frac ! vegetation fraction - real(r_single) :: snow_depth ! snow depth - real(r_single) :: sfc_wndspd ! surface wind speed - real(r_single) :: qcdiag1 ! ir=cloud fraction, mw=cloud liquid water - real(r_single) :: qcdiag2 ! ir=cloud top pressure, mw=total column water - real(r_single) :: tref ! reference temperature (Tr) in NSST - real(r_single) :: dtw ! dt_warm at zob - real(r_single) :: dtc ! dt_cool at zob - real(r_single) :: tz_tr ! d(Tz)/d(Tr) - end type diag_data_fix_list - - type diag_data_chan_list - real(r_single) :: tbobs ! Tb (obs) (K) - real(r_single) :: omgbc ! Tb_(obs) - Tb_(simulated w/ bc) (K) - real(r_single) :: omgnbc ! Tb_(obs) - Tb_(simulated_w/o bc) (K) - real(r_single) :: errinv ! inverse error (K**(-1)) - real(r_single) :: qcmark ! quality control mark - real(r_single) :: emiss ! surface emissivity - real(r_single) :: tlap ! temperature lapse rate - real(r_single) :: tb_tz ! d(Tb)/d(Tz) - real(r_single) :: bicons ! constant bias correction term - real(r_single) :: biang ! scan angle bias correction term - real(r_single) :: biclw ! CLW bias correction term - real(r_single) :: bilap2 ! square lapse rate bias correction term - real(r_single) :: bilap ! lapse rate bias correction term - real(r_single) :: bicos ! node*cos(lat) bias correction term - real(r_single) :: bisin ! sin(lat) bias correction term - real(r_single) :: biemis ! emissivity sensitivity bias correction term - real(r_single),dimension(:),allocatable :: bifix ! angle dependent bias - real(r_single) :: bisst ! SST bias correction term - end type diag_data_chan_list - - type diag_data_extra_list - real(r_single) :: extra ! extra information - end type diag_data_extra_list - - integer(i_kind),save :: iversion_radiag ! Current version (see set routine) - integer(i_kind),parameter:: iversion_radiag_1 = 11104 ! Version when bias-correction entries were modified - integer(i_kind),parameter:: iversion_radiag_2 = 13784 ! Version when NSST entries were added - integer(i_kind),parameter:: iversion_radiag_3 = 19180 ! Version when SSMIS added - integer(i_kind),parameter:: iversion_radiag_4 = 30303 ! Version when emissivity predictor added - - real(r_single),parameter:: rmiss_radiag = -9.9e11_r_single - -contains - -subroutine set_radiag_int_ (what,iv,ier) -character(len=*),intent(in) :: what -integer(i_kind),intent(in) :: iv -integer(i_kind),intent(out):: ier -ier=-1 -if(trim(what)=='version') then - iversion_radiag = iv - ier=0 -endif -end subroutine set_radiag_int_ - -subroutine get_radiag_int_ (what,iv,ier) -character(len=*),intent(in) :: what -integer(i_kind),intent(out):: iv -integer(i_kind),intent(out):: ier -ier=-1 -if(trim(what)=='version') then - iv = iversion_radiag - ier=0 -endif -end subroutine get_radiag_int_ - -subroutine read_radiag_header(ftin,npred_radiag,retrieval,header_fix,header_chan,data_name,iflag,lverbose) -! . . . . -! subprogram: read_diag_header read rad diag header -! prgmmr: tahara org: np20 date: 2003-01-01 -! -! abstract: This routine reads the header record from a radiance -! diagnostic file -! -! program history log: -! 2010-10-05 treadon - add this doc block -! 2011-02-22 kleist - changes related to memory allocation and standard output -! -! input argument list: -! ftin - unit number connected to diagnostic file -! npred_radiag - number of bias correction terms -! retrieval - .true. if sst retrieval -! -! output argument list: -! header_fix - header information structure -! header_chan - channel information structure -! data_name - diag file data names -! iflag - error code -! lverbose - optional flag to turn off default output to standard out -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ - -! Declare passed arguments - integer(i_kind),intent(in) :: ftin - integer(i_kind),intent(in) :: npred_radiag - logical,intent(in) :: retrieval - type(diag_header_fix_list ),intent(out):: header_fix - type(diag_header_chan_list),allocatable :: header_chan(:) - type(diag_data_name_list) :: data_name - integer(i_kind),intent(out) :: iflag - logical,optional,intent(in) :: lverbose - -! Declare local variables - character(len=2):: string - character(len=10):: satid,sentype - character(len=20):: sensat - integer(i_kind) :: i,ich - integer(i_kind):: jiter,nchanl,npred,ianldate,ireal,ipchan,iextra,jextra - integer(i_kind):: idiag,angord,iversion,inewpc,isens - integer(i_kind):: iuse_tmp,nuchan_tmp,iochan_tmp - real(r_single) :: freq_tmp,polar_tmp,wave_tmp,varch_tmp,tlapmean_tmp - logical loutall - - loutall=.true. - if(present(lverbose)) loutall=lverbose - -! Read header (fixed_part). - read(ftin,IOSTAT=iflag) sensat,satid,sentype,jiter,nchanl,npred,ianldate,& - ireal,ipchan,iextra,jextra,idiag,angord,iversion,inewpc,isens - if (iflag/=0) then - rewind(ftin) - read(ftin,IOSTAT=iflag) sensat,satid,sentype,jiter,nchanl,npred,ianldate,& - ireal,ipchan,iextra,jextra,idiag,angord,iversion,inewpc - isens=0 - end if - - if (iflag/=0) then - rewind(ftin) - read(ftin,IOSTAT=iflag) sensat,satid,sentype,jiter,nchanl,npred,ianldate,& - ireal,ipchan,iextra,jextra - idiag=ipchan+npred+1 - angord=0 - iversion=0 - inewpc=0 - isens=0 - if (iflag/=0) then - write(6,*)'READ_RADIAG_HEADER: ***ERROR*** Unknown file format. Cannot read' - return - endif - endif - - header_fix%isis = sensat - header_fix%id = satid - header_fix%obstype = sentype - header_fix%jiter = jiter - header_fix%nchan = nchanl - header_fix%npred = npred - header_fix%idate = ianldate - header_fix%ireal = ireal - header_fix%ipchan = ipchan - header_fix%iextra = iextra - header_fix%jextra = jextra - header_fix%idiag = idiag - header_fix%angord = angord - header_fix%iversion= iversion - header_fix%inewpc = inewpc - header_fix%isens = isens - - if (loutall) then - write(6,*)'READ_RADIAG_HEADER: isis=',header_fix%isis,& - ' nchan=',header_fix%nchan,& - ' npred=',header_fix%npred,& - ' angord=',header_fix%angord,& - ' idiag=',header_fix%idiag,& - ' iversion=',header_fix%iversion,& - ' inewpc=',header_fix%inewpc,& - ' isens=',header_fix%isens - - if ( header_fix%iextra /= 0) & - write(6,*)'READ_RADIAG_HEADER: extra diagnostic information available, ',& - 'iextra=',header_fix%iextra - end if - - if (header_fix%npred /= npred_radiag) & - write(6,*) 'READ_RADIAG_HEADER: **WARNING** header_fix%npred,npred=',& - header_fix%npred,npred_radiag - -! Allocate and initialize as needed - if (allocated(header_chan)) deallocate(header_chan) - if (allocated(data_name%chn)) deallocate(data_name%chn) - - allocate(header_chan( header_fix%nchan)) - allocate(data_name%chn(header_fix%idiag)) - - data_name%fix(1) ='lat ' - data_name%fix(2) ='lon ' - data_name%fix(3) ='zsges ' - data_name%fix(4) ='obstim ' - data_name%fix(5) ='scanpos ' - data_name%fix(6) ='satzen ' - data_name%fix(7) ='satazm ' - data_name%fix(8) ='solzen ' - data_name%fix(9) ='solazm ' - data_name%fix(10)='sungln ' - data_name%fix(11)='fwater ' - data_name%fix(12)='fland ' - data_name%fix(13)='fice ' - data_name%fix(14)='fsnow ' - data_name%fix(15)='twater ' - data_name%fix(16)='tland ' - data_name%fix(17)='tice ' - data_name%fix(18)='tsnow ' - data_name%fix(19)='tsoil ' - data_name%fix(20)='soilmoi ' - data_name%fix(21)='landtyp ' - data_name%fix(22)='vegfrac ' - data_name%fix(23)='snowdep ' - data_name%fix(24)='wndspd ' - data_name%fix(25)='qc1 ' - data_name%fix(26)='qc2 ' - data_name%fix(27)='tref ' - data_name%fix(28)='dtw ' - data_name%fix(29)='dtc ' - data_name%fix(30)='tz_tr ' - - data_name%chn(1)='obs ' - data_name%chn(2)='omgbc ' - data_name%chn(3)='omgnbc ' - data_name%chn(4)='errinv ' - data_name%chn(5)='qcmark ' - data_name%chn(6)='emiss ' - data_name%chn(7)='tlap ' - data_name%chn(8)='tb_tz ' - - if (header_fix%iversion < iversion_radiag_1) then - data_name%chn( 8)= 'bifix ' - data_name%chn( 9)= 'bilap ' - data_name%chn(10)= 'bilap2 ' - data_name%chn(11)= 'bicons ' - data_name%chn(12)= 'biang ' - data_name%chn(13)= 'biclw ' - if (retrieval) data_name%chn(13)= 'bisst ' - elseif ( header_fix%iversion < iversion_radiag_2 .and. header_fix%iversion >= iversion_radiag_1 ) then - data_name%chn( 8)= 'bicons ' - data_name%chn( 9)= 'biang ' - data_name%chn(10)= 'biclw ' - data_name%chn(11)= 'bilap2 ' - data_name%chn(12)= 'bilap ' - do i=1,header_fix%angord - write(string,'(i2.2)') header_fix%angord-i+1 - data_name%chn(12+i)= 'bifix' // string - end do - data_name%chn(12+header_fix%angord+1)= 'bifix ' - data_name%chn(12+header_fix%angord+2)= 'bisst ' - elseif ( header_fix%iversion < iversion_radiag_3 .and. header_fix%iversion >= iversion_radiag_2 ) then - data_name%chn( 9)= 'bicons ' - data_name%chn(10)= 'biang ' - data_name%chn(11)= 'biclw ' - data_name%chn(12)= 'bilap2 ' - data_name%chn(13)= 'bilap ' - do i=1,header_fix%angord - write(string,'(i2.2)') header_fix%angord-i+1 - data_name%chn(13+i)= 'bifix' // string - end do - data_name%chn(13+header_fix%angord+1)= 'bifix ' - data_name%chn(13+header_fix%angord+2)= 'bisst ' - elseif ( header_fix%iversion < iversion_radiag_4 .and. header_fix%iversion >= iversion_radiag_3 ) then - data_name%chn( 9)= 'bicons ' - data_name%chn(10)= 'biang ' - data_name%chn(11)= 'biclw ' - data_name%chn(12)= 'bilap2 ' - data_name%chn(13)= 'bilap ' - data_name%chn(14)= 'bicos ' - data_name%chn(15)= 'bisin ' - do i=1,header_fix%angord - write(string,'(i2.2)') header_fix%angord-i+1 - data_name%chn(15+i)= 'bifix' // string - end do - data_name%chn(15+header_fix%angord+1)= 'bifix ' - data_name%chn(15+header_fix%angord+2)= 'bisst ' - else - data_name%chn( 9)= 'bicons ' - data_name%chn(10)= 'biang ' - data_name%chn(11)= 'biclw ' - data_name%chn(12)= 'bilap2 ' - data_name%chn(13)= 'bilap ' - data_name%chn(14)= 'bicos ' - data_name%chn(15)= 'bisin ' - data_name%chn(16)= 'biemis ' - do i=1,header_fix%angord - write(string,'(i2.2)') header_fix%angord-i+1 - data_name%chn(16+i)= 'bifix' // string - end do - data_name%chn(16+header_fix%angord+1)= 'bifix ' - data_name%chn(16+header_fix%angord+2)= 'bisst ' - endif - -! Read header (channel part) - do ich=1, header_fix%nchan - read(ftin,IOSTAT=iflag) freq_tmp,polar_tmp,wave_tmp,varch_tmp,tlapmean_tmp,iuse_tmp,nuchan_tmp,iochan_tmp - header_chan(ich)%freq = freq_tmp - header_chan(ich)%polar = polar_tmp - header_chan(ich)%wave = wave_tmp - header_chan(ich)%varch = varch_tmp - header_chan(ich)%tlapmean = tlapmean_tmp - header_chan(ich)%iuse = iuse_tmp - header_chan(ich)%nuchan = nuchan_tmp - header_chan(ich)%iochan = iochan_tmp - if (iflag/=0) return - end do - -! Construct array containing menonics for data record entries - - -end subroutine read_radiag_header - -subroutine read_radiag_data(ftin,header_fix,retrieval,data_fix,data_chan,data_extra,iflag ) -! . . . . -! subprogram: read_radiag_dat read rad diag data -! prgmmr: tahara org: np20 date: 2003-01-01 -! -! abstract: This routine reads the data record from a radiance -! diagnostic file -! -! program history log: -! 2010-10-05 treadon - add this doc block -! 2011-02-22 kleist - changes related to memory allocation -! -! input argument list: -! ftin - unit number connected to diagnostic file -! header_fix - header information structure -! -! output argument list: -! data_fix - spot header information structure -! data_chan - spot channel information structure -! data_extra - spot extra information -! iflag - error code -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ - - -! Declare passed arguments - integer(i_kind),intent(in) :: ftin - type(diag_header_fix_list ),intent(in) :: header_fix - logical,intent(in) :: retrieval - type(diag_data_fix_list) ,intent(out):: data_fix - type(diag_data_chan_list) ,allocatable :: data_chan(:) - type(diag_data_extra_list) ,allocatable :: data_extra(:,:) - integer(i_kind),intent(out) :: iflag - - integer(i_kind) :: ich,iang,i,j - real(r_single),dimension(:,:),allocatable :: data_tmp - real(r_single),dimension(:),allocatable :: fix_tmp - real(r_single),dimension(:,:),allocatable :: extra_tmp - -! Allocate arrays as needed - if (allocated(data_chan)) deallocate(data_chan) - allocate(data_chan(header_fix%nchan)) - - do ich=1,header_fix%nchan - if (allocated(data_chan(ich)%bifix)) deallocate(data_chan(ich)%bifix) - allocate(data_chan(ich)%bifix(header_fix%angord+1)) - end do - - if (header_fix%iextra > 0) then - if (allocated(data_extra)) deallocate(data_extra) - allocate(data_extra(header_fix%iextra,header_fix%jextra)) - allocate(extra_tmp(header_fix%iextra,header_fix%jextra)) - end if - -! Allocate arrays to hold data record - allocate(data_tmp(header_fix%idiag,header_fix%nchan)) - - if (header_fix%iversion < iversion_radiag_2) then - allocate( fix_tmp( ireal_old_radiag ) ) - else - allocate( fix_tmp( ireal_radiag ) ) - end if - -! Read data record - - if (header_fix%iextra == 0) then - read(ftin,IOSTAT=iflag) fix_tmp, data_tmp - else - read(ftin,IOSTAT=iflag) fix_tmp, data_tmp, extra_tmp - endif - - -! Transfer fix_tmp record to output structure - data_fix%lat = fix_tmp(1) - data_fix%lon = fix_tmp(2) - data_fix%zsges = fix_tmp(3) - data_fix%obstime = fix_tmp(4) - data_fix%senscn_pos = fix_tmp(5) - data_fix%satzen_ang = fix_tmp(6) - data_fix%satazm_ang = fix_tmp(7) - data_fix%solzen_ang = fix_tmp(8) - data_fix%solazm_ang = fix_tmp(9) - data_fix%sungln_ang = fix_tmp(10) - data_fix%water_frac = fix_tmp(11) - data_fix%land_frac = fix_tmp(12) - data_fix%ice_frac = fix_tmp(13) - data_fix%snow_frac = fix_tmp(14) - data_fix%water_temp = fix_tmp(15) - data_fix%land_temp = fix_tmp(16) - data_fix%ice_temp = fix_tmp(17) - data_fix%snow_temp = fix_tmp(18) - data_fix%soil_temp = fix_tmp(19) - data_fix%soil_mois = fix_tmp(20) - data_fix%land_type = fix_tmp(21) - data_fix%veg_frac = fix_tmp(22) - data_fix%snow_depth = fix_tmp(23) - data_fix%sfc_wndspd = fix_tmp(24) - data_fix%qcdiag1 = fix_tmp(25) - data_fix%qcdiag2 = fix_tmp(26) - - if ( header_fix%iversion <= iversion_radiag_1 ) then - data_fix%tref = rmiss_radiag - data_fix%dtw = rmiss_radiag - data_fix%dtc = rmiss_radiag - data_fix%tz_tr = rmiss_radiag - else - data_fix%tref = fix_tmp(27) - data_fix%dtw = fix_tmp(28) - data_fix%dtc = fix_tmp(29) - data_fix%tz_tr = fix_tmp(30) - end if - - -! Transfer data record to output structure - do ich=1,header_fix%nchan - data_chan(ich)%tbobs =data_tmp(1,ich) - data_chan(ich)%omgbc =data_tmp(2,ich) - data_chan(ich)%omgnbc=data_tmp(3,ich) - data_chan(ich)%errinv=data_tmp(4,ich) - data_chan(ich)%qcmark=data_tmp(5,ich) - data_chan(ich)%emiss =data_tmp(6,ich) - data_chan(ich)%tlap =data_tmp(7,ich) - data_chan(ich)%tb_tz =data_tmp(8,ich) - end do - if (header_fix%iversion < iversion_radiag_1) then - do ich=1,header_fix%nchan - data_chan(ich)%bifix(1)=data_tmp(8,ich) - data_chan(ich)%bilap =data_tmp(9,ich) - data_chan(ich)%bilap2 =data_tmp(10,ich) - data_chan(ich)%bicons =data_tmp(11,ich) - data_chan(ich)%biang =data_tmp(12,ich) - data_chan(ich)%biclw =data_tmp(13,ich) - data_chan(ich)%bisst = rmiss_radiag - if (retrieval) then - data_chan(ich)%biclw =rmiss_radiag - data_chan(ich)%bisst =data_tmp(13,ich) - endif - end do - elseif ( header_fix%iversion < iversion_radiag_2 .and. header_fix%iversion >= iversion_radiag_1 ) then - do ich=1,header_fix%nchan - data_chan(ich)%bicons=data_tmp(8,ich) - data_chan(ich)%biang =data_tmp(9,ich) - data_chan(ich)%biclw =data_tmp(10,ich) - data_chan(ich)%bilap2=data_tmp(11,ich) - data_chan(ich)%bilap =data_tmp(12,ich) - end do - do ich=1,header_fix%nchan - do iang=1,header_fix%angord+1 - data_chan(ich)%bifix(iang)=data_tmp(12+iang,ich) - end do - data_chan(ich)%bisst = data_tmp(12+header_fix%angord+2,ich) - end do - elseif ( header_fix%iversion < iversion_radiag_3 .and. header_fix%iversion >= iversion_radiag_2 ) then - do ich=1,header_fix%nchan - data_chan(ich)%bicons=data_tmp(9,ich) - data_chan(ich)%biang =data_tmp(10,ich) - data_chan(ich)%biclw =data_tmp(11,ich) - data_chan(ich)%bilap2=data_tmp(12,ich) - data_chan(ich)%bilap =data_tmp(13,ich) - end do - do ich=1,header_fix%nchan - do iang=1,header_fix%angord+1 - data_chan(ich)%bifix(iang)=data_tmp(13+iang,ich) - end do - data_chan(ich)%bisst = data_tmp(13+header_fix%angord+2,ich) - end do - elseif ( header_fix%iversion < iversion_radiag_4 .and. header_fix%iversion >= iversion_radiag_3 ) then - do ich=1,header_fix%nchan - data_chan(ich)%bicons=data_tmp(9,ich) - data_chan(ich)%biang =data_tmp(10,ich) - data_chan(ich)%biclw =data_tmp(11,ich) - data_chan(ich)%bilap2=data_tmp(12,ich) - data_chan(ich)%bilap =data_tmp(13,ich) - data_chan(ich)%bicos =data_tmp(14,ich) ! 1st bias correction term node*cos(lat) for SSMIS - data_chan(ich)%bisin =data_tmp(15,ich) ! 2nd bias correction term sin(lat) for SSMI - end do - do ich=1,header_fix%nchan - do iang=1,header_fix%angord+1 - data_chan(ich)%bifix(iang)=data_tmp(15+iang,ich) - end do - data_chan(ich)%bisst = data_tmp(15+header_fix%angord+2,ich) - end do - else - do ich=1,header_fix%nchan - data_chan(ich)%bicons=data_tmp(9,ich) - data_chan(ich)%biang =data_tmp(10,ich) - data_chan(ich)%biclw =data_tmp(11,ich) - data_chan(ich)%bilap2=data_tmp(12,ich) - data_chan(ich)%bilap =data_tmp(13,ich) - data_chan(ich)%bicos =data_tmp(14,ich) - data_chan(ich)%bisin =data_tmp(15,ich) - data_chan(ich)%biemis=data_tmp(16,ich) - end do - do ich=1,header_fix%nchan - do iang=1,header_fix%angord+1 - data_chan(ich)%bifix(iang)=data_tmp(16+iang,ich) - end do - data_chan(ich)%bisst = data_tmp(16+header_fix%angord+2,ich) - end do - endif - - if (header_fix%iextra > 0) then - do j=1,header_fix%jextra - do i=1,header_fix%iextra - data_extra(i,j)%extra=extra_tmp(i,j) - end do - end do - endif - - deallocate(data_tmp, fix_tmp) - if (header_fix%iextra > 0) deallocate(extra_tmp) - -end subroutine read_radiag_data - -end module read_diag - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radtime.fd/time.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radtime.fd/time.f90 deleted file mode 100755 index 5cf23a9aba..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radtime.fd/time.f90 +++ /dev/null @@ -1,492 +0,0 @@ -program time -!************************************************************************ -! -! time.f90 -! -! log -! 05/2010 safford reduce validation to just region 1 (global) -! 07/2010 safford redefine regions to surface types -!************************************************************************ - - use read_diag - use bad_obs - use bad_penalty - use bad_chan - use valid - - implicit none - integer ntype,mregion,surf_nregion,max_surf_region - parameter (ntype=8,mregion=25, max_surf_region=5) - integer iglobal, iland, iwater, isnowice, imixed - parameter (iglobal=1, iland=2, iwater=3, isnowice=4, imixed=5) - - character(10),dimension(ntype):: ftype - character(8) stid - character(20) satname,stringd,satsis - character(10) dum,satype,dplat - character(40) string,diag_rad,data_file,dfile,ctl_file - character(40),dimension(max_surf_region):: region - character(40),dimension(mregion):: surf_region - character :: command - character(8) date,suffix,cycle - - integer luname,lungrd,lunctl,lndiag,nregion - integer iyy,imm,idd,ihh,idhh,incr,iread,iflag - integer n_chan,j,idsat,i,k,ii,nreg - integer,dimension(mregion):: jsub - integer,allocatable,dimension(:):: io_chan,nu_chan - integer :: ios = 0 - integer :: channel_obs - integer :: iret, ier, ver - integer npred_radiag - - real rread, pen, bound - real rlat, rlon, rmiss, obs - real,dimension(2):: cor_tot,nbc_omg,bc_omg - real,dimension(max_surf_region):: rlatmin,rlatmax,rlonmin,rlonmax - - real,allocatable,dimension(:):: wavenumbr,channel_count - real,allocatable,dimension(:,:):: count,error,use,frequency,penalty,test_pen - real,allocatable,dimension(:,:,:):: tot_cor,omg_nbc,omg_bc - -! Variables for reading satellite data - type(diag_header_fix_list ) :: header_fix - type(diag_header_chan_list),allocatable :: header_chan(:) - type(diag_data_name_list ) :: data_name - type(diag_data_fix_list ) :: data_fix - type(diag_data_chan_list ),allocatable :: data_chan(:) - type(diag_data_extra_list) ,allocatable :: data_extra(:,:) - - logical valid_count, valid_penalty - integer nsnow, nland, nwater, nice, nmixed, ntotal - integer nnsnow, nnland, nnwater, nnmixed, nntotal - -! Namelist with defaults - logical :: retrieval = .false. - integer :: nchanl = 19 - integer :: imkctl = 1 - integer :: imkdata = 1 - character(3) :: gesanl = 'ges' - integer :: little_endian = 1 - character(3) :: rad_area = 'glb' - namelist /input/ satname,iyy,imm,idd,ihh,idhh,incr,nchanl,& - suffix,imkctl,imkdata,retrieval,gesanl,little_endian,rad_area - - data luname,lungrd,lunctl,lndiag / 5, 51, 52, 21 / - data rmiss /-999./ - data stringd / '.%y4%m2%d2%h2' / - data ftype / 'count','penalty','omgnbc','total','omgbc','omgnbc2','total2','omgbc2'/ - data region / 'global', 'land', 'water', 'ice/snow', 'mixed'/ - data rlonmin / -180., -180., -180., -180., -180./ - data rlonmax / 180., 180., 180., 180., 180./ - data rlatmin / -90., -90., -90., -90., -90./ - data rlatmax / 90., 90., 90., 90., 90./ - - -!************************************************************************ -! -! Initialize variables - iread=0 - npred_radiag = 12 - -! Read namelist input - read(luname,input) - write(6,input) - write(6,*)' ' - write(6,*)'gesanl = ', gesanl - write(6,*)'imkdata = ', imkdata - - if ( trim(gesanl) == 'anl' ) then - ftype(3) = 'omanbc' - ftype(5) = 'omabc' - ftype(6) = 'omanbc2' - ftype(8) = 'omabc2' - endif - - surf_nregion = 5 - if ( trim(rad_area) == 'rgn' ) then - surf_nregion = 1 - endif - - nregion=surf_nregion - write(6,*)'surf_nregion = ', surf_nregion - - - nregion=surf_nregion - -! Ensure number of requested regions does not exceed specified upper limit - if (nregion>mregion) then - write(6,*)'***ERROR*** too many regions specified' - write(6,*)' maximum allowed: mregion=',mregion - write(6,*)' user requested: nregion=',nregion - call errexit(91) - endif - - -! Create filenames for diagnostic input, binary output file - write(stringd,100) iyy,imm,idd,ihh -100 format('.',i4.4,3i2.2) - - if ( trim(gesanl) == 'ges' ) then - diag_rad = trim(satname) - data_file= trim(satname) // trim(stringd) // '.ieee_d' - ctl_file = trim(satname) // '.ctl' - else - diag_rad = trim(satname) // '_anl' - data_file= trim(satname) // '_anl' // trim(stringd) // '.ieee_d' - ctl_file = trim(satname) // '_anl.ctl' - endif - - write(6,*)'diag_rad =',diag_rad - write(6,*)'data_file=',data_file - write(6,*)'ctl_file =',ctl_file - write(6,*)'suffix =',suffix - -! Open unit to diagnostic file. Read portion of -! header to see if file exists - open(lndiag,file=diag_rad,form='unformatted') - read(lndiag,err=900,end=900) dum - rewind lndiag - -! File exists. Read header - call get_radiag ('version',ver,ier) - write(6,*)'read_diag version = ', ver, ier - - write(6,*)'call read_diag_header' - call read_radiag_header( lndiag, npred_radiag, retrieval, header_fix,& - header_chan, data_name, iflag ) - if( iflag/=0 ) then - write(6,*)'***ERROR*** problem reading diag file header, iflag=',iflag - call errexit(91) - endif - -! Extract observation type, satellite id, and number of channels - satype = header_fix%obstype - satsis = header_fix%isis - dplat = header_fix%id - n_chan = header_fix%nchan - - string = trim(satype)//'_'//trim(dplat) - write(6,*)'string,satname=',string,' ',satname - if ( trim(string) /= trim(satname) ) then - write(6,*)'***ERROR*** inconsistent instrument types' - write(6,*)' satname,string =',satname,' ',string - call errexit(92) - endif - -! -! initialize data integrity check flags, open output file for email warning(s) -! - date = stringd(2:9) - cycle = stringd(10:11) - -! call open_bad_obs_file( date, cycle, ios ) - if ( trim(gesanl) == 'ges' ) then - call open_bad_penalty_file( date, cycle, ios ) - call open_bad_chan_file( date, cycle, ios ) - - call load_base( satname, ios ) - endif - - -! Allocate arrays to hold observational information - allocate (io_chan(n_chan), nu_chan(n_chan), wavenumbr(n_chan)) - allocate (tot_cor(n_chan,mregion,2), omg_nbc(n_chan,mregion,2), & - omg_bc(n_chan,mregion,2), count(n_chan,mregion), & - penalty(n_chan,mregion), test_pen(n_chan,mregion), & - error(n_chan,mregion), use(n_chan,mregion), & - frequency(n_chan,mregion), channel_count(n_chan)) - -! Zero accumulator arrays - do ii=1,2 - do k=1,mregion - do j=1,n_chan - if (ii==1) then - count(j,k) = 0.0 - penalty(j,k) = 0.0 - if( j==1) then - channel_count = 0.0 - endif - endif - tot_cor(j,k,ii) = 0.0 - omg_nbc(j,k,ii) = 0.0 - omg_bc(j,k,ii) = 0.0 - end do - end do - end do - - -! Extract satinfo relative index - do j=1,n_chan - nu_chan(j) = real( header_chan(j)%nuchan, 4 ) - io_chan(j) = real( header_chan(j)%iochan, 4 ) - wavenumbr(j) = real( header_chan(j)%wave, 4 ) - end do - do k=1,mregion - do j=1,n_chan - error(j,k) = real( header_chan(j)%varch, 4) - use(j,k) = real( header_chan(j)%iuse, 4 ) - frequency(j,k) = real( header_chan(j)%freq, 4) - end do - end do - - -! Create control file - if ( imkctl == 1 ) then - write(6,*)'call create_ctl_time' - - if ( trim(gesanl) == 'ges' ) then - dfile = trim(satname) - else - dfile = trim(satname) // '_anl' - endif - - call create_ctl_time(ntype,ftype,n_chan,iyy,imm,idd,ihh,idhh,& - incr,ctl_file,lunctl,rmiss,dfile,satype,dplat,nregion,& - region,rlonmin,rlonmax,rlatmin,rlatmax,nu_chan,use(1,1),& - error(1,1),frequency(1,1),wavenumbr,little_endian) - endif - - nwater = 0; nnwater=0 - nice = 0 - nsnow = 0; nnsnow=0 - nland = 0; nnland=0 - nmixed = 0; nnmixed=0 - ntotal = 0 - -! Loop to read entries in diagnostic file - if ( imkdata == 1 ) then - iflag = 0 - loopd: do while (iflag == 0) - -! Read a record. If read flag, iflag does not equal zero, exit loopd - call read_radiag_data( lndiag, header_fix, retrieval, data_fix, data_chan,& - data_extra, iflag ) - if( iflag /= 0 ) exit loopd - iread=iread+1 - -! Extract observation location. -! Convert (0-360) lon to (-180,180) - rlat = data_fix%lat - rlon = data_fix%lon - if (rlon>180.) rlon = rlon - 360. - rread = rread +1.0 - -! Detemine which subdomains the observation falls into. -! These are now based on surface type, not geography. All -! obs match global (surf_region 1). - - ii=0; jsub=0; - jsub(1)=iglobal - nreg=1 - - if ( nregion > 1 ) then - if ( data_fix%land_frac > 0.99 ) then - jsub(2)=iland - nreg=2 - nnland=nnland+1 - else if ( data_fix%water_frac > 0.99 ) then - jsub(2)=iwater - nreg=2 - nnwater=nnwater+1 - else if (( data_fix%snow_frac > 0.99 ) .OR. ( data_fix%ice_frac > 0.99 )) then - jsub(2)=isnowice - nreg=2 - nnsnow=nnsnow+1 - else - jsub(2)=imixed - nreg=2 - nnmixed=nnmixed+1 - write(6,*)'data_fix%land_frac,water,snow,ice = ',data_fix%land_frac, data_fix%water_frac, data_fix%snow_frac, data_fix%ice_frac - end if - end if - - -! Channel loop - do j = 1, n_chan - -! If observation was assimilated, accumulate sums in appropriate regions - if (data_chan(j)%errinv > 1.e-6) then - pen = data_chan(j)%errinv*(data_chan(j)%omgbc)**2 - cor_tot(1) = (data_chan(j)%omgnbc - data_chan(j)%omgbc) - nbc_omg(1) = - data_chan(j)%omgnbc - bc_omg(1) = - data_chan(j)%omgbc - - cor_tot(2) = (data_chan(j)%omgnbc - data_chan(j)%omgbc)**2 - nbc_omg(2) = (data_chan(j)%omgnbc)**2 - bc_omg(2) = (data_chan(j)%omgbc)**2 - - do i=1,nreg - k=jsub(i) - - count(j,k) = count(j,k) + 1.0 - penalty(j,k) = penalty(j,k) + pen - channel_count(j) = channel_count(j) + 1.0 - - do ii=1,2 - tot_cor(j,k,ii) = tot_cor(j,k,ii) + cor_tot(ii) - omg_nbc(j,k,ii) = omg_nbc(j,k,ii) + nbc_omg(ii) - omg_bc(j,k,ii) = omg_bc(j,k,ii) + bc_omg(ii) - end do - - end do - - endif - - enddo ! channel loop - - -! End of loop over diagnostic file - enddo loopd - - - write(6,*)' ' - write(6,*)'read in ',iread,' obs ',rread - write(6,*)' ' - -! -! Compute average and standard deviation -! - do k=1,nregion - do j=1,n_chan - - ! --- validate the count value for region 1 (global) - ! -! if ( use(j,k) > 0.0 .AND. k == 1 .AND. imkdata == 1 ) then -! call validate_count( j, k, count(j,k), valid_count, iret ) -! write (*,*) ' valid_count, iret = ', valid_count, iret -! if ( (iret == 0) .AND. (valid_count .eqv. .FALSE.) ) then -! write (*,*) ' calling write_bad_obs ' -! call write_bad_obs( satname, nu_chan(j), k, count(j,k) ) -! end if -! end if - - if (count(j,k)>0) then - test_pen(j,k)=penalty(j,k)/count(j,k) - - !--- check for valid penalty value for region 1 (global) - ! - if ( use(j,k) > 0.0 .AND. k == 1 .AND. imkdata == 1 .AND. trim(gesanl) == 'ges' ) then - call validate_penalty( j, k, test_pen(j,k), valid_penalty, bound, iret ) - if( (iret == 0) .AND. (valid_penalty .eqv. .FALSE.) ) then - call write_bad_penalty( satname, nu_chan(j), k, test_pen(j,k), bound ) - endif - endif - - else - count(j,k)=rmiss - penalty(j,k)=rmiss - endif - - end do - end do - -! -! Check each assimilated channel to see if we -! have a 0 count (no obs) for that channel. If so, report -! it using write_bad_chan(). -! - -! -! This is for testing purposes only -! channel_count(1) = 0.0 -! write(6,*)' header_chan(j)%iuse, channel_count(1) = ', header_chan(1)%iuse, channel_count(1) -! - do j=1,n_chan -! write(6,*)' j, header_chan(j)%iuse, channel_count(j) = ', j, header_chan(j)%iuse, channel_count(j) -! if( header_chan(j)%iuse > 0.0 ) then -! write(6,*)' header_chan(j)%iuse > 0.0', header_chan(j)%iuse -! else -! write(6,*)' header_chan(j)%iuse <= 0.0', header_chan(j)%iuse -! endif - -! if( channel_count(j) < 1.0 ) then -! write(6,*)' channel_count(j) < 1.0', channel_count(j) -! else -! write(6,*)' channel_count(j) >= 1.0', channel_count(j) -! endif - - if( header_chan(j)%iuse > 0.0 .and. channel_count(j) < 1.0 .AND. trim(gesanl) == 'ges' ) then - write(6,*)' calling write_bad_chan, satname, j, nu_chan(j) = ', satname, j, nu_chan(j) - call write_bad_chan( satname, nu_chan(j) ) - end if ! if header_chan%iuse - - end do ! channel loop - - if ( trim(gesanl) == 'ges' ) then -! call close_bad_obs_file() - call close_bad_penalty_file() - call close_bad_chan_file() - endif - - -! Write output to binary output file - - write(6,*)' ' - open(lungrd,file=data_file,form='unformatted') - write(lungrd) ((count(j,k),j=1,n_chan),k=1,nregion) - write(lungrd) ((penalty(j,k),j=1,n_chan),k=1,nregion) - do ii=1,2 - write(lungrd) ((omg_nbc(j,k,ii),j=1,n_chan),k=1,nregion) - write(lungrd) ((tot_cor(j,k,ii),j=1,n_chan),k=1,nregion) - write(lungrd) ((omg_bc (j,k,ii),j=1,n_chan),k=1,nregion) - end do - write(6,*)'write output to lungrd=',lungrd,', file=',trim(data_file) - close(lungrd) - endif - -! Deallocate arrays - write(6,*)' ' - write(6,*)'deallocate arrays' - deallocate(io_chan,nu_chan,wavenumbr,tot_cor,omg_nbc,omg_bc,count,& - penalty,error,use,frequency) - goto 950 - -! Jump to here if eof or error reading diagnostic file. -900 continue - write(6,*)'***PROBLEM reading diagnostic file. diag_rad=',diag_rad - close(lndiag) - - n_chan=nchanl - if (n_chan<=0) then - write(6,*)'***ERROR*** invalid nchanl=',nchanl,' STOP program' - call errexit(93) - endif - - write(6,*)'load missing value ',rmiss,' into output arrays. ',& - nregion,n_chan - allocate(count(n_chan,nregion),penalty(n_chan,nregion),& - omg_nbc(n_chan,nregion,2),tot_cor(n_chan,nregion,2),& - omg_bc(n_chan,nregion,2)) - do ii=1,2 - do k=1,nregion - do j=1,n_chan - if (ii==1) then - count(j,k) = rmiss - penalty(j,k)= rmiss - endif - omg_nbc(j,k,ii) = rmiss - tot_cor(j,k,ii) = rmiss - omg_bc(j,k,ii) = rmiss - end do - end do - end do - - if ( imkdata == 1 ) then - open(lungrd,file=data_file,form='unformatted') - write(lungrd) ((count(j,k),j=1,n_chan),k=1,nregion) - write(lungrd) ((penalty(j,k),j=1,n_chan),k=1,nregion) - do ii=1,2 - write(lungrd) ((omg_nbc(j,k,ii),j=1,n_chan),k=1,nregion) - write(lungrd) ((tot_cor(j,k,ii),j=1,n_chan),k=1,nregion) - write(lungrd) ((omg_bc (j,k,ii),j=1,n_chan),k=1,nregion) - end do - write(6,*)'write output to lungrd=',lungrd,', file=',trim(data_file) - close(lungrd) - endif - deallocate(count,penalty,omg_nbc,tot_cor,omg_bc) - -! End of program -950 continue - stop -end program time diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radtime.fd/valid.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radtime.fd/valid.f90 deleted file mode 100755 index ffae19c452..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/sorc/verf_radtime.fd/valid.f90 +++ /dev/null @@ -1,288 +0,0 @@ -!$$$ subprogram documentation block -! . . . -! subprogram: valid validate the obs and penalty values -! prgmmr: safford date: 2009-12 -! -! abstract: This module contains code to read a given satellite's -! base file and then validate new obs(count) and penalty -! values by comparing them to the baseline values. -! -! program history log: -! 2009-12-07 safford - initial coding -! -! contains: -! -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ - -module valid - - implicit none - - private - -! --- module routines - public :: load_base - public :: validate_count - public :: validate_penalty - -! --- module parameters - integer, parameter :: funit = 17 - real,parameter :: rmiss = -999.0 - -! --- module vars - logical :: base_loaded = .FALSE. - integer :: nchan, nregion, j, k, dummy - - real,allocatable,dimension(:,:):: avg_count, sdv_count - real,allocatable,dimension(:,:):: min_count, max_count - real,allocatable,dimension(:,:):: avg_penalty, sdv_penalty - real,allocatable,dimension(:,:):: min_penalty, max_penalty - - integer,allocatable,dimension(:):: nu_chan - - contains - - !------------------------------------------------------------- - ! load the base file for the given satellite - !------------------------------------------------------------- - - subroutine load_base( satname, iret ) - - !--- interface - character(20), intent( in ) :: satname - integer, intent( out ) :: iret - - !--- variables - character(20) fname - character(20) test_satname - character(10) base_date - - integer fios - integer chan, region - - logical fexist - - - !--- initialization - iret = -1 - fname = trim(satname) // '.base' - fexist = .FALSE. - - write(*,*) '--> valid, satname, fname = ', satname, fname - - !--- verify file exists and open the file - inquire( file = fname, exist = fexist ) - if( fexist .eqv. .FALSE. ) then - fios = -1 - else - open( UNIT=funit, FILE=fname, IOSTAT=fios ) - write(*,*) ' fios = ', fios - end if - - if( fios == 0 ) then - !--- read the file header - read(funit,*) test_satname, base_date, nchan, nregion - write(*,*) ' test_satname, base_date, nchan, nregion = ', test_satname, base_date, nchan, nregion - - allocate( avg_count(nchan,nregion), sdv_count(nchan,nregion), & - avg_penalty(nchan,nregion), sdv_penalty(nchan,nregion), & - min_count(nchan,nregion), max_count(nchan,nregion), & - min_penalty(nchan,nregion), max_penalty(nchan,nregion) ) - - ! --- set all missing - do k=1,nregion - do j=1,nchan - avg_count(j,k) = rmiss - sdv_count(j,k) = rmiss - min_count(j,k) = rmiss - max_count(j,k) = rmiss - avg_penalty(j,k) = rmiss - sdv_penalty(j,k) = rmiss - min_penalty(j,k) = rmiss - max_penalty(j,k) = rmiss - end do - end do - - do k=1,nregion - do j=1,nchan - read(funit,*) chan, region, avg_count(j,k), sdv_count(j,k), min_count(j,k), max_count(j,k), & - avg_penalty(j,k), sdv_penalty(j,k), min_penalty(j,k), max_penalty(j,k) - end do - end do - -! write(*,*) 'chan 18, region 2, avg_count(18,1), sdv_count(18,1), avg_penalty(18,1), sdv_penalty(18,1) = ', & -! avg_count(18,1), sdv_count(18,1), avg_penalty(18,1), sdv_penalty(18,1) - - iret = 0 - base_loaded = .TRUE. - else - write(*,*) 'unable to load fname for data error checking' - end if - - end subroutine load_base - - - !--------------------------------------------------------------- - ! validate a count - ! given a count value for a channel and region, determine - ! if the count is within +/- 2*sdv - ! - ! iret 0 = normal - ! -1 = invalid channel - ! -2 = invalid region - ! 1 = base file wasn't loaded, unable to validate - !--------------------------------------------------------------- - subroutine validate_count( channel, region, count, valid, iret ) - - !--- interface - integer, intent( in ) :: channel - integer, intent( in ) :: region - real, intent( in ) :: count - logical, intent( out ) :: valid - integer, intent( out ) :: iret - - !--- vars - real cnt, hi, lo, sdv2 - - write(*,*) '--> validate_count, channel, region, count ', channel, region, count - !--- initialize vars - iret = 0 - cnt = count - valid = .FALSE. - - if( base_loaded .eqv. .TRUE. ) then - if( channel < 1 .OR. channel > nchan ) then - iret = -1 - write(*,*) 'attempt to validate channel out of range', channel - else if( region < 1 .OR. region > nregion ) then - iret = -2 - write(*,*) 'attempt to validate region out of range', region - else - ! - ! all unassimilated channels in the base files will have an rmiss - ! value and are considered valid for verification purposes - ! - if( avg_count(channel,region) < 0.0 ) then - valid = .TRUE. - else - sdv2 = 2 * sdv_count( channel, region ) - hi = avg_count(channel,region) + sdv2 - lo = avg_count(channel,region) - sdv2 - - ! - ! Consider any count valid if: - ! cnt is 2 sdvs from avg or - ! cnt is within the established min/max range for chan,region - ! - if( cnt > 0.0 ) then - valid = .TRUE. - end if - !if( cnt <= hi .AND. cnt >= lo ) then - ! valid = .TRUE. - !else if( (cnt > 0) .AND. (cnt >= min_count( channel,region )) .AND. & - ! (cnt <= max_count( channel,region )) ) then - ! valid = .TRUE. - !end if - end if - - end if - - if ( valid .eqv. .FALSE. ) then - write(*,*) ' avg_count(channel,region), sdv2, hi, lo = ', avg_count(channel,region), sdv2, hi, lo - end if - write (*,*) '<-- valid, iret=', valid, iret - else - !--- base file was not loaded, so return a warning that validation isn't possible - iret = 1 - end if - end subroutine validate_count - - - !------------------------------------------------------------- - ! validate a penalty value - ! given a penalty value for a channel and region, determine - ! if the penalty is within +/- 2*sdv - ! - ! iret 0 = normal - ! -1 = invalid channel - ! -2 = invalid region - !------------------------------------------------------------- - subroutine validate_penalty( channel, region, penalty, valid, bound, iret ) - - !--- interface - integer, intent( in ) :: channel - integer, intent( in ) :: region - real, intent( in ) :: penalty - logical, intent( out ) :: valid - real, intent( out ) :: bound - integer, intent( out ) :: iret - - !--- vars - real hi, lo, sdv2 - - write(*,*) '--> validate_penalty, channel, region, penalty ', channel, region, penalty - - !--- initialize vars - iret = 0 - valid = .FALSE. - bound = rmiss - - if( base_loaded .eqv. .TRUE. ) then - if( channel < 1 .OR. channel > nchan ) then - iret = -1 - write(*,*) 'attempt to validate channel out of range', channel - else if( region < 1 .OR. region > nregion ) then - iret = -2 - write(*,*) 'attempt to validate region out of range', region - else - ! - ! all unassimilated channels in the base files will have an rmiss - ! value and are considered valid for verification purposes - ! - bound = max_penalty( channel,region ) - - if( avg_penalty(channel,region) < 0.0 ) then - valid = .TRUE. - else - sdv2 = 2 * sdv_penalty( channel, region ) - hi = avg_penalty(channel,region) + sdv2 - lo = avg_penalty(channel,region) - sdv2 - - ! - ! Consider any penalty value valid if: - ! penalty is 2 sdvs from avg or - ! penalty is greater than the established max range for - ! chan,region by 20% or more --> idea here is to stage - ! two levels of warning, say a 20% exceedence and then - ! maybe a 25% or 30% exceedence for a yellow and red - ! level warning. - ! - if( (penalty >= 0.0) .AND. penalty <= hi ) then - valid = .TRUE. - else if( (penalty > 0.0) .AND. & - (penalty <= (max_penalty( channel,region )*1.2) ) ) then - valid = .TRUE. - !else if( penalty > hi ) then - ! bound = max_penalty( channel,region ) - end if - - end if - end if - - if ( valid .eqv. .FALSE. ) then - write(*,*) ' BAD: penalty, avg_penalty(channel,region), sdv2, hi, lo, bound = ', penalty, avg_penalty(channel,region), sdv2, hi, lo, bound - end if - write (*,*) '<-- valid, iret=', valid, iret - else - !--- base file was not loaded, so return a warning that validation isn't possible - iret = 1 - end if - end subroutine validate_penalty - - -end module valid diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/ush/radmon_ck_stdout.sh b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/ush/radmon_ck_stdout.sh deleted file mode 100755 index 6e408a0c72..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/ush/radmon_ck_stdout.sh +++ /dev/null @@ -1,126 +0,0 @@ -#!/bin/ksh - -################################################################################ -#### UNIX Script Documentation Block -# . . -# Script name: radmon_ck_stdout.sh -# Script description: Scan stdout files for problems reading the diagnostic -# files. -# -# Author: Ed Safford Org: NP23 Date: 2012-02-02 -# -# Abstract: This script scans the stdout files produced by the radmon_time -# executable for problems reading the diagnostic files. -# -# This script is a child script of radmon_verf_time.sh. The parent -# script generates the stdout files which this script examines. -# -# -# Script history log: -# 2012-02-02 Safford initial script -# -# Usage: radmon_ck_stdout.sh outfile -# -# Input script positional parameters: -# outfile output file name -# required -# -# Imported Shell Variables: -# SATYPE list of satellite/instrument sources -# defaults to none -# INISCRIPT preprocessing script -# defaults to none -# LOGSCRIPT log script -# defaults to none -# ERRSCRIPT error processing script -# defaults to 'eval [[ $err = 0 ]]' -# ENDSCRIPT postprocessing script -# defaults to none -# VERBOSE Verbose flag (YES or NO) -# defaults to NO -# -# Exported Shell Variables: -# err Last return code -# -# Modules and files referenced: -# scripts : $INISCRIPT -# $LOGSCRIPT -# $ERRSCRIPT -# $ENDSCRIPT -# -# programs : -# -# fixed data : -# -# input data : $data_file -# -# output data: $outfile -# -# Remarks: -# -# Condition codes -# 0 - no problem encountered -# >0 - some problem encountered -# -# Control variable resolution priority -# 1 Command line argument. -# 2 Environment variable. -# 3 Inline default. -# -# Attributes: -# Language: POSIX shell -# Machine: IBM SP -#################################################################### -# Command line arguments. -outfile=${1:-${outfile:?}} - -# Directories -# File names -INISCRIPT=${INISCRIPT:-} -LOGSCRIPT=${LOGSCRIPT:-} -ERRSCRIPT=${ERRSCRIPT:-} -ENDSCRIPT=${ENDSCRIPT:-} - -# Other variables -SATYPE=${SATYPE:-} -err=0 - -if [[ "$VERBOSE" = "YES" ]]; then - set -ax - echo "$(date) executing $0 $* >&2" -fi -################################################################################ -# Preprocessing -$INISCRIPT -$LOGSCRIPT - -outfile=$1 -error_msg="PROBLEM reading diagnostic file" - -for type in ${SATYPE}; do - if [[ "$VERBOSE" = "YES" ]]; then - echo ${type} - fi - if [[ -s "stdout.${type}" ]]; then - if [[ "$VERBOSE" = "YES" ]]; then - echo stdout.${type} - fi - match=`gawk "/$error_msg/" stdout.$type` - - match_len=`echo ${#match}` - if [[ $match_len > 0 ]]; then - echo "${type} ${match}" >> $outfile - fi - fi -done - -################################################################################ -# Post processing -$ENDSCRIPT -set +x - -if [[ "$VERBOSE" = "YES" ]]; then - echo $(date) EXITING $0 with error code ${err} >&2 -fi - -exit ${err} diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/ush/radmon_err_rpt.sh b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/ush/radmon_err_rpt.sh deleted file mode 100755 index c34bcf828c..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/ush/radmon_err_rpt.sh +++ /dev/null @@ -1,259 +0,0 @@ -#!/bin/ksh - -################################################################################ -#### UNIX Script Documentation Block -# . . -# Script name: radmon_err_rpt.sh -# Script description: Compare the contents of error files from two different -# cycles. -# -# Author: Ed Safford Org: NP23 Date: 2012-02-02 -# -# Abstract: This script compares the contents of two error files from two different -# sets of radiance diagnostic files (which are an output from GSI runs). -# All unique satellite instrument/channel/region combinations that appear -# in both files are reported. -# -# This script is a child script of radmon_verf_time.sh. The parent -# script creates/copies the error files into a temporary working -# directory before invoking this script. -# -# -# Script history log: -# 2012-02-02 Safford initial script -# -# Usage: radmon_err_rpt.sh file1 file2 type cycle1 cycle2 diag_rpt outfile -# -# Input script positional parameters: -# file1 obs, penalty, or channel error file -# required -# file2 obs, penalty, or channel error file -# required -# type type of error file -# choises are obs, pen, or chan; required -# cycle1 first cycle processing date -# yyyymmddcc format; required -# cycle2 second cycle processing date -# yyyymmddcc format; required -# diag_rpt diagnostic report text file -# required -# outfile output file name -# required -# -# Imported Shell Variables: -# -# HOMEradmon package's nwprod subdirectory -# defaults to pwd -# INISCRIPT preprocessing script -# defaults to none -# LOGSCRIPT log script -# defaults to none -# ERRSCRIPT error processing script -# defaults to 'eval [[ $err = 0 ]]' -# ENDSCRIPT postprocessing script -# defaults to none -# VERBOSE Verbose flag (YES or NO) -# defaults to NO -# -# Exported Shell Variables: -# err Last return code -# -# Modules and files referenced: -# scripts : $INISCRIPT -# $LOGSCRIPT -# $ERRSCRIPT -# $ENDSCRIPT -# -# programs : radmon_getchgrp.pl -# -# -# fixed data : $ctlfile -# -# input data : $file1 -# $file2 -# -# output data: $outfile -# -# Remarks: -# -# Condition codes -# 0 - no problem encountered -# >0 - some problem encountered -# -# Control variable resolution priority -# 1 Command line argument. -# 2 Environment variable. -# 3 Inline default. -# -# Attributes: -# Language: POSIX shell -# Machine: IBM SP -#################################################################### -# Command line arguments. -file1=${1:-${file1:?}} -file2=${2:-${file2:?}} -type=${3:-${type:?}} -cycle1=${4:-${cycle1:?}} -cycle2=${5:-${cycle2:?}} -diag_rpt=${6:-${diag_rpt:?}} -outfile=${7:-${outfile:?}} - -# Directories -HOMEradmon=${HOMEradmon:-$(pwd)} - -# File names -INISCRIPT=${INISCRIPT:-} -LOGSCRIPT=${LOGSCRIPT:-} -ERRSCRIPT=${ERRSCRIPT:-} -ENDSCRIPT=${ENDSCRIPT:-} - -# Other variables -VERBOSE=${VERBOSE:-NO} -err=0 -SUFFIX=${SUFFIX} - -if [[ "$VERBOSE" = "YES" ]]; then - echo EXECUTING $0 $* >&2 - set -ax -fi - -#export list=$list0 - - have_diag_rpt=0 - if [[ -s $diag_rpt ]]; then - have_diag_rpt=1 - else - err=1 - fi - - -#----------------------------------------------------------------------------- -# read each line in the $file1 -# search $file2 for the same satname, channel, and region -# if same combination is in both files, add the values to the output file -# - { while read myline;do - bound="" - - echo $myline - satname=`echo $myline | gawk '{print $1}'` - echo satname = $satname - channel=`echo $myline | gawk '{print $3}'` - echo channel = $channel - region=`echo $myline | gawk '{print $5}'` - echo region = $region - value1=`echo $myline | gawk '{print $7}'` - echo value1 = $value1 - bound=`echo $myline | gawk '{print $9}'` - -# -# Check findings against diag_report. If the satellite/instrument is on the -# diagnostic report it means the diagnostic file file for the -# satelite/instrument is missing for this cycle, so skip any additional -# error checking for that source. Otherwise, evaluate as per normal. -# - - diag_match="" - diag_match_len=0 - - if [[ $have_diag_rpt == 1 ]]; then - diag_match=`gawk "/$satname/" $diag_rpt` - diag_match_len=`echo ${#diag_match}` - fi - - - if [[ $diag_match_len == 0 ]]; then - - if [[ $type == "chan" ]]; then - match=`gawk "/$satname/ && /channel= $channel/" $file2` - else - match=`gawk "/$satname/ && /channel= $channel / && /region= $region /" $file2` - echo match = $match - - match_len=`echo ${#match}` - if [[ $match_len > 0 ]]; then - channel2=`echo $match | gawk '{print $3}'` - echo channel2 = $channel2 - if [[ $channel2 != $channel ]]; then - match="" - fi - fi - echo match = $match - fi - match_len=`echo ${#match}` - - if [[ $match_len > 0 ]]; then - echo $match_len - value2=`echo $match | gawk '{print $7}'` - bound2=`echo $match | gawk '{print $9}'` - - if [[ $type == "chan" ]]; then - tmpa="$satname channel= $channel" - tmpb="" - - elif [[ $type == "pen" ]]; then - tmpa="$satname channel= $channel region= $region" - tmpb="$cycle1 $value1 $bound" - - else - tmpa="$satname channel= $channel region= $region" - tmpb="$cycle1: $type= $value1" - fi - - line1="$tmpa $tmpb" - echo "$line1" >> $outfile - - if [[ $type != "chan" ]]; then - tmpc=`echo $tmpa |sed 's/[a-z]/ /g' | sed 's/[0-9]/ /g' | sed 's/=/ /g' | sed 's/_/ /g' | sed 's/-/ /g'` - - if [[ $type == "pen" ]]; then - line2=" $tmpc $cycle2 $value2 $bound2" - else - line2=" $tmpc $cycle2: $type= $value2" - fi - - echo "$line2" >> $outfile - fi - - #---------------------------------------------------------- - # Access the control file to deterimine channel grouping - # number. Not all sources have consecutively numbered - # channels, and we need to map the channel to the correct - # grouping number in order to produce an accurate hyperlink. - # - # Update: with the new js plotting the actual channel number - # can be sent. This applies to all glb sources now; it's not - # yet implemented for regional sources. - if [[ $RAD_AREA == 'glb' ]]; then - changrp=${channel} - echo "for glb using actual channel as changrp value" - else - ctlfile="time.${satname}.ctl" - if [[ -s ${ctlfile}.Z || -s ${ctlfile}.gz ]]; then - uncompress ${ctlfile}.* - fi - changrp=`${HOMEradmon}/ush/radmon_getchgrp.pl ${ctlfile} ${channel}` - fi - echo changrp = $changrp - - line3=" http://www.emc.ncep.noaa.gov/gmb/gdas/radiance/esafford/${SUFFIX}/index.html?sat=${satname}®ion=${region}&channel=${changrp}&stat=${type}" - if [[ $changrp -gt 0 ]]; then - echo "$line3" >> $outfile - echo "" >> $outfile - fi - fi - fi - done } < $file1 - - -################################################################################ -# Post processing -$ENDSCRIPT -set +x - -if [[ "$VERBOSE" = "YES" ]]; then - echo $(date) EXITING $0 with error code ${err} >&2 -fi - -exit ${err} - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/ush/radmon_getchgrp.pl b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/ush/radmon_getchgrp.pl deleted file mode 100755 index 890beb15a7..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/ush/radmon_getchgrp.pl +++ /dev/null @@ -1,82 +0,0 @@ -#! /usr/bin/perl - -################################################################################ -#### Perl Script Documentation Block -# . . -# Script name: radmon_getchgrp.pl -# Script description: Find the channel grouping number for a given setllite and -# channel. -# -# Author: Ed Safford Org: NP23 Date: 2012-02-02 -# -# Abstract: This script determines the channel grouping number for a given -# satellite and channel number. Most, but not all satellite sources -# have consecutively numbered channels. This script locates the -# channel and determines in which block of images that channel would be -# located. -# -# -# Script history log: -# 2012-02-02 Safford initial script -# -# Usage: radmon_getchgrp.pl ctl_file channel -# -# Input script positional parameters: -# ctl_file meta-data file -# required -# channel satellite/instrument channel number -# required -# -# output data: $chan_grp -# -# -# Remarks: -# -# Condition codes -# 0 - no problem encountered -# >0 - some problem encountered -# -# Control variable resolution priority -# 1 Command line argument. -# -# Attributes: -# Language: Perl script -# Machine: IBM SP -#################################################################### - -$numArgs = $#ARGV + 1; - -if( $numArgs < 2 ) { - print" Usage: \n"; - print" radmon_gtchgrp.pl sat_control_file, channel \n"; - exit(1); -} -else { - $ctl_file = @ARGV[0]; - $channel = @ARGV[1]; -} - -#---------------------------------------------------------- -# Load the control file -#---------------------------------------------------------- -open( CTLFILE, $ctl_file ) or die "Can't open $ctl_file \n"; - -$chan_grp = 0; -$ctr = 0; - -while( $line = ) { - if ( $line =~ m/iuse/ ) { - $ctr+=1; - @fields = split ' ', $line; - if( $fields[4] == $channel ) { - $chan_grp = int( $ctr/4 ); - if( $ctr % 4 > 0 ) { - $chan_grp +=1; - break; - } - } - } -} - -print "$chan_grp\n"; -close CTLFILE; diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/ush/radmon_verf_angle.sh b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/ush/radmon_verf_angle.sh deleted file mode 100755 index 9c43020d8f..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/ush/radmon_verf_angle.sh +++ /dev/null @@ -1,245 +0,0 @@ -#!/bin/ksh - -################################################################################ -#### UNIX Script Documentation Block -# . . -# Script name: radmon_verf_angle.sh -# Script description: Extract angle dependent data from radiance -# diagnostic files. -# -# Author: Ed Safford Org: NP23 Date: 2012-02-02 -# -# Abstract: This script extracts angle dependent data from radiance -# diagnostic files (which are an output from GSI runs), -# storing the extracted data in small binary files. -# -# This script is a child script of exgdas_vrfyrad.sh.sms. The parent -# script opens and uncompresses the radiance diagnostic file and copies -# other supporting files into a temporary working directory. -# -# -# Script history log: -# 2012-02-02 Safford initial script -# -# Usage: radmon_verf_angle.sh PDATE -# -# Input script positional parameters: -# PDATE processing date -# yyyymmddcc format; required -# -# Imported Shell Variables: -# SUFFIX data source suffix -# defauls to opr -# MAKE_CTL switch to construct the meta-data control file -# defaults to 1 (on) -# MAKE_DATA switch to construct the binary data file -# defaults to 1 (on) -# EXECradmon executable directory -# defaults to current directory -# FIXradmon fixed data directory -# defaults to current directory -# RAD_AREA global or regional flag -# defaults to global -# TANKverf_rad data repository -# defaults to current directory -# SATYPE list of satellite/instrument sources -# defaults to none -# INISCRIPT preprocessing script -# defaults to none -# LOGSCRIPT log script -# defaults to none -# ERRSCRIPT error processing script -# defaults to 'eval [[ $err = 0 ]]' -# ENDSCRIPT postprocessing script -# defaults to none -# VERBOSE Verbose flag (YES or NO) -# defaults to NO -# LITTLE_ENDIAN flag to indicate LE machine -# defaults to 0 (big endian) -# USE_ANL use analysis files as inputs in addition to -# the ges files. Default is 0 (ges only) -# -# Exported Shell Variables: -# err Last return code -# -# Modules and files referenced: -# scripts : $INISCRIPT -# $LOGSCRIPT -# $ERRSCRIPT -# $ENDSCRIPT -# -# programs : $NCP -# $angle_exec -# -# fixed data : $scaninfo -# -# input data : $data_file -# -# output data: $angle_file -# $angle_ctl -# $angle_stdout -# -# Remarks: -# -# Condition codes -# 0 - no problem encountered -# >0 - some problem encountered -# -# Control variable resolution priority -# 1 Command line argument. -# 2 Environment variable. -# 3 Inline default. -# -# Attributes: -# Language: POSIX shell -# Machine: IBM SP -#################################################################### -# Command line arguments. -export PDATE=${1:-${PDATE:?}} - -# Directories -FIXradmon=${FIXradmon:-$(pwd)} -EXECradmon=${EXECradmon:-$(pwd)} -TANKverf_rad=${TANKverf_rad:-$(pwd)} - -# File names -INISCRIPT=${INISCRIPT:-} -LOGSCRIPT=${LOGSCRIPT:-} -ERRSCRIPT=${ERRSCRIPT:-} -ENDSCRIPT=${ENDSCRIPT:-} - -# Other variables -MAKE_CTL=${MAKE_CTL:-1} -MAKE_DATA=${MAKE_DATA:-1} -RAD_AREA=${RAD_AREA:-glb} -SATYPE=${SATYPE:-} -VERBOSE=${VERBOSE:-NO} -LITTLE_ENDIAN=${LITTLE_ENDIAN:-0} -USE_ANL=${USE_ANL:-0} - -if [[ $USE_ANL -eq 1 ]]; then - gesanl="ges anl" -else - gesanl="ges" -fi - -err=0 -angle_exec=radmon_angle -scaninfo=scaninfo.txt - -if [[ "$VERBOSE" = "YES" ]]; then - set -ax - echo "$(date) executing $0 $* >&2" -fi -################################################################################ -# Preprocessing -$INISCRIPT -$LOGSCRIPT - - -#-------------------------------------------------------------------- -# Copy extraction program and supporting files to working directory - -$NCP ${EXECradmon}/${angle_exec} ./ -$NCP $FIXradmon/gdas_radmon_scaninfo.txt ./${scaninfo} - -if [[ ! -s ./${angle_exec} || ! -s ./${scaninfo} ]]; then - err=2 -else -#-------------------------------------------------------------------- -# Run program for given time - - iyy=`echo $PDATE | cut -c1-4` - imm=`echo $PDATE | cut -c5-6` - idd=`echo $PDATE | cut -c7-8` - ihh=`echo $PDATE | cut -c9-10` - - ctr=0 - fail=0 - - for type in ${SATYPE}; do - - for dtype in ${gesanl}; do - - ctr=`expr $ctr + 1` - - if [[ $dtype == "anl" ]]; then - data_file=${type}_anl.${PDATE}.ieee_d - angl_file=angle.${data_file} - ctl_file=${type}_anl.ctl - angl_ctl=angle.${ctl_file} - stdout_file=stdout.${type}_anl - angl_stdout=angle.${stdout_file} - else - data_file=${type}.${PDATE}.ieee_d - angl_file=angle.${data_file} - ctl_file=${type}.ctl - angl_ctl=angle.${ctl_file} - stdout_file=stdout.${type} - angl_stdout=angle.${stdout_file} - fi - - rm input - - nchanl=-999 -cat << EOF > input - &INPUT - satname='${type}', - iyy=${iyy}, - imm=${imm}, - idd=${idd}, - ihh=${ihh}, - idhh=-720, - incr=6, - nchanl=${nchanl}, - suffix='${SUFFIX}', - imkctl=${MAKE_CTL}, - imkdata=${MAKE_DATA}, - gesanl='${dtype}', - little_endian=${LITTLE_ENDIAN}, - rad_area='${RAD_AREA}', - / -EOF - $TIMEX ./${angle_exec} < input > ${stdout_file} - if [[ $? -ne 0 ]]; then - fail=`expr $fail + 1` - fi -#------------------------------------------------------------------- -# move data, control, and stdout files to $TANKverf_rad and compress -# - if [[ -s ${data_file} ]]; then - mv ${data_file} ${angl_file} - mv ${angl_file} $TANKverf_rad/. - ${COMPRESS} -f $TANKverf_rad/${angl_file} - fi - - if [[ -s ${ctl_file} ]]; then - mv ${ctl_file} ${angl_ctl} - mv ${angl_ctl} ${TANKverf_rad}/. - ${COMPRESS} -f ${TANKverf_rad}/${angl_ctl} - fi - - if [[ -s ${stdout_file} ]]; then - mv ${stdout_file} ${angl_stdout} - mv ${angl_stdout} ${TANKverf_rad}/. - ${COMPRESS} -f ${TANKverf_rad}/${angl_stdout} - fi - - done # for dtype in ${gesanl} loop - done # for type in ${SATYPE} loop - - if [[ $fail -eq $ctr || $fail -gt $ctr ]]; then - err=3 - fi -fi - -################################################################################ -# Post processing -$ENDSCRIPT -set +x - -if [[ "$VERBOSE" = "YES" ]]; then - echo $(date) EXITING $0 error code ${err} >&2 -fi - -exit ${err} diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/ush/radmon_verf_bcoef.sh b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/ush/radmon_verf_bcoef.sh deleted file mode 100755 index ab63eeb1c8..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/ush/radmon_verf_bcoef.sh +++ /dev/null @@ -1,247 +0,0 @@ -#!/bin/ksh - -################################################################################ -#### UNIX Script Documentation Block -# . . -# Script name: radmon_verf_bcoef.sh -# Script description: Extract bias correction coefficients data from radiance -# diagnostic files. -# -# Author: Ed Safford Org: NP23 Date: 2012-02-02 -# -# Abstract: This script extracts bias correction coefficient related data from -# radiance diagnostic files (which are an output from GSI runs), -# storing the extracted data in small binary files. -# -# This script is a child script of exgdas_vrfyrad.sh.sms. The parent -# script opens and uncompresses the radiance diagnostic file and copies -# other supporting files into a temporary working directory. -# -# -# Script history log: -# 2012-02-02 Safford initial script -# -# Usage: radmon_verf_bcoef.sh PDATE -# -# Input script positional parameters: -# PDATE processing date -# yyyymmddcc format; required -# -# Imported Shell Variables: -# SUFFIX data source suffix -# defauls to opr -# MAKE_CTL switch to construct the meta-data control file -# defaults to 1 (on) -# MAKE_DATA switch to construct the binary data file -# defaults to 1 (on) -# EXECradmon executable directory -# defaults to current directory -# FIXradmon fixed data directory -# defaults to current directory -# RAD_AREA global or regional flag -# defaults to global -# TANKverf_rad data repository -# defaults to current directory -# SATYPE list of satellite/instrument sources -# defaults to none -# INISCRIPT preprocessing script -# defaults to none -# LOGSCRIPT log script -# defaults to none -# ERRSCRIPT error processing script -# defaults to 'eval [[ $err = 0 ]]' -# ENDSCRIPT postprocessing script -# defaults to none -# VERBOSE Verbose flag (YES or NO) -# defaults to NO -# LITTLE_ENDIAN flag for LE machine -# defaults to 0 (big endian) -# -# Exported Shell Variables: -# err Last return code -# -# Modules and files referenced: -# scripts : $INISCRIPT -# $LOGSCRIPT -# $ERRSCRIPT -# $ENDSCRIPT -# -# programs : $NCP -# $bcoef_exec -# -# fixed data : $biascr -# -# input data : $data_file -# -# output data: $bcoef_file -# $bcoef_ctl -# $bcoef_stdout -# -# Remarks: -# -# Condition codes -# 0 - no problem encountered -# >0 - some problem encountered -# -# Control variable resolution priority -# 1 Command line argument. -# 2 Environment variable. -# 3 Inline default. -# -# Attributes: -# Language: POSIX shell -# Machine: IBM SP -#################################################################### -# Command line arguments. -export PDATE=${1:-${PDATE:?}} - -# Directories -FIXradmon=${FIXradmon:-$(pwd)} -EXECradmon=${EXECradmon:-$(pwd)} -TANKverf_rad=${TANKverf_rad:-$(pwd)} - -# File names -INISCRIPT=${INISCRIPT:-} -LOGSCRIPT=${LOGSCRIPT:-} -ERRSCRIPT=${ERRSCRIPT:-} -ENDSCRIPT=${ENDSCRIPT:-} - -# Other variables -MAKE_CTL=${MAKE_CTL:-1} -MAKE_DATA=${MAKE_DATA:-1} -RAD_AREA=${RAD_AREA:-glb} -SATYPE=${SATYPE:-} -VERBOSE=${VERBOSE:-NO} -LITTLE_ENDIAN=${LITTLE_ENDIAN:-0} -USE_ANL=${USE_ANL:-0} -err=0 -#bcoef_exec=radmon_bcoef.${RAD_AREA} -bcoef_exec=radmon_bcoef - -if [[ "$VERBOSE" = "YES" ]]; then - set -ax - echo "$(date) executing $0 $* >&2" -fi -################################################################################ -# Preprocessing -$INISCRIPT -$LOGSCRIPT - -if [[ $USE_ANL -eq 1 ]]; then - gesanl="ges anl" -else - gesanl="ges" -fi - -#-------------------------------------------------------------------- -# Copy extraction program and supporting files to working directory - -$NCP $EXECradmon/${bcoef_exec} ./${bcoef_exec} -$NCP ${biascr} ./biascr.txt - -if [[ ! -s ./${bcoef_exec} || ! -s ./biascr.txt ]]; then - err=4 -else - - -#-------------------------------------------------------------------- -# Run program for given time - - iyy=`echo $PDATE | cut -c1-4` - imm=`echo $PDATE | cut -c5-6` - idd=`echo $PDATE | cut -c7-8` - ihh=`echo $PDATE | cut -c9-10` - - ctr=0 - fail=0 - - for type in ${SATYPE}; do - for dtype in ${gesanl}; do - ctr=`expr $ctr + 1` - - if [[ $dtype == "anl" ]]; then - data_file=${type}_anl.${PDATE}.ieee_d - bcoef_file=bcoef.${data_file} - ctl_file=${type}_anl.ctl - bcoef_ctl=bcoef.${ctl_file} - stdout_file=stdout.${type}_anl - bcoef_stdout=bcoef.${stdout_file} - else - data_file=${type}.${PDATE}.ieee_d - bcoef_file=bcoef.${data_file} - ctl_file=${type}.ctl - bcoef_ctl=bcoef.${ctl_file} - stdout_file=stdout.${type} - bcoef_stdout=bcoef.${stdout_file} - fi - - rm input - - nchanl=-999 - npredr=5 - -cat << EOF > input - &INPUT - satname='${type}', - npredr=${npredr}, - nchanl=${nchanl}, - iyy=${iyy}, - imm=${imm}, - idd=${idd}, - ihh=${ihh}, - idhh=-720, - incr=6, - suffix='${SUFFIX}', - imkctl=${MAKE_CTL}, - imkdata=${MAKE_DATA}, - gesanl='${dtype}', - little_endian=${LITTLE_ENDIAN}, - / -EOF - $TIMEX ./${bcoef_exec} < input > ${stdout_file} - if [[ $? -ne 0 ]]; then - fail=`expr $fail + 1` - fi - - -#------------------------------------------------------------------- -# move data, control, and stdout files to $TANKverf_rad and compress -# - - if [[ -s ${data_file} ]]; then - mv ${data_file} ${bcoef_file} - mv ${bcoef_file} $TANKverf_rad/. - ${COMPRESS} -f $TANKverf_rad/${bcoef_file} - fi - - if [[ -s ${ctl_file} ]]; then - mv ${ctl_file} ${bcoef_ctl} - mv ${bcoef_ctl} ${TANKverf_rad}/. - ${COMPRESS} -f ${TANKverf_rad}/${bcoef_ctl} - fi - - if [[ -s ${stdout_file} ]]; then - mv ${stdout_file} ${bcoef_stdout} - mv ${bcoef_stdout} ${TANKverf_rad}/. - ${COMPRESS} -f ${TANKverf_rad}/${bcoef_stdout} - fi - - done # dtype in $gesanl loop - done # type in $SATYPE loop - - if [[ $fail -eq $ctr || $fail -gt $ctr ]]; then - err=5 - fi -fi - - -################################################################################ -# Post processing -$ENDSCRIPT -set +x - -if [[ "$VERBOSE" = "YES" ]]; then - echo $(date) EXITING $0 with error code ${err} >&2 -fi - -exit ${err} diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/ush/radmon_verf_bcor.sh b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/ush/radmon_verf_bcor.sh deleted file mode 100755 index ce2b7a08b9..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/ush/radmon_verf_bcor.sh +++ /dev/null @@ -1,251 +0,0 @@ -#!/bin/ksh - -################################################################################ -#### UNIX Script Documentation Block -# . . -# Script name: radmon_verf_bcor.sh -# Script description: Extract bias correction data from radiance diagnostic -# files. -# -# Author: Ed Safford Org: NP23 Date: 2012-02-02 -# -# Abstract: This script extracts bias correction related data from radiance -# diagnostic files (which are an output from GSI runs), storing the -# extracted data in small binary files. -# -# This script is a child script of exgdas_vrfyrad.sh.sms. The parent -# script opens and uncompresses the radiance diagnostic file and copies -# other supporting files into a temporary working directory. -# -# -# Script history log: -# 2012-02-02 Safford initial script -# -# Usage: radmon_verf_bcor.sh PDATE -# -# Input script positional parameters: -# PDATE processing date -# yyyymmddcc format; required -# -# Imported Shell Variables: -# SUFFIX data source suffix -# defauls to opr -# MAKE_CTL switch to construct the meta-data control file -# defaults to 1 (on) -# MAKE_DATA switch to construct the binary data file -# defaults to 1 (on) -# EXECradmon executable directory -# defaults to current directory -# FIXradmon fixed data directory -# defaults to current directory -# RAD_AREA global or regional flag -# defaults to global -# TANKverf_rad data repository -# defaults to current directory -# SATYPE list of satellite/instrument sources -# defaults to none -# INISCRIPT preprocessing script -# defaults to none -# LOGSCRIPT log script -# defaults to none -# ERRSCRIPT error processing script -# defaults to 'eval [[ $err = 0 ]]' -# ENDSCRIPT postprocessing script -# defaults to none -# VERBOSE Verbose flag (YES or NO) -# defaults to NO -# LITTLE_ENDIAN flag for little endian machine -# defaults to 0 (big endian) -# -# Exported Shell Variables: -# err Last return code -# -# Modules and files referenced: -# scripts : $INISCRIPT -# $LOGSCRIPT -# $ERRSCRIPT -# $ENDSCRIPT -# -# programs : $NCP -# $bcor_exec -# -# fixed data : none -# -# input data : $data_file -# -# output data: $bcor_file -# $bcor_ctl -# $bcor_stdout -# -# Remarks: -# -# Condition codes -# 0 - no problem encountered -# >0 - some problem encountered -# -# Control variable resolution priority -# 1 Command line argument. -# 2 Environment variable. -# 3 Inline default. -# -# Attributes: -# Language: POSIX shell -# Machine: IBM SP -#################################################################### - -# Command line arguments. -export PDATE=${1:-${PDATE:?}} - -# Directories -FIXradmon=${FIXradmon:-$(pwd)} -EXECradmon=${EXECradmon:-$(pwd)} -TANKverf_rad=${TANKverf_rad:-$(pwd)} - -# File names -INISCRIPT=${INISCRIPT:-} -LOGSCRIPT=${LOGSCRIPT:-} -ERRSCRIPT=${ERRSCRIPT:-} -ENDSCRIPT=${ENDSCRIPT:-} - -# Other variables -MAKE_CTL=${MAKE_CTL:-1} -MAKE_DATA=${MAKE_DATA:-1} -RAD_AREA=${RAD_AREA:-glb} -SATYPE=${SATYPE:-} -VERBOSE=${VERBOSE:-NO} -LITTLE_ENDIAN=${LITTLE_ENDIAN:-0} -USE_ANL=${USE_ANL:-0} -#bcor_exec=radmon_bcor.${RAD_AREA} -bcor_exec=radmon_bcor -err=0 - -if [[ "$VERBOSE" = "YES" ]]; then - set -ax - echo "$(date) executing $0 $* >&2" -fi - -################################################################################ -# Preprocessing -$INISCRIPT -$LOGSCRIPT - -if [[ $USE_ANL -eq 1 ]]; then - gesanl="ges anl" -else - gesanl="ges" -fi - - -#-------------------------------------------------------------------- -# Copy extraction program to working directory - -$NCP ${EXECradmon}/${bcor_exec} ./${bcor_exec} - -if [[ ! -s ./${bcor_exec} ]]; then - err=6 -else - - -#-------------------------------------------------------------------- -# Run program for given time - - iyy=`echo $PDATE | cut -c1-4` - imm=`echo $PDATE | cut -c5-6` - idd=`echo $PDATE | cut -c7-8` - ihh=`echo $PDATE | cut -c9-10` - - ctr=0 - fail=0 - - for type in ${SATYPE}; do - - for dtype in ${gesanl}; do - - ctr=`expr $ctr + 1` - - if [[ $dtype == "anl" ]]; then - data_file=${type}_anl.${PDATE}.ieee_d - bcor_file=bcor.${data_file} - ctl_file=${type}_anl.ctl - bcor_ctl=bcor.${ctl_file} - stdout_file=stdout.${type}_anl - bcor_stdout=bcor.${stdout_file} - else - data_file=${type}.${PDATE}.ieee_d - bcor_file=bcor.${data_file} - ctl_file=${type}.ctl - bcor_ctl=bcor.${ctl_file} - stdout_file=stdout.${type} - bcor_stdout=bcor.${stdout_file} - fi - rm input - - nchanl=-999 - -cat << EOF > input - &INPUT - satname='${type}', - iyy=${iyy}, - imm=${imm}, - idd=${idd}, - ihh=${ihh}, - idhh=-720, - incr=6, - nchanl=${nchanl}, - suffix='${SUFFIX}', - imkctl=${MAKE_CTL}, - imkdata=${MAKE_DATA}, - gesanl='${dtype}', - little_endian=${LITTLE_ENDIAN}, - rad_area='${RAD_AREA}', - / -EOF - $TIMEX ./${bcor_exec} < input > stdout.$type - ./${bcor_exec} < input > stdout.$type - if [[ $? -ne 0 ]]; then - fail=`expr $fail + 1` - fi - - -#------------------------------------------------------------------- -# move data, control, and stdout files to $TANKverf_rad and compress -# - - if [[ -s ${data_file} ]]; then - mv ${data_file} ${bcor_file} - mv ${bcor_file} $TANKverf_rad/. - ${COMPRESS} -f $TANKverf_rad/${bcor_file} - fi - - if [[ -s ${ctl_file} ]]; then - mv ${ctl_file} ${bcor_ctl} - mv ${bcor_ctl} ${TANKverf_rad}/. - ${COMPRESS} -f ${TANKverf_rad}/${bcor_ctl} - fi - - if [[ -s ${stdout_file} ]]; then - mv ${stdout_file} ${bcor_stdout} - mv ${bcor_stdout} ${TANKverf_rad}/. - ${COMPRESS} -f ${TANKverf_rad}/${bcor_stdout} - fi - - done # dtype in $gesanl loop - done # type in $SATYPE loop - - - if [[ $fail -eq $ctr || $fail -gt $ctr ]]; then - err=7 - fi -fi - -################################################################################ -# Post processing -$ENDSCRIPT -set +x - -if [[ "$VERBOSE" = "YES" ]]; then - echo $(date) EXITING $0 error code ${err} >&2 -fi - -exit ${err} - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/ush/radmon_verf_time.sh b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/ush/radmon_verf_time.sh deleted file mode 100755 index e683378658..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.1/ush/radmon_verf_time.sh +++ /dev/null @@ -1,524 +0,0 @@ -#!/bin/ksh - -################################################################################ -#### UNIX Script Documentation Block -# . . -# Script name: radmon_verf_time.sh -# Script description: Extract time data from radiance diagnostic files, -# perform data integrity checks. -# -# Author: Ed Safford Org: NP23 Date: 2012-02-02 -# -# Abstract: This script extracts time related data from radiance diagnostic -# files (which are an output from GSI runs), storing the extracted -# data in small binary files. Data integrity checks are performed -# on the data and mail messages are sent if potential errors are -# detected. -# -# This script is a child script of exgdas_vrfyrad.sh.sms. The parent -# script opens and uncompresses the radiance diagnostic file and copies -# other supporting files into a temporary working directory. -# -# -# Script history log: -# 2012-02-02 Safford initial script -# -# Usage: radmon_verf_time.sh PDATE -# -# Input script positional parameters: -# PDATE processing date -# yyyymmddcc format; required -# -# Imported Shell Variables: -# DO_DIAG_RPT switch to build the diagnostic report -# defaults to 1 (on) -# DO_DATA_RPT switch to build the data report -# defaults to 1 (on) -# SUFFIX data source suffix -# defauls to opr -# MAKE_CTL switch to construct the meta-data control file -# defaults to 1 (on) -# MAKE_DATA switch to construct the binary data file -# defaults to 1 (on) -# EXECradmon executable directory -# defaults to current directory -# FIXradmon fixed data directory -# defaults to current directory -# RAD_AREA global or regional flag -# defaults to global -# TANKverf_rad data repository -# defaults to current directory -# SATYPE list of satellite/instrument sources -# defaults to none -# MAIL_TO email recipients -# defaults to none -# MAIL_CC email cc recipients -# defaults to none -# INISCRIPT preprocessing script -# defaults to none -# LOGSCRIPT log script -# defaults to none -# ERRSCRIPT error processing script -# defaults to 'eval [[ $err = 0 ]]' -# ENDSCRIPT postprocessing script -# defaults to none -# VERBOSE Verbose flag (YES or NO) -# defaults to NO -# LITTLE_ENDIAN flag for little endian machine -# defaults to 0 (big endian) -# -# Exported Shell Variables: -# err Last return code -# -# Modules and files referenced: -# scripts : $INISCRIPT -# $LOGSCRIPT -# $ERRSCRIPT -# $ENDSCRIPT -# -# programs : $NCP -# $time_exec -# -# fixed data : gdas_radmon_base.tar -# -# input data : $data_file -# -# output data: $time_file -# $time_ctl -# $time_stdout -# $bad_pen -# $bad_chan -# $report -# $diag_report -# -# -# Remarks: -# -# Condition codes -# 0 - no problem encountered -# >0 - some problem encountered -# -# Control variable resolution priority -# 1 Command line argument. -# 2 Environment variable. -# 3 Inline default. -# -# Attributes: -# Language: POSIX shell -# Machine: IBM SP -# -#################################################################### - -# Command line arguments. -export PDATE=${1:-${PDATE:?}} - -# Directories -FIXradmon=${FIXradmon:-$(pwd)} -EXECradmon=${EXECradmon:-$(pwd)} -TANKverf_rad=${TANKverf_rad:-$(pwd)} - -# File names -INISCRIPT=${INISCRIPT:-} -LOGSCRIPT=${LOGSCRIPT:-} -ERRSCRIPT=${ERRSCRIPT:-} -ENDSCRIPT=${ENDSCRIPT:-} - -radmon_err_rpt=${radmon_err_rpt:-${USHradmon}/radmon_err_rpt.sh} -base_file=${base_file:-$FIXradmon/gdas_radmon_base.tar} -report=report.txt -disclaimer=disclaimer.txt -region=region.txt -diag_report=diag_report.txt -diag_hdr=diag_hdr.txt -diag=diag.txt -obs_err=obs_err.txt -obs_hdr=obs_hdr.txt -pen_err=pen_err.txt -pen_hdr=pen_hdr.txt -chan_err=chan_err.txt -chan_hdr=chan_hdr.txt - -# Other variables -DO_DIAG_RPT=${DO_DIAG_RPT:-1} -DO_DATA_RPT=${DO_DATA_RPT:-1} -SUFFIX=${SUFFIX:-opr} -MAKE_CTL=${MAKE_CTL:-1} -MAKE_DATA=${MAKE_DATA:-1} -RAD_AREA=${RAD_AREA:-glb} -SATYPE=${SATYPE:-} -MAIL_TO=${MAIL_TO:-} -MAIL_CC=${MAIL_CC:-} -VERBOSE=${VERBOSE:-NO} -LITTLE_ENDIAN=${LITTLE_ENDIAN:-0} -time_exec=radmon_time -USE_ANL=${USE_ANL:-0} -err=0 - -if [[ "$VERBOSE" = "YES" ]]; then - set -ax - echo "$(date) executing $0 $* >&2" -fi - -################################################################################ -# Preprocessing -$INISCRIPT -$LOGSCRIPT - -if [[ $USE_ANL -eq 1 ]]; then - gesanl="ges anl" -else - gesanl="ges" -fi - -iyy=`echo $PDATE | cut -c1-4` -imm=`echo $PDATE | cut -c5-6` -idd=`echo $PDATE | cut -c7-8` -ihh=`echo $PDATE | cut -c9-10` -cyc=$ihh -CYCLE=$cyc - -#-------------------------------------------------------------------- -# Copy extraction program and base files to working directory -#------------------------------------------------------------------- -$NCP ${EXECradmon}/${time_exec} ./ -if [[ ! -s ./${time_exec} ]]; then - err=8 -fi - -if [[ $DO_DATA_RPT -eq 1 ]]; then - $NCP ${base_file}* ./ - if [[ -e ${base_file}.${Z} ]]; then - ${UNCOMPRESS} ${base_file}.${Z} - fi - tar -xf ${base_file} - if [[ ! -s ${base_file} ]]; then - err=9 - fi -fi - -if [[ $err -eq 0 ]]; then - ctr=0 - fail=0 - -#-------------------------------------------------------------------- -# Loop over each entry in SATYPE -#-------------------------------------------------------------------- - for type in ${SATYPE}; do - ctr=`expr $ctr + 1` - - for dtype in ${gesanl}; do - rm input - - if [[ $dtype == "anl" ]]; then - data_file=${type}_anl.${PDATE}.ieee_d - time_file=time.${data_file} - ctl_file=${type}_anl.ctl - time_ctl=time.${ctl_file} - stdout_file=stdout.${type}_anl - time_stdout=time.${stdout_file} - else - data_file=${type}.${PDATE}.ieee_d - time_file=time.${data_file} - ctl_file=${type}.ctl - time_ctl=time.${ctl_file} - stdout_file=stdout.${type} - time_stdout=time.${stdout_file} - fi -#-------------------------------------------------------------------- -# Run program for given satellite/instrument -#-------------------------------------------------------------------- - nchanl=-999 -cat << EOF > input - &INPUT - satname='${type}', - iyy=${iyy}, - imm=${imm}, - idd=${idd}, - ihh=${ihh}, - idhh=-720 - incr=6 - nchanl=${nchanl}, - suffix='${SUFFIX}', - imkctl=${MAKE_CTL}, - imkdata=${MAKE_DATA}, - gesanl='${dtype}', - little_endian=${LITTLE_ENDIAN}, - rad_area='${RAD_AREA}', - / -EOF - $TIMEX ./${time_exec} < input > ${stdout_file} - if [[ $? -ne 0 ]]; then - fail=`expr $fail + 1` - fi - -#------------------------------------------------------------------- -# move data, control, and stdout files to $TANKverf_rad and compress -#------------------------------------------------------------------- - - if [[ -s ${data_file} ]]; then - mv ${data_file} ${time_file} - mv ${time_file} $TANKverf_rad/. - ${COMPRESS} -f $TANKverf_rad/${time_file} - fi - - if [[ -s ${ctl_file} ]]; then - $NCP ${ctl_file} ${time_ctl} - $NCP ${time_ctl} ${TANKverf_rad}/. - ${COMPRESS} -f ${TANKverf_rad}/${time_ctl} - fi - - if [[ -s ${stdout_file} ]]; then - $NCP ${stdout_file} ${time_stdout} - mv ${time_stdout} ${TANKverf_rad}/. - ${COMPRESS} -f ${TANKverf_rad}/${time_stdout} - fi - - done - done - if [[ $fail -eq $ctr || $fail -gt $ctr ]]; then - err=10 - fi - -fi - - - -#################################################################### -#------------------------------------------------------------------- -# Begin error analysis and reporting -#------------------------------------------------------------------- -#################################################################### - -if [[ $DO_DIAG_RPT -eq 1 ]]; then - -# build the disclaimer and region files - - cat << EOF > ${disclaimer} - - -*********************** WARNING *************************** -THIS IS AN AUTOMATED EMAIL. REPLIES TO SENDER WILL NOT BE -RECEIVED. PLEASE DIRECT REPLIES TO edward.safford@noaa.gov -*********************** WARNING *************************** -EOF - - cat << EOF > ${region} - Region Definitions: - - 1 Global (90S-90N, 0-360E) -EOF - - -#------------------------------------------------------------------- -# Check stdout file for any reported problem(s) reading the -# diagnostic file by calling ck_stdout.sh -# - ${USHradmon}/radmon_ck_stdout.sh ${diag} - - if [[ -s ${diag} ]]; then - cat << EOF > ${diag_hdr} - -Problem Reading Diagnostic File - - $PDATE - - Problems were encountered reading the diagnostic file for - the following sources: - -EOF - - cat ${diag_hdr} >> ${diag_report} - cat ${diag} >> ${diag_report} - if [[ $USE_MAIL -eq 1 ]]; then - cat ${disclaimer} >> ${diag_report} - else - echo End Problem Reading Diagnostic File >> ${diag_report} - echo >> ${diag_report} - fi - rm ${diag} ${diag_hdr} - fi - -#------------------------------------------------------------------- -# mail error notifications or dump to log file - - if [[ -s ${diag_report} ]]; then - lines=`wc -l <${diag_report}` - if [[ $lines -gt 1 ]]; then - - if [[ $USE_MAIL -eq 1 ]]; then - if [[ $MAIL_CC == "" ]]; then - /bin/mail -v -s diagnostic_error_report ${MAIL_TO}< ${diag_report} - else - /bin/mail -v -s diagnostic_error_report -c "${MAIL_CC}" ${MAIL_TO}< ${diag_report} - fi - else - - cat ${diag_report} - fi - else - echo "NO DIAG REPORT" - fi - fi - -fi - - -#------------------------------------------------------------------- -# Assemble the bad penalty/channel report - -if [[ $DO_DATA_RPT -eq 1 ]]; then - - #---------------------------------------------------------------- - # Identify bad_pen and bad_chan files for this cycle and - # previous cycle - - bad_pen=bad_pen.${PDATE} - bad_chan=bad_chan.${PDATE} - - qdate=`$NDATE -06 $PDATE` - pday=`echo $qdate | cut -c1-8` - - prev_bad_pen=bad_pen.${qdate} - prev_bad_chan=bad_chan.${qdate} - - do_rpt=0 - if [[ -s $bad_pen && -s ${TANKverf}/radmon.${pday}/$prev_bad_pen ]]; then - do_rpt=1 - fi - if [[ -s $bad_chan && -s ${TANKverf}/radmon.${pday}/$prev_bad_chan ]]; then - do_rpt=1 - fi - -#-------------------------------------------------------------------- -# Remove extra spaces in new bad_pen file -# - gawk '{$1=$1}1' $bad_pen > tmp.bad_pen - mv -f tmp.bad_pen $bad_pen - - - if [[ $do_rpt -eq 1 ]]; then -#------------------------------------------------------------------- -# copy previous cycle's bad_chan and bad_pen files -# - $NCP ${TANKverf}/radmon.${pday}/${prev_bad_pen} ./ - $NCP ${TANKverf}/radmon.${pday}/${prev_bad_chan} ./ - -#------------------------------------------------------------------- -# run radmon_err_rpt.sh for chan and pen to create the error files -# -# ${USHradmon}/radmon_err_rpt.sh ${prev_bad_pen} ${bad_pen} pen ${qdate} ${PDATE} ${diag_report} ${pen_err} - ${radmon_err_rpt} ${prev_bad_pen} ${bad_pen} pen ${qdate} ${PDATE} ${diag_report} ${pen_err} - - -#------------------------------------------------------------------- -# put together the unified error report with any obs, chan, and -# penalty problems and mail it - - if [[ -s ${obs_err} || -s ${pen_err} || -s ${chan_err} ]]; then - - echo DOING ERROR REPORTING - - echo "Begin Cycle Data Integrity Report" > $report - - cat << EOF >> $report -Cycle Data Integrity Report - $PDATE - -EOF - - cat ${region} >> $report - - if [[ -s ${chan_err} ]]; then - - echo OUTPUTING CHAN_ERR - - cat << EOF > ${chan_hdr} - - The following channels report 0 observational counts over the past two cycles: - - Satellite/Instrument Channel - ==================== ======= - -EOF - - cat ${chan_hdr} >> $report - cat ${chan_err} >> $report - - fi - - if [[ -s ${pen_err} ]]; then - - cat << EOF > ${pen_hdr} - - - Penalty values outside of the established normal range were found - for these sensor/channel/regions in the past two cycles: - - Questionable Penalty Values - ============ ======= ====== Cycle Penalty Bound - ----- ------- ----- -EOF - cat ${pen_hdr} >> $report - cat ${pen_err} >> $report - rm ${pen_hdr} ${pen_err} - fi - - if [[ $USE_MAIL -eq 1 ]]; then - cat ${disclaimer} >> $report - else - echo End Cycle Data Integrity Report >> $report - echo >> $report - fi - fi - -#------------------------------------------------------------------- -# mail error notifications or dump to log file -# - if [[ -s ${report} ]]; then - lines=`wc -l <${report}` - if [[ $lines -gt 2 ]]; then - if [[ $USE_MAIL -eq 1 ]]; then - if [[ $MAIL_CC == "" ]]; then - /bin/mail -v -s cycle_report ${MAIL_TO}< ${report} - else - /bin/mail -v -s cycle_report -c "${MAIL_CC}" ${MAIL_TO}< ${report} - fi - else - cat ${report} - fi - fi - else - echo "NO ERROR REPORT" - fi - - fi - -#------------------------------------------------------------------- -# copy new bad_pen and bad_chan files to $TANKverf_rad - - if [[ -s ${bad_chan} ]]; then - $NCP ${bad_chan} ${TANKverf_rad}/. - fi - - if [[ -s ${bad_pen} ]]; then - $NCP ${bad_pen} ${TANKverf_rad}/. - fi - -fi - -################################################################################ -#------------------------------------------------------------------- -# end error reporting section -#------------------------------------------------------------------- -################################################################################ - -################################################################################ -# Post processing -$ENDSCRIPT -set +x - -if [[ "$VERBOSE" = "YES" ]]; then - echo $(date) EXITING $0 error code ${err} >&2 -fi - -exit ${err} diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/modulefiles/cray/RadMonBuild b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/modulefiles/cray/RadMonBuild deleted file mode 100644 index cf6c40ad42..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/modulefiles/cray/RadMonBuild +++ /dev/null @@ -1,18 +0,0 @@ -#%Module################################################################# -proc ModulesHelp { } { - puts stderr "Set environment variables for WCOSS(cray) radmon build" -} - -module-whatis "Set environment variables for WCOSS(cray) radmon build" - -set ver 2.0.2 -set FCOMP ifort - -setenv CF $FCOMP -setenv FC $FCOMP -setenv FFLAGS "-O3 -fp-model strict -D_REAL8_ -traceback -convert big_endian -assume byterecl" - -setenv D_FFLAGS "-O3 -fp-model strict -D_REAL8_ -traceback -convert big_endian -assume byterecl -debug" -module load intel -module load w3nco-intel/2.0.6 - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/modulefiles/theia/RadMonBuild b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/modulefiles/theia/RadMonBuild deleted file mode 100644 index 0954419273..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/modulefiles/theia/RadMonBuild +++ /dev/null @@ -1,17 +0,0 @@ -#%Module################################################################# -proc ModulesHelp { } { - puts stderr "Set environment variables for THEIA radmon build" -} - -module-whatis "Set environment variables for THEIA radmon build" - -set ver 2.0.2 -set FCOMP ifort - -setenv CF $FCOMP -setenv FC $FCOMP -setenv FFLAGS "-O3 -fp-model strict -D_REAL8_ -traceback -convert big_endian -assume byterecl" -setenv D_FFLAGS "-O3 -fp-model strict -D_REAL8_ -traceback -convert big_endian -assume byterecl -debug" - -setenv W3NCO_LIB4 "-L/scratch3/NCEPDEV/nwprod/lib -lw3nco_4" - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/modulefiles/wcoss/RadMonBuild b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/modulefiles/wcoss/RadMonBuild deleted file mode 100644 index bb1ee8484e..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/modulefiles/wcoss/RadMonBuild +++ /dev/null @@ -1,18 +0,0 @@ -#%Module################################################################# -proc ModulesHelp { } { - puts stderr "Set environment variables for WCOSS radmon build" -} - -module-whatis "Set environment variables for WCOSS radmon build" - -set ver 2.0.2 -set FCOMP ifort - -setenv CF $FCOMP -setenv FC $FCOMP -setenv FFLAGS "-O3 -fp-model strict -D_REAL8_ -traceback -convert big_endian -assume byterecl" -setenv D_FFLAGS "-O3 -fp-model strict -D_REAL8_ -traceback -convert big_endian -assume byterecl -debug" - -module load ics/12.1 -module load w3nco/v2.0.6 - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/readme b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/readme deleted file mode 100644 index cba655dd58..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/readme +++ /dev/null @@ -1,27 +0,0 @@ -Instructions for building executables. - - 1) Load the build module appropriate for your Machine: - i.) - WCOSS: - "module use -a ../modulefiles/wcoss" - CRAY: - "module use -a ../modulefiles/cray" - THEIA: - "module use -a ../modulefiles/theia" - ii.) type: - "module load RadMonBuild" - - 2) cd into each executable directory (*.fd) - - 3) Optional: verify all prerequisites are met by typing: - "make check_prereqs" - - 4) Build the executable by typing: - "make" - - 5) Move the executable to the ../../exec directory by typing: - "make install" - - 6) When all executable have been built unload the build module: - "module unload RadMonBuild" - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radang.fd/angle_bias.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radang.fd/angle_bias.f90 deleted file mode 100755 index dfc405ee7b..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radang.fd/angle_bias.f90 +++ /dev/null @@ -1,701 +0,0 @@ -program angle - use read_diag - - implicit none - integer ntype,mregion,mstep,surf_nregion,max_surf_region - parameter (ntype=35,mregion=25,mstep=100,max_surf_region=5) - integer iglobal, iland, iwater, isnowice, imixed - parameter (iglobal=1, iland=2, iwater=3, isnowice=4, imixed=5) - - character(10),dimension(ntype):: ftype - character(8) stid - character(20) satname,stringd - character(10) satype,dplat - character(20) dum,satsis,satscan_sis - character(40) string,diag_rad,data_file,dfile,ctl_file - character(40),dimension(max_surf_region):: surf_region - character(8) date,suffix,cycle - character(len=1024) :: command - - integer luname,lungrd,lndiag,lunang,lunctl - integer iyy,imm,idd,ihh,idhh,incr,iread,iflag,ipos - integer n_chan,j,i,k,ii,nsub,jiter,jj - integer,dimension(mregion):: jsub - integer,allocatable,dimension(:):: io_chan,nu_chan - integer imatch, npred_radiag, angord - - real start,step - integer nstep,iscan - character(1) cflg - real rang,pen - real weight,rlat,rlon,rmiss,obs,biascor,obsges,obsgesnbc,rterm,rread - real,dimension(2):: cor_tot,nbc_omg,bc_omg - real,dimension(2):: cor_fixang,cor_lapse,cor_lapse2,cor_const,cor_scangl,cor_clw - real,dimension(2):: cor_cos,cor_sin,cor_emiss - real,dimension(2):: cor_ordang4,cor_ordang3,cor_ordang2,cor_ordang1 - real,dimension(max_surf_region):: surf_rlatmin,surf_rlatmax,surf_rlonmin,surf_rlonmax - - real,allocatable,dimension(:):: wavenumbr,error,use,frequency - real,allocatable,dimension(:,:):: timang - real,allocatable,dimension(:,:,:):: count,penalty - real,allocatable,dimension(:,:,:,:):: tot_cor,omg_nbc,omg_bc - real,allocatable,dimension(:,:,:,:):: fixang_cor,lapse_cor,lapse2_cor - real,allocatable,dimension(:,:,:,:):: const_cor,scangl_cor,clw_cor - real,allocatable,dimension(:,:,:,:):: cos_cor,sin_cor,emiss_cor - real,allocatable,dimension(:,:,:,:):: ordang4_cor,ordang3_cor,ordang2_cor,ordang1_cor - -! Variables for reading satellite data - type(diag_header_fix_list ) :: header_fix - type(diag_header_chan_list),allocatable :: header_chan(:) - type(diag_data_name_list ) :: data_name - type(diag_data_fix_list ) :: data_fix - type(diag_data_chan_list ),allocatable :: data_chan(:) - type(diag_data_extra_list) ,allocatable :: data_extra(:,:) - - integer nsnow, nland, nwater, nice, nmixed, ntotal - integer nnsnow, nnland, nnwater, nnmixed, nntotal - -! Namelist with defaults - logical :: retrieval = .false. - integer :: nchanl = 19 - integer :: imkctl = 1 - integer :: imkdata = 1 - character(3) :: gesanl = 'ges' - integer :: little_endian = 1 - character(3) :: rad_area = 'glb' - namelist /input/ satname,iyy,imm,idd,ihh,idhh,incr,nchanl,& - suffix,imkctl,imkdata,retrieval,gesanl,little_endian,rad_area - - data luname,lungrd,lunctl,lndiag,iscan / 5, 51, 52, 21, 31 / - data lunang / 22 / - data rmiss /-999./ - data stringd / '.%y4%m2%d2%h2' / - data ftype / 'satang', 'count', 'penalty', & - 'omgnbc', 'total', 'omgbc', & - 'fixang', 'lapse', 'lapse2', & - 'const', 'scangl', 'clw', & - 'cos','sin','emiss','ordang4',& - 'ordang3','ordang2','ordang1',& - 'omgnbc_2', 'total_2', 'omgbc_2', & - 'fixang_2', 'lapse_2', 'lapse2_2', & - 'const_2', 'scangl_2', 'clw_2', & - 'cos_2', 'sin_2', 'emiss_2', & - 'ordang4_2','ordang3_2','ordang2_2', & - 'ordang1_2' / - data surf_region / 'global', 'land', 'water', 'ice/snow', 'mixed'/ - data surf_rlonmin / -180., -180., -180., -180., -180./ - data surf_rlonmax / 180., 180., 180., 180., 180./ - data surf_rlatmin / -90., -90., -90., -90., -90./ - data surf_rlatmax / 90., 90., 90., 90., 90./ -!************************************************************************ -! -! Initialize variables - iread=0 - npred_radiag = 12 - -! Read namelist input - read(luname,input) - write(6,input) - write(6,*)' ' - write(6,*)'gesanl = ', gesanl - write(6,*)'rad_area = ', rad_area - - surf_nregion = 5 - if ( trim(rad_area) == 'rgn' ) then - surf_nregion = 1 - endif - - if ( trim(gesanl) == 'anl' ) then - ftype(4) = 'omanbc' - ftype(6) = 'omabc' - ftype(13) = 'omanbc_2' - ftype(15) = 'omabc_2' - endif - -! Ensure number of requested regions does not exceed specified upper limit - if (surf_nregion>mregion) then - write(6,*)'***ERROR*** too many regions specified' - write(6,*)' maximum allowed: mregion=',mregion - write(6,*)' user requested: surf_nregion=',surf_nregion - call errexit(91) - endif - - date = stringd(2:9) - cycle = stringd(10:11) - -! Create filenames for diagnostic input, binary output files - write(stringd,100) iyy,imm,idd,ihh -100 format('.',i4.4,3i2.2) - - if ( trim(gesanl) == 'ges' ) then - diag_rad = trim(satname) - data_file= trim(satname) // trim(stringd) // '.ieee_d' - ctl_file = trim(satname) // '.ctl' - else - diag_rad = trim(satname) // '_anl' - data_file= trim(satname) // '_anl' // trim(stringd) // '.ieee_d' - ctl_file = trim(satname) // '_anl.ctl' - endif - - - write(6,*)'diag_rad =',diag_rad - write(6,*)'data_file=',data_file - write(6,*)'suffix =',suffix - write(6,*)'ctl_file =',ctl_file - write(6,*)'imkctl =',imkctl - write(6,*)'imkdata =',imkdata - write(6,*)'little_endian =', little_endian - - -! Open unit to diagnostic file. Read portion of -! header to see if file exists - open(lndiag,file=diag_rad,form='unformatted') - read(lndiag,err=900,end=900) dum - rewind lndiag - -! File exists. Read header - write(6,*)'call read_diag_header' - call read_radiag_header( lndiag, npred_radiag, retrieval,& - header_fix, header_chan, data_name, iflag ) -! -! If there was an error reading the header try to convert from little endian -! and re-read. If that fails exit. -! - if( iflag/=0 ) then - write(6,*)'***ERROR*** problem reading diag file header, iflag=',iflag - call errexit(91) - endif - - -! Extract observation type, satellite id, and number of channels - satype = header_fix%obstype - satsis = header_fix%isis - dplat = header_fix%id - n_chan = header_fix%nchan - jiter = header_fix%jiter - angord = header_fix%angord - - write(6,*)'satype,satid,n_chan,angord=',satype,' ',dplat,' ',n_chan,' ',angord - - string = trim(satype) //'_'// trim(dplat) - write(6,*)'string,satname=',string,' ',satname - if ( trim(string) /= trim(satname) ) then - write(6,*)'***ERROR*** inconsistent instrument types' - write(6,*)' satname,string =',satname,' ',string - call errexit(92) - endif - -! open scan info file compiled in the source directory - open(iscan,file='scaninfo.txt',form='formatted') - do - read(iscan,1000,IOSTAT=iflag) cflg,satscan_sis,start,step,nstep - write(6,*) 'satscan_sis,start,step,nstep=',satscan_sis,start,step,nstep - if( iflag /= 0 ) exit - if(trim(satname) == trim(satscan_sis)) exit - enddo -!1000 format(a1,a20,2f10.2,i10) -1000 format(a1,a20,2f10.3,i10) - - write(6,*) 'satscan_sis,start,step,nstep=',satscan_sis,start,step,nstep - - -! Allocate arrays to hold observational information - write(6,*)' ' - write(6,*)'allocate arrays' - allocate (io_chan(n_chan), nu_chan(n_chan), wavenumbr(n_chan), & - error(n_chan), use(n_chan), frequency(n_chan)) - allocate (timang(mstep,n_chan)) - allocate (tot_cor(mstep,n_chan,surf_nregion,2), & - omg_nbc(mstep,n_chan,surf_nregion,2), & - omg_bc(mstep,n_chan,surf_nregion,2), & - count(mstep,n_chan,surf_nregion), & - penalty(mstep,n_chan,surf_nregion),& - fixang_cor(mstep,n_chan,surf_nregion,2),lapse_cor(mstep,n_chan,surf_nregion,2),& - lapse2_cor(mstep,n_chan,surf_nregion,2),clw_cor(mstep,n_chan,surf_nregion,2),& - const_cor(mstep,n_chan,surf_nregion,2), scangl_cor(mstep,n_chan,surf_nregion,2),& - cos_cor(mstep,n_chan,surf_nregion,2), sin_cor(mstep,n_chan,surf_nregion,2),& - emiss_cor(mstep,n_chan,surf_nregion,2), ordang4_cor(mstep,n_chan,surf_nregion,2),& - ordang3_cor(mstep,n_chan,surf_nregion,2), ordang2_cor(mstep,n_chan,surf_nregion,2),& - ordang1_cor(mstep,n_chan,surf_nregion,2)) - -! Zero accumulator arrays - do ii=1,2 - do k=1,surf_nregion - do j=1,n_chan - do i=1,mstep - if (ii==1) then - count(i,j,k) = 0.0 - penalty(i,j,k) = 0.0 - endif - tot_cor(i,j,k,ii) = 0.0 - omg_nbc(i,j,k,ii) = 0.0 - omg_bc(i,j,k,ii) = 0.0 - fixang_cor(i,j,k,ii) = 0.0 - lapse_cor(i,j,k,ii) = 0.0 - lapse2_cor(i,j,k,ii) = 0.0 - clw_cor(i,j,k,ii) = 0.0 - const_cor(i,j,k,ii) = 0.0 - scangl_cor(i,j,k,ii) = 0.0 - cos_cor(i,j,k,ii) = 0.0 - sin_cor(i,j,k,ii) = 0.0 - emiss_cor(i,j,k,ii) = 0.0 - ordang4_cor(i,j,k,ii) = 0.0 - ordang3_cor(i,j,k,ii) = 0.0 - ordang2_cor(i,j,k,ii) = 0.0 - ordang1_cor(i,j,k,ii) = 0.0 - end do - end do - end do - end do - -! Note: timang has been deprecated and the satang file is no longer -! used. See the plot_angle_sep.*.gs scripts for how the timang -! values are derived from the diagnostic file contents. The -! timang variable has been kept to avoid making a change in -! ieee_d file format. - do j=1,n_chan - do i=1,mstep - timang(i,j) = rmiss - end do - end do - -! Extract satinfo relative index - do j=1,n_chan - nu_chan(j) = real( header_chan(j)%nuchan, 4 ) - io_chan(j) = real( header_chan(j)%iochan, 4 ) - wavenumbr(j) = real( header_chan(j)%wave, 4 ) - error(j) = real( header_chan(j)%varch, 4) - use(j) = real( header_chan(j)%iuse, 4 ) - frequency(j) = real( header_chan(j)%freq, 4) -! print *,nu_chan(j),io_chan(j),wavenumbr(j),error(j),use(j),frequency(j) - end do - - - - write(6,*)'beginning read entries in diag file' - nwater = 0; nnwater=0 - nice = 0 - nsnow = 0; nnsnow=0 - nland = 0; nnland=0 - nmixed = 0; nnmixed=0; - ntotal = 0; - -! Loop to read entries in diagnostic file - iflag = 0 - loopd: do while (iflag == 0) - -! Read a record. If read flag, iflag does not equal zero, exit loopd - call read_radiag_data( lndiag, header_fix, retrieval, data_fix, data_chan,& - data_extra, iflag ) - if( iflag /= 0 ) exit loopd - iread=iread+1 - -! Extract observation location, scan position, and mpi weight. -! Convert (0-360) lon to (-180,180) - rlat = data_fix%lat - rlon = data_fix%lon - ipos = data_fix%senscn_pos !! sensor scan position(integer) - rang = data_fix%satzen_ang !! satellite zenith angle (deg) - - ntotal = ntotal + 1 - jsub(1)=iglobal - - if ( surf_nregion > 1 ) then - if ( data_fix%water_frac > 0.99 ) then - nwater = nwater + 1 - else if ( data_fix%land_frac > 0.99 ) then - nland = nland + 1 - else if ( data_fix%snow_frac > 0.99 ) then - nsnow = nsnow + 1 - else if ( data_fix%ice_frac > 0.99 ) then - nice = nice + 1 - else - nmixed = nmixed + 1 - end if - - - if (rlon>180.) rlon = rlon - 360. - if (ipos<1) then - write(6,*)'scan position less than 1. ipos=',ipos - ipos=1 - endif - if (ipos>nstep) then - write(6,*)'scan position > nstep. ipos,nstep,',& - ipos,nstep - ipos=nstep - endif - rread = rread + 1.0 - - -! Detemine which subdomains the observation falls into -! These are now based on surface type, not geography. All -! obs match global (surf_region 1). -! - ii=0; jsub=0; - jsub(1)=iglobal - if ( data_fix%land_frac > 0.99 ) then - jsub(2)=iland - nsub=2 - nnland=nnland+1 - else if ( data_fix%water_frac > 0.99 ) then - jsub(2)=iwater - nsub=2 - nnwater=nnwater+1 - else if (( data_fix%snow_frac > 0.99 ) .OR. ( data_fix%ice_frac > 0.99 )) then - jsub(2)=isnowice - nsub=2 - nnsnow=nnsnow+1 - else - jsub(2)=imixed - nsub=2 - nnmixed=nnmixed+1 - write(6,*)'data_fix%land_frac,water,snow,ice = ',data_fix%land_frac, data_fix%water_frac, data_fix%snow_frac, data_fix%ice_frac - end if - end if - - -! Channel loop - do j = 1, n_chan - -! If observation was assimilated, accumulate sums for appropriate -! scan angle and regions - cor_cos = 0.0 - cor_sin = 0.0 - cor_emiss = 0.0 - cor_ordang4 = 0.0 - cor_ordang3 = 0.0 - cor_ordang2 = 0.0 - cor_ordang1 = 0.0 - - if (data_chan(j)%errinv > 1.e-6) then -! pen = data_chan(j)%errinv*(data_chan(j)%omgbc)**2 - pen = (data_chan(j)%errinv*(data_chan(j)%omgbc))**2 - - - cor_tot(1) = (data_chan(j)%omgnbc - data_chan(j)%omgbc) - nbc_omg(1) = - (data_chan(j)%omgnbc) - bc_omg(1) = - (data_chan(j)%omgbc) - - - if ( trim(rad_area) == 'rgn' ) then - write(6,*) 'chan,pen,cor_tot(1),nbc_omg(1),bc_omb(1) = ', j,pen,cor_tot(1),nbc_omg(1),bc_omg(1) - endif - - cor_tot(2) = (data_chan(j)%omgnbc - data_chan(j)%omgbc)**2 - nbc_omg(2) = (data_chan(j)%omgnbc)**2 - bc_omg(2) = (data_chan(j)%omgbc)**2 - - cor_fixang(1) = data_chan(j)%bifix(angord+1) - cor_lapse(1) = data_chan(j)%bilap - cor_lapse2(1) = data_chan(j)%bilap2 - cor_const(1) = data_chan(j)%bicons - cor_scangl(1) = data_chan(j)%biang - cor_clw(1) = data_chan(j)%biclw - cor_cos(1) = data_chan(j)%bicos - cor_sin(1) = data_chan(j)%bisin - cor_emiss(1) = data_chan(j)%biemis - if (angord >= 4 ) then - cor_ordang4(1) = data_chan(j)%bifix(1) - cor_ordang3(1) = data_chan(j)%bifix(2) - cor_ordang2(1) = data_chan(j)%bifix(3) - cor_ordang1(1) = data_chan(j)%bifix(4) - else - cor_ordang4(1) = 0.0 - cor_ordang3(1) = 0.0 - cor_ordang2(1) = 0.0 - cor_ordang1(1) = 0.0 - endif - - cor_fixang(2) = (data_chan(j)%bifix(angord+1))**2 - cor_lapse(2) = (data_chan(j)%bilap)**2 - cor_lapse2(2) = (data_chan(j)%bilap2)**2 - cor_const(2) = (data_chan(j)%bicons)**2 - cor_scangl(2) = (data_chan(j)%biang)**2 - cor_clw(2) = (data_chan(j)%biclw)**2 - cor_cos(2) = (data_chan(j)%bicos)**2 - cor_sin(2) = (data_chan(j)%bisin)**2 - cor_emiss(2) = (data_chan(j)%biemis)**2 - if (angord >= 4 ) then - cor_ordang4(2) = (data_chan(j)%bifix(1))**2 - cor_ordang3(2) = (data_chan(j)%bifix(2))**2 - cor_ordang2(2) = (data_chan(j)%bifix(3))**2 - cor_ordang1(2) = (data_chan(j)%bifix(4))**2 - else - cor_ordang4(2) = 0.0 - cor_ordang3(2) = 0.0 - cor_ordang2(2) = 0.0 - cor_ordang1(2) = 0.0 - endif - - - if ( trim(rad_area) == 'rgn' ) then - nsub = 1 - endif - do i=1,nsub - if ( trim(rad_area) == 'rgn' ) then - write(6,*) 'INSIDE i 1 to nsub do loop' - endif - k=jsub(i) - count(ipos,j,k) = count(ipos,j,k) + 1.0 - penalty(ipos,j,k) = penalty(ipos,j,k) + pen - - do ii=1,2 - tot_cor(ipos,j,k,ii) = tot_cor(ipos,j,k,ii) + cor_tot(ii) - omg_nbc(ipos,j,k,ii) = omg_nbc(ipos,j,k,ii) + nbc_omg(ii) - omg_bc(ipos,j,k,ii) = omg_bc(ipos,j,k,ii) + bc_omg(ii) - fixang_cor(ipos,j,k,ii) = fixang_cor(ipos,j,k,ii) + cor_fixang(ii) - lapse_cor(ipos,j,k,ii) = lapse_cor(ipos,j,k,ii) + cor_lapse(ii) - lapse2_cor(ipos,j,k,ii) = lapse2_cor(ipos,j,k,ii) + cor_lapse2(ii) - const_cor(ipos,j,k,ii) = const_cor(ipos,j,k,ii) + cor_const(ii) - scangl_cor(ipos,j,k,ii) = scangl_cor(ipos,j,k,ii) + cor_scangl(ii) - clw_cor(ipos,j,k,ii) = clw_cor(ipos,j,k,ii) + cor_clw(ii) - cos_cor(ipos,j,k,ii) = cos_cor(ipos,j,k,ii) + cor_cos(ii) - sin_cor(ipos,j,k,ii) = sin_cor(ipos,j,k,ii) + cor_sin(ii) - emiss_cor(ipos,j,k,ii) = emiss_cor(ipos,j,k,ii) + cor_emiss(ii) - ordang4_cor(ipos,j,k,ii) = ordang4_cor(ipos,j,k,ii) + cor_ordang4(ii) - ordang3_cor(ipos,j,k,ii) = ordang3_cor(ipos,j,k,ii) + cor_ordang3(ii) - ordang2_cor(ipos,j,k,ii) = ordang2_cor(ipos,j,k,ii) + cor_ordang2(ii) - ordang1_cor(ipos,j,k,ii) = ordang1_cor(ipos,j,k,ii) + cor_ordang1(ii) - - end do - end do - - endif - - enddo ! channel loop - -! End of loop over diagnostic file - enddo loopd - close(lndiag) - write(6,*)' ' - write(6,*)'read in ',iread,' obs ',rread - write(6,*)' ' - - write(6,*)'nwater, nland, nice, nsnow, nmixed, ntotal = ', nwater, nland, nice, nsnow, nmixed, ntotal - nntotal=nnwater+nnland+nnsnow+nnmixed - write(6,*)'nnwater, nnland, nnsnow, nnmixed, nntotal = ', nnwater, nnland, nnsnow, nnmixed, nntotal - - - ! Create Control file - if ( imkctl == 1 ) then - write(6,*)'call create_ctl_angle' - if ( trim(gesanl) == 'ges' ) then - dfile = trim(satname) - else - dfile = trim(satname) // '_anl' - endif - - call create_ctl_angle(ntype,ftype,n_chan,iyy,imm,idd,ihh,& - ctl_file,lunctl,rmiss,dfile,satype,dplat,surf_nregion,& - surf_region,surf_rlonmin,surf_rlonmax,surf_rlatmin,surf_rlatmax,& - nu_chan,use, error, frequency,wavenumbr,nstep,start,step, little_endian) - else - write(6,*) 'imkctl =',imkctl - endif - - -! Write output to data file - if ( imkdata == 1 ) then - write(6,*)' ' - open(lungrd,file=data_file,form='unformatted') - write(lungrd) ((timang(i,j),i=1,nstep),j=1,n_chan) - do k=1,surf_nregion - write(lungrd) ((count(i,j,k),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd) ((penalty(i,j,k),i=1,nstep),j=1,n_chan) - end do - do ii=1,2 - do k=1,surf_nregion - write(lungrd)((omg_nbc(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((tot_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((omg_bc(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((fixang_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((lapse_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((lapse2_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((const_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((scangl_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((clw_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((cos_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((sin_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((emiss_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((ordang4_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((ordang3_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((ordang2_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((ordang1_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - end do - write(6,*)'write output to lungrd=',lungrd,', file=',trim(data_file) - close(lungrd) - else - write(6,*) 'imkctl =',imkctl - endif - - -! Deallocate arrays - write(6,*)' ' - write(6,*)'deallocate arrays' - deallocate(penalty,io_chan,nu_chan,wavenumbr,error,use,frequency) - deallocate(timang,tot_cor,omg_nbc,omg_bc,count) - goto 950 - - -! Jump to here if eof or error reading diagnostic file. -900 continue - write(6,*)'***PROBLEM reading diagnostic file. diag_rad=',diag_rad - close(lndiag) - - n_chan=nchanl - if (n_chan<=0) then - write(6,*)'***ERROR*** invalid nchanl=',nchanl,' STOP program' - call errexit(93) - endif - - allocate(timang(mstep,n_chan)) - allocate(count(mstep,n_chan,surf_nregion),& - penalty(mstep,n_chan,surf_nregion),& - omg_nbc(mstep,n_chan,surf_nregion,2),& - tot_cor(mstep,n_chan,surf_nregion,2),& - omg_bc(mstep,n_chan,surf_nregion,2)) - -! -! Initialze all output variables to rmiss -! -! - do j=1,n_chan - do i=1,mstep - timang(i,j) = rmiss - end do - end do - - write(6,*)'load missing value ',rmiss,' into output arrays. ',& - nstep,surf_nregion,n_chan - do ii=1,2 - do k=1,surf_nregion - do j=1,n_chan - do i=1,mstep - if (ii==1) then - count(i,j,k) = rmiss - penalty(i,j,k)= rmiss - endif - omg_nbc(i,j,k,ii) = rmiss - tot_cor(i,j,k,ii) = rmiss - omg_bc(i,j,k,ii) = rmiss - fixang_cor(i,j,k,ii) = rmiss - lapse_cor(i,j,k,ii) = rmiss - lapse2_cor(i,j,k,ii) = rmiss - clw_cor(i,j,k,ii) = rmiss - const_cor(i,j,k,ii) = rmiss - scangl_cor(i,j,k,ii) = rmiss - cos_cor(i,j,k,ii) = rmiss - sin_cor(i,j,k,ii) = rmiss - emiss_cor(i,j,k,ii) = rmiss - ordang4_cor(i,j,k,ii) = rmiss - ordang3_cor(i,j,k,ii) = rmiss - ordang2_cor(i,j,k,ii) = rmiss - ordang1_cor(i,j,k,ii) = rmiss - end do - end do - end do - end do - - if ( imkdata == 1 ) then - open(lungrd,file=data_file,form='unformatted') - write(lungrd) ((timang(i,j),i=1,nstep),j=1,n_chan) - do k=1,surf_nregion - write(lungrd) ((count(i,j,k),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd) ((penalty(i,j,k),i=1,nstep),j=1,n_chan) - end do - do ii=1,2 - do k=1,surf_nregion - write(lungrd)((omg_nbc(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((tot_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((omg_bc(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((fixang_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((lapse_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((lapse2_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((const_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((scangl_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((clw_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((cos_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((sin_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((emiss_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((ordang4_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((ordang3_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((ordang2_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((ordang1_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - end do - write(6,*)'write output to lungrd=',lungrd,', file=',trim(data_file) - close(lungrd) - endif - deallocate(timang,count,penalty,omg_nbc,omg_bc,tot_cor,& - fixang_cor,lapse_cor,lapse2_cor,const_cor,scangl_cor,clw_cor) - deallocate(cos_cor,sin_cor,emiss_cor,ordang1_cor,ordang2_cor,ordang3_cor,ordang4_cor) - -! End of program -950 continue - stop -end program angle diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radang.fd/create_ctl_angle.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radang.fd/create_ctl_angle.f90 deleted file mode 100755 index 6077ac6c1b..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radang.fd/create_ctl_angle.f90 +++ /dev/null @@ -1,176 +0,0 @@ -subroutine create_ctl_angle(ntype,ftype,n_chan,iyy,imm,idd,ihh,& - ctl_file,lunctl,rmiss,satname,satype,dplat,nregion,& - region,rlonmin,rlonmax,rlatmin,rlatmax,nu_chan,use,error,& - frequency,wavenumbr,nstep,start,step, little_endian) - - implicit none - - integer ntype - - character(2) cword - character(3),dimension(12):: mon - character(3):: clatmin,clatmax - character(4):: clonmin,clonmax - character(10),dimension(ntype):: ftype - character(13) stringd - character(20) satname - character(10) satype,dplat - character(40) ctl_file,grad_file - character(80) string - character(40),dimension(nregion):: region - character(80),dimension(nregion):: stringr - - integer nregion,iuse,klev,nstep - integer lunctl,iyy,imm,idd,ihh,j,i,n_chan,idhh,incr - integer iyy2,imm2,idd2,ihh2,ntime - integer, dimension(8):: ida,jda - integer,dimension(n_chan):: nu_chan - integer little_endian - - real rmiss,wavelength,start,step - real,dimension(5):: fha - real,dimension(n_chan):: error,use,frequency,wavenumbr - real,dimension(nregion):: rlonmin,rlonmax,rlatmin,rlatmax - - data stringd / '.%y4%m2%d2%h2' / - data mon / 'jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', & - 'aug', 'sep', 'oct', 'nov', 'dec' / - -!************************************************************************** - - write(6,*)'start create_ctl_angle' - write(6,*)' n_chan = ', n_chan - -! Create date for tdef based on given date and hour offset - - idhh=-720 ! this is 30 days back in hours. - incr=6 ! cycle interval - - fha=0.0; ida=0; jda=0; ntime=0 - iyy2=iyy; imm2=imm; idd2=idd; ihh2=ihh - if (idhh/=0) then - ntime = abs(idhh)/incr - fha(2)=idhh - ida(1)=iyy - ida(2)=imm - ida(3)=idd - ida(4)=0 - ida(5)=ihh - call w3movdat(fha,ida,jda) - iyy2=jda(1) - imm2=jda(2) - idd2=jda(3) - ihh2=jda(5) - endif - ntime=ntime+1 - -! Open unit to GrADS control file - open(lunctl,file=ctl_file,form='formatted') - -!******************************************************************* -! Construct the region strings if this is for a global source, -! which is defined as nregion > 1. -! - if (nregion > 1) then - do i=1,nregion - if (rlatmin(i)>0.) then - write(clatmin,10) int(rlatmin(i)) - else - write(clatmin,20) abs(int(rlatmin(i))) - endif - if (rlatmax(i)>0.) then - write(clatmax,10) int(rlatmax(i)) - else - write(clatmax,20) abs(int(rlatmax(i))) - endif - if (rlonmin(i)>0.) then - write(clonmin,30) int(rlonmin(i)) - else - write(clonmin,40) abs(int(rlonmin(i))) - endif - if (rlonmax(i)>0.) then - write(clonmax,30) int(rlonmax(i)) - else - write(clonmax,40) abs(int(rlonmax(i))) - endif - stringr(i) = trim(region(i)) // ' (' // & - trim(clonmin) // '-' // trim(clonmax) // ', ' // & - trim(clatmin) // '-' // trim(clatmax) // ')' - end do - endif -10 format(i2,'N') -20 format(i2,'S') -30 format(i3,'E') -40 format(i3,'W') - -! Write header information - grad_file = trim(satname) // stringd // '.ieee_d' - write(lunctl,100) grad_file - if (little_endian == 1 ) then - write( lunctl,112 ) - else - write( lunctl,110 ) - endif - write(lunctl,120) rmiss - write(lunctl,130) adjustl(satype),dplat,n_chan - write(lunctl,132) - write(lunctl,134) - do i=1,n_chan - iuse = nint(use(i)) - wavelength = 10000./wavenumbr(i) - write(lunctl,136) i,nu_chan(i),iuse,error(i),wavelength,frequency(i) - end do - write(lunctl,138) - - if (nregion > 1) then - do i=1,nregion - write(cword,'(i2)') i - string = '* region=' // cword // ' ' // trim(stringr(i)) - write(lunctl,140) string - end do - endif - write(lunctl,145) nstep,start,step - write(lunctl,150) n_chan - write(lunctl,160) nregion - write(lunctl,170) ntime,ihh2,idd2,mon(imm2),iyy2 - write(lunctl,180) ntype - -100 format('dset ^',a40) -110 format('options template big_endian sequential') -112 format('options template little_endian sequential') -120 format('undef ',f5.0) -130 format('title ',a10,1x,a10,1x,i4) -132 format('*XDEF is scan position') -134 format('*YDEF is channel number') -136 format('* y= ',i4,', channel= ',i4,' , iuse= ',i2,' , error= ',f8.3,& - ' , wlth= ',f9.2,' , freq= ',f9.2) -138 format('*ZDEF is geographic region') -140 format(a80) -145 format('xdef ',i3,' linear ',f5.1,1x,f5.1) -150 format('ydef ',i4,' linear 1.0 1.0') -160 format('zdef ',i2,' linear 1.0 1.0') -170 format('tdef ',i4,' linear ',i2.2,'Z',i2.2,a3,i4.4,' 06hr') -180 format('vars ',i7) - -! Write data portion of GraDS control file - do i=1,ntype - string = trim(ftype(i)) - klev=nregion - if (i==1) klev=1 - write(lunctl,190) adjustl(string),klev,trim(ftype(i)) -190 format(a10,1x,i2,' 0 ',a10) - end do - -! Write trminating "endvars" record - write(lunctl,200) -200 format('endvars') - - -! Close ctl file - close(lunctl) - - write(6,*)'finish create_ctl_angle' - -! Return - return -end subroutine create_ctl_angle diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radang.fd/makefile b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radang.fd/makefile deleted file mode 100755 index ccb150be90..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radang.fd/makefile +++ /dev/null @@ -1,51 +0,0 @@ -# ***************************************************************** -# makefile.angle_bias -# -# Make the radmon_angle executable. -# -# ***************************************************************** - -BINDIR = ../../exec - -LIBS = $(W3NCO_LIB4) - -OBJS = kinds.o read_diag.o angle_bias.o create_ctl_angle.o - -# -# ***************************************************************** -# - -CMD = radmon_angle - -all: $(CMD) - -clean: - rm -f *.o - rm -f *.mod - rm -f $(CMD) - -check_prereqs: - /nwprod/spa_util/check_libs.bash $(LIBS) - -install: - cp -f $(CMD) $(BINDIR)/ - -debug: FFLAGS = $(D_FFLAGS) -debug: $(CMD) - -$(CMD): $(OBJS) - $(CF) $(FFLAGS) $(LDFLAGS) -o $(@) $(OBJS) $(LIBS) - - -kinds.o : kinds.F90 - $(CF) $(FFLAGS) -c $(*).F90 - -read_diag.o : read_diag.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -angle_bias.o : angle_bias.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -create_ctl_angle.o : create_ctl_angle.f90 - $(CF) $(FFLAGS) -c $(*).f90 - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radang.fd/read_diag.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radang.fd/read_diag.f90 deleted file mode 100755 index 7a4d6cdc49..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radang.fd/read_diag.f90 +++ /dev/null @@ -1,659 +0,0 @@ -!$$$ subprogram documentation block -! . . . . -! subprogram: read_raddiag read rad diag file -! prgmmr: tahara org: np20 date: 2003-01-01 -! -! abstract: This module contains code to process radiance -! diagnostic files. The module defines structures -! to contain information from the radiance -! diagnostic files and then provides two routines -! to access contents of the file. -! -! program history log: -! 2005-07-22 treadon - add this doc block -! 2010-10-05 treadon - refactor code to GSI standard -! 2010-10-08 zhu - use data_tmp to handle various npred values -! 2011-02-22 kleist - changes related to memory allocate/deallocate -! 2011-04-08 li - add tref, dtw, dtc to diag_data_fix_list, add tb_tz to diag_data_chan_list -! - correspondingly, change ireal_radiag (26 -> 30) and ipchan_radiag (7 -> 8) -! 2011-07-24 safford - make structure size for reading data_fix data version dependent -! 2013-11-21 todling - revisit how versions are set (add set/get_radiag) -! 2014-01-27 todling - add ob sensitivity index -! -! contains -! read_radiag_header - read radiance diagnostic file header -! read_radiag_data - read radiance diagnostic file data -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ - -module read_diag - - use kinds, only: i_kind,r_single - implicit none - -! Declare public and private - private - - public :: diag_header_fix_list - public :: diag_header_chan_list - public :: diag_data_name_list - public :: diag_data_fix_list - public :: diag_data_chan_list - public :: diag_data_extra_list - public :: read_radiag_header - public :: read_radiag_data -! public :: iversion_radiag -! public :: iversion_radiag_1 -! public :: iversion_radiag_2 -! public :: iversion_radiag_3 -! public :: iversion_radiag_4 - public :: ireal_radiag - public :: ipchan_radiag - public :: set_radiag - public :: get_radiag - - interface set_radiag - module procedure set_radiag_int_ ! internal procedure for integers - end interface - interface get_radiag - module procedure get_radiag_int_ ! internal procedure for integers - end interface - - integer(i_kind),parameter :: ireal_radiag = 30 ! number of real entries per spot in radiance diagnostic file - integer(i_kind),parameter :: ireal_old_radiag = 26 ! number of real entries per spot in versions older than iversion_radiag_2 - integer(i_kind),parameter :: ipchan_radiag = 8 ! number of entries per channel per spot in radiance diagnostic file - -! Declare structures for radiance diagnostic file information - type diag_header_fix_list - character(len=20) :: isis ! sat and sensor type - character(len=10) :: id ! sat type - character(len=10) :: obstype ! observation type - integer(i_kind) :: jiter ! outer loop counter - integer(i_kind) :: nchan ! number of channels in the sensor - integer(i_kind) :: npred ! number of updating bias correction predictors - integer(i_kind) :: idate ! time (yyyymmddhh) - integer(i_kind) :: ireal ! # of real elements in the fix part of a data record - integer(i_kind) :: ipchan ! # of elements for each channel except for bias correction terms - integer(i_kind) :: iextra ! # of extra elements for each channel - integer(i_kind) :: jextra ! # of extra elements - integer(i_kind) :: idiag ! first dimension of diag_data_chan - integer(i_kind) :: angord ! order of polynomial for adp_anglebc option - integer(i_kind) :: iversion ! radiance diagnostic file version number - integer(i_kind) :: inewpc ! indicator of newpc4pred (1 on, 0 off) - integer(i_kind) :: isens ! sensitivity index - end type diag_header_fix_list - - type diag_data_name_list - character(len=10),dimension(ireal_radiag) :: fix - character(len=10),dimension(:),allocatable :: chn - end type diag_data_name_list - - type diag_header_chan_list - real(r_single) :: freq ! frequency (Hz) - real(r_single) :: polar ! polarization - real(r_single) :: wave ! wave number (cm^-1) - real(r_single) :: varch ! error variance (or SD error?) - real(r_single) :: tlapmean ! mean lapse rate - integer(i_kind):: iuse ! use flag - integer(i_kind):: nuchan ! sensor relative channel number - integer(i_kind):: iochan ! satinfo relative channel number - end type diag_header_chan_list - - type diag_data_fix_list - real(r_single) :: lat ! latitude (deg) - real(r_single) :: lon ! longitude (deg) - real(r_single) :: zsges ! guess elevation at obs location (m) - real(r_single) :: obstime ! observation time relative to analysis - real(r_single) :: senscn_pos ! sensor scan position (integer(i_kind)) - real(r_single) :: satzen_ang ! satellite zenith angle (deg) - real(r_single) :: satazm_ang ! satellite azimuth angle (deg) - real(r_single) :: solzen_ang ! solar zenith angle (deg) - real(r_single) :: solazm_ang ! solar azimumth angle (deg) - real(r_single) :: sungln_ang ! sun glint angle (deg) - real(r_single) :: water_frac ! fractional coverage by water - real(r_single) :: land_frac ! fractional coverage by land - real(r_single) :: ice_frac ! fractional coverage by ice - real(r_single) :: snow_frac ! fractional coverage by snow - real(r_single) :: water_temp ! surface temperature over water (K) - real(r_single) :: land_temp ! surface temperature over land (K) - real(r_single) :: ice_temp ! surface temperature over ice (K) - real(r_single) :: snow_temp ! surface temperature over snow (K) - real(r_single) :: soil_temp ! soil temperature (K) - real(r_single) :: soil_mois ! soil moisture - real(r_single) :: land_type ! land type (integer(i_kind)) - real(r_single) :: veg_frac ! vegetation fraction - real(r_single) :: snow_depth ! snow depth - real(r_single) :: sfc_wndspd ! surface wind speed - real(r_single) :: qcdiag1 ! ir=cloud fraction, mw=cloud liquid water - real(r_single) :: qcdiag2 ! ir=cloud top pressure, mw=total column water - real(r_single) :: tref ! reference temperature (Tr) in NSST - real(r_single) :: dtw ! dt_warm at zob - real(r_single) :: dtc ! dt_cool at zob - real(r_single) :: tz_tr ! d(Tz)/d(Tr) - end type diag_data_fix_list - - type diag_data_chan_list - real(r_single) :: tbobs ! Tb (obs) (K) - real(r_single) :: omgbc ! Tb_(obs) - Tb_(simulated w/ bc) (K) - real(r_single) :: omgnbc ! Tb_(obs) - Tb_(simulated_w/o bc) (K) - real(r_single) :: errinv ! inverse error (K**(-1)) - real(r_single) :: qcmark ! quality control mark - real(r_single) :: emiss ! surface emissivity - real(r_single) :: tlap ! temperature lapse rate - real(r_single) :: tb_tz ! d(Tb)/d(Tz) - real(r_single) :: bicons ! constant bias correction term - real(r_single) :: biang ! scan angle bias correction term - real(r_single) :: biclw ! CLW bias correction term - real(r_single) :: bilap2 ! square lapse rate bias correction term - real(r_single) :: bilap ! lapse rate bias correction term - real(r_single) :: bicos ! node*cos(lat) bias correction term - real(r_single) :: bisin ! sin(lat) bias correction term - real(r_single) :: biemis ! emissivity sensitivity bias correction term - real(r_single),dimension(:),allocatable :: bifix ! angle dependent bias - real(r_single) :: bisst ! SST bias correction term - end type diag_data_chan_list - - type diag_data_extra_list - real(r_single) :: extra ! extra information - end type diag_data_extra_list - - integer(i_kind),save :: iversion_radiag ! Current version (see set routine) - integer(i_kind),parameter:: iversion_radiag_1 = 11104 ! Version when bias-correction entries were modified - integer(i_kind),parameter:: iversion_radiag_2 = 13784 ! Version when NSST entries were added - integer(i_kind),parameter:: iversion_radiag_3 = 19180 ! Version when SSMIS added - integer(i_kind),parameter:: iversion_radiag_4 = 30303 ! Version when emissivity predictor added - - real(r_single),parameter:: rmiss_radiag = -9.9e11_r_single - -contains - -subroutine set_radiag_int_ (what,iv,ier) -character(len=*),intent(in) :: what -integer(i_kind),intent(in) :: iv -integer(i_kind),intent(out):: ier -ier=-1 -if(trim(what)=='version') then - iversion_radiag = iv - ier=0 -endif -end subroutine set_radiag_int_ - -subroutine get_radiag_int_ (what,iv,ier) -character(len=*),intent(in) :: what -integer(i_kind),intent(out):: iv -integer(i_kind),intent(out):: ier -ier=-1 -if(trim(what)=='version') then - iv = iversion_radiag - ier=0 -endif -end subroutine get_radiag_int_ - -subroutine read_radiag_header(ftin,npred_radiag,retrieval,header_fix,header_chan,data_name,iflag,lverbose) -! . . . . -! subprogram: read_diag_header read rad diag header -! prgmmr: tahara org: np20 date: 2003-01-01 -! -! abstract: This routine reads the header record from a radiance -! diagnostic file -! -! program history log: -! 2010-10-05 treadon - add this doc block -! 2011-02-22 kleist - changes related to memory allocation and standard output -! -! input argument list: -! ftin - unit number connected to diagnostic file -! npred_radiag - number of bias correction terms -! retrieval - .true. if sst retrieval -! -! output argument list: -! header_fix - header information structure -! header_chan - channel information structure -! data_name - diag file data names -! iflag - error code -! lverbose - optional flag to turn off default output to standard out -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ - -! Declare passed arguments - integer(i_kind),intent(in) :: ftin - integer(i_kind),intent(in) :: npred_radiag - logical,intent(in) :: retrieval - type(diag_header_fix_list ),intent(out):: header_fix - type(diag_header_chan_list),allocatable :: header_chan(:) - type(diag_data_name_list) :: data_name - integer(i_kind),intent(out) :: iflag - logical,optional,intent(in) :: lverbose - -! Declare local variables - character(len=2):: string - character(len=10):: satid,sentype - character(len=20):: sensat - integer(i_kind) :: i,ich - integer(i_kind):: jiter,nchanl,npred,ianldate,ireal,ipchan,iextra,jextra - integer(i_kind):: idiag,angord,iversion,inewpc,isens - integer(i_kind):: iuse_tmp,nuchan_tmp,iochan_tmp - real(r_single) :: freq_tmp,polar_tmp,wave_tmp,varch_tmp,tlapmean_tmp - logical loutall - - loutall=.true. - if(present(lverbose)) loutall=lverbose - -! Read header (fixed_part). - read(ftin,IOSTAT=iflag) sensat,satid,sentype,jiter,nchanl,npred,ianldate,& - ireal,ipchan,iextra,jextra,idiag,angord,iversion,inewpc,isens - if (iflag/=0) then - rewind(ftin) - read(ftin,IOSTAT=iflag) sensat,satid,sentype,jiter,nchanl,npred,ianldate,& - ireal,ipchan,iextra,jextra,idiag,angord,iversion,inewpc - isens=0 - end if - - if (iflag/=0) then - rewind(ftin) - read(ftin,IOSTAT=iflag) sensat,satid,sentype,jiter,nchanl,npred,ianldate,& - ireal,ipchan,iextra,jextra - idiag=ipchan+npred+1 - angord=0 - iversion=0 - inewpc=0 - isens=0 - if (iflag/=0) then - write(6,*)'READ_RADIAG_HEADER: ***ERROR*** Unknown file format. Cannot read' - return - endif - endif - - header_fix%isis = sensat - header_fix%id = satid - header_fix%obstype = sentype - header_fix%jiter = jiter - header_fix%nchan = nchanl - header_fix%npred = npred - header_fix%idate = ianldate - header_fix%ireal = ireal - header_fix%ipchan = ipchan - header_fix%iextra = iextra - header_fix%jextra = jextra - header_fix%idiag = idiag - header_fix%angord = angord - header_fix%iversion= iversion - header_fix%inewpc = inewpc - header_fix%isens = isens - - if (loutall) then - write(6,*)'READ_RADIAG_HEADER: isis=',header_fix%isis,& - ' nchan=',header_fix%nchan,& - ' npred=',header_fix%npred,& - ' angord=',header_fix%angord,& - ' idiag=',header_fix%idiag,& - ' iversion=',header_fix%iversion,& - ' inewpc=',header_fix%inewpc,& - ' isens=',header_fix%isens - - if ( header_fix%iextra /= 0) & - write(6,*)'READ_RADIAG_HEADER: extra diagnostic information available, ',& - 'iextra=',header_fix%iextra - end if - - if (header_fix%npred /= npred_radiag) & - write(6,*) 'READ_RADIAG_HEADER: **WARNING** header_fix%npred,npred=',& - header_fix%npred,npred_radiag - -! Allocate and initialize as needed - if (allocated(header_chan)) deallocate(header_chan) - if (allocated(data_name%chn)) deallocate(data_name%chn) - - allocate(header_chan( header_fix%nchan)) - allocate(data_name%chn(header_fix%idiag)) - - data_name%fix(1) ='lat ' - data_name%fix(2) ='lon ' - data_name%fix(3) ='zsges ' - data_name%fix(4) ='obstim ' - data_name%fix(5) ='scanpos ' - data_name%fix(6) ='satzen ' - data_name%fix(7) ='satazm ' - data_name%fix(8) ='solzen ' - data_name%fix(9) ='solazm ' - data_name%fix(10)='sungln ' - data_name%fix(11)='fwater ' - data_name%fix(12)='fland ' - data_name%fix(13)='fice ' - data_name%fix(14)='fsnow ' - data_name%fix(15)='twater ' - data_name%fix(16)='tland ' - data_name%fix(17)='tice ' - data_name%fix(18)='tsnow ' - data_name%fix(19)='tsoil ' - data_name%fix(20)='soilmoi ' - data_name%fix(21)='landtyp ' - data_name%fix(22)='vegfrac ' - data_name%fix(23)='snowdep ' - data_name%fix(24)='wndspd ' - data_name%fix(25)='qc1 ' - data_name%fix(26)='qc2 ' - data_name%fix(27)='tref ' - data_name%fix(28)='dtw ' - data_name%fix(29)='dtc ' - data_name%fix(30)='tz_tr ' - - data_name%chn(1)='obs ' - data_name%chn(2)='omgbc ' - data_name%chn(3)='omgnbc ' - data_name%chn(4)='errinv ' - data_name%chn(5)='qcmark ' - data_name%chn(6)='emiss ' - data_name%chn(7)='tlap ' - data_name%chn(8)='tb_tz ' - - if (header_fix%iversion < iversion_radiag_1) then - data_name%chn( 8)= 'bifix ' - data_name%chn( 9)= 'bilap ' - data_name%chn(10)= 'bilap2 ' - data_name%chn(11)= 'bicons ' - data_name%chn(12)= 'biang ' - data_name%chn(13)= 'biclw ' - if (retrieval) data_name%chn(13)= 'bisst ' - elseif ( header_fix%iversion < iversion_radiag_2 .and. header_fix%iversion >= iversion_radiag_1 ) then - data_name%chn( 8)= 'bicons ' - data_name%chn( 9)= 'biang ' - data_name%chn(10)= 'biclw ' - data_name%chn(11)= 'bilap2 ' - data_name%chn(12)= 'bilap ' - do i=1,header_fix%angord - write(string,'(i2.2)') header_fix%angord-i+1 - data_name%chn(12+i)= 'bifix' // string - end do - data_name%chn(12+header_fix%angord+1)= 'bifix ' - data_name%chn(12+header_fix%angord+2)= 'bisst ' - elseif ( header_fix%iversion < iversion_radiag_3 .and. header_fix%iversion >= iversion_radiag_2 ) then - data_name%chn( 9)= 'bicons ' - data_name%chn(10)= 'biang ' - data_name%chn(11)= 'biclw ' - data_name%chn(12)= 'bilap2 ' - data_name%chn(13)= 'bilap ' - do i=1,header_fix%angord - write(string,'(i2.2)') header_fix%angord-i+1 - data_name%chn(13+i)= 'bifix' // string - end do - data_name%chn(13+header_fix%angord+1)= 'bifix ' - data_name%chn(13+header_fix%angord+2)= 'bisst ' - elseif ( header_fix%iversion < iversion_radiag_4 .and. header_fix%iversion >= iversion_radiag_3 ) then - data_name%chn( 9)= 'bicons ' - data_name%chn(10)= 'biang ' - data_name%chn(11)= 'biclw ' - data_name%chn(12)= 'bilap2 ' - data_name%chn(13)= 'bilap ' - data_name%chn(14)= 'bicos ' - data_name%chn(15)= 'bisin ' - do i=1,header_fix%angord - write(string,'(i2.2)') header_fix%angord-i+1 - data_name%chn(15+i)= 'bifix' // string - end do - data_name%chn(15+header_fix%angord+1)= 'bifix ' - data_name%chn(15+header_fix%angord+2)= 'bisst ' - else - data_name%chn( 9)= 'bicons ' - data_name%chn(10)= 'biang ' - data_name%chn(11)= 'biclw ' - data_name%chn(12)= 'bilap2 ' - data_name%chn(13)= 'bilap ' - data_name%chn(14)= 'bicos ' - data_name%chn(15)= 'bisin ' - data_name%chn(16)= 'biemis ' - do i=1,header_fix%angord - write(string,'(i2.2)') header_fix%angord-i+1 - data_name%chn(16+i)= 'bifix' // string - end do - data_name%chn(16+header_fix%angord+1)= 'bifix ' - data_name%chn(16+header_fix%angord+2)= 'bisst ' - endif - -! Read header (channel part) - do ich=1, header_fix%nchan - read(ftin,IOSTAT=iflag) freq_tmp,polar_tmp,wave_tmp,varch_tmp,tlapmean_tmp,iuse_tmp,nuchan_tmp,iochan_tmp - header_chan(ich)%freq = freq_tmp - header_chan(ich)%polar = polar_tmp - header_chan(ich)%wave = wave_tmp - header_chan(ich)%varch = varch_tmp - header_chan(ich)%tlapmean = tlapmean_tmp - header_chan(ich)%iuse = iuse_tmp - header_chan(ich)%nuchan = nuchan_tmp - header_chan(ich)%iochan = iochan_tmp - if (iflag/=0) return - end do - -! Construct array containing menonics for data record entries - - -end subroutine read_radiag_header - -subroutine read_radiag_data(ftin,header_fix,retrieval,data_fix,data_chan,data_extra,iflag ) -! . . . . -! subprogram: read_radiag_dat read rad diag data -! prgmmr: tahara org: np20 date: 2003-01-01 -! -! abstract: This routine reads the data record from a radiance -! diagnostic file -! -! program history log: -! 2010-10-05 treadon - add this doc block -! 2011-02-22 kleist - changes related to memory allocation -! -! input argument list: -! ftin - unit number connected to diagnostic file -! header_fix - header information structure -! -! output argument list: -! data_fix - spot header information structure -! data_chan - spot channel information structure -! data_extra - spot extra information -! iflag - error code -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ - - -! Declare passed arguments - integer(i_kind),intent(in) :: ftin - type(diag_header_fix_list ),intent(in) :: header_fix - logical,intent(in) :: retrieval - type(diag_data_fix_list) ,intent(out):: data_fix - type(diag_data_chan_list) ,allocatable :: data_chan(:) - type(diag_data_extra_list) ,allocatable :: data_extra(:,:) - integer(i_kind),intent(out) :: iflag - - integer(i_kind) :: ich,iang,i,j - real(r_single),dimension(:,:),allocatable :: data_tmp - real(r_single),dimension(:),allocatable :: fix_tmp - real(r_single),dimension(:,:),allocatable :: extra_tmp - -! Allocate arrays as needed - if (allocated(data_chan)) deallocate(data_chan) - allocate(data_chan(header_fix%nchan)) - - do ich=1,header_fix%nchan - if (allocated(data_chan(ich)%bifix)) deallocate(data_chan(ich)%bifix) - allocate(data_chan(ich)%bifix(header_fix%angord+1)) - end do - - if (header_fix%iextra > 0) then - if (allocated(data_extra)) deallocate(data_extra) - allocate(data_extra(header_fix%iextra,header_fix%jextra)) - allocate(extra_tmp(header_fix%iextra,header_fix%jextra)) - end if - -! Allocate arrays to hold data record - allocate(data_tmp(header_fix%idiag,header_fix%nchan)) - - if (header_fix%iversion < iversion_radiag_2) then - allocate( fix_tmp( ireal_old_radiag ) ) - else - allocate( fix_tmp( ireal_radiag ) ) - end if - -! Read data record - - if (header_fix%iextra == 0) then - read(ftin,IOSTAT=iflag) fix_tmp, data_tmp - else - read(ftin,IOSTAT=iflag) fix_tmp, data_tmp, extra_tmp - endif - - -! Transfer fix_tmp record to output structure - data_fix%lat = fix_tmp(1) - data_fix%lon = fix_tmp(2) - data_fix%zsges = fix_tmp(3) - data_fix%obstime = fix_tmp(4) - data_fix%senscn_pos = fix_tmp(5) - data_fix%satzen_ang = fix_tmp(6) - data_fix%satazm_ang = fix_tmp(7) - data_fix%solzen_ang = fix_tmp(8) - data_fix%solazm_ang = fix_tmp(9) - data_fix%sungln_ang = fix_tmp(10) - data_fix%water_frac = fix_tmp(11) - data_fix%land_frac = fix_tmp(12) - data_fix%ice_frac = fix_tmp(13) - data_fix%snow_frac = fix_tmp(14) - data_fix%water_temp = fix_tmp(15) - data_fix%land_temp = fix_tmp(16) - data_fix%ice_temp = fix_tmp(17) - data_fix%snow_temp = fix_tmp(18) - data_fix%soil_temp = fix_tmp(19) - data_fix%soil_mois = fix_tmp(20) - data_fix%land_type = fix_tmp(21) - data_fix%veg_frac = fix_tmp(22) - data_fix%snow_depth = fix_tmp(23) - data_fix%sfc_wndspd = fix_tmp(24) - data_fix%qcdiag1 = fix_tmp(25) - data_fix%qcdiag2 = fix_tmp(26) - - if ( header_fix%iversion <= iversion_radiag_1 ) then - data_fix%tref = rmiss_radiag - data_fix%dtw = rmiss_radiag - data_fix%dtc = rmiss_radiag - data_fix%tz_tr = rmiss_radiag - else - data_fix%tref = fix_tmp(27) - data_fix%dtw = fix_tmp(28) - data_fix%dtc = fix_tmp(29) - data_fix%tz_tr = fix_tmp(30) - end if - - -! Transfer data record to output structure - do ich=1,header_fix%nchan - data_chan(ich)%tbobs =data_tmp(1,ich) - data_chan(ich)%omgbc =data_tmp(2,ich) - data_chan(ich)%omgnbc=data_tmp(3,ich) - data_chan(ich)%errinv=data_tmp(4,ich) - data_chan(ich)%qcmark=data_tmp(5,ich) - data_chan(ich)%emiss =data_tmp(6,ich) - data_chan(ich)%tlap =data_tmp(7,ich) - data_chan(ich)%tb_tz =data_tmp(8,ich) - end do - if (header_fix%iversion < iversion_radiag_1) then - do ich=1,header_fix%nchan - data_chan(ich)%bifix(1)=data_tmp(8,ich) - data_chan(ich)%bilap =data_tmp(9,ich) - data_chan(ich)%bilap2 =data_tmp(10,ich) - data_chan(ich)%bicons =data_tmp(11,ich) - data_chan(ich)%biang =data_tmp(12,ich) - data_chan(ich)%biclw =data_tmp(13,ich) - data_chan(ich)%bisst = rmiss_radiag - if (retrieval) then - data_chan(ich)%biclw =rmiss_radiag - data_chan(ich)%bisst =data_tmp(13,ich) - endif - end do - elseif ( header_fix%iversion < iversion_radiag_2 .and. header_fix%iversion >= iversion_radiag_1 ) then - do ich=1,header_fix%nchan - data_chan(ich)%bicons=data_tmp(8,ich) - data_chan(ich)%biang =data_tmp(9,ich) - data_chan(ich)%biclw =data_tmp(10,ich) - data_chan(ich)%bilap2=data_tmp(11,ich) - data_chan(ich)%bilap =data_tmp(12,ich) - end do - do ich=1,header_fix%nchan - do iang=1,header_fix%angord+1 - data_chan(ich)%bifix(iang)=data_tmp(12+iang,ich) - end do - data_chan(ich)%bisst = data_tmp(12+header_fix%angord+2,ich) - end do - elseif ( header_fix%iversion < iversion_radiag_3 .and. header_fix%iversion >= iversion_radiag_2 ) then - do ich=1,header_fix%nchan - data_chan(ich)%bicons=data_tmp(9,ich) - data_chan(ich)%biang =data_tmp(10,ich) - data_chan(ich)%biclw =data_tmp(11,ich) - data_chan(ich)%bilap2=data_tmp(12,ich) - data_chan(ich)%bilap =data_tmp(13,ich) - end do - do ich=1,header_fix%nchan - do iang=1,header_fix%angord+1 - data_chan(ich)%bifix(iang)=data_tmp(13+iang,ich) - end do - data_chan(ich)%bisst = data_tmp(13+header_fix%angord+2,ich) - end do - elseif ( header_fix%iversion < iversion_radiag_4 .and. header_fix%iversion >= iversion_radiag_3 ) then - do ich=1,header_fix%nchan - data_chan(ich)%bicons=data_tmp(9,ich) - data_chan(ich)%biang =data_tmp(10,ich) - data_chan(ich)%biclw =data_tmp(11,ich) - data_chan(ich)%bilap2=data_tmp(12,ich) - data_chan(ich)%bilap =data_tmp(13,ich) - data_chan(ich)%bicos =data_tmp(14,ich) ! 1st bias correction term node*cos(lat) for SSMIS - data_chan(ich)%bisin =data_tmp(15,ich) ! 2nd bias correction term sin(lat) for SSMI - end do - do ich=1,header_fix%nchan - do iang=1,header_fix%angord+1 - data_chan(ich)%bifix(iang)=data_tmp(15+iang,ich) - end do - data_chan(ich)%bisst = data_tmp(15+header_fix%angord+2,ich) - end do - else - do ich=1,header_fix%nchan - data_chan(ich)%bicons=data_tmp(9,ich) - data_chan(ich)%biang =data_tmp(10,ich) - data_chan(ich)%biclw =data_tmp(11,ich) - data_chan(ich)%bilap2=data_tmp(12,ich) - data_chan(ich)%bilap =data_tmp(13,ich) - data_chan(ich)%bicos =data_tmp(14,ich) - data_chan(ich)%bisin =data_tmp(15,ich) - data_chan(ich)%biemis=data_tmp(16,ich) - end do - do ich=1,header_fix%nchan - do iang=1,header_fix%angord+1 - data_chan(ich)%bifix(iang)=data_tmp(16+iang,ich) - end do - data_chan(ich)%bisst = data_tmp(16+header_fix%angord+2,ich) - end do - endif - - if (header_fix%iextra > 0) then - do j=1,header_fix%jextra - do i=1,header_fix%iextra - data_extra(i,j)%extra=extra_tmp(i,j) - end do - end do - endif - - deallocate(data_tmp, fix_tmp) - if (header_fix%iextra > 0) deallocate(extra_tmp) - -end subroutine read_radiag_data - -end module read_diag - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radang.fd/readme b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radang.fd/readme deleted file mode 100644 index da9740f8d3..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radang.fd/readme +++ /dev/null @@ -1,25 +0,0 @@ -Instructions for building radmon_angle executable. - - 1) Load the build module appropriate for your Machine: - i.) - WCOSS: - "module use -a ../../modulefiles/wcoss" - CRAY: - "module use -a ../../modulefiles/cray" - THEIA: - "module use -a ../../modulefiles/theia" - ii.) - "module load RadMonBuild" - - 2) Optional: verify all prerequisites are met by typing: - "make check_prereqs" - - 3) Build the executable by typing: - "make" - - 4) Move the executable to the ../../exec directory by typing: - "make install" - - 5) Unload the build module: - "module unload RadMonBuild" - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radbcoef.fd/bcoef.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radbcoef.fd/bcoef.f90 deleted file mode 100755 index 08b4f13a50..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radbcoef.fd/bcoef.f90 +++ /dev/null @@ -1,355 +0,0 @@ -program bcoef - use read_diag - use kinds, only: r_kind,i_kind,r_quad - - implicit none - integer ntype,maxpred - parameter (ntype=13) - parameter (maxpred=12) - - logical eof - - character(10),dimension(ntype):: ftype - character(20) dum,satname,stringd,satsis,isis,mod_satname - character(10) satype,dplat - character(40) string,diag_rad,data_file,ctl_file - character(10) suffix - - integer luname,lungrd,lunctl,lncoef,lndiag,ich - integer iyy,imm,idd,ihh,idhh,incr,iread,iflag - integer n_chan,j,i,k,idum,ichan - integer,allocatable,dimension(:):: io_chan,nu_chan - integer npred_radiag - integer(i_kind) angord,ntlapupdate - - real pen,rmiss,weight,rread - real,allocatable,dimension(:):: wavenumbr,count,error,& - use,frequency,penalty,predr - real,allocatable,dimension(:,:):: coefs - real(r_kind) tlapm, tsum - -! Variables for reading satellite data - type(diag_header_fix_list ) :: header_fix - type(diag_header_chan_list),allocatable :: header_chan(:) - type(diag_data_name_list ) :: data_name - type(diag_data_fix_list ) :: data_fix - type(diag_data_chan_list ),allocatable :: data_chan(:) - type(diag_data_extra_list ),allocatable :: data_extra(:,:) - -! Namelist with defaults - integer :: npredr = 12 - logical :: retrieval = .false. - integer :: nchanl = 19 - integer :: imkctl = 1 - integer :: imkdata = 1 - character(3) :: gesanl ='ges' - integer :: little_endian = 1 - namelist /input/ satname,npredr,nchanl,iyy,imm,idd,ihh,idhh,& - incr,suffix,imkctl,imkdata,retrieval,gesanl,little_endian - - data luname,lungrd,lunctl / 5, 51, 52 / - data lncoef,lndiag / 21, 22 / - data rmiss /-999./ - data stringd / '.%y4%m2%d2%h2' / -!************************************************************************ -! Explanation of the fype array -! These are values used within the generated GrADS control file -! (bcoef.ctl). A fuller discription of the terms is thus: -! -! mean pred(1) = global offset (mean) -! atmpath pred(2) = not used when adp_anglebc=.true. and newpc4pred=.true. -! clw pred(3) = cloud liquid water term -! lapse2 pred(4) = (temperature lapse rate)**2 -! lapse pred(5) = temperature lapse rate -! cos_ssmis pred(6) = cosine term for SSMIS -! sin_ssmis pred(7) = sine term for SSMIS -! emiss pred(8) = emissivity sensitivity term -! ordang4 pred(9) = 4th order angle term -! ordang3 pred(10) = 3rd order angle term -! ordang2 pred(11) = 2nd order angle term -! ordang1 pred(12) = 1st order angle term -! -! Note that the npred namelist indicates how many of these terms -! will to be processed by this program. The default value is 12, -! meaning all will be processed. Earlier versions processed only the -! first 5. In all cases 12 values will be written to the resulting -! data file though if npred < 12 then the unprocessed values will -! all be set to rmiss. -!************************************************************************ - data ftype / 'penalty','mean','atmpath','clw','lapse2','lapse',& - 'cos_ssmis','sin_ssmis','emiss','ordang4','ordang3',& - 'ordang2','ordang1' / -!************************************************************************ -! - - -!************************************************************************ -! -! Initialize variables - iread=0 - npred_radiag = 12 - angord = 0 - -! Read namelist input - read(luname,input) - write(6,input) - write(6,*)'gesanl = ', gesanl - write(6,*)' ' - -! Check for user requests exceeding assumed limits - if (npredr>maxpred) then - write(6,*)' ' - write(6,*)'***ERROR*** user specified predictors > maximum allowed' - write(6,*)' npredr,maxpred=',npredr,maxpred - call errexit(91) - endif - - -! Set satellite id for specified satellite/sensor - write(6,*)'satname ',satname - - -! Create filenames for diagnostic input, binary output file - write(stringd,100) iyy,imm,idd,ihh -100 format('.',i4.4,3i2.2) - - if ( trim(gesanl) == 'ges' ) then - diag_rad = trim(satname) - data_file= trim(satname) // trim(stringd) // '.ieee_d' - ctl_file = trim(satname) // '.ctl' - else - diag_rad = trim(satname) // '_anl' - data_file= trim(satname) // '_anl' // trim(stringd) // '.ieee_d' - ctl_file = trim(satname) // '_anl.ctl' - endif - - write(6,*)'diag_rad =',diag_rad - write(6,*)'data_file=',data_file - write(6,*)'ctl_file =',ctl_file - write(6,*)'suffix =',suffix - - -! Open unit to diagnostic file. Read portion of header to -! see if file exists - open(lndiag,file=diag_rad,form='unformatted') - read(lndiag,err=900,end=900) dum - rewind lndiag - -! File exists. Read header - write(6,*)'call read_diag_header' - call read_radiag_header( lndiag, npred_radiag, retrieval, header_fix,& - header_chan, data_name, iflag ) - if( iflag/=0 ) then - write(6,*)'***ERROR*** problem reading diag file header, iflag=',iflag - call errexit(91) - endif - -! Extract observation type, satellite id, and number of channels - satype = header_fix%obstype - satsis = header_fix%isis - dplat = header_fix%id - n_chan = header_fix%nchan - angord = header_fix%angord - - if (angord == 4 ) then - npredr = 12 - endif - - write(6,*)'satype,n_chan=',satype,' ',dplat,n_chan - write(6,*)'angord = ', angord - - string = trim(satype)//'_'//trim(dplat) - write(6,*)'string,satname=',string,' ',satname - if ( trim(string) /= trim(satname) ) then - write(6,*)'***ERROR*** inconsistent instrument types' - write(6,*)' satname,string =',satname,' ',string - call errexit(93) - endif - - -! Allocate arrays to hold observational information - write(6,*)' ' - write(6,*)'allocate arrays' - allocate (io_chan(n_chan), nu_chan(n_chan), wavenumbr(n_chan)) - allocate (count(n_chan), penalty(n_chan), use(n_chan), & - frequency(n_chan)) - allocate(coefs(n_chan,maxpred)) - -! Zero accumulator arrays - do j=1,n_chan - count(j) = 0.0 - penalty(j) = 0.0 - end do - coefs = rmiss - - -! Extract satinfo relative index - do j=1,n_chan - nu_chan(j) = real( header_chan(j)%nuchan, 4 ) - io_chan(j) = real( header_chan(j)%iochan, 4 ) - wavenumbr(j) = real( header_chan(j)%wave, 4 ) - use(j) = real( header_chan(j)%iuse, 4 ) - frequency(j) = real( header_chan(j)%freq, 4) - end do - -! Loop to read entries in diagnostic file - iflag = 0 - loopd: do while (iflag == 0) - -! Read a record. If read flag, iflag does not equal zero, exit loopd - call read_radiag_data( lndiag, header_fix, retrieval, data_fix, data_chan,& - data_extra, iflag ) - if( iflag /= 0 ) exit loopd - iread=iread+1 - rread=rread+1.0 - - -! Channel loop - do j = 1, n_chan - -! If observation was assimilated, accumulate sum - if (data_chan(j)%errinv > 1.e-6) then -! pen = data_chan(j)%errinv*(data_chan(j)%omgbc)**2 - pen = (data_chan(j)%errinv*(data_chan(j)%omgbc))**2 - count(j) = count(j) + 1.0 - penalty(j) = penalty(j) + pen - endif - - enddo ! channel loop - -! End of loop over diagnostic file - enddo loopd - close(lndiag) - write(6,*)' ' - write(6,*)'read in ',iread,' obs ',rread - write(6,*)' ' - -! Compute average. - do j=1,n_chan - if (count(j)>0) then - penalty(j)=penalty(j)/count(j) - else - count(j)=rmiss - penalty(j)=rmiss - endif - end do - - -! Open unit to input data file. See if file exists - open(lncoef,file='biascr.txt',form='formatted') - if (angord == 4 ) then - read(lncoef,122,end=920,err=920) idum - else - read(lncoef,120,end=920,err=920) idum - endif - rewind(lncoef) -120 format(I5,1x,A20,1x,I5,10f12.6) -122 format(I5,1x,A20,1x,I5,2e15.6,1x,I5/2(4x,10f12.6/)) - -!read(lunin,'(I5,1x,A20,1x,I5,2e15.6,1x,I5/2(4x,10f12.6/))',iostat=istat,end=1333) -!ich,isis,& ichan,tlapm,tsum,ntlapupdate,(predr(ip),ip=1,npred), where npred=12 - -! Read coefficient file - allocate(predr(npredr)) - i=0 - k=1 - eof=.false. - do - if (angord /= 4 ) then - read(lncoef,120,IOSTAT=iflag) ich,isis,ichan,(predr(j),j=1,npredr) - else - read(lncoef,122,IOSTAT=iflag) ich,isis,ichan, tlapm,tsum,ntlapupdate,(predr(j),j=1,npredr) - endif - if(iflag /=0) exit - if (trim(isis)==trim(satsis)) then - io_chan(k)=ichan - do j=1,npredr - coefs(k,j)=predr(j) - end do - k=k+1 - cycle - endif - end do - close(lncoef) - deallocate(predr) - - ! Create Control file - if ( imkctl == 1 ) then - write(6,*)'call create_ctl_bcoef' - - if ( trim(gesanl) == 'ges' ) then - mod_satname = trim(satname) - else - mod_satname = trim(satname) // '_anl' - endif - - call create_ctl_bcoef(ntype,ftype,n_chan,iyy,imm,idd,ihh,idhh,& - incr,ctl_file,lunctl,rmiss,mod_satname,satype,dplat,& - nu_chan,use,penalty,frequency,wavenumbr,little_endian) - else - write(6,*) 'imkctl =',imkctl - endif - - -! Write data to binary output file - if ( imkdata == 1 ) then - write(6,*)'write data to lungrd=',lungrd - open(lungrd,file=data_file,form='unformatted') - write(lungrd) (penalty(k),k=1,n_chan) - do j=1,maxpred - write(lungrd) (coefs(k,j),k=1,n_chan) - end do - close(lungrd) - endif - -! Deallocate arrays - write(6,*)'deallocate arrays' - deallocate(coefs,io_chan,nu_chan,wavenumbr,count,penalty,use,frequency) - goto 950 - - -! Jump here if problem reading diagnostic file -900 continue - write(6,*)'***PROBLEM*** reading diagnostic file' - - n_chan=nchanl - if (n_chan<=0) then - write(6,*)'***ERROR*** invalid nchanl=',nchanl,' STOP program' - call errexit(94) - endif - - write(6,*)'load missing value ',rmiss,' into output arrays. ',& - n_chan,npredr - allocate(penalty(n_chan),coefs(n_chan,npredr)) - do k=1,n_chan - penalty(k)=rmiss - end do - do j=1,npredr - do k=1,n_chan - coefs(k,j)=rmiss - end do - end do - - if ( imkdata == 1 ) then - open(lungrd,file=data_file,form='unformatted') - write(lungrd) (penalty(k),k=1,n_chan) - do j=1,npredr - write(lungrd) (coefs(k,j),k=1,n_chan) - end do - write(6,*)'write output to lungrd=',lungrd,', file=',trim(data_file) - close(lungrd) - endif - deallocate(penalty,coefs) - - goto 950 - - -! Jump here if problem reading coefficient file -920 continue - write(6,*)'***PROBLEM*** reading coefficient file' - - -! End of program -950 continue - stop -end program bcoef diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radbcoef.fd/create_ctl_bcoef.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radbcoef.fd/create_ctl_bcoef.f90 deleted file mode 100755 index f8f785dcc6..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radbcoef.fd/create_ctl_bcoef.f90 +++ /dev/null @@ -1,147 +0,0 @@ -subroutine create_ctl_bcoef(ntype,ftype,n_chan,iyy,imm,idd,ihh,idhh,& - incr,ctl_file,lunctl,rmiss,satname,satype,dplat,& - nu_chan,use,ratio,frequency,wavenumbr,little_endian) - - implicit none - - integer ntype - - character(2) cword - character(3),dimension(12):: mon - character(3):: clatmin,clatmax - character(4):: clonmin,clonmax - character(10),dimension(ntype):: ftype - character(13) stringd - character(20) satname - character(10) satype,dplat - character(40) ctl_file,grad_file - character(80) string - - integer idsat,iuse,little_endian - integer lunctl,iyy,imm,idd,ihh,j,i,n_chan,idhh,incr - integer iyy2,imm2,idd2,ihh2,ntime - integer,dimension(8):: ida,jda - integer,dimension(n_chan):: nu_chan - - real rmiss,wavelength - real,dimension(5):: fha - real,dimension(n_chan):: ratio,use,frequency,wavenumbr - - data stringd / '.%y4%m2%d2%h2' / - data mon / 'jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', & - 'aug', 'sep', 'oct', 'nov', 'dec' / - -!************************************************************************** -! Create date for tdef based on given date and hour offset - fha=0.0; ida=0; jda=0; ntime=0 - iyy2=iyy; imm2=imm; idd2=idd; ihh2=ihh - if (idhh/=0) then - ntime = abs(idhh)/incr - fha(2)=idhh - ida(1)=iyy - ida(2)=imm - ida(3)=idd - ida(4)=0 - ida(5)=ihh - call w3movdat(fha,ida,jda) - iyy2=jda(1) - imm2=jda(2) - idd2=jda(3) - ihh2=jda(5) - endif - ntime=ntime+1 - -! Open unit to GrADS control file - open(lunctl,file=ctl_file,form='formatted') - - -! Write header information - grad_file = trim(satname) // stringd // '.ieee_d' - write(lunctl,100) grad_file - if ( little_endian == 1 ) then - write(lunctl,112) - else - write(lunctl,110) - endif - write(lunctl,120) rmiss - write(lunctl,130) adjustl(satype),dplat,n_chan - write(lunctl,132) - do i=1,n_chan - iuse = nint(use(i)) - wavelength = 10000./wavenumbr(i) - write(lunctl,134) i,nu_chan(i),iuse,ratio(i),wavelength,frequency(i) - end do - - write(lunctl,210) - write(lunctl,211) - write(lunctl,212) - write(lunctl,213) - write(lunctl,214) - write(lunctl,215) - write(lunctl,216) - write(lunctl,217) - write(lunctl,218) - write(lunctl,219) - write(lunctl,220) - write(lunctl,221) - write(lunctl,222) - write(lunctl,223) - write(lunctl,224) - write(lunctl,210) - - write(lunctl,140) n_chan - write(lunctl,150) - write(lunctl,160) - write(lunctl,170) ntime,ihh2,idd2,mon(imm2),iyy2 - write(lunctl,180) ntype - -100 format('dset ^',a40) -110 format('options template big_endian sequential') -112 format('options template little_endian sequential') -120 format('undef ',f5.0) -130 format('title ',a10,1x,a10,1x,i4) -132 format('*XDEF is channel number') -134 format('* x= ',i4,', channel= ',i4,' , iuse= ',i2,' , ratio= ',f8.3,& - ' , wlth= ',f9.2,' , freq= ',f9.2) -136 format('* ',a70) -140 format('xdef ',i4,' linear 1.0 1.0') -150 format('ydef 1 linear 1.0 1.0') -160 format('zdef 1 linear 1.0 1.0') -170 format('tdef ',i4,' linear ',i2.2,'Z',i2.2,a3,i4.4,' 06hr') -180 format('vars ',i7) - -210 format('*') -211 format('* Explanation of data terms:') -212 format('* penalty penalty value') -213 format('* mean global offset (mean)') -214 format('* atmpath not used when adp_anglebc=.true. and newpc4pred=.true.') -215 format('* clw cloud liquid water term') -216 format('* lapse2 temperature lapse rate**2') -217 format('* lapse temperature lapse rate') -218 format('* cos_ssmis cosine term for SSMIS') -219 format('* sin_ssmis sine term for SSMIS') -220 format('* emiss emissivity sensitivity term') -221 format('* 4ordang 4th order angle term') -222 format('* 3ordang 3rd order angle term') -223 format('* 2ordang 2nd order angle term') -224 format('* 1ordang 1st order angle term') - - -! Write data portion of GraDS control file - do i=1,ntype - string = trim(ftype(i)) - write(lunctl,190) adjustl(string),trim(ftype(i)) -190 format(a10,' 0 0 ',a10) - end do - -! Write trminating "endvars" record - write(lunctl,200) -200 format('endvars') - - -! Close ctl file - close(lunctl) - -! Return - return -end subroutine create_ctl_bcoef diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radbcoef.fd/makefile b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radbcoef.fd/makefile deleted file mode 100755 index dd1f86bad2..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radbcoef.fd/makefile +++ /dev/null @@ -1,49 +0,0 @@ -# ***************************************************************** -# makefile.bcoef -# -# Make the radmon_bcoef executable. -# -# ***************************************************************** - -BINDIR = ../../exec - -LIBS = $(W3NCO_LIB4) - -OBJS = kinds.o read_diag.o bcoef.o create_ctl_bcoef.o - -# -# ***************************************************************** -# - -CMD = radmon_bcoef - -all: $(CMD) - -clean: - rm -f *.o - rm -f *.mod - rm -f radmon_bcoef - -check_prereqs: - /nwprod/spa_util/check_libs.bash $(LIBS) - -install: - cp -f $(CMD) $(BINDIR)/ - -debug: FFLAGS = $(D_FFLAGS) -debug: $(CMD) - -$(CMD): $(OBJS) - $(CF) $(FFLAGS) $(LDFLAGS) -o $(@) $(OBJS) $(LIBS) - -read_diag.o : read_diag.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -bcoef.o : bcoef.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -create_ctl_bcoef.o : create_ctl_bcoef.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -kinds.o : kinds.F90 - $(CF) $(FFLAGS) -c $(*).F90 diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radbcoef.fd/read_diag.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radbcoef.fd/read_diag.f90 deleted file mode 100755 index 7a4d6cdc49..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radbcoef.fd/read_diag.f90 +++ /dev/null @@ -1,659 +0,0 @@ -!$$$ subprogram documentation block -! . . . . -! subprogram: read_raddiag read rad diag file -! prgmmr: tahara org: np20 date: 2003-01-01 -! -! abstract: This module contains code to process radiance -! diagnostic files. The module defines structures -! to contain information from the radiance -! diagnostic files and then provides two routines -! to access contents of the file. -! -! program history log: -! 2005-07-22 treadon - add this doc block -! 2010-10-05 treadon - refactor code to GSI standard -! 2010-10-08 zhu - use data_tmp to handle various npred values -! 2011-02-22 kleist - changes related to memory allocate/deallocate -! 2011-04-08 li - add tref, dtw, dtc to diag_data_fix_list, add tb_tz to diag_data_chan_list -! - correspondingly, change ireal_radiag (26 -> 30) and ipchan_radiag (7 -> 8) -! 2011-07-24 safford - make structure size for reading data_fix data version dependent -! 2013-11-21 todling - revisit how versions are set (add set/get_radiag) -! 2014-01-27 todling - add ob sensitivity index -! -! contains -! read_radiag_header - read radiance diagnostic file header -! read_radiag_data - read radiance diagnostic file data -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ - -module read_diag - - use kinds, only: i_kind,r_single - implicit none - -! Declare public and private - private - - public :: diag_header_fix_list - public :: diag_header_chan_list - public :: diag_data_name_list - public :: diag_data_fix_list - public :: diag_data_chan_list - public :: diag_data_extra_list - public :: read_radiag_header - public :: read_radiag_data -! public :: iversion_radiag -! public :: iversion_radiag_1 -! public :: iversion_radiag_2 -! public :: iversion_radiag_3 -! public :: iversion_radiag_4 - public :: ireal_radiag - public :: ipchan_radiag - public :: set_radiag - public :: get_radiag - - interface set_radiag - module procedure set_radiag_int_ ! internal procedure for integers - end interface - interface get_radiag - module procedure get_radiag_int_ ! internal procedure for integers - end interface - - integer(i_kind),parameter :: ireal_radiag = 30 ! number of real entries per spot in radiance diagnostic file - integer(i_kind),parameter :: ireal_old_radiag = 26 ! number of real entries per spot in versions older than iversion_radiag_2 - integer(i_kind),parameter :: ipchan_radiag = 8 ! number of entries per channel per spot in radiance diagnostic file - -! Declare structures for radiance diagnostic file information - type diag_header_fix_list - character(len=20) :: isis ! sat and sensor type - character(len=10) :: id ! sat type - character(len=10) :: obstype ! observation type - integer(i_kind) :: jiter ! outer loop counter - integer(i_kind) :: nchan ! number of channels in the sensor - integer(i_kind) :: npred ! number of updating bias correction predictors - integer(i_kind) :: idate ! time (yyyymmddhh) - integer(i_kind) :: ireal ! # of real elements in the fix part of a data record - integer(i_kind) :: ipchan ! # of elements for each channel except for bias correction terms - integer(i_kind) :: iextra ! # of extra elements for each channel - integer(i_kind) :: jextra ! # of extra elements - integer(i_kind) :: idiag ! first dimension of diag_data_chan - integer(i_kind) :: angord ! order of polynomial for adp_anglebc option - integer(i_kind) :: iversion ! radiance diagnostic file version number - integer(i_kind) :: inewpc ! indicator of newpc4pred (1 on, 0 off) - integer(i_kind) :: isens ! sensitivity index - end type diag_header_fix_list - - type diag_data_name_list - character(len=10),dimension(ireal_radiag) :: fix - character(len=10),dimension(:),allocatable :: chn - end type diag_data_name_list - - type diag_header_chan_list - real(r_single) :: freq ! frequency (Hz) - real(r_single) :: polar ! polarization - real(r_single) :: wave ! wave number (cm^-1) - real(r_single) :: varch ! error variance (or SD error?) - real(r_single) :: tlapmean ! mean lapse rate - integer(i_kind):: iuse ! use flag - integer(i_kind):: nuchan ! sensor relative channel number - integer(i_kind):: iochan ! satinfo relative channel number - end type diag_header_chan_list - - type diag_data_fix_list - real(r_single) :: lat ! latitude (deg) - real(r_single) :: lon ! longitude (deg) - real(r_single) :: zsges ! guess elevation at obs location (m) - real(r_single) :: obstime ! observation time relative to analysis - real(r_single) :: senscn_pos ! sensor scan position (integer(i_kind)) - real(r_single) :: satzen_ang ! satellite zenith angle (deg) - real(r_single) :: satazm_ang ! satellite azimuth angle (deg) - real(r_single) :: solzen_ang ! solar zenith angle (deg) - real(r_single) :: solazm_ang ! solar azimumth angle (deg) - real(r_single) :: sungln_ang ! sun glint angle (deg) - real(r_single) :: water_frac ! fractional coverage by water - real(r_single) :: land_frac ! fractional coverage by land - real(r_single) :: ice_frac ! fractional coverage by ice - real(r_single) :: snow_frac ! fractional coverage by snow - real(r_single) :: water_temp ! surface temperature over water (K) - real(r_single) :: land_temp ! surface temperature over land (K) - real(r_single) :: ice_temp ! surface temperature over ice (K) - real(r_single) :: snow_temp ! surface temperature over snow (K) - real(r_single) :: soil_temp ! soil temperature (K) - real(r_single) :: soil_mois ! soil moisture - real(r_single) :: land_type ! land type (integer(i_kind)) - real(r_single) :: veg_frac ! vegetation fraction - real(r_single) :: snow_depth ! snow depth - real(r_single) :: sfc_wndspd ! surface wind speed - real(r_single) :: qcdiag1 ! ir=cloud fraction, mw=cloud liquid water - real(r_single) :: qcdiag2 ! ir=cloud top pressure, mw=total column water - real(r_single) :: tref ! reference temperature (Tr) in NSST - real(r_single) :: dtw ! dt_warm at zob - real(r_single) :: dtc ! dt_cool at zob - real(r_single) :: tz_tr ! d(Tz)/d(Tr) - end type diag_data_fix_list - - type diag_data_chan_list - real(r_single) :: tbobs ! Tb (obs) (K) - real(r_single) :: omgbc ! Tb_(obs) - Tb_(simulated w/ bc) (K) - real(r_single) :: omgnbc ! Tb_(obs) - Tb_(simulated_w/o bc) (K) - real(r_single) :: errinv ! inverse error (K**(-1)) - real(r_single) :: qcmark ! quality control mark - real(r_single) :: emiss ! surface emissivity - real(r_single) :: tlap ! temperature lapse rate - real(r_single) :: tb_tz ! d(Tb)/d(Tz) - real(r_single) :: bicons ! constant bias correction term - real(r_single) :: biang ! scan angle bias correction term - real(r_single) :: biclw ! CLW bias correction term - real(r_single) :: bilap2 ! square lapse rate bias correction term - real(r_single) :: bilap ! lapse rate bias correction term - real(r_single) :: bicos ! node*cos(lat) bias correction term - real(r_single) :: bisin ! sin(lat) bias correction term - real(r_single) :: biemis ! emissivity sensitivity bias correction term - real(r_single),dimension(:),allocatable :: bifix ! angle dependent bias - real(r_single) :: bisst ! SST bias correction term - end type diag_data_chan_list - - type diag_data_extra_list - real(r_single) :: extra ! extra information - end type diag_data_extra_list - - integer(i_kind),save :: iversion_radiag ! Current version (see set routine) - integer(i_kind),parameter:: iversion_radiag_1 = 11104 ! Version when bias-correction entries were modified - integer(i_kind),parameter:: iversion_radiag_2 = 13784 ! Version when NSST entries were added - integer(i_kind),parameter:: iversion_radiag_3 = 19180 ! Version when SSMIS added - integer(i_kind),parameter:: iversion_radiag_4 = 30303 ! Version when emissivity predictor added - - real(r_single),parameter:: rmiss_radiag = -9.9e11_r_single - -contains - -subroutine set_radiag_int_ (what,iv,ier) -character(len=*),intent(in) :: what -integer(i_kind),intent(in) :: iv -integer(i_kind),intent(out):: ier -ier=-1 -if(trim(what)=='version') then - iversion_radiag = iv - ier=0 -endif -end subroutine set_radiag_int_ - -subroutine get_radiag_int_ (what,iv,ier) -character(len=*),intent(in) :: what -integer(i_kind),intent(out):: iv -integer(i_kind),intent(out):: ier -ier=-1 -if(trim(what)=='version') then - iv = iversion_radiag - ier=0 -endif -end subroutine get_radiag_int_ - -subroutine read_radiag_header(ftin,npred_radiag,retrieval,header_fix,header_chan,data_name,iflag,lverbose) -! . . . . -! subprogram: read_diag_header read rad diag header -! prgmmr: tahara org: np20 date: 2003-01-01 -! -! abstract: This routine reads the header record from a radiance -! diagnostic file -! -! program history log: -! 2010-10-05 treadon - add this doc block -! 2011-02-22 kleist - changes related to memory allocation and standard output -! -! input argument list: -! ftin - unit number connected to diagnostic file -! npred_radiag - number of bias correction terms -! retrieval - .true. if sst retrieval -! -! output argument list: -! header_fix - header information structure -! header_chan - channel information structure -! data_name - diag file data names -! iflag - error code -! lverbose - optional flag to turn off default output to standard out -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ - -! Declare passed arguments - integer(i_kind),intent(in) :: ftin - integer(i_kind),intent(in) :: npred_radiag - logical,intent(in) :: retrieval - type(diag_header_fix_list ),intent(out):: header_fix - type(diag_header_chan_list),allocatable :: header_chan(:) - type(diag_data_name_list) :: data_name - integer(i_kind),intent(out) :: iflag - logical,optional,intent(in) :: lverbose - -! Declare local variables - character(len=2):: string - character(len=10):: satid,sentype - character(len=20):: sensat - integer(i_kind) :: i,ich - integer(i_kind):: jiter,nchanl,npred,ianldate,ireal,ipchan,iextra,jextra - integer(i_kind):: idiag,angord,iversion,inewpc,isens - integer(i_kind):: iuse_tmp,nuchan_tmp,iochan_tmp - real(r_single) :: freq_tmp,polar_tmp,wave_tmp,varch_tmp,tlapmean_tmp - logical loutall - - loutall=.true. - if(present(lverbose)) loutall=lverbose - -! Read header (fixed_part). - read(ftin,IOSTAT=iflag) sensat,satid,sentype,jiter,nchanl,npred,ianldate,& - ireal,ipchan,iextra,jextra,idiag,angord,iversion,inewpc,isens - if (iflag/=0) then - rewind(ftin) - read(ftin,IOSTAT=iflag) sensat,satid,sentype,jiter,nchanl,npred,ianldate,& - ireal,ipchan,iextra,jextra,idiag,angord,iversion,inewpc - isens=0 - end if - - if (iflag/=0) then - rewind(ftin) - read(ftin,IOSTAT=iflag) sensat,satid,sentype,jiter,nchanl,npred,ianldate,& - ireal,ipchan,iextra,jextra - idiag=ipchan+npred+1 - angord=0 - iversion=0 - inewpc=0 - isens=0 - if (iflag/=0) then - write(6,*)'READ_RADIAG_HEADER: ***ERROR*** Unknown file format. Cannot read' - return - endif - endif - - header_fix%isis = sensat - header_fix%id = satid - header_fix%obstype = sentype - header_fix%jiter = jiter - header_fix%nchan = nchanl - header_fix%npred = npred - header_fix%idate = ianldate - header_fix%ireal = ireal - header_fix%ipchan = ipchan - header_fix%iextra = iextra - header_fix%jextra = jextra - header_fix%idiag = idiag - header_fix%angord = angord - header_fix%iversion= iversion - header_fix%inewpc = inewpc - header_fix%isens = isens - - if (loutall) then - write(6,*)'READ_RADIAG_HEADER: isis=',header_fix%isis,& - ' nchan=',header_fix%nchan,& - ' npred=',header_fix%npred,& - ' angord=',header_fix%angord,& - ' idiag=',header_fix%idiag,& - ' iversion=',header_fix%iversion,& - ' inewpc=',header_fix%inewpc,& - ' isens=',header_fix%isens - - if ( header_fix%iextra /= 0) & - write(6,*)'READ_RADIAG_HEADER: extra diagnostic information available, ',& - 'iextra=',header_fix%iextra - end if - - if (header_fix%npred /= npred_radiag) & - write(6,*) 'READ_RADIAG_HEADER: **WARNING** header_fix%npred,npred=',& - header_fix%npred,npred_radiag - -! Allocate and initialize as needed - if (allocated(header_chan)) deallocate(header_chan) - if (allocated(data_name%chn)) deallocate(data_name%chn) - - allocate(header_chan( header_fix%nchan)) - allocate(data_name%chn(header_fix%idiag)) - - data_name%fix(1) ='lat ' - data_name%fix(2) ='lon ' - data_name%fix(3) ='zsges ' - data_name%fix(4) ='obstim ' - data_name%fix(5) ='scanpos ' - data_name%fix(6) ='satzen ' - data_name%fix(7) ='satazm ' - data_name%fix(8) ='solzen ' - data_name%fix(9) ='solazm ' - data_name%fix(10)='sungln ' - data_name%fix(11)='fwater ' - data_name%fix(12)='fland ' - data_name%fix(13)='fice ' - data_name%fix(14)='fsnow ' - data_name%fix(15)='twater ' - data_name%fix(16)='tland ' - data_name%fix(17)='tice ' - data_name%fix(18)='tsnow ' - data_name%fix(19)='tsoil ' - data_name%fix(20)='soilmoi ' - data_name%fix(21)='landtyp ' - data_name%fix(22)='vegfrac ' - data_name%fix(23)='snowdep ' - data_name%fix(24)='wndspd ' - data_name%fix(25)='qc1 ' - data_name%fix(26)='qc2 ' - data_name%fix(27)='tref ' - data_name%fix(28)='dtw ' - data_name%fix(29)='dtc ' - data_name%fix(30)='tz_tr ' - - data_name%chn(1)='obs ' - data_name%chn(2)='omgbc ' - data_name%chn(3)='omgnbc ' - data_name%chn(4)='errinv ' - data_name%chn(5)='qcmark ' - data_name%chn(6)='emiss ' - data_name%chn(7)='tlap ' - data_name%chn(8)='tb_tz ' - - if (header_fix%iversion < iversion_radiag_1) then - data_name%chn( 8)= 'bifix ' - data_name%chn( 9)= 'bilap ' - data_name%chn(10)= 'bilap2 ' - data_name%chn(11)= 'bicons ' - data_name%chn(12)= 'biang ' - data_name%chn(13)= 'biclw ' - if (retrieval) data_name%chn(13)= 'bisst ' - elseif ( header_fix%iversion < iversion_radiag_2 .and. header_fix%iversion >= iversion_radiag_1 ) then - data_name%chn( 8)= 'bicons ' - data_name%chn( 9)= 'biang ' - data_name%chn(10)= 'biclw ' - data_name%chn(11)= 'bilap2 ' - data_name%chn(12)= 'bilap ' - do i=1,header_fix%angord - write(string,'(i2.2)') header_fix%angord-i+1 - data_name%chn(12+i)= 'bifix' // string - end do - data_name%chn(12+header_fix%angord+1)= 'bifix ' - data_name%chn(12+header_fix%angord+2)= 'bisst ' - elseif ( header_fix%iversion < iversion_radiag_3 .and. header_fix%iversion >= iversion_radiag_2 ) then - data_name%chn( 9)= 'bicons ' - data_name%chn(10)= 'biang ' - data_name%chn(11)= 'biclw ' - data_name%chn(12)= 'bilap2 ' - data_name%chn(13)= 'bilap ' - do i=1,header_fix%angord - write(string,'(i2.2)') header_fix%angord-i+1 - data_name%chn(13+i)= 'bifix' // string - end do - data_name%chn(13+header_fix%angord+1)= 'bifix ' - data_name%chn(13+header_fix%angord+2)= 'bisst ' - elseif ( header_fix%iversion < iversion_radiag_4 .and. header_fix%iversion >= iversion_radiag_3 ) then - data_name%chn( 9)= 'bicons ' - data_name%chn(10)= 'biang ' - data_name%chn(11)= 'biclw ' - data_name%chn(12)= 'bilap2 ' - data_name%chn(13)= 'bilap ' - data_name%chn(14)= 'bicos ' - data_name%chn(15)= 'bisin ' - do i=1,header_fix%angord - write(string,'(i2.2)') header_fix%angord-i+1 - data_name%chn(15+i)= 'bifix' // string - end do - data_name%chn(15+header_fix%angord+1)= 'bifix ' - data_name%chn(15+header_fix%angord+2)= 'bisst ' - else - data_name%chn( 9)= 'bicons ' - data_name%chn(10)= 'biang ' - data_name%chn(11)= 'biclw ' - data_name%chn(12)= 'bilap2 ' - data_name%chn(13)= 'bilap ' - data_name%chn(14)= 'bicos ' - data_name%chn(15)= 'bisin ' - data_name%chn(16)= 'biemis ' - do i=1,header_fix%angord - write(string,'(i2.2)') header_fix%angord-i+1 - data_name%chn(16+i)= 'bifix' // string - end do - data_name%chn(16+header_fix%angord+1)= 'bifix ' - data_name%chn(16+header_fix%angord+2)= 'bisst ' - endif - -! Read header (channel part) - do ich=1, header_fix%nchan - read(ftin,IOSTAT=iflag) freq_tmp,polar_tmp,wave_tmp,varch_tmp,tlapmean_tmp,iuse_tmp,nuchan_tmp,iochan_tmp - header_chan(ich)%freq = freq_tmp - header_chan(ich)%polar = polar_tmp - header_chan(ich)%wave = wave_tmp - header_chan(ich)%varch = varch_tmp - header_chan(ich)%tlapmean = tlapmean_tmp - header_chan(ich)%iuse = iuse_tmp - header_chan(ich)%nuchan = nuchan_tmp - header_chan(ich)%iochan = iochan_tmp - if (iflag/=0) return - end do - -! Construct array containing menonics for data record entries - - -end subroutine read_radiag_header - -subroutine read_radiag_data(ftin,header_fix,retrieval,data_fix,data_chan,data_extra,iflag ) -! . . . . -! subprogram: read_radiag_dat read rad diag data -! prgmmr: tahara org: np20 date: 2003-01-01 -! -! abstract: This routine reads the data record from a radiance -! diagnostic file -! -! program history log: -! 2010-10-05 treadon - add this doc block -! 2011-02-22 kleist - changes related to memory allocation -! -! input argument list: -! ftin - unit number connected to diagnostic file -! header_fix - header information structure -! -! output argument list: -! data_fix - spot header information structure -! data_chan - spot channel information structure -! data_extra - spot extra information -! iflag - error code -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ - - -! Declare passed arguments - integer(i_kind),intent(in) :: ftin - type(diag_header_fix_list ),intent(in) :: header_fix - logical,intent(in) :: retrieval - type(diag_data_fix_list) ,intent(out):: data_fix - type(diag_data_chan_list) ,allocatable :: data_chan(:) - type(diag_data_extra_list) ,allocatable :: data_extra(:,:) - integer(i_kind),intent(out) :: iflag - - integer(i_kind) :: ich,iang,i,j - real(r_single),dimension(:,:),allocatable :: data_tmp - real(r_single),dimension(:),allocatable :: fix_tmp - real(r_single),dimension(:,:),allocatable :: extra_tmp - -! Allocate arrays as needed - if (allocated(data_chan)) deallocate(data_chan) - allocate(data_chan(header_fix%nchan)) - - do ich=1,header_fix%nchan - if (allocated(data_chan(ich)%bifix)) deallocate(data_chan(ich)%bifix) - allocate(data_chan(ich)%bifix(header_fix%angord+1)) - end do - - if (header_fix%iextra > 0) then - if (allocated(data_extra)) deallocate(data_extra) - allocate(data_extra(header_fix%iextra,header_fix%jextra)) - allocate(extra_tmp(header_fix%iextra,header_fix%jextra)) - end if - -! Allocate arrays to hold data record - allocate(data_tmp(header_fix%idiag,header_fix%nchan)) - - if (header_fix%iversion < iversion_radiag_2) then - allocate( fix_tmp( ireal_old_radiag ) ) - else - allocate( fix_tmp( ireal_radiag ) ) - end if - -! Read data record - - if (header_fix%iextra == 0) then - read(ftin,IOSTAT=iflag) fix_tmp, data_tmp - else - read(ftin,IOSTAT=iflag) fix_tmp, data_tmp, extra_tmp - endif - - -! Transfer fix_tmp record to output structure - data_fix%lat = fix_tmp(1) - data_fix%lon = fix_tmp(2) - data_fix%zsges = fix_tmp(3) - data_fix%obstime = fix_tmp(4) - data_fix%senscn_pos = fix_tmp(5) - data_fix%satzen_ang = fix_tmp(6) - data_fix%satazm_ang = fix_tmp(7) - data_fix%solzen_ang = fix_tmp(8) - data_fix%solazm_ang = fix_tmp(9) - data_fix%sungln_ang = fix_tmp(10) - data_fix%water_frac = fix_tmp(11) - data_fix%land_frac = fix_tmp(12) - data_fix%ice_frac = fix_tmp(13) - data_fix%snow_frac = fix_tmp(14) - data_fix%water_temp = fix_tmp(15) - data_fix%land_temp = fix_tmp(16) - data_fix%ice_temp = fix_tmp(17) - data_fix%snow_temp = fix_tmp(18) - data_fix%soil_temp = fix_tmp(19) - data_fix%soil_mois = fix_tmp(20) - data_fix%land_type = fix_tmp(21) - data_fix%veg_frac = fix_tmp(22) - data_fix%snow_depth = fix_tmp(23) - data_fix%sfc_wndspd = fix_tmp(24) - data_fix%qcdiag1 = fix_tmp(25) - data_fix%qcdiag2 = fix_tmp(26) - - if ( header_fix%iversion <= iversion_radiag_1 ) then - data_fix%tref = rmiss_radiag - data_fix%dtw = rmiss_radiag - data_fix%dtc = rmiss_radiag - data_fix%tz_tr = rmiss_radiag - else - data_fix%tref = fix_tmp(27) - data_fix%dtw = fix_tmp(28) - data_fix%dtc = fix_tmp(29) - data_fix%tz_tr = fix_tmp(30) - end if - - -! Transfer data record to output structure - do ich=1,header_fix%nchan - data_chan(ich)%tbobs =data_tmp(1,ich) - data_chan(ich)%omgbc =data_tmp(2,ich) - data_chan(ich)%omgnbc=data_tmp(3,ich) - data_chan(ich)%errinv=data_tmp(4,ich) - data_chan(ich)%qcmark=data_tmp(5,ich) - data_chan(ich)%emiss =data_tmp(6,ich) - data_chan(ich)%tlap =data_tmp(7,ich) - data_chan(ich)%tb_tz =data_tmp(8,ich) - end do - if (header_fix%iversion < iversion_radiag_1) then - do ich=1,header_fix%nchan - data_chan(ich)%bifix(1)=data_tmp(8,ich) - data_chan(ich)%bilap =data_tmp(9,ich) - data_chan(ich)%bilap2 =data_tmp(10,ich) - data_chan(ich)%bicons =data_tmp(11,ich) - data_chan(ich)%biang =data_tmp(12,ich) - data_chan(ich)%biclw =data_tmp(13,ich) - data_chan(ich)%bisst = rmiss_radiag - if (retrieval) then - data_chan(ich)%biclw =rmiss_radiag - data_chan(ich)%bisst =data_tmp(13,ich) - endif - end do - elseif ( header_fix%iversion < iversion_radiag_2 .and. header_fix%iversion >= iversion_radiag_1 ) then - do ich=1,header_fix%nchan - data_chan(ich)%bicons=data_tmp(8,ich) - data_chan(ich)%biang =data_tmp(9,ich) - data_chan(ich)%biclw =data_tmp(10,ich) - data_chan(ich)%bilap2=data_tmp(11,ich) - data_chan(ich)%bilap =data_tmp(12,ich) - end do - do ich=1,header_fix%nchan - do iang=1,header_fix%angord+1 - data_chan(ich)%bifix(iang)=data_tmp(12+iang,ich) - end do - data_chan(ich)%bisst = data_tmp(12+header_fix%angord+2,ich) - end do - elseif ( header_fix%iversion < iversion_radiag_3 .and. header_fix%iversion >= iversion_radiag_2 ) then - do ich=1,header_fix%nchan - data_chan(ich)%bicons=data_tmp(9,ich) - data_chan(ich)%biang =data_tmp(10,ich) - data_chan(ich)%biclw =data_tmp(11,ich) - data_chan(ich)%bilap2=data_tmp(12,ich) - data_chan(ich)%bilap =data_tmp(13,ich) - end do - do ich=1,header_fix%nchan - do iang=1,header_fix%angord+1 - data_chan(ich)%bifix(iang)=data_tmp(13+iang,ich) - end do - data_chan(ich)%bisst = data_tmp(13+header_fix%angord+2,ich) - end do - elseif ( header_fix%iversion < iversion_radiag_4 .and. header_fix%iversion >= iversion_radiag_3 ) then - do ich=1,header_fix%nchan - data_chan(ich)%bicons=data_tmp(9,ich) - data_chan(ich)%biang =data_tmp(10,ich) - data_chan(ich)%biclw =data_tmp(11,ich) - data_chan(ich)%bilap2=data_tmp(12,ich) - data_chan(ich)%bilap =data_tmp(13,ich) - data_chan(ich)%bicos =data_tmp(14,ich) ! 1st bias correction term node*cos(lat) for SSMIS - data_chan(ich)%bisin =data_tmp(15,ich) ! 2nd bias correction term sin(lat) for SSMI - end do - do ich=1,header_fix%nchan - do iang=1,header_fix%angord+1 - data_chan(ich)%bifix(iang)=data_tmp(15+iang,ich) - end do - data_chan(ich)%bisst = data_tmp(15+header_fix%angord+2,ich) - end do - else - do ich=1,header_fix%nchan - data_chan(ich)%bicons=data_tmp(9,ich) - data_chan(ich)%biang =data_tmp(10,ich) - data_chan(ich)%biclw =data_tmp(11,ich) - data_chan(ich)%bilap2=data_tmp(12,ich) - data_chan(ich)%bilap =data_tmp(13,ich) - data_chan(ich)%bicos =data_tmp(14,ich) - data_chan(ich)%bisin =data_tmp(15,ich) - data_chan(ich)%biemis=data_tmp(16,ich) - end do - do ich=1,header_fix%nchan - do iang=1,header_fix%angord+1 - data_chan(ich)%bifix(iang)=data_tmp(16+iang,ich) - end do - data_chan(ich)%bisst = data_tmp(16+header_fix%angord+2,ich) - end do - endif - - if (header_fix%iextra > 0) then - do j=1,header_fix%jextra - do i=1,header_fix%iextra - data_extra(i,j)%extra=extra_tmp(i,j) - end do - end do - endif - - deallocate(data_tmp, fix_tmp) - if (header_fix%iextra > 0) deallocate(extra_tmp) - -end subroutine read_radiag_data - -end module read_diag - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radbcoef.fd/readme b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radbcoef.fd/readme deleted file mode 100644 index a229412533..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radbcoef.fd/readme +++ /dev/null @@ -1,23 +0,0 @@ -Instructions for building radmon_bcoef executable. - - 1) Load the build module appropriate for your Machine: - i.) - WCOSS: - "module use -a ../../modulefiles/wcoss" - THEIA: - "module use -a ../../modulefiles/theia" - ii.) - "module load RadMonBuild" - - 2) Optional: verify all prerequisites are met by typing: - "make check_prereqs" - - 3) Build the executable by typing: - "make" - - 4) Move the executable to the ../../exec directory by typing: - "make install" - - 5) Unload the build module: - "module unload RadMonBuild" - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radbcor.fd/avgsdv.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radbcor.fd/avgsdv.f90 deleted file mode 100755 index 44d1103a97..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radbcor.fd/avgsdv.f90 +++ /dev/null @@ -1,31 +0,0 @@ -subroutine avgsdv(count,sum1,sum2,rmiss) - implicit none - real count,sum1,sum2,rmiss - real avg,sdv,rterm1,rterm2,svar - - if (count>0.) then - rterm1 = 1./count - avg = rterm1*sum1 - if (count>1.) then - rterm2 = 1./(count-1.) - svar = (count*sum2-sum1*sum1)*rterm1*rterm2 - if (svar>0.) then - sdv = sqrt(svar) - else - sdv = rmiss - endif - else - sdv = rmiss - endif - else - count = rmiss - avg = rmiss - sdv = rmiss - endif - - sum1=avg - sum2=sdv - - return -end subroutine avgsdv - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radbcor.fd/bcor.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radbcor.fd/bcor.f90 deleted file mode 100755 index b03bdfc9dd..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radbcor.fd/bcor.f90 +++ /dev/null @@ -1,562 +0,0 @@ -! -! bcor.f90 -! -program bcor - use read_diag - - implicit none - integer ntype,mregion,surf_nregion,max_surf_region - parameter (ntype=30,mregion=25,max_surf_region=5) - integer iglobal, iland, iwater, isnowice, imixed - parameter( iglobal=1, iland=2, iwater=3, isnowice=4, imixed=5 ) - - character(10),dimension(ntype):: ftype - character(20) satname,stringd,satsis,mod_satname - character(10) dum,satype,dplat - character(40) string,diag_rad,data_file,ctl_file - character(40),dimension(max_surf_region):: region - character(10) suffix - - integer luname,lungrd,lunctl,lndiag - integer iyy,imm,idd,ihh,idhh,incr,iread,iflag - integer n_chan,j,idsat,i,k,ii,nsub - integer,dimension(mregion):: jsub - integer,allocatable,dimension(:):: io_chan,nu_chan - integer npred_radiag,angord - - real pen,rread - real weight,rlat,rlon,rmiss,obs,biascor,obsges,obsgesnbc,rterm - real,dimension(2):: cor_total,cor_fixang,cor_lapse,cor_lapse2,& - cor_const,cor_scangl,cor_clw,cor_cos_ssmis,cor_sin_ssmis,& - cor_emiss,cor_ordang4,cor_ordang3,cor_ordang2,cor_ordang1 - - real,dimension(max_surf_region):: rlatmin,rlatmax,rlonmin,rlonmax - - real,allocatable,dimension(:):: wavenumbr - real,allocatable,dimension(:,:):: count,error,use,frequency,penalty - real,allocatable,dimension(:,:,:):: total_cor,fixang_cor,lapse_cor,& - lapse2_cor,const_cor,scangl_cor,clw_cor,cos_ssmis_cor,sin_ssmis_cor,& - emiss_cor,ordang4_cor,ordang3_cor,ordang2_cor,ordang1_cor - - logical no_obs - -! Variables for reading satellite data - type(diag_header_fix_list ) :: header_fix - type(diag_header_chan_list),allocatable :: header_chan(:) - type(diag_data_name_list ) :: data_name - type(diag_data_fix_list ) :: data_fix - type(diag_data_chan_list ),allocatable :: data_chan(:) - type(diag_data_extra_list) ,allocatable :: data_extra(:,:) - - integer nsnow, nland, nwater, nice, nmixed, ntotal - integer nnsnow, nnland, nnwater, nnmixed, nntotal - -! Namelist with defaults - logical :: retrieval = .false. - integer :: nchanl = 19 - integer :: imkctl = 1 - integer :: imkdata = 1 - character(3) :: gesanl = 'ges' - integer :: little_endian = 1 - character(3) :: rad_area = 'glb' - namelist /input/ satname,iyy,imm,idd,ihh,idhh,incr,nchanl,& - suffix,imkctl,imkdata,retrieval,gesanl,little_endian,rad_area - - data luname,lungrd,lunctl,lndiag / 5, 51, 52, 21 / - data rmiss /-999./ - data stringd / '.%y4%m2%d2%h2' / - data ftype / 'count', 'penalty', & - 'avgtotal', 'avgfixang', 'avglapse', 'avglapse2', & - 'avgconst', 'avgscangl', 'avgclw', & - 'avgcos', 'avgsin', 'avgemiss', 'avgordang4', & - 'avgordang3', 'avgordang2', 'avgordang1', & - 'sdvtotal', 'sdvfixang', 'sdvlapse', 'sdvlapse2', & - 'sdvconst', 'sdvscangl', 'sdvclw', & - 'sdvcos', 'sdvsin', 'sdvemiss', 'sdvordang4',& - 'sdvordang3', 'sdvordang2', 'sdvordang1' / - data region / 'global', 'land', 'water', 'ice/snow', 'mixed'/ - data rlonmin / -180., -180., -180., -180., -180./ - data rlonmax / 180., 180., 180., 180., 180./ - data rlatmin / -90., -90., -90., -90., -90./ - data rlatmax / 90., 90., 90., 90., 90./ - - - -!************************************************************************ -! -! Initialize variables - iread=0 - npred_radiag = 12 - -! Read namelist input - read(luname,input) - write(6,input) - write(6,*)'gesanl = ', gesanl - write(6,*)'rad_area = ', rad_area - write(6,*)' ' - - surf_nregion = 5 - if ( trim(rad_area) == 'rgn' ) then - surf_nregion = 1 - endif - - write(6,*)'surf_nregion = ', surf_nregion - - -! Ensure number of requested regions does not exceed specified upper limit - if (surf_nregion>mregion) then - write(6,*)'***ERROR*** too many regions specified' - write(6,*)' maximum allowed: mregion=',mregion - write(6,*)' user requested: surf_nregion=',surf_nregion - call errexit(91) - endif - - -! Create filenames for diagnostic input, binary output file - write(stringd,100) iyy,imm,idd,ihh -100 format('.',i4.4,3i2.2) - - if ( trim(gesanl) == 'ges' ) then - diag_rad = trim(satname) - data_file= trim(satname) // trim(stringd) // '.ieee_d' - ctl_file = trim(satname) // '.ctl' - else - diag_rad = trim(satname) // '_anl' - data_file= trim(satname) // '_anl' // trim(stringd) // '.ieee_d' - ctl_file = trim(satname) // '_anl.ctl' - endif - - write(6,*)'diag_rad =',diag_rad - write(6,*)'data_file=',data_file - write(6,*)'ctl_file =',ctl_file - write(6,*)'suffix =',suffix - - -! Open unit to diagnostic file. Read portion of header to -! see if file exists - open(lndiag,file=diag_rad,form='unformatted') - read(lndiag,err=900,end=900) dum - rewind lndiag - -! File exists. Read header - write(6,*)'call read_diag_header' - call read_radiag_header( lndiag, npred_radiag, retrieval, header_fix,& - header_chan, data_name, iflag ) - if( iflag/=0 ) then - write(6,*)'***ERROR*** problem reading diag file header, iflag=',iflag - call errexit(91) - endif - -! Extract observation type, satellite id, and number of channels - satype = header_fix%obstype - satsis = header_fix%isis - dplat = header_fix%id - n_chan = header_fix%nchan - angord = header_fix%angord - - write(6,*)'satype,dplat,n_chan,angord=',satype,' ',dplat,n_chan,angord - - string = trim(satype)//'_'//trim(dplat) - write(6,*)'string,satname=',string,' ',satname - if ( trim(string) /= trim(satname) ) then - write(6,*)'***ERROR*** inconsistent instrument types' - write(6,*)' satname,string =',satname,' ',string - call errexit(92) - endif - - -! Allocate arrays to hold observational information - write(6,*)' ' - write(6,*)'allocate arrays' - allocate (io_chan(n_chan), nu_chan(n_chan), wavenumbr(n_chan)) - allocate (total_cor(n_chan,mregion,2), fixang_cor(n_chan,mregion,2), & - lapse_cor(n_chan,mregion,2), lapse2_cor(n_chan,mregion,2), & - const_cor(n_chan,mregion,2), scangl_cor(n_chan,mregion,2), & - clw_cor(n_chan,mregion,2), cos_ssmis_cor(n_chan,mregion,2), & - sin_ssmis_cor(n_chan,mregion,2), emiss_cor(n_chan,mregion,2), & - ordang4_cor(n_chan,mregion,2), ordang3_cor(n_chan,mregion,2), & - ordang2_cor(n_chan,mregion,2), ordang1_cor(n_chan,mregion,2), & - count(n_chan,mregion), penalty(n_chan,mregion), & - error(n_chan,mregion), use(n_chan,mregion), & - frequency(n_chan,mregion)) - -! Zero accumulator arrays - do ii=1,2 - do k=1,mregion - do j=1,n_chan - if (ii==1) then - count(j,k) = 0.0 - penalty(j,k) = 0.0 - endif - total_cor(j,k,ii) = 0.0 - fixang_cor(j,k,ii) = 0.0 - lapse_cor(j,k,ii) = 0.0 - lapse2_cor(j,k,ii) = 0.0 - const_cor(j,k,ii) = 0.0 - scangl_cor(j,k,ii) = 0.0 - clw_cor(j,k,ii) = 0.0 - cos_ssmis_cor(j,k,ii) = 0.0 - sin_ssmis_cor(j,k,ii) = 0.0 - emiss_cor(j,k,ii) = 0.0 - ordang4_cor(j,k,ii) = 0.0 - ordang3_cor(j,k,ii) = 0.0 - ordang2_cor(j,k,ii) = 0.0 - ordang1_cor(j,k,ii) = 0.0 - end do - end do - end do - - -! Extract satinfo relative index - do j=1,n_chan - nu_chan(j) = real( header_chan(j)%nuchan, 4 ) - io_chan(j) = real( header_chan(j)%iochan, 4 ) - wavenumbr(j) = real( header_chan(j)%wave, 4 ) - end do - do k=1,mregion - do j=1,n_chan - error(j,k) = real( header_chan(j)%varch, 4) - use(j,k) = real( header_chan(j)%iuse, 4 ) - frequency(j,k) = real( header_chan(j)%freq, 4) - end do - end do - - -! Create GrADS control file - if ( imkctl == 1 ) then - write(6,*)'call create_ctl_bcor' - - if ( trim(gesanl) == 'ges' ) then - mod_satname = trim(satname) - else - mod_satname = trim(satname) // '_anl' - endif - - - call create_ctl_bcor(ntype,ftype,n_chan,iyy,imm,idd,ihh,idhh,& - incr,ctl_file,lunctl,rmiss,mod_satname,satype,dplat,surf_nregion,& - region,rlonmin,rlonmax,rlatmin,rlatmax,nu_chan,use(1,1),error(1,1),& - frequency(1,1),wavenumbr,little_endian) - - endif - - nwater = 0; nnwater = 0 - nland = 0; nnland = 0 - nsnow = 0; nnsnow = 0 - nice = 0 - nmixed = 0; nnmixed = 0 - ntotal = 0 - -! Loop to read entries in diagnostic file - if ( imkdata == 1 ) then - iflag = 0 - loopd: do while (iflag == 0) - -! Read a record. If read flag, iflag does not equal zero, exit loopd - call read_radiag_data( lndiag, header_fix, retrieval, data_fix, data_chan,& - data_extra, iflag ) - if( iflag /= 0 ) exit loopd - iread=iread+1 - -! Extract obervation location and mpi weight. Convert (0-360) lon to (-180,180) - rlat = data_fix%lat - rlon = data_fix%lon - if (rlon>180.) rlon = rlon - 360. - rread = rread + 1.0 - - ntotal = ntotal + 1 - jsub(1)= iglobal - nsub = 1 - - if ( surf_nregion > 1 ) then - if ( data_fix%water_frac > 0.99 ) then - nwater = nwater + 1 - else if ( data_fix%land_frac > 0.99 ) then - nland = nland + 1 - else if ( data_fix%snow_frac > 0.99 ) then - nsnow = nsnow + 1 - else if ( data_fix%ice_frac > 0.99 ) then - nice = nice + 1 - else - nmixed = nmixed + 1 - end if - - - -! Detemine into which subdomains the observation falls. -! These are now based on surface type, not geography. All -! obs match global (surf_region 1). -! - ii=0; -!jsub=0; - if ( data_fix%land_frac > 0.99 ) then - jsub(2)=iland - nsub=2 - nnland=nnland+1 - else if ( data_fix%water_frac > 0.99 ) then - jsub(2)=iwater - nsub=2 - nnwater=nnwater+1 - else if (( data_fix%snow_frac > 0.99 ) .OR. ( data_fix%ice_frac > 0.99 )) then - jsub(2)=isnowice - nsub=2 - nnsnow=nnsnow+1 - else - jsub(2)=imixed - nsub=2 - nnmixed=nnmixed+1 - write(6,*)'data_fix%land_frac,water,snow,ice = ',data_fix%land_frac, data_fix%water_frac, data_fix%snow_frac, data_fix%ice_frac - end if - end if - - -! Channel loop - do j = 1, n_chan - -! If observation was assimilated, accumulate sums in appropriate regions - if (data_chan(j)%errinv > 1.e-6) then -! pen = data_chan(j)%errinv*(data_chan(j)%omgbc)**2 - pen = (data_chan(j)%errinv*(data_chan(j)%omgbc))**2 - cor_total(1) = (data_chan(j)%omgnbc - data_chan(j)%omgbc) - cor_fixang(1) = data_chan(j)%bifix(angord+1) - cor_lapse(1) = data_chan(j)%bilap - cor_lapse2(1) = data_chan(j)%bilap2 - cor_const(1) = data_chan(j)%bicons - cor_scangl(1) = data_chan(j)%biang - cor_clw(1) = data_chan(j)%biclw - cor_cos_ssmis(1) = data_chan(j)%bicos - cor_sin_ssmis(1) = data_chan(j)%bisin - cor_emiss(1) = data_chan(j)%biemis - if (angord >= 4 ) then - cor_ordang4(1) = data_chan(j)%bifix(1) - cor_ordang3(1) = data_chan(j)%bifix(2) - cor_ordang2(1) = data_chan(j)%bifix(3) - cor_ordang1(1) = data_chan(j)%bifix(4) - else - cor_ordang4(1) = 0.0 - cor_ordang3(1) = 0.0 - cor_ordang2(1) = 0.0 - cor_ordang1(1) = 0.0 - endif -! do i=1,angord -! cor_ordang4 -! write(string,'(i2.2)') header_fix%angord-i+1 -! data_name%chn(15+i)= 'bifix' // string -! end do - - - cor_total(2) = (data_chan(j)%omgnbc - data_chan(j)%omgbc)**2 - cor_fixang(2) = (data_chan(j)%bifix(angord+1))**2 - cor_lapse(2) = (data_chan(j)%bilap)**2 - cor_lapse2(2) = (data_chan(j)%bilap2)**2 - cor_const(2) = (data_chan(j)%bicons)**2 - cor_scangl(2) = (data_chan(j)%biang)**2 - cor_clw(2) = (data_chan(j)%biclw)**2 - cor_cos_ssmis(2) = data_chan(j)%bicos**2 - cor_sin_ssmis(2) = data_chan(j)%bisin**2 - cor_emiss(2) = data_chan(j)%biemis**2 - if (angord >= 4 ) then - cor_ordang4(1) = data_chan(j)%bifix(1)**2 - cor_ordang3(1) = data_chan(j)%bifix(2)**2 - cor_ordang2(1) = data_chan(j)%bifix(3)**2 - cor_ordang1(1) = data_chan(j)%bifix(4)**2 - else - cor_ordang4(2) = 0.0 - cor_ordang3(2) = 0.0 - cor_ordang2(2) = 0.0 - cor_ordang1(2) = 0.0 - end if - - do i=1,nsub - k=jsub(i) - count(j,k) = count(j,k) +1.0 - penalty(j,k) = penalty(j,k) + pen - - do ii=1,2 - total_cor(j,k,ii) = total_cor(j,k,ii) + cor_total(ii) - fixang_cor(j,k,ii) = fixang_cor(j,k,ii) + cor_fixang(ii) - lapse_cor(j,k,ii) = lapse_cor(j,k,ii) + cor_lapse(ii) - lapse2_cor(j,k,ii) = lapse2_cor(j,k,ii) + cor_lapse2(ii) - const_cor(j,k,ii) = const_cor(j,k,ii) + cor_const(ii) - scangl_cor(j,k,ii) = scangl_cor(j,k,ii) + cor_scangl(ii) - clw_cor(j,k,ii) = clw_cor(j,k,ii) + cor_clw(ii) - cos_ssmis_cor(j,k,ii) = cos_ssmis_cor(j,k,ii) + cor_cos_ssmis(ii) - sin_ssmis_cor(j,k,ii) = sin_ssmis_cor(j,k,ii) + cor_sin_ssmis(ii) - emiss_cor(j,k,ii) = emiss_cor(j,k,ii) + cor_emiss(ii) - ordang4_cor(j,k,ii) = ordang4_cor(j,k,ii) + cor_ordang4(ii) - ordang3_cor(j,k,ii) = ordang3_cor(j,k,ii) + cor_ordang3(ii) - ordang2_cor(j,k,ii) = ordang2_cor(j,k,ii) + cor_ordang2(ii) - ordang1_cor(j,k,ii) = ordang1_cor(j,k,ii) + cor_ordang1(ii) - end do - - end do - endif - - enddo ! channel loop - -! End of loop over diagnostic file - enddo loopd - close(lndiag) - write(6,*)' ' - write(6,*)'read in ',iread,' obs ',rread - write(6,*)' ' - - write(6,*)'nwater, nland, nice, nsnow, nmixed, ntotal = ', nwater, nland, nice, nsnow, nmixed, ntotal - nntotal=nnwater+nnland+nnsnow+nnmixed - write(6,*)'nnwater, nnland, nnsnow, nnmixed, nntotal = ', nnwater, nnland, nnsnow, nnmixed, nntotal - -! Compute average and standard deviation - do k=1,surf_nregion - do j=1,n_chan - call avgsdv(count(j,k),total_cor(j,k,1), total_cor(j,k,2), rmiss) - call avgsdv(count(j,k),fixang_cor(j,k,1), fixang_cor(j,k,2), rmiss) - call avgsdv(count(j,k),lapse_cor(j,k,1), lapse_cor(j,k,2), rmiss) - call avgsdv(count(j,k),lapse2_cor(j,k,1), lapse2_cor(j,k,2), rmiss) - call avgsdv(count(j,k),const_cor(j,k,1), const_cor(j,k,2), rmiss) - call avgsdv(count(j,k),scangl_cor(j,k,1), scangl_cor(j,k,2), rmiss) - call avgsdv(count(j,k),clw_cor(j,k,1), clw_cor(j,k,2), rmiss) - call avgsdv(count(j,k),cos_ssmis_cor(j,k,1), cos_ssmis_cor(j,k,2), rmiss) - call avgsdv(count(j,k),sin_ssmis_cor(j,k,1), sin_ssmis_cor(j,k,2), rmiss) - call avgsdv(count(j,k),emiss_cor(j,k,1), emiss_cor(j,k,2), rmiss) - call avgsdv(count(j,k),ordang4_cor(j,k,1), ordang4_cor(j,k,2), rmiss) - call avgsdv(count(j,k),ordang3_cor(j,k,1), ordang3_cor(j,k,2), rmiss) - call avgsdv(count(j,k),ordang2_cor(j,k,1), ordang2_cor(j,k,2), rmiss) - call avgsdv(count(j,k),ordang1_cor(j,k,1), ordang1_cor(j,k,2), rmiss) - - if (count(j,k)>0) then - penalty(j,k)=penalty(j,k)/count(j,k) - else - count(j,k)=rmiss - penalty(j,k)=rmiss - endif - end do - end do - -! Write output to binary output file - write(6,*)' ' - open(lungrd,file=data_file,form='unformatted') - write(lungrd) ((count(j,k),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((penalty(j,k),j=1,n_chan),k=1,surf_nregion) - do ii=1,2 - write(lungrd) ((total_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((fixang_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((lapse_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((lapse2_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((const_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((scangl_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((clw_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((cos_ssmis_cor(j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((sin_ssmis_cor(j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((emiss_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((ordang4_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((ordang3_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((ordang2_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((ordang1_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - end do - write(6,*)'write output to lungrd=',lungrd,', file=',trim(data_file) - close(lungrd) - endif - -! Deallocate arrays - write(6,*)' ' - write(6,*)'deallocate arrays' - if(allocated(io_chan)) deallocate (io_chan) - if(allocated(nu_chan)) deallocate (nu_chan) - if(allocated(wavenumbr)) deallocate (wavenumbr) - if(allocated(total_cor)) deallocate (total_cor) - if(allocated(fixang_cor)) deallocate (fixang_cor) - if(allocated(lapse_cor)) deallocate (lapse_cor) - if(allocated(lapse2_cor)) deallocate (lapse2_cor) - if(allocated(const_cor)) deallocate (const_cor) - if(allocated(scangl_cor)) deallocate (scangl_cor) - if(allocated(clw_cor)) deallocate (clw_cor) - if(allocated(cos_ssmis_cor)) deallocate (cos_ssmis_cor) - if(allocated(sin_ssmis_cor)) deallocate (sin_ssmis_cor) - if(allocated(emiss_cor)) deallocate (emiss_cor) - if(allocated(ordang4_cor)) deallocate (ordang4_cor) - if(allocated(ordang3_cor)) deallocate (ordang3_cor) - if(allocated(ordang2_cor)) deallocate (ordang2_cor) - if(allocated(ordang1_cor)) deallocate (ordang1_cor) - if(allocated(count)) deallocate (count) - if(allocated(penalty)) deallocate (penalty) - if(allocated(error)) deallocate (error) - if(allocated(use)) deallocate (use) - if(allocated(frequency)) deallocate (frequency) - - -! deallocate(io_chan,nu_chan,wavenumbr,total_cor,fixang_cor,lapse_cor,& -! lapse2_cor,const_cor,scangl_cor,clw_cor,count,penalty,error,use,& -! frequency) - - write(6,*)'deallocated arrays' - goto 950 - -! Jump to here if eof or error reading diagnostic file. -900 continue - write(6,*)'***PROBLEM reading diagnostic file. diag_rad=',diag_rad - close(lndiag) - - n_chan=nchanl - if (n_chan<=0) then - write(6,*)'***ERROR*** invalid nchanl=',nchanl,' STOP program' - call errexit(93) - endif - - write(6,*)'load missing value ',rmiss,' into output arrays. ',& - surf_nregion,n_chan - allocate(count(n_chan,surf_nregion),penalty(n_chan,surf_nregion)) - allocate(total_cor(n_chan,mregion,2), fixang_cor(n_chan,mregion,2), & - lapse_cor(n_chan,mregion,2), lapse2_cor(n_chan,mregion,2), & - const_cor(n_chan,mregion,2), scangl_cor(n_chan,mregion,2), & - clw_cor(n_chan,mregion,2)) - - write(6,*)'load missing value ',rmiss,' into output arrays' - do ii=1,2 - do k=1,surf_nregion - do j=1,n_chan - if (ii==1) then - count(j,k) =rmiss - penalty(j,k)=rmiss - endif - total_cor(j,k,ii) =rmiss - fixang_cor(j,k,ii)=rmiss - lapse_cor(j,k,ii) =rmiss - lapse2_cor(j,k,ii)=rmiss - const_cor(j,k,ii) =rmiss - scangl_cor(j,k,ii)=rmiss - clw_cor(j,k,ii) =rmiss - end do - end do - end do - - if ( imkdata == 1 ) then - open(lungrd,file=data_file,form='unformatted') - write(lungrd) ((count(j,k),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((penalty(j,k),j=1,n_chan),k=1,surf_nregion) - do ii=1,2 - write(lungrd) ((total_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((fixang_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((lapse_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((lapse2_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((const_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((scangl_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((clw_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((cos_ssmis_cor(j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((sin_ssmis_cor(j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((emiss_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((ordang4_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((ordang3_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((ordang2_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((ordang1_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - end do - write(6,*)'write output to lungrd=',lungrd,', file=',trim(data_file) - close(lungrd) - endif - deallocate(count,penalty,total_cor,fixang_cor,lapse_cor,lapse2_cor,& - const_cor,scangl_cor,clw_cor) - -! End of program -950 continue - write(6,*) 'exiting program bcor' - stop -end program bcor diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radbcor.fd/create_ctl_bcor.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radbcor.fd/create_ctl_bcor.f90 deleted file mode 100755 index e312247953..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radbcor.fd/create_ctl_bcor.f90 +++ /dev/null @@ -1,163 +0,0 @@ -subroutine create_ctl_bcor(ntype,ftype,n_chan,iyy,imm,idd,ihh,idhh,& - incr,ctl_file,lunctl,rmiss,satname,satype,dplat,nregion,& - region,rlonmin,rlonmax,rlatmin,rlatmax,nu_chan,use,error,& - frequency,wavenumbr,little_endian) - - implicit none - - integer ntype - - character(2) cword - character(3),dimension(12):: mon - character(3):: clatmin,clatmax - character(4):: clonmin,clonmax - character(10),dimension(ntype):: ftype - character(13) stringd - character(20) satname - character(10) satype,dplat - character(40) ctl_file,grad_file - character(80) string - character(40),dimension(nregion):: region - character(80),dimension(nregion):: stringr - - integer idsat,nregion,iuse,little_endian - integer lunctl,iyy,imm,idd,ihh,j,i,n_chan,idhh,incr - integer iyy2,imm2,idd2,ihh2,ntime - integer,dimension(8):: ida,jda - integer,dimension(n_chan):: nu_chan - - real rmiss,wavelength - real,dimension(5):: fha - real,dimension(n_chan):: error,use,frequency,wavenumbr - real,dimension(nregion):: rlonmin,rlonmax,rlatmin,rlatmax - - data stringd / '.%y4%m2%d2%h2' / - data mon / 'jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', & - 'aug', 'sep', 'oct', 'nov', 'dec' / - -!************************************************************************** -! Create date for tdef based on given date and hour offset - fha=0.0; ida=0; jda=0; ntime=0 - iyy2=iyy; imm2=imm; idd2=idd; ihh2=ihh - if (idhh/=0) then - ntime = abs(idhh)/incr - fha(2)=idhh - ida(1)=iyy - ida(2)=imm - ida(3)=idd - ida(4)=0 - ida(5)=ihh - call w3movdat(fha,ida,jda) - iyy2=jda(1) - imm2=jda(2) - idd2=jda(3) - ihh2=jda(5) - endif - ntime=ntime+1 - -! Open unit to GrADS control file - open(lunctl,file=ctl_file,form='formatted') - -!******************************************************************* -! Construct the region strings if this is for a global source, -! which is defined as nregion > 1. -! - if (nregion > 1) then - - do i=1,nregion - if (rlatmin(i)>0.) then - write(clatmin,10) int(rlatmin(i)) - else - write(clatmin,20) abs(int(rlatmin(i))) - endif - if (rlatmax(i)>0.) then - write(clatmax,10) int(rlatmax(i)) - else - write(clatmax,20) abs(int(rlatmax(i))) - endif - if (rlonmin(i)>0.) then - write(clonmin,30) int(rlonmin(i)) - else - write(clonmin,40) abs(int(rlonmin(i))) - endif - if (rlonmax(i)>0.) then - write(clonmax,30) int(rlonmax(i)) - else - write(clonmax,40) abs(int(rlonmax(i))) - endif - stringr(i) = trim(region(i)) // ' (' // & - trim(clonmin) // '-' // trim(clonmax) // ', ' // & - trim(clatmin) // '-' // trim(clatmax) // ')' - end do - endif -10 format(i2,'N') -20 format(i2,'S') -30 format(i3,'E') -40 format(i3,'W') - -! Write header information - grad_file = trim(satname) // stringd // '.ieee_d' - write(lunctl,100) grad_file - if ( little_endian == 1 ) then - write(lunctl,112) - else - write(lunctl,110) - endif - write(lunctl,120) rmiss - write(lunctl,130) adjustl(satype),dplat,n_chan - write(lunctl,132) - do i=1,n_chan - iuse = nint(use(i)) - wavelength = 10000./wavenumbr(i) - write(lunctl,134) i,nu_chan(i),iuse,error(i),wavelength,frequency(i) - end do - write(lunctl,136) - - if (nregion > 1) then - do i=1,nregion - write(cword,'(i2)') i - string = '* region=' // cword // ' ' // trim(stringr(i)) - write(lunctl,138) string - end do - endif - - write(lunctl,140) n_chan - write(lunctl,150) nregion - write(lunctl,160) - write(lunctl,170) ntime,ihh2,idd2,mon(imm2),iyy2 - write(lunctl,180) ntype - -100 format('dset ^',a40) -110 format('options template big_endian sequential') -112 format('options template little_endian sequential') -120 format('undef ',f5.0) -130 format('title ',a10,1x,a10,1x,i4) -132 format('*XDEF is channel number') -134 format('* x= ',i4,', channel= ',i4,' , iuse= ',i2,' , error= ',f8.3,& - ' , wlth= ',f9.2,' , freq= ',f9.2) -136 format('*YDEF is geographic region') -138 format(a80) -140 format('xdef ',i4,' linear 1.0 1.0') -150 format('ydef ',i2,' linear 1.0 1.0') -160 format('zdef 1 linear 1.0 1.0') -170 format('tdef ',i4,' linear ',i2.2,'Z',i2.2,a3,i4.4,' 06hr') -180 format('vars ',i7) - -! Write data portion of GraDS control file - do i=1,ntype - string = trim(ftype(i)) - write(lunctl,190) adjustl(string),trim(ftype(i)) -190 format(a10,' 0 0 ',a10) - end do - -! Write trminating "endvars" record - write(lunctl,200) -200 format('endvars') - - -! Close ctl file - close(lunctl) - -! Return - return -end subroutine create_ctl_bcor diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radbcor.fd/makefile b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radbcor.fd/makefile deleted file mode 100755 index d5fd1795ce..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radbcor.fd/makefile +++ /dev/null @@ -1,52 +0,0 @@ -# ***************************************************************** -# makefile.bcor -# -# Make the radmon_bcor executable. -# -# ***************************************************************** - -BINDIR = ../../exec - -LIBS = $(W3NCO_LIB4) - -OBJS = kinds.o read_diag.o bcor.o avgsdv.o create_ctl_bcor.o - -# -# ***************************************************************** -# - -CMD = radmon_bcor - -all: $(CMD) - -clean: - rm -f *.o - rm -f *.mod - rm -f radmon_bcor - -check_prereqs: - /nwprod/spa_util/check_libs.bash $(LIBS) - -install: - cp -f $(CMD) $(BINDIR)/ - -debug: FFLAGS = $(D_FFLAGS) -debug: $(CMD) - -$(CMD): $(OBJS) - $(CF) $(FFLAGS) $(LDFLAGS) -o $(@) $(OBJS) $(LIBS) - -read_diag.o : read_diag.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -bcor.o : bcor.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -avgsdv.o : avgsdv.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -create_ctl_bcor.o : create_ctl_bcor.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -kinds.o : kinds.F90 - $(CF) $(FFLAGS) -c $(*).F90 diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radbcor.fd/read_diag.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radbcor.fd/read_diag.f90 deleted file mode 100755 index 7a4d6cdc49..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radbcor.fd/read_diag.f90 +++ /dev/null @@ -1,659 +0,0 @@ -!$$$ subprogram documentation block -! . . . . -! subprogram: read_raddiag read rad diag file -! prgmmr: tahara org: np20 date: 2003-01-01 -! -! abstract: This module contains code to process radiance -! diagnostic files. The module defines structures -! to contain information from the radiance -! diagnostic files and then provides two routines -! to access contents of the file. -! -! program history log: -! 2005-07-22 treadon - add this doc block -! 2010-10-05 treadon - refactor code to GSI standard -! 2010-10-08 zhu - use data_tmp to handle various npred values -! 2011-02-22 kleist - changes related to memory allocate/deallocate -! 2011-04-08 li - add tref, dtw, dtc to diag_data_fix_list, add tb_tz to diag_data_chan_list -! - correspondingly, change ireal_radiag (26 -> 30) and ipchan_radiag (7 -> 8) -! 2011-07-24 safford - make structure size for reading data_fix data version dependent -! 2013-11-21 todling - revisit how versions are set (add set/get_radiag) -! 2014-01-27 todling - add ob sensitivity index -! -! contains -! read_radiag_header - read radiance diagnostic file header -! read_radiag_data - read radiance diagnostic file data -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ - -module read_diag - - use kinds, only: i_kind,r_single - implicit none - -! Declare public and private - private - - public :: diag_header_fix_list - public :: diag_header_chan_list - public :: diag_data_name_list - public :: diag_data_fix_list - public :: diag_data_chan_list - public :: diag_data_extra_list - public :: read_radiag_header - public :: read_radiag_data -! public :: iversion_radiag -! public :: iversion_radiag_1 -! public :: iversion_radiag_2 -! public :: iversion_radiag_3 -! public :: iversion_radiag_4 - public :: ireal_radiag - public :: ipchan_radiag - public :: set_radiag - public :: get_radiag - - interface set_radiag - module procedure set_radiag_int_ ! internal procedure for integers - end interface - interface get_radiag - module procedure get_radiag_int_ ! internal procedure for integers - end interface - - integer(i_kind),parameter :: ireal_radiag = 30 ! number of real entries per spot in radiance diagnostic file - integer(i_kind),parameter :: ireal_old_radiag = 26 ! number of real entries per spot in versions older than iversion_radiag_2 - integer(i_kind),parameter :: ipchan_radiag = 8 ! number of entries per channel per spot in radiance diagnostic file - -! Declare structures for radiance diagnostic file information - type diag_header_fix_list - character(len=20) :: isis ! sat and sensor type - character(len=10) :: id ! sat type - character(len=10) :: obstype ! observation type - integer(i_kind) :: jiter ! outer loop counter - integer(i_kind) :: nchan ! number of channels in the sensor - integer(i_kind) :: npred ! number of updating bias correction predictors - integer(i_kind) :: idate ! time (yyyymmddhh) - integer(i_kind) :: ireal ! # of real elements in the fix part of a data record - integer(i_kind) :: ipchan ! # of elements for each channel except for bias correction terms - integer(i_kind) :: iextra ! # of extra elements for each channel - integer(i_kind) :: jextra ! # of extra elements - integer(i_kind) :: idiag ! first dimension of diag_data_chan - integer(i_kind) :: angord ! order of polynomial for adp_anglebc option - integer(i_kind) :: iversion ! radiance diagnostic file version number - integer(i_kind) :: inewpc ! indicator of newpc4pred (1 on, 0 off) - integer(i_kind) :: isens ! sensitivity index - end type diag_header_fix_list - - type diag_data_name_list - character(len=10),dimension(ireal_radiag) :: fix - character(len=10),dimension(:),allocatable :: chn - end type diag_data_name_list - - type diag_header_chan_list - real(r_single) :: freq ! frequency (Hz) - real(r_single) :: polar ! polarization - real(r_single) :: wave ! wave number (cm^-1) - real(r_single) :: varch ! error variance (or SD error?) - real(r_single) :: tlapmean ! mean lapse rate - integer(i_kind):: iuse ! use flag - integer(i_kind):: nuchan ! sensor relative channel number - integer(i_kind):: iochan ! satinfo relative channel number - end type diag_header_chan_list - - type diag_data_fix_list - real(r_single) :: lat ! latitude (deg) - real(r_single) :: lon ! longitude (deg) - real(r_single) :: zsges ! guess elevation at obs location (m) - real(r_single) :: obstime ! observation time relative to analysis - real(r_single) :: senscn_pos ! sensor scan position (integer(i_kind)) - real(r_single) :: satzen_ang ! satellite zenith angle (deg) - real(r_single) :: satazm_ang ! satellite azimuth angle (deg) - real(r_single) :: solzen_ang ! solar zenith angle (deg) - real(r_single) :: solazm_ang ! solar azimumth angle (deg) - real(r_single) :: sungln_ang ! sun glint angle (deg) - real(r_single) :: water_frac ! fractional coverage by water - real(r_single) :: land_frac ! fractional coverage by land - real(r_single) :: ice_frac ! fractional coverage by ice - real(r_single) :: snow_frac ! fractional coverage by snow - real(r_single) :: water_temp ! surface temperature over water (K) - real(r_single) :: land_temp ! surface temperature over land (K) - real(r_single) :: ice_temp ! surface temperature over ice (K) - real(r_single) :: snow_temp ! surface temperature over snow (K) - real(r_single) :: soil_temp ! soil temperature (K) - real(r_single) :: soil_mois ! soil moisture - real(r_single) :: land_type ! land type (integer(i_kind)) - real(r_single) :: veg_frac ! vegetation fraction - real(r_single) :: snow_depth ! snow depth - real(r_single) :: sfc_wndspd ! surface wind speed - real(r_single) :: qcdiag1 ! ir=cloud fraction, mw=cloud liquid water - real(r_single) :: qcdiag2 ! ir=cloud top pressure, mw=total column water - real(r_single) :: tref ! reference temperature (Tr) in NSST - real(r_single) :: dtw ! dt_warm at zob - real(r_single) :: dtc ! dt_cool at zob - real(r_single) :: tz_tr ! d(Tz)/d(Tr) - end type diag_data_fix_list - - type diag_data_chan_list - real(r_single) :: tbobs ! Tb (obs) (K) - real(r_single) :: omgbc ! Tb_(obs) - Tb_(simulated w/ bc) (K) - real(r_single) :: omgnbc ! Tb_(obs) - Tb_(simulated_w/o bc) (K) - real(r_single) :: errinv ! inverse error (K**(-1)) - real(r_single) :: qcmark ! quality control mark - real(r_single) :: emiss ! surface emissivity - real(r_single) :: tlap ! temperature lapse rate - real(r_single) :: tb_tz ! d(Tb)/d(Tz) - real(r_single) :: bicons ! constant bias correction term - real(r_single) :: biang ! scan angle bias correction term - real(r_single) :: biclw ! CLW bias correction term - real(r_single) :: bilap2 ! square lapse rate bias correction term - real(r_single) :: bilap ! lapse rate bias correction term - real(r_single) :: bicos ! node*cos(lat) bias correction term - real(r_single) :: bisin ! sin(lat) bias correction term - real(r_single) :: biemis ! emissivity sensitivity bias correction term - real(r_single),dimension(:),allocatable :: bifix ! angle dependent bias - real(r_single) :: bisst ! SST bias correction term - end type diag_data_chan_list - - type diag_data_extra_list - real(r_single) :: extra ! extra information - end type diag_data_extra_list - - integer(i_kind),save :: iversion_radiag ! Current version (see set routine) - integer(i_kind),parameter:: iversion_radiag_1 = 11104 ! Version when bias-correction entries were modified - integer(i_kind),parameter:: iversion_radiag_2 = 13784 ! Version when NSST entries were added - integer(i_kind),parameter:: iversion_radiag_3 = 19180 ! Version when SSMIS added - integer(i_kind),parameter:: iversion_radiag_4 = 30303 ! Version when emissivity predictor added - - real(r_single),parameter:: rmiss_radiag = -9.9e11_r_single - -contains - -subroutine set_radiag_int_ (what,iv,ier) -character(len=*),intent(in) :: what -integer(i_kind),intent(in) :: iv -integer(i_kind),intent(out):: ier -ier=-1 -if(trim(what)=='version') then - iversion_radiag = iv - ier=0 -endif -end subroutine set_radiag_int_ - -subroutine get_radiag_int_ (what,iv,ier) -character(len=*),intent(in) :: what -integer(i_kind),intent(out):: iv -integer(i_kind),intent(out):: ier -ier=-1 -if(trim(what)=='version') then - iv = iversion_radiag - ier=0 -endif -end subroutine get_radiag_int_ - -subroutine read_radiag_header(ftin,npred_radiag,retrieval,header_fix,header_chan,data_name,iflag,lverbose) -! . . . . -! subprogram: read_diag_header read rad diag header -! prgmmr: tahara org: np20 date: 2003-01-01 -! -! abstract: This routine reads the header record from a radiance -! diagnostic file -! -! program history log: -! 2010-10-05 treadon - add this doc block -! 2011-02-22 kleist - changes related to memory allocation and standard output -! -! input argument list: -! ftin - unit number connected to diagnostic file -! npred_radiag - number of bias correction terms -! retrieval - .true. if sst retrieval -! -! output argument list: -! header_fix - header information structure -! header_chan - channel information structure -! data_name - diag file data names -! iflag - error code -! lverbose - optional flag to turn off default output to standard out -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ - -! Declare passed arguments - integer(i_kind),intent(in) :: ftin - integer(i_kind),intent(in) :: npred_radiag - logical,intent(in) :: retrieval - type(diag_header_fix_list ),intent(out):: header_fix - type(diag_header_chan_list),allocatable :: header_chan(:) - type(diag_data_name_list) :: data_name - integer(i_kind),intent(out) :: iflag - logical,optional,intent(in) :: lverbose - -! Declare local variables - character(len=2):: string - character(len=10):: satid,sentype - character(len=20):: sensat - integer(i_kind) :: i,ich - integer(i_kind):: jiter,nchanl,npred,ianldate,ireal,ipchan,iextra,jextra - integer(i_kind):: idiag,angord,iversion,inewpc,isens - integer(i_kind):: iuse_tmp,nuchan_tmp,iochan_tmp - real(r_single) :: freq_tmp,polar_tmp,wave_tmp,varch_tmp,tlapmean_tmp - logical loutall - - loutall=.true. - if(present(lverbose)) loutall=lverbose - -! Read header (fixed_part). - read(ftin,IOSTAT=iflag) sensat,satid,sentype,jiter,nchanl,npred,ianldate,& - ireal,ipchan,iextra,jextra,idiag,angord,iversion,inewpc,isens - if (iflag/=0) then - rewind(ftin) - read(ftin,IOSTAT=iflag) sensat,satid,sentype,jiter,nchanl,npred,ianldate,& - ireal,ipchan,iextra,jextra,idiag,angord,iversion,inewpc - isens=0 - end if - - if (iflag/=0) then - rewind(ftin) - read(ftin,IOSTAT=iflag) sensat,satid,sentype,jiter,nchanl,npred,ianldate,& - ireal,ipchan,iextra,jextra - idiag=ipchan+npred+1 - angord=0 - iversion=0 - inewpc=0 - isens=0 - if (iflag/=0) then - write(6,*)'READ_RADIAG_HEADER: ***ERROR*** Unknown file format. Cannot read' - return - endif - endif - - header_fix%isis = sensat - header_fix%id = satid - header_fix%obstype = sentype - header_fix%jiter = jiter - header_fix%nchan = nchanl - header_fix%npred = npred - header_fix%idate = ianldate - header_fix%ireal = ireal - header_fix%ipchan = ipchan - header_fix%iextra = iextra - header_fix%jextra = jextra - header_fix%idiag = idiag - header_fix%angord = angord - header_fix%iversion= iversion - header_fix%inewpc = inewpc - header_fix%isens = isens - - if (loutall) then - write(6,*)'READ_RADIAG_HEADER: isis=',header_fix%isis,& - ' nchan=',header_fix%nchan,& - ' npred=',header_fix%npred,& - ' angord=',header_fix%angord,& - ' idiag=',header_fix%idiag,& - ' iversion=',header_fix%iversion,& - ' inewpc=',header_fix%inewpc,& - ' isens=',header_fix%isens - - if ( header_fix%iextra /= 0) & - write(6,*)'READ_RADIAG_HEADER: extra diagnostic information available, ',& - 'iextra=',header_fix%iextra - end if - - if (header_fix%npred /= npred_radiag) & - write(6,*) 'READ_RADIAG_HEADER: **WARNING** header_fix%npred,npred=',& - header_fix%npred,npred_radiag - -! Allocate and initialize as needed - if (allocated(header_chan)) deallocate(header_chan) - if (allocated(data_name%chn)) deallocate(data_name%chn) - - allocate(header_chan( header_fix%nchan)) - allocate(data_name%chn(header_fix%idiag)) - - data_name%fix(1) ='lat ' - data_name%fix(2) ='lon ' - data_name%fix(3) ='zsges ' - data_name%fix(4) ='obstim ' - data_name%fix(5) ='scanpos ' - data_name%fix(6) ='satzen ' - data_name%fix(7) ='satazm ' - data_name%fix(8) ='solzen ' - data_name%fix(9) ='solazm ' - data_name%fix(10)='sungln ' - data_name%fix(11)='fwater ' - data_name%fix(12)='fland ' - data_name%fix(13)='fice ' - data_name%fix(14)='fsnow ' - data_name%fix(15)='twater ' - data_name%fix(16)='tland ' - data_name%fix(17)='tice ' - data_name%fix(18)='tsnow ' - data_name%fix(19)='tsoil ' - data_name%fix(20)='soilmoi ' - data_name%fix(21)='landtyp ' - data_name%fix(22)='vegfrac ' - data_name%fix(23)='snowdep ' - data_name%fix(24)='wndspd ' - data_name%fix(25)='qc1 ' - data_name%fix(26)='qc2 ' - data_name%fix(27)='tref ' - data_name%fix(28)='dtw ' - data_name%fix(29)='dtc ' - data_name%fix(30)='tz_tr ' - - data_name%chn(1)='obs ' - data_name%chn(2)='omgbc ' - data_name%chn(3)='omgnbc ' - data_name%chn(4)='errinv ' - data_name%chn(5)='qcmark ' - data_name%chn(6)='emiss ' - data_name%chn(7)='tlap ' - data_name%chn(8)='tb_tz ' - - if (header_fix%iversion < iversion_radiag_1) then - data_name%chn( 8)= 'bifix ' - data_name%chn( 9)= 'bilap ' - data_name%chn(10)= 'bilap2 ' - data_name%chn(11)= 'bicons ' - data_name%chn(12)= 'biang ' - data_name%chn(13)= 'biclw ' - if (retrieval) data_name%chn(13)= 'bisst ' - elseif ( header_fix%iversion < iversion_radiag_2 .and. header_fix%iversion >= iversion_radiag_1 ) then - data_name%chn( 8)= 'bicons ' - data_name%chn( 9)= 'biang ' - data_name%chn(10)= 'biclw ' - data_name%chn(11)= 'bilap2 ' - data_name%chn(12)= 'bilap ' - do i=1,header_fix%angord - write(string,'(i2.2)') header_fix%angord-i+1 - data_name%chn(12+i)= 'bifix' // string - end do - data_name%chn(12+header_fix%angord+1)= 'bifix ' - data_name%chn(12+header_fix%angord+2)= 'bisst ' - elseif ( header_fix%iversion < iversion_radiag_3 .and. header_fix%iversion >= iversion_radiag_2 ) then - data_name%chn( 9)= 'bicons ' - data_name%chn(10)= 'biang ' - data_name%chn(11)= 'biclw ' - data_name%chn(12)= 'bilap2 ' - data_name%chn(13)= 'bilap ' - do i=1,header_fix%angord - write(string,'(i2.2)') header_fix%angord-i+1 - data_name%chn(13+i)= 'bifix' // string - end do - data_name%chn(13+header_fix%angord+1)= 'bifix ' - data_name%chn(13+header_fix%angord+2)= 'bisst ' - elseif ( header_fix%iversion < iversion_radiag_4 .and. header_fix%iversion >= iversion_radiag_3 ) then - data_name%chn( 9)= 'bicons ' - data_name%chn(10)= 'biang ' - data_name%chn(11)= 'biclw ' - data_name%chn(12)= 'bilap2 ' - data_name%chn(13)= 'bilap ' - data_name%chn(14)= 'bicos ' - data_name%chn(15)= 'bisin ' - do i=1,header_fix%angord - write(string,'(i2.2)') header_fix%angord-i+1 - data_name%chn(15+i)= 'bifix' // string - end do - data_name%chn(15+header_fix%angord+1)= 'bifix ' - data_name%chn(15+header_fix%angord+2)= 'bisst ' - else - data_name%chn( 9)= 'bicons ' - data_name%chn(10)= 'biang ' - data_name%chn(11)= 'biclw ' - data_name%chn(12)= 'bilap2 ' - data_name%chn(13)= 'bilap ' - data_name%chn(14)= 'bicos ' - data_name%chn(15)= 'bisin ' - data_name%chn(16)= 'biemis ' - do i=1,header_fix%angord - write(string,'(i2.2)') header_fix%angord-i+1 - data_name%chn(16+i)= 'bifix' // string - end do - data_name%chn(16+header_fix%angord+1)= 'bifix ' - data_name%chn(16+header_fix%angord+2)= 'bisst ' - endif - -! Read header (channel part) - do ich=1, header_fix%nchan - read(ftin,IOSTAT=iflag) freq_tmp,polar_tmp,wave_tmp,varch_tmp,tlapmean_tmp,iuse_tmp,nuchan_tmp,iochan_tmp - header_chan(ich)%freq = freq_tmp - header_chan(ich)%polar = polar_tmp - header_chan(ich)%wave = wave_tmp - header_chan(ich)%varch = varch_tmp - header_chan(ich)%tlapmean = tlapmean_tmp - header_chan(ich)%iuse = iuse_tmp - header_chan(ich)%nuchan = nuchan_tmp - header_chan(ich)%iochan = iochan_tmp - if (iflag/=0) return - end do - -! Construct array containing menonics for data record entries - - -end subroutine read_radiag_header - -subroutine read_radiag_data(ftin,header_fix,retrieval,data_fix,data_chan,data_extra,iflag ) -! . . . . -! subprogram: read_radiag_dat read rad diag data -! prgmmr: tahara org: np20 date: 2003-01-01 -! -! abstract: This routine reads the data record from a radiance -! diagnostic file -! -! program history log: -! 2010-10-05 treadon - add this doc block -! 2011-02-22 kleist - changes related to memory allocation -! -! input argument list: -! ftin - unit number connected to diagnostic file -! header_fix - header information structure -! -! output argument list: -! data_fix - spot header information structure -! data_chan - spot channel information structure -! data_extra - spot extra information -! iflag - error code -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ - - -! Declare passed arguments - integer(i_kind),intent(in) :: ftin - type(diag_header_fix_list ),intent(in) :: header_fix - logical,intent(in) :: retrieval - type(diag_data_fix_list) ,intent(out):: data_fix - type(diag_data_chan_list) ,allocatable :: data_chan(:) - type(diag_data_extra_list) ,allocatable :: data_extra(:,:) - integer(i_kind),intent(out) :: iflag - - integer(i_kind) :: ich,iang,i,j - real(r_single),dimension(:,:),allocatable :: data_tmp - real(r_single),dimension(:),allocatable :: fix_tmp - real(r_single),dimension(:,:),allocatable :: extra_tmp - -! Allocate arrays as needed - if (allocated(data_chan)) deallocate(data_chan) - allocate(data_chan(header_fix%nchan)) - - do ich=1,header_fix%nchan - if (allocated(data_chan(ich)%bifix)) deallocate(data_chan(ich)%bifix) - allocate(data_chan(ich)%bifix(header_fix%angord+1)) - end do - - if (header_fix%iextra > 0) then - if (allocated(data_extra)) deallocate(data_extra) - allocate(data_extra(header_fix%iextra,header_fix%jextra)) - allocate(extra_tmp(header_fix%iextra,header_fix%jextra)) - end if - -! Allocate arrays to hold data record - allocate(data_tmp(header_fix%idiag,header_fix%nchan)) - - if (header_fix%iversion < iversion_radiag_2) then - allocate( fix_tmp( ireal_old_radiag ) ) - else - allocate( fix_tmp( ireal_radiag ) ) - end if - -! Read data record - - if (header_fix%iextra == 0) then - read(ftin,IOSTAT=iflag) fix_tmp, data_tmp - else - read(ftin,IOSTAT=iflag) fix_tmp, data_tmp, extra_tmp - endif - - -! Transfer fix_tmp record to output structure - data_fix%lat = fix_tmp(1) - data_fix%lon = fix_tmp(2) - data_fix%zsges = fix_tmp(3) - data_fix%obstime = fix_tmp(4) - data_fix%senscn_pos = fix_tmp(5) - data_fix%satzen_ang = fix_tmp(6) - data_fix%satazm_ang = fix_tmp(7) - data_fix%solzen_ang = fix_tmp(8) - data_fix%solazm_ang = fix_tmp(9) - data_fix%sungln_ang = fix_tmp(10) - data_fix%water_frac = fix_tmp(11) - data_fix%land_frac = fix_tmp(12) - data_fix%ice_frac = fix_tmp(13) - data_fix%snow_frac = fix_tmp(14) - data_fix%water_temp = fix_tmp(15) - data_fix%land_temp = fix_tmp(16) - data_fix%ice_temp = fix_tmp(17) - data_fix%snow_temp = fix_tmp(18) - data_fix%soil_temp = fix_tmp(19) - data_fix%soil_mois = fix_tmp(20) - data_fix%land_type = fix_tmp(21) - data_fix%veg_frac = fix_tmp(22) - data_fix%snow_depth = fix_tmp(23) - data_fix%sfc_wndspd = fix_tmp(24) - data_fix%qcdiag1 = fix_tmp(25) - data_fix%qcdiag2 = fix_tmp(26) - - if ( header_fix%iversion <= iversion_radiag_1 ) then - data_fix%tref = rmiss_radiag - data_fix%dtw = rmiss_radiag - data_fix%dtc = rmiss_radiag - data_fix%tz_tr = rmiss_radiag - else - data_fix%tref = fix_tmp(27) - data_fix%dtw = fix_tmp(28) - data_fix%dtc = fix_tmp(29) - data_fix%tz_tr = fix_tmp(30) - end if - - -! Transfer data record to output structure - do ich=1,header_fix%nchan - data_chan(ich)%tbobs =data_tmp(1,ich) - data_chan(ich)%omgbc =data_tmp(2,ich) - data_chan(ich)%omgnbc=data_tmp(3,ich) - data_chan(ich)%errinv=data_tmp(4,ich) - data_chan(ich)%qcmark=data_tmp(5,ich) - data_chan(ich)%emiss =data_tmp(6,ich) - data_chan(ich)%tlap =data_tmp(7,ich) - data_chan(ich)%tb_tz =data_tmp(8,ich) - end do - if (header_fix%iversion < iversion_radiag_1) then - do ich=1,header_fix%nchan - data_chan(ich)%bifix(1)=data_tmp(8,ich) - data_chan(ich)%bilap =data_tmp(9,ich) - data_chan(ich)%bilap2 =data_tmp(10,ich) - data_chan(ich)%bicons =data_tmp(11,ich) - data_chan(ich)%biang =data_tmp(12,ich) - data_chan(ich)%biclw =data_tmp(13,ich) - data_chan(ich)%bisst = rmiss_radiag - if (retrieval) then - data_chan(ich)%biclw =rmiss_radiag - data_chan(ich)%bisst =data_tmp(13,ich) - endif - end do - elseif ( header_fix%iversion < iversion_radiag_2 .and. header_fix%iversion >= iversion_radiag_1 ) then - do ich=1,header_fix%nchan - data_chan(ich)%bicons=data_tmp(8,ich) - data_chan(ich)%biang =data_tmp(9,ich) - data_chan(ich)%biclw =data_tmp(10,ich) - data_chan(ich)%bilap2=data_tmp(11,ich) - data_chan(ich)%bilap =data_tmp(12,ich) - end do - do ich=1,header_fix%nchan - do iang=1,header_fix%angord+1 - data_chan(ich)%bifix(iang)=data_tmp(12+iang,ich) - end do - data_chan(ich)%bisst = data_tmp(12+header_fix%angord+2,ich) - end do - elseif ( header_fix%iversion < iversion_radiag_3 .and. header_fix%iversion >= iversion_radiag_2 ) then - do ich=1,header_fix%nchan - data_chan(ich)%bicons=data_tmp(9,ich) - data_chan(ich)%biang =data_tmp(10,ich) - data_chan(ich)%biclw =data_tmp(11,ich) - data_chan(ich)%bilap2=data_tmp(12,ich) - data_chan(ich)%bilap =data_tmp(13,ich) - end do - do ich=1,header_fix%nchan - do iang=1,header_fix%angord+1 - data_chan(ich)%bifix(iang)=data_tmp(13+iang,ich) - end do - data_chan(ich)%bisst = data_tmp(13+header_fix%angord+2,ich) - end do - elseif ( header_fix%iversion < iversion_radiag_4 .and. header_fix%iversion >= iversion_radiag_3 ) then - do ich=1,header_fix%nchan - data_chan(ich)%bicons=data_tmp(9,ich) - data_chan(ich)%biang =data_tmp(10,ich) - data_chan(ich)%biclw =data_tmp(11,ich) - data_chan(ich)%bilap2=data_tmp(12,ich) - data_chan(ich)%bilap =data_tmp(13,ich) - data_chan(ich)%bicos =data_tmp(14,ich) ! 1st bias correction term node*cos(lat) for SSMIS - data_chan(ich)%bisin =data_tmp(15,ich) ! 2nd bias correction term sin(lat) for SSMI - end do - do ich=1,header_fix%nchan - do iang=1,header_fix%angord+1 - data_chan(ich)%bifix(iang)=data_tmp(15+iang,ich) - end do - data_chan(ich)%bisst = data_tmp(15+header_fix%angord+2,ich) - end do - else - do ich=1,header_fix%nchan - data_chan(ich)%bicons=data_tmp(9,ich) - data_chan(ich)%biang =data_tmp(10,ich) - data_chan(ich)%biclw =data_tmp(11,ich) - data_chan(ich)%bilap2=data_tmp(12,ich) - data_chan(ich)%bilap =data_tmp(13,ich) - data_chan(ich)%bicos =data_tmp(14,ich) - data_chan(ich)%bisin =data_tmp(15,ich) - data_chan(ich)%biemis=data_tmp(16,ich) - end do - do ich=1,header_fix%nchan - do iang=1,header_fix%angord+1 - data_chan(ich)%bifix(iang)=data_tmp(16+iang,ich) - end do - data_chan(ich)%bisst = data_tmp(16+header_fix%angord+2,ich) - end do - endif - - if (header_fix%iextra > 0) then - do j=1,header_fix%jextra - do i=1,header_fix%iextra - data_extra(i,j)%extra=extra_tmp(i,j) - end do - end do - endif - - deallocate(data_tmp, fix_tmp) - if (header_fix%iextra > 0) deallocate(extra_tmp) - -end subroutine read_radiag_data - -end module read_diag - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radbcor.fd/readme b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radbcor.fd/readme deleted file mode 100644 index 6957c66f6f..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radbcor.fd/readme +++ /dev/null @@ -1,23 +0,0 @@ -Instructions for building radmon_bcor executable. - - 1) Load the build module appropriate for your Machine: - i.) - WCOSS: - "module use -a ../../modulefiles/wcoss" - THEIA: - "module use -a ../../modulefiles/theia" - ii.) - "module load RadMonBuild" - - 2) Optional: verify all prerequisites are met by typing: - "make check_prereqs" - - 3) Build the executable by typing: - "make" - - 4) Move the executable to the ../../exec directory by typing: - "make install" - - 5) Unload the build module: - "module unload RadMonBuild" - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radtime.fd/bad_chan.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radtime.fd/bad_chan.f90 deleted file mode 100644 index eaac10cff6..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radtime.fd/bad_chan.f90 +++ /dev/null @@ -1,94 +0,0 @@ -!$$$ subprogram documentation block -! . . . -! subprogram: bad_chan build bad_chan.txt file -! prgmmr: safford date: 2009-11 -! -! abstract: This module contains code to build the bad_chan.txt file. -! The bad_chan.txt file reports the satellite and channel for -! which zero obs were found on a channel that is set for use -! and normally has data. -! -! program history log: -! 2009-12-22 safford - initial coding -! -! contains: -! -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ - -module bad_chan - - implicit none - - private - - public :: open_bad_chan_file - public :: write_bad_chan - public :: close_bad_chan_file - - integer, parameter :: funit = 14 - - contains - - - !------------------------------------------------------------- - ! create the bad_chan file - !------------------------------------------------------------- - - subroutine open_bad_chan_file( date, cycle, fios ) - - !--- interface - character(8), intent( in ) :: date - character(8), intent( in ) :: cycle - integer, intent( out ) :: fios - - !--- variables - logical :: lexist = .FALSE. - character(60) :: fname - - -! write(*,*) '--> open_bad_chan_file, date, cycle = ', date, cycle - !--- build the file name - fname = 'bad_chan.' // trim(date) // trim(cycle) - - write(*,*) ' fname = ', fname - - !--- open file and write the header - inquire(file=fname, exist=lexist) - if( lexist .eqv. .FALSE. ) then - write(6,*) ' opening new bad_chan file' - open( UNIT=funit, FILE=fname, STATUS='NEW', IOSTAT=fios ) - else - write(6,*) ' opening existing bad_chan.txt file' - open( UNIT=funit, FILE=fname, STATUS='OLD', POSITION='APPEND', IOSTAT=fios ) - end if - - end subroutine open_bad_chan_file - - - subroutine write_bad_chan( satname, channel ) - - !--- interface - character(20), intent( in ) :: satname - integer, intent( in ) :: channel - - !--- variables - real :: count - - write(6,*) 'write_bad_chan, satname, channel', satname, channel - - write(funit,*) satname, 'channel= ', channel - - end subroutine write_bad_chan - - - subroutine close_bad_chan_file( ) -! write(6,*) '--> close_bad_chan_file' - close( funit ) - end subroutine close_bad_chan_file - -end module bad_chan diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radtime.fd/bad_penalty.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radtime.fd/bad_penalty.f90 deleted file mode 100644 index 55c822c7e8..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radtime.fd/bad_penalty.f90 +++ /dev/null @@ -1,100 +0,0 @@ -!$$$ subprogram documentation block -! . . . -! subprogram: penalty build penalty.txt file -! prgmmr: safford date: 2009-11 -! -! abstract: This module contains code to build the penalty.txt file. -! The penalty.txt file reports the satellite and channel for -! which a penalty value is likely out of range. -! -! program history log: -! 2009-11-23 safford - initial coding -! -! contains: -! -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ - -module bad_penalty - - implicit none - - private - - public :: open_bad_penalty_file - public :: write_bad_penalty - public :: close_bad_penalty_file - - integer, parameter :: funit = 11 - - contains - - - !------------------------------------------------------------- - ! open the bad_pen file - !------------------------------------------------------------- - - subroutine open_bad_penalty_file( date, cycle, fios ) - - !--- interface - character(8), intent( in ) :: date - character(8), intent( in ) :: cycle - integer, intent( out ) :: fios - - !--- variables - logical :: lexist = .FALSE. - character(60) :: fname - -! write(*,*) '--> open_bad_penalty_file, date, cycle = ', date, cycle - - !--- build the file name - fname= 'bad_pen.' // trim(date) // trim(cycle) - write(*,*) ' fname = ', fname - - !--- open file and write the header - inquire(file=fname, exist=lexist) - if( lexist .eqv. .FALSE. ) then - write(*,*) ' opening new bad_pen file' - open( UNIT=funit, FILE=fname, STATUS='NEW', IOSTAT=fios ) - else - write(*,*) ' opening existing bad_penalty.txt file' - open( UNIT=funit, FILE=fname, STATUS='OLD', POSITION='APPEND', IOSTAT=fios ) - end if - - end subroutine open_bad_penalty_file - - - !------------------------------------------------------------- - ! add an entry to the bad_penalty.txt file - !------------------------------------------------------------- - subroutine write_bad_penalty( satname, channel, region, penalty, bound ) - - !--- interface - character(20), intent( in ) :: satname - integer, intent( in ) :: channel - integer, intent( in ) :: region - real, intent( in ) :: penalty - real, intent( in ) :: bound - character(60) :: myformat - - myformat = "(A20,A10,I5,A9,I1,A10,ES15.7E2,A8,ES15.7E2)" - - - write(funit,myformat) satname, ' channel= ',channel, ' region= ', region, ' penalty= ', penalty, ' bound= ', bound - - end subroutine write_bad_penalty - - - !------------------------------------------------------------- - ! close the bad_penalty.txt file - !------------------------------------------------------------- - subroutine close_bad_penalty_file( ) -! write(*,*) '--> close_bad_penalty_file' - close( funit ) - end subroutine close_bad_penalty_file - -end module bad_penalty diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radtime.fd/create_ctl_time.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radtime.fd/create_ctl_time.f90 deleted file mode 100755 index a5be776d16..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radtime.fd/create_ctl_time.f90 +++ /dev/null @@ -1,162 +0,0 @@ -subroutine create_ctl_time(ntype,ftype,n_chan,iyy,imm,idd,ihh,idhh,& - incr,ctl_file,lunctl,rmiss,satname,satype,dplat,nregion,& - region,rlonmin,rlonmax,rlatmin,rlatmax,nu_chan,use,error,& - frequency,wavenumbr,little_endian) - - implicit none - - integer ntype - - character(2) cword - character(3),dimension(12):: mon - character(3):: clatmin,clatmax - character(4):: clonmin,clonmax - character(10),dimension(ntype):: ftype - character(13) stringd - character(20) satname,satsis - character(10) satype,dplat - character(40) ctl_file,grad_file - character(80) string - character(40),dimension(nregion):: region - character(80),dimension(nregion):: stringr - - integer idsat,nregion,iuse,little_endian - integer lunctl,iyy,imm,idd,ihh,j,i,n_chan,idhh,incr - integer iyy2,imm2,idd2,ihh2,ntime - integer,dimension(8):: ida,jda - integer,dimension(n_chan):: nu_chan - - real rmiss,wavelength - real,dimension(5):: fha - real,dimension(n_chan):: error,use,frequency,wavenumbr - real,dimension(nregion):: rlonmin,rlonmax,rlatmin,rlatmax - - data stringd / '.%y4%m2%d2%h2' / - data mon / 'jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', & - 'aug', 'sep', 'oct', 'nov', 'dec' / - -!************************************************************************** -! Create date for tdef based on given date and hour offset - fha=0.0; ida=0; jda=0; ntime=0 - iyy2=iyy; imm2=imm; idd2=idd; ihh2=ihh - if (idhh/=0) then - ntime = abs(idhh)/incr - fha(2)=idhh - ida(1)=iyy - ida(2)=imm - ida(3)=idd - ida(4)=0 - ida(5)=ihh - call w3movdat(fha,ida,jda) - iyy2=jda(1) - imm2=jda(2) - idd2=jda(3) - ihh2=jda(5) - endif - ntime=ntime+1 - -! Open unit to GrADS control file - open(lunctl,file=ctl_file,form='formatted') - -!******************************************************************* -! Construct the region strings if this is for a global source, -! which is defined as nregion > 1. -! - if (nregion > 1) then - do i=1,nregion - if (rlatmin(i)>0.) then - write(clatmin,10) int(rlatmin(i)) - else - write(clatmin,20) abs(int(rlatmin(i))) - endif - if (rlatmax(i)>0.) then - write(clatmax,10) int(rlatmax(i)) - else - write(clatmax,20) abs(int(rlatmax(i))) - endif - if (rlonmin(i)>0.) then - write(clonmin,30) int(rlonmin(i)) - else - write(clonmin,40) abs(int(rlonmin(i))) - endif - if (rlonmax(i)>0.) then - write(clonmax,30) int(rlonmax(i)) - else - write(clonmax,40) abs(int(rlonmax(i))) - endif - stringr(i) = trim(region(i)) // ' (' // & - trim(clonmin) // '-' // trim(clonmax) // ', ' // & - trim(clatmin) // '-' // trim(clatmax) // ')' - end do - endif -10 format(i2,'N') -20 format(i2,'S') -30 format(i3,'E') -40 format(i3,'W') - -! Write header information - grad_file = trim(satname) // stringd // '.ieee_d' - write(lunctl,100) grad_file - if ( little_endian == 1 ) then - write(lunctl,112) - else - write(lunctl,110) - endif - write(lunctl,120) rmiss - write(lunctl,130) adjustl(satype),dplat,n_chan - write(lunctl,132) - do i=1,n_chan - iuse = nint(use(i)) - wavelength = 10000./wavenumbr(i) - write(lunctl,134) i,nu_chan(i),iuse,error(i),wavelength,frequency(i) - end do - write(lunctl,136) - - if (nregion > 1) then - do i=1,nregion - write(cword,'(i2)') i - string = '* region=' // cword // ' ' // trim(stringr(i)) - write(lunctl,138) string - end do - endif - - write(lunctl,140) n_chan - write(lunctl,150) nregion - write(lunctl,160) - write(lunctl,170) ntime,ihh2,idd2,mon(imm2),iyy2 - write(lunctl,180) ntype - -100 format('dset ^',a40) -110 format('options template big_endian sequential') -112 format('options template little_endian sequential') -120 format('undef ',f5.0) -130 format('title ',a10,1x,a10,1x,i4) -132 format('*XDEF is channel number') -134 format('* x= ',i4,', channel= ',i4,' , iuse= ',i2,' , error= ',f8.3,& - ' , wlth= ',f9.2,' , freq= ',f9.2) -136 format('*YDEF is geographic region') -138 format(a80) -140 format('xdef ',i4,' linear 1.0 1.0') -150 format('ydef ',i2,' linear 1.0 1.0') -160 format('zdef 1 linear 1.0 1.0') -170 format('tdef ',i4,' linear ',i2.2,'Z',i2.2,a3,i4.4,' 06hr') -180 format('vars ',i7) - -! Write data portion of GraDS control file - do i=1,ntype - string = trim(ftype(i)) - write(lunctl,190) adjustl(string),trim(ftype(i)) -190 format(a10,' 0 0 ',a10) - end do - -! Write trminating "endvars" record - write(lunctl,200) -200 format('endvars') - - -! Close ctl file - close(lunctl) - -! Return - return -end subroutine create_ctl_time diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radtime.fd/makefile b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radtime.fd/makefile deleted file mode 100755 index ff0f8b1f57..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radtime.fd/makefile +++ /dev/null @@ -1,62 +0,0 @@ -# ***************************************************************** -# makefile -# -# Make the radmon_time executable. -# -# ***************************************************************** - -BINDIR = ../../exec - -LIBS = $(W3NCO_LIB4) - -OBJS = kinds.o read_diag.o bad_obs.o bad_penalty.o bad_chan.o valid.o \ - time.o create_ctl_time.o - -# -# ***************************************************************** -# - -CMD = radmon_time - -all: $(CMD) - -clean: - rm -f *.o - rm -f *.mod - rm -f radmon_time - -check_prereqs: - /nwprod/spa_util/check_libs.bash $(LIBS) - -install: - cp -f $(CMD) $(BINDIR)/ - -debug: FFLAGS = $(D_FFLAGS) -debug: $(CMD) - -$(CMD): $(OBJS) - $(CF) $(FFLAGS) $(LDFLAGS) -o $(@) $(OBJS) $(LIBS) - -read_diag.o : read_diag.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -bad_obs.o : bad_obs.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -bad_penalty.o : bad_penalty.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -bad_chan.o : bad_chan.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -valid.o : valid.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -time.o : time.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -create_ctl_time.o : create_ctl_time.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -kinds.o : kinds.F90 - $(CF) $(FFLAGS) -c $(*).F90 diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radtime.fd/read_diag.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radtime.fd/read_diag.f90 deleted file mode 100755 index 7a4d6cdc49..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radtime.fd/read_diag.f90 +++ /dev/null @@ -1,659 +0,0 @@ -!$$$ subprogram documentation block -! . . . . -! subprogram: read_raddiag read rad diag file -! prgmmr: tahara org: np20 date: 2003-01-01 -! -! abstract: This module contains code to process radiance -! diagnostic files. The module defines structures -! to contain information from the radiance -! diagnostic files and then provides two routines -! to access contents of the file. -! -! program history log: -! 2005-07-22 treadon - add this doc block -! 2010-10-05 treadon - refactor code to GSI standard -! 2010-10-08 zhu - use data_tmp to handle various npred values -! 2011-02-22 kleist - changes related to memory allocate/deallocate -! 2011-04-08 li - add tref, dtw, dtc to diag_data_fix_list, add tb_tz to diag_data_chan_list -! - correspondingly, change ireal_radiag (26 -> 30) and ipchan_radiag (7 -> 8) -! 2011-07-24 safford - make structure size for reading data_fix data version dependent -! 2013-11-21 todling - revisit how versions are set (add set/get_radiag) -! 2014-01-27 todling - add ob sensitivity index -! -! contains -! read_radiag_header - read radiance diagnostic file header -! read_radiag_data - read radiance diagnostic file data -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ - -module read_diag - - use kinds, only: i_kind,r_single - implicit none - -! Declare public and private - private - - public :: diag_header_fix_list - public :: diag_header_chan_list - public :: diag_data_name_list - public :: diag_data_fix_list - public :: diag_data_chan_list - public :: diag_data_extra_list - public :: read_radiag_header - public :: read_radiag_data -! public :: iversion_radiag -! public :: iversion_radiag_1 -! public :: iversion_radiag_2 -! public :: iversion_radiag_3 -! public :: iversion_radiag_4 - public :: ireal_radiag - public :: ipchan_radiag - public :: set_radiag - public :: get_radiag - - interface set_radiag - module procedure set_radiag_int_ ! internal procedure for integers - end interface - interface get_radiag - module procedure get_radiag_int_ ! internal procedure for integers - end interface - - integer(i_kind),parameter :: ireal_radiag = 30 ! number of real entries per spot in radiance diagnostic file - integer(i_kind),parameter :: ireal_old_radiag = 26 ! number of real entries per spot in versions older than iversion_radiag_2 - integer(i_kind),parameter :: ipchan_radiag = 8 ! number of entries per channel per spot in radiance diagnostic file - -! Declare structures for radiance diagnostic file information - type diag_header_fix_list - character(len=20) :: isis ! sat and sensor type - character(len=10) :: id ! sat type - character(len=10) :: obstype ! observation type - integer(i_kind) :: jiter ! outer loop counter - integer(i_kind) :: nchan ! number of channels in the sensor - integer(i_kind) :: npred ! number of updating bias correction predictors - integer(i_kind) :: idate ! time (yyyymmddhh) - integer(i_kind) :: ireal ! # of real elements in the fix part of a data record - integer(i_kind) :: ipchan ! # of elements for each channel except for bias correction terms - integer(i_kind) :: iextra ! # of extra elements for each channel - integer(i_kind) :: jextra ! # of extra elements - integer(i_kind) :: idiag ! first dimension of diag_data_chan - integer(i_kind) :: angord ! order of polynomial for adp_anglebc option - integer(i_kind) :: iversion ! radiance diagnostic file version number - integer(i_kind) :: inewpc ! indicator of newpc4pred (1 on, 0 off) - integer(i_kind) :: isens ! sensitivity index - end type diag_header_fix_list - - type diag_data_name_list - character(len=10),dimension(ireal_radiag) :: fix - character(len=10),dimension(:),allocatable :: chn - end type diag_data_name_list - - type diag_header_chan_list - real(r_single) :: freq ! frequency (Hz) - real(r_single) :: polar ! polarization - real(r_single) :: wave ! wave number (cm^-1) - real(r_single) :: varch ! error variance (or SD error?) - real(r_single) :: tlapmean ! mean lapse rate - integer(i_kind):: iuse ! use flag - integer(i_kind):: nuchan ! sensor relative channel number - integer(i_kind):: iochan ! satinfo relative channel number - end type diag_header_chan_list - - type diag_data_fix_list - real(r_single) :: lat ! latitude (deg) - real(r_single) :: lon ! longitude (deg) - real(r_single) :: zsges ! guess elevation at obs location (m) - real(r_single) :: obstime ! observation time relative to analysis - real(r_single) :: senscn_pos ! sensor scan position (integer(i_kind)) - real(r_single) :: satzen_ang ! satellite zenith angle (deg) - real(r_single) :: satazm_ang ! satellite azimuth angle (deg) - real(r_single) :: solzen_ang ! solar zenith angle (deg) - real(r_single) :: solazm_ang ! solar azimumth angle (deg) - real(r_single) :: sungln_ang ! sun glint angle (deg) - real(r_single) :: water_frac ! fractional coverage by water - real(r_single) :: land_frac ! fractional coverage by land - real(r_single) :: ice_frac ! fractional coverage by ice - real(r_single) :: snow_frac ! fractional coverage by snow - real(r_single) :: water_temp ! surface temperature over water (K) - real(r_single) :: land_temp ! surface temperature over land (K) - real(r_single) :: ice_temp ! surface temperature over ice (K) - real(r_single) :: snow_temp ! surface temperature over snow (K) - real(r_single) :: soil_temp ! soil temperature (K) - real(r_single) :: soil_mois ! soil moisture - real(r_single) :: land_type ! land type (integer(i_kind)) - real(r_single) :: veg_frac ! vegetation fraction - real(r_single) :: snow_depth ! snow depth - real(r_single) :: sfc_wndspd ! surface wind speed - real(r_single) :: qcdiag1 ! ir=cloud fraction, mw=cloud liquid water - real(r_single) :: qcdiag2 ! ir=cloud top pressure, mw=total column water - real(r_single) :: tref ! reference temperature (Tr) in NSST - real(r_single) :: dtw ! dt_warm at zob - real(r_single) :: dtc ! dt_cool at zob - real(r_single) :: tz_tr ! d(Tz)/d(Tr) - end type diag_data_fix_list - - type diag_data_chan_list - real(r_single) :: tbobs ! Tb (obs) (K) - real(r_single) :: omgbc ! Tb_(obs) - Tb_(simulated w/ bc) (K) - real(r_single) :: omgnbc ! Tb_(obs) - Tb_(simulated_w/o bc) (K) - real(r_single) :: errinv ! inverse error (K**(-1)) - real(r_single) :: qcmark ! quality control mark - real(r_single) :: emiss ! surface emissivity - real(r_single) :: tlap ! temperature lapse rate - real(r_single) :: tb_tz ! d(Tb)/d(Tz) - real(r_single) :: bicons ! constant bias correction term - real(r_single) :: biang ! scan angle bias correction term - real(r_single) :: biclw ! CLW bias correction term - real(r_single) :: bilap2 ! square lapse rate bias correction term - real(r_single) :: bilap ! lapse rate bias correction term - real(r_single) :: bicos ! node*cos(lat) bias correction term - real(r_single) :: bisin ! sin(lat) bias correction term - real(r_single) :: biemis ! emissivity sensitivity bias correction term - real(r_single),dimension(:),allocatable :: bifix ! angle dependent bias - real(r_single) :: bisst ! SST bias correction term - end type diag_data_chan_list - - type diag_data_extra_list - real(r_single) :: extra ! extra information - end type diag_data_extra_list - - integer(i_kind),save :: iversion_radiag ! Current version (see set routine) - integer(i_kind),parameter:: iversion_radiag_1 = 11104 ! Version when bias-correction entries were modified - integer(i_kind),parameter:: iversion_radiag_2 = 13784 ! Version when NSST entries were added - integer(i_kind),parameter:: iversion_radiag_3 = 19180 ! Version when SSMIS added - integer(i_kind),parameter:: iversion_radiag_4 = 30303 ! Version when emissivity predictor added - - real(r_single),parameter:: rmiss_radiag = -9.9e11_r_single - -contains - -subroutine set_radiag_int_ (what,iv,ier) -character(len=*),intent(in) :: what -integer(i_kind),intent(in) :: iv -integer(i_kind),intent(out):: ier -ier=-1 -if(trim(what)=='version') then - iversion_radiag = iv - ier=0 -endif -end subroutine set_radiag_int_ - -subroutine get_radiag_int_ (what,iv,ier) -character(len=*),intent(in) :: what -integer(i_kind),intent(out):: iv -integer(i_kind),intent(out):: ier -ier=-1 -if(trim(what)=='version') then - iv = iversion_radiag - ier=0 -endif -end subroutine get_radiag_int_ - -subroutine read_radiag_header(ftin,npred_radiag,retrieval,header_fix,header_chan,data_name,iflag,lverbose) -! . . . . -! subprogram: read_diag_header read rad diag header -! prgmmr: tahara org: np20 date: 2003-01-01 -! -! abstract: This routine reads the header record from a radiance -! diagnostic file -! -! program history log: -! 2010-10-05 treadon - add this doc block -! 2011-02-22 kleist - changes related to memory allocation and standard output -! -! input argument list: -! ftin - unit number connected to diagnostic file -! npred_radiag - number of bias correction terms -! retrieval - .true. if sst retrieval -! -! output argument list: -! header_fix - header information structure -! header_chan - channel information structure -! data_name - diag file data names -! iflag - error code -! lverbose - optional flag to turn off default output to standard out -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ - -! Declare passed arguments - integer(i_kind),intent(in) :: ftin - integer(i_kind),intent(in) :: npred_radiag - logical,intent(in) :: retrieval - type(diag_header_fix_list ),intent(out):: header_fix - type(diag_header_chan_list),allocatable :: header_chan(:) - type(diag_data_name_list) :: data_name - integer(i_kind),intent(out) :: iflag - logical,optional,intent(in) :: lverbose - -! Declare local variables - character(len=2):: string - character(len=10):: satid,sentype - character(len=20):: sensat - integer(i_kind) :: i,ich - integer(i_kind):: jiter,nchanl,npred,ianldate,ireal,ipchan,iextra,jextra - integer(i_kind):: idiag,angord,iversion,inewpc,isens - integer(i_kind):: iuse_tmp,nuchan_tmp,iochan_tmp - real(r_single) :: freq_tmp,polar_tmp,wave_tmp,varch_tmp,tlapmean_tmp - logical loutall - - loutall=.true. - if(present(lverbose)) loutall=lverbose - -! Read header (fixed_part). - read(ftin,IOSTAT=iflag) sensat,satid,sentype,jiter,nchanl,npred,ianldate,& - ireal,ipchan,iextra,jextra,idiag,angord,iversion,inewpc,isens - if (iflag/=0) then - rewind(ftin) - read(ftin,IOSTAT=iflag) sensat,satid,sentype,jiter,nchanl,npred,ianldate,& - ireal,ipchan,iextra,jextra,idiag,angord,iversion,inewpc - isens=0 - end if - - if (iflag/=0) then - rewind(ftin) - read(ftin,IOSTAT=iflag) sensat,satid,sentype,jiter,nchanl,npred,ianldate,& - ireal,ipchan,iextra,jextra - idiag=ipchan+npred+1 - angord=0 - iversion=0 - inewpc=0 - isens=0 - if (iflag/=0) then - write(6,*)'READ_RADIAG_HEADER: ***ERROR*** Unknown file format. Cannot read' - return - endif - endif - - header_fix%isis = sensat - header_fix%id = satid - header_fix%obstype = sentype - header_fix%jiter = jiter - header_fix%nchan = nchanl - header_fix%npred = npred - header_fix%idate = ianldate - header_fix%ireal = ireal - header_fix%ipchan = ipchan - header_fix%iextra = iextra - header_fix%jextra = jextra - header_fix%idiag = idiag - header_fix%angord = angord - header_fix%iversion= iversion - header_fix%inewpc = inewpc - header_fix%isens = isens - - if (loutall) then - write(6,*)'READ_RADIAG_HEADER: isis=',header_fix%isis,& - ' nchan=',header_fix%nchan,& - ' npred=',header_fix%npred,& - ' angord=',header_fix%angord,& - ' idiag=',header_fix%idiag,& - ' iversion=',header_fix%iversion,& - ' inewpc=',header_fix%inewpc,& - ' isens=',header_fix%isens - - if ( header_fix%iextra /= 0) & - write(6,*)'READ_RADIAG_HEADER: extra diagnostic information available, ',& - 'iextra=',header_fix%iextra - end if - - if (header_fix%npred /= npred_radiag) & - write(6,*) 'READ_RADIAG_HEADER: **WARNING** header_fix%npred,npred=',& - header_fix%npred,npred_radiag - -! Allocate and initialize as needed - if (allocated(header_chan)) deallocate(header_chan) - if (allocated(data_name%chn)) deallocate(data_name%chn) - - allocate(header_chan( header_fix%nchan)) - allocate(data_name%chn(header_fix%idiag)) - - data_name%fix(1) ='lat ' - data_name%fix(2) ='lon ' - data_name%fix(3) ='zsges ' - data_name%fix(4) ='obstim ' - data_name%fix(5) ='scanpos ' - data_name%fix(6) ='satzen ' - data_name%fix(7) ='satazm ' - data_name%fix(8) ='solzen ' - data_name%fix(9) ='solazm ' - data_name%fix(10)='sungln ' - data_name%fix(11)='fwater ' - data_name%fix(12)='fland ' - data_name%fix(13)='fice ' - data_name%fix(14)='fsnow ' - data_name%fix(15)='twater ' - data_name%fix(16)='tland ' - data_name%fix(17)='tice ' - data_name%fix(18)='tsnow ' - data_name%fix(19)='tsoil ' - data_name%fix(20)='soilmoi ' - data_name%fix(21)='landtyp ' - data_name%fix(22)='vegfrac ' - data_name%fix(23)='snowdep ' - data_name%fix(24)='wndspd ' - data_name%fix(25)='qc1 ' - data_name%fix(26)='qc2 ' - data_name%fix(27)='tref ' - data_name%fix(28)='dtw ' - data_name%fix(29)='dtc ' - data_name%fix(30)='tz_tr ' - - data_name%chn(1)='obs ' - data_name%chn(2)='omgbc ' - data_name%chn(3)='omgnbc ' - data_name%chn(4)='errinv ' - data_name%chn(5)='qcmark ' - data_name%chn(6)='emiss ' - data_name%chn(7)='tlap ' - data_name%chn(8)='tb_tz ' - - if (header_fix%iversion < iversion_radiag_1) then - data_name%chn( 8)= 'bifix ' - data_name%chn( 9)= 'bilap ' - data_name%chn(10)= 'bilap2 ' - data_name%chn(11)= 'bicons ' - data_name%chn(12)= 'biang ' - data_name%chn(13)= 'biclw ' - if (retrieval) data_name%chn(13)= 'bisst ' - elseif ( header_fix%iversion < iversion_radiag_2 .and. header_fix%iversion >= iversion_radiag_1 ) then - data_name%chn( 8)= 'bicons ' - data_name%chn( 9)= 'biang ' - data_name%chn(10)= 'biclw ' - data_name%chn(11)= 'bilap2 ' - data_name%chn(12)= 'bilap ' - do i=1,header_fix%angord - write(string,'(i2.2)') header_fix%angord-i+1 - data_name%chn(12+i)= 'bifix' // string - end do - data_name%chn(12+header_fix%angord+1)= 'bifix ' - data_name%chn(12+header_fix%angord+2)= 'bisst ' - elseif ( header_fix%iversion < iversion_radiag_3 .and. header_fix%iversion >= iversion_radiag_2 ) then - data_name%chn( 9)= 'bicons ' - data_name%chn(10)= 'biang ' - data_name%chn(11)= 'biclw ' - data_name%chn(12)= 'bilap2 ' - data_name%chn(13)= 'bilap ' - do i=1,header_fix%angord - write(string,'(i2.2)') header_fix%angord-i+1 - data_name%chn(13+i)= 'bifix' // string - end do - data_name%chn(13+header_fix%angord+1)= 'bifix ' - data_name%chn(13+header_fix%angord+2)= 'bisst ' - elseif ( header_fix%iversion < iversion_radiag_4 .and. header_fix%iversion >= iversion_radiag_3 ) then - data_name%chn( 9)= 'bicons ' - data_name%chn(10)= 'biang ' - data_name%chn(11)= 'biclw ' - data_name%chn(12)= 'bilap2 ' - data_name%chn(13)= 'bilap ' - data_name%chn(14)= 'bicos ' - data_name%chn(15)= 'bisin ' - do i=1,header_fix%angord - write(string,'(i2.2)') header_fix%angord-i+1 - data_name%chn(15+i)= 'bifix' // string - end do - data_name%chn(15+header_fix%angord+1)= 'bifix ' - data_name%chn(15+header_fix%angord+2)= 'bisst ' - else - data_name%chn( 9)= 'bicons ' - data_name%chn(10)= 'biang ' - data_name%chn(11)= 'biclw ' - data_name%chn(12)= 'bilap2 ' - data_name%chn(13)= 'bilap ' - data_name%chn(14)= 'bicos ' - data_name%chn(15)= 'bisin ' - data_name%chn(16)= 'biemis ' - do i=1,header_fix%angord - write(string,'(i2.2)') header_fix%angord-i+1 - data_name%chn(16+i)= 'bifix' // string - end do - data_name%chn(16+header_fix%angord+1)= 'bifix ' - data_name%chn(16+header_fix%angord+2)= 'bisst ' - endif - -! Read header (channel part) - do ich=1, header_fix%nchan - read(ftin,IOSTAT=iflag) freq_tmp,polar_tmp,wave_tmp,varch_tmp,tlapmean_tmp,iuse_tmp,nuchan_tmp,iochan_tmp - header_chan(ich)%freq = freq_tmp - header_chan(ich)%polar = polar_tmp - header_chan(ich)%wave = wave_tmp - header_chan(ich)%varch = varch_tmp - header_chan(ich)%tlapmean = tlapmean_tmp - header_chan(ich)%iuse = iuse_tmp - header_chan(ich)%nuchan = nuchan_tmp - header_chan(ich)%iochan = iochan_tmp - if (iflag/=0) return - end do - -! Construct array containing menonics for data record entries - - -end subroutine read_radiag_header - -subroutine read_radiag_data(ftin,header_fix,retrieval,data_fix,data_chan,data_extra,iflag ) -! . . . . -! subprogram: read_radiag_dat read rad diag data -! prgmmr: tahara org: np20 date: 2003-01-01 -! -! abstract: This routine reads the data record from a radiance -! diagnostic file -! -! program history log: -! 2010-10-05 treadon - add this doc block -! 2011-02-22 kleist - changes related to memory allocation -! -! input argument list: -! ftin - unit number connected to diagnostic file -! header_fix - header information structure -! -! output argument list: -! data_fix - spot header information structure -! data_chan - spot channel information structure -! data_extra - spot extra information -! iflag - error code -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ - - -! Declare passed arguments - integer(i_kind),intent(in) :: ftin - type(diag_header_fix_list ),intent(in) :: header_fix - logical,intent(in) :: retrieval - type(diag_data_fix_list) ,intent(out):: data_fix - type(diag_data_chan_list) ,allocatable :: data_chan(:) - type(diag_data_extra_list) ,allocatable :: data_extra(:,:) - integer(i_kind),intent(out) :: iflag - - integer(i_kind) :: ich,iang,i,j - real(r_single),dimension(:,:),allocatable :: data_tmp - real(r_single),dimension(:),allocatable :: fix_tmp - real(r_single),dimension(:,:),allocatable :: extra_tmp - -! Allocate arrays as needed - if (allocated(data_chan)) deallocate(data_chan) - allocate(data_chan(header_fix%nchan)) - - do ich=1,header_fix%nchan - if (allocated(data_chan(ich)%bifix)) deallocate(data_chan(ich)%bifix) - allocate(data_chan(ich)%bifix(header_fix%angord+1)) - end do - - if (header_fix%iextra > 0) then - if (allocated(data_extra)) deallocate(data_extra) - allocate(data_extra(header_fix%iextra,header_fix%jextra)) - allocate(extra_tmp(header_fix%iextra,header_fix%jextra)) - end if - -! Allocate arrays to hold data record - allocate(data_tmp(header_fix%idiag,header_fix%nchan)) - - if (header_fix%iversion < iversion_radiag_2) then - allocate( fix_tmp( ireal_old_radiag ) ) - else - allocate( fix_tmp( ireal_radiag ) ) - end if - -! Read data record - - if (header_fix%iextra == 0) then - read(ftin,IOSTAT=iflag) fix_tmp, data_tmp - else - read(ftin,IOSTAT=iflag) fix_tmp, data_tmp, extra_tmp - endif - - -! Transfer fix_tmp record to output structure - data_fix%lat = fix_tmp(1) - data_fix%lon = fix_tmp(2) - data_fix%zsges = fix_tmp(3) - data_fix%obstime = fix_tmp(4) - data_fix%senscn_pos = fix_tmp(5) - data_fix%satzen_ang = fix_tmp(6) - data_fix%satazm_ang = fix_tmp(7) - data_fix%solzen_ang = fix_tmp(8) - data_fix%solazm_ang = fix_tmp(9) - data_fix%sungln_ang = fix_tmp(10) - data_fix%water_frac = fix_tmp(11) - data_fix%land_frac = fix_tmp(12) - data_fix%ice_frac = fix_tmp(13) - data_fix%snow_frac = fix_tmp(14) - data_fix%water_temp = fix_tmp(15) - data_fix%land_temp = fix_tmp(16) - data_fix%ice_temp = fix_tmp(17) - data_fix%snow_temp = fix_tmp(18) - data_fix%soil_temp = fix_tmp(19) - data_fix%soil_mois = fix_tmp(20) - data_fix%land_type = fix_tmp(21) - data_fix%veg_frac = fix_tmp(22) - data_fix%snow_depth = fix_tmp(23) - data_fix%sfc_wndspd = fix_tmp(24) - data_fix%qcdiag1 = fix_tmp(25) - data_fix%qcdiag2 = fix_tmp(26) - - if ( header_fix%iversion <= iversion_radiag_1 ) then - data_fix%tref = rmiss_radiag - data_fix%dtw = rmiss_radiag - data_fix%dtc = rmiss_radiag - data_fix%tz_tr = rmiss_radiag - else - data_fix%tref = fix_tmp(27) - data_fix%dtw = fix_tmp(28) - data_fix%dtc = fix_tmp(29) - data_fix%tz_tr = fix_tmp(30) - end if - - -! Transfer data record to output structure - do ich=1,header_fix%nchan - data_chan(ich)%tbobs =data_tmp(1,ich) - data_chan(ich)%omgbc =data_tmp(2,ich) - data_chan(ich)%omgnbc=data_tmp(3,ich) - data_chan(ich)%errinv=data_tmp(4,ich) - data_chan(ich)%qcmark=data_tmp(5,ich) - data_chan(ich)%emiss =data_tmp(6,ich) - data_chan(ich)%tlap =data_tmp(7,ich) - data_chan(ich)%tb_tz =data_tmp(8,ich) - end do - if (header_fix%iversion < iversion_radiag_1) then - do ich=1,header_fix%nchan - data_chan(ich)%bifix(1)=data_tmp(8,ich) - data_chan(ich)%bilap =data_tmp(9,ich) - data_chan(ich)%bilap2 =data_tmp(10,ich) - data_chan(ich)%bicons =data_tmp(11,ich) - data_chan(ich)%biang =data_tmp(12,ich) - data_chan(ich)%biclw =data_tmp(13,ich) - data_chan(ich)%bisst = rmiss_radiag - if (retrieval) then - data_chan(ich)%biclw =rmiss_radiag - data_chan(ich)%bisst =data_tmp(13,ich) - endif - end do - elseif ( header_fix%iversion < iversion_radiag_2 .and. header_fix%iversion >= iversion_radiag_1 ) then - do ich=1,header_fix%nchan - data_chan(ich)%bicons=data_tmp(8,ich) - data_chan(ich)%biang =data_tmp(9,ich) - data_chan(ich)%biclw =data_tmp(10,ich) - data_chan(ich)%bilap2=data_tmp(11,ich) - data_chan(ich)%bilap =data_tmp(12,ich) - end do - do ich=1,header_fix%nchan - do iang=1,header_fix%angord+1 - data_chan(ich)%bifix(iang)=data_tmp(12+iang,ich) - end do - data_chan(ich)%bisst = data_tmp(12+header_fix%angord+2,ich) - end do - elseif ( header_fix%iversion < iversion_radiag_3 .and. header_fix%iversion >= iversion_radiag_2 ) then - do ich=1,header_fix%nchan - data_chan(ich)%bicons=data_tmp(9,ich) - data_chan(ich)%biang =data_tmp(10,ich) - data_chan(ich)%biclw =data_tmp(11,ich) - data_chan(ich)%bilap2=data_tmp(12,ich) - data_chan(ich)%bilap =data_tmp(13,ich) - end do - do ich=1,header_fix%nchan - do iang=1,header_fix%angord+1 - data_chan(ich)%bifix(iang)=data_tmp(13+iang,ich) - end do - data_chan(ich)%bisst = data_tmp(13+header_fix%angord+2,ich) - end do - elseif ( header_fix%iversion < iversion_radiag_4 .and. header_fix%iversion >= iversion_radiag_3 ) then - do ich=1,header_fix%nchan - data_chan(ich)%bicons=data_tmp(9,ich) - data_chan(ich)%biang =data_tmp(10,ich) - data_chan(ich)%biclw =data_tmp(11,ich) - data_chan(ich)%bilap2=data_tmp(12,ich) - data_chan(ich)%bilap =data_tmp(13,ich) - data_chan(ich)%bicos =data_tmp(14,ich) ! 1st bias correction term node*cos(lat) for SSMIS - data_chan(ich)%bisin =data_tmp(15,ich) ! 2nd bias correction term sin(lat) for SSMI - end do - do ich=1,header_fix%nchan - do iang=1,header_fix%angord+1 - data_chan(ich)%bifix(iang)=data_tmp(15+iang,ich) - end do - data_chan(ich)%bisst = data_tmp(15+header_fix%angord+2,ich) - end do - else - do ich=1,header_fix%nchan - data_chan(ich)%bicons=data_tmp(9,ich) - data_chan(ich)%biang =data_tmp(10,ich) - data_chan(ich)%biclw =data_tmp(11,ich) - data_chan(ich)%bilap2=data_tmp(12,ich) - data_chan(ich)%bilap =data_tmp(13,ich) - data_chan(ich)%bicos =data_tmp(14,ich) - data_chan(ich)%bisin =data_tmp(15,ich) - data_chan(ich)%biemis=data_tmp(16,ich) - end do - do ich=1,header_fix%nchan - do iang=1,header_fix%angord+1 - data_chan(ich)%bifix(iang)=data_tmp(16+iang,ich) - end do - data_chan(ich)%bisst = data_tmp(16+header_fix%angord+2,ich) - end do - endif - - if (header_fix%iextra > 0) then - do j=1,header_fix%jextra - do i=1,header_fix%iextra - data_extra(i,j)%extra=extra_tmp(i,j) - end do - end do - endif - - deallocate(data_tmp, fix_tmp) - if (header_fix%iextra > 0) deallocate(extra_tmp) - -end subroutine read_radiag_data - -end module read_diag - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radtime.fd/readme b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radtime.fd/readme deleted file mode 100644 index b6fdcbaf0e..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radtime.fd/readme +++ /dev/null @@ -1,23 +0,0 @@ -Instructions for building radmon_time executable. - - 1) Load the build module appropriate for your Machine: - i.) - WCOSS: - "module use -a ../../modulefiles/wcoss" - THEIA: - "module use -a ../../modulefiles/theia" - ii.) - "module load RadMonBuild" - - 2) Optional: verify all prerequisites are met by typing: - "make check_prereqs" - - 3) Build the executable by typing: - "make" - - 4) Move the executable to the ../../exec directory by typing: - "make install" - - 5) Unload the build module: - "module unload RadMonBuild" - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radtime.fd/time.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radtime.fd/time.f90 deleted file mode 100755 index 79ebf4cc3c..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radtime.fd/time.f90 +++ /dev/null @@ -1,493 +0,0 @@ -program time -!************************************************************************ -! -! time.f90 -! -! log -! 05/2010 safford reduce validation to just region 1 (global) -! 07/2010 safford redefine regions to surface types -!************************************************************************ - - use read_diag - use bad_obs - use bad_penalty - use bad_chan - use valid - - implicit none - integer ntype,mregion,surf_nregion,max_surf_region - parameter (ntype=8,mregion=25, max_surf_region=5) - integer iglobal, iland, iwater, isnowice, imixed - parameter (iglobal=1, iland=2, iwater=3, isnowice=4, imixed=5) - - character(10),dimension(ntype):: ftype - character(8) stid - character(20) satname,stringd,satsis - character(10) dum,satype,dplat - character(40) string,diag_rad,data_file,dfile,ctl_file - character(40),dimension(max_surf_region):: region - character(40),dimension(mregion):: surf_region - character :: command - character(8) date,suffix,cycle - - integer luname,lungrd,lunctl,lndiag,nregion - integer iyy,imm,idd,ihh,idhh,incr,iread,iflag - integer n_chan,j,idsat,i,k,ii,nreg - integer,dimension(mregion):: jsub - integer,allocatable,dimension(:):: io_chan,nu_chan - integer :: ios = 0 - integer :: channel_obs - integer :: iret, ier, ver - integer npred_radiag - - real rread, pen, bound - real rlat, rlon, rmiss, obs - real,dimension(2):: cor_tot,nbc_omg,bc_omg - real,dimension(max_surf_region):: rlatmin,rlatmax,rlonmin,rlonmax - - real,allocatable,dimension(:):: wavenumbr,channel_count - real,allocatable,dimension(:,:):: count,error,use,frequency,penalty,test_pen - real,allocatable,dimension(:,:,:):: tot_cor,omg_nbc,omg_bc - -! Variables for reading satellite data - type(diag_header_fix_list ) :: header_fix - type(diag_header_chan_list),allocatable :: header_chan(:) - type(diag_data_name_list ) :: data_name - type(diag_data_fix_list ) :: data_fix - type(diag_data_chan_list ),allocatable :: data_chan(:) - type(diag_data_extra_list) ,allocatable :: data_extra(:,:) - - logical valid_count, valid_penalty - integer nsnow, nland, nwater, nice, nmixed, ntotal - integer nnsnow, nnland, nnwater, nnmixed, nntotal - -! Namelist with defaults - logical :: retrieval = .false. - integer :: nchanl = 19 - integer :: imkctl = 1 - integer :: imkdata = 1 - character(3) :: gesanl = 'ges' - integer :: little_endian = 1 - character(3) :: rad_area = 'glb' - namelist /input/ satname,iyy,imm,idd,ihh,idhh,incr,nchanl,& - suffix,imkctl,imkdata,retrieval,gesanl,little_endian,rad_area - - data luname,lungrd,lunctl,lndiag / 5, 51, 52, 21 / - data rmiss /-999./ - data stringd / '.%y4%m2%d2%h2' / - data ftype / 'count','penalty','omgnbc','total','omgbc','omgnbc2','total2','omgbc2'/ - data region / 'global', 'land', 'water', 'ice/snow', 'mixed'/ - data rlonmin / -180., -180., -180., -180., -180./ - data rlonmax / 180., 180., 180., 180., 180./ - data rlatmin / -90., -90., -90., -90., -90./ - data rlatmax / 90., 90., 90., 90., 90./ - - -!************************************************************************ -! -! Initialize variables - iread=0 - npred_radiag = 12 - -! Read namelist input - read(luname,input) - write(6,input) - write(6,*)' ' - write(6,*)'gesanl = ', gesanl - write(6,*)'imkdata = ', imkdata - - if ( trim(gesanl) == 'anl' ) then - ftype(3) = 'omanbc' - ftype(5) = 'omabc' - ftype(6) = 'omanbc2' - ftype(8) = 'omabc2' - endif - - surf_nregion = 5 - if ( trim(rad_area) == 'rgn' ) then - surf_nregion = 1 - endif - - nregion=surf_nregion - write(6,*)'surf_nregion = ', surf_nregion - - - nregion=surf_nregion - -! Ensure number of requested regions does not exceed specified upper limit - if (nregion>mregion) then - write(6,*)'***ERROR*** too many regions specified' - write(6,*)' maximum allowed: mregion=',mregion - write(6,*)' user requested: nregion=',nregion - call errexit(91) - endif - - -! Create filenames for diagnostic input, binary output file - write(stringd,100) iyy,imm,idd,ihh -100 format('.',i4.4,3i2.2) - - if ( trim(gesanl) == 'ges' ) then - diag_rad = trim(satname) - data_file= trim(satname) // trim(stringd) // '.ieee_d' - ctl_file = trim(satname) // '.ctl' - else - diag_rad = trim(satname) // '_anl' - data_file= trim(satname) // '_anl' // trim(stringd) // '.ieee_d' - ctl_file = trim(satname) // '_anl.ctl' - endif - - write(6,*)'diag_rad =',diag_rad - write(6,*)'data_file=',data_file - write(6,*)'ctl_file =',ctl_file - write(6,*)'suffix =',suffix - -! Open unit to diagnostic file. Read portion of -! header to see if file exists - open(lndiag,file=diag_rad,form='unformatted') - read(lndiag,err=900,end=900) dum - rewind lndiag - -! File exists. Read header - call get_radiag ('version',ver,ier) - write(6,*)'read_diag version = ', ver, ier - - write(6,*)'call read_diag_header' - call read_radiag_header( lndiag, npred_radiag, retrieval, header_fix,& - header_chan, data_name, iflag ) - if( iflag/=0 ) then - write(6,*)'***ERROR*** problem reading diag file header, iflag=',iflag - call errexit(91) - endif - -! Extract observation type, satellite id, and number of channels - satype = header_fix%obstype - satsis = header_fix%isis - dplat = header_fix%id - n_chan = header_fix%nchan - - string = trim(satype)//'_'//trim(dplat) - write(6,*)'string,satname=',string,' ',satname - if ( trim(string) /= trim(satname) ) then - write(6,*)'***ERROR*** inconsistent instrument types' - write(6,*)' satname,string =',satname,' ',string - call errexit(92) - endif - -! -! initialize data integrity check flags, open output file for email warning(s) -! - date = stringd(2:9) - cycle = stringd(10:11) - -! call open_bad_obs_file( date, cycle, ios ) - if ( trim(gesanl) == 'ges' ) then - call open_bad_penalty_file( date, cycle, ios ) - call open_bad_chan_file( date, cycle, ios ) - - call load_base( satname, ios ) - endif - - -! Allocate arrays to hold observational information - allocate (io_chan(n_chan), nu_chan(n_chan), wavenumbr(n_chan)) - allocate (tot_cor(n_chan,mregion,2), omg_nbc(n_chan,mregion,2), & - omg_bc(n_chan,mregion,2), count(n_chan,mregion), & - penalty(n_chan,mregion), test_pen(n_chan,mregion), & - error(n_chan,mregion), use(n_chan,mregion), & - frequency(n_chan,mregion), channel_count(n_chan)) - -! Zero accumulator arrays - do ii=1,2 - do k=1,mregion - do j=1,n_chan - if (ii==1) then - count(j,k) = 0.0 - penalty(j,k) = 0.0 - if( j==1) then - channel_count = 0.0 - endif - endif - tot_cor(j,k,ii) = 0.0 - omg_nbc(j,k,ii) = 0.0 - omg_bc(j,k,ii) = 0.0 - end do - end do - end do - - -! Extract satinfo relative index - do j=1,n_chan - nu_chan(j) = real( header_chan(j)%nuchan, 4 ) - io_chan(j) = real( header_chan(j)%iochan, 4 ) - wavenumbr(j) = real( header_chan(j)%wave, 4 ) - end do - do k=1,mregion - do j=1,n_chan - error(j,k) = real( header_chan(j)%varch, 4) - use(j,k) = real( header_chan(j)%iuse, 4 ) - frequency(j,k) = real( header_chan(j)%freq, 4) - end do - end do - - -! Create control file - if ( imkctl == 1 ) then - write(6,*)'call create_ctl_time' - - if ( trim(gesanl) == 'ges' ) then - dfile = trim(satname) - else - dfile = trim(satname) // '_anl' - endif - - call create_ctl_time(ntype,ftype,n_chan,iyy,imm,idd,ihh,idhh,& - incr,ctl_file,lunctl,rmiss,dfile,satype,dplat,nregion,& - region,rlonmin,rlonmax,rlatmin,rlatmax,nu_chan,use(1,1),& - error(1,1),frequency(1,1),wavenumbr,little_endian) - endif - - nwater = 0; nnwater=0 - nice = 0 - nsnow = 0; nnsnow=0 - nland = 0; nnland=0 - nmixed = 0; nnmixed=0 - ntotal = 0 - -! Loop to read entries in diagnostic file - if ( imkdata == 1 ) then - iflag = 0 - loopd: do while (iflag == 0) - -! Read a record. If read flag, iflag does not equal zero, exit loopd - call read_radiag_data( lndiag, header_fix, retrieval, data_fix, data_chan,& - data_extra, iflag ) - if( iflag /= 0 ) exit loopd - iread=iread+1 - -! Extract observation location. -! Convert (0-360) lon to (-180,180) - rlat = data_fix%lat - rlon = data_fix%lon - if (rlon>180.) rlon = rlon - 360. - rread = rread +1.0 - -! Detemine which subdomains the observation falls into. -! These are now based on surface type, not geography. All -! obs match global (surf_region 1). - - ii=0; jsub=0; - jsub(1)=iglobal - nreg=1 - - if ( nregion > 1 ) then - if ( data_fix%land_frac > 0.99 ) then - jsub(2)=iland - nreg=2 - nnland=nnland+1 - else if ( data_fix%water_frac > 0.99 ) then - jsub(2)=iwater - nreg=2 - nnwater=nnwater+1 - else if (( data_fix%snow_frac > 0.99 ) .OR. ( data_fix%ice_frac > 0.99 )) then - jsub(2)=isnowice - nreg=2 - nnsnow=nnsnow+1 - else - jsub(2)=imixed - nreg=2 - nnmixed=nnmixed+1 - write(6,*)'data_fix%land_frac,water,snow,ice = ',data_fix%land_frac, data_fix%water_frac, data_fix%snow_frac, data_fix%ice_frac - end if - end if - - -! Channel loop - do j = 1, n_chan - -! If observation was assimilated, accumulate sums in appropriate regions - if (data_chan(j)%errinv > 1.e-6) then -! pen = data_chan(j)%errinv*(data_chan(j)%omgbc)**2 - pen = (data_chan(j)%errinv*(data_chan(j)%omgbc))**2 - cor_tot(1) = (data_chan(j)%omgnbc - data_chan(j)%omgbc) - nbc_omg(1) = - data_chan(j)%omgnbc - bc_omg(1) = - data_chan(j)%omgbc - - cor_tot(2) = (data_chan(j)%omgnbc - data_chan(j)%omgbc)**2 - nbc_omg(2) = (data_chan(j)%omgnbc)**2 - bc_omg(2) = (data_chan(j)%omgbc)**2 - - do i=1,nreg - k=jsub(i) - - count(j,k) = count(j,k) + 1.0 - penalty(j,k) = penalty(j,k) + pen - channel_count(j) = channel_count(j) + 1.0 - - do ii=1,2 - tot_cor(j,k,ii) = tot_cor(j,k,ii) + cor_tot(ii) - omg_nbc(j,k,ii) = omg_nbc(j,k,ii) + nbc_omg(ii) - omg_bc(j,k,ii) = omg_bc(j,k,ii) + bc_omg(ii) - end do - - end do - - endif - - enddo ! channel loop - - -! End of loop over diagnostic file - enddo loopd - - - write(6,*)' ' - write(6,*)'read in ',iread,' obs ',rread - write(6,*)' ' - -! -! Compute average and standard deviation -! - do k=1,nregion - do j=1,n_chan - - ! --- validate the count value for region 1 (global) - ! -! if ( use(j,k) > 0.0 .AND. k == 1 .AND. imkdata == 1 ) then -! call validate_count( j, k, count(j,k), valid_count, iret ) -! write (*,*) ' valid_count, iret = ', valid_count, iret -! if ( (iret == 0) .AND. (valid_count .eqv. .FALSE.) ) then -! write (*,*) ' calling write_bad_obs ' -! call write_bad_obs( satname, nu_chan(j), k, count(j,k) ) -! end if -! end if - - if (count(j,k)>0) then - test_pen(j,k)=penalty(j,k)/count(j,k) - - !--- check for valid penalty value for region 1 (global) - ! - if ( use(j,k) > 0.0 .AND. k == 1 .AND. imkdata == 1 .AND. trim(gesanl) == 'ges' ) then - call validate_penalty( j, k, test_pen(j,k), valid_penalty, bound, iret ) - if( (iret == 0) .AND. (valid_penalty .eqv. .FALSE.) ) then - call write_bad_penalty( satname, nu_chan(j), k, test_pen(j,k), bound ) - endif - endif - - else - count(j,k)=rmiss - penalty(j,k)=rmiss - endif - - end do - end do - -! -! Check each assimilated channel to see if we -! have a 0 count (no obs) for that channel. If so, report -! it using write_bad_chan(). -! - -! -! This is for testing purposes only -! channel_count(1) = 0.0 -! write(6,*)' header_chan(j)%iuse, channel_count(1) = ', header_chan(1)%iuse, channel_count(1) -! - do j=1,n_chan -! write(6,*)' j, header_chan(j)%iuse, channel_count(j) = ', j, header_chan(j)%iuse, channel_count(j) -! if( header_chan(j)%iuse > 0.0 ) then -! write(6,*)' header_chan(j)%iuse > 0.0', header_chan(j)%iuse -! else -! write(6,*)' header_chan(j)%iuse <= 0.0', header_chan(j)%iuse -! endif - -! if( channel_count(j) < 1.0 ) then -! write(6,*)' channel_count(j) < 1.0', channel_count(j) -! else -! write(6,*)' channel_count(j) >= 1.0', channel_count(j) -! endif - - if( header_chan(j)%iuse > 0.0 .and. channel_count(j) < 1.0 .AND. trim(gesanl) == 'ges' ) then - write(6,*)' calling write_bad_chan, satname, j, nu_chan(j) = ', satname, j, nu_chan(j) - call write_bad_chan( satname, nu_chan(j) ) - end if ! if header_chan%iuse - - end do ! channel loop - - if ( trim(gesanl) == 'ges' ) then -! call close_bad_obs_file() - call close_bad_penalty_file() - call close_bad_chan_file() - endif - - -! Write output to binary output file - - write(6,*)' ' - open(lungrd,file=data_file,form='unformatted') - write(lungrd) ((count(j,k),j=1,n_chan),k=1,nregion) - write(lungrd) ((penalty(j,k),j=1,n_chan),k=1,nregion) - do ii=1,2 - write(lungrd) ((omg_nbc(j,k,ii),j=1,n_chan),k=1,nregion) - write(lungrd) ((tot_cor(j,k,ii),j=1,n_chan),k=1,nregion) - write(lungrd) ((omg_bc (j,k,ii),j=1,n_chan),k=1,nregion) - end do - write(6,*)'write output to lungrd=',lungrd,', file=',trim(data_file) - close(lungrd) - endif - -! Deallocate arrays - write(6,*)' ' - write(6,*)'deallocate arrays' - deallocate(io_chan,nu_chan,wavenumbr,tot_cor,omg_nbc,omg_bc,count,& - penalty,error,use,frequency) - goto 950 - -! Jump to here if eof or error reading diagnostic file. -900 continue - write(6,*)'***PROBLEM reading diagnostic file. diag_rad=',diag_rad - close(lndiag) - - n_chan=nchanl - if (n_chan<=0) then - write(6,*)'***ERROR*** invalid nchanl=',nchanl,' STOP program' - call errexit(93) - endif - - write(6,*)'load missing value ',rmiss,' into output arrays. ',& - nregion,n_chan - allocate(count(n_chan,nregion),penalty(n_chan,nregion),& - omg_nbc(n_chan,nregion,2),tot_cor(n_chan,nregion,2),& - omg_bc(n_chan,nregion,2)) - do ii=1,2 - do k=1,nregion - do j=1,n_chan - if (ii==1) then - count(j,k) = rmiss - penalty(j,k)= rmiss - endif - omg_nbc(j,k,ii) = rmiss - tot_cor(j,k,ii) = rmiss - omg_bc(j,k,ii) = rmiss - end do - end do - end do - - if ( imkdata == 1 ) then - open(lungrd,file=data_file,form='unformatted') - write(lungrd) ((count(j,k),j=1,n_chan),k=1,nregion) - write(lungrd) ((penalty(j,k),j=1,n_chan),k=1,nregion) - do ii=1,2 - write(lungrd) ((omg_nbc(j,k,ii),j=1,n_chan),k=1,nregion) - write(lungrd) ((tot_cor(j,k,ii),j=1,n_chan),k=1,nregion) - write(lungrd) ((omg_bc (j,k,ii),j=1,n_chan),k=1,nregion) - end do - write(6,*)'write output to lungrd=',lungrd,', file=',trim(data_file) - close(lungrd) - endif - deallocate(count,penalty,omg_nbc,tot_cor,omg_bc) - -! End of program -950 continue - stop -end program time diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radtime.fd/valid.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radtime.fd/valid.f90 deleted file mode 100755 index ffae19c452..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radtime.fd/valid.f90 +++ /dev/null @@ -1,288 +0,0 @@ -!$$$ subprogram documentation block -! . . . -! subprogram: valid validate the obs and penalty values -! prgmmr: safford date: 2009-12 -! -! abstract: This module contains code to read a given satellite's -! base file and then validate new obs(count) and penalty -! values by comparing them to the baseline values. -! -! program history log: -! 2009-12-07 safford - initial coding -! -! contains: -! -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ - -module valid - - implicit none - - private - -! --- module routines - public :: load_base - public :: validate_count - public :: validate_penalty - -! --- module parameters - integer, parameter :: funit = 17 - real,parameter :: rmiss = -999.0 - -! --- module vars - logical :: base_loaded = .FALSE. - integer :: nchan, nregion, j, k, dummy - - real,allocatable,dimension(:,:):: avg_count, sdv_count - real,allocatable,dimension(:,:):: min_count, max_count - real,allocatable,dimension(:,:):: avg_penalty, sdv_penalty - real,allocatable,dimension(:,:):: min_penalty, max_penalty - - integer,allocatable,dimension(:):: nu_chan - - contains - - !------------------------------------------------------------- - ! load the base file for the given satellite - !------------------------------------------------------------- - - subroutine load_base( satname, iret ) - - !--- interface - character(20), intent( in ) :: satname - integer, intent( out ) :: iret - - !--- variables - character(20) fname - character(20) test_satname - character(10) base_date - - integer fios - integer chan, region - - logical fexist - - - !--- initialization - iret = -1 - fname = trim(satname) // '.base' - fexist = .FALSE. - - write(*,*) '--> valid, satname, fname = ', satname, fname - - !--- verify file exists and open the file - inquire( file = fname, exist = fexist ) - if( fexist .eqv. .FALSE. ) then - fios = -1 - else - open( UNIT=funit, FILE=fname, IOSTAT=fios ) - write(*,*) ' fios = ', fios - end if - - if( fios == 0 ) then - !--- read the file header - read(funit,*) test_satname, base_date, nchan, nregion - write(*,*) ' test_satname, base_date, nchan, nregion = ', test_satname, base_date, nchan, nregion - - allocate( avg_count(nchan,nregion), sdv_count(nchan,nregion), & - avg_penalty(nchan,nregion), sdv_penalty(nchan,nregion), & - min_count(nchan,nregion), max_count(nchan,nregion), & - min_penalty(nchan,nregion), max_penalty(nchan,nregion) ) - - ! --- set all missing - do k=1,nregion - do j=1,nchan - avg_count(j,k) = rmiss - sdv_count(j,k) = rmiss - min_count(j,k) = rmiss - max_count(j,k) = rmiss - avg_penalty(j,k) = rmiss - sdv_penalty(j,k) = rmiss - min_penalty(j,k) = rmiss - max_penalty(j,k) = rmiss - end do - end do - - do k=1,nregion - do j=1,nchan - read(funit,*) chan, region, avg_count(j,k), sdv_count(j,k), min_count(j,k), max_count(j,k), & - avg_penalty(j,k), sdv_penalty(j,k), min_penalty(j,k), max_penalty(j,k) - end do - end do - -! write(*,*) 'chan 18, region 2, avg_count(18,1), sdv_count(18,1), avg_penalty(18,1), sdv_penalty(18,1) = ', & -! avg_count(18,1), sdv_count(18,1), avg_penalty(18,1), sdv_penalty(18,1) - - iret = 0 - base_loaded = .TRUE. - else - write(*,*) 'unable to load fname for data error checking' - end if - - end subroutine load_base - - - !--------------------------------------------------------------- - ! validate a count - ! given a count value for a channel and region, determine - ! if the count is within +/- 2*sdv - ! - ! iret 0 = normal - ! -1 = invalid channel - ! -2 = invalid region - ! 1 = base file wasn't loaded, unable to validate - !--------------------------------------------------------------- - subroutine validate_count( channel, region, count, valid, iret ) - - !--- interface - integer, intent( in ) :: channel - integer, intent( in ) :: region - real, intent( in ) :: count - logical, intent( out ) :: valid - integer, intent( out ) :: iret - - !--- vars - real cnt, hi, lo, sdv2 - - write(*,*) '--> validate_count, channel, region, count ', channel, region, count - !--- initialize vars - iret = 0 - cnt = count - valid = .FALSE. - - if( base_loaded .eqv. .TRUE. ) then - if( channel < 1 .OR. channel > nchan ) then - iret = -1 - write(*,*) 'attempt to validate channel out of range', channel - else if( region < 1 .OR. region > nregion ) then - iret = -2 - write(*,*) 'attempt to validate region out of range', region - else - ! - ! all unassimilated channels in the base files will have an rmiss - ! value and are considered valid for verification purposes - ! - if( avg_count(channel,region) < 0.0 ) then - valid = .TRUE. - else - sdv2 = 2 * sdv_count( channel, region ) - hi = avg_count(channel,region) + sdv2 - lo = avg_count(channel,region) - sdv2 - - ! - ! Consider any count valid if: - ! cnt is 2 sdvs from avg or - ! cnt is within the established min/max range for chan,region - ! - if( cnt > 0.0 ) then - valid = .TRUE. - end if - !if( cnt <= hi .AND. cnt >= lo ) then - ! valid = .TRUE. - !else if( (cnt > 0) .AND. (cnt >= min_count( channel,region )) .AND. & - ! (cnt <= max_count( channel,region )) ) then - ! valid = .TRUE. - !end if - end if - - end if - - if ( valid .eqv. .FALSE. ) then - write(*,*) ' avg_count(channel,region), sdv2, hi, lo = ', avg_count(channel,region), sdv2, hi, lo - end if - write (*,*) '<-- valid, iret=', valid, iret - else - !--- base file was not loaded, so return a warning that validation isn't possible - iret = 1 - end if - end subroutine validate_count - - - !------------------------------------------------------------- - ! validate a penalty value - ! given a penalty value for a channel and region, determine - ! if the penalty is within +/- 2*sdv - ! - ! iret 0 = normal - ! -1 = invalid channel - ! -2 = invalid region - !------------------------------------------------------------- - subroutine validate_penalty( channel, region, penalty, valid, bound, iret ) - - !--- interface - integer, intent( in ) :: channel - integer, intent( in ) :: region - real, intent( in ) :: penalty - logical, intent( out ) :: valid - real, intent( out ) :: bound - integer, intent( out ) :: iret - - !--- vars - real hi, lo, sdv2 - - write(*,*) '--> validate_penalty, channel, region, penalty ', channel, region, penalty - - !--- initialize vars - iret = 0 - valid = .FALSE. - bound = rmiss - - if( base_loaded .eqv. .TRUE. ) then - if( channel < 1 .OR. channel > nchan ) then - iret = -1 - write(*,*) 'attempt to validate channel out of range', channel - else if( region < 1 .OR. region > nregion ) then - iret = -2 - write(*,*) 'attempt to validate region out of range', region - else - ! - ! all unassimilated channels in the base files will have an rmiss - ! value and are considered valid for verification purposes - ! - bound = max_penalty( channel,region ) - - if( avg_penalty(channel,region) < 0.0 ) then - valid = .TRUE. - else - sdv2 = 2 * sdv_penalty( channel, region ) - hi = avg_penalty(channel,region) + sdv2 - lo = avg_penalty(channel,region) - sdv2 - - ! - ! Consider any penalty value valid if: - ! penalty is 2 sdvs from avg or - ! penalty is greater than the established max range for - ! chan,region by 20% or more --> idea here is to stage - ! two levels of warning, say a 20% exceedence and then - ! maybe a 25% or 30% exceedence for a yellow and red - ! level warning. - ! - if( (penalty >= 0.0) .AND. penalty <= hi ) then - valid = .TRUE. - else if( (penalty > 0.0) .AND. & - (penalty <= (max_penalty( channel,region )*1.2) ) ) then - valid = .TRUE. - !else if( penalty > hi ) then - ! bound = max_penalty( channel,region ) - end if - - end if - end if - - if ( valid .eqv. .FALSE. ) then - write(*,*) ' BAD: penalty, avg_penalty(channel,region), sdv2, hi, lo, bound = ', penalty, avg_penalty(channel,region), sdv2, hi, lo, bound - end if - write (*,*) '<-- valid, iret=', valid, iret - else - !--- base file was not loaded, so return a warning that validation isn't possible - iret = 1 - end if - end subroutine validate_penalty - - -end module valid diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/ush/radmon_ck_stdout.sh b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/ush/radmon_ck_stdout.sh deleted file mode 100755 index a918c9204f..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/ush/radmon_ck_stdout.sh +++ /dev/null @@ -1,112 +0,0 @@ -#!/bin/ksh - -################################################################################ -#### UNIX Script Documentation Block -# . . -# Script name: radmon_ck_stdout.sh -# Script description: Scan stdout files for problems reading the diagnostic -# files. -# -# Author: Ed Safford Org: NP23 Date: 2012-02-02 -# -# Abstract: This script scans the stdout files produced by the radmon_time -# executable for problems reading the diagnostic files. -# -# This script is a child script of radmon_verf_time.sh. The parent -# script generates the stdout files which this script examines. -# -# -# Script history log: -# 2012-02-02 Safford initial script -# -# Usage: radmon_ck_stdout.sh outfile -# -# Input script positional parameters: -# outfile output file name -# required -# -# Imported Shell Variables: -# SATYPE list of satellite/instrument sources -# defaults to none -# VERBOSE Verbose flag (YES or NO) -# defaults to NO -# -# Exported Shell Variables: -# err Last return code -# -# Modules and files referenced: -# scripts : -# -# programs : -# -# fixed data : -# -# input data : $data_file -# -# output data: $outfile -# -# Remarks: -# -# Condition codes -# 0 - no problem encountered -# >0 - some problem encountered -# -# Control variable resolution priority -# 1 Command line argument. -# 2 Environment variable. -# 3 Inline default. -# -# Attributes: -# Language: POSIX shell -# Machine: IBM SP -#################################################################### -export scr=radmon_ck_stdout.sh -msg="${scr} HAS STARTED" -postmsg "$jlogfile" "$msg" - - -# Command line arguments. -outfile=${1:-${outfile:?}} - -# Other variables -SATYPE=${SATYPE:-} -err=0 - -if [[ "$VERBOSE" = "YES" ]]; then - set -ax - echo "$(date) executing $0 $* >&2" -fi -################################################################################ -# Preprocessing - -outfile=$1 -error_msg="PROBLEM reading diagnostic file" - -for type in ${SATYPE}; do - if [[ "$VERBOSE" = "YES" ]]; then - echo ${type} - fi - if [[ -s "stdout.${type}" ]]; then - if [[ "$VERBOSE" = "YES" ]]; then - echo stdout.${type} - fi - match=`gawk "/$error_msg/" stdout.$type` - - match_len=`echo ${#match}` - if [[ $match_len > 0 ]]; then - echo "${type} ${match}" >> $outfile - fi - fi -done - -################################################################################ -# Post processing -if [[ "$VERBOSE" = "YES" ]]; then - echo $(date) EXITING $0 with error code ${err} >&2 -fi - -msg="${scr} HAS ENDED" -postmsg "$jlogfile" "$msg" - -set +x -exit ${err} diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/ush/radmon_err_rpt.sh b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/ush/radmon_err_rpt.sh deleted file mode 100755 index 17a0f97308..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/ush/radmon_err_rpt.sh +++ /dev/null @@ -1,238 +0,0 @@ -#!/bin/ksh - -################################################################################ -#### UNIX Script Documentation Block -# . . -# Script name: radmon_err_rpt.sh -# Script description: Compare the contents of error files from two different -# cycles. -# -# Author: Ed Safford Org: NP23 Date: 2012-02-02 -# -# Abstract: This script compares the contents of two error files from two different -# sets of radiance diagnostic files (which are an output from GSI runs). -# All unique satellite instrument/channel/region combinations that appear -# in both files are reported. -# -# This script is a child script of radmon_verf_time.sh. The parent -# script creates/copies the error files into a temporary working -# directory before invoking this script. -# -# -# Script history log: -# 2012-02-02 Safford initial script -# -# Usage: radmon_err_rpt.sh file1 file2 type cycle1 cycle2 diag_rpt outfile -# -# Input script positional parameters: -# file1 obs, penalty, or channel error file -# required -# file2 obs, penalty, or channel error file -# required -# type type of error file -# choises are obs, pen, or chan; required -# cycle1 first cycle processing date -# yyyymmddcc format; required -# cycle2 second cycle processing date -# yyyymmddcc format; required -# diag_rpt diagnostic report text file -# required -# outfile output file name -# required -# -# Imported Shell Variables: -# -# HOMEradmon package's nwprod subdirectory -# defaults to pwd -# VERBOSE Verbose flag (YES or NO) -# defaults to NO -# -# Exported Shell Variables: -# err Last return code -# -# Modules and files referenced: -# scripts : -# -# programs : radmon_getchgrp.pl -# -# -# fixed data : $ctlfile -# -# input data : $file1 -# $file2 -# -# output data: $outfile -# -# Remarks: -# -# Condition codes -# 0 - no problem encountered -# >0 - some problem encountered -#################################################################### -export scr=radmon_err_rpt.sh - -msg="${scr} HAS STARTED" -postmsg "$jlogfile" "$msg" - -# Command line arguments. -file1=${1:-${file1:?}} -file2=${2:-${file2:?}} -type=${3:-${type:?}} -cycle1=${4:-${cycle1:?}} -cycle2=${5:-${cycle2:?}} -diag_rpt=${6:-${diag_rpt:?}} -outfile=${7:-${outfile:?}} - -# Directories -HOMEradmon=${HOMEradmon:-$(pwd)} - -# Other variables -VERBOSE=${VERBOSE:-NO} -err=0 -SUFFIX=${SUFFIX} - -if [[ "$VERBOSE" = "YES" ]]; then - echo EXECUTING $0 $* >&2 - set -ax -fi - - -have_diag_rpt=0 -if [[ -s $diag_rpt ]]; then - have_diag_rpt=1 -else - err=1 -fi - - -#----------------------------------------------------------------------------- -# read each line in the $file1 -# search $file2 for the same satname, channel, and region -# if same combination is in both files, add the values to the output file -# -{ while read myline;do - bound="" - - echo $myline - satname=`echo $myline | gawk '{print $1}'` - echo satname = $satname - channel=`echo $myline | gawk '{print $3}'` - echo channel = $channel - region=`echo $myline | gawk '{print $5}'` - echo region = $region - value1=`echo $myline | gawk '{print $7}'` - echo value1 = $value1 - bound=`echo $myline | gawk '{print $9}'` - -# -# Check findings against diag_report. If the satellite/instrument is on the -# diagnostic report it means the diagnostic file file for the -# satelite/instrument is missing for this cycle, so skip any additional -# error checking for that source. Otherwise, evaluate as per normal. -# - - diag_match="" - diag_match_len=0 - - if [[ $have_diag_rpt == 1 ]]; then - diag_match=`gawk "/$satname/" $diag_rpt` - diag_match_len=`echo ${#diag_match}` - fi - - - if [[ $diag_match_len == 0 ]]; then - - if [[ $type == "chan" ]]; then - match=`gawk "/$satname/ && /channel= $channel/" $file2` - else - match=`gawk "/$satname/ && /channel= $channel / && /region= $region /" $file2` - echo match = $match - - match_len=`echo ${#match}` - if [[ $match_len > 0 ]]; then - channel2=`echo $match | gawk '{print $3}'` - echo channel2 = $channel2 - if [[ $channel2 != $channel ]]; then - match="" - fi - fi - echo match = $match - fi - match_len=`echo ${#match}` - - if [[ $match_len > 0 ]]; then - echo $match_len - value2=`echo $match | gawk '{print $7}'` - bound2=`echo $match | gawk '{print $9}'` - - if [[ $type == "chan" ]]; then - tmpa="$satname channel= $channel" - tmpb="" - - elif [[ $type == "pen" ]]; then - tmpa="$satname channel= $channel region= $region" - tmpb="$cycle1 $value1 $bound" - - else - tmpa="$satname channel= $channel region= $region" - tmpb="$cycle1: $type= $value1" - fi - - line1="$tmpa $tmpb" - echo "$line1" >> $outfile - - if [[ $type != "chan" ]]; then - tmpc=`echo $tmpa |sed 's/[a-z]/ /g' | sed 's/[0-9]/ /g' | sed 's/=/ /g' | sed 's/_/ /g' | sed 's/-/ /g'` - - if [[ $type == "pen" ]]; then - line2=" $tmpc $cycle2 $value2 $bound2" - else - line2=" $tmpc $cycle2: $type= $value2" - fi - - echo "$line2" >> $outfile - fi - - #---------------------------------------------------------- - # Access the control file to deterimine channel grouping - # number. Not all sources have consecutively numbered - # channels, and we need to map the channel to the correct - # grouping number in order to produce an accurate hyperlink. - # - # Update: with the new js plotting the actual channel number - # can be sent. This applies to all glb sources now; it's not - # yet implemented for regional sources. - if [[ $RAD_AREA == 'glb' ]]; then - changrp=${channel} - echo "for glb using actual channel as changrp value" - else - ctlfile="time.${satname}.ctl" - if [[ -s ${ctlfile}.Z || -s ${ctlfile}.gz ]]; then - uncompress ${ctlfile}.* - fi - changrp=`${HOMEradmon}/ush/radmon_getchgrp.pl ${ctlfile} ${channel}` - fi - echo changrp = $changrp - - line3=" http://www.emc.ncep.noaa.gov/gmb/gdas/radiance/esafford/${SUFFIX}/index.html?sat=${satname}®ion=${region}&channel=${changrp}&stat=${type}" - if [[ $changrp -gt 0 ]]; then - echo "$line3" >> $outfile - echo "" >> $outfile - fi - fi - fi -done } < $file1 - - -################################################################################ -# Post processing -if [[ "$VERBOSE" = "YES" ]]; then - echo $(date) EXITING $0 with error code ${err} >&2 -fi - -msg="${scr} HAS ENDED" -postmsg "$jlogfile" "$msg" - -set +x -exit ${err} - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/ush/radmon_getchgrp.pl b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/ush/radmon_getchgrp.pl deleted file mode 100755 index 890beb15a7..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/ush/radmon_getchgrp.pl +++ /dev/null @@ -1,82 +0,0 @@ -#! /usr/bin/perl - -################################################################################ -#### Perl Script Documentation Block -# . . -# Script name: radmon_getchgrp.pl -# Script description: Find the channel grouping number for a given setllite and -# channel. -# -# Author: Ed Safford Org: NP23 Date: 2012-02-02 -# -# Abstract: This script determines the channel grouping number for a given -# satellite and channel number. Most, but not all satellite sources -# have consecutively numbered channels. This script locates the -# channel and determines in which block of images that channel would be -# located. -# -# -# Script history log: -# 2012-02-02 Safford initial script -# -# Usage: radmon_getchgrp.pl ctl_file channel -# -# Input script positional parameters: -# ctl_file meta-data file -# required -# channel satellite/instrument channel number -# required -# -# output data: $chan_grp -# -# -# Remarks: -# -# Condition codes -# 0 - no problem encountered -# >0 - some problem encountered -# -# Control variable resolution priority -# 1 Command line argument. -# -# Attributes: -# Language: Perl script -# Machine: IBM SP -#################################################################### - -$numArgs = $#ARGV + 1; - -if( $numArgs < 2 ) { - print" Usage: \n"; - print" radmon_gtchgrp.pl sat_control_file, channel \n"; - exit(1); -} -else { - $ctl_file = @ARGV[0]; - $channel = @ARGV[1]; -} - -#---------------------------------------------------------- -# Load the control file -#---------------------------------------------------------- -open( CTLFILE, $ctl_file ) or die "Can't open $ctl_file \n"; - -$chan_grp = 0; -$ctr = 0; - -while( $line = ) { - if ( $line =~ m/iuse/ ) { - $ctr+=1; - @fields = split ' ', $line; - if( $fields[4] == $channel ) { - $chan_grp = int( $ctr/4 ); - if( $ctr % 4 > 0 ) { - $chan_grp +=1; - break; - } - } - } -} - -print "$chan_grp\n"; -close CTLFILE; diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/ush/radmon_verf_angle.sh b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/ush/radmon_verf_angle.sh deleted file mode 100755 index 1e0de091cf..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/ush/radmon_verf_angle.sh +++ /dev/null @@ -1,241 +0,0 @@ -#!/bin/ksh - -################################################################################ -#### UNIX Script Documentation Block -# . . -# Script name: radmon_verf_angle.sh -# Script description: Extract angle dependent data from radiance -# diagnostic files. -# -# Author: Ed Safford Org: NP23 Date: 2012-02-02 -# -# Abstract: This script extracts angle dependent data from radiance -# diagnostic files (which are an output from GSI runs), -# storing the extracted data in small binary files. -# -# This script is a child script of exgdas_vrfyrad.sh.sms. The parent -# script opens and uncompresses the radiance diagnostic file and copies -# other supporting files into a temporary working directory. -# -# -# Usage: radmon_verf_angle.sh PDATE -# -# Input script positional parameters: -# PDATE processing date -# yyyymmddcc format; required -# -# Imported Shell Variables: -# SUFFIX data source suffix -# defauls to opr -# MAKE_CTL switch to construct the meta-data control file -# defaults to 1 (on) -# MAKE_DATA switch to construct the binary data file -# defaults to 1 (on) -# EXECradmon executable directory -# defaults to current directory -# RAD_AREA global or regional flag -# defaults to global -# TANKverf_rad data repository -# defaults to current directory -# SATYPE list of satellite/instrument sources -# defaults to none -# VERBOSE Verbose flag (YES or NO) -# defaults to NO -# LITTLE_ENDIAN flag to indicate LE machine -# defaults to 0 (big endian) -# USE_ANL use analysis files as inputs in addition to -# the ges files. Default is 0 (ges only) -# -# Modules and files referenced: -# scripts : -# -# programs : $NCP -# $angle_exec -# -# fixed data : $scaninfo -# -# input data : $data_file -# -# output data: $angle_file -# $angle_ctl -# $pgmout -# -# Remarks: -# -# Condition codes -# 0 - no problem encountered -# >0 - some problem encountered -# -#################################################################### -# Command line arguments. -export PDATE=${1:-${PDATE:?}} - -scr=radmon_verf_angle.sh -msg="${scr} HAS STARTED" -postmsg "$jlogfile" "$msg" - -which prep_step -which startmsg - -if [[ "$VERBOSE" = "YES" ]]; then - set -ax -fi - -# Directories -FIXgdas=${FIXgdas:-$(pwd)} -EXECradmon=${EXECradmon:-$(pwd)} -TANKverf_rad=${TANKverf_rad:-$(pwd)} - -# File names -export pgmout=${pgmout:-${jlogfile}} -touch $pgmout - -# Other variables -MAKE_CTL=${MAKE_CTL:-1} -MAKE_DATA=${MAKE_DATA:-1} -RAD_AREA=${RAD_AREA:-glb} -SATYPE=${SATYPE:-} -VERBOSE=${VERBOSE:-NO} -LITTLE_ENDIAN=${LITTLE_ENDIAN:-0} -USE_ANL=${USE_ANL:-0} - -if [[ $USE_ANL -eq 1 ]]; then - gesanl="ges anl" -else - gesanl="ges" -fi - -err=0 -angle_exec=radmon_angle -scaninfo=scaninfo.txt - - -#-------------------------------------------------------------------- -# Copy extraction program and supporting files to working directory - -$NCP ${EXECradmon}/${angle_exec} ./ -$NCP $FIXgdas/gdas_radmon_scaninfo.txt ./${scaninfo} - -if [[ ! -s ./${angle_exec} || ! -s ./${scaninfo} ]]; then - err=2 -else -#-------------------------------------------------------------------- -# Run program for given time - - export pgm=${angle_exec} - - iyy=`echo $PDATE | cut -c1-4` - imm=`echo $PDATE | cut -c5-6` - idd=`echo $PDATE | cut -c7-8` - ihh=`echo $PDATE | cut -c9-10` - - ctr=0 - fail=0 - touch "./errfile" - - for type in ${SATYPE}; do - - for dtype in ${gesanl}; do - - echo "pgm = $pgm" - echo "pgmout = $pgmout" - -# prep_step - /nwprod2/util/ush/prep_step.sh - - ctr=`expr $ctr + 1` - - if [[ $dtype == "anl" ]]; then - data_file=${type}_anl.${PDATE}.ieee_d - angl_file=angle.${data_file} - ctl_file=${type}_anl.ctl - angl_ctl=angle.${ctl_file} - stdout_file=stdout.${type}_anl - angl_stdout=angle.${stdout_file} - input_file=${type}_anl - else - data_file=${type}.${PDATE}.ieee_d - angl_file=angle.${data_file} - ctl_file=${type}.ctl - angl_ctl=angle.${ctl_file} - stdout_file=stdout.${type} - angl_stdout=angle.${stdout_file} - input_file=${type} - fi - - rm input - - - # Check for 0 length data file here and avoid running - # the executable if $data_file doesn't exist or is 0 bytes - # - if [[ -s $input_file ]]; then - nchanl=-999 -cat << EOF > input - &INPUT - satname='${type}', - iyy=${iyy}, - imm=${imm}, - idd=${idd}, - ihh=${ihh}, - idhh=-720, - incr=6, - nchanl=${nchanl}, - suffix='${SUFFIX}', - imkctl=${MAKE_CTL}, - imkdata=${MAKE_DATA}, - gesanl='${dtype}', - little_endian=${LITTLE_ENDIAN}, - rad_area='${RAD_AREA}', - / -EOF - - startmsg - ./${angle_exec} < input >> ${pgmout} 2>>errfile - export err=$?; err_chk - if [[ $? -ne 0 ]]; then - fail=`expr $fail + 1` - fi - -#------------------------------------------------------------------- -# move data, control, and stdout files to $TANKverf_rad and compress - - if [[ -s ${data_file} ]]; then - mv ${data_file} ${angl_file} - mv ${angl_file} $TANKverf_rad/. - ${COMPRESS} -f $TANKverf_rad/${angl_file} - fi - - if [[ -s ${ctl_file} ]]; then - mv ${ctl_file} ${angl_ctl} - mv ${angl_ctl} ${TANKverf_rad}/. - ${COMPRESS} -f ${TANKverf_rad}/${angl_ctl} - fi - - if [[ -s ${stdout_file} ]]; then - mv ${stdout_file} ${angl_stdout} - mv ${angl_stdout} ${TANKverf_rad}/. - ${COMPRESS} -f ${TANKverf_rad}/${angl_stdout} - fi - - - fi # -s $data_file - done # for dtype in ${gesanl} loop - done # for type in ${SATYPE} loop - - if [[ $fail -eq $ctr || $fail -gt $ctr ]]; then - err=3 - fi -fi - -################################################################################ -# Post processing - -if [[ "$VERBOSE" = "YES" ]]; then - echo $(date) EXITING $0 error code ${err} >&2 -fi - -msg="${scr} HAS ENDED" -postmsg "$jlogfile" "$msg" - -exit ${err} diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/ush/radmon_verf_bcoef.sh b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/ush/radmon_verf_bcoef.sh deleted file mode 100755 index 2119adb4fd..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/ush/radmon_verf_bcoef.sh +++ /dev/null @@ -1,235 +0,0 @@ -#!/bin/ksh - -################################################################################ -#### UNIX Script Documentation Block -# . . -# Script name: radmon_verf_bcoef.sh -# Script description: Extract bias correction coefficients data from radiance -# diagnostic files. -# -# Author: Ed Safford Org: NP23 Date: 2012-02-02 -# -# Abstract: This script extracts bias correction coefficient related data from -# radiance diagnostic files (which are an output from GSI runs), -# storing the extracted data in small binary files. -# -# This script is a child script of exgdas_vrfyrad.sh.sms. The parent -# script opens and uncompresses the radiance diagnostic file and copies -# other supporting files into a temporary working directory. -# -# -# Usage: radmon_verf_bcoef.sh PDATE -# -# Input script positional parameters: -# PDATE processing date -# yyyymmddcc format; required -# -# Imported Shell Variables: -# SUFFIX data source suffix -# defauls to opr -# MAKE_CTL switch to construct the meta-data control file -# defaults to 1 (on) -# MAKE_DATA switch to construct the binary data file -# defaults to 1 (on) -# EXECradmon executable directory -# defaults to current directory -# FIXradmon fixed data directory -# defaults to current directory -# RAD_AREA global or regional flag -# defaults to global -# TANKverf_rad data repository -# defaults to current directory -# SATYPE list of satellite/instrument sources -# defaults to none -# VERBOSE Verbose flag (YES or NO) -# defaults to NO -# LITTLE_ENDIAN flag for LE machine -# defaults to 0 (big endian) -# USE_ANL use analysis files as inputs in addition to -# the ges files. Default is 0 (ges only) -# -# Modules and files referenced: -# scripts : -# -# programs : $NCP -# $bcoef_exec -# -# fixed data : $biascr -# -# input data : $data_file -# -# output data: $bcoef_file -# $bcoef_ctl -# $pgmout -# -# Remarks: -# -# Condition codes -# 0 - no problem encountered -# >0 - some problem encountered -# -#################################################################### -# Command line arguments. -export PDATE=${1:-${PDATE:?}} - -scr=radmon_verf_bcoef.sh -msg="${scr} HAS STARTED" -postmsg "$jlogfile" "$msg" - -if [[ "$VERBOSE" = "YES" ]]; then - set -ax -fi - -# Directories -FIXgdas=${FIXgdas:-$(pwd)} -EXECradmon=${EXECradmon:-$(pwd)} -TANKverf_rad=${TANKverf_rad:-$(pwd)} - -# File names -pgmout=${pgmout:-${jlogfile}} -touch $pgmout - -# Other variables -MAKE_CTL=${MAKE_CTL:-1} -MAKE_DATA=${MAKE_DATA:-1} -RAD_AREA=${RAD_AREA:-glb} -SATYPE=${SATYPE:-} -VERBOSE=${VERBOSE:-NO} -LITTLE_ENDIAN=${LITTLE_ENDIAN:-0} -USE_ANL=${USE_ANL:-0} - -err=0 -bcoef_exec=radmon_bcoef - -if [[ $USE_ANL -eq 1 ]]; then - gesanl="ges anl" -else - gesanl="ges" -fi - -#-------------------------------------------------------------------- -# Copy extraction program and supporting files to working directory - -$NCP $EXECradmon/${bcoef_exec} ./${bcoef_exec} -$NCP ${biascr} ./biascr.txt - -if [[ ! -s ./${bcoef_exec} || ! -s ./biascr.txt ]]; then - err=4 -else - - -#-------------------------------------------------------------------- -# Run program for given time - - export pgm=${bcoef_exec} - - iyy=`echo $PDATE | cut -c1-4` - imm=`echo $PDATE | cut -c5-6` - idd=`echo $PDATE | cut -c7-8` - ihh=`echo $PDATE | cut -c9-10` - - ctr=0 - fail=0 - - for type in ${SATYPE}; do - for dtype in ${gesanl}; do - - prep_step - - ctr=`expr $ctr + 1` - - if [[ $dtype == "anl" ]]; then - data_file=${type}_anl.${PDATE}.ieee_d - bcoef_file=bcoef.${data_file} - ctl_file=${type}_anl.ctl - bcoef_ctl=bcoef.${ctl_file} - stdout_file=stdout.${type}_anl - bcoef_stdout=bcoef.${stdout_file} - input_file=${type}_anl - else - data_file=${type}.${PDATE}.ieee_d - bcoef_file=bcoef.${data_file} - ctl_file=${type}.ctl - bcoef_ctl=bcoef.${ctl_file} - stdout_file=stdout.${type} - bcoef_stdout=bcoef.${stdout_file} - input_file=${type} - fi - - rm input - - # Check for 0 length data file here and avoid running - # the executable if $data_file doesn't exist or is 0 bytes - # - if [[ -s $input_file ]]; then - nchanl=-999 - npredr=5 - -cat << EOF > input - &INPUT - satname='${type}', - npredr=${npredr}, - nchanl=${nchanl}, - iyy=${iyy}, - imm=${imm}, - idd=${idd}, - ihh=${ihh}, - idhh=-720, - incr=6, - suffix='${SUFFIX}', - imkctl=${MAKE_CTL}, - imkdata=${MAKE_DATA}, - gesanl='${dtype}', - little_endian=${LITTLE_ENDIAN}, - / -EOF - startmsg - ./${bcoef_exec} < input >>${pgmout} 2>>errfile - export err=$?; err_chk - if [[ $? -ne 0 ]]; then - fail=`expr $fail + 1` - fi - - -#------------------------------------------------------------------- -# move data, control, and stdout files to $TANKverf_rad and compress -# - - if [[ -s ${data_file} ]]; then - mv ${data_file} ${bcoef_file} - mv ${bcoef_file} $TANKverf_rad/. - ${COMPRESS} -f $TANKverf_rad/${bcoef_file} - fi - - if [[ -s ${ctl_file} ]]; then - mv ${ctl_file} ${bcoef_ctl} - mv ${bcoef_ctl} ${TANKverf_rad}/. - ${COMPRESS} -f ${TANKverf_rad}/${bcoef_ctl} - fi - - if [[ -s ${stdout_file} ]]; then - mv ${stdout_file} ${bcoef_stdout} - mv ${bcoef_stdout} ${TANKverf_rad}/. - ${COMPRESS} -f ${TANKverf_rad}/${bcoef_stdout} - fi - - fi # -s $data_file - done # dtype in $gesanl loop - done # type in $SATYPE loop - - if [[ $fail -eq $ctr || $fail -gt $ctr ]]; then - err=5 - fi -fi - - -################################################################################ -# Post processing -if [[ "$VERBOSE" = "YES" ]]; then - echo $(date) EXITING $0 with error code ${err} >&2 -fi - -msg="${scr} HAS ENDED" -postmsg "$jlogfile" "$msg" - -exit ${err} diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/ush/radmon_verf_bcor.sh b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/ush/radmon_verf_bcor.sh deleted file mode 100755 index e0008cbc0b..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/ush/radmon_verf_bcor.sh +++ /dev/null @@ -1,239 +0,0 @@ -#!/bin/ksh - -################################################################################ -#### UNIX Script Documentation Block -# . . -# Script name: radmon_verf_bcor.sh -# Script description: Extract bias correction data from radiance diagnostic -# files. -# -# Author: Ed Safford Org: NP23 Date: 2012-02-02 -# -# Abstract: This script extracts bias correction related data from radiance -# diagnostic files (which are an output from GSI runs), storing the -# extracted data in small binary files. -# -# This script is a child script of exgdas_vrfyrad.sh.sms. The parent -# script opens and uncompresses the radiance diagnostic file and copies -# other supporting files into a temporary working directory. -# -# -# Usage: radmon_verf_bcor.sh PDATE -# -# Input script positional parameters: -# PDATE processing date -# yyyymmddcc format; required -# -# Imported Shell Variables: -# SUFFIX data source suffix -# defauls to opr -# MAKE_CTL switch to construct the meta-data control file -# defaults to 1 (on) -# MAKE_DATA switch to construct the binary data file -# defaults to 1 (on) -# EXECradmon executable directory -# defaults to current directory -# RAD_AREA global or regional flag -# defaults to global -# TANKverf_rad data repository -# defaults to current directory -# SATYPE list of satellite/instrument sources -# defaults to none -# VERBOSE Verbose flag (YES or NO) -# defaults to NO -# LITTLE_ENDIAN flag for little endian machine -# defaults to 0 (big endian) -# USE_ANL use analysis files as inputs in addition to -# the ges files. Default is 0 (ges only) -# -# Modules and files referenced: -# scripts : -# -# programs : $NCP -# $bcor_exec -# -# fixed data : none -# -# input data : $data_file -# -# output data: $bcor_file -# $bcor_ctl -# $pgmout -# -# Remarks: -# -# Condition codes -# 0 - no problem encountered -# >0 - some problem encountered -# -#################################################################### - -# Command line arguments. -export PDATE=${1:-${PDATE:?}} - -scr=radmon_verf_bcor.sh -msg="${scr} HAS STARTED" -postmsg "$jlogfile" "$msg" - - -if [[ "$VERBOSE" = "YES" ]]; then - set -ax -fi - -# Directories -EXECradmon=${EXECradmon:-$(pwd)} -TANKverf_rad=${TANKverf_rad:-$(pwd)} - -# File names -pgmout=${pgmout:-${jlogfile}} -touch $pgmout - -# Other variables -MAKE_CTL=${MAKE_CTL:-1} -MAKE_DATA=${MAKE_DATA:-1} -RAD_AREA=${RAD_AREA:-glb} -SATYPE=${SATYPE:-} -VERBOSE=${VERBOSE:-NO} -LITTLE_ENDIAN=${LITTLE_ENDIAN:-0} -USE_ANL=${USE_ANL:-0} - -bcor_exec=radmon_bcor -err=0 - -if [[ $USE_ANL -eq 1 ]]; then - gesanl="ges anl" -else - gesanl="ges" -fi - - -#-------------------------------------------------------------------- -# Copy extraction program to working directory - -$NCP ${EXECradmon}/${bcor_exec} ./${bcor_exec} - -if [[ ! -s ./${bcor_exec} ]]; then - err=6 -else - - -#-------------------------------------------------------------------- -# Run program for given time - - export pgm=${bcor_exec} - - iyy=`echo $PDATE | cut -c1-4` - imm=`echo $PDATE | cut -c5-6` - idd=`echo $PDATE | cut -c7-8` - ihh=`echo $PDATE | cut -c9-10` - - ctr=0 - fail=0 - touch "./errfile" - - for type in ${SATYPE}; do - - for dtype in ${gesanl}; do - - prep_step - - ctr=`expr $ctr + 1` - - if [[ $dtype == "anl" ]]; then - data_file=${type}_anl.${PDATE}.ieee_d - bcor_file=bcor.${data_file} - ctl_file=${type}_anl.ctl - bcor_ctl=bcor.${ctl_file} - stdout_file=stdout.${type}_anl - bcor_stdout=bcor.${stdout_file} - input_file=${type}_anl - else - data_file=${type}.${PDATE}.ieee_d - bcor_file=bcor.${data_file} - ctl_file=${type}.ctl - bcor_ctl=bcor.${ctl_file} - stdout_file=stdout.${type} - bcor_stdout=bcor.${stdout_file} - input_file=${type} - fi - - rm input - - # Check for 0 length input file here and avoid running - # the executable if $input_file doesn't exist or is 0 bytes - # - if [[ -s $input_file ]]; then - nchanl=-999 - -cat << EOF > input - &INPUT - satname='${type}', - iyy=${iyy}, - imm=${imm}, - idd=${idd}, - ihh=${ihh}, - idhh=-720, - incr=6, - nchanl=${nchanl}, - suffix='${SUFFIX}', - imkctl=${MAKE_CTL}, - imkdata=${MAKE_DATA}, - gesanl='${dtype}', - little_endian=${LITTLE_ENDIAN}, - rad_area='${RAD_AREA}', - / -EOF - - startmsg - ./${bcor_exec} < input >> ${pgmout} 2>>errfile - export err=$?; err_chk - if [[ $? -ne 0 ]]; then - fail=`expr $fail + 1` - fi - - -#------------------------------------------------------------------- -# move data, control, and stdout files to $TANKverf_rad and compress -# - - if [[ -s ${data_file} ]]; then - mv ${data_file} ${bcor_file} - mv ${bcor_file} $TANKverf_rad/. - ${COMPRESS} -f $TANKverf_rad/${bcor_file} - fi - - if [[ -s ${ctl_file} ]]; then - mv ${ctl_file} ${bcor_ctl} - mv ${bcor_ctl} ${TANKverf_rad}/. - ${COMPRESS} -f ${TANKverf_rad}/${bcor_ctl} - fi - - if [[ -s ${stdout_file} ]]; then - mv ${stdout_file} ${bcor_stdout} - mv ${bcor_stdout} ${TANKverf_rad}/. - ${COMPRESS} -f ${TANKverf_rad}/${bcor_stdout} - fi - - fi # -s $data_file - - done # dtype in $gesanl loop - done # type in $SATYPE loop - - - if [[ $fail -eq $ctr || $fail -gt $ctr ]]; then - err=7 - fi -fi - -################################################################################ -# Post processing - -if [[ "$VERBOSE" = "YES" ]]; then - echo $(date) EXITING $0 error code ${err} >&2 -fi - -msg="${scr} HAS ENDED" -postmsg "$jlogfile" "$msg" - -exit ${err} - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/ush/radmon_verf_time.sh b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/ush/radmon_verf_time.sh deleted file mode 100755 index 2b1531684f..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/ush/radmon_verf_time.sh +++ /dev/null @@ -1,523 +0,0 @@ -#!/bin/ksh - -################################################################################ -#### UNIX Script Documentation Block -# . . -# Script name: radmon_verf_time.sh -# Script description: Extract time data from radiance diagnostic files, -# perform data integrity checks. -# -# Author: Ed Safford Org: NP23 Date: 2012-02-02 -# -# Abstract: This script extracts time related data from radiance diagnostic -# files (which are an output from GSI runs), storing the extracted -# data in small binary files. Data integrity checks are performed -# on the data and mail messages are sent if potential errors are -# detected. -# -# This script is a child script of exgdas_vrfyrad.sh.sms. The parent -# script opens and uncompresses the radiance diagnostic file and copies -# other supporting files into a temporary working directory. -# -# -# Usage: radmon_verf_time.sh PDATE -# -# Input script positional parameters: -# PDATE processing date -# yyyymmddcc format; required -# -# Imported Shell Variables: -# DO_DIAG_RPT switch to build the diagnostic report -# defaults to 1 (on) -# DO_DATA_RPT switch to build the data report -# defaults to 1 (on) -# SUFFIX data source suffix -# defauls to opr -# MAKE_CTL switch to construct the meta-data control file -# defaults to 1 (on) -# MAKE_DATA switch to construct the binary data file -# defaults to 1 (on) -# EXECradmon executable directory -# defaults to current directory -# FIXgdas fixed data directory -# defaults to current directory -# RAD_AREA global or regional flag -# defaults to global -# TANKverf_rad data repository -# defaults to current directory -# SATYPE list of satellite/instrument sources -# defaults to none -# MAIL_TO email recipients -# defaults to none -# MAIL_CC email cc recipients -# defaults to none -# VERBOSE Verbose flag (YES or NO) -# defaults to NO -# LITTLE_ENDIAN flag for little endian machine -# defaults to 0 (big endian) -# USE_ANL use analysis files as inputs in addition to -# the ges files. Default is 0 (ges only) -# -# Modules and files referenced: -# scripts : -# -# programs : $NCP -# $time_exec -# -# fixed data : gdas_radmon_base.tar -# -# input data : $data_file -# -# output data: $time_file -# $time_ctl -# $pgmout -# $bad_pen -# $bad_chan -# $report -# $diag_report -# -# -# Remarks: -# -# Condition codes -# 0 - no problem encountered -# >0 - some problem encountered -# -#################################################################### - -# Command line arguments. -export PDATE=${1:-${PDATE:?}} - -scr=radmon_verf_time.sh -msg="${scr} HAS STARTED" -postmsg "$jlogfile" "$msg" - -if [[ "$VERBOSE" = "YES" ]]; then - set -ax -fi - -# Directories -FIXgdas=${FIXgdas:-$(pwd)} -EXECradmon=${EXECradmon:-$(pwd)} -TANKverf_rad=${TANKverf_rad:-$(pwd)} - -# File names -pgmout=${pgmout:-${jlogfile}} -touch $pgmout - -radmon_err_rpt=${radmon_err_rpt:-${USHradmon}/radmon_err_rpt.sh} -base_file=${base_file:-$FIXgdas/gdas_radmon_base.tar} -report=report.txt -disclaimer=disclaimer.txt -region=region.txt -diag_report=diag_report.txt -diag_hdr=diag_hdr.txt -diag=diag.txt -obs_err=obs_err.txt -obs_hdr=obs_hdr.txt -pen_err=pen_err.txt -pen_hdr=pen_hdr.txt -chan_err=chan_err.txt -chan_hdr=chan_hdr.txt - -# Other variables -DO_DIAG_RPT=${DO_DIAG_RPT:-1} -DO_DATA_RPT=${DO_DATA_RPT:-1} -SUFFIX=${SUFFIX:-opr} -MAKE_CTL=${MAKE_CTL:-1} -MAKE_DATA=${MAKE_DATA:-1} -RAD_AREA=${RAD_AREA:-glb} -SATYPE=${SATYPE:-} -MAIL_TO=${MAIL_TO:-} -MAIL_CC=${MAIL_CC:-} -VERBOSE=${VERBOSE:-NO} -LITTLE_ENDIAN=${LITTLE_ENDIAN:-0} - -time_exec=radmon_time -USE_ANL=${USE_ANL:-0} -err=0 - -if [[ $USE_ANL -eq 1 ]]; then - gesanl="ges anl" -else - gesanl="ges" -fi - - -#-------------------------------------------------------------------- -# Copy extraction program and base files to working directory -#------------------------------------------------------------------- -$NCP ${EXECradmon}/${time_exec} ./ -if [[ ! -s ./${time_exec} ]]; then - err=8 -fi - -iyy=`echo $PDATE | cut -c1-4` -imm=`echo $PDATE | cut -c5-6` -idd=`echo $PDATE | cut -c7-8` -ihh=`echo $PDATE | cut -c9-10` -cyc=$ihh -CYCLE=$cyc - -local_base="local_base" -if [[ $DO_DATA_RPT -eq 1 ]]; then - - if [[ -e ${base_file}.${Z} ]]; then - $NCP ${base_file}.${Z} ./${local_base}.{Z} - ${UNCOMPRESS} ${local_base}.${Z} - else - $NCP ${base_file} ./${local_base} - fi - - if [[ ! -s ./${local_file} ]]; then - echo "RED LIGHT: local_base file not found" - err=9 - else - echo "Confirming local_base file is good = ${local_base}" - tar -xf ./${local_base} - echo "local_base is untarred" - fi -fi - -if [[ $err -eq 0 ]]; then - ctr=0 - fail=0 - - export pgm=${time_exec} -#-------------------------------------------------------------------- -# Loop over each entry in SATYPE -#-------------------------------------------------------------------- - for type in ${SATYPE}; do - ctr=`expr $ctr + 1` - - for dtype in ${gesanl}; do - - prep_step - - rm input - - if [[ $dtype == "anl" ]]; then - data_file=${type}_anl.${PDATE}.ieee_d - time_file=time.${data_file} - ctl_file=${type}_anl.ctl - time_ctl=time.${ctl_file} - stdout_file=stdout.${type}_anl - time_stdout=time.${stdout_file} - input_file=${type}_anl - else - data_file=${type}.${PDATE}.ieee_d - time_file=time.${data_file} - ctl_file=${type}.ctl - time_ctl=time.${ctl_file} - stdout_file=stdout.${type} - time_stdout=time.${stdout_file} - input_file=${type} - fi -#-------------------------------------------------------------------- -# Run program for given satellite/instrument -#-------------------------------------------------------------------- - # Check for 0 length input file here and avoid running - # the executable if $input_file doesn't exist or is 0 bytes - # - if [[ -s $input_file ]]; then - nchanl=-999 -cat << EOF > input - &INPUT - satname='${type}', - iyy=${iyy}, - imm=${imm}, - idd=${idd}, - ihh=${ihh}, - idhh=-720 - incr=6 - nchanl=${nchanl}, - suffix='${SUFFIX}', - imkctl=${MAKE_CTL}, - imkdata=${MAKE_DATA}, - gesanl='${dtype}', - little_endian=${LITTLE_ENDIAN}, - rad_area='${RAD_AREA}', - / -EOF - startmsg - ./${time_exec} < input >> ${pgmout} 2>>errfile - export err=$?; err_chk - - if [[ $? -ne 0 ]]; then - fail=`expr $fail + 1` - fi - -#------------------------------------------------------------------- -# move data, control, and stdout files to $TANKverf_rad and compress -#------------------------------------------------------------------- - - if [[ -s ${data_file} ]]; then - mv ${data_file} ${time_file} - mv ${time_file} $TANKverf_rad/. - ${COMPRESS} -f $TANKverf_rad/${time_file} - fi - - if [[ -s ${ctl_file} ]]; then - $NCP ${ctl_file} ${time_ctl} - $NCP ${time_ctl} ${TANKverf_rad}/. - ${COMPRESS} -f ${TANKverf_rad}/${time_ctl} - fi - - if [[ -s ${stdout_file} ]]; then - $NCP ${stdout_file} ${time_stdout} - mv ${time_stdout} ${TANKverf_rad}/. - ${COMPRESS} -f ${TANKverf_rad}/${time_stdout} - fi - - else # ! -s $data_file - # journal warning message to log file that an expected $data_file - # failed the -s test - echo "***PROBLEM reading diagnostic file. diag_rad=$type" >> ${pgmout} - fi - - done - done - if [[ $fail -eq $ctr || $fail -gt $ctr ]]; then - echo "fail, ctr = $fail, $ctr" - err=10 - fi - -fi - - - -#################################################################### -#------------------------------------------------------------------- -# Begin error analysis and reporting -#------------------------------------------------------------------- -#################################################################### - -if [[ $DO_DIAG_RPT -eq 1 ]]; then - -# build the disclaimer and region files - - cat << EOF > ${disclaimer} - - -*********************** WARNING *************************** -THIS IS AN AUTOMATED EMAIL. REPLIES TO SENDER WILL NOT BE -RECEIVED. PLEASE DIRECT REPLIES TO edward.safford@noaa.gov -*********************** WARNING *************************** -EOF - - cat << EOF > ${region} - Region Definitions: - - 1 Global (90S-90N, 0-360E) -EOF - - -#------------------------------------------------------------------- -# Check stdout file for any reported problem(s) reading the -# diagnostic file by calling ck_stdout.sh -# - ${USHradmon}/radmon_ck_stdout.sh ${diag} - - if [[ -s ${diag} ]]; then - cat << EOF > ${diag_hdr} - -Problem Reading Diagnostic File - - $PDATE - - Problems were encountered reading the diagnostic file for - the following sources: - -EOF - - cat ${diag_hdr} >> ${diag_report} - cat ${diag} >> ${diag_report} - if [[ $USE_MAIL -eq 1 ]]; then - cat ${disclaimer} >> ${diag_report} - else - echo End Problem Reading Diagnostic File >> ${diag_report} - echo >> ${diag_report} - fi - rm ${diag} ${diag_hdr} - fi - -#------------------------------------------------------------------- -# mail error notifications or dump to log file - - if [[ -s ${diag_report} ]]; then - lines=`wc -l <${diag_report}` - if [[ $lines -gt 1 ]]; then - - if [[ $USE_MAIL -eq 1 ]]; then - if [[ $MAIL_CC == "" ]]; then - /bin/mail -v -s diagnostic_error_report ${MAIL_TO}< ${diag_report} - else - /bin/mail -v -s diagnostic_error_report -c "${MAIL_CC}" ${MAIL_TO}< ${diag_report} - fi - else - - cat ${diag_report} - fi - fi - fi - -fi - - -#------------------------------------------------------------------- -# Assemble the bad penalty/channel report - -if [[ $DO_DATA_RPT -eq 1 ]]; then - - #---------------------------------------------------------------- - # Identify bad_pen and bad_chan files for this cycle and - # previous cycle - - bad_pen=bad_pen.${PDATE} - bad_chan=bad_chan.${PDATE} - - qdate=`$NDATE -06 $PDATE` - pday=`echo $qdate | cut -c1-8` - - prev_bad_pen=bad_pen.${qdate} - prev_bad_chan=bad_chan.${qdate} - - do_rpt=0 - if [[ -s $bad_pen && -s ${TANKverf}/radmon.${pday}/$prev_bad_pen ]]; then - do_rpt=1 - fi - if [[ -s $bad_chan && -s ${TANKverf}/radmon.${pday}/$prev_bad_chan ]]; then - do_rpt=1 - fi - -#-------------------------------------------------------------------- -# Remove extra spaces in new bad_pen file -# - gawk '{$1=$1}1' $bad_pen > tmp.bad_pen - mv -f tmp.bad_pen $bad_pen - - - if [[ $do_rpt -eq 1 ]]; then -#------------------------------------------------------------------- -# copy previous cycle's bad_chan and bad_pen files -# - $NCP ${TANKverf}/radmon.${pday}/${prev_bad_pen} ./ - $NCP ${TANKverf}/radmon.${pday}/${prev_bad_chan} ./ - -#------------------------------------------------------------------- -# run radmon_err_rpt.sh for chan and pen to create the error files -# -# ${USHradmon}/radmon_err_rpt.sh ${prev_bad_pen} ${bad_pen} pen ${qdate} ${PDATE} ${diag_report} ${pen_err} - ${radmon_err_rpt} ${prev_bad_pen} ${bad_pen} pen ${qdate} ${PDATE} ${diag_report} ${pen_err} - - -#------------------------------------------------------------------- -# put together the unified error report with any obs, chan, and -# penalty problems and mail it - - if [[ -s ${obs_err} || -s ${pen_err} || -s ${chan_err} ]]; then - - echo DOING ERROR REPORTING - - echo "Begin Cycle Data Integrity Report" > $report - - cat << EOF >> $report -Cycle Data Integrity Report - $PDATE - -EOF - - cat ${region} >> $report - - if [[ -s ${chan_err} ]]; then - - echo OUTPUTING CHAN_ERR - - cat << EOF > ${chan_hdr} - - The following channels report 0 observational counts over the past two cycles: - - Satellite/Instrument Channel - ==================== ======= - -EOF - - cat ${chan_hdr} >> $report - cat ${chan_err} >> $report - - fi - - if [[ -s ${pen_err} ]]; then - - cat << EOF > ${pen_hdr} - - - Penalty values outside of the established normal range were found - for these sensor/channel/regions in the past two cycles: - - Questionable Penalty Values - ============ ======= ====== Cycle Penalty Bound - ----- ------- ----- -EOF - cat ${pen_hdr} >> $report - cat ${pen_err} >> $report - rm ${pen_hdr} ${pen_err} - fi - - if [[ $USE_MAIL -eq 1 ]]; then - cat ${disclaimer} >> $report - else - echo End Cycle Data Integrity Report >> $report - echo >> $report - fi - fi - -#------------------------------------------------------------------- -# mail error notifications or dump to log file -# - if [[ -s ${report} ]]; then - lines=`wc -l <${report}` - if [[ $lines -gt 2 ]]; then - if [[ $USE_MAIL -eq 1 ]]; then - if [[ $MAIL_CC == "" ]]; then - /bin/mail -v -s cycle_report ${MAIL_TO}< ${report} - else - /bin/mail -v -s cycle_report -c "${MAIL_CC}" ${MAIL_TO}< ${report} - fi - else - cat ${report} - fi - fi - fi - - fi - -#------------------------------------------------------------------- -# copy new bad_pen and bad_chan files to $TANKverf_rad - - if [[ -s ${bad_chan} ]]; then - $NCP ${bad_chan} ${TANKverf_rad}/. - fi - - if [[ -s ${bad_pen} ]]; then - $NCP ${bad_pen} ${TANKverf_rad}/. - fi - -fi - -################################################################################ -#------------------------------------------------------------------- -# end error reporting section -#------------------------------------------------------------------- -################################################################################ - -################################################################################ -# Post processing -if [[ "$VERBOSE" = "YES" ]]; then - echo $(date) EXITING $0 error code ${err} >&2 -fi - -msg="${scr} HAS ENDED" -postmsg "$jlogfile" "$msg" - -exit ${err} diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/modulefiles/cray/RadMonBuild b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/modulefiles/cray/RadMonBuild deleted file mode 100644 index aea1101f5c..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/modulefiles/cray/RadMonBuild +++ /dev/null @@ -1,18 +0,0 @@ -#%Module################################################################# -proc ModulesHelp { } { - puts stderr "Set environment variables for WCOSS(cray) radmon build" -} - -module-whatis "Set environment variables for WCOSS(cray) radmon build" - -set ver 2.0.2 -set FCOMP ifort - -setenv CF $FCOMP -setenv FC $FCOMP -setenv FFLAGS "-O3 -fp-model strict -D_REAL8_ -traceback -convert big_endian -assume byterecl" -setenv CHECK_LIBS "/gpfs/hps/nco/ops/nwprod/spa_util/check_libs.bash" -setenv D_FFLAGS "-O3 -fp-model strict -D_REAL8_ -traceback -convert big_endian -assume byterecl -debug" -module load intel -module load w3nco-intel/2.0.6 - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/modulefiles/theia/RadMonBuild b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/modulefiles/theia/RadMonBuild deleted file mode 100644 index 0954419273..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/modulefiles/theia/RadMonBuild +++ /dev/null @@ -1,17 +0,0 @@ -#%Module################################################################# -proc ModulesHelp { } { - puts stderr "Set environment variables for THEIA radmon build" -} - -module-whatis "Set environment variables for THEIA radmon build" - -set ver 2.0.2 -set FCOMP ifort - -setenv CF $FCOMP -setenv FC $FCOMP -setenv FFLAGS "-O3 -fp-model strict -D_REAL8_ -traceback -convert big_endian -assume byterecl" -setenv D_FFLAGS "-O3 -fp-model strict -D_REAL8_ -traceback -convert big_endian -assume byterecl -debug" - -setenv W3NCO_LIB4 "-L/scratch3/NCEPDEV/nwprod/lib -lw3nco_4" - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/modulefiles/wcoss/RadMonBuild b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/modulefiles/wcoss/RadMonBuild deleted file mode 100644 index 0ab4cd0908..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/modulefiles/wcoss/RadMonBuild +++ /dev/null @@ -1,18 +0,0 @@ -#%Module################################################################# -proc ModulesHelp { } { - puts stderr "Set environment variables for WCOSS radmon build" -} - -module-whatis "Set environment variables for WCOSS radmon build" - -set ver 2.0.2 -set FCOMP ifort - -setenv CF $FCOMP -setenv FC $FCOMP -setenv FFLAGS "-O3 -fp-model strict -D_REAL8_ -traceback -convert big_endian -assume byterecl" -setenv D_FFLAGS "-O3 -fp-model strict -D_REAL8_ -traceback -convert big_endian -assume byterecl -debug" -setenv CHECK_LIBS "/nwprod/spa_util/check_libs.bash" -module load ics/12.1 -module load w3nco/v2.0.6 - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/build_radmon.sh b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/build_radmon.sh deleted file mode 100755 index fa38a27598..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/build_radmon.sh +++ /dev/null @@ -1,14 +0,0 @@ -module use -a ../modulefiles/cray -module load RadMonBuild - - -for dir in verf_radbcoef.fd verf_radtime.fd verf_radang.fd verf_radbcor.fd -do - cd $dir - make check_prereqs - make - make install - cd ../ -done - -module unload RadMonBuild diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/readme b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/readme deleted file mode 100644 index cba655dd58..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/readme +++ /dev/null @@ -1,27 +0,0 @@ -Instructions for building executables. - - 1) Load the build module appropriate for your Machine: - i.) - WCOSS: - "module use -a ../modulefiles/wcoss" - CRAY: - "module use -a ../modulefiles/cray" - THEIA: - "module use -a ../modulefiles/theia" - ii.) type: - "module load RadMonBuild" - - 2) cd into each executable directory (*.fd) - - 3) Optional: verify all prerequisites are met by typing: - "make check_prereqs" - - 4) Build the executable by typing: - "make" - - 5) Move the executable to the ../../exec directory by typing: - "make install" - - 6) When all executable have been built unload the build module: - "module unload RadMonBuild" - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radang.fd/angle_bias.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radang.fd/angle_bias.f90 deleted file mode 100755 index dfc405ee7b..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radang.fd/angle_bias.f90 +++ /dev/null @@ -1,701 +0,0 @@ -program angle - use read_diag - - implicit none - integer ntype,mregion,mstep,surf_nregion,max_surf_region - parameter (ntype=35,mregion=25,mstep=100,max_surf_region=5) - integer iglobal, iland, iwater, isnowice, imixed - parameter (iglobal=1, iland=2, iwater=3, isnowice=4, imixed=5) - - character(10),dimension(ntype):: ftype - character(8) stid - character(20) satname,stringd - character(10) satype,dplat - character(20) dum,satsis,satscan_sis - character(40) string,diag_rad,data_file,dfile,ctl_file - character(40),dimension(max_surf_region):: surf_region - character(8) date,suffix,cycle - character(len=1024) :: command - - integer luname,lungrd,lndiag,lunang,lunctl - integer iyy,imm,idd,ihh,idhh,incr,iread,iflag,ipos - integer n_chan,j,i,k,ii,nsub,jiter,jj - integer,dimension(mregion):: jsub - integer,allocatable,dimension(:):: io_chan,nu_chan - integer imatch, npred_radiag, angord - - real start,step - integer nstep,iscan - character(1) cflg - real rang,pen - real weight,rlat,rlon,rmiss,obs,biascor,obsges,obsgesnbc,rterm,rread - real,dimension(2):: cor_tot,nbc_omg,bc_omg - real,dimension(2):: cor_fixang,cor_lapse,cor_lapse2,cor_const,cor_scangl,cor_clw - real,dimension(2):: cor_cos,cor_sin,cor_emiss - real,dimension(2):: cor_ordang4,cor_ordang3,cor_ordang2,cor_ordang1 - real,dimension(max_surf_region):: surf_rlatmin,surf_rlatmax,surf_rlonmin,surf_rlonmax - - real,allocatable,dimension(:):: wavenumbr,error,use,frequency - real,allocatable,dimension(:,:):: timang - real,allocatable,dimension(:,:,:):: count,penalty - real,allocatable,dimension(:,:,:,:):: tot_cor,omg_nbc,omg_bc - real,allocatable,dimension(:,:,:,:):: fixang_cor,lapse_cor,lapse2_cor - real,allocatable,dimension(:,:,:,:):: const_cor,scangl_cor,clw_cor - real,allocatable,dimension(:,:,:,:):: cos_cor,sin_cor,emiss_cor - real,allocatable,dimension(:,:,:,:):: ordang4_cor,ordang3_cor,ordang2_cor,ordang1_cor - -! Variables for reading satellite data - type(diag_header_fix_list ) :: header_fix - type(diag_header_chan_list),allocatable :: header_chan(:) - type(diag_data_name_list ) :: data_name - type(diag_data_fix_list ) :: data_fix - type(diag_data_chan_list ),allocatable :: data_chan(:) - type(diag_data_extra_list) ,allocatable :: data_extra(:,:) - - integer nsnow, nland, nwater, nice, nmixed, ntotal - integer nnsnow, nnland, nnwater, nnmixed, nntotal - -! Namelist with defaults - logical :: retrieval = .false. - integer :: nchanl = 19 - integer :: imkctl = 1 - integer :: imkdata = 1 - character(3) :: gesanl = 'ges' - integer :: little_endian = 1 - character(3) :: rad_area = 'glb' - namelist /input/ satname,iyy,imm,idd,ihh,idhh,incr,nchanl,& - suffix,imkctl,imkdata,retrieval,gesanl,little_endian,rad_area - - data luname,lungrd,lunctl,lndiag,iscan / 5, 51, 52, 21, 31 / - data lunang / 22 / - data rmiss /-999./ - data stringd / '.%y4%m2%d2%h2' / - data ftype / 'satang', 'count', 'penalty', & - 'omgnbc', 'total', 'omgbc', & - 'fixang', 'lapse', 'lapse2', & - 'const', 'scangl', 'clw', & - 'cos','sin','emiss','ordang4',& - 'ordang3','ordang2','ordang1',& - 'omgnbc_2', 'total_2', 'omgbc_2', & - 'fixang_2', 'lapse_2', 'lapse2_2', & - 'const_2', 'scangl_2', 'clw_2', & - 'cos_2', 'sin_2', 'emiss_2', & - 'ordang4_2','ordang3_2','ordang2_2', & - 'ordang1_2' / - data surf_region / 'global', 'land', 'water', 'ice/snow', 'mixed'/ - data surf_rlonmin / -180., -180., -180., -180., -180./ - data surf_rlonmax / 180., 180., 180., 180., 180./ - data surf_rlatmin / -90., -90., -90., -90., -90./ - data surf_rlatmax / 90., 90., 90., 90., 90./ -!************************************************************************ -! -! Initialize variables - iread=0 - npred_radiag = 12 - -! Read namelist input - read(luname,input) - write(6,input) - write(6,*)' ' - write(6,*)'gesanl = ', gesanl - write(6,*)'rad_area = ', rad_area - - surf_nregion = 5 - if ( trim(rad_area) == 'rgn' ) then - surf_nregion = 1 - endif - - if ( trim(gesanl) == 'anl' ) then - ftype(4) = 'omanbc' - ftype(6) = 'omabc' - ftype(13) = 'omanbc_2' - ftype(15) = 'omabc_2' - endif - -! Ensure number of requested regions does not exceed specified upper limit - if (surf_nregion>mregion) then - write(6,*)'***ERROR*** too many regions specified' - write(6,*)' maximum allowed: mregion=',mregion - write(6,*)' user requested: surf_nregion=',surf_nregion - call errexit(91) - endif - - date = stringd(2:9) - cycle = stringd(10:11) - -! Create filenames for diagnostic input, binary output files - write(stringd,100) iyy,imm,idd,ihh -100 format('.',i4.4,3i2.2) - - if ( trim(gesanl) == 'ges' ) then - diag_rad = trim(satname) - data_file= trim(satname) // trim(stringd) // '.ieee_d' - ctl_file = trim(satname) // '.ctl' - else - diag_rad = trim(satname) // '_anl' - data_file= trim(satname) // '_anl' // trim(stringd) // '.ieee_d' - ctl_file = trim(satname) // '_anl.ctl' - endif - - - write(6,*)'diag_rad =',diag_rad - write(6,*)'data_file=',data_file - write(6,*)'suffix =',suffix - write(6,*)'ctl_file =',ctl_file - write(6,*)'imkctl =',imkctl - write(6,*)'imkdata =',imkdata - write(6,*)'little_endian =', little_endian - - -! Open unit to diagnostic file. Read portion of -! header to see if file exists - open(lndiag,file=diag_rad,form='unformatted') - read(lndiag,err=900,end=900) dum - rewind lndiag - -! File exists. Read header - write(6,*)'call read_diag_header' - call read_radiag_header( lndiag, npred_radiag, retrieval,& - header_fix, header_chan, data_name, iflag ) -! -! If there was an error reading the header try to convert from little endian -! and re-read. If that fails exit. -! - if( iflag/=0 ) then - write(6,*)'***ERROR*** problem reading diag file header, iflag=',iflag - call errexit(91) - endif - - -! Extract observation type, satellite id, and number of channels - satype = header_fix%obstype - satsis = header_fix%isis - dplat = header_fix%id - n_chan = header_fix%nchan - jiter = header_fix%jiter - angord = header_fix%angord - - write(6,*)'satype,satid,n_chan,angord=',satype,' ',dplat,' ',n_chan,' ',angord - - string = trim(satype) //'_'// trim(dplat) - write(6,*)'string,satname=',string,' ',satname - if ( trim(string) /= trim(satname) ) then - write(6,*)'***ERROR*** inconsistent instrument types' - write(6,*)' satname,string =',satname,' ',string - call errexit(92) - endif - -! open scan info file compiled in the source directory - open(iscan,file='scaninfo.txt',form='formatted') - do - read(iscan,1000,IOSTAT=iflag) cflg,satscan_sis,start,step,nstep - write(6,*) 'satscan_sis,start,step,nstep=',satscan_sis,start,step,nstep - if( iflag /= 0 ) exit - if(trim(satname) == trim(satscan_sis)) exit - enddo -!1000 format(a1,a20,2f10.2,i10) -1000 format(a1,a20,2f10.3,i10) - - write(6,*) 'satscan_sis,start,step,nstep=',satscan_sis,start,step,nstep - - -! Allocate arrays to hold observational information - write(6,*)' ' - write(6,*)'allocate arrays' - allocate (io_chan(n_chan), nu_chan(n_chan), wavenumbr(n_chan), & - error(n_chan), use(n_chan), frequency(n_chan)) - allocate (timang(mstep,n_chan)) - allocate (tot_cor(mstep,n_chan,surf_nregion,2), & - omg_nbc(mstep,n_chan,surf_nregion,2), & - omg_bc(mstep,n_chan,surf_nregion,2), & - count(mstep,n_chan,surf_nregion), & - penalty(mstep,n_chan,surf_nregion),& - fixang_cor(mstep,n_chan,surf_nregion,2),lapse_cor(mstep,n_chan,surf_nregion,2),& - lapse2_cor(mstep,n_chan,surf_nregion,2),clw_cor(mstep,n_chan,surf_nregion,2),& - const_cor(mstep,n_chan,surf_nregion,2), scangl_cor(mstep,n_chan,surf_nregion,2),& - cos_cor(mstep,n_chan,surf_nregion,2), sin_cor(mstep,n_chan,surf_nregion,2),& - emiss_cor(mstep,n_chan,surf_nregion,2), ordang4_cor(mstep,n_chan,surf_nregion,2),& - ordang3_cor(mstep,n_chan,surf_nregion,2), ordang2_cor(mstep,n_chan,surf_nregion,2),& - ordang1_cor(mstep,n_chan,surf_nregion,2)) - -! Zero accumulator arrays - do ii=1,2 - do k=1,surf_nregion - do j=1,n_chan - do i=1,mstep - if (ii==1) then - count(i,j,k) = 0.0 - penalty(i,j,k) = 0.0 - endif - tot_cor(i,j,k,ii) = 0.0 - omg_nbc(i,j,k,ii) = 0.0 - omg_bc(i,j,k,ii) = 0.0 - fixang_cor(i,j,k,ii) = 0.0 - lapse_cor(i,j,k,ii) = 0.0 - lapse2_cor(i,j,k,ii) = 0.0 - clw_cor(i,j,k,ii) = 0.0 - const_cor(i,j,k,ii) = 0.0 - scangl_cor(i,j,k,ii) = 0.0 - cos_cor(i,j,k,ii) = 0.0 - sin_cor(i,j,k,ii) = 0.0 - emiss_cor(i,j,k,ii) = 0.0 - ordang4_cor(i,j,k,ii) = 0.0 - ordang3_cor(i,j,k,ii) = 0.0 - ordang2_cor(i,j,k,ii) = 0.0 - ordang1_cor(i,j,k,ii) = 0.0 - end do - end do - end do - end do - -! Note: timang has been deprecated and the satang file is no longer -! used. See the plot_angle_sep.*.gs scripts for how the timang -! values are derived from the diagnostic file contents. The -! timang variable has been kept to avoid making a change in -! ieee_d file format. - do j=1,n_chan - do i=1,mstep - timang(i,j) = rmiss - end do - end do - -! Extract satinfo relative index - do j=1,n_chan - nu_chan(j) = real( header_chan(j)%nuchan, 4 ) - io_chan(j) = real( header_chan(j)%iochan, 4 ) - wavenumbr(j) = real( header_chan(j)%wave, 4 ) - error(j) = real( header_chan(j)%varch, 4) - use(j) = real( header_chan(j)%iuse, 4 ) - frequency(j) = real( header_chan(j)%freq, 4) -! print *,nu_chan(j),io_chan(j),wavenumbr(j),error(j),use(j),frequency(j) - end do - - - - write(6,*)'beginning read entries in diag file' - nwater = 0; nnwater=0 - nice = 0 - nsnow = 0; nnsnow=0 - nland = 0; nnland=0 - nmixed = 0; nnmixed=0; - ntotal = 0; - -! Loop to read entries in diagnostic file - iflag = 0 - loopd: do while (iflag == 0) - -! Read a record. If read flag, iflag does not equal zero, exit loopd - call read_radiag_data( lndiag, header_fix, retrieval, data_fix, data_chan,& - data_extra, iflag ) - if( iflag /= 0 ) exit loopd - iread=iread+1 - -! Extract observation location, scan position, and mpi weight. -! Convert (0-360) lon to (-180,180) - rlat = data_fix%lat - rlon = data_fix%lon - ipos = data_fix%senscn_pos !! sensor scan position(integer) - rang = data_fix%satzen_ang !! satellite zenith angle (deg) - - ntotal = ntotal + 1 - jsub(1)=iglobal - - if ( surf_nregion > 1 ) then - if ( data_fix%water_frac > 0.99 ) then - nwater = nwater + 1 - else if ( data_fix%land_frac > 0.99 ) then - nland = nland + 1 - else if ( data_fix%snow_frac > 0.99 ) then - nsnow = nsnow + 1 - else if ( data_fix%ice_frac > 0.99 ) then - nice = nice + 1 - else - nmixed = nmixed + 1 - end if - - - if (rlon>180.) rlon = rlon - 360. - if (ipos<1) then - write(6,*)'scan position less than 1. ipos=',ipos - ipos=1 - endif - if (ipos>nstep) then - write(6,*)'scan position > nstep. ipos,nstep,',& - ipos,nstep - ipos=nstep - endif - rread = rread + 1.0 - - -! Detemine which subdomains the observation falls into -! These are now based on surface type, not geography. All -! obs match global (surf_region 1). -! - ii=0; jsub=0; - jsub(1)=iglobal - if ( data_fix%land_frac > 0.99 ) then - jsub(2)=iland - nsub=2 - nnland=nnland+1 - else if ( data_fix%water_frac > 0.99 ) then - jsub(2)=iwater - nsub=2 - nnwater=nnwater+1 - else if (( data_fix%snow_frac > 0.99 ) .OR. ( data_fix%ice_frac > 0.99 )) then - jsub(2)=isnowice - nsub=2 - nnsnow=nnsnow+1 - else - jsub(2)=imixed - nsub=2 - nnmixed=nnmixed+1 - write(6,*)'data_fix%land_frac,water,snow,ice = ',data_fix%land_frac, data_fix%water_frac, data_fix%snow_frac, data_fix%ice_frac - end if - end if - - -! Channel loop - do j = 1, n_chan - -! If observation was assimilated, accumulate sums for appropriate -! scan angle and regions - cor_cos = 0.0 - cor_sin = 0.0 - cor_emiss = 0.0 - cor_ordang4 = 0.0 - cor_ordang3 = 0.0 - cor_ordang2 = 0.0 - cor_ordang1 = 0.0 - - if (data_chan(j)%errinv > 1.e-6) then -! pen = data_chan(j)%errinv*(data_chan(j)%omgbc)**2 - pen = (data_chan(j)%errinv*(data_chan(j)%omgbc))**2 - - - cor_tot(1) = (data_chan(j)%omgnbc - data_chan(j)%omgbc) - nbc_omg(1) = - (data_chan(j)%omgnbc) - bc_omg(1) = - (data_chan(j)%omgbc) - - - if ( trim(rad_area) == 'rgn' ) then - write(6,*) 'chan,pen,cor_tot(1),nbc_omg(1),bc_omb(1) = ', j,pen,cor_tot(1),nbc_omg(1),bc_omg(1) - endif - - cor_tot(2) = (data_chan(j)%omgnbc - data_chan(j)%omgbc)**2 - nbc_omg(2) = (data_chan(j)%omgnbc)**2 - bc_omg(2) = (data_chan(j)%omgbc)**2 - - cor_fixang(1) = data_chan(j)%bifix(angord+1) - cor_lapse(1) = data_chan(j)%bilap - cor_lapse2(1) = data_chan(j)%bilap2 - cor_const(1) = data_chan(j)%bicons - cor_scangl(1) = data_chan(j)%biang - cor_clw(1) = data_chan(j)%biclw - cor_cos(1) = data_chan(j)%bicos - cor_sin(1) = data_chan(j)%bisin - cor_emiss(1) = data_chan(j)%biemis - if (angord >= 4 ) then - cor_ordang4(1) = data_chan(j)%bifix(1) - cor_ordang3(1) = data_chan(j)%bifix(2) - cor_ordang2(1) = data_chan(j)%bifix(3) - cor_ordang1(1) = data_chan(j)%bifix(4) - else - cor_ordang4(1) = 0.0 - cor_ordang3(1) = 0.0 - cor_ordang2(1) = 0.0 - cor_ordang1(1) = 0.0 - endif - - cor_fixang(2) = (data_chan(j)%bifix(angord+1))**2 - cor_lapse(2) = (data_chan(j)%bilap)**2 - cor_lapse2(2) = (data_chan(j)%bilap2)**2 - cor_const(2) = (data_chan(j)%bicons)**2 - cor_scangl(2) = (data_chan(j)%biang)**2 - cor_clw(2) = (data_chan(j)%biclw)**2 - cor_cos(2) = (data_chan(j)%bicos)**2 - cor_sin(2) = (data_chan(j)%bisin)**2 - cor_emiss(2) = (data_chan(j)%biemis)**2 - if (angord >= 4 ) then - cor_ordang4(2) = (data_chan(j)%bifix(1))**2 - cor_ordang3(2) = (data_chan(j)%bifix(2))**2 - cor_ordang2(2) = (data_chan(j)%bifix(3))**2 - cor_ordang1(2) = (data_chan(j)%bifix(4))**2 - else - cor_ordang4(2) = 0.0 - cor_ordang3(2) = 0.0 - cor_ordang2(2) = 0.0 - cor_ordang1(2) = 0.0 - endif - - - if ( trim(rad_area) == 'rgn' ) then - nsub = 1 - endif - do i=1,nsub - if ( trim(rad_area) == 'rgn' ) then - write(6,*) 'INSIDE i 1 to nsub do loop' - endif - k=jsub(i) - count(ipos,j,k) = count(ipos,j,k) + 1.0 - penalty(ipos,j,k) = penalty(ipos,j,k) + pen - - do ii=1,2 - tot_cor(ipos,j,k,ii) = tot_cor(ipos,j,k,ii) + cor_tot(ii) - omg_nbc(ipos,j,k,ii) = omg_nbc(ipos,j,k,ii) + nbc_omg(ii) - omg_bc(ipos,j,k,ii) = omg_bc(ipos,j,k,ii) + bc_omg(ii) - fixang_cor(ipos,j,k,ii) = fixang_cor(ipos,j,k,ii) + cor_fixang(ii) - lapse_cor(ipos,j,k,ii) = lapse_cor(ipos,j,k,ii) + cor_lapse(ii) - lapse2_cor(ipos,j,k,ii) = lapse2_cor(ipos,j,k,ii) + cor_lapse2(ii) - const_cor(ipos,j,k,ii) = const_cor(ipos,j,k,ii) + cor_const(ii) - scangl_cor(ipos,j,k,ii) = scangl_cor(ipos,j,k,ii) + cor_scangl(ii) - clw_cor(ipos,j,k,ii) = clw_cor(ipos,j,k,ii) + cor_clw(ii) - cos_cor(ipos,j,k,ii) = cos_cor(ipos,j,k,ii) + cor_cos(ii) - sin_cor(ipos,j,k,ii) = sin_cor(ipos,j,k,ii) + cor_sin(ii) - emiss_cor(ipos,j,k,ii) = emiss_cor(ipos,j,k,ii) + cor_emiss(ii) - ordang4_cor(ipos,j,k,ii) = ordang4_cor(ipos,j,k,ii) + cor_ordang4(ii) - ordang3_cor(ipos,j,k,ii) = ordang3_cor(ipos,j,k,ii) + cor_ordang3(ii) - ordang2_cor(ipos,j,k,ii) = ordang2_cor(ipos,j,k,ii) + cor_ordang2(ii) - ordang1_cor(ipos,j,k,ii) = ordang1_cor(ipos,j,k,ii) + cor_ordang1(ii) - - end do - end do - - endif - - enddo ! channel loop - -! End of loop over diagnostic file - enddo loopd - close(lndiag) - write(6,*)' ' - write(6,*)'read in ',iread,' obs ',rread - write(6,*)' ' - - write(6,*)'nwater, nland, nice, nsnow, nmixed, ntotal = ', nwater, nland, nice, nsnow, nmixed, ntotal - nntotal=nnwater+nnland+nnsnow+nnmixed - write(6,*)'nnwater, nnland, nnsnow, nnmixed, nntotal = ', nnwater, nnland, nnsnow, nnmixed, nntotal - - - ! Create Control file - if ( imkctl == 1 ) then - write(6,*)'call create_ctl_angle' - if ( trim(gesanl) == 'ges' ) then - dfile = trim(satname) - else - dfile = trim(satname) // '_anl' - endif - - call create_ctl_angle(ntype,ftype,n_chan,iyy,imm,idd,ihh,& - ctl_file,lunctl,rmiss,dfile,satype,dplat,surf_nregion,& - surf_region,surf_rlonmin,surf_rlonmax,surf_rlatmin,surf_rlatmax,& - nu_chan,use, error, frequency,wavenumbr,nstep,start,step, little_endian) - else - write(6,*) 'imkctl =',imkctl - endif - - -! Write output to data file - if ( imkdata == 1 ) then - write(6,*)' ' - open(lungrd,file=data_file,form='unformatted') - write(lungrd) ((timang(i,j),i=1,nstep),j=1,n_chan) - do k=1,surf_nregion - write(lungrd) ((count(i,j,k),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd) ((penalty(i,j,k),i=1,nstep),j=1,n_chan) - end do - do ii=1,2 - do k=1,surf_nregion - write(lungrd)((omg_nbc(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((tot_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((omg_bc(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((fixang_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((lapse_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((lapse2_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((const_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((scangl_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((clw_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((cos_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((sin_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((emiss_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((ordang4_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((ordang3_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((ordang2_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((ordang1_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - end do - write(6,*)'write output to lungrd=',lungrd,', file=',trim(data_file) - close(lungrd) - else - write(6,*) 'imkctl =',imkctl - endif - - -! Deallocate arrays - write(6,*)' ' - write(6,*)'deallocate arrays' - deallocate(penalty,io_chan,nu_chan,wavenumbr,error,use,frequency) - deallocate(timang,tot_cor,omg_nbc,omg_bc,count) - goto 950 - - -! Jump to here if eof or error reading diagnostic file. -900 continue - write(6,*)'***PROBLEM reading diagnostic file. diag_rad=',diag_rad - close(lndiag) - - n_chan=nchanl - if (n_chan<=0) then - write(6,*)'***ERROR*** invalid nchanl=',nchanl,' STOP program' - call errexit(93) - endif - - allocate(timang(mstep,n_chan)) - allocate(count(mstep,n_chan,surf_nregion),& - penalty(mstep,n_chan,surf_nregion),& - omg_nbc(mstep,n_chan,surf_nregion,2),& - tot_cor(mstep,n_chan,surf_nregion,2),& - omg_bc(mstep,n_chan,surf_nregion,2)) - -! -! Initialze all output variables to rmiss -! -! - do j=1,n_chan - do i=1,mstep - timang(i,j) = rmiss - end do - end do - - write(6,*)'load missing value ',rmiss,' into output arrays. ',& - nstep,surf_nregion,n_chan - do ii=1,2 - do k=1,surf_nregion - do j=1,n_chan - do i=1,mstep - if (ii==1) then - count(i,j,k) = rmiss - penalty(i,j,k)= rmiss - endif - omg_nbc(i,j,k,ii) = rmiss - tot_cor(i,j,k,ii) = rmiss - omg_bc(i,j,k,ii) = rmiss - fixang_cor(i,j,k,ii) = rmiss - lapse_cor(i,j,k,ii) = rmiss - lapse2_cor(i,j,k,ii) = rmiss - clw_cor(i,j,k,ii) = rmiss - const_cor(i,j,k,ii) = rmiss - scangl_cor(i,j,k,ii) = rmiss - cos_cor(i,j,k,ii) = rmiss - sin_cor(i,j,k,ii) = rmiss - emiss_cor(i,j,k,ii) = rmiss - ordang4_cor(i,j,k,ii) = rmiss - ordang3_cor(i,j,k,ii) = rmiss - ordang2_cor(i,j,k,ii) = rmiss - ordang1_cor(i,j,k,ii) = rmiss - end do - end do - end do - end do - - if ( imkdata == 1 ) then - open(lungrd,file=data_file,form='unformatted') - write(lungrd) ((timang(i,j),i=1,nstep),j=1,n_chan) - do k=1,surf_nregion - write(lungrd) ((count(i,j,k),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd) ((penalty(i,j,k),i=1,nstep),j=1,n_chan) - end do - do ii=1,2 - do k=1,surf_nregion - write(lungrd)((omg_nbc(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((tot_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((omg_bc(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((fixang_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((lapse_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((lapse2_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((const_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((scangl_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((clw_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((cos_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((sin_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((emiss_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((ordang4_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((ordang3_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((ordang2_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((ordang1_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - end do - write(6,*)'write output to lungrd=',lungrd,', file=',trim(data_file) - close(lungrd) - endif - deallocate(timang,count,penalty,omg_nbc,omg_bc,tot_cor,& - fixang_cor,lapse_cor,lapse2_cor,const_cor,scangl_cor,clw_cor) - deallocate(cos_cor,sin_cor,emiss_cor,ordang1_cor,ordang2_cor,ordang3_cor,ordang4_cor) - -! End of program -950 continue - stop -end program angle diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radang.fd/create_ctl_angle.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radang.fd/create_ctl_angle.f90 deleted file mode 100755 index 6077ac6c1b..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radang.fd/create_ctl_angle.f90 +++ /dev/null @@ -1,176 +0,0 @@ -subroutine create_ctl_angle(ntype,ftype,n_chan,iyy,imm,idd,ihh,& - ctl_file,lunctl,rmiss,satname,satype,dplat,nregion,& - region,rlonmin,rlonmax,rlatmin,rlatmax,nu_chan,use,error,& - frequency,wavenumbr,nstep,start,step, little_endian) - - implicit none - - integer ntype - - character(2) cword - character(3),dimension(12):: mon - character(3):: clatmin,clatmax - character(4):: clonmin,clonmax - character(10),dimension(ntype):: ftype - character(13) stringd - character(20) satname - character(10) satype,dplat - character(40) ctl_file,grad_file - character(80) string - character(40),dimension(nregion):: region - character(80),dimension(nregion):: stringr - - integer nregion,iuse,klev,nstep - integer lunctl,iyy,imm,idd,ihh,j,i,n_chan,idhh,incr - integer iyy2,imm2,idd2,ihh2,ntime - integer, dimension(8):: ida,jda - integer,dimension(n_chan):: nu_chan - integer little_endian - - real rmiss,wavelength,start,step - real,dimension(5):: fha - real,dimension(n_chan):: error,use,frequency,wavenumbr - real,dimension(nregion):: rlonmin,rlonmax,rlatmin,rlatmax - - data stringd / '.%y4%m2%d2%h2' / - data mon / 'jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', & - 'aug', 'sep', 'oct', 'nov', 'dec' / - -!************************************************************************** - - write(6,*)'start create_ctl_angle' - write(6,*)' n_chan = ', n_chan - -! Create date for tdef based on given date and hour offset - - idhh=-720 ! this is 30 days back in hours. - incr=6 ! cycle interval - - fha=0.0; ida=0; jda=0; ntime=0 - iyy2=iyy; imm2=imm; idd2=idd; ihh2=ihh - if (idhh/=0) then - ntime = abs(idhh)/incr - fha(2)=idhh - ida(1)=iyy - ida(2)=imm - ida(3)=idd - ida(4)=0 - ida(5)=ihh - call w3movdat(fha,ida,jda) - iyy2=jda(1) - imm2=jda(2) - idd2=jda(3) - ihh2=jda(5) - endif - ntime=ntime+1 - -! Open unit to GrADS control file - open(lunctl,file=ctl_file,form='formatted') - -!******************************************************************* -! Construct the region strings if this is for a global source, -! which is defined as nregion > 1. -! - if (nregion > 1) then - do i=1,nregion - if (rlatmin(i)>0.) then - write(clatmin,10) int(rlatmin(i)) - else - write(clatmin,20) abs(int(rlatmin(i))) - endif - if (rlatmax(i)>0.) then - write(clatmax,10) int(rlatmax(i)) - else - write(clatmax,20) abs(int(rlatmax(i))) - endif - if (rlonmin(i)>0.) then - write(clonmin,30) int(rlonmin(i)) - else - write(clonmin,40) abs(int(rlonmin(i))) - endif - if (rlonmax(i)>0.) then - write(clonmax,30) int(rlonmax(i)) - else - write(clonmax,40) abs(int(rlonmax(i))) - endif - stringr(i) = trim(region(i)) // ' (' // & - trim(clonmin) // '-' // trim(clonmax) // ', ' // & - trim(clatmin) // '-' // trim(clatmax) // ')' - end do - endif -10 format(i2,'N') -20 format(i2,'S') -30 format(i3,'E') -40 format(i3,'W') - -! Write header information - grad_file = trim(satname) // stringd // '.ieee_d' - write(lunctl,100) grad_file - if (little_endian == 1 ) then - write( lunctl,112 ) - else - write( lunctl,110 ) - endif - write(lunctl,120) rmiss - write(lunctl,130) adjustl(satype),dplat,n_chan - write(lunctl,132) - write(lunctl,134) - do i=1,n_chan - iuse = nint(use(i)) - wavelength = 10000./wavenumbr(i) - write(lunctl,136) i,nu_chan(i),iuse,error(i),wavelength,frequency(i) - end do - write(lunctl,138) - - if (nregion > 1) then - do i=1,nregion - write(cword,'(i2)') i - string = '* region=' // cword // ' ' // trim(stringr(i)) - write(lunctl,140) string - end do - endif - write(lunctl,145) nstep,start,step - write(lunctl,150) n_chan - write(lunctl,160) nregion - write(lunctl,170) ntime,ihh2,idd2,mon(imm2),iyy2 - write(lunctl,180) ntype - -100 format('dset ^',a40) -110 format('options template big_endian sequential') -112 format('options template little_endian sequential') -120 format('undef ',f5.0) -130 format('title ',a10,1x,a10,1x,i4) -132 format('*XDEF is scan position') -134 format('*YDEF is channel number') -136 format('* y= ',i4,', channel= ',i4,' , iuse= ',i2,' , error= ',f8.3,& - ' , wlth= ',f9.2,' , freq= ',f9.2) -138 format('*ZDEF is geographic region') -140 format(a80) -145 format('xdef ',i3,' linear ',f5.1,1x,f5.1) -150 format('ydef ',i4,' linear 1.0 1.0') -160 format('zdef ',i2,' linear 1.0 1.0') -170 format('tdef ',i4,' linear ',i2.2,'Z',i2.2,a3,i4.4,' 06hr') -180 format('vars ',i7) - -! Write data portion of GraDS control file - do i=1,ntype - string = trim(ftype(i)) - klev=nregion - if (i==1) klev=1 - write(lunctl,190) adjustl(string),klev,trim(ftype(i)) -190 format(a10,1x,i2,' 0 ',a10) - end do - -! Write trminating "endvars" record - write(lunctl,200) -200 format('endvars') - - -! Close ctl file - close(lunctl) - - write(6,*)'finish create_ctl_angle' - -! Return - return -end subroutine create_ctl_angle diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radang.fd/makefile b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radang.fd/makefile deleted file mode 100755 index 2f8ff632ce..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radang.fd/makefile +++ /dev/null @@ -1,51 +0,0 @@ -# ***************************************************************** -# makefile.angle_bias -# -# Make the radmon_angle executable. -# -# ***************************************************************** - -BINDIR = ../../exec - -LIBS = $(W3NCO_LIB4) - -OBJS = kinds.o read_diag.o angle_bias.o create_ctl_angle.o - -# -# ***************************************************************** -# - -CMD = radmon_angle - -all: $(CMD) - -clean: - rm -f *.o - rm -f *.mod - rm -f $(CMD) - -check_prereqs: - $(PRE_REQ) $(LIBS) - -install: - cp -f $(CMD) $(BINDIR)/ - -debug: FFLAGS = $(D_FFLAGS) -debug: $(CMD) - -$(CMD): $(OBJS) - $(CF) $(FFLAGS) $(LDFLAGS) -o $(@) $(OBJS) $(LIBS) - - -kinds.o : kinds.F90 - $(CF) $(FFLAGS) -c $(*).F90 - -read_diag.o : read_diag.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -angle_bias.o : angle_bias.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -create_ctl_angle.o : create_ctl_angle.f90 - $(CF) $(FFLAGS) -c $(*).f90 - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radang.fd/read_diag.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radang.fd/read_diag.f90 deleted file mode 100755 index 7a4d6cdc49..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radang.fd/read_diag.f90 +++ /dev/null @@ -1,659 +0,0 @@ -!$$$ subprogram documentation block -! . . . . -! subprogram: read_raddiag read rad diag file -! prgmmr: tahara org: np20 date: 2003-01-01 -! -! abstract: This module contains code to process radiance -! diagnostic files. The module defines structures -! to contain information from the radiance -! diagnostic files and then provides two routines -! to access contents of the file. -! -! program history log: -! 2005-07-22 treadon - add this doc block -! 2010-10-05 treadon - refactor code to GSI standard -! 2010-10-08 zhu - use data_tmp to handle various npred values -! 2011-02-22 kleist - changes related to memory allocate/deallocate -! 2011-04-08 li - add tref, dtw, dtc to diag_data_fix_list, add tb_tz to diag_data_chan_list -! - correspondingly, change ireal_radiag (26 -> 30) and ipchan_radiag (7 -> 8) -! 2011-07-24 safford - make structure size for reading data_fix data version dependent -! 2013-11-21 todling - revisit how versions are set (add set/get_radiag) -! 2014-01-27 todling - add ob sensitivity index -! -! contains -! read_radiag_header - read radiance diagnostic file header -! read_radiag_data - read radiance diagnostic file data -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ - -module read_diag - - use kinds, only: i_kind,r_single - implicit none - -! Declare public and private - private - - public :: diag_header_fix_list - public :: diag_header_chan_list - public :: diag_data_name_list - public :: diag_data_fix_list - public :: diag_data_chan_list - public :: diag_data_extra_list - public :: read_radiag_header - public :: read_radiag_data -! public :: iversion_radiag -! public :: iversion_radiag_1 -! public :: iversion_radiag_2 -! public :: iversion_radiag_3 -! public :: iversion_radiag_4 - public :: ireal_radiag - public :: ipchan_radiag - public :: set_radiag - public :: get_radiag - - interface set_radiag - module procedure set_radiag_int_ ! internal procedure for integers - end interface - interface get_radiag - module procedure get_radiag_int_ ! internal procedure for integers - end interface - - integer(i_kind),parameter :: ireal_radiag = 30 ! number of real entries per spot in radiance diagnostic file - integer(i_kind),parameter :: ireal_old_radiag = 26 ! number of real entries per spot in versions older than iversion_radiag_2 - integer(i_kind),parameter :: ipchan_radiag = 8 ! number of entries per channel per spot in radiance diagnostic file - -! Declare structures for radiance diagnostic file information - type diag_header_fix_list - character(len=20) :: isis ! sat and sensor type - character(len=10) :: id ! sat type - character(len=10) :: obstype ! observation type - integer(i_kind) :: jiter ! outer loop counter - integer(i_kind) :: nchan ! number of channels in the sensor - integer(i_kind) :: npred ! number of updating bias correction predictors - integer(i_kind) :: idate ! time (yyyymmddhh) - integer(i_kind) :: ireal ! # of real elements in the fix part of a data record - integer(i_kind) :: ipchan ! # of elements for each channel except for bias correction terms - integer(i_kind) :: iextra ! # of extra elements for each channel - integer(i_kind) :: jextra ! # of extra elements - integer(i_kind) :: idiag ! first dimension of diag_data_chan - integer(i_kind) :: angord ! order of polynomial for adp_anglebc option - integer(i_kind) :: iversion ! radiance diagnostic file version number - integer(i_kind) :: inewpc ! indicator of newpc4pred (1 on, 0 off) - integer(i_kind) :: isens ! sensitivity index - end type diag_header_fix_list - - type diag_data_name_list - character(len=10),dimension(ireal_radiag) :: fix - character(len=10),dimension(:),allocatable :: chn - end type diag_data_name_list - - type diag_header_chan_list - real(r_single) :: freq ! frequency (Hz) - real(r_single) :: polar ! polarization - real(r_single) :: wave ! wave number (cm^-1) - real(r_single) :: varch ! error variance (or SD error?) - real(r_single) :: tlapmean ! mean lapse rate - integer(i_kind):: iuse ! use flag - integer(i_kind):: nuchan ! sensor relative channel number - integer(i_kind):: iochan ! satinfo relative channel number - end type diag_header_chan_list - - type diag_data_fix_list - real(r_single) :: lat ! latitude (deg) - real(r_single) :: lon ! longitude (deg) - real(r_single) :: zsges ! guess elevation at obs location (m) - real(r_single) :: obstime ! observation time relative to analysis - real(r_single) :: senscn_pos ! sensor scan position (integer(i_kind)) - real(r_single) :: satzen_ang ! satellite zenith angle (deg) - real(r_single) :: satazm_ang ! satellite azimuth angle (deg) - real(r_single) :: solzen_ang ! solar zenith angle (deg) - real(r_single) :: solazm_ang ! solar azimumth angle (deg) - real(r_single) :: sungln_ang ! sun glint angle (deg) - real(r_single) :: water_frac ! fractional coverage by water - real(r_single) :: land_frac ! fractional coverage by land - real(r_single) :: ice_frac ! fractional coverage by ice - real(r_single) :: snow_frac ! fractional coverage by snow - real(r_single) :: water_temp ! surface temperature over water (K) - real(r_single) :: land_temp ! surface temperature over land (K) - real(r_single) :: ice_temp ! surface temperature over ice (K) - real(r_single) :: snow_temp ! surface temperature over snow (K) - real(r_single) :: soil_temp ! soil temperature (K) - real(r_single) :: soil_mois ! soil moisture - real(r_single) :: land_type ! land type (integer(i_kind)) - real(r_single) :: veg_frac ! vegetation fraction - real(r_single) :: snow_depth ! snow depth - real(r_single) :: sfc_wndspd ! surface wind speed - real(r_single) :: qcdiag1 ! ir=cloud fraction, mw=cloud liquid water - real(r_single) :: qcdiag2 ! ir=cloud top pressure, mw=total column water - real(r_single) :: tref ! reference temperature (Tr) in NSST - real(r_single) :: dtw ! dt_warm at zob - real(r_single) :: dtc ! dt_cool at zob - real(r_single) :: tz_tr ! d(Tz)/d(Tr) - end type diag_data_fix_list - - type diag_data_chan_list - real(r_single) :: tbobs ! Tb (obs) (K) - real(r_single) :: omgbc ! Tb_(obs) - Tb_(simulated w/ bc) (K) - real(r_single) :: omgnbc ! Tb_(obs) - Tb_(simulated_w/o bc) (K) - real(r_single) :: errinv ! inverse error (K**(-1)) - real(r_single) :: qcmark ! quality control mark - real(r_single) :: emiss ! surface emissivity - real(r_single) :: tlap ! temperature lapse rate - real(r_single) :: tb_tz ! d(Tb)/d(Tz) - real(r_single) :: bicons ! constant bias correction term - real(r_single) :: biang ! scan angle bias correction term - real(r_single) :: biclw ! CLW bias correction term - real(r_single) :: bilap2 ! square lapse rate bias correction term - real(r_single) :: bilap ! lapse rate bias correction term - real(r_single) :: bicos ! node*cos(lat) bias correction term - real(r_single) :: bisin ! sin(lat) bias correction term - real(r_single) :: biemis ! emissivity sensitivity bias correction term - real(r_single),dimension(:),allocatable :: bifix ! angle dependent bias - real(r_single) :: bisst ! SST bias correction term - end type diag_data_chan_list - - type diag_data_extra_list - real(r_single) :: extra ! extra information - end type diag_data_extra_list - - integer(i_kind),save :: iversion_radiag ! Current version (see set routine) - integer(i_kind),parameter:: iversion_radiag_1 = 11104 ! Version when bias-correction entries were modified - integer(i_kind),parameter:: iversion_radiag_2 = 13784 ! Version when NSST entries were added - integer(i_kind),parameter:: iversion_radiag_3 = 19180 ! Version when SSMIS added - integer(i_kind),parameter:: iversion_radiag_4 = 30303 ! Version when emissivity predictor added - - real(r_single),parameter:: rmiss_radiag = -9.9e11_r_single - -contains - -subroutine set_radiag_int_ (what,iv,ier) -character(len=*),intent(in) :: what -integer(i_kind),intent(in) :: iv -integer(i_kind),intent(out):: ier -ier=-1 -if(trim(what)=='version') then - iversion_radiag = iv - ier=0 -endif -end subroutine set_radiag_int_ - -subroutine get_radiag_int_ (what,iv,ier) -character(len=*),intent(in) :: what -integer(i_kind),intent(out):: iv -integer(i_kind),intent(out):: ier -ier=-1 -if(trim(what)=='version') then - iv = iversion_radiag - ier=0 -endif -end subroutine get_radiag_int_ - -subroutine read_radiag_header(ftin,npred_radiag,retrieval,header_fix,header_chan,data_name,iflag,lverbose) -! . . . . -! subprogram: read_diag_header read rad diag header -! prgmmr: tahara org: np20 date: 2003-01-01 -! -! abstract: This routine reads the header record from a radiance -! diagnostic file -! -! program history log: -! 2010-10-05 treadon - add this doc block -! 2011-02-22 kleist - changes related to memory allocation and standard output -! -! input argument list: -! ftin - unit number connected to diagnostic file -! npred_radiag - number of bias correction terms -! retrieval - .true. if sst retrieval -! -! output argument list: -! header_fix - header information structure -! header_chan - channel information structure -! data_name - diag file data names -! iflag - error code -! lverbose - optional flag to turn off default output to standard out -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ - -! Declare passed arguments - integer(i_kind),intent(in) :: ftin - integer(i_kind),intent(in) :: npred_radiag - logical,intent(in) :: retrieval - type(diag_header_fix_list ),intent(out):: header_fix - type(diag_header_chan_list),allocatable :: header_chan(:) - type(diag_data_name_list) :: data_name - integer(i_kind),intent(out) :: iflag - logical,optional,intent(in) :: lverbose - -! Declare local variables - character(len=2):: string - character(len=10):: satid,sentype - character(len=20):: sensat - integer(i_kind) :: i,ich - integer(i_kind):: jiter,nchanl,npred,ianldate,ireal,ipchan,iextra,jextra - integer(i_kind):: idiag,angord,iversion,inewpc,isens - integer(i_kind):: iuse_tmp,nuchan_tmp,iochan_tmp - real(r_single) :: freq_tmp,polar_tmp,wave_tmp,varch_tmp,tlapmean_tmp - logical loutall - - loutall=.true. - if(present(lverbose)) loutall=lverbose - -! Read header (fixed_part). - read(ftin,IOSTAT=iflag) sensat,satid,sentype,jiter,nchanl,npred,ianldate,& - ireal,ipchan,iextra,jextra,idiag,angord,iversion,inewpc,isens - if (iflag/=0) then - rewind(ftin) - read(ftin,IOSTAT=iflag) sensat,satid,sentype,jiter,nchanl,npred,ianldate,& - ireal,ipchan,iextra,jextra,idiag,angord,iversion,inewpc - isens=0 - end if - - if (iflag/=0) then - rewind(ftin) - read(ftin,IOSTAT=iflag) sensat,satid,sentype,jiter,nchanl,npred,ianldate,& - ireal,ipchan,iextra,jextra - idiag=ipchan+npred+1 - angord=0 - iversion=0 - inewpc=0 - isens=0 - if (iflag/=0) then - write(6,*)'READ_RADIAG_HEADER: ***ERROR*** Unknown file format. Cannot read' - return - endif - endif - - header_fix%isis = sensat - header_fix%id = satid - header_fix%obstype = sentype - header_fix%jiter = jiter - header_fix%nchan = nchanl - header_fix%npred = npred - header_fix%idate = ianldate - header_fix%ireal = ireal - header_fix%ipchan = ipchan - header_fix%iextra = iextra - header_fix%jextra = jextra - header_fix%idiag = idiag - header_fix%angord = angord - header_fix%iversion= iversion - header_fix%inewpc = inewpc - header_fix%isens = isens - - if (loutall) then - write(6,*)'READ_RADIAG_HEADER: isis=',header_fix%isis,& - ' nchan=',header_fix%nchan,& - ' npred=',header_fix%npred,& - ' angord=',header_fix%angord,& - ' idiag=',header_fix%idiag,& - ' iversion=',header_fix%iversion,& - ' inewpc=',header_fix%inewpc,& - ' isens=',header_fix%isens - - if ( header_fix%iextra /= 0) & - write(6,*)'READ_RADIAG_HEADER: extra diagnostic information available, ',& - 'iextra=',header_fix%iextra - end if - - if (header_fix%npred /= npred_radiag) & - write(6,*) 'READ_RADIAG_HEADER: **WARNING** header_fix%npred,npred=',& - header_fix%npred,npred_radiag - -! Allocate and initialize as needed - if (allocated(header_chan)) deallocate(header_chan) - if (allocated(data_name%chn)) deallocate(data_name%chn) - - allocate(header_chan( header_fix%nchan)) - allocate(data_name%chn(header_fix%idiag)) - - data_name%fix(1) ='lat ' - data_name%fix(2) ='lon ' - data_name%fix(3) ='zsges ' - data_name%fix(4) ='obstim ' - data_name%fix(5) ='scanpos ' - data_name%fix(6) ='satzen ' - data_name%fix(7) ='satazm ' - data_name%fix(8) ='solzen ' - data_name%fix(9) ='solazm ' - data_name%fix(10)='sungln ' - data_name%fix(11)='fwater ' - data_name%fix(12)='fland ' - data_name%fix(13)='fice ' - data_name%fix(14)='fsnow ' - data_name%fix(15)='twater ' - data_name%fix(16)='tland ' - data_name%fix(17)='tice ' - data_name%fix(18)='tsnow ' - data_name%fix(19)='tsoil ' - data_name%fix(20)='soilmoi ' - data_name%fix(21)='landtyp ' - data_name%fix(22)='vegfrac ' - data_name%fix(23)='snowdep ' - data_name%fix(24)='wndspd ' - data_name%fix(25)='qc1 ' - data_name%fix(26)='qc2 ' - data_name%fix(27)='tref ' - data_name%fix(28)='dtw ' - data_name%fix(29)='dtc ' - data_name%fix(30)='tz_tr ' - - data_name%chn(1)='obs ' - data_name%chn(2)='omgbc ' - data_name%chn(3)='omgnbc ' - data_name%chn(4)='errinv ' - data_name%chn(5)='qcmark ' - data_name%chn(6)='emiss ' - data_name%chn(7)='tlap ' - data_name%chn(8)='tb_tz ' - - if (header_fix%iversion < iversion_radiag_1) then - data_name%chn( 8)= 'bifix ' - data_name%chn( 9)= 'bilap ' - data_name%chn(10)= 'bilap2 ' - data_name%chn(11)= 'bicons ' - data_name%chn(12)= 'biang ' - data_name%chn(13)= 'biclw ' - if (retrieval) data_name%chn(13)= 'bisst ' - elseif ( header_fix%iversion < iversion_radiag_2 .and. header_fix%iversion >= iversion_radiag_1 ) then - data_name%chn( 8)= 'bicons ' - data_name%chn( 9)= 'biang ' - data_name%chn(10)= 'biclw ' - data_name%chn(11)= 'bilap2 ' - data_name%chn(12)= 'bilap ' - do i=1,header_fix%angord - write(string,'(i2.2)') header_fix%angord-i+1 - data_name%chn(12+i)= 'bifix' // string - end do - data_name%chn(12+header_fix%angord+1)= 'bifix ' - data_name%chn(12+header_fix%angord+2)= 'bisst ' - elseif ( header_fix%iversion < iversion_radiag_3 .and. header_fix%iversion >= iversion_radiag_2 ) then - data_name%chn( 9)= 'bicons ' - data_name%chn(10)= 'biang ' - data_name%chn(11)= 'biclw ' - data_name%chn(12)= 'bilap2 ' - data_name%chn(13)= 'bilap ' - do i=1,header_fix%angord - write(string,'(i2.2)') header_fix%angord-i+1 - data_name%chn(13+i)= 'bifix' // string - end do - data_name%chn(13+header_fix%angord+1)= 'bifix ' - data_name%chn(13+header_fix%angord+2)= 'bisst ' - elseif ( header_fix%iversion < iversion_radiag_4 .and. header_fix%iversion >= iversion_radiag_3 ) then - data_name%chn( 9)= 'bicons ' - data_name%chn(10)= 'biang ' - data_name%chn(11)= 'biclw ' - data_name%chn(12)= 'bilap2 ' - data_name%chn(13)= 'bilap ' - data_name%chn(14)= 'bicos ' - data_name%chn(15)= 'bisin ' - do i=1,header_fix%angord - write(string,'(i2.2)') header_fix%angord-i+1 - data_name%chn(15+i)= 'bifix' // string - end do - data_name%chn(15+header_fix%angord+1)= 'bifix ' - data_name%chn(15+header_fix%angord+2)= 'bisst ' - else - data_name%chn( 9)= 'bicons ' - data_name%chn(10)= 'biang ' - data_name%chn(11)= 'biclw ' - data_name%chn(12)= 'bilap2 ' - data_name%chn(13)= 'bilap ' - data_name%chn(14)= 'bicos ' - data_name%chn(15)= 'bisin ' - data_name%chn(16)= 'biemis ' - do i=1,header_fix%angord - write(string,'(i2.2)') header_fix%angord-i+1 - data_name%chn(16+i)= 'bifix' // string - end do - data_name%chn(16+header_fix%angord+1)= 'bifix ' - data_name%chn(16+header_fix%angord+2)= 'bisst ' - endif - -! Read header (channel part) - do ich=1, header_fix%nchan - read(ftin,IOSTAT=iflag) freq_tmp,polar_tmp,wave_tmp,varch_tmp,tlapmean_tmp,iuse_tmp,nuchan_tmp,iochan_tmp - header_chan(ich)%freq = freq_tmp - header_chan(ich)%polar = polar_tmp - header_chan(ich)%wave = wave_tmp - header_chan(ich)%varch = varch_tmp - header_chan(ich)%tlapmean = tlapmean_tmp - header_chan(ich)%iuse = iuse_tmp - header_chan(ich)%nuchan = nuchan_tmp - header_chan(ich)%iochan = iochan_tmp - if (iflag/=0) return - end do - -! Construct array containing menonics for data record entries - - -end subroutine read_radiag_header - -subroutine read_radiag_data(ftin,header_fix,retrieval,data_fix,data_chan,data_extra,iflag ) -! . . . . -! subprogram: read_radiag_dat read rad diag data -! prgmmr: tahara org: np20 date: 2003-01-01 -! -! abstract: This routine reads the data record from a radiance -! diagnostic file -! -! program history log: -! 2010-10-05 treadon - add this doc block -! 2011-02-22 kleist - changes related to memory allocation -! -! input argument list: -! ftin - unit number connected to diagnostic file -! header_fix - header information structure -! -! output argument list: -! data_fix - spot header information structure -! data_chan - spot channel information structure -! data_extra - spot extra information -! iflag - error code -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ - - -! Declare passed arguments - integer(i_kind),intent(in) :: ftin - type(diag_header_fix_list ),intent(in) :: header_fix - logical,intent(in) :: retrieval - type(diag_data_fix_list) ,intent(out):: data_fix - type(diag_data_chan_list) ,allocatable :: data_chan(:) - type(diag_data_extra_list) ,allocatable :: data_extra(:,:) - integer(i_kind),intent(out) :: iflag - - integer(i_kind) :: ich,iang,i,j - real(r_single),dimension(:,:),allocatable :: data_tmp - real(r_single),dimension(:),allocatable :: fix_tmp - real(r_single),dimension(:,:),allocatable :: extra_tmp - -! Allocate arrays as needed - if (allocated(data_chan)) deallocate(data_chan) - allocate(data_chan(header_fix%nchan)) - - do ich=1,header_fix%nchan - if (allocated(data_chan(ich)%bifix)) deallocate(data_chan(ich)%bifix) - allocate(data_chan(ich)%bifix(header_fix%angord+1)) - end do - - if (header_fix%iextra > 0) then - if (allocated(data_extra)) deallocate(data_extra) - allocate(data_extra(header_fix%iextra,header_fix%jextra)) - allocate(extra_tmp(header_fix%iextra,header_fix%jextra)) - end if - -! Allocate arrays to hold data record - allocate(data_tmp(header_fix%idiag,header_fix%nchan)) - - if (header_fix%iversion < iversion_radiag_2) then - allocate( fix_tmp( ireal_old_radiag ) ) - else - allocate( fix_tmp( ireal_radiag ) ) - end if - -! Read data record - - if (header_fix%iextra == 0) then - read(ftin,IOSTAT=iflag) fix_tmp, data_tmp - else - read(ftin,IOSTAT=iflag) fix_tmp, data_tmp, extra_tmp - endif - - -! Transfer fix_tmp record to output structure - data_fix%lat = fix_tmp(1) - data_fix%lon = fix_tmp(2) - data_fix%zsges = fix_tmp(3) - data_fix%obstime = fix_tmp(4) - data_fix%senscn_pos = fix_tmp(5) - data_fix%satzen_ang = fix_tmp(6) - data_fix%satazm_ang = fix_tmp(7) - data_fix%solzen_ang = fix_tmp(8) - data_fix%solazm_ang = fix_tmp(9) - data_fix%sungln_ang = fix_tmp(10) - data_fix%water_frac = fix_tmp(11) - data_fix%land_frac = fix_tmp(12) - data_fix%ice_frac = fix_tmp(13) - data_fix%snow_frac = fix_tmp(14) - data_fix%water_temp = fix_tmp(15) - data_fix%land_temp = fix_tmp(16) - data_fix%ice_temp = fix_tmp(17) - data_fix%snow_temp = fix_tmp(18) - data_fix%soil_temp = fix_tmp(19) - data_fix%soil_mois = fix_tmp(20) - data_fix%land_type = fix_tmp(21) - data_fix%veg_frac = fix_tmp(22) - data_fix%snow_depth = fix_tmp(23) - data_fix%sfc_wndspd = fix_tmp(24) - data_fix%qcdiag1 = fix_tmp(25) - data_fix%qcdiag2 = fix_tmp(26) - - if ( header_fix%iversion <= iversion_radiag_1 ) then - data_fix%tref = rmiss_radiag - data_fix%dtw = rmiss_radiag - data_fix%dtc = rmiss_radiag - data_fix%tz_tr = rmiss_radiag - else - data_fix%tref = fix_tmp(27) - data_fix%dtw = fix_tmp(28) - data_fix%dtc = fix_tmp(29) - data_fix%tz_tr = fix_tmp(30) - end if - - -! Transfer data record to output structure - do ich=1,header_fix%nchan - data_chan(ich)%tbobs =data_tmp(1,ich) - data_chan(ich)%omgbc =data_tmp(2,ich) - data_chan(ich)%omgnbc=data_tmp(3,ich) - data_chan(ich)%errinv=data_tmp(4,ich) - data_chan(ich)%qcmark=data_tmp(5,ich) - data_chan(ich)%emiss =data_tmp(6,ich) - data_chan(ich)%tlap =data_tmp(7,ich) - data_chan(ich)%tb_tz =data_tmp(8,ich) - end do - if (header_fix%iversion < iversion_radiag_1) then - do ich=1,header_fix%nchan - data_chan(ich)%bifix(1)=data_tmp(8,ich) - data_chan(ich)%bilap =data_tmp(9,ich) - data_chan(ich)%bilap2 =data_tmp(10,ich) - data_chan(ich)%bicons =data_tmp(11,ich) - data_chan(ich)%biang =data_tmp(12,ich) - data_chan(ich)%biclw =data_tmp(13,ich) - data_chan(ich)%bisst = rmiss_radiag - if (retrieval) then - data_chan(ich)%biclw =rmiss_radiag - data_chan(ich)%bisst =data_tmp(13,ich) - endif - end do - elseif ( header_fix%iversion < iversion_radiag_2 .and. header_fix%iversion >= iversion_radiag_1 ) then - do ich=1,header_fix%nchan - data_chan(ich)%bicons=data_tmp(8,ich) - data_chan(ich)%biang =data_tmp(9,ich) - data_chan(ich)%biclw =data_tmp(10,ich) - data_chan(ich)%bilap2=data_tmp(11,ich) - data_chan(ich)%bilap =data_tmp(12,ich) - end do - do ich=1,header_fix%nchan - do iang=1,header_fix%angord+1 - data_chan(ich)%bifix(iang)=data_tmp(12+iang,ich) - end do - data_chan(ich)%bisst = data_tmp(12+header_fix%angord+2,ich) - end do - elseif ( header_fix%iversion < iversion_radiag_3 .and. header_fix%iversion >= iversion_radiag_2 ) then - do ich=1,header_fix%nchan - data_chan(ich)%bicons=data_tmp(9,ich) - data_chan(ich)%biang =data_tmp(10,ich) - data_chan(ich)%biclw =data_tmp(11,ich) - data_chan(ich)%bilap2=data_tmp(12,ich) - data_chan(ich)%bilap =data_tmp(13,ich) - end do - do ich=1,header_fix%nchan - do iang=1,header_fix%angord+1 - data_chan(ich)%bifix(iang)=data_tmp(13+iang,ich) - end do - data_chan(ich)%bisst = data_tmp(13+header_fix%angord+2,ich) - end do - elseif ( header_fix%iversion < iversion_radiag_4 .and. header_fix%iversion >= iversion_radiag_3 ) then - do ich=1,header_fix%nchan - data_chan(ich)%bicons=data_tmp(9,ich) - data_chan(ich)%biang =data_tmp(10,ich) - data_chan(ich)%biclw =data_tmp(11,ich) - data_chan(ich)%bilap2=data_tmp(12,ich) - data_chan(ich)%bilap =data_tmp(13,ich) - data_chan(ich)%bicos =data_tmp(14,ich) ! 1st bias correction term node*cos(lat) for SSMIS - data_chan(ich)%bisin =data_tmp(15,ich) ! 2nd bias correction term sin(lat) for SSMI - end do - do ich=1,header_fix%nchan - do iang=1,header_fix%angord+1 - data_chan(ich)%bifix(iang)=data_tmp(15+iang,ich) - end do - data_chan(ich)%bisst = data_tmp(15+header_fix%angord+2,ich) - end do - else - do ich=1,header_fix%nchan - data_chan(ich)%bicons=data_tmp(9,ich) - data_chan(ich)%biang =data_tmp(10,ich) - data_chan(ich)%biclw =data_tmp(11,ich) - data_chan(ich)%bilap2=data_tmp(12,ich) - data_chan(ich)%bilap =data_tmp(13,ich) - data_chan(ich)%bicos =data_tmp(14,ich) - data_chan(ich)%bisin =data_tmp(15,ich) - data_chan(ich)%biemis=data_tmp(16,ich) - end do - do ich=1,header_fix%nchan - do iang=1,header_fix%angord+1 - data_chan(ich)%bifix(iang)=data_tmp(16+iang,ich) - end do - data_chan(ich)%bisst = data_tmp(16+header_fix%angord+2,ich) - end do - endif - - if (header_fix%iextra > 0) then - do j=1,header_fix%jextra - do i=1,header_fix%iextra - data_extra(i,j)%extra=extra_tmp(i,j) - end do - end do - endif - - deallocate(data_tmp, fix_tmp) - if (header_fix%iextra > 0) deallocate(extra_tmp) - -end subroutine read_radiag_data - -end module read_diag - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radang.fd/readme b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radang.fd/readme deleted file mode 100644 index da9740f8d3..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radang.fd/readme +++ /dev/null @@ -1,25 +0,0 @@ -Instructions for building radmon_angle executable. - - 1) Load the build module appropriate for your Machine: - i.) - WCOSS: - "module use -a ../../modulefiles/wcoss" - CRAY: - "module use -a ../../modulefiles/cray" - THEIA: - "module use -a ../../modulefiles/theia" - ii.) - "module load RadMonBuild" - - 2) Optional: verify all prerequisites are met by typing: - "make check_prereqs" - - 3) Build the executable by typing: - "make" - - 4) Move the executable to the ../../exec directory by typing: - "make install" - - 5) Unload the build module: - "module unload RadMonBuild" - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radbcoef.fd/bcoef.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radbcoef.fd/bcoef.f90 deleted file mode 100755 index 08b4f13a50..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radbcoef.fd/bcoef.f90 +++ /dev/null @@ -1,355 +0,0 @@ -program bcoef - use read_diag - use kinds, only: r_kind,i_kind,r_quad - - implicit none - integer ntype,maxpred - parameter (ntype=13) - parameter (maxpred=12) - - logical eof - - character(10),dimension(ntype):: ftype - character(20) dum,satname,stringd,satsis,isis,mod_satname - character(10) satype,dplat - character(40) string,diag_rad,data_file,ctl_file - character(10) suffix - - integer luname,lungrd,lunctl,lncoef,lndiag,ich - integer iyy,imm,idd,ihh,idhh,incr,iread,iflag - integer n_chan,j,i,k,idum,ichan - integer,allocatable,dimension(:):: io_chan,nu_chan - integer npred_radiag - integer(i_kind) angord,ntlapupdate - - real pen,rmiss,weight,rread - real,allocatable,dimension(:):: wavenumbr,count,error,& - use,frequency,penalty,predr - real,allocatable,dimension(:,:):: coefs - real(r_kind) tlapm, tsum - -! Variables for reading satellite data - type(diag_header_fix_list ) :: header_fix - type(diag_header_chan_list),allocatable :: header_chan(:) - type(diag_data_name_list ) :: data_name - type(diag_data_fix_list ) :: data_fix - type(diag_data_chan_list ),allocatable :: data_chan(:) - type(diag_data_extra_list ),allocatable :: data_extra(:,:) - -! Namelist with defaults - integer :: npredr = 12 - logical :: retrieval = .false. - integer :: nchanl = 19 - integer :: imkctl = 1 - integer :: imkdata = 1 - character(3) :: gesanl ='ges' - integer :: little_endian = 1 - namelist /input/ satname,npredr,nchanl,iyy,imm,idd,ihh,idhh,& - incr,suffix,imkctl,imkdata,retrieval,gesanl,little_endian - - data luname,lungrd,lunctl / 5, 51, 52 / - data lncoef,lndiag / 21, 22 / - data rmiss /-999./ - data stringd / '.%y4%m2%d2%h2' / -!************************************************************************ -! Explanation of the fype array -! These are values used within the generated GrADS control file -! (bcoef.ctl). A fuller discription of the terms is thus: -! -! mean pred(1) = global offset (mean) -! atmpath pred(2) = not used when adp_anglebc=.true. and newpc4pred=.true. -! clw pred(3) = cloud liquid water term -! lapse2 pred(4) = (temperature lapse rate)**2 -! lapse pred(5) = temperature lapse rate -! cos_ssmis pred(6) = cosine term for SSMIS -! sin_ssmis pred(7) = sine term for SSMIS -! emiss pred(8) = emissivity sensitivity term -! ordang4 pred(9) = 4th order angle term -! ordang3 pred(10) = 3rd order angle term -! ordang2 pred(11) = 2nd order angle term -! ordang1 pred(12) = 1st order angle term -! -! Note that the npred namelist indicates how many of these terms -! will to be processed by this program. The default value is 12, -! meaning all will be processed. Earlier versions processed only the -! first 5. In all cases 12 values will be written to the resulting -! data file though if npred < 12 then the unprocessed values will -! all be set to rmiss. -!************************************************************************ - data ftype / 'penalty','mean','atmpath','clw','lapse2','lapse',& - 'cos_ssmis','sin_ssmis','emiss','ordang4','ordang3',& - 'ordang2','ordang1' / -!************************************************************************ -! - - -!************************************************************************ -! -! Initialize variables - iread=0 - npred_radiag = 12 - angord = 0 - -! Read namelist input - read(luname,input) - write(6,input) - write(6,*)'gesanl = ', gesanl - write(6,*)' ' - -! Check for user requests exceeding assumed limits - if (npredr>maxpred) then - write(6,*)' ' - write(6,*)'***ERROR*** user specified predictors > maximum allowed' - write(6,*)' npredr,maxpred=',npredr,maxpred - call errexit(91) - endif - - -! Set satellite id for specified satellite/sensor - write(6,*)'satname ',satname - - -! Create filenames for diagnostic input, binary output file - write(stringd,100) iyy,imm,idd,ihh -100 format('.',i4.4,3i2.2) - - if ( trim(gesanl) == 'ges' ) then - diag_rad = trim(satname) - data_file= trim(satname) // trim(stringd) // '.ieee_d' - ctl_file = trim(satname) // '.ctl' - else - diag_rad = trim(satname) // '_anl' - data_file= trim(satname) // '_anl' // trim(stringd) // '.ieee_d' - ctl_file = trim(satname) // '_anl.ctl' - endif - - write(6,*)'diag_rad =',diag_rad - write(6,*)'data_file=',data_file - write(6,*)'ctl_file =',ctl_file - write(6,*)'suffix =',suffix - - -! Open unit to diagnostic file. Read portion of header to -! see if file exists - open(lndiag,file=diag_rad,form='unformatted') - read(lndiag,err=900,end=900) dum - rewind lndiag - -! File exists. Read header - write(6,*)'call read_diag_header' - call read_radiag_header( lndiag, npred_radiag, retrieval, header_fix,& - header_chan, data_name, iflag ) - if( iflag/=0 ) then - write(6,*)'***ERROR*** problem reading diag file header, iflag=',iflag - call errexit(91) - endif - -! Extract observation type, satellite id, and number of channels - satype = header_fix%obstype - satsis = header_fix%isis - dplat = header_fix%id - n_chan = header_fix%nchan - angord = header_fix%angord - - if (angord == 4 ) then - npredr = 12 - endif - - write(6,*)'satype,n_chan=',satype,' ',dplat,n_chan - write(6,*)'angord = ', angord - - string = trim(satype)//'_'//trim(dplat) - write(6,*)'string,satname=',string,' ',satname - if ( trim(string) /= trim(satname) ) then - write(6,*)'***ERROR*** inconsistent instrument types' - write(6,*)' satname,string =',satname,' ',string - call errexit(93) - endif - - -! Allocate arrays to hold observational information - write(6,*)' ' - write(6,*)'allocate arrays' - allocate (io_chan(n_chan), nu_chan(n_chan), wavenumbr(n_chan)) - allocate (count(n_chan), penalty(n_chan), use(n_chan), & - frequency(n_chan)) - allocate(coefs(n_chan,maxpred)) - -! Zero accumulator arrays - do j=1,n_chan - count(j) = 0.0 - penalty(j) = 0.0 - end do - coefs = rmiss - - -! Extract satinfo relative index - do j=1,n_chan - nu_chan(j) = real( header_chan(j)%nuchan, 4 ) - io_chan(j) = real( header_chan(j)%iochan, 4 ) - wavenumbr(j) = real( header_chan(j)%wave, 4 ) - use(j) = real( header_chan(j)%iuse, 4 ) - frequency(j) = real( header_chan(j)%freq, 4) - end do - -! Loop to read entries in diagnostic file - iflag = 0 - loopd: do while (iflag == 0) - -! Read a record. If read flag, iflag does not equal zero, exit loopd - call read_radiag_data( lndiag, header_fix, retrieval, data_fix, data_chan,& - data_extra, iflag ) - if( iflag /= 0 ) exit loopd - iread=iread+1 - rread=rread+1.0 - - -! Channel loop - do j = 1, n_chan - -! If observation was assimilated, accumulate sum - if (data_chan(j)%errinv > 1.e-6) then -! pen = data_chan(j)%errinv*(data_chan(j)%omgbc)**2 - pen = (data_chan(j)%errinv*(data_chan(j)%omgbc))**2 - count(j) = count(j) + 1.0 - penalty(j) = penalty(j) + pen - endif - - enddo ! channel loop - -! End of loop over diagnostic file - enddo loopd - close(lndiag) - write(6,*)' ' - write(6,*)'read in ',iread,' obs ',rread - write(6,*)' ' - -! Compute average. - do j=1,n_chan - if (count(j)>0) then - penalty(j)=penalty(j)/count(j) - else - count(j)=rmiss - penalty(j)=rmiss - endif - end do - - -! Open unit to input data file. See if file exists - open(lncoef,file='biascr.txt',form='formatted') - if (angord == 4 ) then - read(lncoef,122,end=920,err=920) idum - else - read(lncoef,120,end=920,err=920) idum - endif - rewind(lncoef) -120 format(I5,1x,A20,1x,I5,10f12.6) -122 format(I5,1x,A20,1x,I5,2e15.6,1x,I5/2(4x,10f12.6/)) - -!read(lunin,'(I5,1x,A20,1x,I5,2e15.6,1x,I5/2(4x,10f12.6/))',iostat=istat,end=1333) -!ich,isis,& ichan,tlapm,tsum,ntlapupdate,(predr(ip),ip=1,npred), where npred=12 - -! Read coefficient file - allocate(predr(npredr)) - i=0 - k=1 - eof=.false. - do - if (angord /= 4 ) then - read(lncoef,120,IOSTAT=iflag) ich,isis,ichan,(predr(j),j=1,npredr) - else - read(lncoef,122,IOSTAT=iflag) ich,isis,ichan, tlapm,tsum,ntlapupdate,(predr(j),j=1,npredr) - endif - if(iflag /=0) exit - if (trim(isis)==trim(satsis)) then - io_chan(k)=ichan - do j=1,npredr - coefs(k,j)=predr(j) - end do - k=k+1 - cycle - endif - end do - close(lncoef) - deallocate(predr) - - ! Create Control file - if ( imkctl == 1 ) then - write(6,*)'call create_ctl_bcoef' - - if ( trim(gesanl) == 'ges' ) then - mod_satname = trim(satname) - else - mod_satname = trim(satname) // '_anl' - endif - - call create_ctl_bcoef(ntype,ftype,n_chan,iyy,imm,idd,ihh,idhh,& - incr,ctl_file,lunctl,rmiss,mod_satname,satype,dplat,& - nu_chan,use,penalty,frequency,wavenumbr,little_endian) - else - write(6,*) 'imkctl =',imkctl - endif - - -! Write data to binary output file - if ( imkdata == 1 ) then - write(6,*)'write data to lungrd=',lungrd - open(lungrd,file=data_file,form='unformatted') - write(lungrd) (penalty(k),k=1,n_chan) - do j=1,maxpred - write(lungrd) (coefs(k,j),k=1,n_chan) - end do - close(lungrd) - endif - -! Deallocate arrays - write(6,*)'deallocate arrays' - deallocate(coefs,io_chan,nu_chan,wavenumbr,count,penalty,use,frequency) - goto 950 - - -! Jump here if problem reading diagnostic file -900 continue - write(6,*)'***PROBLEM*** reading diagnostic file' - - n_chan=nchanl - if (n_chan<=0) then - write(6,*)'***ERROR*** invalid nchanl=',nchanl,' STOP program' - call errexit(94) - endif - - write(6,*)'load missing value ',rmiss,' into output arrays. ',& - n_chan,npredr - allocate(penalty(n_chan),coefs(n_chan,npredr)) - do k=1,n_chan - penalty(k)=rmiss - end do - do j=1,npredr - do k=1,n_chan - coefs(k,j)=rmiss - end do - end do - - if ( imkdata == 1 ) then - open(lungrd,file=data_file,form='unformatted') - write(lungrd) (penalty(k),k=1,n_chan) - do j=1,npredr - write(lungrd) (coefs(k,j),k=1,n_chan) - end do - write(6,*)'write output to lungrd=',lungrd,', file=',trim(data_file) - close(lungrd) - endif - deallocate(penalty,coefs) - - goto 950 - - -! Jump here if problem reading coefficient file -920 continue - write(6,*)'***PROBLEM*** reading coefficient file' - - -! End of program -950 continue - stop -end program bcoef diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radbcoef.fd/create_ctl_bcoef.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radbcoef.fd/create_ctl_bcoef.f90 deleted file mode 100755 index f8f785dcc6..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radbcoef.fd/create_ctl_bcoef.f90 +++ /dev/null @@ -1,147 +0,0 @@ -subroutine create_ctl_bcoef(ntype,ftype,n_chan,iyy,imm,idd,ihh,idhh,& - incr,ctl_file,lunctl,rmiss,satname,satype,dplat,& - nu_chan,use,ratio,frequency,wavenumbr,little_endian) - - implicit none - - integer ntype - - character(2) cword - character(3),dimension(12):: mon - character(3):: clatmin,clatmax - character(4):: clonmin,clonmax - character(10),dimension(ntype):: ftype - character(13) stringd - character(20) satname - character(10) satype,dplat - character(40) ctl_file,grad_file - character(80) string - - integer idsat,iuse,little_endian - integer lunctl,iyy,imm,idd,ihh,j,i,n_chan,idhh,incr - integer iyy2,imm2,idd2,ihh2,ntime - integer,dimension(8):: ida,jda - integer,dimension(n_chan):: nu_chan - - real rmiss,wavelength - real,dimension(5):: fha - real,dimension(n_chan):: ratio,use,frequency,wavenumbr - - data stringd / '.%y4%m2%d2%h2' / - data mon / 'jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', & - 'aug', 'sep', 'oct', 'nov', 'dec' / - -!************************************************************************** -! Create date for tdef based on given date and hour offset - fha=0.0; ida=0; jda=0; ntime=0 - iyy2=iyy; imm2=imm; idd2=idd; ihh2=ihh - if (idhh/=0) then - ntime = abs(idhh)/incr - fha(2)=idhh - ida(1)=iyy - ida(2)=imm - ida(3)=idd - ida(4)=0 - ida(5)=ihh - call w3movdat(fha,ida,jda) - iyy2=jda(1) - imm2=jda(2) - idd2=jda(3) - ihh2=jda(5) - endif - ntime=ntime+1 - -! Open unit to GrADS control file - open(lunctl,file=ctl_file,form='formatted') - - -! Write header information - grad_file = trim(satname) // stringd // '.ieee_d' - write(lunctl,100) grad_file - if ( little_endian == 1 ) then - write(lunctl,112) - else - write(lunctl,110) - endif - write(lunctl,120) rmiss - write(lunctl,130) adjustl(satype),dplat,n_chan - write(lunctl,132) - do i=1,n_chan - iuse = nint(use(i)) - wavelength = 10000./wavenumbr(i) - write(lunctl,134) i,nu_chan(i),iuse,ratio(i),wavelength,frequency(i) - end do - - write(lunctl,210) - write(lunctl,211) - write(lunctl,212) - write(lunctl,213) - write(lunctl,214) - write(lunctl,215) - write(lunctl,216) - write(lunctl,217) - write(lunctl,218) - write(lunctl,219) - write(lunctl,220) - write(lunctl,221) - write(lunctl,222) - write(lunctl,223) - write(lunctl,224) - write(lunctl,210) - - write(lunctl,140) n_chan - write(lunctl,150) - write(lunctl,160) - write(lunctl,170) ntime,ihh2,idd2,mon(imm2),iyy2 - write(lunctl,180) ntype - -100 format('dset ^',a40) -110 format('options template big_endian sequential') -112 format('options template little_endian sequential') -120 format('undef ',f5.0) -130 format('title ',a10,1x,a10,1x,i4) -132 format('*XDEF is channel number') -134 format('* x= ',i4,', channel= ',i4,' , iuse= ',i2,' , ratio= ',f8.3,& - ' , wlth= ',f9.2,' , freq= ',f9.2) -136 format('* ',a70) -140 format('xdef ',i4,' linear 1.0 1.0') -150 format('ydef 1 linear 1.0 1.0') -160 format('zdef 1 linear 1.0 1.0') -170 format('tdef ',i4,' linear ',i2.2,'Z',i2.2,a3,i4.4,' 06hr') -180 format('vars ',i7) - -210 format('*') -211 format('* Explanation of data terms:') -212 format('* penalty penalty value') -213 format('* mean global offset (mean)') -214 format('* atmpath not used when adp_anglebc=.true. and newpc4pred=.true.') -215 format('* clw cloud liquid water term') -216 format('* lapse2 temperature lapse rate**2') -217 format('* lapse temperature lapse rate') -218 format('* cos_ssmis cosine term for SSMIS') -219 format('* sin_ssmis sine term for SSMIS') -220 format('* emiss emissivity sensitivity term') -221 format('* 4ordang 4th order angle term') -222 format('* 3ordang 3rd order angle term') -223 format('* 2ordang 2nd order angle term') -224 format('* 1ordang 1st order angle term') - - -! Write data portion of GraDS control file - do i=1,ntype - string = trim(ftype(i)) - write(lunctl,190) adjustl(string),trim(ftype(i)) -190 format(a10,' 0 0 ',a10) - end do - -! Write trminating "endvars" record - write(lunctl,200) -200 format('endvars') - - -! Close ctl file - close(lunctl) - -! Return - return -end subroutine create_ctl_bcoef diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radbcoef.fd/kinds.F90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radbcoef.fd/kinds.F90 deleted file mode 100644 index 8b3a2fcc4e..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radbcoef.fd/kinds.F90 +++ /dev/null @@ -1,112 +0,0 @@ -module kinds -!$$$ module documentation block -! . . . . -! module: kinds -! prgmmr: treadon org: np23 date: 2004-08-15 -! -! abstract: Module to hold specification kinds for variable declaration. -! This module is based on (copied from) Paul vanDelst's -! type_kinds module found in the community radiative transfer -! model -! -! module history log: -! 2004-08-15 treadon -! 2011-07-04 todling - define main precision during compilation -! -! Subroutines Included: -! -! Functions Included: -! -! remarks: -! The numerical data types defined in this module are: -! i_byte - specification kind for byte (1-byte) integer variable -! i_short - specification kind for short (2-byte) integer variable -! i_long - specification kind for long (4-byte) integer variable -! i_llong - specification kind for double long (8-byte) integer variable -! r_single - specification kind for single precision (4-byte) real variable -! r_double - specification kind for double precision (8-byte) real variable -! r_quad - specification kind for quad precision (16-byte) real variable -! -! i_kind - generic specification kind for default integer -! r_kind - generic specification kind for default floating point -! -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ end documentation block - implicit none - private - -! Integer type definitions below - -! Integer types - integer, parameter, public :: i_byte = selected_int_kind(1) ! byte integer - integer, parameter, public :: i_short = selected_int_kind(4) ! short integer - integer, parameter, public :: i_long = selected_int_kind(8) ! long integer - integer, parameter, private :: llong_t = selected_int_kind(16) ! llong integer - integer, parameter, public :: i_llong = max( llong_t, i_long ) - -! Expected 8-bit byte sizes of the integer kinds - integer, parameter, public :: num_bytes_for_i_byte = 1 - integer, parameter, public :: num_bytes_for_i_short = 2 - integer, parameter, public :: num_bytes_for_i_long = 4 - integer, parameter, public :: num_bytes_for_i_llong = 8 - -! Define arrays for default definition - integer, parameter, private :: num_i_kinds = 4 - integer, parameter, dimension( num_i_kinds ), private :: integer_types = (/ & - i_byte, i_short, i_long, i_llong /) - integer, parameter, dimension( num_i_kinds ), private :: integer_byte_sizes = (/ & - num_bytes_for_i_byte, num_bytes_for_i_short, & - num_bytes_for_i_long, num_bytes_for_i_llong /) - -! Default values -! **** CHANGE THE FOLLOWING TO CHANGE THE DEFAULT INTEGER TYPE KIND *** - integer, parameter, private :: default_integer = 3 ! 1=byte, - ! 2=short, - ! 3=long, - ! 4=llong - integer, parameter, public :: i_kind = integer_types( default_integer ) - integer, parameter, public :: num_bytes_for_i_kind = & - integer_byte_sizes( default_integer ) - - -! Real definitions below - -! Real types - integer, parameter, public :: r_single = selected_real_kind(6) ! single precision - integer, parameter, public :: r_double = selected_real_kind(15) ! double precision - integer, parameter, private :: quad_t = selected_real_kind(20) ! quad precision - integer, parameter, public :: r_quad = max( quad_t, r_double ) - -! Expected 8-bit byte sizes of the real kinds - integer, parameter, public :: num_bytes_for_r_single = 4 - integer, parameter, public :: num_bytes_for_r_double = 8 - integer, parameter, public :: num_bytes_for_r_quad = 16 - -! Define arrays for default definition - integer, parameter, private :: num_r_kinds = 3 - integer, parameter, dimension( num_r_kinds ), private :: real_kinds = (/ & - r_single, r_double, r_quad /) - integer, parameter, dimension( num_r_kinds ), private :: real_byte_sizes = (/ & - num_bytes_for_r_single, num_bytes_for_r_double, & - num_bytes_for_r_quad /) - -! Default values -! **** CHANGE THE FOLLOWING TO CHANGE THE DEFAULT REAL TYPE KIND *** -#ifdef _REAL4_ - integer, parameter, private :: default_real = 1 ! 1=single, -#endif -#ifdef _REAL8_ - integer, parameter, private :: default_real = 2 ! 2=double, -#endif -#ifdef _REAL16_ - integer, parameter, private :: default_real = 3 ! 3=quad -#endif - integer, parameter, public :: r_kind = real_kinds( default_real ) - integer, parameter, public :: num_bytes_for_r_kind = & - real_byte_sizes( default_real ) - -end module kinds diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radbcoef.fd/makefile b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radbcoef.fd/makefile deleted file mode 100755 index ed3694558d..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radbcoef.fd/makefile +++ /dev/null @@ -1,49 +0,0 @@ -# ***************************************************************** -# makefile.bcoef -# -# Make the radmon_bcoef executable. -# -# ***************************************************************** - -BINDIR = ../../exec - -LIBS = $(W3NCO_LIB4) - -OBJS = kinds.o read_diag.o bcoef.o create_ctl_bcoef.o - -# -# ***************************************************************** -# - -CMD = radmon_bcoef - -all: $(CMD) - -clean: - rm -f *.o - rm -f *.mod - rm -f radmon_bcoef - -check_prereqs: - $(CHECK_LIBS) $(LIBS) - -install: - cp -f $(CMD) $(BINDIR)/ - -debug: FFLAGS = $(D_FFLAGS) -debug: $(CMD) - -$(CMD): $(OBJS) - $(CF) $(FFLAGS) $(LDFLAGS) -o $(@) $(OBJS) $(LIBS) - -read_diag.o : read_diag.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -bcoef.o : bcoef.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -create_ctl_bcoef.o : create_ctl_bcoef.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -kinds.o : kinds.F90 - $(CF) $(FFLAGS) -c $(*).F90 diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radbcoef.fd/read_diag.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radbcoef.fd/read_diag.f90 deleted file mode 100755 index 7a4d6cdc49..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radbcoef.fd/read_diag.f90 +++ /dev/null @@ -1,659 +0,0 @@ -!$$$ subprogram documentation block -! . . . . -! subprogram: read_raddiag read rad diag file -! prgmmr: tahara org: np20 date: 2003-01-01 -! -! abstract: This module contains code to process radiance -! diagnostic files. The module defines structures -! to contain information from the radiance -! diagnostic files and then provides two routines -! to access contents of the file. -! -! program history log: -! 2005-07-22 treadon - add this doc block -! 2010-10-05 treadon - refactor code to GSI standard -! 2010-10-08 zhu - use data_tmp to handle various npred values -! 2011-02-22 kleist - changes related to memory allocate/deallocate -! 2011-04-08 li - add tref, dtw, dtc to diag_data_fix_list, add tb_tz to diag_data_chan_list -! - correspondingly, change ireal_radiag (26 -> 30) and ipchan_radiag (7 -> 8) -! 2011-07-24 safford - make structure size for reading data_fix data version dependent -! 2013-11-21 todling - revisit how versions are set (add set/get_radiag) -! 2014-01-27 todling - add ob sensitivity index -! -! contains -! read_radiag_header - read radiance diagnostic file header -! read_radiag_data - read radiance diagnostic file data -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ - -module read_diag - - use kinds, only: i_kind,r_single - implicit none - -! Declare public and private - private - - public :: diag_header_fix_list - public :: diag_header_chan_list - public :: diag_data_name_list - public :: diag_data_fix_list - public :: diag_data_chan_list - public :: diag_data_extra_list - public :: read_radiag_header - public :: read_radiag_data -! public :: iversion_radiag -! public :: iversion_radiag_1 -! public :: iversion_radiag_2 -! public :: iversion_radiag_3 -! public :: iversion_radiag_4 - public :: ireal_radiag - public :: ipchan_radiag - public :: set_radiag - public :: get_radiag - - interface set_radiag - module procedure set_radiag_int_ ! internal procedure for integers - end interface - interface get_radiag - module procedure get_radiag_int_ ! internal procedure for integers - end interface - - integer(i_kind),parameter :: ireal_radiag = 30 ! number of real entries per spot in radiance diagnostic file - integer(i_kind),parameter :: ireal_old_radiag = 26 ! number of real entries per spot in versions older than iversion_radiag_2 - integer(i_kind),parameter :: ipchan_radiag = 8 ! number of entries per channel per spot in radiance diagnostic file - -! Declare structures for radiance diagnostic file information - type diag_header_fix_list - character(len=20) :: isis ! sat and sensor type - character(len=10) :: id ! sat type - character(len=10) :: obstype ! observation type - integer(i_kind) :: jiter ! outer loop counter - integer(i_kind) :: nchan ! number of channels in the sensor - integer(i_kind) :: npred ! number of updating bias correction predictors - integer(i_kind) :: idate ! time (yyyymmddhh) - integer(i_kind) :: ireal ! # of real elements in the fix part of a data record - integer(i_kind) :: ipchan ! # of elements for each channel except for bias correction terms - integer(i_kind) :: iextra ! # of extra elements for each channel - integer(i_kind) :: jextra ! # of extra elements - integer(i_kind) :: idiag ! first dimension of diag_data_chan - integer(i_kind) :: angord ! order of polynomial for adp_anglebc option - integer(i_kind) :: iversion ! radiance diagnostic file version number - integer(i_kind) :: inewpc ! indicator of newpc4pred (1 on, 0 off) - integer(i_kind) :: isens ! sensitivity index - end type diag_header_fix_list - - type diag_data_name_list - character(len=10),dimension(ireal_radiag) :: fix - character(len=10),dimension(:),allocatable :: chn - end type diag_data_name_list - - type diag_header_chan_list - real(r_single) :: freq ! frequency (Hz) - real(r_single) :: polar ! polarization - real(r_single) :: wave ! wave number (cm^-1) - real(r_single) :: varch ! error variance (or SD error?) - real(r_single) :: tlapmean ! mean lapse rate - integer(i_kind):: iuse ! use flag - integer(i_kind):: nuchan ! sensor relative channel number - integer(i_kind):: iochan ! satinfo relative channel number - end type diag_header_chan_list - - type diag_data_fix_list - real(r_single) :: lat ! latitude (deg) - real(r_single) :: lon ! longitude (deg) - real(r_single) :: zsges ! guess elevation at obs location (m) - real(r_single) :: obstime ! observation time relative to analysis - real(r_single) :: senscn_pos ! sensor scan position (integer(i_kind)) - real(r_single) :: satzen_ang ! satellite zenith angle (deg) - real(r_single) :: satazm_ang ! satellite azimuth angle (deg) - real(r_single) :: solzen_ang ! solar zenith angle (deg) - real(r_single) :: solazm_ang ! solar azimumth angle (deg) - real(r_single) :: sungln_ang ! sun glint angle (deg) - real(r_single) :: water_frac ! fractional coverage by water - real(r_single) :: land_frac ! fractional coverage by land - real(r_single) :: ice_frac ! fractional coverage by ice - real(r_single) :: snow_frac ! fractional coverage by snow - real(r_single) :: water_temp ! surface temperature over water (K) - real(r_single) :: land_temp ! surface temperature over land (K) - real(r_single) :: ice_temp ! surface temperature over ice (K) - real(r_single) :: snow_temp ! surface temperature over snow (K) - real(r_single) :: soil_temp ! soil temperature (K) - real(r_single) :: soil_mois ! soil moisture - real(r_single) :: land_type ! land type (integer(i_kind)) - real(r_single) :: veg_frac ! vegetation fraction - real(r_single) :: snow_depth ! snow depth - real(r_single) :: sfc_wndspd ! surface wind speed - real(r_single) :: qcdiag1 ! ir=cloud fraction, mw=cloud liquid water - real(r_single) :: qcdiag2 ! ir=cloud top pressure, mw=total column water - real(r_single) :: tref ! reference temperature (Tr) in NSST - real(r_single) :: dtw ! dt_warm at zob - real(r_single) :: dtc ! dt_cool at zob - real(r_single) :: tz_tr ! d(Tz)/d(Tr) - end type diag_data_fix_list - - type diag_data_chan_list - real(r_single) :: tbobs ! Tb (obs) (K) - real(r_single) :: omgbc ! Tb_(obs) - Tb_(simulated w/ bc) (K) - real(r_single) :: omgnbc ! Tb_(obs) - Tb_(simulated_w/o bc) (K) - real(r_single) :: errinv ! inverse error (K**(-1)) - real(r_single) :: qcmark ! quality control mark - real(r_single) :: emiss ! surface emissivity - real(r_single) :: tlap ! temperature lapse rate - real(r_single) :: tb_tz ! d(Tb)/d(Tz) - real(r_single) :: bicons ! constant bias correction term - real(r_single) :: biang ! scan angle bias correction term - real(r_single) :: biclw ! CLW bias correction term - real(r_single) :: bilap2 ! square lapse rate bias correction term - real(r_single) :: bilap ! lapse rate bias correction term - real(r_single) :: bicos ! node*cos(lat) bias correction term - real(r_single) :: bisin ! sin(lat) bias correction term - real(r_single) :: biemis ! emissivity sensitivity bias correction term - real(r_single),dimension(:),allocatable :: bifix ! angle dependent bias - real(r_single) :: bisst ! SST bias correction term - end type diag_data_chan_list - - type diag_data_extra_list - real(r_single) :: extra ! extra information - end type diag_data_extra_list - - integer(i_kind),save :: iversion_radiag ! Current version (see set routine) - integer(i_kind),parameter:: iversion_radiag_1 = 11104 ! Version when bias-correction entries were modified - integer(i_kind),parameter:: iversion_radiag_2 = 13784 ! Version when NSST entries were added - integer(i_kind),parameter:: iversion_radiag_3 = 19180 ! Version when SSMIS added - integer(i_kind),parameter:: iversion_radiag_4 = 30303 ! Version when emissivity predictor added - - real(r_single),parameter:: rmiss_radiag = -9.9e11_r_single - -contains - -subroutine set_radiag_int_ (what,iv,ier) -character(len=*),intent(in) :: what -integer(i_kind),intent(in) :: iv -integer(i_kind),intent(out):: ier -ier=-1 -if(trim(what)=='version') then - iversion_radiag = iv - ier=0 -endif -end subroutine set_radiag_int_ - -subroutine get_radiag_int_ (what,iv,ier) -character(len=*),intent(in) :: what -integer(i_kind),intent(out):: iv -integer(i_kind),intent(out):: ier -ier=-1 -if(trim(what)=='version') then - iv = iversion_radiag - ier=0 -endif -end subroutine get_radiag_int_ - -subroutine read_radiag_header(ftin,npred_radiag,retrieval,header_fix,header_chan,data_name,iflag,lverbose) -! . . . . -! subprogram: read_diag_header read rad diag header -! prgmmr: tahara org: np20 date: 2003-01-01 -! -! abstract: This routine reads the header record from a radiance -! diagnostic file -! -! program history log: -! 2010-10-05 treadon - add this doc block -! 2011-02-22 kleist - changes related to memory allocation and standard output -! -! input argument list: -! ftin - unit number connected to diagnostic file -! npred_radiag - number of bias correction terms -! retrieval - .true. if sst retrieval -! -! output argument list: -! header_fix - header information structure -! header_chan - channel information structure -! data_name - diag file data names -! iflag - error code -! lverbose - optional flag to turn off default output to standard out -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ - -! Declare passed arguments - integer(i_kind),intent(in) :: ftin - integer(i_kind),intent(in) :: npred_radiag - logical,intent(in) :: retrieval - type(diag_header_fix_list ),intent(out):: header_fix - type(diag_header_chan_list),allocatable :: header_chan(:) - type(diag_data_name_list) :: data_name - integer(i_kind),intent(out) :: iflag - logical,optional,intent(in) :: lverbose - -! Declare local variables - character(len=2):: string - character(len=10):: satid,sentype - character(len=20):: sensat - integer(i_kind) :: i,ich - integer(i_kind):: jiter,nchanl,npred,ianldate,ireal,ipchan,iextra,jextra - integer(i_kind):: idiag,angord,iversion,inewpc,isens - integer(i_kind):: iuse_tmp,nuchan_tmp,iochan_tmp - real(r_single) :: freq_tmp,polar_tmp,wave_tmp,varch_tmp,tlapmean_tmp - logical loutall - - loutall=.true. - if(present(lverbose)) loutall=lverbose - -! Read header (fixed_part). - read(ftin,IOSTAT=iflag) sensat,satid,sentype,jiter,nchanl,npred,ianldate,& - ireal,ipchan,iextra,jextra,idiag,angord,iversion,inewpc,isens - if (iflag/=0) then - rewind(ftin) - read(ftin,IOSTAT=iflag) sensat,satid,sentype,jiter,nchanl,npred,ianldate,& - ireal,ipchan,iextra,jextra,idiag,angord,iversion,inewpc - isens=0 - end if - - if (iflag/=0) then - rewind(ftin) - read(ftin,IOSTAT=iflag) sensat,satid,sentype,jiter,nchanl,npred,ianldate,& - ireal,ipchan,iextra,jextra - idiag=ipchan+npred+1 - angord=0 - iversion=0 - inewpc=0 - isens=0 - if (iflag/=0) then - write(6,*)'READ_RADIAG_HEADER: ***ERROR*** Unknown file format. Cannot read' - return - endif - endif - - header_fix%isis = sensat - header_fix%id = satid - header_fix%obstype = sentype - header_fix%jiter = jiter - header_fix%nchan = nchanl - header_fix%npred = npred - header_fix%idate = ianldate - header_fix%ireal = ireal - header_fix%ipchan = ipchan - header_fix%iextra = iextra - header_fix%jextra = jextra - header_fix%idiag = idiag - header_fix%angord = angord - header_fix%iversion= iversion - header_fix%inewpc = inewpc - header_fix%isens = isens - - if (loutall) then - write(6,*)'READ_RADIAG_HEADER: isis=',header_fix%isis,& - ' nchan=',header_fix%nchan,& - ' npred=',header_fix%npred,& - ' angord=',header_fix%angord,& - ' idiag=',header_fix%idiag,& - ' iversion=',header_fix%iversion,& - ' inewpc=',header_fix%inewpc,& - ' isens=',header_fix%isens - - if ( header_fix%iextra /= 0) & - write(6,*)'READ_RADIAG_HEADER: extra diagnostic information available, ',& - 'iextra=',header_fix%iextra - end if - - if (header_fix%npred /= npred_radiag) & - write(6,*) 'READ_RADIAG_HEADER: **WARNING** header_fix%npred,npred=',& - header_fix%npred,npred_radiag - -! Allocate and initialize as needed - if (allocated(header_chan)) deallocate(header_chan) - if (allocated(data_name%chn)) deallocate(data_name%chn) - - allocate(header_chan( header_fix%nchan)) - allocate(data_name%chn(header_fix%idiag)) - - data_name%fix(1) ='lat ' - data_name%fix(2) ='lon ' - data_name%fix(3) ='zsges ' - data_name%fix(4) ='obstim ' - data_name%fix(5) ='scanpos ' - data_name%fix(6) ='satzen ' - data_name%fix(7) ='satazm ' - data_name%fix(8) ='solzen ' - data_name%fix(9) ='solazm ' - data_name%fix(10)='sungln ' - data_name%fix(11)='fwater ' - data_name%fix(12)='fland ' - data_name%fix(13)='fice ' - data_name%fix(14)='fsnow ' - data_name%fix(15)='twater ' - data_name%fix(16)='tland ' - data_name%fix(17)='tice ' - data_name%fix(18)='tsnow ' - data_name%fix(19)='tsoil ' - data_name%fix(20)='soilmoi ' - data_name%fix(21)='landtyp ' - data_name%fix(22)='vegfrac ' - data_name%fix(23)='snowdep ' - data_name%fix(24)='wndspd ' - data_name%fix(25)='qc1 ' - data_name%fix(26)='qc2 ' - data_name%fix(27)='tref ' - data_name%fix(28)='dtw ' - data_name%fix(29)='dtc ' - data_name%fix(30)='tz_tr ' - - data_name%chn(1)='obs ' - data_name%chn(2)='omgbc ' - data_name%chn(3)='omgnbc ' - data_name%chn(4)='errinv ' - data_name%chn(5)='qcmark ' - data_name%chn(6)='emiss ' - data_name%chn(7)='tlap ' - data_name%chn(8)='tb_tz ' - - if (header_fix%iversion < iversion_radiag_1) then - data_name%chn( 8)= 'bifix ' - data_name%chn( 9)= 'bilap ' - data_name%chn(10)= 'bilap2 ' - data_name%chn(11)= 'bicons ' - data_name%chn(12)= 'biang ' - data_name%chn(13)= 'biclw ' - if (retrieval) data_name%chn(13)= 'bisst ' - elseif ( header_fix%iversion < iversion_radiag_2 .and. header_fix%iversion >= iversion_radiag_1 ) then - data_name%chn( 8)= 'bicons ' - data_name%chn( 9)= 'biang ' - data_name%chn(10)= 'biclw ' - data_name%chn(11)= 'bilap2 ' - data_name%chn(12)= 'bilap ' - do i=1,header_fix%angord - write(string,'(i2.2)') header_fix%angord-i+1 - data_name%chn(12+i)= 'bifix' // string - end do - data_name%chn(12+header_fix%angord+1)= 'bifix ' - data_name%chn(12+header_fix%angord+2)= 'bisst ' - elseif ( header_fix%iversion < iversion_radiag_3 .and. header_fix%iversion >= iversion_radiag_2 ) then - data_name%chn( 9)= 'bicons ' - data_name%chn(10)= 'biang ' - data_name%chn(11)= 'biclw ' - data_name%chn(12)= 'bilap2 ' - data_name%chn(13)= 'bilap ' - do i=1,header_fix%angord - write(string,'(i2.2)') header_fix%angord-i+1 - data_name%chn(13+i)= 'bifix' // string - end do - data_name%chn(13+header_fix%angord+1)= 'bifix ' - data_name%chn(13+header_fix%angord+2)= 'bisst ' - elseif ( header_fix%iversion < iversion_radiag_4 .and. header_fix%iversion >= iversion_radiag_3 ) then - data_name%chn( 9)= 'bicons ' - data_name%chn(10)= 'biang ' - data_name%chn(11)= 'biclw ' - data_name%chn(12)= 'bilap2 ' - data_name%chn(13)= 'bilap ' - data_name%chn(14)= 'bicos ' - data_name%chn(15)= 'bisin ' - do i=1,header_fix%angord - write(string,'(i2.2)') header_fix%angord-i+1 - data_name%chn(15+i)= 'bifix' // string - end do - data_name%chn(15+header_fix%angord+1)= 'bifix ' - data_name%chn(15+header_fix%angord+2)= 'bisst ' - else - data_name%chn( 9)= 'bicons ' - data_name%chn(10)= 'biang ' - data_name%chn(11)= 'biclw ' - data_name%chn(12)= 'bilap2 ' - data_name%chn(13)= 'bilap ' - data_name%chn(14)= 'bicos ' - data_name%chn(15)= 'bisin ' - data_name%chn(16)= 'biemis ' - do i=1,header_fix%angord - write(string,'(i2.2)') header_fix%angord-i+1 - data_name%chn(16+i)= 'bifix' // string - end do - data_name%chn(16+header_fix%angord+1)= 'bifix ' - data_name%chn(16+header_fix%angord+2)= 'bisst ' - endif - -! Read header (channel part) - do ich=1, header_fix%nchan - read(ftin,IOSTAT=iflag) freq_tmp,polar_tmp,wave_tmp,varch_tmp,tlapmean_tmp,iuse_tmp,nuchan_tmp,iochan_tmp - header_chan(ich)%freq = freq_tmp - header_chan(ich)%polar = polar_tmp - header_chan(ich)%wave = wave_tmp - header_chan(ich)%varch = varch_tmp - header_chan(ich)%tlapmean = tlapmean_tmp - header_chan(ich)%iuse = iuse_tmp - header_chan(ich)%nuchan = nuchan_tmp - header_chan(ich)%iochan = iochan_tmp - if (iflag/=0) return - end do - -! Construct array containing menonics for data record entries - - -end subroutine read_radiag_header - -subroutine read_radiag_data(ftin,header_fix,retrieval,data_fix,data_chan,data_extra,iflag ) -! . . . . -! subprogram: read_radiag_dat read rad diag data -! prgmmr: tahara org: np20 date: 2003-01-01 -! -! abstract: This routine reads the data record from a radiance -! diagnostic file -! -! program history log: -! 2010-10-05 treadon - add this doc block -! 2011-02-22 kleist - changes related to memory allocation -! -! input argument list: -! ftin - unit number connected to diagnostic file -! header_fix - header information structure -! -! output argument list: -! data_fix - spot header information structure -! data_chan - spot channel information structure -! data_extra - spot extra information -! iflag - error code -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ - - -! Declare passed arguments - integer(i_kind),intent(in) :: ftin - type(diag_header_fix_list ),intent(in) :: header_fix - logical,intent(in) :: retrieval - type(diag_data_fix_list) ,intent(out):: data_fix - type(diag_data_chan_list) ,allocatable :: data_chan(:) - type(diag_data_extra_list) ,allocatable :: data_extra(:,:) - integer(i_kind),intent(out) :: iflag - - integer(i_kind) :: ich,iang,i,j - real(r_single),dimension(:,:),allocatable :: data_tmp - real(r_single),dimension(:),allocatable :: fix_tmp - real(r_single),dimension(:,:),allocatable :: extra_tmp - -! Allocate arrays as needed - if (allocated(data_chan)) deallocate(data_chan) - allocate(data_chan(header_fix%nchan)) - - do ich=1,header_fix%nchan - if (allocated(data_chan(ich)%bifix)) deallocate(data_chan(ich)%bifix) - allocate(data_chan(ich)%bifix(header_fix%angord+1)) - end do - - if (header_fix%iextra > 0) then - if (allocated(data_extra)) deallocate(data_extra) - allocate(data_extra(header_fix%iextra,header_fix%jextra)) - allocate(extra_tmp(header_fix%iextra,header_fix%jextra)) - end if - -! Allocate arrays to hold data record - allocate(data_tmp(header_fix%idiag,header_fix%nchan)) - - if (header_fix%iversion < iversion_radiag_2) then - allocate( fix_tmp( ireal_old_radiag ) ) - else - allocate( fix_tmp( ireal_radiag ) ) - end if - -! Read data record - - if (header_fix%iextra == 0) then - read(ftin,IOSTAT=iflag) fix_tmp, data_tmp - else - read(ftin,IOSTAT=iflag) fix_tmp, data_tmp, extra_tmp - endif - - -! Transfer fix_tmp record to output structure - data_fix%lat = fix_tmp(1) - data_fix%lon = fix_tmp(2) - data_fix%zsges = fix_tmp(3) - data_fix%obstime = fix_tmp(4) - data_fix%senscn_pos = fix_tmp(5) - data_fix%satzen_ang = fix_tmp(6) - data_fix%satazm_ang = fix_tmp(7) - data_fix%solzen_ang = fix_tmp(8) - data_fix%solazm_ang = fix_tmp(9) - data_fix%sungln_ang = fix_tmp(10) - data_fix%water_frac = fix_tmp(11) - data_fix%land_frac = fix_tmp(12) - data_fix%ice_frac = fix_tmp(13) - data_fix%snow_frac = fix_tmp(14) - data_fix%water_temp = fix_tmp(15) - data_fix%land_temp = fix_tmp(16) - data_fix%ice_temp = fix_tmp(17) - data_fix%snow_temp = fix_tmp(18) - data_fix%soil_temp = fix_tmp(19) - data_fix%soil_mois = fix_tmp(20) - data_fix%land_type = fix_tmp(21) - data_fix%veg_frac = fix_tmp(22) - data_fix%snow_depth = fix_tmp(23) - data_fix%sfc_wndspd = fix_tmp(24) - data_fix%qcdiag1 = fix_tmp(25) - data_fix%qcdiag2 = fix_tmp(26) - - if ( header_fix%iversion <= iversion_radiag_1 ) then - data_fix%tref = rmiss_radiag - data_fix%dtw = rmiss_radiag - data_fix%dtc = rmiss_radiag - data_fix%tz_tr = rmiss_radiag - else - data_fix%tref = fix_tmp(27) - data_fix%dtw = fix_tmp(28) - data_fix%dtc = fix_tmp(29) - data_fix%tz_tr = fix_tmp(30) - end if - - -! Transfer data record to output structure - do ich=1,header_fix%nchan - data_chan(ich)%tbobs =data_tmp(1,ich) - data_chan(ich)%omgbc =data_tmp(2,ich) - data_chan(ich)%omgnbc=data_tmp(3,ich) - data_chan(ich)%errinv=data_tmp(4,ich) - data_chan(ich)%qcmark=data_tmp(5,ich) - data_chan(ich)%emiss =data_tmp(6,ich) - data_chan(ich)%tlap =data_tmp(7,ich) - data_chan(ich)%tb_tz =data_tmp(8,ich) - end do - if (header_fix%iversion < iversion_radiag_1) then - do ich=1,header_fix%nchan - data_chan(ich)%bifix(1)=data_tmp(8,ich) - data_chan(ich)%bilap =data_tmp(9,ich) - data_chan(ich)%bilap2 =data_tmp(10,ich) - data_chan(ich)%bicons =data_tmp(11,ich) - data_chan(ich)%biang =data_tmp(12,ich) - data_chan(ich)%biclw =data_tmp(13,ich) - data_chan(ich)%bisst = rmiss_radiag - if (retrieval) then - data_chan(ich)%biclw =rmiss_radiag - data_chan(ich)%bisst =data_tmp(13,ich) - endif - end do - elseif ( header_fix%iversion < iversion_radiag_2 .and. header_fix%iversion >= iversion_radiag_1 ) then - do ich=1,header_fix%nchan - data_chan(ich)%bicons=data_tmp(8,ich) - data_chan(ich)%biang =data_tmp(9,ich) - data_chan(ich)%biclw =data_tmp(10,ich) - data_chan(ich)%bilap2=data_tmp(11,ich) - data_chan(ich)%bilap =data_tmp(12,ich) - end do - do ich=1,header_fix%nchan - do iang=1,header_fix%angord+1 - data_chan(ich)%bifix(iang)=data_tmp(12+iang,ich) - end do - data_chan(ich)%bisst = data_tmp(12+header_fix%angord+2,ich) - end do - elseif ( header_fix%iversion < iversion_radiag_3 .and. header_fix%iversion >= iversion_radiag_2 ) then - do ich=1,header_fix%nchan - data_chan(ich)%bicons=data_tmp(9,ich) - data_chan(ich)%biang =data_tmp(10,ich) - data_chan(ich)%biclw =data_tmp(11,ich) - data_chan(ich)%bilap2=data_tmp(12,ich) - data_chan(ich)%bilap =data_tmp(13,ich) - end do - do ich=1,header_fix%nchan - do iang=1,header_fix%angord+1 - data_chan(ich)%bifix(iang)=data_tmp(13+iang,ich) - end do - data_chan(ich)%bisst = data_tmp(13+header_fix%angord+2,ich) - end do - elseif ( header_fix%iversion < iversion_radiag_4 .and. header_fix%iversion >= iversion_radiag_3 ) then - do ich=1,header_fix%nchan - data_chan(ich)%bicons=data_tmp(9,ich) - data_chan(ich)%biang =data_tmp(10,ich) - data_chan(ich)%biclw =data_tmp(11,ich) - data_chan(ich)%bilap2=data_tmp(12,ich) - data_chan(ich)%bilap =data_tmp(13,ich) - data_chan(ich)%bicos =data_tmp(14,ich) ! 1st bias correction term node*cos(lat) for SSMIS - data_chan(ich)%bisin =data_tmp(15,ich) ! 2nd bias correction term sin(lat) for SSMI - end do - do ich=1,header_fix%nchan - do iang=1,header_fix%angord+1 - data_chan(ich)%bifix(iang)=data_tmp(15+iang,ich) - end do - data_chan(ich)%bisst = data_tmp(15+header_fix%angord+2,ich) - end do - else - do ich=1,header_fix%nchan - data_chan(ich)%bicons=data_tmp(9,ich) - data_chan(ich)%biang =data_tmp(10,ich) - data_chan(ich)%biclw =data_tmp(11,ich) - data_chan(ich)%bilap2=data_tmp(12,ich) - data_chan(ich)%bilap =data_tmp(13,ich) - data_chan(ich)%bicos =data_tmp(14,ich) - data_chan(ich)%bisin =data_tmp(15,ich) - data_chan(ich)%biemis=data_tmp(16,ich) - end do - do ich=1,header_fix%nchan - do iang=1,header_fix%angord+1 - data_chan(ich)%bifix(iang)=data_tmp(16+iang,ich) - end do - data_chan(ich)%bisst = data_tmp(16+header_fix%angord+2,ich) - end do - endif - - if (header_fix%iextra > 0) then - do j=1,header_fix%jextra - do i=1,header_fix%iextra - data_extra(i,j)%extra=extra_tmp(i,j) - end do - end do - endif - - deallocate(data_tmp, fix_tmp) - if (header_fix%iextra > 0) deallocate(extra_tmp) - -end subroutine read_radiag_data - -end module read_diag - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radbcoef.fd/readme b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radbcoef.fd/readme deleted file mode 100644 index a229412533..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radbcoef.fd/readme +++ /dev/null @@ -1,23 +0,0 @@ -Instructions for building radmon_bcoef executable. - - 1) Load the build module appropriate for your Machine: - i.) - WCOSS: - "module use -a ../../modulefiles/wcoss" - THEIA: - "module use -a ../../modulefiles/theia" - ii.) - "module load RadMonBuild" - - 2) Optional: verify all prerequisites are met by typing: - "make check_prereqs" - - 3) Build the executable by typing: - "make" - - 4) Move the executable to the ../../exec directory by typing: - "make install" - - 5) Unload the build module: - "module unload RadMonBuild" - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radbcor.fd/avgsdv.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radbcor.fd/avgsdv.f90 deleted file mode 100755 index 44d1103a97..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radbcor.fd/avgsdv.f90 +++ /dev/null @@ -1,31 +0,0 @@ -subroutine avgsdv(count,sum1,sum2,rmiss) - implicit none - real count,sum1,sum2,rmiss - real avg,sdv,rterm1,rterm2,svar - - if (count>0.) then - rterm1 = 1./count - avg = rterm1*sum1 - if (count>1.) then - rterm2 = 1./(count-1.) - svar = (count*sum2-sum1*sum1)*rterm1*rterm2 - if (svar>0.) then - sdv = sqrt(svar) - else - sdv = rmiss - endif - else - sdv = rmiss - endif - else - count = rmiss - avg = rmiss - sdv = rmiss - endif - - sum1=avg - sum2=sdv - - return -end subroutine avgsdv - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radbcor.fd/bcor.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radbcor.fd/bcor.f90 deleted file mode 100755 index b03bdfc9dd..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radbcor.fd/bcor.f90 +++ /dev/null @@ -1,562 +0,0 @@ -! -! bcor.f90 -! -program bcor - use read_diag - - implicit none - integer ntype,mregion,surf_nregion,max_surf_region - parameter (ntype=30,mregion=25,max_surf_region=5) - integer iglobal, iland, iwater, isnowice, imixed - parameter( iglobal=1, iland=2, iwater=3, isnowice=4, imixed=5 ) - - character(10),dimension(ntype):: ftype - character(20) satname,stringd,satsis,mod_satname - character(10) dum,satype,dplat - character(40) string,diag_rad,data_file,ctl_file - character(40),dimension(max_surf_region):: region - character(10) suffix - - integer luname,lungrd,lunctl,lndiag - integer iyy,imm,idd,ihh,idhh,incr,iread,iflag - integer n_chan,j,idsat,i,k,ii,nsub - integer,dimension(mregion):: jsub - integer,allocatable,dimension(:):: io_chan,nu_chan - integer npred_radiag,angord - - real pen,rread - real weight,rlat,rlon,rmiss,obs,biascor,obsges,obsgesnbc,rterm - real,dimension(2):: cor_total,cor_fixang,cor_lapse,cor_lapse2,& - cor_const,cor_scangl,cor_clw,cor_cos_ssmis,cor_sin_ssmis,& - cor_emiss,cor_ordang4,cor_ordang3,cor_ordang2,cor_ordang1 - - real,dimension(max_surf_region):: rlatmin,rlatmax,rlonmin,rlonmax - - real,allocatable,dimension(:):: wavenumbr - real,allocatable,dimension(:,:):: count,error,use,frequency,penalty - real,allocatable,dimension(:,:,:):: total_cor,fixang_cor,lapse_cor,& - lapse2_cor,const_cor,scangl_cor,clw_cor,cos_ssmis_cor,sin_ssmis_cor,& - emiss_cor,ordang4_cor,ordang3_cor,ordang2_cor,ordang1_cor - - logical no_obs - -! Variables for reading satellite data - type(diag_header_fix_list ) :: header_fix - type(diag_header_chan_list),allocatable :: header_chan(:) - type(diag_data_name_list ) :: data_name - type(diag_data_fix_list ) :: data_fix - type(diag_data_chan_list ),allocatable :: data_chan(:) - type(diag_data_extra_list) ,allocatable :: data_extra(:,:) - - integer nsnow, nland, nwater, nice, nmixed, ntotal - integer nnsnow, nnland, nnwater, nnmixed, nntotal - -! Namelist with defaults - logical :: retrieval = .false. - integer :: nchanl = 19 - integer :: imkctl = 1 - integer :: imkdata = 1 - character(3) :: gesanl = 'ges' - integer :: little_endian = 1 - character(3) :: rad_area = 'glb' - namelist /input/ satname,iyy,imm,idd,ihh,idhh,incr,nchanl,& - suffix,imkctl,imkdata,retrieval,gesanl,little_endian,rad_area - - data luname,lungrd,lunctl,lndiag / 5, 51, 52, 21 / - data rmiss /-999./ - data stringd / '.%y4%m2%d2%h2' / - data ftype / 'count', 'penalty', & - 'avgtotal', 'avgfixang', 'avglapse', 'avglapse2', & - 'avgconst', 'avgscangl', 'avgclw', & - 'avgcos', 'avgsin', 'avgemiss', 'avgordang4', & - 'avgordang3', 'avgordang2', 'avgordang1', & - 'sdvtotal', 'sdvfixang', 'sdvlapse', 'sdvlapse2', & - 'sdvconst', 'sdvscangl', 'sdvclw', & - 'sdvcos', 'sdvsin', 'sdvemiss', 'sdvordang4',& - 'sdvordang3', 'sdvordang2', 'sdvordang1' / - data region / 'global', 'land', 'water', 'ice/snow', 'mixed'/ - data rlonmin / -180., -180., -180., -180., -180./ - data rlonmax / 180., 180., 180., 180., 180./ - data rlatmin / -90., -90., -90., -90., -90./ - data rlatmax / 90., 90., 90., 90., 90./ - - - -!************************************************************************ -! -! Initialize variables - iread=0 - npred_radiag = 12 - -! Read namelist input - read(luname,input) - write(6,input) - write(6,*)'gesanl = ', gesanl - write(6,*)'rad_area = ', rad_area - write(6,*)' ' - - surf_nregion = 5 - if ( trim(rad_area) == 'rgn' ) then - surf_nregion = 1 - endif - - write(6,*)'surf_nregion = ', surf_nregion - - -! Ensure number of requested regions does not exceed specified upper limit - if (surf_nregion>mregion) then - write(6,*)'***ERROR*** too many regions specified' - write(6,*)' maximum allowed: mregion=',mregion - write(6,*)' user requested: surf_nregion=',surf_nregion - call errexit(91) - endif - - -! Create filenames for diagnostic input, binary output file - write(stringd,100) iyy,imm,idd,ihh -100 format('.',i4.4,3i2.2) - - if ( trim(gesanl) == 'ges' ) then - diag_rad = trim(satname) - data_file= trim(satname) // trim(stringd) // '.ieee_d' - ctl_file = trim(satname) // '.ctl' - else - diag_rad = trim(satname) // '_anl' - data_file= trim(satname) // '_anl' // trim(stringd) // '.ieee_d' - ctl_file = trim(satname) // '_anl.ctl' - endif - - write(6,*)'diag_rad =',diag_rad - write(6,*)'data_file=',data_file - write(6,*)'ctl_file =',ctl_file - write(6,*)'suffix =',suffix - - -! Open unit to diagnostic file. Read portion of header to -! see if file exists - open(lndiag,file=diag_rad,form='unformatted') - read(lndiag,err=900,end=900) dum - rewind lndiag - -! File exists. Read header - write(6,*)'call read_diag_header' - call read_radiag_header( lndiag, npred_radiag, retrieval, header_fix,& - header_chan, data_name, iflag ) - if( iflag/=0 ) then - write(6,*)'***ERROR*** problem reading diag file header, iflag=',iflag - call errexit(91) - endif - -! Extract observation type, satellite id, and number of channels - satype = header_fix%obstype - satsis = header_fix%isis - dplat = header_fix%id - n_chan = header_fix%nchan - angord = header_fix%angord - - write(6,*)'satype,dplat,n_chan,angord=',satype,' ',dplat,n_chan,angord - - string = trim(satype)//'_'//trim(dplat) - write(6,*)'string,satname=',string,' ',satname - if ( trim(string) /= trim(satname) ) then - write(6,*)'***ERROR*** inconsistent instrument types' - write(6,*)' satname,string =',satname,' ',string - call errexit(92) - endif - - -! Allocate arrays to hold observational information - write(6,*)' ' - write(6,*)'allocate arrays' - allocate (io_chan(n_chan), nu_chan(n_chan), wavenumbr(n_chan)) - allocate (total_cor(n_chan,mregion,2), fixang_cor(n_chan,mregion,2), & - lapse_cor(n_chan,mregion,2), lapse2_cor(n_chan,mregion,2), & - const_cor(n_chan,mregion,2), scangl_cor(n_chan,mregion,2), & - clw_cor(n_chan,mregion,2), cos_ssmis_cor(n_chan,mregion,2), & - sin_ssmis_cor(n_chan,mregion,2), emiss_cor(n_chan,mregion,2), & - ordang4_cor(n_chan,mregion,2), ordang3_cor(n_chan,mregion,2), & - ordang2_cor(n_chan,mregion,2), ordang1_cor(n_chan,mregion,2), & - count(n_chan,mregion), penalty(n_chan,mregion), & - error(n_chan,mregion), use(n_chan,mregion), & - frequency(n_chan,mregion)) - -! Zero accumulator arrays - do ii=1,2 - do k=1,mregion - do j=1,n_chan - if (ii==1) then - count(j,k) = 0.0 - penalty(j,k) = 0.0 - endif - total_cor(j,k,ii) = 0.0 - fixang_cor(j,k,ii) = 0.0 - lapse_cor(j,k,ii) = 0.0 - lapse2_cor(j,k,ii) = 0.0 - const_cor(j,k,ii) = 0.0 - scangl_cor(j,k,ii) = 0.0 - clw_cor(j,k,ii) = 0.0 - cos_ssmis_cor(j,k,ii) = 0.0 - sin_ssmis_cor(j,k,ii) = 0.0 - emiss_cor(j,k,ii) = 0.0 - ordang4_cor(j,k,ii) = 0.0 - ordang3_cor(j,k,ii) = 0.0 - ordang2_cor(j,k,ii) = 0.0 - ordang1_cor(j,k,ii) = 0.0 - end do - end do - end do - - -! Extract satinfo relative index - do j=1,n_chan - nu_chan(j) = real( header_chan(j)%nuchan, 4 ) - io_chan(j) = real( header_chan(j)%iochan, 4 ) - wavenumbr(j) = real( header_chan(j)%wave, 4 ) - end do - do k=1,mregion - do j=1,n_chan - error(j,k) = real( header_chan(j)%varch, 4) - use(j,k) = real( header_chan(j)%iuse, 4 ) - frequency(j,k) = real( header_chan(j)%freq, 4) - end do - end do - - -! Create GrADS control file - if ( imkctl == 1 ) then - write(6,*)'call create_ctl_bcor' - - if ( trim(gesanl) == 'ges' ) then - mod_satname = trim(satname) - else - mod_satname = trim(satname) // '_anl' - endif - - - call create_ctl_bcor(ntype,ftype,n_chan,iyy,imm,idd,ihh,idhh,& - incr,ctl_file,lunctl,rmiss,mod_satname,satype,dplat,surf_nregion,& - region,rlonmin,rlonmax,rlatmin,rlatmax,nu_chan,use(1,1),error(1,1),& - frequency(1,1),wavenumbr,little_endian) - - endif - - nwater = 0; nnwater = 0 - nland = 0; nnland = 0 - nsnow = 0; nnsnow = 0 - nice = 0 - nmixed = 0; nnmixed = 0 - ntotal = 0 - -! Loop to read entries in diagnostic file - if ( imkdata == 1 ) then - iflag = 0 - loopd: do while (iflag == 0) - -! Read a record. If read flag, iflag does not equal zero, exit loopd - call read_radiag_data( lndiag, header_fix, retrieval, data_fix, data_chan,& - data_extra, iflag ) - if( iflag /= 0 ) exit loopd - iread=iread+1 - -! Extract obervation location and mpi weight. Convert (0-360) lon to (-180,180) - rlat = data_fix%lat - rlon = data_fix%lon - if (rlon>180.) rlon = rlon - 360. - rread = rread + 1.0 - - ntotal = ntotal + 1 - jsub(1)= iglobal - nsub = 1 - - if ( surf_nregion > 1 ) then - if ( data_fix%water_frac > 0.99 ) then - nwater = nwater + 1 - else if ( data_fix%land_frac > 0.99 ) then - nland = nland + 1 - else if ( data_fix%snow_frac > 0.99 ) then - nsnow = nsnow + 1 - else if ( data_fix%ice_frac > 0.99 ) then - nice = nice + 1 - else - nmixed = nmixed + 1 - end if - - - -! Detemine into which subdomains the observation falls. -! These are now based on surface type, not geography. All -! obs match global (surf_region 1). -! - ii=0; -!jsub=0; - if ( data_fix%land_frac > 0.99 ) then - jsub(2)=iland - nsub=2 - nnland=nnland+1 - else if ( data_fix%water_frac > 0.99 ) then - jsub(2)=iwater - nsub=2 - nnwater=nnwater+1 - else if (( data_fix%snow_frac > 0.99 ) .OR. ( data_fix%ice_frac > 0.99 )) then - jsub(2)=isnowice - nsub=2 - nnsnow=nnsnow+1 - else - jsub(2)=imixed - nsub=2 - nnmixed=nnmixed+1 - write(6,*)'data_fix%land_frac,water,snow,ice = ',data_fix%land_frac, data_fix%water_frac, data_fix%snow_frac, data_fix%ice_frac - end if - end if - - -! Channel loop - do j = 1, n_chan - -! If observation was assimilated, accumulate sums in appropriate regions - if (data_chan(j)%errinv > 1.e-6) then -! pen = data_chan(j)%errinv*(data_chan(j)%omgbc)**2 - pen = (data_chan(j)%errinv*(data_chan(j)%omgbc))**2 - cor_total(1) = (data_chan(j)%omgnbc - data_chan(j)%omgbc) - cor_fixang(1) = data_chan(j)%bifix(angord+1) - cor_lapse(1) = data_chan(j)%bilap - cor_lapse2(1) = data_chan(j)%bilap2 - cor_const(1) = data_chan(j)%bicons - cor_scangl(1) = data_chan(j)%biang - cor_clw(1) = data_chan(j)%biclw - cor_cos_ssmis(1) = data_chan(j)%bicos - cor_sin_ssmis(1) = data_chan(j)%bisin - cor_emiss(1) = data_chan(j)%biemis - if (angord >= 4 ) then - cor_ordang4(1) = data_chan(j)%bifix(1) - cor_ordang3(1) = data_chan(j)%bifix(2) - cor_ordang2(1) = data_chan(j)%bifix(3) - cor_ordang1(1) = data_chan(j)%bifix(4) - else - cor_ordang4(1) = 0.0 - cor_ordang3(1) = 0.0 - cor_ordang2(1) = 0.0 - cor_ordang1(1) = 0.0 - endif -! do i=1,angord -! cor_ordang4 -! write(string,'(i2.2)') header_fix%angord-i+1 -! data_name%chn(15+i)= 'bifix' // string -! end do - - - cor_total(2) = (data_chan(j)%omgnbc - data_chan(j)%omgbc)**2 - cor_fixang(2) = (data_chan(j)%bifix(angord+1))**2 - cor_lapse(2) = (data_chan(j)%bilap)**2 - cor_lapse2(2) = (data_chan(j)%bilap2)**2 - cor_const(2) = (data_chan(j)%bicons)**2 - cor_scangl(2) = (data_chan(j)%biang)**2 - cor_clw(2) = (data_chan(j)%biclw)**2 - cor_cos_ssmis(2) = data_chan(j)%bicos**2 - cor_sin_ssmis(2) = data_chan(j)%bisin**2 - cor_emiss(2) = data_chan(j)%biemis**2 - if (angord >= 4 ) then - cor_ordang4(1) = data_chan(j)%bifix(1)**2 - cor_ordang3(1) = data_chan(j)%bifix(2)**2 - cor_ordang2(1) = data_chan(j)%bifix(3)**2 - cor_ordang1(1) = data_chan(j)%bifix(4)**2 - else - cor_ordang4(2) = 0.0 - cor_ordang3(2) = 0.0 - cor_ordang2(2) = 0.0 - cor_ordang1(2) = 0.0 - end if - - do i=1,nsub - k=jsub(i) - count(j,k) = count(j,k) +1.0 - penalty(j,k) = penalty(j,k) + pen - - do ii=1,2 - total_cor(j,k,ii) = total_cor(j,k,ii) + cor_total(ii) - fixang_cor(j,k,ii) = fixang_cor(j,k,ii) + cor_fixang(ii) - lapse_cor(j,k,ii) = lapse_cor(j,k,ii) + cor_lapse(ii) - lapse2_cor(j,k,ii) = lapse2_cor(j,k,ii) + cor_lapse2(ii) - const_cor(j,k,ii) = const_cor(j,k,ii) + cor_const(ii) - scangl_cor(j,k,ii) = scangl_cor(j,k,ii) + cor_scangl(ii) - clw_cor(j,k,ii) = clw_cor(j,k,ii) + cor_clw(ii) - cos_ssmis_cor(j,k,ii) = cos_ssmis_cor(j,k,ii) + cor_cos_ssmis(ii) - sin_ssmis_cor(j,k,ii) = sin_ssmis_cor(j,k,ii) + cor_sin_ssmis(ii) - emiss_cor(j,k,ii) = emiss_cor(j,k,ii) + cor_emiss(ii) - ordang4_cor(j,k,ii) = ordang4_cor(j,k,ii) + cor_ordang4(ii) - ordang3_cor(j,k,ii) = ordang3_cor(j,k,ii) + cor_ordang3(ii) - ordang2_cor(j,k,ii) = ordang2_cor(j,k,ii) + cor_ordang2(ii) - ordang1_cor(j,k,ii) = ordang1_cor(j,k,ii) + cor_ordang1(ii) - end do - - end do - endif - - enddo ! channel loop - -! End of loop over diagnostic file - enddo loopd - close(lndiag) - write(6,*)' ' - write(6,*)'read in ',iread,' obs ',rread - write(6,*)' ' - - write(6,*)'nwater, nland, nice, nsnow, nmixed, ntotal = ', nwater, nland, nice, nsnow, nmixed, ntotal - nntotal=nnwater+nnland+nnsnow+nnmixed - write(6,*)'nnwater, nnland, nnsnow, nnmixed, nntotal = ', nnwater, nnland, nnsnow, nnmixed, nntotal - -! Compute average and standard deviation - do k=1,surf_nregion - do j=1,n_chan - call avgsdv(count(j,k),total_cor(j,k,1), total_cor(j,k,2), rmiss) - call avgsdv(count(j,k),fixang_cor(j,k,1), fixang_cor(j,k,2), rmiss) - call avgsdv(count(j,k),lapse_cor(j,k,1), lapse_cor(j,k,2), rmiss) - call avgsdv(count(j,k),lapse2_cor(j,k,1), lapse2_cor(j,k,2), rmiss) - call avgsdv(count(j,k),const_cor(j,k,1), const_cor(j,k,2), rmiss) - call avgsdv(count(j,k),scangl_cor(j,k,1), scangl_cor(j,k,2), rmiss) - call avgsdv(count(j,k),clw_cor(j,k,1), clw_cor(j,k,2), rmiss) - call avgsdv(count(j,k),cos_ssmis_cor(j,k,1), cos_ssmis_cor(j,k,2), rmiss) - call avgsdv(count(j,k),sin_ssmis_cor(j,k,1), sin_ssmis_cor(j,k,2), rmiss) - call avgsdv(count(j,k),emiss_cor(j,k,1), emiss_cor(j,k,2), rmiss) - call avgsdv(count(j,k),ordang4_cor(j,k,1), ordang4_cor(j,k,2), rmiss) - call avgsdv(count(j,k),ordang3_cor(j,k,1), ordang3_cor(j,k,2), rmiss) - call avgsdv(count(j,k),ordang2_cor(j,k,1), ordang2_cor(j,k,2), rmiss) - call avgsdv(count(j,k),ordang1_cor(j,k,1), ordang1_cor(j,k,2), rmiss) - - if (count(j,k)>0) then - penalty(j,k)=penalty(j,k)/count(j,k) - else - count(j,k)=rmiss - penalty(j,k)=rmiss - endif - end do - end do - -! Write output to binary output file - write(6,*)' ' - open(lungrd,file=data_file,form='unformatted') - write(lungrd) ((count(j,k),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((penalty(j,k),j=1,n_chan),k=1,surf_nregion) - do ii=1,2 - write(lungrd) ((total_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((fixang_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((lapse_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((lapse2_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((const_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((scangl_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((clw_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((cos_ssmis_cor(j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((sin_ssmis_cor(j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((emiss_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((ordang4_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((ordang3_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((ordang2_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((ordang1_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - end do - write(6,*)'write output to lungrd=',lungrd,', file=',trim(data_file) - close(lungrd) - endif - -! Deallocate arrays - write(6,*)' ' - write(6,*)'deallocate arrays' - if(allocated(io_chan)) deallocate (io_chan) - if(allocated(nu_chan)) deallocate (nu_chan) - if(allocated(wavenumbr)) deallocate (wavenumbr) - if(allocated(total_cor)) deallocate (total_cor) - if(allocated(fixang_cor)) deallocate (fixang_cor) - if(allocated(lapse_cor)) deallocate (lapse_cor) - if(allocated(lapse2_cor)) deallocate (lapse2_cor) - if(allocated(const_cor)) deallocate (const_cor) - if(allocated(scangl_cor)) deallocate (scangl_cor) - if(allocated(clw_cor)) deallocate (clw_cor) - if(allocated(cos_ssmis_cor)) deallocate (cos_ssmis_cor) - if(allocated(sin_ssmis_cor)) deallocate (sin_ssmis_cor) - if(allocated(emiss_cor)) deallocate (emiss_cor) - if(allocated(ordang4_cor)) deallocate (ordang4_cor) - if(allocated(ordang3_cor)) deallocate (ordang3_cor) - if(allocated(ordang2_cor)) deallocate (ordang2_cor) - if(allocated(ordang1_cor)) deallocate (ordang1_cor) - if(allocated(count)) deallocate (count) - if(allocated(penalty)) deallocate (penalty) - if(allocated(error)) deallocate (error) - if(allocated(use)) deallocate (use) - if(allocated(frequency)) deallocate (frequency) - - -! deallocate(io_chan,nu_chan,wavenumbr,total_cor,fixang_cor,lapse_cor,& -! lapse2_cor,const_cor,scangl_cor,clw_cor,count,penalty,error,use,& -! frequency) - - write(6,*)'deallocated arrays' - goto 950 - -! Jump to here if eof or error reading diagnostic file. -900 continue - write(6,*)'***PROBLEM reading diagnostic file. diag_rad=',diag_rad - close(lndiag) - - n_chan=nchanl - if (n_chan<=0) then - write(6,*)'***ERROR*** invalid nchanl=',nchanl,' STOP program' - call errexit(93) - endif - - write(6,*)'load missing value ',rmiss,' into output arrays. ',& - surf_nregion,n_chan - allocate(count(n_chan,surf_nregion),penalty(n_chan,surf_nregion)) - allocate(total_cor(n_chan,mregion,2), fixang_cor(n_chan,mregion,2), & - lapse_cor(n_chan,mregion,2), lapse2_cor(n_chan,mregion,2), & - const_cor(n_chan,mregion,2), scangl_cor(n_chan,mregion,2), & - clw_cor(n_chan,mregion,2)) - - write(6,*)'load missing value ',rmiss,' into output arrays' - do ii=1,2 - do k=1,surf_nregion - do j=1,n_chan - if (ii==1) then - count(j,k) =rmiss - penalty(j,k)=rmiss - endif - total_cor(j,k,ii) =rmiss - fixang_cor(j,k,ii)=rmiss - lapse_cor(j,k,ii) =rmiss - lapse2_cor(j,k,ii)=rmiss - const_cor(j,k,ii) =rmiss - scangl_cor(j,k,ii)=rmiss - clw_cor(j,k,ii) =rmiss - end do - end do - end do - - if ( imkdata == 1 ) then - open(lungrd,file=data_file,form='unformatted') - write(lungrd) ((count(j,k),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((penalty(j,k),j=1,n_chan),k=1,surf_nregion) - do ii=1,2 - write(lungrd) ((total_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((fixang_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((lapse_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((lapse2_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((const_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((scangl_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((clw_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((cos_ssmis_cor(j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((sin_ssmis_cor(j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((emiss_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((ordang4_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((ordang3_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((ordang2_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((ordang1_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - end do - write(6,*)'write output to lungrd=',lungrd,', file=',trim(data_file) - close(lungrd) - endif - deallocate(count,penalty,total_cor,fixang_cor,lapse_cor,lapse2_cor,& - const_cor,scangl_cor,clw_cor) - -! End of program -950 continue - write(6,*) 'exiting program bcor' - stop -end program bcor diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radbcor.fd/create_ctl_bcor.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radbcor.fd/create_ctl_bcor.f90 deleted file mode 100755 index e312247953..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radbcor.fd/create_ctl_bcor.f90 +++ /dev/null @@ -1,163 +0,0 @@ -subroutine create_ctl_bcor(ntype,ftype,n_chan,iyy,imm,idd,ihh,idhh,& - incr,ctl_file,lunctl,rmiss,satname,satype,dplat,nregion,& - region,rlonmin,rlonmax,rlatmin,rlatmax,nu_chan,use,error,& - frequency,wavenumbr,little_endian) - - implicit none - - integer ntype - - character(2) cword - character(3),dimension(12):: mon - character(3):: clatmin,clatmax - character(4):: clonmin,clonmax - character(10),dimension(ntype):: ftype - character(13) stringd - character(20) satname - character(10) satype,dplat - character(40) ctl_file,grad_file - character(80) string - character(40),dimension(nregion):: region - character(80),dimension(nregion):: stringr - - integer idsat,nregion,iuse,little_endian - integer lunctl,iyy,imm,idd,ihh,j,i,n_chan,idhh,incr - integer iyy2,imm2,idd2,ihh2,ntime - integer,dimension(8):: ida,jda - integer,dimension(n_chan):: nu_chan - - real rmiss,wavelength - real,dimension(5):: fha - real,dimension(n_chan):: error,use,frequency,wavenumbr - real,dimension(nregion):: rlonmin,rlonmax,rlatmin,rlatmax - - data stringd / '.%y4%m2%d2%h2' / - data mon / 'jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', & - 'aug', 'sep', 'oct', 'nov', 'dec' / - -!************************************************************************** -! Create date for tdef based on given date and hour offset - fha=0.0; ida=0; jda=0; ntime=0 - iyy2=iyy; imm2=imm; idd2=idd; ihh2=ihh - if (idhh/=0) then - ntime = abs(idhh)/incr - fha(2)=idhh - ida(1)=iyy - ida(2)=imm - ida(3)=idd - ida(4)=0 - ida(5)=ihh - call w3movdat(fha,ida,jda) - iyy2=jda(1) - imm2=jda(2) - idd2=jda(3) - ihh2=jda(5) - endif - ntime=ntime+1 - -! Open unit to GrADS control file - open(lunctl,file=ctl_file,form='formatted') - -!******************************************************************* -! Construct the region strings if this is for a global source, -! which is defined as nregion > 1. -! - if (nregion > 1) then - - do i=1,nregion - if (rlatmin(i)>0.) then - write(clatmin,10) int(rlatmin(i)) - else - write(clatmin,20) abs(int(rlatmin(i))) - endif - if (rlatmax(i)>0.) then - write(clatmax,10) int(rlatmax(i)) - else - write(clatmax,20) abs(int(rlatmax(i))) - endif - if (rlonmin(i)>0.) then - write(clonmin,30) int(rlonmin(i)) - else - write(clonmin,40) abs(int(rlonmin(i))) - endif - if (rlonmax(i)>0.) then - write(clonmax,30) int(rlonmax(i)) - else - write(clonmax,40) abs(int(rlonmax(i))) - endif - stringr(i) = trim(region(i)) // ' (' // & - trim(clonmin) // '-' // trim(clonmax) // ', ' // & - trim(clatmin) // '-' // trim(clatmax) // ')' - end do - endif -10 format(i2,'N') -20 format(i2,'S') -30 format(i3,'E') -40 format(i3,'W') - -! Write header information - grad_file = trim(satname) // stringd // '.ieee_d' - write(lunctl,100) grad_file - if ( little_endian == 1 ) then - write(lunctl,112) - else - write(lunctl,110) - endif - write(lunctl,120) rmiss - write(lunctl,130) adjustl(satype),dplat,n_chan - write(lunctl,132) - do i=1,n_chan - iuse = nint(use(i)) - wavelength = 10000./wavenumbr(i) - write(lunctl,134) i,nu_chan(i),iuse,error(i),wavelength,frequency(i) - end do - write(lunctl,136) - - if (nregion > 1) then - do i=1,nregion - write(cword,'(i2)') i - string = '* region=' // cword // ' ' // trim(stringr(i)) - write(lunctl,138) string - end do - endif - - write(lunctl,140) n_chan - write(lunctl,150) nregion - write(lunctl,160) - write(lunctl,170) ntime,ihh2,idd2,mon(imm2),iyy2 - write(lunctl,180) ntype - -100 format('dset ^',a40) -110 format('options template big_endian sequential') -112 format('options template little_endian sequential') -120 format('undef ',f5.0) -130 format('title ',a10,1x,a10,1x,i4) -132 format('*XDEF is channel number') -134 format('* x= ',i4,', channel= ',i4,' , iuse= ',i2,' , error= ',f8.3,& - ' , wlth= ',f9.2,' , freq= ',f9.2) -136 format('*YDEF is geographic region') -138 format(a80) -140 format('xdef ',i4,' linear 1.0 1.0') -150 format('ydef ',i2,' linear 1.0 1.0') -160 format('zdef 1 linear 1.0 1.0') -170 format('tdef ',i4,' linear ',i2.2,'Z',i2.2,a3,i4.4,' 06hr') -180 format('vars ',i7) - -! Write data portion of GraDS control file - do i=1,ntype - string = trim(ftype(i)) - write(lunctl,190) adjustl(string),trim(ftype(i)) -190 format(a10,' 0 0 ',a10) - end do - -! Write trminating "endvars" record - write(lunctl,200) -200 format('endvars') - - -! Close ctl file - close(lunctl) - -! Return - return -end subroutine create_ctl_bcor diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radbcor.fd/kinds.F90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radbcor.fd/kinds.F90 deleted file mode 100644 index 8b3a2fcc4e..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radbcor.fd/kinds.F90 +++ /dev/null @@ -1,112 +0,0 @@ -module kinds -!$$$ module documentation block -! . . . . -! module: kinds -! prgmmr: treadon org: np23 date: 2004-08-15 -! -! abstract: Module to hold specification kinds for variable declaration. -! This module is based on (copied from) Paul vanDelst's -! type_kinds module found in the community radiative transfer -! model -! -! module history log: -! 2004-08-15 treadon -! 2011-07-04 todling - define main precision during compilation -! -! Subroutines Included: -! -! Functions Included: -! -! remarks: -! The numerical data types defined in this module are: -! i_byte - specification kind for byte (1-byte) integer variable -! i_short - specification kind for short (2-byte) integer variable -! i_long - specification kind for long (4-byte) integer variable -! i_llong - specification kind for double long (8-byte) integer variable -! r_single - specification kind for single precision (4-byte) real variable -! r_double - specification kind for double precision (8-byte) real variable -! r_quad - specification kind for quad precision (16-byte) real variable -! -! i_kind - generic specification kind for default integer -! r_kind - generic specification kind for default floating point -! -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ end documentation block - implicit none - private - -! Integer type definitions below - -! Integer types - integer, parameter, public :: i_byte = selected_int_kind(1) ! byte integer - integer, parameter, public :: i_short = selected_int_kind(4) ! short integer - integer, parameter, public :: i_long = selected_int_kind(8) ! long integer - integer, parameter, private :: llong_t = selected_int_kind(16) ! llong integer - integer, parameter, public :: i_llong = max( llong_t, i_long ) - -! Expected 8-bit byte sizes of the integer kinds - integer, parameter, public :: num_bytes_for_i_byte = 1 - integer, parameter, public :: num_bytes_for_i_short = 2 - integer, parameter, public :: num_bytes_for_i_long = 4 - integer, parameter, public :: num_bytes_for_i_llong = 8 - -! Define arrays for default definition - integer, parameter, private :: num_i_kinds = 4 - integer, parameter, dimension( num_i_kinds ), private :: integer_types = (/ & - i_byte, i_short, i_long, i_llong /) - integer, parameter, dimension( num_i_kinds ), private :: integer_byte_sizes = (/ & - num_bytes_for_i_byte, num_bytes_for_i_short, & - num_bytes_for_i_long, num_bytes_for_i_llong /) - -! Default values -! **** CHANGE THE FOLLOWING TO CHANGE THE DEFAULT INTEGER TYPE KIND *** - integer, parameter, private :: default_integer = 3 ! 1=byte, - ! 2=short, - ! 3=long, - ! 4=llong - integer, parameter, public :: i_kind = integer_types( default_integer ) - integer, parameter, public :: num_bytes_for_i_kind = & - integer_byte_sizes( default_integer ) - - -! Real definitions below - -! Real types - integer, parameter, public :: r_single = selected_real_kind(6) ! single precision - integer, parameter, public :: r_double = selected_real_kind(15) ! double precision - integer, parameter, private :: quad_t = selected_real_kind(20) ! quad precision - integer, parameter, public :: r_quad = max( quad_t, r_double ) - -! Expected 8-bit byte sizes of the real kinds - integer, parameter, public :: num_bytes_for_r_single = 4 - integer, parameter, public :: num_bytes_for_r_double = 8 - integer, parameter, public :: num_bytes_for_r_quad = 16 - -! Define arrays for default definition - integer, parameter, private :: num_r_kinds = 3 - integer, parameter, dimension( num_r_kinds ), private :: real_kinds = (/ & - r_single, r_double, r_quad /) - integer, parameter, dimension( num_r_kinds ), private :: real_byte_sizes = (/ & - num_bytes_for_r_single, num_bytes_for_r_double, & - num_bytes_for_r_quad /) - -! Default values -! **** CHANGE THE FOLLOWING TO CHANGE THE DEFAULT REAL TYPE KIND *** -#ifdef _REAL4_ - integer, parameter, private :: default_real = 1 ! 1=single, -#endif -#ifdef _REAL8_ - integer, parameter, private :: default_real = 2 ! 2=double, -#endif -#ifdef _REAL16_ - integer, parameter, private :: default_real = 3 ! 3=quad -#endif - integer, parameter, public :: r_kind = real_kinds( default_real ) - integer, parameter, public :: num_bytes_for_r_kind = & - real_byte_sizes( default_real ) - -end module kinds diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radbcor.fd/makefile b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radbcor.fd/makefile deleted file mode 100755 index 02178b7ea9..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radbcor.fd/makefile +++ /dev/null @@ -1,52 +0,0 @@ -# ***************************************************************** -# makefile.bcor -# -# Make the radmon_bcor executable. -# -# ***************************************************************** - -BINDIR = ../../exec - -LIBS = $(W3NCO_LIB4) - -OBJS = kinds.o read_diag.o bcor.o avgsdv.o create_ctl_bcor.o - -# -# ***************************************************************** -# - -CMD = radmon_bcor - -all: $(CMD) - -clean: - rm -f *.o - rm -f *.mod - rm -f radmon_bcor - -check_prereqs: - $(CHECK_LIBS) $(LIBS) - -install: - cp -f $(CMD) $(BINDIR)/ - -debug: FFLAGS = $(D_FFLAGS) -debug: $(CMD) - -$(CMD): $(OBJS) - $(CF) $(FFLAGS) $(LDFLAGS) -o $(@) $(OBJS) $(LIBS) - -read_diag.o : read_diag.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -bcor.o : bcor.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -avgsdv.o : avgsdv.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -create_ctl_bcor.o : create_ctl_bcor.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -kinds.o : kinds.F90 - $(CF) $(FFLAGS) -c $(*).F90 diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radbcor.fd/read_diag.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radbcor.fd/read_diag.f90 deleted file mode 100755 index 7a4d6cdc49..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radbcor.fd/read_diag.f90 +++ /dev/null @@ -1,659 +0,0 @@ -!$$$ subprogram documentation block -! . . . . -! subprogram: read_raddiag read rad diag file -! prgmmr: tahara org: np20 date: 2003-01-01 -! -! abstract: This module contains code to process radiance -! diagnostic files. The module defines structures -! to contain information from the radiance -! diagnostic files and then provides two routines -! to access contents of the file. -! -! program history log: -! 2005-07-22 treadon - add this doc block -! 2010-10-05 treadon - refactor code to GSI standard -! 2010-10-08 zhu - use data_tmp to handle various npred values -! 2011-02-22 kleist - changes related to memory allocate/deallocate -! 2011-04-08 li - add tref, dtw, dtc to diag_data_fix_list, add tb_tz to diag_data_chan_list -! - correspondingly, change ireal_radiag (26 -> 30) and ipchan_radiag (7 -> 8) -! 2011-07-24 safford - make structure size for reading data_fix data version dependent -! 2013-11-21 todling - revisit how versions are set (add set/get_radiag) -! 2014-01-27 todling - add ob sensitivity index -! -! contains -! read_radiag_header - read radiance diagnostic file header -! read_radiag_data - read radiance diagnostic file data -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ - -module read_diag - - use kinds, only: i_kind,r_single - implicit none - -! Declare public and private - private - - public :: diag_header_fix_list - public :: diag_header_chan_list - public :: diag_data_name_list - public :: diag_data_fix_list - public :: diag_data_chan_list - public :: diag_data_extra_list - public :: read_radiag_header - public :: read_radiag_data -! public :: iversion_radiag -! public :: iversion_radiag_1 -! public :: iversion_radiag_2 -! public :: iversion_radiag_3 -! public :: iversion_radiag_4 - public :: ireal_radiag - public :: ipchan_radiag - public :: set_radiag - public :: get_radiag - - interface set_radiag - module procedure set_radiag_int_ ! internal procedure for integers - end interface - interface get_radiag - module procedure get_radiag_int_ ! internal procedure for integers - end interface - - integer(i_kind),parameter :: ireal_radiag = 30 ! number of real entries per spot in radiance diagnostic file - integer(i_kind),parameter :: ireal_old_radiag = 26 ! number of real entries per spot in versions older than iversion_radiag_2 - integer(i_kind),parameter :: ipchan_radiag = 8 ! number of entries per channel per spot in radiance diagnostic file - -! Declare structures for radiance diagnostic file information - type diag_header_fix_list - character(len=20) :: isis ! sat and sensor type - character(len=10) :: id ! sat type - character(len=10) :: obstype ! observation type - integer(i_kind) :: jiter ! outer loop counter - integer(i_kind) :: nchan ! number of channels in the sensor - integer(i_kind) :: npred ! number of updating bias correction predictors - integer(i_kind) :: idate ! time (yyyymmddhh) - integer(i_kind) :: ireal ! # of real elements in the fix part of a data record - integer(i_kind) :: ipchan ! # of elements for each channel except for bias correction terms - integer(i_kind) :: iextra ! # of extra elements for each channel - integer(i_kind) :: jextra ! # of extra elements - integer(i_kind) :: idiag ! first dimension of diag_data_chan - integer(i_kind) :: angord ! order of polynomial for adp_anglebc option - integer(i_kind) :: iversion ! radiance diagnostic file version number - integer(i_kind) :: inewpc ! indicator of newpc4pred (1 on, 0 off) - integer(i_kind) :: isens ! sensitivity index - end type diag_header_fix_list - - type diag_data_name_list - character(len=10),dimension(ireal_radiag) :: fix - character(len=10),dimension(:),allocatable :: chn - end type diag_data_name_list - - type diag_header_chan_list - real(r_single) :: freq ! frequency (Hz) - real(r_single) :: polar ! polarization - real(r_single) :: wave ! wave number (cm^-1) - real(r_single) :: varch ! error variance (or SD error?) - real(r_single) :: tlapmean ! mean lapse rate - integer(i_kind):: iuse ! use flag - integer(i_kind):: nuchan ! sensor relative channel number - integer(i_kind):: iochan ! satinfo relative channel number - end type diag_header_chan_list - - type diag_data_fix_list - real(r_single) :: lat ! latitude (deg) - real(r_single) :: lon ! longitude (deg) - real(r_single) :: zsges ! guess elevation at obs location (m) - real(r_single) :: obstime ! observation time relative to analysis - real(r_single) :: senscn_pos ! sensor scan position (integer(i_kind)) - real(r_single) :: satzen_ang ! satellite zenith angle (deg) - real(r_single) :: satazm_ang ! satellite azimuth angle (deg) - real(r_single) :: solzen_ang ! solar zenith angle (deg) - real(r_single) :: solazm_ang ! solar azimumth angle (deg) - real(r_single) :: sungln_ang ! sun glint angle (deg) - real(r_single) :: water_frac ! fractional coverage by water - real(r_single) :: land_frac ! fractional coverage by land - real(r_single) :: ice_frac ! fractional coverage by ice - real(r_single) :: snow_frac ! fractional coverage by snow - real(r_single) :: water_temp ! surface temperature over water (K) - real(r_single) :: land_temp ! surface temperature over land (K) - real(r_single) :: ice_temp ! surface temperature over ice (K) - real(r_single) :: snow_temp ! surface temperature over snow (K) - real(r_single) :: soil_temp ! soil temperature (K) - real(r_single) :: soil_mois ! soil moisture - real(r_single) :: land_type ! land type (integer(i_kind)) - real(r_single) :: veg_frac ! vegetation fraction - real(r_single) :: snow_depth ! snow depth - real(r_single) :: sfc_wndspd ! surface wind speed - real(r_single) :: qcdiag1 ! ir=cloud fraction, mw=cloud liquid water - real(r_single) :: qcdiag2 ! ir=cloud top pressure, mw=total column water - real(r_single) :: tref ! reference temperature (Tr) in NSST - real(r_single) :: dtw ! dt_warm at zob - real(r_single) :: dtc ! dt_cool at zob - real(r_single) :: tz_tr ! d(Tz)/d(Tr) - end type diag_data_fix_list - - type diag_data_chan_list - real(r_single) :: tbobs ! Tb (obs) (K) - real(r_single) :: omgbc ! Tb_(obs) - Tb_(simulated w/ bc) (K) - real(r_single) :: omgnbc ! Tb_(obs) - Tb_(simulated_w/o bc) (K) - real(r_single) :: errinv ! inverse error (K**(-1)) - real(r_single) :: qcmark ! quality control mark - real(r_single) :: emiss ! surface emissivity - real(r_single) :: tlap ! temperature lapse rate - real(r_single) :: tb_tz ! d(Tb)/d(Tz) - real(r_single) :: bicons ! constant bias correction term - real(r_single) :: biang ! scan angle bias correction term - real(r_single) :: biclw ! CLW bias correction term - real(r_single) :: bilap2 ! square lapse rate bias correction term - real(r_single) :: bilap ! lapse rate bias correction term - real(r_single) :: bicos ! node*cos(lat) bias correction term - real(r_single) :: bisin ! sin(lat) bias correction term - real(r_single) :: biemis ! emissivity sensitivity bias correction term - real(r_single),dimension(:),allocatable :: bifix ! angle dependent bias - real(r_single) :: bisst ! SST bias correction term - end type diag_data_chan_list - - type diag_data_extra_list - real(r_single) :: extra ! extra information - end type diag_data_extra_list - - integer(i_kind),save :: iversion_radiag ! Current version (see set routine) - integer(i_kind),parameter:: iversion_radiag_1 = 11104 ! Version when bias-correction entries were modified - integer(i_kind),parameter:: iversion_radiag_2 = 13784 ! Version when NSST entries were added - integer(i_kind),parameter:: iversion_radiag_3 = 19180 ! Version when SSMIS added - integer(i_kind),parameter:: iversion_radiag_4 = 30303 ! Version when emissivity predictor added - - real(r_single),parameter:: rmiss_radiag = -9.9e11_r_single - -contains - -subroutine set_radiag_int_ (what,iv,ier) -character(len=*),intent(in) :: what -integer(i_kind),intent(in) :: iv -integer(i_kind),intent(out):: ier -ier=-1 -if(trim(what)=='version') then - iversion_radiag = iv - ier=0 -endif -end subroutine set_radiag_int_ - -subroutine get_radiag_int_ (what,iv,ier) -character(len=*),intent(in) :: what -integer(i_kind),intent(out):: iv -integer(i_kind),intent(out):: ier -ier=-1 -if(trim(what)=='version') then - iv = iversion_radiag - ier=0 -endif -end subroutine get_radiag_int_ - -subroutine read_radiag_header(ftin,npred_radiag,retrieval,header_fix,header_chan,data_name,iflag,lverbose) -! . . . . -! subprogram: read_diag_header read rad diag header -! prgmmr: tahara org: np20 date: 2003-01-01 -! -! abstract: This routine reads the header record from a radiance -! diagnostic file -! -! program history log: -! 2010-10-05 treadon - add this doc block -! 2011-02-22 kleist - changes related to memory allocation and standard output -! -! input argument list: -! ftin - unit number connected to diagnostic file -! npred_radiag - number of bias correction terms -! retrieval - .true. if sst retrieval -! -! output argument list: -! header_fix - header information structure -! header_chan - channel information structure -! data_name - diag file data names -! iflag - error code -! lverbose - optional flag to turn off default output to standard out -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ - -! Declare passed arguments - integer(i_kind),intent(in) :: ftin - integer(i_kind),intent(in) :: npred_radiag - logical,intent(in) :: retrieval - type(diag_header_fix_list ),intent(out):: header_fix - type(diag_header_chan_list),allocatable :: header_chan(:) - type(diag_data_name_list) :: data_name - integer(i_kind),intent(out) :: iflag - logical,optional,intent(in) :: lverbose - -! Declare local variables - character(len=2):: string - character(len=10):: satid,sentype - character(len=20):: sensat - integer(i_kind) :: i,ich - integer(i_kind):: jiter,nchanl,npred,ianldate,ireal,ipchan,iextra,jextra - integer(i_kind):: idiag,angord,iversion,inewpc,isens - integer(i_kind):: iuse_tmp,nuchan_tmp,iochan_tmp - real(r_single) :: freq_tmp,polar_tmp,wave_tmp,varch_tmp,tlapmean_tmp - logical loutall - - loutall=.true. - if(present(lverbose)) loutall=lverbose - -! Read header (fixed_part). - read(ftin,IOSTAT=iflag) sensat,satid,sentype,jiter,nchanl,npred,ianldate,& - ireal,ipchan,iextra,jextra,idiag,angord,iversion,inewpc,isens - if (iflag/=0) then - rewind(ftin) - read(ftin,IOSTAT=iflag) sensat,satid,sentype,jiter,nchanl,npred,ianldate,& - ireal,ipchan,iextra,jextra,idiag,angord,iversion,inewpc - isens=0 - end if - - if (iflag/=0) then - rewind(ftin) - read(ftin,IOSTAT=iflag) sensat,satid,sentype,jiter,nchanl,npred,ianldate,& - ireal,ipchan,iextra,jextra - idiag=ipchan+npred+1 - angord=0 - iversion=0 - inewpc=0 - isens=0 - if (iflag/=0) then - write(6,*)'READ_RADIAG_HEADER: ***ERROR*** Unknown file format. Cannot read' - return - endif - endif - - header_fix%isis = sensat - header_fix%id = satid - header_fix%obstype = sentype - header_fix%jiter = jiter - header_fix%nchan = nchanl - header_fix%npred = npred - header_fix%idate = ianldate - header_fix%ireal = ireal - header_fix%ipchan = ipchan - header_fix%iextra = iextra - header_fix%jextra = jextra - header_fix%idiag = idiag - header_fix%angord = angord - header_fix%iversion= iversion - header_fix%inewpc = inewpc - header_fix%isens = isens - - if (loutall) then - write(6,*)'READ_RADIAG_HEADER: isis=',header_fix%isis,& - ' nchan=',header_fix%nchan,& - ' npred=',header_fix%npred,& - ' angord=',header_fix%angord,& - ' idiag=',header_fix%idiag,& - ' iversion=',header_fix%iversion,& - ' inewpc=',header_fix%inewpc,& - ' isens=',header_fix%isens - - if ( header_fix%iextra /= 0) & - write(6,*)'READ_RADIAG_HEADER: extra diagnostic information available, ',& - 'iextra=',header_fix%iextra - end if - - if (header_fix%npred /= npred_radiag) & - write(6,*) 'READ_RADIAG_HEADER: **WARNING** header_fix%npred,npred=',& - header_fix%npred,npred_radiag - -! Allocate and initialize as needed - if (allocated(header_chan)) deallocate(header_chan) - if (allocated(data_name%chn)) deallocate(data_name%chn) - - allocate(header_chan( header_fix%nchan)) - allocate(data_name%chn(header_fix%idiag)) - - data_name%fix(1) ='lat ' - data_name%fix(2) ='lon ' - data_name%fix(3) ='zsges ' - data_name%fix(4) ='obstim ' - data_name%fix(5) ='scanpos ' - data_name%fix(6) ='satzen ' - data_name%fix(7) ='satazm ' - data_name%fix(8) ='solzen ' - data_name%fix(9) ='solazm ' - data_name%fix(10)='sungln ' - data_name%fix(11)='fwater ' - data_name%fix(12)='fland ' - data_name%fix(13)='fice ' - data_name%fix(14)='fsnow ' - data_name%fix(15)='twater ' - data_name%fix(16)='tland ' - data_name%fix(17)='tice ' - data_name%fix(18)='tsnow ' - data_name%fix(19)='tsoil ' - data_name%fix(20)='soilmoi ' - data_name%fix(21)='landtyp ' - data_name%fix(22)='vegfrac ' - data_name%fix(23)='snowdep ' - data_name%fix(24)='wndspd ' - data_name%fix(25)='qc1 ' - data_name%fix(26)='qc2 ' - data_name%fix(27)='tref ' - data_name%fix(28)='dtw ' - data_name%fix(29)='dtc ' - data_name%fix(30)='tz_tr ' - - data_name%chn(1)='obs ' - data_name%chn(2)='omgbc ' - data_name%chn(3)='omgnbc ' - data_name%chn(4)='errinv ' - data_name%chn(5)='qcmark ' - data_name%chn(6)='emiss ' - data_name%chn(7)='tlap ' - data_name%chn(8)='tb_tz ' - - if (header_fix%iversion < iversion_radiag_1) then - data_name%chn( 8)= 'bifix ' - data_name%chn( 9)= 'bilap ' - data_name%chn(10)= 'bilap2 ' - data_name%chn(11)= 'bicons ' - data_name%chn(12)= 'biang ' - data_name%chn(13)= 'biclw ' - if (retrieval) data_name%chn(13)= 'bisst ' - elseif ( header_fix%iversion < iversion_radiag_2 .and. header_fix%iversion >= iversion_radiag_1 ) then - data_name%chn( 8)= 'bicons ' - data_name%chn( 9)= 'biang ' - data_name%chn(10)= 'biclw ' - data_name%chn(11)= 'bilap2 ' - data_name%chn(12)= 'bilap ' - do i=1,header_fix%angord - write(string,'(i2.2)') header_fix%angord-i+1 - data_name%chn(12+i)= 'bifix' // string - end do - data_name%chn(12+header_fix%angord+1)= 'bifix ' - data_name%chn(12+header_fix%angord+2)= 'bisst ' - elseif ( header_fix%iversion < iversion_radiag_3 .and. header_fix%iversion >= iversion_radiag_2 ) then - data_name%chn( 9)= 'bicons ' - data_name%chn(10)= 'biang ' - data_name%chn(11)= 'biclw ' - data_name%chn(12)= 'bilap2 ' - data_name%chn(13)= 'bilap ' - do i=1,header_fix%angord - write(string,'(i2.2)') header_fix%angord-i+1 - data_name%chn(13+i)= 'bifix' // string - end do - data_name%chn(13+header_fix%angord+1)= 'bifix ' - data_name%chn(13+header_fix%angord+2)= 'bisst ' - elseif ( header_fix%iversion < iversion_radiag_4 .and. header_fix%iversion >= iversion_radiag_3 ) then - data_name%chn( 9)= 'bicons ' - data_name%chn(10)= 'biang ' - data_name%chn(11)= 'biclw ' - data_name%chn(12)= 'bilap2 ' - data_name%chn(13)= 'bilap ' - data_name%chn(14)= 'bicos ' - data_name%chn(15)= 'bisin ' - do i=1,header_fix%angord - write(string,'(i2.2)') header_fix%angord-i+1 - data_name%chn(15+i)= 'bifix' // string - end do - data_name%chn(15+header_fix%angord+1)= 'bifix ' - data_name%chn(15+header_fix%angord+2)= 'bisst ' - else - data_name%chn( 9)= 'bicons ' - data_name%chn(10)= 'biang ' - data_name%chn(11)= 'biclw ' - data_name%chn(12)= 'bilap2 ' - data_name%chn(13)= 'bilap ' - data_name%chn(14)= 'bicos ' - data_name%chn(15)= 'bisin ' - data_name%chn(16)= 'biemis ' - do i=1,header_fix%angord - write(string,'(i2.2)') header_fix%angord-i+1 - data_name%chn(16+i)= 'bifix' // string - end do - data_name%chn(16+header_fix%angord+1)= 'bifix ' - data_name%chn(16+header_fix%angord+2)= 'bisst ' - endif - -! Read header (channel part) - do ich=1, header_fix%nchan - read(ftin,IOSTAT=iflag) freq_tmp,polar_tmp,wave_tmp,varch_tmp,tlapmean_tmp,iuse_tmp,nuchan_tmp,iochan_tmp - header_chan(ich)%freq = freq_tmp - header_chan(ich)%polar = polar_tmp - header_chan(ich)%wave = wave_tmp - header_chan(ich)%varch = varch_tmp - header_chan(ich)%tlapmean = tlapmean_tmp - header_chan(ich)%iuse = iuse_tmp - header_chan(ich)%nuchan = nuchan_tmp - header_chan(ich)%iochan = iochan_tmp - if (iflag/=0) return - end do - -! Construct array containing menonics for data record entries - - -end subroutine read_radiag_header - -subroutine read_radiag_data(ftin,header_fix,retrieval,data_fix,data_chan,data_extra,iflag ) -! . . . . -! subprogram: read_radiag_dat read rad diag data -! prgmmr: tahara org: np20 date: 2003-01-01 -! -! abstract: This routine reads the data record from a radiance -! diagnostic file -! -! program history log: -! 2010-10-05 treadon - add this doc block -! 2011-02-22 kleist - changes related to memory allocation -! -! input argument list: -! ftin - unit number connected to diagnostic file -! header_fix - header information structure -! -! output argument list: -! data_fix - spot header information structure -! data_chan - spot channel information structure -! data_extra - spot extra information -! iflag - error code -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ - - -! Declare passed arguments - integer(i_kind),intent(in) :: ftin - type(diag_header_fix_list ),intent(in) :: header_fix - logical,intent(in) :: retrieval - type(diag_data_fix_list) ,intent(out):: data_fix - type(diag_data_chan_list) ,allocatable :: data_chan(:) - type(diag_data_extra_list) ,allocatable :: data_extra(:,:) - integer(i_kind),intent(out) :: iflag - - integer(i_kind) :: ich,iang,i,j - real(r_single),dimension(:,:),allocatable :: data_tmp - real(r_single),dimension(:),allocatable :: fix_tmp - real(r_single),dimension(:,:),allocatable :: extra_tmp - -! Allocate arrays as needed - if (allocated(data_chan)) deallocate(data_chan) - allocate(data_chan(header_fix%nchan)) - - do ich=1,header_fix%nchan - if (allocated(data_chan(ich)%bifix)) deallocate(data_chan(ich)%bifix) - allocate(data_chan(ich)%bifix(header_fix%angord+1)) - end do - - if (header_fix%iextra > 0) then - if (allocated(data_extra)) deallocate(data_extra) - allocate(data_extra(header_fix%iextra,header_fix%jextra)) - allocate(extra_tmp(header_fix%iextra,header_fix%jextra)) - end if - -! Allocate arrays to hold data record - allocate(data_tmp(header_fix%idiag,header_fix%nchan)) - - if (header_fix%iversion < iversion_radiag_2) then - allocate( fix_tmp( ireal_old_radiag ) ) - else - allocate( fix_tmp( ireal_radiag ) ) - end if - -! Read data record - - if (header_fix%iextra == 0) then - read(ftin,IOSTAT=iflag) fix_tmp, data_tmp - else - read(ftin,IOSTAT=iflag) fix_tmp, data_tmp, extra_tmp - endif - - -! Transfer fix_tmp record to output structure - data_fix%lat = fix_tmp(1) - data_fix%lon = fix_tmp(2) - data_fix%zsges = fix_tmp(3) - data_fix%obstime = fix_tmp(4) - data_fix%senscn_pos = fix_tmp(5) - data_fix%satzen_ang = fix_tmp(6) - data_fix%satazm_ang = fix_tmp(7) - data_fix%solzen_ang = fix_tmp(8) - data_fix%solazm_ang = fix_tmp(9) - data_fix%sungln_ang = fix_tmp(10) - data_fix%water_frac = fix_tmp(11) - data_fix%land_frac = fix_tmp(12) - data_fix%ice_frac = fix_tmp(13) - data_fix%snow_frac = fix_tmp(14) - data_fix%water_temp = fix_tmp(15) - data_fix%land_temp = fix_tmp(16) - data_fix%ice_temp = fix_tmp(17) - data_fix%snow_temp = fix_tmp(18) - data_fix%soil_temp = fix_tmp(19) - data_fix%soil_mois = fix_tmp(20) - data_fix%land_type = fix_tmp(21) - data_fix%veg_frac = fix_tmp(22) - data_fix%snow_depth = fix_tmp(23) - data_fix%sfc_wndspd = fix_tmp(24) - data_fix%qcdiag1 = fix_tmp(25) - data_fix%qcdiag2 = fix_tmp(26) - - if ( header_fix%iversion <= iversion_radiag_1 ) then - data_fix%tref = rmiss_radiag - data_fix%dtw = rmiss_radiag - data_fix%dtc = rmiss_radiag - data_fix%tz_tr = rmiss_radiag - else - data_fix%tref = fix_tmp(27) - data_fix%dtw = fix_tmp(28) - data_fix%dtc = fix_tmp(29) - data_fix%tz_tr = fix_tmp(30) - end if - - -! Transfer data record to output structure - do ich=1,header_fix%nchan - data_chan(ich)%tbobs =data_tmp(1,ich) - data_chan(ich)%omgbc =data_tmp(2,ich) - data_chan(ich)%omgnbc=data_tmp(3,ich) - data_chan(ich)%errinv=data_tmp(4,ich) - data_chan(ich)%qcmark=data_tmp(5,ich) - data_chan(ich)%emiss =data_tmp(6,ich) - data_chan(ich)%tlap =data_tmp(7,ich) - data_chan(ich)%tb_tz =data_tmp(8,ich) - end do - if (header_fix%iversion < iversion_radiag_1) then - do ich=1,header_fix%nchan - data_chan(ich)%bifix(1)=data_tmp(8,ich) - data_chan(ich)%bilap =data_tmp(9,ich) - data_chan(ich)%bilap2 =data_tmp(10,ich) - data_chan(ich)%bicons =data_tmp(11,ich) - data_chan(ich)%biang =data_tmp(12,ich) - data_chan(ich)%biclw =data_tmp(13,ich) - data_chan(ich)%bisst = rmiss_radiag - if (retrieval) then - data_chan(ich)%biclw =rmiss_radiag - data_chan(ich)%bisst =data_tmp(13,ich) - endif - end do - elseif ( header_fix%iversion < iversion_radiag_2 .and. header_fix%iversion >= iversion_radiag_1 ) then - do ich=1,header_fix%nchan - data_chan(ich)%bicons=data_tmp(8,ich) - data_chan(ich)%biang =data_tmp(9,ich) - data_chan(ich)%biclw =data_tmp(10,ich) - data_chan(ich)%bilap2=data_tmp(11,ich) - data_chan(ich)%bilap =data_tmp(12,ich) - end do - do ich=1,header_fix%nchan - do iang=1,header_fix%angord+1 - data_chan(ich)%bifix(iang)=data_tmp(12+iang,ich) - end do - data_chan(ich)%bisst = data_tmp(12+header_fix%angord+2,ich) - end do - elseif ( header_fix%iversion < iversion_radiag_3 .and. header_fix%iversion >= iversion_radiag_2 ) then - do ich=1,header_fix%nchan - data_chan(ich)%bicons=data_tmp(9,ich) - data_chan(ich)%biang =data_tmp(10,ich) - data_chan(ich)%biclw =data_tmp(11,ich) - data_chan(ich)%bilap2=data_tmp(12,ich) - data_chan(ich)%bilap =data_tmp(13,ich) - end do - do ich=1,header_fix%nchan - do iang=1,header_fix%angord+1 - data_chan(ich)%bifix(iang)=data_tmp(13+iang,ich) - end do - data_chan(ich)%bisst = data_tmp(13+header_fix%angord+2,ich) - end do - elseif ( header_fix%iversion < iversion_radiag_4 .and. header_fix%iversion >= iversion_radiag_3 ) then - do ich=1,header_fix%nchan - data_chan(ich)%bicons=data_tmp(9,ich) - data_chan(ich)%biang =data_tmp(10,ich) - data_chan(ich)%biclw =data_tmp(11,ich) - data_chan(ich)%bilap2=data_tmp(12,ich) - data_chan(ich)%bilap =data_tmp(13,ich) - data_chan(ich)%bicos =data_tmp(14,ich) ! 1st bias correction term node*cos(lat) for SSMIS - data_chan(ich)%bisin =data_tmp(15,ich) ! 2nd bias correction term sin(lat) for SSMI - end do - do ich=1,header_fix%nchan - do iang=1,header_fix%angord+1 - data_chan(ich)%bifix(iang)=data_tmp(15+iang,ich) - end do - data_chan(ich)%bisst = data_tmp(15+header_fix%angord+2,ich) - end do - else - do ich=1,header_fix%nchan - data_chan(ich)%bicons=data_tmp(9,ich) - data_chan(ich)%biang =data_tmp(10,ich) - data_chan(ich)%biclw =data_tmp(11,ich) - data_chan(ich)%bilap2=data_tmp(12,ich) - data_chan(ich)%bilap =data_tmp(13,ich) - data_chan(ich)%bicos =data_tmp(14,ich) - data_chan(ich)%bisin =data_tmp(15,ich) - data_chan(ich)%biemis=data_tmp(16,ich) - end do - do ich=1,header_fix%nchan - do iang=1,header_fix%angord+1 - data_chan(ich)%bifix(iang)=data_tmp(16+iang,ich) - end do - data_chan(ich)%bisst = data_tmp(16+header_fix%angord+2,ich) - end do - endif - - if (header_fix%iextra > 0) then - do j=1,header_fix%jextra - do i=1,header_fix%iextra - data_extra(i,j)%extra=extra_tmp(i,j) - end do - end do - endif - - deallocate(data_tmp, fix_tmp) - if (header_fix%iextra > 0) deallocate(extra_tmp) - -end subroutine read_radiag_data - -end module read_diag - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radbcor.fd/readme b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radbcor.fd/readme deleted file mode 100644 index 6957c66f6f..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radbcor.fd/readme +++ /dev/null @@ -1,23 +0,0 @@ -Instructions for building radmon_bcor executable. - - 1) Load the build module appropriate for your Machine: - i.) - WCOSS: - "module use -a ../../modulefiles/wcoss" - THEIA: - "module use -a ../../modulefiles/theia" - ii.) - "module load RadMonBuild" - - 2) Optional: verify all prerequisites are met by typing: - "make check_prereqs" - - 3) Build the executable by typing: - "make" - - 4) Move the executable to the ../../exec directory by typing: - "make install" - - 5) Unload the build module: - "module unload RadMonBuild" - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radtime.fd/bad_chan.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radtime.fd/bad_chan.f90 deleted file mode 100644 index eaac10cff6..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radtime.fd/bad_chan.f90 +++ /dev/null @@ -1,94 +0,0 @@ -!$$$ subprogram documentation block -! . . . -! subprogram: bad_chan build bad_chan.txt file -! prgmmr: safford date: 2009-11 -! -! abstract: This module contains code to build the bad_chan.txt file. -! The bad_chan.txt file reports the satellite and channel for -! which zero obs were found on a channel that is set for use -! and normally has data. -! -! program history log: -! 2009-12-22 safford - initial coding -! -! contains: -! -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ - -module bad_chan - - implicit none - - private - - public :: open_bad_chan_file - public :: write_bad_chan - public :: close_bad_chan_file - - integer, parameter :: funit = 14 - - contains - - - !------------------------------------------------------------- - ! create the bad_chan file - !------------------------------------------------------------- - - subroutine open_bad_chan_file( date, cycle, fios ) - - !--- interface - character(8), intent( in ) :: date - character(8), intent( in ) :: cycle - integer, intent( out ) :: fios - - !--- variables - logical :: lexist = .FALSE. - character(60) :: fname - - -! write(*,*) '--> open_bad_chan_file, date, cycle = ', date, cycle - !--- build the file name - fname = 'bad_chan.' // trim(date) // trim(cycle) - - write(*,*) ' fname = ', fname - - !--- open file and write the header - inquire(file=fname, exist=lexist) - if( lexist .eqv. .FALSE. ) then - write(6,*) ' opening new bad_chan file' - open( UNIT=funit, FILE=fname, STATUS='NEW', IOSTAT=fios ) - else - write(6,*) ' opening existing bad_chan.txt file' - open( UNIT=funit, FILE=fname, STATUS='OLD', POSITION='APPEND', IOSTAT=fios ) - end if - - end subroutine open_bad_chan_file - - - subroutine write_bad_chan( satname, channel ) - - !--- interface - character(20), intent( in ) :: satname - integer, intent( in ) :: channel - - !--- variables - real :: count - - write(6,*) 'write_bad_chan, satname, channel', satname, channel - - write(funit,*) satname, 'channel= ', channel - - end subroutine write_bad_chan - - - subroutine close_bad_chan_file( ) -! write(6,*) '--> close_bad_chan_file' - close( funit ) - end subroutine close_bad_chan_file - -end module bad_chan diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radtime.fd/bad_obs.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radtime.fd/bad_obs.f90 deleted file mode 100644 index 9962b00bb3..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radtime.fd/bad_obs.f90 +++ /dev/null @@ -1,99 +0,0 @@ -!$$$ subprogram documentation block -! . . . -! subprogram: bad_obs build bad_obs.txt file -! prgmmr: safford date: 2009-11 -! -! abstract: This module contains code to build the bad_obs.txt file. -! The bad_obs.txt file reports the satellite and channel for -! which an unexpected number of observations were found in -! assimilated radiance data. -! -! program history log: -! 2009-11-23 safford - initial coding -! -! contains: -! -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ - -module bad_obs - - implicit none - - private - - public :: open_bad_obs_file - public :: write_bad_obs - public :: close_bad_obs_file - - integer, parameter :: funit = 10 - - contains - - - !------------------------------------------------------------- - ! create the bad_obs file - !------------------------------------------------------------- - - subroutine open_bad_obs_file( date, cycle, fios ) - - !--- interface - character(8), intent( in ) :: date - character(8), intent( in ) :: cycle - integer, intent( out ) :: fios - - !--- variables - logical :: lexist = .FALSE. - character(60) :: fname - - - write(*,*) '--> open_bad_obs_file, date, cycle = ', date, cycle - !--- build the file name - fname = 'bad_obs.' // trim(date) // trim(cycle) - - !--- open file and write the header - inquire(file=fname, exist=lexist) - if( lexist .eqv. .FALSE. ) then - write(*,*) ' opening new bad_obs file' - open( UNIT=funit, FILE=fname, STATUS='NEW', IOSTAT=fios ) - else - write(*,*) ' opening existing bad_obs.txt file' - open( UNIT=funit, FILE=fname, STATUS='OLD', POSITION='APPEND', IOSTAT=fios ) - end if - - end subroutine open_bad_obs_file - - - subroutine write_bad_obs( satname, channel, region, num_obs ) - - !--- interface - character(20), intent( in ) :: satname - integer, intent( in ) :: channel - integer, intent( in ) :: region - real, intent( in ) :: num_obs - - !--- variables - real :: count - - !--- -! if( num_obs < 0.0 ) then -! count = 0.0 -! else - count = num_obs -! end if - - write(funit,*) satname, 'channel= ', channel, ' region= ', region, ' num_obs= ', count - - end subroutine write_bad_obs - - - subroutine close_bad_obs_file( ) - write(*,*) '--> close_bad_obs_file' - close( funit ) - end subroutine close_bad_obs_file - -end module bad_obs diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radtime.fd/bad_penalty.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radtime.fd/bad_penalty.f90 deleted file mode 100644 index 55c822c7e8..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radtime.fd/bad_penalty.f90 +++ /dev/null @@ -1,100 +0,0 @@ -!$$$ subprogram documentation block -! . . . -! subprogram: penalty build penalty.txt file -! prgmmr: safford date: 2009-11 -! -! abstract: This module contains code to build the penalty.txt file. -! The penalty.txt file reports the satellite and channel for -! which a penalty value is likely out of range. -! -! program history log: -! 2009-11-23 safford - initial coding -! -! contains: -! -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ - -module bad_penalty - - implicit none - - private - - public :: open_bad_penalty_file - public :: write_bad_penalty - public :: close_bad_penalty_file - - integer, parameter :: funit = 11 - - contains - - - !------------------------------------------------------------- - ! open the bad_pen file - !------------------------------------------------------------- - - subroutine open_bad_penalty_file( date, cycle, fios ) - - !--- interface - character(8), intent( in ) :: date - character(8), intent( in ) :: cycle - integer, intent( out ) :: fios - - !--- variables - logical :: lexist = .FALSE. - character(60) :: fname - -! write(*,*) '--> open_bad_penalty_file, date, cycle = ', date, cycle - - !--- build the file name - fname= 'bad_pen.' // trim(date) // trim(cycle) - write(*,*) ' fname = ', fname - - !--- open file and write the header - inquire(file=fname, exist=lexist) - if( lexist .eqv. .FALSE. ) then - write(*,*) ' opening new bad_pen file' - open( UNIT=funit, FILE=fname, STATUS='NEW', IOSTAT=fios ) - else - write(*,*) ' opening existing bad_penalty.txt file' - open( UNIT=funit, FILE=fname, STATUS='OLD', POSITION='APPEND', IOSTAT=fios ) - end if - - end subroutine open_bad_penalty_file - - - !------------------------------------------------------------- - ! add an entry to the bad_penalty.txt file - !------------------------------------------------------------- - subroutine write_bad_penalty( satname, channel, region, penalty, bound ) - - !--- interface - character(20), intent( in ) :: satname - integer, intent( in ) :: channel - integer, intent( in ) :: region - real, intent( in ) :: penalty - real, intent( in ) :: bound - character(60) :: myformat - - myformat = "(A20,A10,I5,A9,I1,A10,ES15.7E2,A8,ES15.7E2)" - - - write(funit,myformat) satname, ' channel= ',channel, ' region= ', region, ' penalty= ', penalty, ' bound= ', bound - - end subroutine write_bad_penalty - - - !------------------------------------------------------------- - ! close the bad_penalty.txt file - !------------------------------------------------------------- - subroutine close_bad_penalty_file( ) -! write(*,*) '--> close_bad_penalty_file' - close( funit ) - end subroutine close_bad_penalty_file - -end module bad_penalty diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radtime.fd/create_ctl_time.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radtime.fd/create_ctl_time.f90 deleted file mode 100755 index a5be776d16..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radtime.fd/create_ctl_time.f90 +++ /dev/null @@ -1,162 +0,0 @@ -subroutine create_ctl_time(ntype,ftype,n_chan,iyy,imm,idd,ihh,idhh,& - incr,ctl_file,lunctl,rmiss,satname,satype,dplat,nregion,& - region,rlonmin,rlonmax,rlatmin,rlatmax,nu_chan,use,error,& - frequency,wavenumbr,little_endian) - - implicit none - - integer ntype - - character(2) cword - character(3),dimension(12):: mon - character(3):: clatmin,clatmax - character(4):: clonmin,clonmax - character(10),dimension(ntype):: ftype - character(13) stringd - character(20) satname,satsis - character(10) satype,dplat - character(40) ctl_file,grad_file - character(80) string - character(40),dimension(nregion):: region - character(80),dimension(nregion):: stringr - - integer idsat,nregion,iuse,little_endian - integer lunctl,iyy,imm,idd,ihh,j,i,n_chan,idhh,incr - integer iyy2,imm2,idd2,ihh2,ntime - integer,dimension(8):: ida,jda - integer,dimension(n_chan):: nu_chan - - real rmiss,wavelength - real,dimension(5):: fha - real,dimension(n_chan):: error,use,frequency,wavenumbr - real,dimension(nregion):: rlonmin,rlonmax,rlatmin,rlatmax - - data stringd / '.%y4%m2%d2%h2' / - data mon / 'jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', & - 'aug', 'sep', 'oct', 'nov', 'dec' / - -!************************************************************************** -! Create date for tdef based on given date and hour offset - fha=0.0; ida=0; jda=0; ntime=0 - iyy2=iyy; imm2=imm; idd2=idd; ihh2=ihh - if (idhh/=0) then - ntime = abs(idhh)/incr - fha(2)=idhh - ida(1)=iyy - ida(2)=imm - ida(3)=idd - ida(4)=0 - ida(5)=ihh - call w3movdat(fha,ida,jda) - iyy2=jda(1) - imm2=jda(2) - idd2=jda(3) - ihh2=jda(5) - endif - ntime=ntime+1 - -! Open unit to GrADS control file - open(lunctl,file=ctl_file,form='formatted') - -!******************************************************************* -! Construct the region strings if this is for a global source, -! which is defined as nregion > 1. -! - if (nregion > 1) then - do i=1,nregion - if (rlatmin(i)>0.) then - write(clatmin,10) int(rlatmin(i)) - else - write(clatmin,20) abs(int(rlatmin(i))) - endif - if (rlatmax(i)>0.) then - write(clatmax,10) int(rlatmax(i)) - else - write(clatmax,20) abs(int(rlatmax(i))) - endif - if (rlonmin(i)>0.) then - write(clonmin,30) int(rlonmin(i)) - else - write(clonmin,40) abs(int(rlonmin(i))) - endif - if (rlonmax(i)>0.) then - write(clonmax,30) int(rlonmax(i)) - else - write(clonmax,40) abs(int(rlonmax(i))) - endif - stringr(i) = trim(region(i)) // ' (' // & - trim(clonmin) // '-' // trim(clonmax) // ', ' // & - trim(clatmin) // '-' // trim(clatmax) // ')' - end do - endif -10 format(i2,'N') -20 format(i2,'S') -30 format(i3,'E') -40 format(i3,'W') - -! Write header information - grad_file = trim(satname) // stringd // '.ieee_d' - write(lunctl,100) grad_file - if ( little_endian == 1 ) then - write(lunctl,112) - else - write(lunctl,110) - endif - write(lunctl,120) rmiss - write(lunctl,130) adjustl(satype),dplat,n_chan - write(lunctl,132) - do i=1,n_chan - iuse = nint(use(i)) - wavelength = 10000./wavenumbr(i) - write(lunctl,134) i,nu_chan(i),iuse,error(i),wavelength,frequency(i) - end do - write(lunctl,136) - - if (nregion > 1) then - do i=1,nregion - write(cword,'(i2)') i - string = '* region=' // cword // ' ' // trim(stringr(i)) - write(lunctl,138) string - end do - endif - - write(lunctl,140) n_chan - write(lunctl,150) nregion - write(lunctl,160) - write(lunctl,170) ntime,ihh2,idd2,mon(imm2),iyy2 - write(lunctl,180) ntype - -100 format('dset ^',a40) -110 format('options template big_endian sequential') -112 format('options template little_endian sequential') -120 format('undef ',f5.0) -130 format('title ',a10,1x,a10,1x,i4) -132 format('*XDEF is channel number') -134 format('* x= ',i4,', channel= ',i4,' , iuse= ',i2,' , error= ',f8.3,& - ' , wlth= ',f9.2,' , freq= ',f9.2) -136 format('*YDEF is geographic region') -138 format(a80) -140 format('xdef ',i4,' linear 1.0 1.0') -150 format('ydef ',i2,' linear 1.0 1.0') -160 format('zdef 1 linear 1.0 1.0') -170 format('tdef ',i4,' linear ',i2.2,'Z',i2.2,a3,i4.4,' 06hr') -180 format('vars ',i7) - -! Write data portion of GraDS control file - do i=1,ntype - string = trim(ftype(i)) - write(lunctl,190) adjustl(string),trim(ftype(i)) -190 format(a10,' 0 0 ',a10) - end do - -! Write trminating "endvars" record - write(lunctl,200) -200 format('endvars') - - -! Close ctl file - close(lunctl) - -! Return - return -end subroutine create_ctl_time diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radtime.fd/kinds.F90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radtime.fd/kinds.F90 deleted file mode 100644 index 8b3a2fcc4e..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radtime.fd/kinds.F90 +++ /dev/null @@ -1,112 +0,0 @@ -module kinds -!$$$ module documentation block -! . . . . -! module: kinds -! prgmmr: treadon org: np23 date: 2004-08-15 -! -! abstract: Module to hold specification kinds for variable declaration. -! This module is based on (copied from) Paul vanDelst's -! type_kinds module found in the community radiative transfer -! model -! -! module history log: -! 2004-08-15 treadon -! 2011-07-04 todling - define main precision during compilation -! -! Subroutines Included: -! -! Functions Included: -! -! remarks: -! The numerical data types defined in this module are: -! i_byte - specification kind for byte (1-byte) integer variable -! i_short - specification kind for short (2-byte) integer variable -! i_long - specification kind for long (4-byte) integer variable -! i_llong - specification kind for double long (8-byte) integer variable -! r_single - specification kind for single precision (4-byte) real variable -! r_double - specification kind for double precision (8-byte) real variable -! r_quad - specification kind for quad precision (16-byte) real variable -! -! i_kind - generic specification kind for default integer -! r_kind - generic specification kind for default floating point -! -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ end documentation block - implicit none - private - -! Integer type definitions below - -! Integer types - integer, parameter, public :: i_byte = selected_int_kind(1) ! byte integer - integer, parameter, public :: i_short = selected_int_kind(4) ! short integer - integer, parameter, public :: i_long = selected_int_kind(8) ! long integer - integer, parameter, private :: llong_t = selected_int_kind(16) ! llong integer - integer, parameter, public :: i_llong = max( llong_t, i_long ) - -! Expected 8-bit byte sizes of the integer kinds - integer, parameter, public :: num_bytes_for_i_byte = 1 - integer, parameter, public :: num_bytes_for_i_short = 2 - integer, parameter, public :: num_bytes_for_i_long = 4 - integer, parameter, public :: num_bytes_for_i_llong = 8 - -! Define arrays for default definition - integer, parameter, private :: num_i_kinds = 4 - integer, parameter, dimension( num_i_kinds ), private :: integer_types = (/ & - i_byte, i_short, i_long, i_llong /) - integer, parameter, dimension( num_i_kinds ), private :: integer_byte_sizes = (/ & - num_bytes_for_i_byte, num_bytes_for_i_short, & - num_bytes_for_i_long, num_bytes_for_i_llong /) - -! Default values -! **** CHANGE THE FOLLOWING TO CHANGE THE DEFAULT INTEGER TYPE KIND *** - integer, parameter, private :: default_integer = 3 ! 1=byte, - ! 2=short, - ! 3=long, - ! 4=llong - integer, parameter, public :: i_kind = integer_types( default_integer ) - integer, parameter, public :: num_bytes_for_i_kind = & - integer_byte_sizes( default_integer ) - - -! Real definitions below - -! Real types - integer, parameter, public :: r_single = selected_real_kind(6) ! single precision - integer, parameter, public :: r_double = selected_real_kind(15) ! double precision - integer, parameter, private :: quad_t = selected_real_kind(20) ! quad precision - integer, parameter, public :: r_quad = max( quad_t, r_double ) - -! Expected 8-bit byte sizes of the real kinds - integer, parameter, public :: num_bytes_for_r_single = 4 - integer, parameter, public :: num_bytes_for_r_double = 8 - integer, parameter, public :: num_bytes_for_r_quad = 16 - -! Define arrays for default definition - integer, parameter, private :: num_r_kinds = 3 - integer, parameter, dimension( num_r_kinds ), private :: real_kinds = (/ & - r_single, r_double, r_quad /) - integer, parameter, dimension( num_r_kinds ), private :: real_byte_sizes = (/ & - num_bytes_for_r_single, num_bytes_for_r_double, & - num_bytes_for_r_quad /) - -! Default values -! **** CHANGE THE FOLLOWING TO CHANGE THE DEFAULT REAL TYPE KIND *** -#ifdef _REAL4_ - integer, parameter, private :: default_real = 1 ! 1=single, -#endif -#ifdef _REAL8_ - integer, parameter, private :: default_real = 2 ! 2=double, -#endif -#ifdef _REAL16_ - integer, parameter, private :: default_real = 3 ! 3=quad -#endif - integer, parameter, public :: r_kind = real_kinds( default_real ) - integer, parameter, public :: num_bytes_for_r_kind = & - real_byte_sizes( default_real ) - -end module kinds diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radtime.fd/makefile b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radtime.fd/makefile deleted file mode 100755 index 5daa741f6f..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radtime.fd/makefile +++ /dev/null @@ -1,62 +0,0 @@ -# ***************************************************************** -# makefile -# -# Make the radmon_time executable. -# -# ***************************************************************** - -BINDIR = ../../exec - -LIBS = $(W3NCO_LIB4) - -OBJS = kinds.o read_diag.o bad_obs.o bad_penalty.o bad_chan.o valid.o \ - time.o create_ctl_time.o - -# -# ***************************************************************** -# - -CMD = radmon_time - -all: $(CMD) - -clean: - rm -f *.o - rm -f *.mod - rm -f radmon_time - -check_prereqs: - $(CHECK_LIBS) $(LIBS) - -install: - cp -f $(CMD) $(BINDIR)/ - -debug: FFLAGS = $(D_FFLAGS) -debug: $(CMD) - -$(CMD): $(OBJS) - $(CF) $(FFLAGS) $(LDFLAGS) -o $(@) $(OBJS) $(LIBS) - -read_diag.o : read_diag.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -bad_obs.o : bad_obs.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -bad_penalty.o : bad_penalty.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -bad_chan.o : bad_chan.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -valid.o : valid.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -time.o : time.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -create_ctl_time.o : create_ctl_time.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -kinds.o : kinds.F90 - $(CF) $(FFLAGS) -c $(*).F90 diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radtime.fd/read_diag.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radtime.fd/read_diag.f90 deleted file mode 100755 index 7a4d6cdc49..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radtime.fd/read_diag.f90 +++ /dev/null @@ -1,659 +0,0 @@ -!$$$ subprogram documentation block -! . . . . -! subprogram: read_raddiag read rad diag file -! prgmmr: tahara org: np20 date: 2003-01-01 -! -! abstract: This module contains code to process radiance -! diagnostic files. The module defines structures -! to contain information from the radiance -! diagnostic files and then provides two routines -! to access contents of the file. -! -! program history log: -! 2005-07-22 treadon - add this doc block -! 2010-10-05 treadon - refactor code to GSI standard -! 2010-10-08 zhu - use data_tmp to handle various npred values -! 2011-02-22 kleist - changes related to memory allocate/deallocate -! 2011-04-08 li - add tref, dtw, dtc to diag_data_fix_list, add tb_tz to diag_data_chan_list -! - correspondingly, change ireal_radiag (26 -> 30) and ipchan_radiag (7 -> 8) -! 2011-07-24 safford - make structure size for reading data_fix data version dependent -! 2013-11-21 todling - revisit how versions are set (add set/get_radiag) -! 2014-01-27 todling - add ob sensitivity index -! -! contains -! read_radiag_header - read radiance diagnostic file header -! read_radiag_data - read radiance diagnostic file data -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ - -module read_diag - - use kinds, only: i_kind,r_single - implicit none - -! Declare public and private - private - - public :: diag_header_fix_list - public :: diag_header_chan_list - public :: diag_data_name_list - public :: diag_data_fix_list - public :: diag_data_chan_list - public :: diag_data_extra_list - public :: read_radiag_header - public :: read_radiag_data -! public :: iversion_radiag -! public :: iversion_radiag_1 -! public :: iversion_radiag_2 -! public :: iversion_radiag_3 -! public :: iversion_radiag_4 - public :: ireal_radiag - public :: ipchan_radiag - public :: set_radiag - public :: get_radiag - - interface set_radiag - module procedure set_radiag_int_ ! internal procedure for integers - end interface - interface get_radiag - module procedure get_radiag_int_ ! internal procedure for integers - end interface - - integer(i_kind),parameter :: ireal_radiag = 30 ! number of real entries per spot in radiance diagnostic file - integer(i_kind),parameter :: ireal_old_radiag = 26 ! number of real entries per spot in versions older than iversion_radiag_2 - integer(i_kind),parameter :: ipchan_radiag = 8 ! number of entries per channel per spot in radiance diagnostic file - -! Declare structures for radiance diagnostic file information - type diag_header_fix_list - character(len=20) :: isis ! sat and sensor type - character(len=10) :: id ! sat type - character(len=10) :: obstype ! observation type - integer(i_kind) :: jiter ! outer loop counter - integer(i_kind) :: nchan ! number of channels in the sensor - integer(i_kind) :: npred ! number of updating bias correction predictors - integer(i_kind) :: idate ! time (yyyymmddhh) - integer(i_kind) :: ireal ! # of real elements in the fix part of a data record - integer(i_kind) :: ipchan ! # of elements for each channel except for bias correction terms - integer(i_kind) :: iextra ! # of extra elements for each channel - integer(i_kind) :: jextra ! # of extra elements - integer(i_kind) :: idiag ! first dimension of diag_data_chan - integer(i_kind) :: angord ! order of polynomial for adp_anglebc option - integer(i_kind) :: iversion ! radiance diagnostic file version number - integer(i_kind) :: inewpc ! indicator of newpc4pred (1 on, 0 off) - integer(i_kind) :: isens ! sensitivity index - end type diag_header_fix_list - - type diag_data_name_list - character(len=10),dimension(ireal_radiag) :: fix - character(len=10),dimension(:),allocatable :: chn - end type diag_data_name_list - - type diag_header_chan_list - real(r_single) :: freq ! frequency (Hz) - real(r_single) :: polar ! polarization - real(r_single) :: wave ! wave number (cm^-1) - real(r_single) :: varch ! error variance (or SD error?) - real(r_single) :: tlapmean ! mean lapse rate - integer(i_kind):: iuse ! use flag - integer(i_kind):: nuchan ! sensor relative channel number - integer(i_kind):: iochan ! satinfo relative channel number - end type diag_header_chan_list - - type diag_data_fix_list - real(r_single) :: lat ! latitude (deg) - real(r_single) :: lon ! longitude (deg) - real(r_single) :: zsges ! guess elevation at obs location (m) - real(r_single) :: obstime ! observation time relative to analysis - real(r_single) :: senscn_pos ! sensor scan position (integer(i_kind)) - real(r_single) :: satzen_ang ! satellite zenith angle (deg) - real(r_single) :: satazm_ang ! satellite azimuth angle (deg) - real(r_single) :: solzen_ang ! solar zenith angle (deg) - real(r_single) :: solazm_ang ! solar azimumth angle (deg) - real(r_single) :: sungln_ang ! sun glint angle (deg) - real(r_single) :: water_frac ! fractional coverage by water - real(r_single) :: land_frac ! fractional coverage by land - real(r_single) :: ice_frac ! fractional coverage by ice - real(r_single) :: snow_frac ! fractional coverage by snow - real(r_single) :: water_temp ! surface temperature over water (K) - real(r_single) :: land_temp ! surface temperature over land (K) - real(r_single) :: ice_temp ! surface temperature over ice (K) - real(r_single) :: snow_temp ! surface temperature over snow (K) - real(r_single) :: soil_temp ! soil temperature (K) - real(r_single) :: soil_mois ! soil moisture - real(r_single) :: land_type ! land type (integer(i_kind)) - real(r_single) :: veg_frac ! vegetation fraction - real(r_single) :: snow_depth ! snow depth - real(r_single) :: sfc_wndspd ! surface wind speed - real(r_single) :: qcdiag1 ! ir=cloud fraction, mw=cloud liquid water - real(r_single) :: qcdiag2 ! ir=cloud top pressure, mw=total column water - real(r_single) :: tref ! reference temperature (Tr) in NSST - real(r_single) :: dtw ! dt_warm at zob - real(r_single) :: dtc ! dt_cool at zob - real(r_single) :: tz_tr ! d(Tz)/d(Tr) - end type diag_data_fix_list - - type diag_data_chan_list - real(r_single) :: tbobs ! Tb (obs) (K) - real(r_single) :: omgbc ! Tb_(obs) - Tb_(simulated w/ bc) (K) - real(r_single) :: omgnbc ! Tb_(obs) - Tb_(simulated_w/o bc) (K) - real(r_single) :: errinv ! inverse error (K**(-1)) - real(r_single) :: qcmark ! quality control mark - real(r_single) :: emiss ! surface emissivity - real(r_single) :: tlap ! temperature lapse rate - real(r_single) :: tb_tz ! d(Tb)/d(Tz) - real(r_single) :: bicons ! constant bias correction term - real(r_single) :: biang ! scan angle bias correction term - real(r_single) :: biclw ! CLW bias correction term - real(r_single) :: bilap2 ! square lapse rate bias correction term - real(r_single) :: bilap ! lapse rate bias correction term - real(r_single) :: bicos ! node*cos(lat) bias correction term - real(r_single) :: bisin ! sin(lat) bias correction term - real(r_single) :: biemis ! emissivity sensitivity bias correction term - real(r_single),dimension(:),allocatable :: bifix ! angle dependent bias - real(r_single) :: bisst ! SST bias correction term - end type diag_data_chan_list - - type diag_data_extra_list - real(r_single) :: extra ! extra information - end type diag_data_extra_list - - integer(i_kind),save :: iversion_radiag ! Current version (see set routine) - integer(i_kind),parameter:: iversion_radiag_1 = 11104 ! Version when bias-correction entries were modified - integer(i_kind),parameter:: iversion_radiag_2 = 13784 ! Version when NSST entries were added - integer(i_kind),parameter:: iversion_radiag_3 = 19180 ! Version when SSMIS added - integer(i_kind),parameter:: iversion_radiag_4 = 30303 ! Version when emissivity predictor added - - real(r_single),parameter:: rmiss_radiag = -9.9e11_r_single - -contains - -subroutine set_radiag_int_ (what,iv,ier) -character(len=*),intent(in) :: what -integer(i_kind),intent(in) :: iv -integer(i_kind),intent(out):: ier -ier=-1 -if(trim(what)=='version') then - iversion_radiag = iv - ier=0 -endif -end subroutine set_radiag_int_ - -subroutine get_radiag_int_ (what,iv,ier) -character(len=*),intent(in) :: what -integer(i_kind),intent(out):: iv -integer(i_kind),intent(out):: ier -ier=-1 -if(trim(what)=='version') then - iv = iversion_radiag - ier=0 -endif -end subroutine get_radiag_int_ - -subroutine read_radiag_header(ftin,npred_radiag,retrieval,header_fix,header_chan,data_name,iflag,lverbose) -! . . . . -! subprogram: read_diag_header read rad diag header -! prgmmr: tahara org: np20 date: 2003-01-01 -! -! abstract: This routine reads the header record from a radiance -! diagnostic file -! -! program history log: -! 2010-10-05 treadon - add this doc block -! 2011-02-22 kleist - changes related to memory allocation and standard output -! -! input argument list: -! ftin - unit number connected to diagnostic file -! npred_radiag - number of bias correction terms -! retrieval - .true. if sst retrieval -! -! output argument list: -! header_fix - header information structure -! header_chan - channel information structure -! data_name - diag file data names -! iflag - error code -! lverbose - optional flag to turn off default output to standard out -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ - -! Declare passed arguments - integer(i_kind),intent(in) :: ftin - integer(i_kind),intent(in) :: npred_radiag - logical,intent(in) :: retrieval - type(diag_header_fix_list ),intent(out):: header_fix - type(diag_header_chan_list),allocatable :: header_chan(:) - type(diag_data_name_list) :: data_name - integer(i_kind),intent(out) :: iflag - logical,optional,intent(in) :: lverbose - -! Declare local variables - character(len=2):: string - character(len=10):: satid,sentype - character(len=20):: sensat - integer(i_kind) :: i,ich - integer(i_kind):: jiter,nchanl,npred,ianldate,ireal,ipchan,iextra,jextra - integer(i_kind):: idiag,angord,iversion,inewpc,isens - integer(i_kind):: iuse_tmp,nuchan_tmp,iochan_tmp - real(r_single) :: freq_tmp,polar_tmp,wave_tmp,varch_tmp,tlapmean_tmp - logical loutall - - loutall=.true. - if(present(lverbose)) loutall=lverbose - -! Read header (fixed_part). - read(ftin,IOSTAT=iflag) sensat,satid,sentype,jiter,nchanl,npred,ianldate,& - ireal,ipchan,iextra,jextra,idiag,angord,iversion,inewpc,isens - if (iflag/=0) then - rewind(ftin) - read(ftin,IOSTAT=iflag) sensat,satid,sentype,jiter,nchanl,npred,ianldate,& - ireal,ipchan,iextra,jextra,idiag,angord,iversion,inewpc - isens=0 - end if - - if (iflag/=0) then - rewind(ftin) - read(ftin,IOSTAT=iflag) sensat,satid,sentype,jiter,nchanl,npred,ianldate,& - ireal,ipchan,iextra,jextra - idiag=ipchan+npred+1 - angord=0 - iversion=0 - inewpc=0 - isens=0 - if (iflag/=0) then - write(6,*)'READ_RADIAG_HEADER: ***ERROR*** Unknown file format. Cannot read' - return - endif - endif - - header_fix%isis = sensat - header_fix%id = satid - header_fix%obstype = sentype - header_fix%jiter = jiter - header_fix%nchan = nchanl - header_fix%npred = npred - header_fix%idate = ianldate - header_fix%ireal = ireal - header_fix%ipchan = ipchan - header_fix%iextra = iextra - header_fix%jextra = jextra - header_fix%idiag = idiag - header_fix%angord = angord - header_fix%iversion= iversion - header_fix%inewpc = inewpc - header_fix%isens = isens - - if (loutall) then - write(6,*)'READ_RADIAG_HEADER: isis=',header_fix%isis,& - ' nchan=',header_fix%nchan,& - ' npred=',header_fix%npred,& - ' angord=',header_fix%angord,& - ' idiag=',header_fix%idiag,& - ' iversion=',header_fix%iversion,& - ' inewpc=',header_fix%inewpc,& - ' isens=',header_fix%isens - - if ( header_fix%iextra /= 0) & - write(6,*)'READ_RADIAG_HEADER: extra diagnostic information available, ',& - 'iextra=',header_fix%iextra - end if - - if (header_fix%npred /= npred_radiag) & - write(6,*) 'READ_RADIAG_HEADER: **WARNING** header_fix%npred,npred=',& - header_fix%npred,npred_radiag - -! Allocate and initialize as needed - if (allocated(header_chan)) deallocate(header_chan) - if (allocated(data_name%chn)) deallocate(data_name%chn) - - allocate(header_chan( header_fix%nchan)) - allocate(data_name%chn(header_fix%idiag)) - - data_name%fix(1) ='lat ' - data_name%fix(2) ='lon ' - data_name%fix(3) ='zsges ' - data_name%fix(4) ='obstim ' - data_name%fix(5) ='scanpos ' - data_name%fix(6) ='satzen ' - data_name%fix(7) ='satazm ' - data_name%fix(8) ='solzen ' - data_name%fix(9) ='solazm ' - data_name%fix(10)='sungln ' - data_name%fix(11)='fwater ' - data_name%fix(12)='fland ' - data_name%fix(13)='fice ' - data_name%fix(14)='fsnow ' - data_name%fix(15)='twater ' - data_name%fix(16)='tland ' - data_name%fix(17)='tice ' - data_name%fix(18)='tsnow ' - data_name%fix(19)='tsoil ' - data_name%fix(20)='soilmoi ' - data_name%fix(21)='landtyp ' - data_name%fix(22)='vegfrac ' - data_name%fix(23)='snowdep ' - data_name%fix(24)='wndspd ' - data_name%fix(25)='qc1 ' - data_name%fix(26)='qc2 ' - data_name%fix(27)='tref ' - data_name%fix(28)='dtw ' - data_name%fix(29)='dtc ' - data_name%fix(30)='tz_tr ' - - data_name%chn(1)='obs ' - data_name%chn(2)='omgbc ' - data_name%chn(3)='omgnbc ' - data_name%chn(4)='errinv ' - data_name%chn(5)='qcmark ' - data_name%chn(6)='emiss ' - data_name%chn(7)='tlap ' - data_name%chn(8)='tb_tz ' - - if (header_fix%iversion < iversion_radiag_1) then - data_name%chn( 8)= 'bifix ' - data_name%chn( 9)= 'bilap ' - data_name%chn(10)= 'bilap2 ' - data_name%chn(11)= 'bicons ' - data_name%chn(12)= 'biang ' - data_name%chn(13)= 'biclw ' - if (retrieval) data_name%chn(13)= 'bisst ' - elseif ( header_fix%iversion < iversion_radiag_2 .and. header_fix%iversion >= iversion_radiag_1 ) then - data_name%chn( 8)= 'bicons ' - data_name%chn( 9)= 'biang ' - data_name%chn(10)= 'biclw ' - data_name%chn(11)= 'bilap2 ' - data_name%chn(12)= 'bilap ' - do i=1,header_fix%angord - write(string,'(i2.2)') header_fix%angord-i+1 - data_name%chn(12+i)= 'bifix' // string - end do - data_name%chn(12+header_fix%angord+1)= 'bifix ' - data_name%chn(12+header_fix%angord+2)= 'bisst ' - elseif ( header_fix%iversion < iversion_radiag_3 .and. header_fix%iversion >= iversion_radiag_2 ) then - data_name%chn( 9)= 'bicons ' - data_name%chn(10)= 'biang ' - data_name%chn(11)= 'biclw ' - data_name%chn(12)= 'bilap2 ' - data_name%chn(13)= 'bilap ' - do i=1,header_fix%angord - write(string,'(i2.2)') header_fix%angord-i+1 - data_name%chn(13+i)= 'bifix' // string - end do - data_name%chn(13+header_fix%angord+1)= 'bifix ' - data_name%chn(13+header_fix%angord+2)= 'bisst ' - elseif ( header_fix%iversion < iversion_radiag_4 .and. header_fix%iversion >= iversion_radiag_3 ) then - data_name%chn( 9)= 'bicons ' - data_name%chn(10)= 'biang ' - data_name%chn(11)= 'biclw ' - data_name%chn(12)= 'bilap2 ' - data_name%chn(13)= 'bilap ' - data_name%chn(14)= 'bicos ' - data_name%chn(15)= 'bisin ' - do i=1,header_fix%angord - write(string,'(i2.2)') header_fix%angord-i+1 - data_name%chn(15+i)= 'bifix' // string - end do - data_name%chn(15+header_fix%angord+1)= 'bifix ' - data_name%chn(15+header_fix%angord+2)= 'bisst ' - else - data_name%chn( 9)= 'bicons ' - data_name%chn(10)= 'biang ' - data_name%chn(11)= 'biclw ' - data_name%chn(12)= 'bilap2 ' - data_name%chn(13)= 'bilap ' - data_name%chn(14)= 'bicos ' - data_name%chn(15)= 'bisin ' - data_name%chn(16)= 'biemis ' - do i=1,header_fix%angord - write(string,'(i2.2)') header_fix%angord-i+1 - data_name%chn(16+i)= 'bifix' // string - end do - data_name%chn(16+header_fix%angord+1)= 'bifix ' - data_name%chn(16+header_fix%angord+2)= 'bisst ' - endif - -! Read header (channel part) - do ich=1, header_fix%nchan - read(ftin,IOSTAT=iflag) freq_tmp,polar_tmp,wave_tmp,varch_tmp,tlapmean_tmp,iuse_tmp,nuchan_tmp,iochan_tmp - header_chan(ich)%freq = freq_tmp - header_chan(ich)%polar = polar_tmp - header_chan(ich)%wave = wave_tmp - header_chan(ich)%varch = varch_tmp - header_chan(ich)%tlapmean = tlapmean_tmp - header_chan(ich)%iuse = iuse_tmp - header_chan(ich)%nuchan = nuchan_tmp - header_chan(ich)%iochan = iochan_tmp - if (iflag/=0) return - end do - -! Construct array containing menonics for data record entries - - -end subroutine read_radiag_header - -subroutine read_radiag_data(ftin,header_fix,retrieval,data_fix,data_chan,data_extra,iflag ) -! . . . . -! subprogram: read_radiag_dat read rad diag data -! prgmmr: tahara org: np20 date: 2003-01-01 -! -! abstract: This routine reads the data record from a radiance -! diagnostic file -! -! program history log: -! 2010-10-05 treadon - add this doc block -! 2011-02-22 kleist - changes related to memory allocation -! -! input argument list: -! ftin - unit number connected to diagnostic file -! header_fix - header information structure -! -! output argument list: -! data_fix - spot header information structure -! data_chan - spot channel information structure -! data_extra - spot extra information -! iflag - error code -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ - - -! Declare passed arguments - integer(i_kind),intent(in) :: ftin - type(diag_header_fix_list ),intent(in) :: header_fix - logical,intent(in) :: retrieval - type(diag_data_fix_list) ,intent(out):: data_fix - type(diag_data_chan_list) ,allocatable :: data_chan(:) - type(diag_data_extra_list) ,allocatable :: data_extra(:,:) - integer(i_kind),intent(out) :: iflag - - integer(i_kind) :: ich,iang,i,j - real(r_single),dimension(:,:),allocatable :: data_tmp - real(r_single),dimension(:),allocatable :: fix_tmp - real(r_single),dimension(:,:),allocatable :: extra_tmp - -! Allocate arrays as needed - if (allocated(data_chan)) deallocate(data_chan) - allocate(data_chan(header_fix%nchan)) - - do ich=1,header_fix%nchan - if (allocated(data_chan(ich)%bifix)) deallocate(data_chan(ich)%bifix) - allocate(data_chan(ich)%bifix(header_fix%angord+1)) - end do - - if (header_fix%iextra > 0) then - if (allocated(data_extra)) deallocate(data_extra) - allocate(data_extra(header_fix%iextra,header_fix%jextra)) - allocate(extra_tmp(header_fix%iextra,header_fix%jextra)) - end if - -! Allocate arrays to hold data record - allocate(data_tmp(header_fix%idiag,header_fix%nchan)) - - if (header_fix%iversion < iversion_radiag_2) then - allocate( fix_tmp( ireal_old_radiag ) ) - else - allocate( fix_tmp( ireal_radiag ) ) - end if - -! Read data record - - if (header_fix%iextra == 0) then - read(ftin,IOSTAT=iflag) fix_tmp, data_tmp - else - read(ftin,IOSTAT=iflag) fix_tmp, data_tmp, extra_tmp - endif - - -! Transfer fix_tmp record to output structure - data_fix%lat = fix_tmp(1) - data_fix%lon = fix_tmp(2) - data_fix%zsges = fix_tmp(3) - data_fix%obstime = fix_tmp(4) - data_fix%senscn_pos = fix_tmp(5) - data_fix%satzen_ang = fix_tmp(6) - data_fix%satazm_ang = fix_tmp(7) - data_fix%solzen_ang = fix_tmp(8) - data_fix%solazm_ang = fix_tmp(9) - data_fix%sungln_ang = fix_tmp(10) - data_fix%water_frac = fix_tmp(11) - data_fix%land_frac = fix_tmp(12) - data_fix%ice_frac = fix_tmp(13) - data_fix%snow_frac = fix_tmp(14) - data_fix%water_temp = fix_tmp(15) - data_fix%land_temp = fix_tmp(16) - data_fix%ice_temp = fix_tmp(17) - data_fix%snow_temp = fix_tmp(18) - data_fix%soil_temp = fix_tmp(19) - data_fix%soil_mois = fix_tmp(20) - data_fix%land_type = fix_tmp(21) - data_fix%veg_frac = fix_tmp(22) - data_fix%snow_depth = fix_tmp(23) - data_fix%sfc_wndspd = fix_tmp(24) - data_fix%qcdiag1 = fix_tmp(25) - data_fix%qcdiag2 = fix_tmp(26) - - if ( header_fix%iversion <= iversion_radiag_1 ) then - data_fix%tref = rmiss_radiag - data_fix%dtw = rmiss_radiag - data_fix%dtc = rmiss_radiag - data_fix%tz_tr = rmiss_radiag - else - data_fix%tref = fix_tmp(27) - data_fix%dtw = fix_tmp(28) - data_fix%dtc = fix_tmp(29) - data_fix%tz_tr = fix_tmp(30) - end if - - -! Transfer data record to output structure - do ich=1,header_fix%nchan - data_chan(ich)%tbobs =data_tmp(1,ich) - data_chan(ich)%omgbc =data_tmp(2,ich) - data_chan(ich)%omgnbc=data_tmp(3,ich) - data_chan(ich)%errinv=data_tmp(4,ich) - data_chan(ich)%qcmark=data_tmp(5,ich) - data_chan(ich)%emiss =data_tmp(6,ich) - data_chan(ich)%tlap =data_tmp(7,ich) - data_chan(ich)%tb_tz =data_tmp(8,ich) - end do - if (header_fix%iversion < iversion_radiag_1) then - do ich=1,header_fix%nchan - data_chan(ich)%bifix(1)=data_tmp(8,ich) - data_chan(ich)%bilap =data_tmp(9,ich) - data_chan(ich)%bilap2 =data_tmp(10,ich) - data_chan(ich)%bicons =data_tmp(11,ich) - data_chan(ich)%biang =data_tmp(12,ich) - data_chan(ich)%biclw =data_tmp(13,ich) - data_chan(ich)%bisst = rmiss_radiag - if (retrieval) then - data_chan(ich)%biclw =rmiss_radiag - data_chan(ich)%bisst =data_tmp(13,ich) - endif - end do - elseif ( header_fix%iversion < iversion_radiag_2 .and. header_fix%iversion >= iversion_radiag_1 ) then - do ich=1,header_fix%nchan - data_chan(ich)%bicons=data_tmp(8,ich) - data_chan(ich)%biang =data_tmp(9,ich) - data_chan(ich)%biclw =data_tmp(10,ich) - data_chan(ich)%bilap2=data_tmp(11,ich) - data_chan(ich)%bilap =data_tmp(12,ich) - end do - do ich=1,header_fix%nchan - do iang=1,header_fix%angord+1 - data_chan(ich)%bifix(iang)=data_tmp(12+iang,ich) - end do - data_chan(ich)%bisst = data_tmp(12+header_fix%angord+2,ich) - end do - elseif ( header_fix%iversion < iversion_radiag_3 .and. header_fix%iversion >= iversion_radiag_2 ) then - do ich=1,header_fix%nchan - data_chan(ich)%bicons=data_tmp(9,ich) - data_chan(ich)%biang =data_tmp(10,ich) - data_chan(ich)%biclw =data_tmp(11,ich) - data_chan(ich)%bilap2=data_tmp(12,ich) - data_chan(ich)%bilap =data_tmp(13,ich) - end do - do ich=1,header_fix%nchan - do iang=1,header_fix%angord+1 - data_chan(ich)%bifix(iang)=data_tmp(13+iang,ich) - end do - data_chan(ich)%bisst = data_tmp(13+header_fix%angord+2,ich) - end do - elseif ( header_fix%iversion < iversion_radiag_4 .and. header_fix%iversion >= iversion_radiag_3 ) then - do ich=1,header_fix%nchan - data_chan(ich)%bicons=data_tmp(9,ich) - data_chan(ich)%biang =data_tmp(10,ich) - data_chan(ich)%biclw =data_tmp(11,ich) - data_chan(ich)%bilap2=data_tmp(12,ich) - data_chan(ich)%bilap =data_tmp(13,ich) - data_chan(ich)%bicos =data_tmp(14,ich) ! 1st bias correction term node*cos(lat) for SSMIS - data_chan(ich)%bisin =data_tmp(15,ich) ! 2nd bias correction term sin(lat) for SSMI - end do - do ich=1,header_fix%nchan - do iang=1,header_fix%angord+1 - data_chan(ich)%bifix(iang)=data_tmp(15+iang,ich) - end do - data_chan(ich)%bisst = data_tmp(15+header_fix%angord+2,ich) - end do - else - do ich=1,header_fix%nchan - data_chan(ich)%bicons=data_tmp(9,ich) - data_chan(ich)%biang =data_tmp(10,ich) - data_chan(ich)%biclw =data_tmp(11,ich) - data_chan(ich)%bilap2=data_tmp(12,ich) - data_chan(ich)%bilap =data_tmp(13,ich) - data_chan(ich)%bicos =data_tmp(14,ich) - data_chan(ich)%bisin =data_tmp(15,ich) - data_chan(ich)%biemis=data_tmp(16,ich) - end do - do ich=1,header_fix%nchan - do iang=1,header_fix%angord+1 - data_chan(ich)%bifix(iang)=data_tmp(16+iang,ich) - end do - data_chan(ich)%bisst = data_tmp(16+header_fix%angord+2,ich) - end do - endif - - if (header_fix%iextra > 0) then - do j=1,header_fix%jextra - do i=1,header_fix%iextra - data_extra(i,j)%extra=extra_tmp(i,j) - end do - end do - endif - - deallocate(data_tmp, fix_tmp) - if (header_fix%iextra > 0) deallocate(extra_tmp) - -end subroutine read_radiag_data - -end module read_diag - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radtime.fd/readme b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radtime.fd/readme deleted file mode 100644 index b6fdcbaf0e..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radtime.fd/readme +++ /dev/null @@ -1,23 +0,0 @@ -Instructions for building radmon_time executable. - - 1) Load the build module appropriate for your Machine: - i.) - WCOSS: - "module use -a ../../modulefiles/wcoss" - THEIA: - "module use -a ../../modulefiles/theia" - ii.) - "module load RadMonBuild" - - 2) Optional: verify all prerequisites are met by typing: - "make check_prereqs" - - 3) Build the executable by typing: - "make" - - 4) Move the executable to the ../../exec directory by typing: - "make install" - - 5) Unload the build module: - "module unload RadMonBuild" - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radtime.fd/time.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radtime.fd/time.f90 deleted file mode 100755 index 79ebf4cc3c..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radtime.fd/time.f90 +++ /dev/null @@ -1,493 +0,0 @@ -program time -!************************************************************************ -! -! time.f90 -! -! log -! 05/2010 safford reduce validation to just region 1 (global) -! 07/2010 safford redefine regions to surface types -!************************************************************************ - - use read_diag - use bad_obs - use bad_penalty - use bad_chan - use valid - - implicit none - integer ntype,mregion,surf_nregion,max_surf_region - parameter (ntype=8,mregion=25, max_surf_region=5) - integer iglobal, iland, iwater, isnowice, imixed - parameter (iglobal=1, iland=2, iwater=3, isnowice=4, imixed=5) - - character(10),dimension(ntype):: ftype - character(8) stid - character(20) satname,stringd,satsis - character(10) dum,satype,dplat - character(40) string,diag_rad,data_file,dfile,ctl_file - character(40),dimension(max_surf_region):: region - character(40),dimension(mregion):: surf_region - character :: command - character(8) date,suffix,cycle - - integer luname,lungrd,lunctl,lndiag,nregion - integer iyy,imm,idd,ihh,idhh,incr,iread,iflag - integer n_chan,j,idsat,i,k,ii,nreg - integer,dimension(mregion):: jsub - integer,allocatable,dimension(:):: io_chan,nu_chan - integer :: ios = 0 - integer :: channel_obs - integer :: iret, ier, ver - integer npred_radiag - - real rread, pen, bound - real rlat, rlon, rmiss, obs - real,dimension(2):: cor_tot,nbc_omg,bc_omg - real,dimension(max_surf_region):: rlatmin,rlatmax,rlonmin,rlonmax - - real,allocatable,dimension(:):: wavenumbr,channel_count - real,allocatable,dimension(:,:):: count,error,use,frequency,penalty,test_pen - real,allocatable,dimension(:,:,:):: tot_cor,omg_nbc,omg_bc - -! Variables for reading satellite data - type(diag_header_fix_list ) :: header_fix - type(diag_header_chan_list),allocatable :: header_chan(:) - type(diag_data_name_list ) :: data_name - type(diag_data_fix_list ) :: data_fix - type(diag_data_chan_list ),allocatable :: data_chan(:) - type(diag_data_extra_list) ,allocatable :: data_extra(:,:) - - logical valid_count, valid_penalty - integer nsnow, nland, nwater, nice, nmixed, ntotal - integer nnsnow, nnland, nnwater, nnmixed, nntotal - -! Namelist with defaults - logical :: retrieval = .false. - integer :: nchanl = 19 - integer :: imkctl = 1 - integer :: imkdata = 1 - character(3) :: gesanl = 'ges' - integer :: little_endian = 1 - character(3) :: rad_area = 'glb' - namelist /input/ satname,iyy,imm,idd,ihh,idhh,incr,nchanl,& - suffix,imkctl,imkdata,retrieval,gesanl,little_endian,rad_area - - data luname,lungrd,lunctl,lndiag / 5, 51, 52, 21 / - data rmiss /-999./ - data stringd / '.%y4%m2%d2%h2' / - data ftype / 'count','penalty','omgnbc','total','omgbc','omgnbc2','total2','omgbc2'/ - data region / 'global', 'land', 'water', 'ice/snow', 'mixed'/ - data rlonmin / -180., -180., -180., -180., -180./ - data rlonmax / 180., 180., 180., 180., 180./ - data rlatmin / -90., -90., -90., -90., -90./ - data rlatmax / 90., 90., 90., 90., 90./ - - -!************************************************************************ -! -! Initialize variables - iread=0 - npred_radiag = 12 - -! Read namelist input - read(luname,input) - write(6,input) - write(6,*)' ' - write(6,*)'gesanl = ', gesanl - write(6,*)'imkdata = ', imkdata - - if ( trim(gesanl) == 'anl' ) then - ftype(3) = 'omanbc' - ftype(5) = 'omabc' - ftype(6) = 'omanbc2' - ftype(8) = 'omabc2' - endif - - surf_nregion = 5 - if ( trim(rad_area) == 'rgn' ) then - surf_nregion = 1 - endif - - nregion=surf_nregion - write(6,*)'surf_nregion = ', surf_nregion - - - nregion=surf_nregion - -! Ensure number of requested regions does not exceed specified upper limit - if (nregion>mregion) then - write(6,*)'***ERROR*** too many regions specified' - write(6,*)' maximum allowed: mregion=',mregion - write(6,*)' user requested: nregion=',nregion - call errexit(91) - endif - - -! Create filenames for diagnostic input, binary output file - write(stringd,100) iyy,imm,idd,ihh -100 format('.',i4.4,3i2.2) - - if ( trim(gesanl) == 'ges' ) then - diag_rad = trim(satname) - data_file= trim(satname) // trim(stringd) // '.ieee_d' - ctl_file = trim(satname) // '.ctl' - else - diag_rad = trim(satname) // '_anl' - data_file= trim(satname) // '_anl' // trim(stringd) // '.ieee_d' - ctl_file = trim(satname) // '_anl.ctl' - endif - - write(6,*)'diag_rad =',diag_rad - write(6,*)'data_file=',data_file - write(6,*)'ctl_file =',ctl_file - write(6,*)'suffix =',suffix - -! Open unit to diagnostic file. Read portion of -! header to see if file exists - open(lndiag,file=diag_rad,form='unformatted') - read(lndiag,err=900,end=900) dum - rewind lndiag - -! File exists. Read header - call get_radiag ('version',ver,ier) - write(6,*)'read_diag version = ', ver, ier - - write(6,*)'call read_diag_header' - call read_radiag_header( lndiag, npred_radiag, retrieval, header_fix,& - header_chan, data_name, iflag ) - if( iflag/=0 ) then - write(6,*)'***ERROR*** problem reading diag file header, iflag=',iflag - call errexit(91) - endif - -! Extract observation type, satellite id, and number of channels - satype = header_fix%obstype - satsis = header_fix%isis - dplat = header_fix%id - n_chan = header_fix%nchan - - string = trim(satype)//'_'//trim(dplat) - write(6,*)'string,satname=',string,' ',satname - if ( trim(string) /= trim(satname) ) then - write(6,*)'***ERROR*** inconsistent instrument types' - write(6,*)' satname,string =',satname,' ',string - call errexit(92) - endif - -! -! initialize data integrity check flags, open output file for email warning(s) -! - date = stringd(2:9) - cycle = stringd(10:11) - -! call open_bad_obs_file( date, cycle, ios ) - if ( trim(gesanl) == 'ges' ) then - call open_bad_penalty_file( date, cycle, ios ) - call open_bad_chan_file( date, cycle, ios ) - - call load_base( satname, ios ) - endif - - -! Allocate arrays to hold observational information - allocate (io_chan(n_chan), nu_chan(n_chan), wavenumbr(n_chan)) - allocate (tot_cor(n_chan,mregion,2), omg_nbc(n_chan,mregion,2), & - omg_bc(n_chan,mregion,2), count(n_chan,mregion), & - penalty(n_chan,mregion), test_pen(n_chan,mregion), & - error(n_chan,mregion), use(n_chan,mregion), & - frequency(n_chan,mregion), channel_count(n_chan)) - -! Zero accumulator arrays - do ii=1,2 - do k=1,mregion - do j=1,n_chan - if (ii==1) then - count(j,k) = 0.0 - penalty(j,k) = 0.0 - if( j==1) then - channel_count = 0.0 - endif - endif - tot_cor(j,k,ii) = 0.0 - omg_nbc(j,k,ii) = 0.0 - omg_bc(j,k,ii) = 0.0 - end do - end do - end do - - -! Extract satinfo relative index - do j=1,n_chan - nu_chan(j) = real( header_chan(j)%nuchan, 4 ) - io_chan(j) = real( header_chan(j)%iochan, 4 ) - wavenumbr(j) = real( header_chan(j)%wave, 4 ) - end do - do k=1,mregion - do j=1,n_chan - error(j,k) = real( header_chan(j)%varch, 4) - use(j,k) = real( header_chan(j)%iuse, 4 ) - frequency(j,k) = real( header_chan(j)%freq, 4) - end do - end do - - -! Create control file - if ( imkctl == 1 ) then - write(6,*)'call create_ctl_time' - - if ( trim(gesanl) == 'ges' ) then - dfile = trim(satname) - else - dfile = trim(satname) // '_anl' - endif - - call create_ctl_time(ntype,ftype,n_chan,iyy,imm,idd,ihh,idhh,& - incr,ctl_file,lunctl,rmiss,dfile,satype,dplat,nregion,& - region,rlonmin,rlonmax,rlatmin,rlatmax,nu_chan,use(1,1),& - error(1,1),frequency(1,1),wavenumbr,little_endian) - endif - - nwater = 0; nnwater=0 - nice = 0 - nsnow = 0; nnsnow=0 - nland = 0; nnland=0 - nmixed = 0; nnmixed=0 - ntotal = 0 - -! Loop to read entries in diagnostic file - if ( imkdata == 1 ) then - iflag = 0 - loopd: do while (iflag == 0) - -! Read a record. If read flag, iflag does not equal zero, exit loopd - call read_radiag_data( lndiag, header_fix, retrieval, data_fix, data_chan,& - data_extra, iflag ) - if( iflag /= 0 ) exit loopd - iread=iread+1 - -! Extract observation location. -! Convert (0-360) lon to (-180,180) - rlat = data_fix%lat - rlon = data_fix%lon - if (rlon>180.) rlon = rlon - 360. - rread = rread +1.0 - -! Detemine which subdomains the observation falls into. -! These are now based on surface type, not geography. All -! obs match global (surf_region 1). - - ii=0; jsub=0; - jsub(1)=iglobal - nreg=1 - - if ( nregion > 1 ) then - if ( data_fix%land_frac > 0.99 ) then - jsub(2)=iland - nreg=2 - nnland=nnland+1 - else if ( data_fix%water_frac > 0.99 ) then - jsub(2)=iwater - nreg=2 - nnwater=nnwater+1 - else if (( data_fix%snow_frac > 0.99 ) .OR. ( data_fix%ice_frac > 0.99 )) then - jsub(2)=isnowice - nreg=2 - nnsnow=nnsnow+1 - else - jsub(2)=imixed - nreg=2 - nnmixed=nnmixed+1 - write(6,*)'data_fix%land_frac,water,snow,ice = ',data_fix%land_frac, data_fix%water_frac, data_fix%snow_frac, data_fix%ice_frac - end if - end if - - -! Channel loop - do j = 1, n_chan - -! If observation was assimilated, accumulate sums in appropriate regions - if (data_chan(j)%errinv > 1.e-6) then -! pen = data_chan(j)%errinv*(data_chan(j)%omgbc)**2 - pen = (data_chan(j)%errinv*(data_chan(j)%omgbc))**2 - cor_tot(1) = (data_chan(j)%omgnbc - data_chan(j)%omgbc) - nbc_omg(1) = - data_chan(j)%omgnbc - bc_omg(1) = - data_chan(j)%omgbc - - cor_tot(2) = (data_chan(j)%omgnbc - data_chan(j)%omgbc)**2 - nbc_omg(2) = (data_chan(j)%omgnbc)**2 - bc_omg(2) = (data_chan(j)%omgbc)**2 - - do i=1,nreg - k=jsub(i) - - count(j,k) = count(j,k) + 1.0 - penalty(j,k) = penalty(j,k) + pen - channel_count(j) = channel_count(j) + 1.0 - - do ii=1,2 - tot_cor(j,k,ii) = tot_cor(j,k,ii) + cor_tot(ii) - omg_nbc(j,k,ii) = omg_nbc(j,k,ii) + nbc_omg(ii) - omg_bc(j,k,ii) = omg_bc(j,k,ii) + bc_omg(ii) - end do - - end do - - endif - - enddo ! channel loop - - -! End of loop over diagnostic file - enddo loopd - - - write(6,*)' ' - write(6,*)'read in ',iread,' obs ',rread - write(6,*)' ' - -! -! Compute average and standard deviation -! - do k=1,nregion - do j=1,n_chan - - ! --- validate the count value for region 1 (global) - ! -! if ( use(j,k) > 0.0 .AND. k == 1 .AND. imkdata == 1 ) then -! call validate_count( j, k, count(j,k), valid_count, iret ) -! write (*,*) ' valid_count, iret = ', valid_count, iret -! if ( (iret == 0) .AND. (valid_count .eqv. .FALSE.) ) then -! write (*,*) ' calling write_bad_obs ' -! call write_bad_obs( satname, nu_chan(j), k, count(j,k) ) -! end if -! end if - - if (count(j,k)>0) then - test_pen(j,k)=penalty(j,k)/count(j,k) - - !--- check for valid penalty value for region 1 (global) - ! - if ( use(j,k) > 0.0 .AND. k == 1 .AND. imkdata == 1 .AND. trim(gesanl) == 'ges' ) then - call validate_penalty( j, k, test_pen(j,k), valid_penalty, bound, iret ) - if( (iret == 0) .AND. (valid_penalty .eqv. .FALSE.) ) then - call write_bad_penalty( satname, nu_chan(j), k, test_pen(j,k), bound ) - endif - endif - - else - count(j,k)=rmiss - penalty(j,k)=rmiss - endif - - end do - end do - -! -! Check each assimilated channel to see if we -! have a 0 count (no obs) for that channel. If so, report -! it using write_bad_chan(). -! - -! -! This is for testing purposes only -! channel_count(1) = 0.0 -! write(6,*)' header_chan(j)%iuse, channel_count(1) = ', header_chan(1)%iuse, channel_count(1) -! - do j=1,n_chan -! write(6,*)' j, header_chan(j)%iuse, channel_count(j) = ', j, header_chan(j)%iuse, channel_count(j) -! if( header_chan(j)%iuse > 0.0 ) then -! write(6,*)' header_chan(j)%iuse > 0.0', header_chan(j)%iuse -! else -! write(6,*)' header_chan(j)%iuse <= 0.0', header_chan(j)%iuse -! endif - -! if( channel_count(j) < 1.0 ) then -! write(6,*)' channel_count(j) < 1.0', channel_count(j) -! else -! write(6,*)' channel_count(j) >= 1.0', channel_count(j) -! endif - - if( header_chan(j)%iuse > 0.0 .and. channel_count(j) < 1.0 .AND. trim(gesanl) == 'ges' ) then - write(6,*)' calling write_bad_chan, satname, j, nu_chan(j) = ', satname, j, nu_chan(j) - call write_bad_chan( satname, nu_chan(j) ) - end if ! if header_chan%iuse - - end do ! channel loop - - if ( trim(gesanl) == 'ges' ) then -! call close_bad_obs_file() - call close_bad_penalty_file() - call close_bad_chan_file() - endif - - -! Write output to binary output file - - write(6,*)' ' - open(lungrd,file=data_file,form='unformatted') - write(lungrd) ((count(j,k),j=1,n_chan),k=1,nregion) - write(lungrd) ((penalty(j,k),j=1,n_chan),k=1,nregion) - do ii=1,2 - write(lungrd) ((omg_nbc(j,k,ii),j=1,n_chan),k=1,nregion) - write(lungrd) ((tot_cor(j,k,ii),j=1,n_chan),k=1,nregion) - write(lungrd) ((omg_bc (j,k,ii),j=1,n_chan),k=1,nregion) - end do - write(6,*)'write output to lungrd=',lungrd,', file=',trim(data_file) - close(lungrd) - endif - -! Deallocate arrays - write(6,*)' ' - write(6,*)'deallocate arrays' - deallocate(io_chan,nu_chan,wavenumbr,tot_cor,omg_nbc,omg_bc,count,& - penalty,error,use,frequency) - goto 950 - -! Jump to here if eof or error reading diagnostic file. -900 continue - write(6,*)'***PROBLEM reading diagnostic file. diag_rad=',diag_rad - close(lndiag) - - n_chan=nchanl - if (n_chan<=0) then - write(6,*)'***ERROR*** invalid nchanl=',nchanl,' STOP program' - call errexit(93) - endif - - write(6,*)'load missing value ',rmiss,' into output arrays. ',& - nregion,n_chan - allocate(count(n_chan,nregion),penalty(n_chan,nregion),& - omg_nbc(n_chan,nregion,2),tot_cor(n_chan,nregion,2),& - omg_bc(n_chan,nregion,2)) - do ii=1,2 - do k=1,nregion - do j=1,n_chan - if (ii==1) then - count(j,k) = rmiss - penalty(j,k)= rmiss - endif - omg_nbc(j,k,ii) = rmiss - tot_cor(j,k,ii) = rmiss - omg_bc(j,k,ii) = rmiss - end do - end do - end do - - if ( imkdata == 1 ) then - open(lungrd,file=data_file,form='unformatted') - write(lungrd) ((count(j,k),j=1,n_chan),k=1,nregion) - write(lungrd) ((penalty(j,k),j=1,n_chan),k=1,nregion) - do ii=1,2 - write(lungrd) ((omg_nbc(j,k,ii),j=1,n_chan),k=1,nregion) - write(lungrd) ((tot_cor(j,k,ii),j=1,n_chan),k=1,nregion) - write(lungrd) ((omg_bc (j,k,ii),j=1,n_chan),k=1,nregion) - end do - write(6,*)'write output to lungrd=',lungrd,', file=',trim(data_file) - close(lungrd) - endif - deallocate(count,penalty,omg_nbc,tot_cor,omg_bc) - -! End of program -950 continue - stop -end program time diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radtime.fd/valid.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radtime.fd/valid.f90 deleted file mode 100755 index ffae19c452..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radtime.fd/valid.f90 +++ /dev/null @@ -1,288 +0,0 @@ -!$$$ subprogram documentation block -! . . . -! subprogram: valid validate the obs and penalty values -! prgmmr: safford date: 2009-12 -! -! abstract: This module contains code to read a given satellite's -! base file and then validate new obs(count) and penalty -! values by comparing them to the baseline values. -! -! program history log: -! 2009-12-07 safford - initial coding -! -! contains: -! -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ - -module valid - - implicit none - - private - -! --- module routines - public :: load_base - public :: validate_count - public :: validate_penalty - -! --- module parameters - integer, parameter :: funit = 17 - real,parameter :: rmiss = -999.0 - -! --- module vars - logical :: base_loaded = .FALSE. - integer :: nchan, nregion, j, k, dummy - - real,allocatable,dimension(:,:):: avg_count, sdv_count - real,allocatable,dimension(:,:):: min_count, max_count - real,allocatable,dimension(:,:):: avg_penalty, sdv_penalty - real,allocatable,dimension(:,:):: min_penalty, max_penalty - - integer,allocatable,dimension(:):: nu_chan - - contains - - !------------------------------------------------------------- - ! load the base file for the given satellite - !------------------------------------------------------------- - - subroutine load_base( satname, iret ) - - !--- interface - character(20), intent( in ) :: satname - integer, intent( out ) :: iret - - !--- variables - character(20) fname - character(20) test_satname - character(10) base_date - - integer fios - integer chan, region - - logical fexist - - - !--- initialization - iret = -1 - fname = trim(satname) // '.base' - fexist = .FALSE. - - write(*,*) '--> valid, satname, fname = ', satname, fname - - !--- verify file exists and open the file - inquire( file = fname, exist = fexist ) - if( fexist .eqv. .FALSE. ) then - fios = -1 - else - open( UNIT=funit, FILE=fname, IOSTAT=fios ) - write(*,*) ' fios = ', fios - end if - - if( fios == 0 ) then - !--- read the file header - read(funit,*) test_satname, base_date, nchan, nregion - write(*,*) ' test_satname, base_date, nchan, nregion = ', test_satname, base_date, nchan, nregion - - allocate( avg_count(nchan,nregion), sdv_count(nchan,nregion), & - avg_penalty(nchan,nregion), sdv_penalty(nchan,nregion), & - min_count(nchan,nregion), max_count(nchan,nregion), & - min_penalty(nchan,nregion), max_penalty(nchan,nregion) ) - - ! --- set all missing - do k=1,nregion - do j=1,nchan - avg_count(j,k) = rmiss - sdv_count(j,k) = rmiss - min_count(j,k) = rmiss - max_count(j,k) = rmiss - avg_penalty(j,k) = rmiss - sdv_penalty(j,k) = rmiss - min_penalty(j,k) = rmiss - max_penalty(j,k) = rmiss - end do - end do - - do k=1,nregion - do j=1,nchan - read(funit,*) chan, region, avg_count(j,k), sdv_count(j,k), min_count(j,k), max_count(j,k), & - avg_penalty(j,k), sdv_penalty(j,k), min_penalty(j,k), max_penalty(j,k) - end do - end do - -! write(*,*) 'chan 18, region 2, avg_count(18,1), sdv_count(18,1), avg_penalty(18,1), sdv_penalty(18,1) = ', & -! avg_count(18,1), sdv_count(18,1), avg_penalty(18,1), sdv_penalty(18,1) - - iret = 0 - base_loaded = .TRUE. - else - write(*,*) 'unable to load fname for data error checking' - end if - - end subroutine load_base - - - !--------------------------------------------------------------- - ! validate a count - ! given a count value for a channel and region, determine - ! if the count is within +/- 2*sdv - ! - ! iret 0 = normal - ! -1 = invalid channel - ! -2 = invalid region - ! 1 = base file wasn't loaded, unable to validate - !--------------------------------------------------------------- - subroutine validate_count( channel, region, count, valid, iret ) - - !--- interface - integer, intent( in ) :: channel - integer, intent( in ) :: region - real, intent( in ) :: count - logical, intent( out ) :: valid - integer, intent( out ) :: iret - - !--- vars - real cnt, hi, lo, sdv2 - - write(*,*) '--> validate_count, channel, region, count ', channel, region, count - !--- initialize vars - iret = 0 - cnt = count - valid = .FALSE. - - if( base_loaded .eqv. .TRUE. ) then - if( channel < 1 .OR. channel > nchan ) then - iret = -1 - write(*,*) 'attempt to validate channel out of range', channel - else if( region < 1 .OR. region > nregion ) then - iret = -2 - write(*,*) 'attempt to validate region out of range', region - else - ! - ! all unassimilated channels in the base files will have an rmiss - ! value and are considered valid for verification purposes - ! - if( avg_count(channel,region) < 0.0 ) then - valid = .TRUE. - else - sdv2 = 2 * sdv_count( channel, region ) - hi = avg_count(channel,region) + sdv2 - lo = avg_count(channel,region) - sdv2 - - ! - ! Consider any count valid if: - ! cnt is 2 sdvs from avg or - ! cnt is within the established min/max range for chan,region - ! - if( cnt > 0.0 ) then - valid = .TRUE. - end if - !if( cnt <= hi .AND. cnt >= lo ) then - ! valid = .TRUE. - !else if( (cnt > 0) .AND. (cnt >= min_count( channel,region )) .AND. & - ! (cnt <= max_count( channel,region )) ) then - ! valid = .TRUE. - !end if - end if - - end if - - if ( valid .eqv. .FALSE. ) then - write(*,*) ' avg_count(channel,region), sdv2, hi, lo = ', avg_count(channel,region), sdv2, hi, lo - end if - write (*,*) '<-- valid, iret=', valid, iret - else - !--- base file was not loaded, so return a warning that validation isn't possible - iret = 1 - end if - end subroutine validate_count - - - !------------------------------------------------------------- - ! validate a penalty value - ! given a penalty value for a channel and region, determine - ! if the penalty is within +/- 2*sdv - ! - ! iret 0 = normal - ! -1 = invalid channel - ! -2 = invalid region - !------------------------------------------------------------- - subroutine validate_penalty( channel, region, penalty, valid, bound, iret ) - - !--- interface - integer, intent( in ) :: channel - integer, intent( in ) :: region - real, intent( in ) :: penalty - logical, intent( out ) :: valid - real, intent( out ) :: bound - integer, intent( out ) :: iret - - !--- vars - real hi, lo, sdv2 - - write(*,*) '--> validate_penalty, channel, region, penalty ', channel, region, penalty - - !--- initialize vars - iret = 0 - valid = .FALSE. - bound = rmiss - - if( base_loaded .eqv. .TRUE. ) then - if( channel < 1 .OR. channel > nchan ) then - iret = -1 - write(*,*) 'attempt to validate channel out of range', channel - else if( region < 1 .OR. region > nregion ) then - iret = -2 - write(*,*) 'attempt to validate region out of range', region - else - ! - ! all unassimilated channels in the base files will have an rmiss - ! value and are considered valid for verification purposes - ! - bound = max_penalty( channel,region ) - - if( avg_penalty(channel,region) < 0.0 ) then - valid = .TRUE. - else - sdv2 = 2 * sdv_penalty( channel, region ) - hi = avg_penalty(channel,region) + sdv2 - lo = avg_penalty(channel,region) - sdv2 - - ! - ! Consider any penalty value valid if: - ! penalty is 2 sdvs from avg or - ! penalty is greater than the established max range for - ! chan,region by 20% or more --> idea here is to stage - ! two levels of warning, say a 20% exceedence and then - ! maybe a 25% or 30% exceedence for a yellow and red - ! level warning. - ! - if( (penalty >= 0.0) .AND. penalty <= hi ) then - valid = .TRUE. - else if( (penalty > 0.0) .AND. & - (penalty <= (max_penalty( channel,region )*1.2) ) ) then - valid = .TRUE. - !else if( penalty > hi ) then - ! bound = max_penalty( channel,region ) - end if - - end if - end if - - if ( valid .eqv. .FALSE. ) then - write(*,*) ' BAD: penalty, avg_penalty(channel,region), sdv2, hi, lo, bound = ', penalty, avg_penalty(channel,region), sdv2, hi, lo, bound - end if - write (*,*) '<-- valid, iret=', valid, iret - else - !--- base file was not loaded, so return a warning that validation isn't possible - iret = 1 - end if - end subroutine validate_penalty - - -end module valid diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/ush/radmon_ck_stdout.sh b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/ush/radmon_ck_stdout.sh deleted file mode 100755 index a918c9204f..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/ush/radmon_ck_stdout.sh +++ /dev/null @@ -1,112 +0,0 @@ -#!/bin/ksh - -################################################################################ -#### UNIX Script Documentation Block -# . . -# Script name: radmon_ck_stdout.sh -# Script description: Scan stdout files for problems reading the diagnostic -# files. -# -# Author: Ed Safford Org: NP23 Date: 2012-02-02 -# -# Abstract: This script scans the stdout files produced by the radmon_time -# executable for problems reading the diagnostic files. -# -# This script is a child script of radmon_verf_time.sh. The parent -# script generates the stdout files which this script examines. -# -# -# Script history log: -# 2012-02-02 Safford initial script -# -# Usage: radmon_ck_stdout.sh outfile -# -# Input script positional parameters: -# outfile output file name -# required -# -# Imported Shell Variables: -# SATYPE list of satellite/instrument sources -# defaults to none -# VERBOSE Verbose flag (YES or NO) -# defaults to NO -# -# Exported Shell Variables: -# err Last return code -# -# Modules and files referenced: -# scripts : -# -# programs : -# -# fixed data : -# -# input data : $data_file -# -# output data: $outfile -# -# Remarks: -# -# Condition codes -# 0 - no problem encountered -# >0 - some problem encountered -# -# Control variable resolution priority -# 1 Command line argument. -# 2 Environment variable. -# 3 Inline default. -# -# Attributes: -# Language: POSIX shell -# Machine: IBM SP -#################################################################### -export scr=radmon_ck_stdout.sh -msg="${scr} HAS STARTED" -postmsg "$jlogfile" "$msg" - - -# Command line arguments. -outfile=${1:-${outfile:?}} - -# Other variables -SATYPE=${SATYPE:-} -err=0 - -if [[ "$VERBOSE" = "YES" ]]; then - set -ax - echo "$(date) executing $0 $* >&2" -fi -################################################################################ -# Preprocessing - -outfile=$1 -error_msg="PROBLEM reading diagnostic file" - -for type in ${SATYPE}; do - if [[ "$VERBOSE" = "YES" ]]; then - echo ${type} - fi - if [[ -s "stdout.${type}" ]]; then - if [[ "$VERBOSE" = "YES" ]]; then - echo stdout.${type} - fi - match=`gawk "/$error_msg/" stdout.$type` - - match_len=`echo ${#match}` - if [[ $match_len > 0 ]]; then - echo "${type} ${match}" >> $outfile - fi - fi -done - -################################################################################ -# Post processing -if [[ "$VERBOSE" = "YES" ]]; then - echo $(date) EXITING $0 with error code ${err} >&2 -fi - -msg="${scr} HAS ENDED" -postmsg "$jlogfile" "$msg" - -set +x -exit ${err} diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/ush/radmon_err_rpt.sh b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/ush/radmon_err_rpt.sh deleted file mode 100755 index 074203aa2b..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/ush/radmon_err_rpt.sh +++ /dev/null @@ -1,238 +0,0 @@ -#!/bin/ksh - -################################################################################ -#### UNIX Script Documentation Block -# . . -# Script name: radmon_err_rpt.sh -# Script description: Compare the contents of error files from two different -# cycles. -# -# Author: Ed Safford Org: NP23 Date: 2012-02-02 -# -# Abstract: This script compares the contents of two error files from two different -# sets of radiance diagnostic files (which are an output from GSI runs). -# All unique satellite instrument/channel/region combinations that appear -# in both files are reported. -# -# This script is a child script of radmon_verf_time.sh. The parent -# script creates/copies the error files into a temporary working -# directory before invoking this script. -# -# -# Script history log: -# 2012-02-02 Safford initial script -# -# Usage: radmon_err_rpt.sh file1 file2 type cycle1 cycle2 diag_rpt outfile -# -# Input script positional parameters: -# file1 obs, penalty, or channel error file -# required -# file2 obs, penalty, or channel error file -# required -# type type of error file -# choises are obs, pen, or chan; required -# cycle1 first cycle processing date -# yyyymmddcc format; required -# cycle2 second cycle processing date -# yyyymmddcc format; required -# diag_rpt diagnostic report text file -# required -# outfile output file name -# required -# -# Imported Shell Variables: -# -# HOMEradmon package's nwprod subdirectory -# defaults to pwd -# VERBOSE Verbose flag (YES or NO) -# defaults to NO -# -# Exported Shell Variables: -# err Last return code -# -# Modules and files referenced: -# scripts : -# -# programs : radmon_getchgrp.pl -# -# -# fixed data : $ctlfile -# -# input data : $file1 -# $file2 -# -# output data: $outfile -# -# Remarks: -# -# Condition codes -# 0 - no problem encountered -# >0 - some problem encountered -#################################################################### -export scr=radmon_err_rpt.sh - -msg="${scr} HAS STARTED" -postmsg "$jlogfile" "$msg" - -# Command line arguments. -file1=${1:-${file1:?}} -file2=${2:-${file2:?}} -type=${3:-${type:?}} -cycle1=${4:-${cycle1:?}} -cycle2=${5:-${cycle2:?}} -diag_rpt=${6:-${diag_rpt:?}} -outfile=${7:-${outfile:?}} - -# Directories -HOMEradmon=${HOMEradmon:-$(pwd)} - -# Other variables -VERBOSE=${VERBOSE:-NO} -err=0 -RADMON_SUFFIX=${RADMON_SUFFIX} - -if [[ "$VERBOSE" = "YES" ]]; then - echo EXECUTING $0 $* >&2 - set -ax -fi - - -have_diag_rpt=0 -if [[ -s $diag_rpt ]]; then - have_diag_rpt=1 -else - err=1 -fi - - -#----------------------------------------------------------------------------- -# read each line in the $file1 -# search $file2 for the same satname, channel, and region -# if same combination is in both files, add the values to the output file -# -{ while read myline;do - bound="" - - echo $myline - satname=`echo $myline | gawk '{print $1}'` - echo satname = $satname - channel=`echo $myline | gawk '{print $3}'` - echo channel = $channel - region=`echo $myline | gawk '{print $5}'` - echo region = $region - value1=`echo $myline | gawk '{print $7}'` - echo value1 = $value1 - bound=`echo $myline | gawk '{print $9}'` - -# -# Check findings against diag_report. If the satellite/instrument is on the -# diagnostic report it means the diagnostic file file for the -# satelite/instrument is missing for this cycle, so skip any additional -# error checking for that source. Otherwise, evaluate as per normal. -# - - diag_match="" - diag_match_len=0 - - if [[ $have_diag_rpt == 1 ]]; then - diag_match=`gawk "/$satname/" $diag_rpt` - diag_match_len=`echo ${#diag_match}` - fi - - - if [[ $diag_match_len == 0 ]]; then - - if [[ $type == "chan" ]]; then - match=`gawk "/$satname/ && /channel= $channel/" $file2` - else - match=`gawk "/$satname/ && /channel= $channel / && /region= $region /" $file2` - echo match = $match - - match_len=`echo ${#match}` - if [[ $match_len > 0 ]]; then - channel2=`echo $match | gawk '{print $3}'` - echo channel2 = $channel2 - if [[ $channel2 != $channel ]]; then - match="" - fi - fi - echo match = $match - fi - match_len=`echo ${#match}` - - if [[ $match_len > 0 ]]; then - echo $match_len - value2=`echo $match | gawk '{print $7}'` - bound2=`echo $match | gawk '{print $9}'` - - if [[ $type == "chan" ]]; then - tmpa="$satname channel= $channel" - tmpb="" - - elif [[ $type == "pen" ]]; then - tmpa="$satname channel= $channel region= $region" - tmpb="$cycle1 $value1 $bound" - - else - tmpa="$satname channel= $channel region= $region" - tmpb="$cycle1: $type= $value1" - fi - - line1="$tmpa $tmpb" - echo "$line1" >> $outfile - - if [[ $type != "chan" ]]; then - tmpc=`echo $tmpa |sed 's/[a-z]/ /g' | sed 's/[0-9]/ /g' | sed 's/=/ /g' | sed 's/_/ /g' | sed 's/-/ /g'` - - if [[ $type == "pen" ]]; then - line2=" $tmpc $cycle2 $value2 $bound2" - else - line2=" $tmpc $cycle2: $type= $value2" - fi - - echo "$line2" >> $outfile - fi - - #---------------------------------------------------------- - # Access the control file to deterimine channel grouping - # number. Not all sources have consecutively numbered - # channels, and we need to map the channel to the correct - # grouping number in order to produce an accurate hyperlink. - # - # Update: with the new js plotting the actual channel number - # can be sent. This applies to all glb sources now; it's not - # yet implemented for regional sources. - if [[ $RAD_AREA == 'glb' ]]; then - changrp=${channel} - echo "for glb using actual channel as changrp value" - else - ctlfile="time.${satname}.ctl" - if [[ -s ${ctlfile}.Z || -s ${ctlfile}.gz ]]; then - uncompress ${ctlfile}.* - fi - changrp=`${HOMEradmon}/ush/radmon_getchgrp.pl ${ctlfile} ${channel}` - fi - echo changrp = $changrp - - line3=" http://www.emc.ncep.noaa.gov/gmb/gdas/radiance/esafford/${RADMON_SUFFIX}/index.html?sat=${satname}®ion=${region}&channel=${changrp}&stat=${type}" - if [[ $changrp -gt 0 ]]; then - echo "$line3" >> $outfile - echo "" >> $outfile - fi - fi - fi -done } < $file1 - - -################################################################################ -# Post processing -if [[ "$VERBOSE" = "YES" ]]; then - echo $(date) EXITING $0 with error code ${err} >&2 -fi - -msg="${scr} HAS ENDED" -postmsg "$jlogfile" "$msg" - -set +x -exit ${err} - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/ush/radmon_getchgrp.pl b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/ush/radmon_getchgrp.pl deleted file mode 100755 index 890beb15a7..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/ush/radmon_getchgrp.pl +++ /dev/null @@ -1,82 +0,0 @@ -#! /usr/bin/perl - -################################################################################ -#### Perl Script Documentation Block -# . . -# Script name: radmon_getchgrp.pl -# Script description: Find the channel grouping number for a given setllite and -# channel. -# -# Author: Ed Safford Org: NP23 Date: 2012-02-02 -# -# Abstract: This script determines the channel grouping number for a given -# satellite and channel number. Most, but not all satellite sources -# have consecutively numbered channels. This script locates the -# channel and determines in which block of images that channel would be -# located. -# -# -# Script history log: -# 2012-02-02 Safford initial script -# -# Usage: radmon_getchgrp.pl ctl_file channel -# -# Input script positional parameters: -# ctl_file meta-data file -# required -# channel satellite/instrument channel number -# required -# -# output data: $chan_grp -# -# -# Remarks: -# -# Condition codes -# 0 - no problem encountered -# >0 - some problem encountered -# -# Control variable resolution priority -# 1 Command line argument. -# -# Attributes: -# Language: Perl script -# Machine: IBM SP -#################################################################### - -$numArgs = $#ARGV + 1; - -if( $numArgs < 2 ) { - print" Usage: \n"; - print" radmon_gtchgrp.pl sat_control_file, channel \n"; - exit(1); -} -else { - $ctl_file = @ARGV[0]; - $channel = @ARGV[1]; -} - -#---------------------------------------------------------- -# Load the control file -#---------------------------------------------------------- -open( CTLFILE, $ctl_file ) or die "Can't open $ctl_file \n"; - -$chan_grp = 0; -$ctr = 0; - -while( $line = ) { - if ( $line =~ m/iuse/ ) { - $ctr+=1; - @fields = split ' ', $line; - if( $fields[4] == $channel ) { - $chan_grp = int( $ctr/4 ); - if( $ctr % 4 > 0 ) { - $chan_grp +=1; - break; - } - } - } -} - -print "$chan_grp\n"; -close CTLFILE; diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/ush/radmon_verf_angle.sh b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/ush/radmon_verf_angle.sh deleted file mode 100755 index 3e69230342..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/ush/radmon_verf_angle.sh +++ /dev/null @@ -1,238 +0,0 @@ -#!/bin/ksh - -################################################################################ -#### UNIX Script Documentation Block -# . . -# Script name: radmon_verf_angle.sh -# Script description: Extract angle dependent data from radiance -# diagnostic files. -# -# Author: Ed Safford Org: NP23 Date: 2012-02-02 -# -# Abstract: This script extracts angle dependent data from radiance -# diagnostic files (which are an output from GSI runs), -# storing the extracted data in small binary files. -# -# This script is a child script of exgdas_vrfyrad.sh.sms. The parent -# script opens and uncompresses the radiance diagnostic file and copies -# other supporting files into a temporary working directory. -# -# -# Usage: radmon_verf_angle.sh PDATE -# -# Input script positional parameters: -# PDATE processing date -# yyyymmddcc format; required -# -# Imported Shell Variables: -# RADMON_SUFFIX data source suffix -# defauls to opr -# MAKE_CTL switch to construct the meta-data control file -# defaults to 1 (on) -# MAKE_DATA switch to construct the binary data file -# defaults to 1 (on) -# EXECradmon executable directory -# defaults to current directory -# RAD_AREA global or regional flag -# defaults to global -# TANKverf_rad data repository -# defaults to current directory -# SATYPE list of satellite/instrument sources -# defaults to none -# VERBOSE Verbose flag (YES or NO) -# defaults to NO -# LITTLE_ENDIAN flag to indicate LE machine -# defaults to 0 (big endian) -# USE_ANL use analysis files as inputs in addition to -# the ges files. Default is 0 (ges only) -# -# Modules and files referenced: -# scripts : -# -# programs : $NCP -# $angle_exec -# -# fixed data : $scaninfo -# -# input data : $data_file -# -# output data: $angle_file -# $angle_ctl -# $pgmout -# -# Remarks: -# -# Condition codes -# 0 - no problem encountered -# >0 - some problem encountered -# -#################################################################### -# Command line arguments. - -RAD_AREA=${RAD_AREA:-glb} -REGIONAL_RR=${REGIONAL_RR:-0} # rapid refresh model flag -rgnHH=${rgnHH:-} -rgnTM=${rgnTM:-} - -export PDATE=${1:-${PDATE:?}} - -scr=radmon_verf_angle.sh -msg="${scr} HAS STARTED" -postmsg "$jlogfile" "$msg" -echo " REGIONAL_RR, rgnHH, rgnTM = $REGIONAL_RR, $rgnHH, $rgnTM" - -which prep_step -which startmsg - -if [[ "$VERBOSE" = "YES" ]]; then - set -ax -fi - -# Directories -FIXgdas=${FIXgdas:-$(pwd)} -EXECradmon=${EXECradmon:-$(pwd)} -TANKverf_rad=${TANKverf_rad:-$(pwd)} - -# File names -export pgmout=${pgmout:-${jlogfile}} -touch $pgmout - -# Other variables -MAKE_CTL=${MAKE_CTL:-1} -MAKE_DATA=${MAKE_DATA:-1} -SATYPE=${SATYPE:-} -VERBOSE=${VERBOSE:-NO} -LITTLE_ENDIAN=${LITTLE_ENDIAN:-0} -USE_ANL=${USE_ANL:-0} - -if [[ $USE_ANL -eq 1 ]]; then - gesanl="ges anl" -else - gesanl="ges" -fi - -err=0 -angle_exec=radmon_angle -scaninfo=scaninfo.txt - - -#-------------------------------------------------------------------- -# Copy extraction program and supporting files to working directory - -$NCP ${EXECradmon}/${angle_exec} ./ -$NCP $FIXgdas/gdas_radmon_scaninfo.txt ./${scaninfo} - -if [[ ! -s ./${angle_exec} || ! -s ./${scaninfo} ]]; then - err=2 -else -#-------------------------------------------------------------------- -# Run program for given time - - export pgm=${angle_exec} - - iyy=`echo $PDATE | cut -c1-4` - imm=`echo $PDATE | cut -c5-6` - idd=`echo $PDATE | cut -c7-8` - ihh=`echo $PDATE | cut -c9-10` - - ctr=0 - fail=0 - touch "./errfile" - - for type in ${SATYPE}; do - - for dtype in ${gesanl}; do - - echo "pgm = $pgm" - echo "pgmout = $pgmout" -# prep_step - /nwprod2/util/ush/prep_step.sh - - ctr=`expr $ctr + 1` - - if [[ $dtype == "anl" ]]; then - data_file=${type}_anl.${PDATE}.ieee_d - ctl_file=${type}_anl.ctl - angl_ctl=angle.${ctl_file} - else - data_file=${type}.${PDATE}.ieee_d - ctl_file=${type}.ctl - angl_ctl=angle.${ctl_file} - fi - - if [[ $REGIONAL_RR -eq 1 ]]; then - angl_file=${rgnHH}.angle.${data_file}.${rgnTM} - else - angl_file=angle.${data_file} - fi - - rm input - - nchanl=-999 -cat << EOF > input - &INPUT - satname='${type}', - iyy=${iyy}, - imm=${imm}, - idd=${idd}, - ihh=${ihh}, - idhh=-720, - incr=6, - nchanl=${nchanl}, - suffix='${RADMON_SUFFIX}', - imkctl=${MAKE_CTL}, - imkdata=${MAKE_DATA}, - gesanl='${dtype}', - little_endian=${LITTLE_ENDIAN}, - rad_area='${RAD_AREA}', - / -EOF - - startmsg - ./${angle_exec} < input >> ${pgmout} 2>>errfile - export err=$?; err_chk - if [[ $? -ne 0 ]]; then - fail=`expr $fail + 1` - fi - -#------------------------------------------------------------------- -# move data, control, and stdout files to $TANKverf_rad and compress - - if [[ -s ${data_file} ]]; then - mv ${data_file} ${angl_file} - mv ${angl_file} $TANKverf_rad/. - ${COMPRESS} -f $TANKverf_rad/${angl_file} - fi - - if [[ -s ${ctl_file} ]]; then - mv ${ctl_file} ${angl_ctl} - mv ${angl_ctl} ${TANKverf_rad}/. - ${COMPRESS} -f ${TANKverf_rad}/${angl_ctl} - fi - -# if [[ -s ${stdout_file} ]]; then -# mv ${stdout_file} ${angl_stdout} -# mv ${angl_stdout} ${TANKverf_rad}/. -# ${COMPRESS} -f ${TANKverf_rad}/${angl_stdout} -# fi - - done # for dtype in ${gesanl} loop - - done # for type in ${SATYPE} loop - - if [[ $fail -eq $ctr || $fail -gt $ctr ]]; then - err=3 - fi -fi - -################################################################################ -# Post processing - -if [[ "$VERBOSE" = "YES" ]]; then - echo $(date) EXITING $0 error code ${err} >&2 -fi - -msg="${scr} HAS ENDED" -postmsg "$jlogfile" "$msg" - -exit ${err} diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/ush/radmon_verf_bcoef.sh b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/ush/radmon_verf_bcoef.sh deleted file mode 100755 index f5190981bc..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/ush/radmon_verf_bcoef.sh +++ /dev/null @@ -1,226 +0,0 @@ -#!/bin/ksh - -################################################################################ -#### UNIX Script Documentation Block -# . . -# Script name: radmon_verf_bcoef.sh -# Script description: Extract bias correction coefficients data from radiance -# diagnostic files. -# -# Author: Ed Safford Org: NP23 Date: 2012-02-02 -# -# Abstract: This script extracts bias correction coefficient related data from -# radiance diagnostic files (which are an output from GSI runs), -# storing the extracted data in small binary files. -# -# This script is a child script of exgdas_vrfyrad.sh.sms. The parent -# script opens and uncompresses the radiance diagnostic file and copies -# other supporting files into a temporary working directory. -# -# -# Usage: radmon_verf_bcoef.sh PDATE -# -# Input script positional parameters: -# PDATE processing date -# yyyymmddcc format; required -# -# Imported Shell Variables: -# RADMON_SUFFIX data source suffix -# defauls to opr -# MAKE_CTL switch to construct the meta-data control file -# defaults to 1 (on) -# MAKE_DATA switch to construct the binary data file -# defaults to 1 (on) -# EXECradmon executable directory -# defaults to current directory -# FIXradmon fixed data directory -# defaults to current directory -# RAD_AREA global or regional flag -# defaults to global -# TANKverf_rad data repository -# defaults to current directory -# SATYPE list of satellite/instrument sources -# defaults to none -# VERBOSE Verbose flag (YES or NO) -# defaults to NO -# LITTLE_ENDIAN flag for LE machine -# defaults to 0 (big endian) -# USE_ANL use analysis files as inputs in addition to -# the ges files. Default is 0 (ges only) -# -# Modules and files referenced: -# scripts : -# -# programs : $NCP -# $bcoef_exec -# -# fixed data : $biascr -# -# input data : $data_file -# -# output data: $bcoef_file -# $bcoef_ctl -# $pgmout -# -# Remarks: -# -# Condition codes -# 0 - no problem encountered -# >0 - some problem encountered -# -#################################################################### -# Command line arguments. -export PDATE=${1:-${PDATE:?}} - -scr=radmon_verf_bcoef.sh -msg="${scr} HAS STARTED" -postmsg "$jlogfile" "$msg" - -if [[ "$VERBOSE" = "YES" ]]; then - set -ax -fi - -# Directories -FIXgdas=${FIXgdas:-$(pwd)} -EXECradmon=${EXECradmon:-$(pwd)} -TANKverf_rad=${TANKverf_rad:-$(pwd)} - -# File names -pgmout=${pgmout:-${jlogfile}} -touch $pgmout - -# Other variables -MAKE_CTL=${MAKE_CTL:-1} -MAKE_DATA=${MAKE_DATA:-1} -RAD_AREA=${RAD_AREA:-glb} -REGIONAL_RR=${REGIONAL_RR:-0} -rgnHH=${rgnHH:-} -rgnTM=${rgnTM:-} -SATYPE=${SATYPE:-} -VERBOSE=${VERBOSE:-NO} -LITTLE_ENDIAN=${LITTLE_ENDIAN:-0} -USE_ANL=${USE_ANL:-0} - -err=0 -bcoef_exec=radmon_bcoef - -if [[ $USE_ANL -eq 1 ]]; then - gesanl="ges anl" -else - gesanl="ges" -fi - -#-------------------------------------------------------------------- -# Copy extraction program and supporting files to working directory - -$NCP $EXECradmon/${bcoef_exec} ./${bcoef_exec} -$NCP ${biascr} ./biascr.txt - -if [[ ! -s ./${bcoef_exec} || ! -s ./biascr.txt ]]; then - err=4 -else - - -#-------------------------------------------------------------------- -# Run program for given time - - export pgm=${bcoef_exec} - - iyy=`echo $PDATE | cut -c1-4` - imm=`echo $PDATE | cut -c5-6` - idd=`echo $PDATE | cut -c7-8` - ihh=`echo $PDATE | cut -c9-10` - - ctr=0 - fail=0 - - for type in ${SATYPE}; do - for dtype in ${gesanl}; do - - prep_step - - ctr=`expr $ctr + 1` - - if [[ $dtype == "anl" ]]; then - data_file=${type}_anl.${PDATE}.ieee_d - ctl_file=${type}_anl.ctl - bcoef_ctl=bcoef.${ctl_file} - else - data_file=${type}.${PDATE}.ieee_d - ctl_file=${type}.ctl - bcoef_ctl=bcoef.${ctl_file} - fi - - if [[ $REGIONAL_RR -eq 1 ]]; then - bcoef_file=${rgnHH}.bcoef.${data_file}.${rgnTM} - else - bcoef_file=bcoef.${data_file} - fi - - - rm input - - nchanl=-999 - npredr=5 - -cat << EOF > input - &INPUT - satname='${type}', - npredr=${npredr}, - nchanl=${nchanl}, - iyy=${iyy}, - imm=${imm}, - idd=${idd}, - ihh=${ihh}, - idhh=-720, - incr=6, - suffix='${RADMON_SUFFIX}', - imkctl=${MAKE_CTL}, - imkdata=${MAKE_DATA}, - gesanl='${dtype}', - little_endian=${LITTLE_ENDIAN}, - / -EOF - startmsg - ./${bcoef_exec} < input >>${pgmout} 2>>errfile - export err=$?; err_chk - if [[ $? -ne 0 ]]; then - fail=`expr $fail + 1` - fi - - -#------------------------------------------------------------------- -# move data, control, and stdout files to $TANKverf_rad and compress -# - - if [[ -s ${data_file} ]]; then - mv ${data_file} ${bcoef_file} - mv ${bcoef_file} $TANKverf_rad/. - ${COMPRESS} -f $TANKverf_rad/${bcoef_file} - fi - - if [[ -s ${ctl_file} ]]; then - mv ${ctl_file} ${bcoef_ctl} - mv ${bcoef_ctl} ${TANKverf_rad}/. - ${COMPRESS} -f ${TANKverf_rad}/${bcoef_ctl} - fi - - done # dtype in $gesanl loop - done # type in $SATYPE loop - - if [[ $fail -eq $ctr || $fail -gt $ctr ]]; then - err=5 - fi -fi - - -################################################################################ -# Post processing -if [[ "$VERBOSE" = "YES" ]]; then - echo $(date) EXITING $0 with error code ${err} >&2 -fi - -msg="${scr} HAS ENDED" -postmsg "$jlogfile" "$msg" - -exit ${err} diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/ush/radmon_verf_bcor.sh b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/ush/radmon_verf_bcor.sh deleted file mode 100755 index 8b65c8f993..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/ush/radmon_verf_bcor.sh +++ /dev/null @@ -1,228 +0,0 @@ -#!/bin/ksh - -################################################################################ -#### UNIX Script Documentation Block -# . . -# Script name: radmon_verf_bcor.sh -# Script description: Extract bias correction data from radiance diagnostic -# files. -# -# Author: Ed Safford Org: NP23 Date: 2012-02-02 -# -# Abstract: This script extracts bias correction related data from radiance -# diagnostic files (which are an output from GSI runs), storing the -# extracted data in small binary files. -# -# This script is a child script of exgdas_vrfyrad.sh.sms. The parent -# script opens and uncompresses the radiance diagnostic file and copies -# other supporting files into a temporary working directory. -# -# -# Usage: radmon_verf_bcor.sh PDATE -# -# Input script positional parameters: -# PDATE processing date -# yyyymmddcc format; required -# -# Imported Shell Variables: -# RADMON_SUFFIX data source suffix -# defauls to opr -# MAKE_CTL switch to construct the meta-data control file -# defaults to 1 (on) -# MAKE_DATA switch to construct the binary data file -# defaults to 1 (on) -# EXECradmon executable directory -# defaults to current directory -# RAD_AREA global or regional flag -# defaults to global -# TANKverf_rad data repository -# defaults to current directory -# SATYPE list of satellite/instrument sources -# defaults to none -# VERBOSE Verbose flag (YES or NO) -# defaults to NO -# LITTLE_ENDIAN flag for little endian machine -# defaults to 0 (big endian) -# USE_ANL use analysis files as inputs in addition to -# the ges files. Default is 0 (ges only) -# -# Modules and files referenced: -# scripts : -# -# programs : $NCP -# $bcor_exec -# -# fixed data : none -# -# input data : $data_file -# -# output data: $bcor_file -# $bcor_ctl -# $pgmout -# -# Remarks: -# -# Condition codes -# 0 - no problem encountered -# >0 - some problem encountered -# -#################################################################### - -# Command line arguments. -export PDATE=${1:-${PDATE:?}} - -scr=radmon_verf_bcor.sh -msg="${scr} HAS STARTED" -postmsg "$jlogfile" "$msg" - - -if [[ "$VERBOSE" = "YES" ]]; then - set -ax -fi - -# Directories -EXECradmon=${EXECradmon:-$(pwd)} -TANKverf_rad=${TANKverf_rad:-$(pwd)} - -# File names -pgmout=${pgmout:-${jlogfile}} -touch $pgmout - -# Other variables -MAKE_CTL=${MAKE_CTL:-1} -MAKE_DATA=${MAKE_DATA:-1} -RAD_AREA=${RAD_AREA:-glb} -REGIONAL_RR=${REGIONAL_RR:-0} -rgnHH=${rgnHH:-} -rgnTM=${rgnTM:-} -SATYPE=${SATYPE:-} -VERBOSE=${VERBOSE:-NO} -LITTLE_ENDIAN=${LITTLE_ENDIAN:-0} -USE_ANL=${USE_ANL:-0} - -bcor_exec=radmon_bcor -err=0 - -if [[ $USE_ANL -eq 1 ]]; then - gesanl="ges anl" -else - gesanl="ges" -fi - - -#-------------------------------------------------------------------- -# Copy extraction program to working directory - -$NCP ${EXECradmon}/${bcor_exec} ./${bcor_exec} - -if [[ ! -s ./${bcor_exec} ]]; then - err=6 -else - - -#-------------------------------------------------------------------- -# Run program for given time - - export pgm=${bcor_exec} - - iyy=`echo $PDATE | cut -c1-4` - imm=`echo $PDATE | cut -c5-6` - idd=`echo $PDATE | cut -c7-8` - ihh=`echo $PDATE | cut -c9-10` - - ctr=0 - fail=0 - touch "./errfile" - - for type in ${SATYPE}; do - - for dtype in ${gesanl}; do - - prep_step - - ctr=`expr $ctr + 1` - - if [[ $dtype == "anl" ]]; then - data_file=${type}_anl.${PDATE}.ieee_d - ctl_file=${type}_anl.ctl - bcor_ctl=bcor.${ctl_file} - else - data_file=${type}.${PDATE}.ieee_d - ctl_file=${type}.ctl - bcor_ctl=bcor.${ctl_file} - fi - - if [[ $REGIONAL_RR -eq 1 ]]; then - bcor_file=${rgnHH}.bcor.${data_file}.${rgnTM} - else - bcor_file=bcor.${data_file} - fi - - rm input - - nchanl=-999 - -cat << EOF > input - &INPUT - satname='${type}', - iyy=${iyy}, - imm=${imm}, - idd=${idd}, - ihh=${ihh}, - idhh=-720, - incr=6, - nchanl=${nchanl}, - suffix='${RADMON_SUFFIX}', - imkctl=${MAKE_CTL}, - imkdata=${MAKE_DATA}, - gesanl='${dtype}', - little_endian=${LITTLE_ENDIAN}, - rad_area='${RAD_AREA}', - / -EOF - - startmsg - ./${bcor_exec} < input >> ${pgmout} 2>>errfile - export err=$?; err_chk - if [[ $? -ne 0 ]]; then - fail=`expr $fail + 1` - fi - - -#------------------------------------------------------------------- -# move data, control, and stdout files to $TANKverf_rad and compress -# - - if [[ -s ${data_file} ]]; then - mv ${data_file} ${bcor_file} - mv ${bcor_file} $TANKverf_rad/. - ${COMPRESS} -f $TANKverf_rad/${bcor_file} - fi - - if [[ -s ${ctl_file} ]]; then - mv ${ctl_file} ${bcor_ctl} - mv ${bcor_ctl} ${TANKverf_rad}/. - ${COMPRESS} -f ${TANKverf_rad}/${bcor_ctl} - fi - - done # dtype in $gesanl loop - done # type in $SATYPE loop - - - if [[ $fail -eq $ctr || $fail -gt $ctr ]]; then - err=7 - fi -fi - -################################################################################ -# Post processing - -if [[ "$VERBOSE" = "YES" ]]; then - echo $(date) EXITING $0 error code ${err} >&2 -fi - -msg="${scr} HAS ENDED" -postmsg "$jlogfile" "$msg" - -exit ${err} - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/ush/radmon_verf_time.sh b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/ush/radmon_verf_time.sh deleted file mode 100755 index a0b8b21a02..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/ush/radmon_verf_time.sh +++ /dev/null @@ -1,519 +0,0 @@ -#!/bin/ksh - -################################################################################ -#### UNIX Script Documentation Block -# . . -# Script name: radmon_verf_time.sh -# Script description: Extract time data from radiance diagnostic files, -# perform data integrity checks. -# -# Author: Ed Safford Org: NP23 Date: 2012-02-02 -# -# Abstract: This script extracts time related data from radiance diagnostic -# files (which are an output from GSI runs), storing the extracted -# data in small binary files. Data integrity checks are performed -# on the data and mail messages are sent if potential errors are -# detected. -# -# This script is a child script of exgdas_vrfyrad.sh.sms. The parent -# script opens and uncompresses the radiance diagnostic file and copies -# other supporting files into a temporary working directory. -# -# -# Usage: radmon_verf_time.sh PDATE -# -# Input script positional parameters: -# PDATE processing date -# yyyymmddcc format; required -# -# Imported Shell Variables: -# DO_DIAG_RPT switch to build the diagnostic report -# defaults to 1 (on) -# DO_DATA_RPT switch to build the data report -# defaults to 1 (on) -# RADMON_SUFFIX data source suffix -# defauls to opr -# MAKE_CTL switch to construct the meta-data control file -# defaults to 1 (on) -# MAKE_DATA switch to construct the binary data file -# defaults to 1 (on) -# EXECradmon executable directory -# defaults to current directory -# FIXgdas fixed data directory -# defaults to current directory -# RAD_AREA global or regional flag -# defaults to global -# TANKverf_rad data repository -# defaults to current directory -# SATYPE list of satellite/instrument sources -# defaults to none -# MAIL_TO email recipients -# defaults to none -# MAIL_CC email cc recipients -# defaults to none -# VERBOSE Verbose flag (YES or NO) -# defaults to NO -# LITTLE_ENDIAN flag for little endian machine -# defaults to 0 (big endian) -# USE_ANL use analysis files as inputs in addition to -# the ges files. Default is 0 (ges only) -# -# Modules and files referenced: -# scripts : -# -# programs : $NCP -# $time_exec -# -# fixed data : gdas_radmon_base.tar -# -# input data : $data_file -# -# output data: $time_file -# $time_ctl -# $pgmout -# $bad_pen -# $bad_chan -# $report -# $diag_report -# -# -# Remarks: -# -# Condition codes -# 0 - no problem encountered -# >0 - some problem encountered -# -#################################################################### - -# Command line arguments. -export PDATE=${1:-${PDATE:?}} - -scr=radmon_verf_time.sh -msg="${scr} HAS STARTED" -postmsg "$jlogfile" "$msg" - -if [[ "$VERBOSE" = "YES" ]]; then - set -ax -fi - -# Directories -FIXgdas=${FIXgdas:-$(pwd)} -EXECradmon=${EXECradmon:-$(pwd)} -TANKverf_rad=${TANKverf_rad:-$(pwd)} - -# File names -pgmout=${pgmout:-${jlogfile}} -touch $pgmout - -radmon_err_rpt=${radmon_err_rpt:-${USHradmon}/radmon_err_rpt.sh} -base_file=${base_file:-$FIXgdas/gdas_radmon_base.tar} -report=report.txt -disclaimer=disclaimer.txt -region=region.txt -diag_report=diag_report.txt -diag_hdr=diag_hdr.txt -diag=diag.txt -obs_err=obs_err.txt -obs_hdr=obs_hdr.txt -pen_err=pen_err.txt -pen_hdr=pen_hdr.txt -chan_err=chan_err.txt -chan_hdr=chan_hdr.txt - -# Other variables -DO_DIAG_RPT=${DO_DIAG_RPT:-1} -DO_DATA_RPT=${DO_DATA_RPT:-1} -RADMON_SUFFIX=${RADMON_SUFFIX:-opr} -MAKE_CTL=${MAKE_CTL:-1} -MAKE_DATA=${MAKE_DATA:-1} -RAD_AREA=${RAD_AREA:-glb} -REGIONAL_RR=${REGIONAL_RR:-0} -rgnHH=${rgnHH:-} -rgnTM=${rgnTM:-} -SATYPE=${SATYPE:-} -MAIL_TO=${MAIL_TO:-} -MAIL_CC=${MAIL_CC:-} -VERBOSE=${VERBOSE:-NO} -LITTLE_ENDIAN=${LITTLE_ENDIAN:-0} - -time_exec=radmon_time -USE_ANL=${USE_ANL:-0} -err=0 - -if [[ $USE_ANL -eq 1 ]]; then - gesanl="ges anl" -else - gesanl="ges" -fi - - -#-------------------------------------------------------------------- -# Copy extraction program and base files to working directory -#------------------------------------------------------------------- -$NCP ${EXECradmon}/${time_exec} ./ -if [[ ! -s ./${time_exec} ]]; then - err=8 -fi - -iyy=`echo $PDATE | cut -c1-4` -imm=`echo $PDATE | cut -c5-6` -idd=`echo $PDATE | cut -c7-8` -ihh=`echo $PDATE | cut -c9-10` -cyc=$ihh -CYCLE=$cyc - -local_base="local_base" -if [[ $DO_DATA_RPT -eq 1 ]]; then - - if [[ -e ${base_file}.${Z} ]]; then - $NCP ${base_file}.${Z} ./${local_base}.{Z} - ${UNCOMPRESS} ${local_base}.${Z} - else - $NCP ${base_file} ./${local_base} - fi - - if [[ ! -s ./${local_file} ]]; then - echo "RED LIGHT: local_base file not found" - err=9 - else - echo "Confirming local_base file is good = ${local_base}" - tar -xf ./${local_base} - echo "local_base is untarred" - fi -fi - -if [[ $err -eq 0 ]]; then - ctr=0 - fail=0 - - export pgm=${time_exec} -#-------------------------------------------------------------------- -# Loop over each entry in SATYPE -#-------------------------------------------------------------------- - for type in ${SATYPE}; do - ctr=`expr $ctr + 1` - - for dtype in ${gesanl}; do - - prep_step - - rm input - - if [[ $dtype == "anl" ]]; then - data_file=${type}_anl.${PDATE}.ieee_d - ctl_file=${type}_anl.ctl - time_ctl=time.${ctl_file} - else - data_file=${type}.${PDATE}.ieee_d - ctl_file=${type}.ctl - time_ctl=time.${ctl_file} - fi - - if [[ $REGIONAL_RR -eq 1 ]]; then - time_file=${rgnHH}.time.${data_file}.${rgnTM} - else - time_file=time.${data_file} - fi - -#-------------------------------------------------------------------- -# Run program for given satellite/instrument -#-------------------------------------------------------------------- - nchanl=-999 -cat << EOF > input - &INPUT - satname='${type}', - iyy=${iyy}, - imm=${imm}, - idd=${idd}, - ihh=${ihh}, - idhh=-720 - incr=6 - nchanl=${nchanl}, - suffix='${RADMON_SUFFIX}', - imkctl=${MAKE_CTL}, - imkdata=${MAKE_DATA}, - gesanl='${dtype}', - little_endian=${LITTLE_ENDIAN}, - rad_area='${RAD_AREA}', - / -EOF - startmsg - - ./${time_exec} < input >> stdout.${type} 2>>errfile - export err=$?; err_chk - - # - # stdout.${type} is needed by radmon_ck_stdout.sh - # NCO requirement is executable output goes to jlogfile, so - # cat it there now: - cat stdout.${type} >> ${pgmout} - - if [[ $? -ne 0 ]]; then - fail=`expr $fail + 1` - fi - -#------------------------------------------------------------------- -# move data, control, and stdout files to $TANKverf_rad and compress -#------------------------------------------------------------------- - - if [[ -s ${data_file} ]]; then - mv ${data_file} ${time_file} - mv ${time_file} $TANKverf_rad/. - ${COMPRESS} -f $TANKverf_rad/${time_file} - fi - - if [[ -s ${ctl_file} ]]; then - $NCP ${ctl_file} ${time_ctl} - $NCP ${time_ctl} ${TANKverf_rad}/. - ${COMPRESS} -f ${TANKverf_rad}/${time_ctl} - fi - - done - done - if [[ $fail -eq $ctr || $fail -gt $ctr ]]; then - echo "fail, ctr = $fail, $ctr" - err=10 - fi - -fi - - - -#################################################################### -#------------------------------------------------------------------- -# Begin error analysis and reporting -#------------------------------------------------------------------- -#################################################################### - -if [[ $DO_DIAG_RPT -eq 1 ]]; then - -# build the disclaimer and region files - - cat << EOF > ${disclaimer} - - -*********************** WARNING *************************** -THIS IS AN AUTOMATED EMAIL. REPLIES TO SENDER WILL NOT BE -RECEIVED. PLEASE DIRECT REPLIES TO edward.safford@noaa.gov -*********************** WARNING *************************** -EOF - - cat << EOF > ${region} - Region Definitions: - - 1 Global (90S-90N, 0-360E) -EOF - - -#------------------------------------------------------------------- -# Check stdout file for any reported problem(s) reading the -# diagnostic file by calling ck_stdout.sh -# - ${USHradmon}/radmon_ck_stdout.sh ${diag} - - if [[ -s ${diag} ]]; then - cat << EOF > ${diag_hdr} - -Problem Reading Diagnostic File - - $PDATE - - Problems were encountered reading the diagnostic file for - the following sources: - -EOF - - cat ${diag_hdr} >> ${diag_report} - cat ${diag} >> ${diag_report} - if [[ $USE_MAIL -eq 1 ]]; then - cat ${disclaimer} >> ${diag_report} - else - echo End Problem Reading Diagnostic File >> ${diag_report} - echo >> ${diag_report} - fi - rm ${diag} ${diag_hdr} - fi - -#------------------------------------------------------------------- -# mail error notifications or dump to log file - - if [[ -s ${diag_report} ]]; then - lines=`wc -l <${diag_report}` - if [[ $lines -gt 1 ]]; then - - if [[ $USE_MAIL -eq 1 ]]; then - if [[ $MAIL_CC == "" ]]; then - /bin/mail -v -s diagnostic_error_report ${MAIL_TO}< ${diag_report} - else - /bin/mail -v -s diagnostic_error_report -c "${MAIL_CC}" ${MAIL_TO}< ${diag_report} - fi - else - - cat ${diag_report} - fi - fi - fi - -fi - - -#------------------------------------------------------------------- -# Assemble the bad penalty/channel report - -if [[ $DO_DATA_RPT -eq 1 ]]; then - - #---------------------------------------------------------------- - # Identify bad_pen and bad_chan files for this cycle and - # previous cycle - - bad_pen=bad_pen.${PDATE} - bad_chan=bad_chan.${PDATE} - - qdate=`$NDATE -06 $PDATE` - pday=`echo $qdate | cut -c1-8` - - prev_bad_pen=bad_pen.${qdate} - prev_bad_chan=bad_chan.${qdate} - - do_rpt=0 - if [[ -s $bad_pen && -s ${TANKverf}/radmon.${pday}/$prev_bad_pen ]]; then - do_rpt=1 - fi - if [[ -s $bad_chan && -s ${TANKverf}/radmon.${pday}/$prev_bad_chan ]]; then - do_rpt=1 - fi - -#-------------------------------------------------------------------- -# Remove extra spaces in new bad_pen file -# - gawk '{$1=$1}1' $bad_pen > tmp.bad_pen - mv -f tmp.bad_pen $bad_pen - - - if [[ $do_rpt -eq 1 ]]; then -#------------------------------------------------------------------- -# copy previous cycle's bad_chan and bad_pen files -# - $NCP ${TANKverf}/radmon.${pday}/${prev_bad_pen} ./ - $NCP ${TANKverf}/radmon.${pday}/${prev_bad_chan} ./ - -#------------------------------------------------------------------- -# run radmon_err_rpt.sh for chan and pen to create the error files -# - ${radmon_err_rpt} ${prev_bad_pen} ${bad_pen} pen ${qdate} ${PDATE} ${diag_report} ${pen_err} - - -#------------------------------------------------------------------- -# put together the unified error report with any obs, chan, and -# penalty problems and mail it - - if [[ -s ${obs_err} || -s ${pen_err} || -s ${chan_err} ]]; then - - echo DOING ERROR REPORTING - - echo "Begin Cycle Data Integrity Report" > $report - - cat << EOF >> $report -Cycle Data Integrity Report - $PDATE - -EOF - - cat ${region} >> $report - - if [[ -s ${chan_err} ]]; then - - echo OUTPUTING CHAN_ERR - - cat << EOF > ${chan_hdr} - - The following channels report 0 observational counts over the past two cycles: - - Satellite/Instrument Channel - ==================== ======= - -EOF - - cat ${chan_hdr} >> $report - cat ${chan_err} >> $report - - fi - - if [[ -s ${pen_err} ]]; then - - cat << EOF > ${pen_hdr} - - - Penalty values outside of the established normal range were found - for these sensor/channel/regions in the past two cycles: - - Questionable Penalty Values - ============ ======= ====== Cycle Penalty Bound - ----- ------- ----- -EOF - cat ${pen_hdr} >> $report - cat ${pen_err} >> $report - rm ${pen_hdr} ${pen_err} - fi - - if [[ $USE_MAIL -eq 1 ]]; then - cat ${disclaimer} >> $report - else - echo End Cycle Data Integrity Report >> $report - echo >> $report - fi - fi - -#------------------------------------------------------------------- -# mail error notifications or dump to log file -# - if [[ -s ${report} ]]; then - lines=`wc -l <${report}` - if [[ $lines -gt 2 ]]; then - if [[ $USE_MAIL -eq 1 ]]; then - if [[ $MAIL_CC == "" ]]; then - /bin/mail -v -s cycle_report ${MAIL_TO}< ${report} - else - /bin/mail -v -s cycle_report -c "${MAIL_CC}" ${MAIL_TO}< ${report} - fi - else - cat ${report} - fi - fi - fi - - fi - -#------------------------------------------------------------------- -# copy new bad_pen and bad_chan files to $TANKverf_rad - - if [[ -s ${bad_chan} ]]; then - $NCP ${bad_chan} ${TANKverf_rad}/. - fi - - if [[ -s ${bad_pen} ]]; then - $NCP ${bad_pen} ${TANKverf_rad}/. - fi - -fi - -for type in ${SATYPE}; do - rm -f stdout.${type} -done - -################################################################################ -#------------------------------------------------------------------- -# end error reporting section -#------------------------------------------------------------------- -################################################################################ - -################################################################################ -# Post processing -if [[ "$VERBOSE" = "YES" ]]; then - echo $(date) EXITING $0 error code ${err} >&2 -fi - -msg="${scr} HAS ENDED" -postmsg "$jlogfile" "$msg" - -exit ${err} diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/modulefiles/dell/RadMonBuild b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/modulefiles/dell/RadMonBuild deleted file mode 100644 index 8747e130a0..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/modulefiles/dell/RadMonBuild +++ /dev/null @@ -1,17 +0,0 @@ -#%Module################################################################# -proc ModulesHelp { } { - puts stderr "Set environment variables for WCOSS(cray) radmon build" -} - -module-whatis "Set environment variables for WCOSS(cray) radmon build" - -set FCOMP ifort - -setenv CF $FCOMP -setenv FC $FCOMP -setenv FFLAGS "-O3 -fp-model strict -D_REAL8_ -traceback -convert big_endian -assume byterecl" -setenv CHECK_LIBS "/gpfs/hps/nco/ops/nwprod/spa_util/check_libs.bash" -setenv D_FFLAGS "-O3 -fp-model strict -D_REAL8_ -traceback -convert big_endian -assume byterecl -debug" -module load ips/18.0.1.163 -module load w3nco/2.0.6 - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/modulefiles/wcoss/RadMonBuild b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/modulefiles/wcoss/RadMonBuild deleted file mode 100644 index 7268764804..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/modulefiles/wcoss/RadMonBuild +++ /dev/null @@ -1,18 +0,0 @@ -#%Module################################################################# -proc ModulesHelp { } { - puts stderr "Set environment variables for WCOSS radmon build" -} - -module-whatis "Set environment variables for WCOSS radmon build" - -set ver 2.0.2 -set FCOMP ifort - -setenv CF $FCOMP -setenv FC $FCOMP -setenv FFLAGS "-O3 -fp-model strict -D_REAL8_ -traceback -convert big_endian -assume byterecl" -setenv D_FFLAGS "-O3 -fp-model strict -D_REAL8_ -traceback -convert big_endian -assume byterecl -debug" -setenv CHECK_LIBS "/nwprod/spa_util/check_libs.bash" -module load ics -module load w3nco - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/build_radmon.sh b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/build_radmon.sh deleted file mode 100755 index fc3faa6b22..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/build_radmon.sh +++ /dev/null @@ -1,34 +0,0 @@ - -this_sys=`hostname` -two=`echo $this_sys | cut -c1-2` -one=`echo $this_sys | cut -c1` - -# System is either wcoss, cray, or theia -# (# = a digit) -# hostnames on theia are tfe## -# cray are s|tlogin# -# wcoss are t|g##a# - -system="wcoss" -if [[ $two = "tf" ]]; then - system="theia" -elif [[ $two = "tl" || $two = "sl" ]]; then - system="cray": -fi - -echo "system = $system" - -module use -a ../modulefiles/${system} -module load RadMonBuild - - -for dir in verf_radbcoef.fd verf_radtime.fd verf_radang.fd verf_radbcor.fd -do - cd $dir - make check_prereqs - make - make install - cd ../ -done - -module unload RadMonBuild diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/readme b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/readme deleted file mode 100644 index 2ec020294c..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/readme +++ /dev/null @@ -1,29 +0,0 @@ -Instructions for building executables. - - Run the build_radmon.sh script OR perform these steps: - - 1) Load the build module appropriate for your Machine: - i.) - WCOSS: - "module use -a ../modulefiles/wcoss" - CRAY: - "module use -a ../modulefiles/cray" - THEIA: - "module use -a ../modulefiles/theia" - ii.) type: - "module load RadMonBuild" - - 2) cd into each executable directory (*.fd) - - 3) Optional: verify all prerequisites are met by typing: - "make check_prereqs" - - 4) Build the executable by typing: - "make" - - 5) Move the executable to the ../../exec directory by typing: - "make install" - - 6) When all executable have been built unload the build module: - "module unload RadMonBuild" - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radang.fd/CMakeLists.txt b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radang.fd/CMakeLists.txt deleted file mode 100644 index 47c5e02828..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radang.fd/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ -cmake_minimum_required(VERSION 2.6) - file(GLOB RADMON_ANGLE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/*90 ) - set(RADMON_ANGLE_Fortran_FLAGS "-fp-model strict -assume byterecl -convert big_endian -O3 -traceback -D_REAL8_ ") - set(Util_MODULE_DIR ${PROJECT_BINARY_DIR}/include/radmon_angle ) - set_source_files_properties( ${RADMON_ANGLE_SRC} PROPERTIES COMPILE_FLAGS ${RADMON_ANGLE_Fortran_FLAGS} ) - add_executable(radmon_angle ${RADMON_ANGLE_SRC} ) - set_target_properties( radmon_angle PROPERTIES COMPILE_FLAGS ${RADMON_ANGLE_Fortran_FLAGS} ) - set_target_properties( radmon_angle PROPERTIES Fortran_MODULE_DIRECTORY ${Util_MODULE_DIR} ) - include_directories( ${CORE_INCS} ) - target_link_libraries( radmon_angle ${W3NCO_4_LIBRARY} ) - if(BUILD_W3NCO) - add_dependencies( radmon_angle ${W3NCO_4_LIBRARY} ) - endif() - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radang.fd/angle_bias.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radang.fd/angle_bias.f90 deleted file mode 100755 index 2a82361616..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radang.fd/angle_bias.f90 +++ /dev/null @@ -1,701 +0,0 @@ -program angle - use read_diag - - implicit none - integer ntype,mregion,mstep,surf_nregion,max_surf_region - parameter (ntype=35,mregion=25,mstep=150,max_surf_region=5) - integer iglobal, iland, iwater, isnowice, imixed - parameter (iglobal=1, iland=2, iwater=3, isnowice=4, imixed=5) - - character(10),dimension(ntype):: ftype - character(8) stid - character(20) satname,stringd - character(10) satype,dplat - character(20) dum,satsis,satscan_sis - character(40) string,diag_rad,data_file,dfile,ctl_file - character(40),dimension(max_surf_region):: surf_region - character(8) date,suffix,cycle - character(len=1024) :: command - - integer luname,lungrd,lndiag,lunang,lunctl - integer iyy,imm,idd,ihh,idhh,incr,iread,iflag,ipos - integer n_chan,j,i,k,ii,nsub,jiter,jj - integer,dimension(mregion):: jsub - integer,allocatable,dimension(:):: io_chan,nu_chan - integer imatch, npred_radiag, angord - - real start,step - integer nstep,iscan - character(1) cflg - real rang,pen - real weight,rlat,rlon,rmiss,obs,biascor,obsges,obsgesnbc,rterm,rread - real,dimension(2):: cor_tot,nbc_omg,bc_omg - real,dimension(2):: cor_fixang,cor_lapse,cor_lapse2,cor_const,cor_scangl,cor_clw - real,dimension(2):: cor_cos,cor_sin,cor_emiss - real,dimension(2):: cor_ordang4,cor_ordang3,cor_ordang2,cor_ordang1 - real,dimension(max_surf_region):: surf_rlatmin,surf_rlatmax,surf_rlonmin,surf_rlonmax - - real,allocatable,dimension(:):: wavenumbr,error,use,frequency - real,allocatable,dimension(:,:):: timang - real,allocatable,dimension(:,:,:):: count,penalty - real,allocatable,dimension(:,:,:,:):: tot_cor,omg_nbc,omg_bc - real,allocatable,dimension(:,:,:,:):: fixang_cor,lapse_cor,lapse2_cor - real,allocatable,dimension(:,:,:,:):: const_cor,scangl_cor,clw_cor - real,allocatable,dimension(:,:,:,:):: cos_cor,sin_cor,emiss_cor - real,allocatable,dimension(:,:,:,:):: ordang4_cor,ordang3_cor,ordang2_cor,ordang1_cor - -! Variables for reading satellite data - type(diag_header_fix_list ) :: header_fix - type(diag_header_chan_list),allocatable :: header_chan(:) - type(diag_data_name_list ) :: data_name - type(diag_data_fix_list ) :: data_fix - type(diag_data_chan_list ),allocatable :: data_chan(:) - type(diag_data_extra_list) ,allocatable :: data_extra(:,:) - - integer nsnow, nland, nwater, nice, nmixed, ntotal - integer nnsnow, nnland, nnwater, nnmixed, nntotal - -! Namelist with defaults - logical :: retrieval = .false. - integer :: nchanl = 19 - integer :: imkctl = 1 - integer :: imkdata = 1 - character(3) :: gesanl = 'ges' - integer :: little_endian = 1 - character(3) :: rad_area = 'glb' - namelist /input/ satname,iyy,imm,idd,ihh,idhh,incr,nchanl,& - suffix,imkctl,imkdata,retrieval,gesanl,little_endian,rad_area - - data luname,lungrd,lunctl,lndiag,iscan / 5, 51, 52, 21, 31 / - data lunang / 22 / - data rmiss /-999./ - data stringd / '.%y4%m2%d2%h2' / - data ftype / 'satang', 'count', 'penalty', & - 'omgnbc', 'total', 'omgbc', & - 'fixang', 'lapse', 'lapse2', & - 'const', 'scangl', 'clw', & - 'cos','sin','emiss','ordang4',& - 'ordang3','ordang2','ordang1',& - 'omgnbc_2', 'total_2', 'omgbc_2', & - 'fixang_2', 'lapse_2', 'lapse2_2', & - 'const_2', 'scangl_2', 'clw_2', & - 'cos_2', 'sin_2', 'emiss_2', & - 'ordang4_2','ordang3_2','ordang2_2', & - 'ordang1_2' / - data surf_region / 'global', 'land', 'water', 'ice/snow', 'mixed'/ - data surf_rlonmin / -180., -180., -180., -180., -180./ - data surf_rlonmax / 180., 180., 180., 180., 180./ - data surf_rlatmin / -90., -90., -90., -90., -90./ - data surf_rlatmax / 90., 90., 90., 90., 90./ -!************************************************************************ -! -! Initialize variables - iread=0 - npred_radiag = 12 - -! Read namelist input - read(luname,input) - write(6,input) - write(6,*)' ' - write(6,*)'gesanl = ', gesanl - write(6,*)'rad_area = ', rad_area - - surf_nregion = 5 - if ( trim(rad_area) == 'rgn' ) then - surf_nregion = 1 - endif - - if ( trim(gesanl) == 'anl' ) then - ftype(4) = 'omanbc' - ftype(6) = 'omabc' - ftype(13) = 'omanbc_2' - ftype(15) = 'omabc_2' - endif - -! Ensure number of requested regions does not exceed specified upper limit - if (surf_nregion>mregion) then - write(6,*)'***ERROR*** too many regions specified' - write(6,*)' maximum allowed: mregion=',mregion - write(6,*)' user requested: surf_nregion=',surf_nregion - call errexit(91) - endif - - date = stringd(2:9) - cycle = stringd(10:11) - -! Create filenames for diagnostic input, binary output files - write(stringd,100) iyy,imm,idd,ihh -100 format('.',i4.4,3i2.2) - - if ( trim(gesanl) == 'ges' ) then - diag_rad = trim(satname) - data_file= trim(satname) // trim(stringd) // '.ieee_d' - ctl_file = trim(satname) // '.ctl' - else - diag_rad = trim(satname) // '_anl' - data_file= trim(satname) // '_anl' // trim(stringd) // '.ieee_d' - ctl_file = trim(satname) // '_anl.ctl' - endif - - - write(6,*)'diag_rad =',diag_rad - write(6,*)'data_file=',data_file - write(6,*)'suffix =',suffix - write(6,*)'ctl_file =',ctl_file - write(6,*)'imkctl =',imkctl - write(6,*)'imkdata =',imkdata - write(6,*)'little_endian =', little_endian - - -! Open unit to diagnostic file. Read portion of -! header to see if file exists - open(lndiag,file=diag_rad,form='unformatted') - read(lndiag,err=900,end=900) dum - rewind lndiag - -! File exists. Read header - write(6,*)'call read_diag_header' - call read_radiag_header( lndiag, npred_radiag, retrieval,& - header_fix, header_chan, data_name, iflag ) -! -! If there was an error reading the header try to convert from little endian -! and re-read. If that fails exit. -! - if( iflag/=0 ) then - write(6,*)'***ERROR*** problem reading diag file header, iflag=',iflag - call errexit(91) - endif - - -! Extract observation type, satellite id, and number of channels - satype = header_fix%obstype - satsis = header_fix%isis - dplat = header_fix%id - n_chan = header_fix%nchan - jiter = header_fix%jiter - angord = header_fix%angord - - write(6,*)'satype,satid,n_chan,angord=',satype,' ',dplat,' ',n_chan,' ',angord - - string = trim(satype) //'_'// trim(dplat) - write(6,*)'string,satname=',string,' ',satname - if ( trim(string) /= trim(satname) ) then - write(6,*)'***ERROR*** inconsistent instrument types' - write(6,*)' satname,string =',satname,' ',string - call errexit(92) - endif - -! open scan info file compiled in the source directory - open(iscan,file='scaninfo.txt',form='formatted') - do - read(iscan,1000,IOSTAT=iflag) cflg,satscan_sis,start,step,nstep - write(6,*) 'satscan_sis,start,step,nstep=',satscan_sis,start,step,nstep - if( iflag /= 0 ) exit - if(trim(satname) == trim(satscan_sis)) exit - enddo -!1000 format(a1,a20,2f10.2,i10) -1000 format(a1,a20,2f10.3,i10) - - write(6,*) 'satscan_sis,start,step,nstep=',satscan_sis,start,step,nstep - - -! Allocate arrays to hold observational information - write(6,*)' ' - write(6,*)'allocate arrays' - allocate (io_chan(n_chan), nu_chan(n_chan), wavenumbr(n_chan), & - error(n_chan), use(n_chan), frequency(n_chan)) - allocate (timang(mstep,n_chan)) - allocate (tot_cor(mstep,n_chan,surf_nregion,2), & - omg_nbc(mstep,n_chan,surf_nregion,2), & - omg_bc(mstep,n_chan,surf_nregion,2), & - count(mstep,n_chan,surf_nregion), & - penalty(mstep,n_chan,surf_nregion),& - fixang_cor(mstep,n_chan,surf_nregion,2),lapse_cor(mstep,n_chan,surf_nregion,2),& - lapse2_cor(mstep,n_chan,surf_nregion,2),clw_cor(mstep,n_chan,surf_nregion,2),& - const_cor(mstep,n_chan,surf_nregion,2), scangl_cor(mstep,n_chan,surf_nregion,2),& - cos_cor(mstep,n_chan,surf_nregion,2), sin_cor(mstep,n_chan,surf_nregion,2),& - emiss_cor(mstep,n_chan,surf_nregion,2), ordang4_cor(mstep,n_chan,surf_nregion,2),& - ordang3_cor(mstep,n_chan,surf_nregion,2), ordang2_cor(mstep,n_chan,surf_nregion,2),& - ordang1_cor(mstep,n_chan,surf_nregion,2)) - -! Zero accumulator arrays - do ii=1,2 - do k=1,surf_nregion - do j=1,n_chan - do i=1,mstep - if (ii==1) then - count(i,j,k) = 0.0 - penalty(i,j,k) = 0.0 - endif - tot_cor(i,j,k,ii) = 0.0 - omg_nbc(i,j,k,ii) = 0.0 - omg_bc(i,j,k,ii) = 0.0 - fixang_cor(i,j,k,ii) = 0.0 - lapse_cor(i,j,k,ii) = 0.0 - lapse2_cor(i,j,k,ii) = 0.0 - clw_cor(i,j,k,ii) = 0.0 - const_cor(i,j,k,ii) = 0.0 - scangl_cor(i,j,k,ii) = 0.0 - cos_cor(i,j,k,ii) = 0.0 - sin_cor(i,j,k,ii) = 0.0 - emiss_cor(i,j,k,ii) = 0.0 - ordang4_cor(i,j,k,ii) = 0.0 - ordang3_cor(i,j,k,ii) = 0.0 - ordang2_cor(i,j,k,ii) = 0.0 - ordang1_cor(i,j,k,ii) = 0.0 - end do - end do - end do - end do - -! Note: timang has been deprecated and the satang file is no longer -! used. See the plot_angle_sep.*.gs scripts for how the timang -! values are derived from the diagnostic file contents. The -! timang variable has been kept to avoid making a change in -! ieee_d file format. - do j=1,n_chan - do i=1,mstep - timang(i,j) = rmiss - end do - end do - -! Extract satinfo relative index - do j=1,n_chan - nu_chan(j) = real( header_chan(j)%nuchan, 4 ) - io_chan(j) = real( header_chan(j)%iochan, 4 ) - wavenumbr(j) = real( header_chan(j)%wave, 4 ) - error(j) = real( header_chan(j)%varch, 4) - use(j) = real( header_chan(j)%iuse, 4 ) - frequency(j) = real( header_chan(j)%freq, 4) -! print *,nu_chan(j),io_chan(j),wavenumbr(j),error(j),use(j),frequency(j) - end do - - - - write(6,*)'beginning read entries in diag file' - nwater = 0; nnwater=0 - nice = 0 - nsnow = 0; nnsnow=0 - nland = 0; nnland=0 - nmixed = 0; nnmixed=0; - ntotal = 0; - -! Loop to read entries in diagnostic file - iflag = 0 - loopd: do while (iflag == 0) - -! Read a record. If read flag, iflag does not equal zero, exit loopd - call read_radiag_data( lndiag, header_fix, retrieval, data_fix, data_chan,& - data_extra, iflag ) - if( iflag /= 0 ) exit loopd - iread=iread+1 - -! Extract observation location, scan position, and mpi weight. -! Convert (0-360) lon to (-180,180) - rlat = data_fix%lat - rlon = data_fix%lon - ipos = data_fix%senscn_pos !! sensor scan position(integer) - rang = data_fix%satzen_ang !! satellite zenith angle (deg) - - ntotal = ntotal + 1 - jsub(1)=iglobal - - if ( surf_nregion > 1 ) then - if ( data_fix%water_frac > 0.99 ) then - nwater = nwater + 1 - else if ( data_fix%land_frac > 0.99 ) then - nland = nland + 1 - else if ( data_fix%snow_frac > 0.99 ) then - nsnow = nsnow + 1 - else if ( data_fix%ice_frac > 0.99 ) then - nice = nice + 1 - else - nmixed = nmixed + 1 - end if - - - if (rlon>180.) rlon = rlon - 360. - if (ipos<1) then - write(6,*)'scan position less than 1. ipos=',ipos - ipos=1 - endif - if (ipos>nstep) then - write(6,*)'scan position > nstep. ipos,nstep,',& - ipos,nstep - ipos=nstep - endif - rread = rread + 1.0 - - -! Detemine which subdomains the observation falls into -! These are now based on surface type, not geography. All -! obs match global (surf_region 1). -! - ii=0; jsub=0; - jsub(1)=iglobal - if ( data_fix%land_frac > 0.99 ) then - jsub(2)=iland - nsub=2 - nnland=nnland+1 - else if ( data_fix%water_frac > 0.99 ) then - jsub(2)=iwater - nsub=2 - nnwater=nnwater+1 - else if (( data_fix%snow_frac > 0.99 ) .OR. ( data_fix%ice_frac > 0.99 )) then - jsub(2)=isnowice - nsub=2 - nnsnow=nnsnow+1 - else - jsub(2)=imixed - nsub=2 - nnmixed=nnmixed+1 - write(6,*)'data_fix%land_frac,water,snow,ice = ',data_fix%land_frac, data_fix%water_frac, data_fix%snow_frac, data_fix%ice_frac - end if - end if - - -! Channel loop - do j = 1, n_chan - -! If observation was assimilated, accumulate sums for appropriate -! scan angle and regions - cor_cos = 0.0 - cor_sin = 0.0 - cor_emiss = 0.0 - cor_ordang4 = 0.0 - cor_ordang3 = 0.0 - cor_ordang2 = 0.0 - cor_ordang1 = 0.0 - - if (data_chan(j)%errinv > 1.e-6) then -! pen = data_chan(j)%errinv*(data_chan(j)%omgbc)**2 - pen = (data_chan(j)%errinv*(data_chan(j)%omgbc))**2 - - - cor_tot(1) = (data_chan(j)%omgnbc - data_chan(j)%omgbc) - nbc_omg(1) = - (data_chan(j)%omgnbc) - bc_omg(1) = - (data_chan(j)%omgbc) - - - if ( trim(rad_area) == 'rgn' ) then - write(6,*) 'chan,pen,cor_tot(1),nbc_omg(1),bc_omb(1) = ', j,pen,cor_tot(1),nbc_omg(1),bc_omg(1) - endif - - cor_tot(2) = (data_chan(j)%omgnbc - data_chan(j)%omgbc)**2 - nbc_omg(2) = (data_chan(j)%omgnbc)**2 - bc_omg(2) = (data_chan(j)%omgbc)**2 - - cor_fixang(1) = data_chan(j)%bifix(angord+1) - cor_lapse(1) = data_chan(j)%bilap - cor_lapse2(1) = data_chan(j)%bilap2 - cor_const(1) = data_chan(j)%bicons - cor_scangl(1) = data_chan(j)%biang - cor_clw(1) = data_chan(j)%biclw - cor_cos(1) = data_chan(j)%bicos - cor_sin(1) = data_chan(j)%bisin - cor_emiss(1) = data_chan(j)%biemis - if (angord >= 4 ) then - cor_ordang4(1) = data_chan(j)%bifix(1) - cor_ordang3(1) = data_chan(j)%bifix(2) - cor_ordang2(1) = data_chan(j)%bifix(3) - cor_ordang1(1) = data_chan(j)%bifix(4) - else - cor_ordang4(1) = 0.0 - cor_ordang3(1) = 0.0 - cor_ordang2(1) = 0.0 - cor_ordang1(1) = 0.0 - endif - - cor_fixang(2) = (data_chan(j)%bifix(angord+1))**2 - cor_lapse(2) = (data_chan(j)%bilap)**2 - cor_lapse2(2) = (data_chan(j)%bilap2)**2 - cor_const(2) = (data_chan(j)%bicons)**2 - cor_scangl(2) = (data_chan(j)%biang)**2 - cor_clw(2) = (data_chan(j)%biclw)**2 - cor_cos(2) = (data_chan(j)%bicos)**2 - cor_sin(2) = (data_chan(j)%bisin)**2 - cor_emiss(2) = (data_chan(j)%biemis)**2 - if (angord >= 4 ) then - cor_ordang4(2) = (data_chan(j)%bifix(1))**2 - cor_ordang3(2) = (data_chan(j)%bifix(2))**2 - cor_ordang2(2) = (data_chan(j)%bifix(3))**2 - cor_ordang1(2) = (data_chan(j)%bifix(4))**2 - else - cor_ordang4(2) = 0.0 - cor_ordang3(2) = 0.0 - cor_ordang2(2) = 0.0 - cor_ordang1(2) = 0.0 - endif - - - if ( trim(rad_area) == 'rgn' ) then - nsub = 1 - endif - do i=1,nsub - if ( trim(rad_area) == 'rgn' ) then - write(6,*) 'INSIDE i 1 to nsub do loop' - endif - k=jsub(i) - count(ipos,j,k) = count(ipos,j,k) + 1.0 - penalty(ipos,j,k) = penalty(ipos,j,k) + pen - - do ii=1,2 - tot_cor(ipos,j,k,ii) = tot_cor(ipos,j,k,ii) + cor_tot(ii) - omg_nbc(ipos,j,k,ii) = omg_nbc(ipos,j,k,ii) + nbc_omg(ii) - omg_bc(ipos,j,k,ii) = omg_bc(ipos,j,k,ii) + bc_omg(ii) - fixang_cor(ipos,j,k,ii) = fixang_cor(ipos,j,k,ii) + cor_fixang(ii) - lapse_cor(ipos,j,k,ii) = lapse_cor(ipos,j,k,ii) + cor_lapse(ii) - lapse2_cor(ipos,j,k,ii) = lapse2_cor(ipos,j,k,ii) + cor_lapse2(ii) - const_cor(ipos,j,k,ii) = const_cor(ipos,j,k,ii) + cor_const(ii) - scangl_cor(ipos,j,k,ii) = scangl_cor(ipos,j,k,ii) + cor_scangl(ii) - clw_cor(ipos,j,k,ii) = clw_cor(ipos,j,k,ii) + cor_clw(ii) - cos_cor(ipos,j,k,ii) = cos_cor(ipos,j,k,ii) + cor_cos(ii) - sin_cor(ipos,j,k,ii) = sin_cor(ipos,j,k,ii) + cor_sin(ii) - emiss_cor(ipos,j,k,ii) = emiss_cor(ipos,j,k,ii) + cor_emiss(ii) - ordang4_cor(ipos,j,k,ii) = ordang4_cor(ipos,j,k,ii) + cor_ordang4(ii) - ordang3_cor(ipos,j,k,ii) = ordang3_cor(ipos,j,k,ii) + cor_ordang3(ii) - ordang2_cor(ipos,j,k,ii) = ordang2_cor(ipos,j,k,ii) + cor_ordang2(ii) - ordang1_cor(ipos,j,k,ii) = ordang1_cor(ipos,j,k,ii) + cor_ordang1(ii) - - end do - end do - - endif - - enddo ! channel loop - -! End of loop over diagnostic file - enddo loopd - close(lndiag) - write(6,*)' ' - write(6,*)'read in ',iread,' obs ',rread - write(6,*)' ' - - write(6,*)'nwater, nland, nice, nsnow, nmixed, ntotal = ', nwater, nland, nice, nsnow, nmixed, ntotal - nntotal=nnwater+nnland+nnsnow+nnmixed - write(6,*)'nnwater, nnland, nnsnow, nnmixed, nntotal = ', nnwater, nnland, nnsnow, nnmixed, nntotal - - - ! Create Control file - if ( imkctl == 1 ) then - write(6,*)'call create_ctl_angle' - if ( trim(gesanl) == 'ges' ) then - dfile = trim(satname) - else - dfile = trim(satname) // '_anl' - endif - - call create_ctl_angle(ntype,ftype,n_chan,iyy,imm,idd,ihh,incr,& - ctl_file,lunctl,rmiss,dfile,satype,dplat,surf_nregion,& - surf_region,surf_rlonmin,surf_rlonmax,surf_rlatmin,surf_rlatmax,& - nu_chan,use, error, frequency,wavenumbr,nstep,start,step, little_endian) - else - write(6,*) 'imkctl =',imkctl - endif - - -! Write output to data file - if ( imkdata == 1 ) then - write(6,*)' ' - open(lungrd,file=data_file,form='unformatted') - write(lungrd) ((timang(i,j),i=1,nstep),j=1,n_chan) - do k=1,surf_nregion - write(lungrd) ((count(i,j,k),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd) ((penalty(i,j,k),i=1,nstep),j=1,n_chan) - end do - do ii=1,2 - do k=1,surf_nregion - write(lungrd)((omg_nbc(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((tot_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((omg_bc(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((fixang_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((lapse_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((lapse2_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((const_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((scangl_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((clw_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((cos_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((sin_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((emiss_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((ordang4_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((ordang3_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((ordang2_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((ordang1_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - end do - write(6,*)'write output to lungrd=',lungrd,', file=',trim(data_file) - close(lungrd) - else - write(6,*) 'imkctl =',imkctl - endif - - -! Deallocate arrays - write(6,*)' ' - write(6,*)'deallocate arrays' - deallocate(penalty,io_chan,nu_chan,wavenumbr,error,use,frequency) - deallocate(timang,tot_cor,omg_nbc,omg_bc,count) - goto 950 - - -! Jump to here if eof or error reading diagnostic file. -900 continue - write(6,*)'***PROBLEM reading diagnostic file. diag_rad=',diag_rad - close(lndiag) - - n_chan=nchanl - if (n_chan<=0) then - write(6,*)'***ERROR*** invalid nchanl=',nchanl,' STOP program' - call errexit(93) - endif - - allocate(timang(mstep,n_chan)) - allocate(count(mstep,n_chan,surf_nregion),& - penalty(mstep,n_chan,surf_nregion),& - omg_nbc(mstep,n_chan,surf_nregion,2),& - tot_cor(mstep,n_chan,surf_nregion,2),& - omg_bc(mstep,n_chan,surf_nregion,2)) - -! -! Initialze all output variables to rmiss -! -! - do j=1,n_chan - do i=1,mstep - timang(i,j) = rmiss - end do - end do - - write(6,*)'load missing value ',rmiss,' into output arrays. ',& - nstep,surf_nregion,n_chan - do ii=1,2 - do k=1,surf_nregion - do j=1,n_chan - do i=1,mstep - if (ii==1) then - count(i,j,k) = rmiss - penalty(i,j,k)= rmiss - endif - omg_nbc(i,j,k,ii) = rmiss - tot_cor(i,j,k,ii) = rmiss - omg_bc(i,j,k,ii) = rmiss - fixang_cor(i,j,k,ii) = rmiss - lapse_cor(i,j,k,ii) = rmiss - lapse2_cor(i,j,k,ii) = rmiss - clw_cor(i,j,k,ii) = rmiss - const_cor(i,j,k,ii) = rmiss - scangl_cor(i,j,k,ii) = rmiss - cos_cor(i,j,k,ii) = rmiss - sin_cor(i,j,k,ii) = rmiss - emiss_cor(i,j,k,ii) = rmiss - ordang4_cor(i,j,k,ii) = rmiss - ordang3_cor(i,j,k,ii) = rmiss - ordang2_cor(i,j,k,ii) = rmiss - ordang1_cor(i,j,k,ii) = rmiss - end do - end do - end do - end do - - if ( imkdata == 1 ) then - open(lungrd,file=data_file,form='unformatted') - write(lungrd) ((timang(i,j),i=1,nstep),j=1,n_chan) - do k=1,surf_nregion - write(lungrd) ((count(i,j,k),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd) ((penalty(i,j,k),i=1,nstep),j=1,n_chan) - end do - do ii=1,2 - do k=1,surf_nregion - write(lungrd)((omg_nbc(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((tot_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((omg_bc(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((fixang_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((lapse_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((lapse2_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((const_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((scangl_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((clw_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((cos_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((sin_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((emiss_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((ordang4_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((ordang3_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((ordang2_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((ordang1_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - end do - write(6,*)'write output to lungrd=',lungrd,', file=',trim(data_file) - close(lungrd) - endif - deallocate(timang,count,penalty,omg_nbc,omg_bc,tot_cor,& - fixang_cor,lapse_cor,lapse2_cor,const_cor,scangl_cor,clw_cor) - deallocate(cos_cor,sin_cor,emiss_cor,ordang1_cor,ordang2_cor,ordang3_cor,ordang4_cor) - -! End of program -950 continue - stop -end program angle diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radang.fd/kinds.F90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radang.fd/kinds.F90 deleted file mode 100644 index 8b3a2fcc4e..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radang.fd/kinds.F90 +++ /dev/null @@ -1,112 +0,0 @@ -module kinds -!$$$ module documentation block -! . . . . -! module: kinds -! prgmmr: treadon org: np23 date: 2004-08-15 -! -! abstract: Module to hold specification kinds for variable declaration. -! This module is based on (copied from) Paul vanDelst's -! type_kinds module found in the community radiative transfer -! model -! -! module history log: -! 2004-08-15 treadon -! 2011-07-04 todling - define main precision during compilation -! -! Subroutines Included: -! -! Functions Included: -! -! remarks: -! The numerical data types defined in this module are: -! i_byte - specification kind for byte (1-byte) integer variable -! i_short - specification kind for short (2-byte) integer variable -! i_long - specification kind for long (4-byte) integer variable -! i_llong - specification kind for double long (8-byte) integer variable -! r_single - specification kind for single precision (4-byte) real variable -! r_double - specification kind for double precision (8-byte) real variable -! r_quad - specification kind for quad precision (16-byte) real variable -! -! i_kind - generic specification kind for default integer -! r_kind - generic specification kind for default floating point -! -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ end documentation block - implicit none - private - -! Integer type definitions below - -! Integer types - integer, parameter, public :: i_byte = selected_int_kind(1) ! byte integer - integer, parameter, public :: i_short = selected_int_kind(4) ! short integer - integer, parameter, public :: i_long = selected_int_kind(8) ! long integer - integer, parameter, private :: llong_t = selected_int_kind(16) ! llong integer - integer, parameter, public :: i_llong = max( llong_t, i_long ) - -! Expected 8-bit byte sizes of the integer kinds - integer, parameter, public :: num_bytes_for_i_byte = 1 - integer, parameter, public :: num_bytes_for_i_short = 2 - integer, parameter, public :: num_bytes_for_i_long = 4 - integer, parameter, public :: num_bytes_for_i_llong = 8 - -! Define arrays for default definition - integer, parameter, private :: num_i_kinds = 4 - integer, parameter, dimension( num_i_kinds ), private :: integer_types = (/ & - i_byte, i_short, i_long, i_llong /) - integer, parameter, dimension( num_i_kinds ), private :: integer_byte_sizes = (/ & - num_bytes_for_i_byte, num_bytes_for_i_short, & - num_bytes_for_i_long, num_bytes_for_i_llong /) - -! Default values -! **** CHANGE THE FOLLOWING TO CHANGE THE DEFAULT INTEGER TYPE KIND *** - integer, parameter, private :: default_integer = 3 ! 1=byte, - ! 2=short, - ! 3=long, - ! 4=llong - integer, parameter, public :: i_kind = integer_types( default_integer ) - integer, parameter, public :: num_bytes_for_i_kind = & - integer_byte_sizes( default_integer ) - - -! Real definitions below - -! Real types - integer, parameter, public :: r_single = selected_real_kind(6) ! single precision - integer, parameter, public :: r_double = selected_real_kind(15) ! double precision - integer, parameter, private :: quad_t = selected_real_kind(20) ! quad precision - integer, parameter, public :: r_quad = max( quad_t, r_double ) - -! Expected 8-bit byte sizes of the real kinds - integer, parameter, public :: num_bytes_for_r_single = 4 - integer, parameter, public :: num_bytes_for_r_double = 8 - integer, parameter, public :: num_bytes_for_r_quad = 16 - -! Define arrays for default definition - integer, parameter, private :: num_r_kinds = 3 - integer, parameter, dimension( num_r_kinds ), private :: real_kinds = (/ & - r_single, r_double, r_quad /) - integer, parameter, dimension( num_r_kinds ), private :: real_byte_sizes = (/ & - num_bytes_for_r_single, num_bytes_for_r_double, & - num_bytes_for_r_quad /) - -! Default values -! **** CHANGE THE FOLLOWING TO CHANGE THE DEFAULT REAL TYPE KIND *** -#ifdef _REAL4_ - integer, parameter, private :: default_real = 1 ! 1=single, -#endif -#ifdef _REAL8_ - integer, parameter, private :: default_real = 2 ! 2=double, -#endif -#ifdef _REAL16_ - integer, parameter, private :: default_real = 3 ! 3=quad -#endif - integer, parameter, public :: r_kind = real_kinds( default_real ) - integer, parameter, public :: num_bytes_for_r_kind = & - real_byte_sizes( default_real ) - -end module kinds diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radang.fd/makefile b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radang.fd/makefile deleted file mode 100755 index 810680fd36..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radang.fd/makefile +++ /dev/null @@ -1,51 +0,0 @@ -# ***************************************************************** -# makefile.angle_bias -# -# Make the radmon_angle executable. -# -# ***************************************************************** - -BINDIR = $(dir_root)/exec - -LIBS = $(W3NCO_LIB4) - -OBJS = kinds.o read_diag.o angle_bias.o create_ctl_angle.o - -# -# ***************************************************************** -# - -CMD = radmon_angle - -all: $(CMD) - -clean: - rm -f *.o - rm -f *.mod - rm -f $(CMD) - -check_prereqs: - $(PRE_REQ) $(LIBS) - -install: - cp -f $(CMD) $(BINDIR)/ - -debug: FFLAGS = $(D_FFLAGS) -debug: $(CMD) - -$(CMD): $(OBJS) - $(CF) $(FFLAGS) $(LDFLAGS) -o $(@) $(OBJS) $(LIBS) - - -kinds.o : kinds.F90 - $(CF) $(FFLAGS) -c $(*).F90 - -read_diag.o : read_diag.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -angle_bias.o : angle_bias.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -create_ctl_angle.o : create_ctl_angle.f90 - $(CF) $(FFLAGS) -c $(*).f90 - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radang.fd/read_diag.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radang.fd/read_diag.f90 deleted file mode 100755 index 7a4d6cdc49..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radang.fd/read_diag.f90 +++ /dev/null @@ -1,659 +0,0 @@ -!$$$ subprogram documentation block -! . . . . -! subprogram: read_raddiag read rad diag file -! prgmmr: tahara org: np20 date: 2003-01-01 -! -! abstract: This module contains code to process radiance -! diagnostic files. The module defines structures -! to contain information from the radiance -! diagnostic files and then provides two routines -! to access contents of the file. -! -! program history log: -! 2005-07-22 treadon - add this doc block -! 2010-10-05 treadon - refactor code to GSI standard -! 2010-10-08 zhu - use data_tmp to handle various npred values -! 2011-02-22 kleist - changes related to memory allocate/deallocate -! 2011-04-08 li - add tref, dtw, dtc to diag_data_fix_list, add tb_tz to diag_data_chan_list -! - correspondingly, change ireal_radiag (26 -> 30) and ipchan_radiag (7 -> 8) -! 2011-07-24 safford - make structure size for reading data_fix data version dependent -! 2013-11-21 todling - revisit how versions are set (add set/get_radiag) -! 2014-01-27 todling - add ob sensitivity index -! -! contains -! read_radiag_header - read radiance diagnostic file header -! read_radiag_data - read radiance diagnostic file data -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ - -module read_diag - - use kinds, only: i_kind,r_single - implicit none - -! Declare public and private - private - - public :: diag_header_fix_list - public :: diag_header_chan_list - public :: diag_data_name_list - public :: diag_data_fix_list - public :: diag_data_chan_list - public :: diag_data_extra_list - public :: read_radiag_header - public :: read_radiag_data -! public :: iversion_radiag -! public :: iversion_radiag_1 -! public :: iversion_radiag_2 -! public :: iversion_radiag_3 -! public :: iversion_radiag_4 - public :: ireal_radiag - public :: ipchan_radiag - public :: set_radiag - public :: get_radiag - - interface set_radiag - module procedure set_radiag_int_ ! internal procedure for integers - end interface - interface get_radiag - module procedure get_radiag_int_ ! internal procedure for integers - end interface - - integer(i_kind),parameter :: ireal_radiag = 30 ! number of real entries per spot in radiance diagnostic file - integer(i_kind),parameter :: ireal_old_radiag = 26 ! number of real entries per spot in versions older than iversion_radiag_2 - integer(i_kind),parameter :: ipchan_radiag = 8 ! number of entries per channel per spot in radiance diagnostic file - -! Declare structures for radiance diagnostic file information - type diag_header_fix_list - character(len=20) :: isis ! sat and sensor type - character(len=10) :: id ! sat type - character(len=10) :: obstype ! observation type - integer(i_kind) :: jiter ! outer loop counter - integer(i_kind) :: nchan ! number of channels in the sensor - integer(i_kind) :: npred ! number of updating bias correction predictors - integer(i_kind) :: idate ! time (yyyymmddhh) - integer(i_kind) :: ireal ! # of real elements in the fix part of a data record - integer(i_kind) :: ipchan ! # of elements for each channel except for bias correction terms - integer(i_kind) :: iextra ! # of extra elements for each channel - integer(i_kind) :: jextra ! # of extra elements - integer(i_kind) :: idiag ! first dimension of diag_data_chan - integer(i_kind) :: angord ! order of polynomial for adp_anglebc option - integer(i_kind) :: iversion ! radiance diagnostic file version number - integer(i_kind) :: inewpc ! indicator of newpc4pred (1 on, 0 off) - integer(i_kind) :: isens ! sensitivity index - end type diag_header_fix_list - - type diag_data_name_list - character(len=10),dimension(ireal_radiag) :: fix - character(len=10),dimension(:),allocatable :: chn - end type diag_data_name_list - - type diag_header_chan_list - real(r_single) :: freq ! frequency (Hz) - real(r_single) :: polar ! polarization - real(r_single) :: wave ! wave number (cm^-1) - real(r_single) :: varch ! error variance (or SD error?) - real(r_single) :: tlapmean ! mean lapse rate - integer(i_kind):: iuse ! use flag - integer(i_kind):: nuchan ! sensor relative channel number - integer(i_kind):: iochan ! satinfo relative channel number - end type diag_header_chan_list - - type diag_data_fix_list - real(r_single) :: lat ! latitude (deg) - real(r_single) :: lon ! longitude (deg) - real(r_single) :: zsges ! guess elevation at obs location (m) - real(r_single) :: obstime ! observation time relative to analysis - real(r_single) :: senscn_pos ! sensor scan position (integer(i_kind)) - real(r_single) :: satzen_ang ! satellite zenith angle (deg) - real(r_single) :: satazm_ang ! satellite azimuth angle (deg) - real(r_single) :: solzen_ang ! solar zenith angle (deg) - real(r_single) :: solazm_ang ! solar azimumth angle (deg) - real(r_single) :: sungln_ang ! sun glint angle (deg) - real(r_single) :: water_frac ! fractional coverage by water - real(r_single) :: land_frac ! fractional coverage by land - real(r_single) :: ice_frac ! fractional coverage by ice - real(r_single) :: snow_frac ! fractional coverage by snow - real(r_single) :: water_temp ! surface temperature over water (K) - real(r_single) :: land_temp ! surface temperature over land (K) - real(r_single) :: ice_temp ! surface temperature over ice (K) - real(r_single) :: snow_temp ! surface temperature over snow (K) - real(r_single) :: soil_temp ! soil temperature (K) - real(r_single) :: soil_mois ! soil moisture - real(r_single) :: land_type ! land type (integer(i_kind)) - real(r_single) :: veg_frac ! vegetation fraction - real(r_single) :: snow_depth ! snow depth - real(r_single) :: sfc_wndspd ! surface wind speed - real(r_single) :: qcdiag1 ! ir=cloud fraction, mw=cloud liquid water - real(r_single) :: qcdiag2 ! ir=cloud top pressure, mw=total column water - real(r_single) :: tref ! reference temperature (Tr) in NSST - real(r_single) :: dtw ! dt_warm at zob - real(r_single) :: dtc ! dt_cool at zob - real(r_single) :: tz_tr ! d(Tz)/d(Tr) - end type diag_data_fix_list - - type diag_data_chan_list - real(r_single) :: tbobs ! Tb (obs) (K) - real(r_single) :: omgbc ! Tb_(obs) - Tb_(simulated w/ bc) (K) - real(r_single) :: omgnbc ! Tb_(obs) - Tb_(simulated_w/o bc) (K) - real(r_single) :: errinv ! inverse error (K**(-1)) - real(r_single) :: qcmark ! quality control mark - real(r_single) :: emiss ! surface emissivity - real(r_single) :: tlap ! temperature lapse rate - real(r_single) :: tb_tz ! d(Tb)/d(Tz) - real(r_single) :: bicons ! constant bias correction term - real(r_single) :: biang ! scan angle bias correction term - real(r_single) :: biclw ! CLW bias correction term - real(r_single) :: bilap2 ! square lapse rate bias correction term - real(r_single) :: bilap ! lapse rate bias correction term - real(r_single) :: bicos ! node*cos(lat) bias correction term - real(r_single) :: bisin ! sin(lat) bias correction term - real(r_single) :: biemis ! emissivity sensitivity bias correction term - real(r_single),dimension(:),allocatable :: bifix ! angle dependent bias - real(r_single) :: bisst ! SST bias correction term - end type diag_data_chan_list - - type diag_data_extra_list - real(r_single) :: extra ! extra information - end type diag_data_extra_list - - integer(i_kind),save :: iversion_radiag ! Current version (see set routine) - integer(i_kind),parameter:: iversion_radiag_1 = 11104 ! Version when bias-correction entries were modified - integer(i_kind),parameter:: iversion_radiag_2 = 13784 ! Version when NSST entries were added - integer(i_kind),parameter:: iversion_radiag_3 = 19180 ! Version when SSMIS added - integer(i_kind),parameter:: iversion_radiag_4 = 30303 ! Version when emissivity predictor added - - real(r_single),parameter:: rmiss_radiag = -9.9e11_r_single - -contains - -subroutine set_radiag_int_ (what,iv,ier) -character(len=*),intent(in) :: what -integer(i_kind),intent(in) :: iv -integer(i_kind),intent(out):: ier -ier=-1 -if(trim(what)=='version') then - iversion_radiag = iv - ier=0 -endif -end subroutine set_radiag_int_ - -subroutine get_radiag_int_ (what,iv,ier) -character(len=*),intent(in) :: what -integer(i_kind),intent(out):: iv -integer(i_kind),intent(out):: ier -ier=-1 -if(trim(what)=='version') then - iv = iversion_radiag - ier=0 -endif -end subroutine get_radiag_int_ - -subroutine read_radiag_header(ftin,npred_radiag,retrieval,header_fix,header_chan,data_name,iflag,lverbose) -! . . . . -! subprogram: read_diag_header read rad diag header -! prgmmr: tahara org: np20 date: 2003-01-01 -! -! abstract: This routine reads the header record from a radiance -! diagnostic file -! -! program history log: -! 2010-10-05 treadon - add this doc block -! 2011-02-22 kleist - changes related to memory allocation and standard output -! -! input argument list: -! ftin - unit number connected to diagnostic file -! npred_radiag - number of bias correction terms -! retrieval - .true. if sst retrieval -! -! output argument list: -! header_fix - header information structure -! header_chan - channel information structure -! data_name - diag file data names -! iflag - error code -! lverbose - optional flag to turn off default output to standard out -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ - -! Declare passed arguments - integer(i_kind),intent(in) :: ftin - integer(i_kind),intent(in) :: npred_radiag - logical,intent(in) :: retrieval - type(diag_header_fix_list ),intent(out):: header_fix - type(diag_header_chan_list),allocatable :: header_chan(:) - type(diag_data_name_list) :: data_name - integer(i_kind),intent(out) :: iflag - logical,optional,intent(in) :: lverbose - -! Declare local variables - character(len=2):: string - character(len=10):: satid,sentype - character(len=20):: sensat - integer(i_kind) :: i,ich - integer(i_kind):: jiter,nchanl,npred,ianldate,ireal,ipchan,iextra,jextra - integer(i_kind):: idiag,angord,iversion,inewpc,isens - integer(i_kind):: iuse_tmp,nuchan_tmp,iochan_tmp - real(r_single) :: freq_tmp,polar_tmp,wave_tmp,varch_tmp,tlapmean_tmp - logical loutall - - loutall=.true. - if(present(lverbose)) loutall=lverbose - -! Read header (fixed_part). - read(ftin,IOSTAT=iflag) sensat,satid,sentype,jiter,nchanl,npred,ianldate,& - ireal,ipchan,iextra,jextra,idiag,angord,iversion,inewpc,isens - if (iflag/=0) then - rewind(ftin) - read(ftin,IOSTAT=iflag) sensat,satid,sentype,jiter,nchanl,npred,ianldate,& - ireal,ipchan,iextra,jextra,idiag,angord,iversion,inewpc - isens=0 - end if - - if (iflag/=0) then - rewind(ftin) - read(ftin,IOSTAT=iflag) sensat,satid,sentype,jiter,nchanl,npred,ianldate,& - ireal,ipchan,iextra,jextra - idiag=ipchan+npred+1 - angord=0 - iversion=0 - inewpc=0 - isens=0 - if (iflag/=0) then - write(6,*)'READ_RADIAG_HEADER: ***ERROR*** Unknown file format. Cannot read' - return - endif - endif - - header_fix%isis = sensat - header_fix%id = satid - header_fix%obstype = sentype - header_fix%jiter = jiter - header_fix%nchan = nchanl - header_fix%npred = npred - header_fix%idate = ianldate - header_fix%ireal = ireal - header_fix%ipchan = ipchan - header_fix%iextra = iextra - header_fix%jextra = jextra - header_fix%idiag = idiag - header_fix%angord = angord - header_fix%iversion= iversion - header_fix%inewpc = inewpc - header_fix%isens = isens - - if (loutall) then - write(6,*)'READ_RADIAG_HEADER: isis=',header_fix%isis,& - ' nchan=',header_fix%nchan,& - ' npred=',header_fix%npred,& - ' angord=',header_fix%angord,& - ' idiag=',header_fix%idiag,& - ' iversion=',header_fix%iversion,& - ' inewpc=',header_fix%inewpc,& - ' isens=',header_fix%isens - - if ( header_fix%iextra /= 0) & - write(6,*)'READ_RADIAG_HEADER: extra diagnostic information available, ',& - 'iextra=',header_fix%iextra - end if - - if (header_fix%npred /= npred_radiag) & - write(6,*) 'READ_RADIAG_HEADER: **WARNING** header_fix%npred,npred=',& - header_fix%npred,npred_radiag - -! Allocate and initialize as needed - if (allocated(header_chan)) deallocate(header_chan) - if (allocated(data_name%chn)) deallocate(data_name%chn) - - allocate(header_chan( header_fix%nchan)) - allocate(data_name%chn(header_fix%idiag)) - - data_name%fix(1) ='lat ' - data_name%fix(2) ='lon ' - data_name%fix(3) ='zsges ' - data_name%fix(4) ='obstim ' - data_name%fix(5) ='scanpos ' - data_name%fix(6) ='satzen ' - data_name%fix(7) ='satazm ' - data_name%fix(8) ='solzen ' - data_name%fix(9) ='solazm ' - data_name%fix(10)='sungln ' - data_name%fix(11)='fwater ' - data_name%fix(12)='fland ' - data_name%fix(13)='fice ' - data_name%fix(14)='fsnow ' - data_name%fix(15)='twater ' - data_name%fix(16)='tland ' - data_name%fix(17)='tice ' - data_name%fix(18)='tsnow ' - data_name%fix(19)='tsoil ' - data_name%fix(20)='soilmoi ' - data_name%fix(21)='landtyp ' - data_name%fix(22)='vegfrac ' - data_name%fix(23)='snowdep ' - data_name%fix(24)='wndspd ' - data_name%fix(25)='qc1 ' - data_name%fix(26)='qc2 ' - data_name%fix(27)='tref ' - data_name%fix(28)='dtw ' - data_name%fix(29)='dtc ' - data_name%fix(30)='tz_tr ' - - data_name%chn(1)='obs ' - data_name%chn(2)='omgbc ' - data_name%chn(3)='omgnbc ' - data_name%chn(4)='errinv ' - data_name%chn(5)='qcmark ' - data_name%chn(6)='emiss ' - data_name%chn(7)='tlap ' - data_name%chn(8)='tb_tz ' - - if (header_fix%iversion < iversion_radiag_1) then - data_name%chn( 8)= 'bifix ' - data_name%chn( 9)= 'bilap ' - data_name%chn(10)= 'bilap2 ' - data_name%chn(11)= 'bicons ' - data_name%chn(12)= 'biang ' - data_name%chn(13)= 'biclw ' - if (retrieval) data_name%chn(13)= 'bisst ' - elseif ( header_fix%iversion < iversion_radiag_2 .and. header_fix%iversion >= iversion_radiag_1 ) then - data_name%chn( 8)= 'bicons ' - data_name%chn( 9)= 'biang ' - data_name%chn(10)= 'biclw ' - data_name%chn(11)= 'bilap2 ' - data_name%chn(12)= 'bilap ' - do i=1,header_fix%angord - write(string,'(i2.2)') header_fix%angord-i+1 - data_name%chn(12+i)= 'bifix' // string - end do - data_name%chn(12+header_fix%angord+1)= 'bifix ' - data_name%chn(12+header_fix%angord+2)= 'bisst ' - elseif ( header_fix%iversion < iversion_radiag_3 .and. header_fix%iversion >= iversion_radiag_2 ) then - data_name%chn( 9)= 'bicons ' - data_name%chn(10)= 'biang ' - data_name%chn(11)= 'biclw ' - data_name%chn(12)= 'bilap2 ' - data_name%chn(13)= 'bilap ' - do i=1,header_fix%angord - write(string,'(i2.2)') header_fix%angord-i+1 - data_name%chn(13+i)= 'bifix' // string - end do - data_name%chn(13+header_fix%angord+1)= 'bifix ' - data_name%chn(13+header_fix%angord+2)= 'bisst ' - elseif ( header_fix%iversion < iversion_radiag_4 .and. header_fix%iversion >= iversion_radiag_3 ) then - data_name%chn( 9)= 'bicons ' - data_name%chn(10)= 'biang ' - data_name%chn(11)= 'biclw ' - data_name%chn(12)= 'bilap2 ' - data_name%chn(13)= 'bilap ' - data_name%chn(14)= 'bicos ' - data_name%chn(15)= 'bisin ' - do i=1,header_fix%angord - write(string,'(i2.2)') header_fix%angord-i+1 - data_name%chn(15+i)= 'bifix' // string - end do - data_name%chn(15+header_fix%angord+1)= 'bifix ' - data_name%chn(15+header_fix%angord+2)= 'bisst ' - else - data_name%chn( 9)= 'bicons ' - data_name%chn(10)= 'biang ' - data_name%chn(11)= 'biclw ' - data_name%chn(12)= 'bilap2 ' - data_name%chn(13)= 'bilap ' - data_name%chn(14)= 'bicos ' - data_name%chn(15)= 'bisin ' - data_name%chn(16)= 'biemis ' - do i=1,header_fix%angord - write(string,'(i2.2)') header_fix%angord-i+1 - data_name%chn(16+i)= 'bifix' // string - end do - data_name%chn(16+header_fix%angord+1)= 'bifix ' - data_name%chn(16+header_fix%angord+2)= 'bisst ' - endif - -! Read header (channel part) - do ich=1, header_fix%nchan - read(ftin,IOSTAT=iflag) freq_tmp,polar_tmp,wave_tmp,varch_tmp,tlapmean_tmp,iuse_tmp,nuchan_tmp,iochan_tmp - header_chan(ich)%freq = freq_tmp - header_chan(ich)%polar = polar_tmp - header_chan(ich)%wave = wave_tmp - header_chan(ich)%varch = varch_tmp - header_chan(ich)%tlapmean = tlapmean_tmp - header_chan(ich)%iuse = iuse_tmp - header_chan(ich)%nuchan = nuchan_tmp - header_chan(ich)%iochan = iochan_tmp - if (iflag/=0) return - end do - -! Construct array containing menonics for data record entries - - -end subroutine read_radiag_header - -subroutine read_radiag_data(ftin,header_fix,retrieval,data_fix,data_chan,data_extra,iflag ) -! . . . . -! subprogram: read_radiag_dat read rad diag data -! prgmmr: tahara org: np20 date: 2003-01-01 -! -! abstract: This routine reads the data record from a radiance -! diagnostic file -! -! program history log: -! 2010-10-05 treadon - add this doc block -! 2011-02-22 kleist - changes related to memory allocation -! -! input argument list: -! ftin - unit number connected to diagnostic file -! header_fix - header information structure -! -! output argument list: -! data_fix - spot header information structure -! data_chan - spot channel information structure -! data_extra - spot extra information -! iflag - error code -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ - - -! Declare passed arguments - integer(i_kind),intent(in) :: ftin - type(diag_header_fix_list ),intent(in) :: header_fix - logical,intent(in) :: retrieval - type(diag_data_fix_list) ,intent(out):: data_fix - type(diag_data_chan_list) ,allocatable :: data_chan(:) - type(diag_data_extra_list) ,allocatable :: data_extra(:,:) - integer(i_kind),intent(out) :: iflag - - integer(i_kind) :: ich,iang,i,j - real(r_single),dimension(:,:),allocatable :: data_tmp - real(r_single),dimension(:),allocatable :: fix_tmp - real(r_single),dimension(:,:),allocatable :: extra_tmp - -! Allocate arrays as needed - if (allocated(data_chan)) deallocate(data_chan) - allocate(data_chan(header_fix%nchan)) - - do ich=1,header_fix%nchan - if (allocated(data_chan(ich)%bifix)) deallocate(data_chan(ich)%bifix) - allocate(data_chan(ich)%bifix(header_fix%angord+1)) - end do - - if (header_fix%iextra > 0) then - if (allocated(data_extra)) deallocate(data_extra) - allocate(data_extra(header_fix%iextra,header_fix%jextra)) - allocate(extra_tmp(header_fix%iextra,header_fix%jextra)) - end if - -! Allocate arrays to hold data record - allocate(data_tmp(header_fix%idiag,header_fix%nchan)) - - if (header_fix%iversion < iversion_radiag_2) then - allocate( fix_tmp( ireal_old_radiag ) ) - else - allocate( fix_tmp( ireal_radiag ) ) - end if - -! Read data record - - if (header_fix%iextra == 0) then - read(ftin,IOSTAT=iflag) fix_tmp, data_tmp - else - read(ftin,IOSTAT=iflag) fix_tmp, data_tmp, extra_tmp - endif - - -! Transfer fix_tmp record to output structure - data_fix%lat = fix_tmp(1) - data_fix%lon = fix_tmp(2) - data_fix%zsges = fix_tmp(3) - data_fix%obstime = fix_tmp(4) - data_fix%senscn_pos = fix_tmp(5) - data_fix%satzen_ang = fix_tmp(6) - data_fix%satazm_ang = fix_tmp(7) - data_fix%solzen_ang = fix_tmp(8) - data_fix%solazm_ang = fix_tmp(9) - data_fix%sungln_ang = fix_tmp(10) - data_fix%water_frac = fix_tmp(11) - data_fix%land_frac = fix_tmp(12) - data_fix%ice_frac = fix_tmp(13) - data_fix%snow_frac = fix_tmp(14) - data_fix%water_temp = fix_tmp(15) - data_fix%land_temp = fix_tmp(16) - data_fix%ice_temp = fix_tmp(17) - data_fix%snow_temp = fix_tmp(18) - data_fix%soil_temp = fix_tmp(19) - data_fix%soil_mois = fix_tmp(20) - data_fix%land_type = fix_tmp(21) - data_fix%veg_frac = fix_tmp(22) - data_fix%snow_depth = fix_tmp(23) - data_fix%sfc_wndspd = fix_tmp(24) - data_fix%qcdiag1 = fix_tmp(25) - data_fix%qcdiag2 = fix_tmp(26) - - if ( header_fix%iversion <= iversion_radiag_1 ) then - data_fix%tref = rmiss_radiag - data_fix%dtw = rmiss_radiag - data_fix%dtc = rmiss_radiag - data_fix%tz_tr = rmiss_radiag - else - data_fix%tref = fix_tmp(27) - data_fix%dtw = fix_tmp(28) - data_fix%dtc = fix_tmp(29) - data_fix%tz_tr = fix_tmp(30) - end if - - -! Transfer data record to output structure - do ich=1,header_fix%nchan - data_chan(ich)%tbobs =data_tmp(1,ich) - data_chan(ich)%omgbc =data_tmp(2,ich) - data_chan(ich)%omgnbc=data_tmp(3,ich) - data_chan(ich)%errinv=data_tmp(4,ich) - data_chan(ich)%qcmark=data_tmp(5,ich) - data_chan(ich)%emiss =data_tmp(6,ich) - data_chan(ich)%tlap =data_tmp(7,ich) - data_chan(ich)%tb_tz =data_tmp(8,ich) - end do - if (header_fix%iversion < iversion_radiag_1) then - do ich=1,header_fix%nchan - data_chan(ich)%bifix(1)=data_tmp(8,ich) - data_chan(ich)%bilap =data_tmp(9,ich) - data_chan(ich)%bilap2 =data_tmp(10,ich) - data_chan(ich)%bicons =data_tmp(11,ich) - data_chan(ich)%biang =data_tmp(12,ich) - data_chan(ich)%biclw =data_tmp(13,ich) - data_chan(ich)%bisst = rmiss_radiag - if (retrieval) then - data_chan(ich)%biclw =rmiss_radiag - data_chan(ich)%bisst =data_tmp(13,ich) - endif - end do - elseif ( header_fix%iversion < iversion_radiag_2 .and. header_fix%iversion >= iversion_radiag_1 ) then - do ich=1,header_fix%nchan - data_chan(ich)%bicons=data_tmp(8,ich) - data_chan(ich)%biang =data_tmp(9,ich) - data_chan(ich)%biclw =data_tmp(10,ich) - data_chan(ich)%bilap2=data_tmp(11,ich) - data_chan(ich)%bilap =data_tmp(12,ich) - end do - do ich=1,header_fix%nchan - do iang=1,header_fix%angord+1 - data_chan(ich)%bifix(iang)=data_tmp(12+iang,ich) - end do - data_chan(ich)%bisst = data_tmp(12+header_fix%angord+2,ich) - end do - elseif ( header_fix%iversion < iversion_radiag_3 .and. header_fix%iversion >= iversion_radiag_2 ) then - do ich=1,header_fix%nchan - data_chan(ich)%bicons=data_tmp(9,ich) - data_chan(ich)%biang =data_tmp(10,ich) - data_chan(ich)%biclw =data_tmp(11,ich) - data_chan(ich)%bilap2=data_tmp(12,ich) - data_chan(ich)%bilap =data_tmp(13,ich) - end do - do ich=1,header_fix%nchan - do iang=1,header_fix%angord+1 - data_chan(ich)%bifix(iang)=data_tmp(13+iang,ich) - end do - data_chan(ich)%bisst = data_tmp(13+header_fix%angord+2,ich) - end do - elseif ( header_fix%iversion < iversion_radiag_4 .and. header_fix%iversion >= iversion_radiag_3 ) then - do ich=1,header_fix%nchan - data_chan(ich)%bicons=data_tmp(9,ich) - data_chan(ich)%biang =data_tmp(10,ich) - data_chan(ich)%biclw =data_tmp(11,ich) - data_chan(ich)%bilap2=data_tmp(12,ich) - data_chan(ich)%bilap =data_tmp(13,ich) - data_chan(ich)%bicos =data_tmp(14,ich) ! 1st bias correction term node*cos(lat) for SSMIS - data_chan(ich)%bisin =data_tmp(15,ich) ! 2nd bias correction term sin(lat) for SSMI - end do - do ich=1,header_fix%nchan - do iang=1,header_fix%angord+1 - data_chan(ich)%bifix(iang)=data_tmp(15+iang,ich) - end do - data_chan(ich)%bisst = data_tmp(15+header_fix%angord+2,ich) - end do - else - do ich=1,header_fix%nchan - data_chan(ich)%bicons=data_tmp(9,ich) - data_chan(ich)%biang =data_tmp(10,ich) - data_chan(ich)%biclw =data_tmp(11,ich) - data_chan(ich)%bilap2=data_tmp(12,ich) - data_chan(ich)%bilap =data_tmp(13,ich) - data_chan(ich)%bicos =data_tmp(14,ich) - data_chan(ich)%bisin =data_tmp(15,ich) - data_chan(ich)%biemis=data_tmp(16,ich) - end do - do ich=1,header_fix%nchan - do iang=1,header_fix%angord+1 - data_chan(ich)%bifix(iang)=data_tmp(16+iang,ich) - end do - data_chan(ich)%bisst = data_tmp(16+header_fix%angord+2,ich) - end do - endif - - if (header_fix%iextra > 0) then - do j=1,header_fix%jextra - do i=1,header_fix%iextra - data_extra(i,j)%extra=extra_tmp(i,j) - end do - end do - endif - - deallocate(data_tmp, fix_tmp) - if (header_fix%iextra > 0) deallocate(extra_tmp) - -end subroutine read_radiag_data - -end module read_diag - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radang.fd/readme b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radang.fd/readme deleted file mode 100644 index da9740f8d3..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radang.fd/readme +++ /dev/null @@ -1,25 +0,0 @@ -Instructions for building radmon_angle executable. - - 1) Load the build module appropriate for your Machine: - i.) - WCOSS: - "module use -a ../../modulefiles/wcoss" - CRAY: - "module use -a ../../modulefiles/cray" - THEIA: - "module use -a ../../modulefiles/theia" - ii.) - "module load RadMonBuild" - - 2) Optional: verify all prerequisites are met by typing: - "make check_prereqs" - - 3) Build the executable by typing: - "make" - - 4) Move the executable to the ../../exec directory by typing: - "make install" - - 5) Unload the build module: - "module unload RadMonBuild" - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radbcoef.fd/CMakeLists.txt b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radbcoef.fd/CMakeLists.txt deleted file mode 100644 index d8aae200c7..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radbcoef.fd/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ -cmake_minimum_required(VERSION 2.6) - file(GLOB RADMON_BCOEF_SRC ${CMAKE_CURRENT_SOURCE_DIR}/*90 ) - set(RADMON_BCOEF_Fortran_FLAGS "-fp-model strict -assume byterecl -convert big_endian -O3 -traceback -D_REAL8_ ") - set(Util_MODULE_DIR ${PROJECT_BINARY_DIR}/include/radmon_bcoef ) - set_source_files_properties( ${RADMON_BCOEF_SRC} PROPERTIES COMPILE_FLAGS ${RADMON_BCOEF_Fortran_FLAGS} ) - add_executable(radmon_bcoef ${RADMON_BCOEF_SRC} ) - set_target_properties( radmon_bcoef PROPERTIES COMPILE_FLAGS ${RADMON_BCOEF_Fortran_FLAGS} ) - set_target_properties( radmon_bcoef PROPERTIES Fortran_MODULE_DIRECTORY ${Util_MODULE_DIR} ) - include_directories( ${CORE_INCS} ) - target_link_libraries( radmon_bcoef ${W3NCO_4_LIBRARY} ) - if(BUILD_W3NCO) - add_dependencies( radmon_bcoef ${W3NCO_4_LIBRARY} ) - endif() - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radbcoef.fd/bcoef.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radbcoef.fd/bcoef.f90 deleted file mode 100755 index 655fbbbf07..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radbcoef.fd/bcoef.f90 +++ /dev/null @@ -1,359 +0,0 @@ -program bcoef - use read_diag - use kinds, only: r_kind,i_kind,r_quad - - implicit none - integer ntype,maxpred - parameter (ntype=13) - parameter (maxpred=12) - - logical eof - - character(10),dimension(ntype):: ftype - character(20) dum,satname,stringd,satsis,isis,mod_satname - character(10) satype,dplat - character(40) string,diag_rad,data_file,ctl_file - character(10) suffix - - integer luname,lungrd,lunctl,lncoef,lndiag,ich - integer iyy,imm,idd,ihh,idhh,incr,iread,iflag - integer n_chan,j,i,k,idum,ichan - integer,allocatable,dimension(:):: io_chan,nu_chan - integer npred_radiag - integer(i_kind) angord,ntlapupdate - - real pen,rmiss,weight,rread - real,allocatable,dimension(:):: wavenumbr,count,error,& - use,frequency,penalty,predr - real,allocatable,dimension(:,:):: coefs - real(r_kind) tlapm, tsum - -! Variables for reading satellite data - type(diag_header_fix_list ) :: header_fix - type(diag_header_chan_list),allocatable :: header_chan(:) - type(diag_data_name_list ) :: data_name - type(diag_data_fix_list ) :: data_fix - type(diag_data_chan_list ),allocatable :: data_chan(:) - type(diag_data_extra_list ),allocatable :: data_extra(:,:) - -! Namelist with defaults - integer :: npredr = 12 - logical :: retrieval = .false. - integer :: nchanl = 19 - integer :: imkctl = 1 - integer :: imkdata = 1 - character(3) :: gesanl ='ges' - integer :: little_endian = 1 - namelist /input/ satname,npredr,nchanl,iyy,imm,idd,ihh,idhh,& - incr,suffix,imkctl,imkdata,retrieval,gesanl,little_endian - - data luname,lungrd,lunctl / 5, 51, 52 / - data lncoef,lndiag / 21, 22 / - data rmiss /-999./ - data stringd / '.%y4%m2%d2%h2' / -!************************************************************************ -! Explanation of the fype array -! These are values used within the generated GrADS control file -! (bcoef.ctl). A fuller discription of the terms is thus: -! -! mean pred(1) = global offset (mean) -! atmpath pred(2) = not used when adp_anglebc=.true. and newpc4pred=.true. -! clw pred(3) = cloud liquid water term -! lapse2 pred(4) = (temperature lapse rate)**2 -! lapse pred(5) = temperature lapse rate -! cos_ssmis pred(6) = cosine term for SSMIS -! sin_ssmis pred(7) = sine term for SSMIS -! emiss pred(8) = emissivity sensitivity term -! ordang4 pred(9) = 4th order angle term -! ordang3 pred(10) = 3rd order angle term -! ordang2 pred(11) = 2nd order angle term -! ordang1 pred(12) = 1st order angle term -! -! Note that the npred namelist indicates how many of these terms -! will to be processed by this program. The default value is 12, -! meaning all will be processed. Earlier versions processed only the -! first 5. In all cases 12 values will be written to the resulting -! data file though if npred < 12 then the unprocessed values will -! all be set to rmiss. -!************************************************************************ - data ftype / 'penalty','mean','atmpath','clw','lapse2','lapse',& - 'cos_ssmis','sin_ssmis','emiss','ordang4','ordang3',& - 'ordang2','ordang1' / -!************************************************************************ -! - - -!************************************************************************ -! -! Initialize variables - iread=0 - npred_radiag = 12 - angord = 0 - -! Read namelist input - read(luname,input) - write(6,input) - write(6,*)'gesanl = ', gesanl - write(6,*)' ' - -! Check for user requests exceeding assumed limits - if (npredr>maxpred) then - write(6,*)' ' - write(6,*)'***ERROR*** user specified predictors > maximum allowed' - write(6,*)' npredr,maxpred=',npredr,maxpred - call errexit(91) - endif - - -! Set satellite id for specified satellite/sensor - write(6,*)'satname ',satname - - -! Create filenames for diagnostic input, binary output file - write(stringd,100) iyy,imm,idd,ihh -100 format('.',i4.4,3i2.2) - - if ( trim(gesanl) == 'ges' ) then - diag_rad = trim(satname) - data_file= trim(satname) // trim(stringd) // '.ieee_d' - ctl_file = trim(satname) // '.ctl' - else - diag_rad = trim(satname) // '_anl' - data_file= trim(satname) // '_anl' // trim(stringd) // '.ieee_d' - ctl_file = trim(satname) // '_anl.ctl' - endif - - write(6,*)'diag_rad =',diag_rad - write(6,*)'data_file=',data_file - write(6,*)'ctl_file =',ctl_file - write(6,*)'suffix =',suffix - - -! Open unit to diagnostic file. Read portion of header to -! see if file exists - open(lndiag,file=diag_rad,form='unformatted') - read(lndiag,err=900,end=900) dum - rewind lndiag - -! File exists. Read header - write(6,*)'call read_diag_header' - call read_radiag_header( lndiag, npred_radiag, retrieval, header_fix,& - header_chan, data_name, iflag ) - if( iflag/=0 ) then - write(6,*)'***ERROR*** problem reading diag file header, iflag=',iflag - call errexit(91) - endif - -! Extract observation type, satellite id, and number of channels - satype = header_fix%obstype - satsis = header_fix%isis - dplat = header_fix%id - n_chan = header_fix%nchan - angord = header_fix%angord - - if (angord == 4 ) then - npredr = 12 - endif - - write(6,*)'satype,n_chan=',satype,' ',dplat,n_chan - write(6,*)'angord = ', angord - - string = trim(satype)//'_'//trim(dplat) - write(6,*)'string,satname=',string,' ',satname - if ( trim(string) /= trim(satname) ) then - write(6,*)'***ERROR*** inconsistent instrument types' - write(6,*)' satname,string =',satname,' ',string - call errexit(93) - endif - - -! Allocate arrays to hold observational information - write(6,*)' ' - write(6,*)'allocate arrays' - allocate (io_chan(n_chan), nu_chan(n_chan), wavenumbr(n_chan)) - allocate (count(n_chan), penalty(n_chan), use(n_chan), & - frequency(n_chan)) - allocate(coefs(n_chan,maxpred)) - -! Zero accumulator arrays - do j=1,n_chan - count(j) = 0.0 - penalty(j) = 0.0 - end do - coefs = rmiss - - -! Extract satinfo relative index - do j=1,n_chan - nu_chan(j) = real( header_chan(j)%nuchan, 4 ) - io_chan(j) = real( header_chan(j)%iochan, 4 ) - wavenumbr(j) = real( header_chan(j)%wave, 4 ) - use(j) = real( header_chan(j)%iuse, 4 ) - frequency(j) = real( header_chan(j)%freq, 4) - end do - -! Loop to read entries in diagnostic file - iflag = 0 - loopd: do while (iflag == 0) - -! Read a record. If read flag, iflag does not equal zero, exit loopd - call read_radiag_data( lndiag, header_fix, retrieval, data_fix, data_chan,& - data_extra, iflag ) - if( iflag /= 0 ) exit loopd - iread=iread+1 - rread=rread+1.0 - - -! Channel loop - do j = 1, n_chan - -! If observation was assimilated, accumulate sum - if (data_chan(j)%errinv > 1.e-6) then -! pen = data_chan(j)%errinv*(data_chan(j)%omgbc)**2 - pen = (data_chan(j)%errinv*(data_chan(j)%omgbc))**2 - count(j) = count(j) + 1.0 - penalty(j) = penalty(j) + pen - endif - - enddo ! channel loop - -! End of loop over diagnostic file - enddo loopd - close(lndiag) - write(6,*)' ' - write(6,*)'read in ',iread,' obs ',rread - write(6,*)' ' - -! Compute average. - do j=1,n_chan - if (count(j)>0) then - penalty(j)=penalty(j)/count(j) - else - count(j)=rmiss - penalty(j)=rmiss - endif - end do - - -! Open unit to input data file. See if file exists - open(lncoef,file='biascr.txt',form='formatted') - if (angord == 4 ) then - read(lncoef,122,end=920,err=920) idum - else - read(lncoef,120,end=920,err=920) idum - endif - rewind(lncoef) -120 format(I5,1x,A20,1x,I5,10f12.6) -122 format(I5,1x,A20,1x,I5,2e15.6,1x,I5/2(4x,10f12.6/)) - -!read(lunin,'(I5,1x,A20,1x,I5,2e15.6,1x,I5/2(4x,10f12.6/))',iostat=istat,end=1333) -!ich,isis,& ichan,tlapm,tsum,ntlapupdate,(predr(ip),ip=1,npred), where npred=12 - -! Read coefficient file - allocate(predr(npredr)) - i=0 - k=1 - eof=.false. - do - if (angord /= 4 ) then - read(lncoef,120,IOSTAT=iflag) ich,isis,ichan,(predr(j),j=1,npredr) - else - read(lncoef,122,IOSTAT=iflag) ich,isis,ichan, tlapm,tsum,ntlapupdate,(predr(j),j=1,npredr) - endif - if(iflag /=0) exit - if (trim(isis)==trim(satsis)) then - - if ( k <= n_chan ) then - io_chan(k)=ichan - do j=1,npredr - coefs(k,j)=predr(j) - end do - endif - - k=k+1 - cycle - endif - end do - close(lncoef) - deallocate(predr) - - ! Create Control file - if ( imkctl == 1 ) then - write(6,*)'call create_ctl_bcoef' - - if ( trim(gesanl) == 'ges' ) then - mod_satname = trim(satname) - else - mod_satname = trim(satname) // '_anl' - endif - - call create_ctl_bcoef(ntype,ftype,n_chan,iyy,imm,idd,ihh,idhh,& - incr,ctl_file,lunctl,rmiss,mod_satname,satype,dplat,& - nu_chan,use,penalty,frequency,wavenumbr,little_endian) - else - write(6,*) 'imkctl =',imkctl - endif - - -! Write data to binary output file - if ( imkdata == 1 ) then - write(6,*)'write data to lungrd=',lungrd - open(lungrd,file=data_file,form='unformatted') - write(lungrd) (penalty(k),k=1,n_chan) - do j=1,maxpred - write(lungrd) (coefs(k,j),k=1,n_chan) - end do - close(lungrd) - endif - -! Deallocate arrays - write(6,*)'deallocate arrays' - deallocate(coefs,io_chan,nu_chan,wavenumbr,count,penalty,use,frequency) - goto 950 - - -! Jump here if problem reading diagnostic file -900 continue - write(6,*)'***PROBLEM*** reading diagnostic file' - - n_chan=nchanl - if (n_chan<=0) then - write(6,*)'***ERROR*** invalid nchanl=',nchanl,' STOP program' - call errexit(94) - endif - - write(6,*)'load missing value ',rmiss,' into output arrays. ',& - n_chan,npredr - allocate(penalty(n_chan),coefs(n_chan,npredr)) - do k=1,n_chan - penalty(k)=rmiss - end do - do j=1,npredr - do k=1,n_chan - coefs(k,j)=rmiss - end do - end do - - if ( imkdata == 1 ) then - open(lungrd,file=data_file,form='unformatted') - write(lungrd) (penalty(k),k=1,n_chan) - do j=1,npredr - write(lungrd) (coefs(k,j),k=1,n_chan) - end do - write(6,*)'write output to lungrd=',lungrd,', file=',trim(data_file) - close(lungrd) - endif - deallocate(penalty,coefs) - - goto 950 - - -! Jump here if problem reading coefficient file -920 continue - write(6,*)'***PROBLEM*** reading coefficient file' - - -! End of program -950 continue - stop -end program bcoef diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radbcoef.fd/kinds.F90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radbcoef.fd/kinds.F90 deleted file mode 100644 index 8b3a2fcc4e..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radbcoef.fd/kinds.F90 +++ /dev/null @@ -1,112 +0,0 @@ -module kinds -!$$$ module documentation block -! . . . . -! module: kinds -! prgmmr: treadon org: np23 date: 2004-08-15 -! -! abstract: Module to hold specification kinds for variable declaration. -! This module is based on (copied from) Paul vanDelst's -! type_kinds module found in the community radiative transfer -! model -! -! module history log: -! 2004-08-15 treadon -! 2011-07-04 todling - define main precision during compilation -! -! Subroutines Included: -! -! Functions Included: -! -! remarks: -! The numerical data types defined in this module are: -! i_byte - specification kind for byte (1-byte) integer variable -! i_short - specification kind for short (2-byte) integer variable -! i_long - specification kind for long (4-byte) integer variable -! i_llong - specification kind for double long (8-byte) integer variable -! r_single - specification kind for single precision (4-byte) real variable -! r_double - specification kind for double precision (8-byte) real variable -! r_quad - specification kind for quad precision (16-byte) real variable -! -! i_kind - generic specification kind for default integer -! r_kind - generic specification kind for default floating point -! -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ end documentation block - implicit none - private - -! Integer type definitions below - -! Integer types - integer, parameter, public :: i_byte = selected_int_kind(1) ! byte integer - integer, parameter, public :: i_short = selected_int_kind(4) ! short integer - integer, parameter, public :: i_long = selected_int_kind(8) ! long integer - integer, parameter, private :: llong_t = selected_int_kind(16) ! llong integer - integer, parameter, public :: i_llong = max( llong_t, i_long ) - -! Expected 8-bit byte sizes of the integer kinds - integer, parameter, public :: num_bytes_for_i_byte = 1 - integer, parameter, public :: num_bytes_for_i_short = 2 - integer, parameter, public :: num_bytes_for_i_long = 4 - integer, parameter, public :: num_bytes_for_i_llong = 8 - -! Define arrays for default definition - integer, parameter, private :: num_i_kinds = 4 - integer, parameter, dimension( num_i_kinds ), private :: integer_types = (/ & - i_byte, i_short, i_long, i_llong /) - integer, parameter, dimension( num_i_kinds ), private :: integer_byte_sizes = (/ & - num_bytes_for_i_byte, num_bytes_for_i_short, & - num_bytes_for_i_long, num_bytes_for_i_llong /) - -! Default values -! **** CHANGE THE FOLLOWING TO CHANGE THE DEFAULT INTEGER TYPE KIND *** - integer, parameter, private :: default_integer = 3 ! 1=byte, - ! 2=short, - ! 3=long, - ! 4=llong - integer, parameter, public :: i_kind = integer_types( default_integer ) - integer, parameter, public :: num_bytes_for_i_kind = & - integer_byte_sizes( default_integer ) - - -! Real definitions below - -! Real types - integer, parameter, public :: r_single = selected_real_kind(6) ! single precision - integer, parameter, public :: r_double = selected_real_kind(15) ! double precision - integer, parameter, private :: quad_t = selected_real_kind(20) ! quad precision - integer, parameter, public :: r_quad = max( quad_t, r_double ) - -! Expected 8-bit byte sizes of the real kinds - integer, parameter, public :: num_bytes_for_r_single = 4 - integer, parameter, public :: num_bytes_for_r_double = 8 - integer, parameter, public :: num_bytes_for_r_quad = 16 - -! Define arrays for default definition - integer, parameter, private :: num_r_kinds = 3 - integer, parameter, dimension( num_r_kinds ), private :: real_kinds = (/ & - r_single, r_double, r_quad /) - integer, parameter, dimension( num_r_kinds ), private :: real_byte_sizes = (/ & - num_bytes_for_r_single, num_bytes_for_r_double, & - num_bytes_for_r_quad /) - -! Default values -! **** CHANGE THE FOLLOWING TO CHANGE THE DEFAULT REAL TYPE KIND *** -#ifdef _REAL4_ - integer, parameter, private :: default_real = 1 ! 1=single, -#endif -#ifdef _REAL8_ - integer, parameter, private :: default_real = 2 ! 2=double, -#endif -#ifdef _REAL16_ - integer, parameter, private :: default_real = 3 ! 3=quad -#endif - integer, parameter, public :: r_kind = real_kinds( default_real ) - integer, parameter, public :: num_bytes_for_r_kind = & - real_byte_sizes( default_real ) - -end module kinds diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radbcoef.fd/makefile b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radbcoef.fd/makefile deleted file mode 100755 index 333992f36d..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radbcoef.fd/makefile +++ /dev/null @@ -1,49 +0,0 @@ -# ***************************************************************** -# makefile.bcoef -# -# Make the radmon_bcoef executable. -# -# ***************************************************************** - -BINDIR = ${dir_root}/exec - -LIBS = $(W3NCO_LIB4) - -OBJS = kinds.o read_diag.o bcoef.o create_ctl_bcoef.o - -# -# ***************************************************************** -# - -CMD = radmon_bcoef - -all: $(CMD) - -clean: - rm -f *.o - rm -f *.mod - rm -f radmon_bcoef - -check_prereqs: - $(CHECK_LIBS) $(LIBS) - -install: - cp -f $(CMD) $(BINDIR)/ - -debug: FFLAGS = $(D_FFLAGS) -debug: $(CMD) - -$(CMD): $(OBJS) - $(CF) $(FFLAGS) $(LDFLAGS) -o $(@) $(OBJS) $(LIBS) - -read_diag.o : read_diag.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -bcoef.o : bcoef.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -create_ctl_bcoef.o : create_ctl_bcoef.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -kinds.o : kinds.F90 - $(CF) $(FFLAGS) -c $(*).F90 diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radbcoef.fd/read_diag.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radbcoef.fd/read_diag.f90 deleted file mode 100755 index 7a4d6cdc49..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radbcoef.fd/read_diag.f90 +++ /dev/null @@ -1,659 +0,0 @@ -!$$$ subprogram documentation block -! . . . . -! subprogram: read_raddiag read rad diag file -! prgmmr: tahara org: np20 date: 2003-01-01 -! -! abstract: This module contains code to process radiance -! diagnostic files. The module defines structures -! to contain information from the radiance -! diagnostic files and then provides two routines -! to access contents of the file. -! -! program history log: -! 2005-07-22 treadon - add this doc block -! 2010-10-05 treadon - refactor code to GSI standard -! 2010-10-08 zhu - use data_tmp to handle various npred values -! 2011-02-22 kleist - changes related to memory allocate/deallocate -! 2011-04-08 li - add tref, dtw, dtc to diag_data_fix_list, add tb_tz to diag_data_chan_list -! - correspondingly, change ireal_radiag (26 -> 30) and ipchan_radiag (7 -> 8) -! 2011-07-24 safford - make structure size for reading data_fix data version dependent -! 2013-11-21 todling - revisit how versions are set (add set/get_radiag) -! 2014-01-27 todling - add ob sensitivity index -! -! contains -! read_radiag_header - read radiance diagnostic file header -! read_radiag_data - read radiance diagnostic file data -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ - -module read_diag - - use kinds, only: i_kind,r_single - implicit none - -! Declare public and private - private - - public :: diag_header_fix_list - public :: diag_header_chan_list - public :: diag_data_name_list - public :: diag_data_fix_list - public :: diag_data_chan_list - public :: diag_data_extra_list - public :: read_radiag_header - public :: read_radiag_data -! public :: iversion_radiag -! public :: iversion_radiag_1 -! public :: iversion_radiag_2 -! public :: iversion_radiag_3 -! public :: iversion_radiag_4 - public :: ireal_radiag - public :: ipchan_radiag - public :: set_radiag - public :: get_radiag - - interface set_radiag - module procedure set_radiag_int_ ! internal procedure for integers - end interface - interface get_radiag - module procedure get_radiag_int_ ! internal procedure for integers - end interface - - integer(i_kind),parameter :: ireal_radiag = 30 ! number of real entries per spot in radiance diagnostic file - integer(i_kind),parameter :: ireal_old_radiag = 26 ! number of real entries per spot in versions older than iversion_radiag_2 - integer(i_kind),parameter :: ipchan_radiag = 8 ! number of entries per channel per spot in radiance diagnostic file - -! Declare structures for radiance diagnostic file information - type diag_header_fix_list - character(len=20) :: isis ! sat and sensor type - character(len=10) :: id ! sat type - character(len=10) :: obstype ! observation type - integer(i_kind) :: jiter ! outer loop counter - integer(i_kind) :: nchan ! number of channels in the sensor - integer(i_kind) :: npred ! number of updating bias correction predictors - integer(i_kind) :: idate ! time (yyyymmddhh) - integer(i_kind) :: ireal ! # of real elements in the fix part of a data record - integer(i_kind) :: ipchan ! # of elements for each channel except for bias correction terms - integer(i_kind) :: iextra ! # of extra elements for each channel - integer(i_kind) :: jextra ! # of extra elements - integer(i_kind) :: idiag ! first dimension of diag_data_chan - integer(i_kind) :: angord ! order of polynomial for adp_anglebc option - integer(i_kind) :: iversion ! radiance diagnostic file version number - integer(i_kind) :: inewpc ! indicator of newpc4pred (1 on, 0 off) - integer(i_kind) :: isens ! sensitivity index - end type diag_header_fix_list - - type diag_data_name_list - character(len=10),dimension(ireal_radiag) :: fix - character(len=10),dimension(:),allocatable :: chn - end type diag_data_name_list - - type diag_header_chan_list - real(r_single) :: freq ! frequency (Hz) - real(r_single) :: polar ! polarization - real(r_single) :: wave ! wave number (cm^-1) - real(r_single) :: varch ! error variance (or SD error?) - real(r_single) :: tlapmean ! mean lapse rate - integer(i_kind):: iuse ! use flag - integer(i_kind):: nuchan ! sensor relative channel number - integer(i_kind):: iochan ! satinfo relative channel number - end type diag_header_chan_list - - type diag_data_fix_list - real(r_single) :: lat ! latitude (deg) - real(r_single) :: lon ! longitude (deg) - real(r_single) :: zsges ! guess elevation at obs location (m) - real(r_single) :: obstime ! observation time relative to analysis - real(r_single) :: senscn_pos ! sensor scan position (integer(i_kind)) - real(r_single) :: satzen_ang ! satellite zenith angle (deg) - real(r_single) :: satazm_ang ! satellite azimuth angle (deg) - real(r_single) :: solzen_ang ! solar zenith angle (deg) - real(r_single) :: solazm_ang ! solar azimumth angle (deg) - real(r_single) :: sungln_ang ! sun glint angle (deg) - real(r_single) :: water_frac ! fractional coverage by water - real(r_single) :: land_frac ! fractional coverage by land - real(r_single) :: ice_frac ! fractional coverage by ice - real(r_single) :: snow_frac ! fractional coverage by snow - real(r_single) :: water_temp ! surface temperature over water (K) - real(r_single) :: land_temp ! surface temperature over land (K) - real(r_single) :: ice_temp ! surface temperature over ice (K) - real(r_single) :: snow_temp ! surface temperature over snow (K) - real(r_single) :: soil_temp ! soil temperature (K) - real(r_single) :: soil_mois ! soil moisture - real(r_single) :: land_type ! land type (integer(i_kind)) - real(r_single) :: veg_frac ! vegetation fraction - real(r_single) :: snow_depth ! snow depth - real(r_single) :: sfc_wndspd ! surface wind speed - real(r_single) :: qcdiag1 ! ir=cloud fraction, mw=cloud liquid water - real(r_single) :: qcdiag2 ! ir=cloud top pressure, mw=total column water - real(r_single) :: tref ! reference temperature (Tr) in NSST - real(r_single) :: dtw ! dt_warm at zob - real(r_single) :: dtc ! dt_cool at zob - real(r_single) :: tz_tr ! d(Tz)/d(Tr) - end type diag_data_fix_list - - type diag_data_chan_list - real(r_single) :: tbobs ! Tb (obs) (K) - real(r_single) :: omgbc ! Tb_(obs) - Tb_(simulated w/ bc) (K) - real(r_single) :: omgnbc ! Tb_(obs) - Tb_(simulated_w/o bc) (K) - real(r_single) :: errinv ! inverse error (K**(-1)) - real(r_single) :: qcmark ! quality control mark - real(r_single) :: emiss ! surface emissivity - real(r_single) :: tlap ! temperature lapse rate - real(r_single) :: tb_tz ! d(Tb)/d(Tz) - real(r_single) :: bicons ! constant bias correction term - real(r_single) :: biang ! scan angle bias correction term - real(r_single) :: biclw ! CLW bias correction term - real(r_single) :: bilap2 ! square lapse rate bias correction term - real(r_single) :: bilap ! lapse rate bias correction term - real(r_single) :: bicos ! node*cos(lat) bias correction term - real(r_single) :: bisin ! sin(lat) bias correction term - real(r_single) :: biemis ! emissivity sensitivity bias correction term - real(r_single),dimension(:),allocatable :: bifix ! angle dependent bias - real(r_single) :: bisst ! SST bias correction term - end type diag_data_chan_list - - type diag_data_extra_list - real(r_single) :: extra ! extra information - end type diag_data_extra_list - - integer(i_kind),save :: iversion_radiag ! Current version (see set routine) - integer(i_kind),parameter:: iversion_radiag_1 = 11104 ! Version when bias-correction entries were modified - integer(i_kind),parameter:: iversion_radiag_2 = 13784 ! Version when NSST entries were added - integer(i_kind),parameter:: iversion_radiag_3 = 19180 ! Version when SSMIS added - integer(i_kind),parameter:: iversion_radiag_4 = 30303 ! Version when emissivity predictor added - - real(r_single),parameter:: rmiss_radiag = -9.9e11_r_single - -contains - -subroutine set_radiag_int_ (what,iv,ier) -character(len=*),intent(in) :: what -integer(i_kind),intent(in) :: iv -integer(i_kind),intent(out):: ier -ier=-1 -if(trim(what)=='version') then - iversion_radiag = iv - ier=0 -endif -end subroutine set_radiag_int_ - -subroutine get_radiag_int_ (what,iv,ier) -character(len=*),intent(in) :: what -integer(i_kind),intent(out):: iv -integer(i_kind),intent(out):: ier -ier=-1 -if(trim(what)=='version') then - iv = iversion_radiag - ier=0 -endif -end subroutine get_radiag_int_ - -subroutine read_radiag_header(ftin,npred_radiag,retrieval,header_fix,header_chan,data_name,iflag,lverbose) -! . . . . -! subprogram: read_diag_header read rad diag header -! prgmmr: tahara org: np20 date: 2003-01-01 -! -! abstract: This routine reads the header record from a radiance -! diagnostic file -! -! program history log: -! 2010-10-05 treadon - add this doc block -! 2011-02-22 kleist - changes related to memory allocation and standard output -! -! input argument list: -! ftin - unit number connected to diagnostic file -! npred_radiag - number of bias correction terms -! retrieval - .true. if sst retrieval -! -! output argument list: -! header_fix - header information structure -! header_chan - channel information structure -! data_name - diag file data names -! iflag - error code -! lverbose - optional flag to turn off default output to standard out -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ - -! Declare passed arguments - integer(i_kind),intent(in) :: ftin - integer(i_kind),intent(in) :: npred_radiag - logical,intent(in) :: retrieval - type(diag_header_fix_list ),intent(out):: header_fix - type(diag_header_chan_list),allocatable :: header_chan(:) - type(diag_data_name_list) :: data_name - integer(i_kind),intent(out) :: iflag - logical,optional,intent(in) :: lverbose - -! Declare local variables - character(len=2):: string - character(len=10):: satid,sentype - character(len=20):: sensat - integer(i_kind) :: i,ich - integer(i_kind):: jiter,nchanl,npred,ianldate,ireal,ipchan,iextra,jextra - integer(i_kind):: idiag,angord,iversion,inewpc,isens - integer(i_kind):: iuse_tmp,nuchan_tmp,iochan_tmp - real(r_single) :: freq_tmp,polar_tmp,wave_tmp,varch_tmp,tlapmean_tmp - logical loutall - - loutall=.true. - if(present(lverbose)) loutall=lverbose - -! Read header (fixed_part). - read(ftin,IOSTAT=iflag) sensat,satid,sentype,jiter,nchanl,npred,ianldate,& - ireal,ipchan,iextra,jextra,idiag,angord,iversion,inewpc,isens - if (iflag/=0) then - rewind(ftin) - read(ftin,IOSTAT=iflag) sensat,satid,sentype,jiter,nchanl,npred,ianldate,& - ireal,ipchan,iextra,jextra,idiag,angord,iversion,inewpc - isens=0 - end if - - if (iflag/=0) then - rewind(ftin) - read(ftin,IOSTAT=iflag) sensat,satid,sentype,jiter,nchanl,npred,ianldate,& - ireal,ipchan,iextra,jextra - idiag=ipchan+npred+1 - angord=0 - iversion=0 - inewpc=0 - isens=0 - if (iflag/=0) then - write(6,*)'READ_RADIAG_HEADER: ***ERROR*** Unknown file format. Cannot read' - return - endif - endif - - header_fix%isis = sensat - header_fix%id = satid - header_fix%obstype = sentype - header_fix%jiter = jiter - header_fix%nchan = nchanl - header_fix%npred = npred - header_fix%idate = ianldate - header_fix%ireal = ireal - header_fix%ipchan = ipchan - header_fix%iextra = iextra - header_fix%jextra = jextra - header_fix%idiag = idiag - header_fix%angord = angord - header_fix%iversion= iversion - header_fix%inewpc = inewpc - header_fix%isens = isens - - if (loutall) then - write(6,*)'READ_RADIAG_HEADER: isis=',header_fix%isis,& - ' nchan=',header_fix%nchan,& - ' npred=',header_fix%npred,& - ' angord=',header_fix%angord,& - ' idiag=',header_fix%idiag,& - ' iversion=',header_fix%iversion,& - ' inewpc=',header_fix%inewpc,& - ' isens=',header_fix%isens - - if ( header_fix%iextra /= 0) & - write(6,*)'READ_RADIAG_HEADER: extra diagnostic information available, ',& - 'iextra=',header_fix%iextra - end if - - if (header_fix%npred /= npred_radiag) & - write(6,*) 'READ_RADIAG_HEADER: **WARNING** header_fix%npred,npred=',& - header_fix%npred,npred_radiag - -! Allocate and initialize as needed - if (allocated(header_chan)) deallocate(header_chan) - if (allocated(data_name%chn)) deallocate(data_name%chn) - - allocate(header_chan( header_fix%nchan)) - allocate(data_name%chn(header_fix%idiag)) - - data_name%fix(1) ='lat ' - data_name%fix(2) ='lon ' - data_name%fix(3) ='zsges ' - data_name%fix(4) ='obstim ' - data_name%fix(5) ='scanpos ' - data_name%fix(6) ='satzen ' - data_name%fix(7) ='satazm ' - data_name%fix(8) ='solzen ' - data_name%fix(9) ='solazm ' - data_name%fix(10)='sungln ' - data_name%fix(11)='fwater ' - data_name%fix(12)='fland ' - data_name%fix(13)='fice ' - data_name%fix(14)='fsnow ' - data_name%fix(15)='twater ' - data_name%fix(16)='tland ' - data_name%fix(17)='tice ' - data_name%fix(18)='tsnow ' - data_name%fix(19)='tsoil ' - data_name%fix(20)='soilmoi ' - data_name%fix(21)='landtyp ' - data_name%fix(22)='vegfrac ' - data_name%fix(23)='snowdep ' - data_name%fix(24)='wndspd ' - data_name%fix(25)='qc1 ' - data_name%fix(26)='qc2 ' - data_name%fix(27)='tref ' - data_name%fix(28)='dtw ' - data_name%fix(29)='dtc ' - data_name%fix(30)='tz_tr ' - - data_name%chn(1)='obs ' - data_name%chn(2)='omgbc ' - data_name%chn(3)='omgnbc ' - data_name%chn(4)='errinv ' - data_name%chn(5)='qcmark ' - data_name%chn(6)='emiss ' - data_name%chn(7)='tlap ' - data_name%chn(8)='tb_tz ' - - if (header_fix%iversion < iversion_radiag_1) then - data_name%chn( 8)= 'bifix ' - data_name%chn( 9)= 'bilap ' - data_name%chn(10)= 'bilap2 ' - data_name%chn(11)= 'bicons ' - data_name%chn(12)= 'biang ' - data_name%chn(13)= 'biclw ' - if (retrieval) data_name%chn(13)= 'bisst ' - elseif ( header_fix%iversion < iversion_radiag_2 .and. header_fix%iversion >= iversion_radiag_1 ) then - data_name%chn( 8)= 'bicons ' - data_name%chn( 9)= 'biang ' - data_name%chn(10)= 'biclw ' - data_name%chn(11)= 'bilap2 ' - data_name%chn(12)= 'bilap ' - do i=1,header_fix%angord - write(string,'(i2.2)') header_fix%angord-i+1 - data_name%chn(12+i)= 'bifix' // string - end do - data_name%chn(12+header_fix%angord+1)= 'bifix ' - data_name%chn(12+header_fix%angord+2)= 'bisst ' - elseif ( header_fix%iversion < iversion_radiag_3 .and. header_fix%iversion >= iversion_radiag_2 ) then - data_name%chn( 9)= 'bicons ' - data_name%chn(10)= 'biang ' - data_name%chn(11)= 'biclw ' - data_name%chn(12)= 'bilap2 ' - data_name%chn(13)= 'bilap ' - do i=1,header_fix%angord - write(string,'(i2.2)') header_fix%angord-i+1 - data_name%chn(13+i)= 'bifix' // string - end do - data_name%chn(13+header_fix%angord+1)= 'bifix ' - data_name%chn(13+header_fix%angord+2)= 'bisst ' - elseif ( header_fix%iversion < iversion_radiag_4 .and. header_fix%iversion >= iversion_radiag_3 ) then - data_name%chn( 9)= 'bicons ' - data_name%chn(10)= 'biang ' - data_name%chn(11)= 'biclw ' - data_name%chn(12)= 'bilap2 ' - data_name%chn(13)= 'bilap ' - data_name%chn(14)= 'bicos ' - data_name%chn(15)= 'bisin ' - do i=1,header_fix%angord - write(string,'(i2.2)') header_fix%angord-i+1 - data_name%chn(15+i)= 'bifix' // string - end do - data_name%chn(15+header_fix%angord+1)= 'bifix ' - data_name%chn(15+header_fix%angord+2)= 'bisst ' - else - data_name%chn( 9)= 'bicons ' - data_name%chn(10)= 'biang ' - data_name%chn(11)= 'biclw ' - data_name%chn(12)= 'bilap2 ' - data_name%chn(13)= 'bilap ' - data_name%chn(14)= 'bicos ' - data_name%chn(15)= 'bisin ' - data_name%chn(16)= 'biemis ' - do i=1,header_fix%angord - write(string,'(i2.2)') header_fix%angord-i+1 - data_name%chn(16+i)= 'bifix' // string - end do - data_name%chn(16+header_fix%angord+1)= 'bifix ' - data_name%chn(16+header_fix%angord+2)= 'bisst ' - endif - -! Read header (channel part) - do ich=1, header_fix%nchan - read(ftin,IOSTAT=iflag) freq_tmp,polar_tmp,wave_tmp,varch_tmp,tlapmean_tmp,iuse_tmp,nuchan_tmp,iochan_tmp - header_chan(ich)%freq = freq_tmp - header_chan(ich)%polar = polar_tmp - header_chan(ich)%wave = wave_tmp - header_chan(ich)%varch = varch_tmp - header_chan(ich)%tlapmean = tlapmean_tmp - header_chan(ich)%iuse = iuse_tmp - header_chan(ich)%nuchan = nuchan_tmp - header_chan(ich)%iochan = iochan_tmp - if (iflag/=0) return - end do - -! Construct array containing menonics for data record entries - - -end subroutine read_radiag_header - -subroutine read_radiag_data(ftin,header_fix,retrieval,data_fix,data_chan,data_extra,iflag ) -! . . . . -! subprogram: read_radiag_dat read rad diag data -! prgmmr: tahara org: np20 date: 2003-01-01 -! -! abstract: This routine reads the data record from a radiance -! diagnostic file -! -! program history log: -! 2010-10-05 treadon - add this doc block -! 2011-02-22 kleist - changes related to memory allocation -! -! input argument list: -! ftin - unit number connected to diagnostic file -! header_fix - header information structure -! -! output argument list: -! data_fix - spot header information structure -! data_chan - spot channel information structure -! data_extra - spot extra information -! iflag - error code -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ - - -! Declare passed arguments - integer(i_kind),intent(in) :: ftin - type(diag_header_fix_list ),intent(in) :: header_fix - logical,intent(in) :: retrieval - type(diag_data_fix_list) ,intent(out):: data_fix - type(diag_data_chan_list) ,allocatable :: data_chan(:) - type(diag_data_extra_list) ,allocatable :: data_extra(:,:) - integer(i_kind),intent(out) :: iflag - - integer(i_kind) :: ich,iang,i,j - real(r_single),dimension(:,:),allocatable :: data_tmp - real(r_single),dimension(:),allocatable :: fix_tmp - real(r_single),dimension(:,:),allocatable :: extra_tmp - -! Allocate arrays as needed - if (allocated(data_chan)) deallocate(data_chan) - allocate(data_chan(header_fix%nchan)) - - do ich=1,header_fix%nchan - if (allocated(data_chan(ich)%bifix)) deallocate(data_chan(ich)%bifix) - allocate(data_chan(ich)%bifix(header_fix%angord+1)) - end do - - if (header_fix%iextra > 0) then - if (allocated(data_extra)) deallocate(data_extra) - allocate(data_extra(header_fix%iextra,header_fix%jextra)) - allocate(extra_tmp(header_fix%iextra,header_fix%jextra)) - end if - -! Allocate arrays to hold data record - allocate(data_tmp(header_fix%idiag,header_fix%nchan)) - - if (header_fix%iversion < iversion_radiag_2) then - allocate( fix_tmp( ireal_old_radiag ) ) - else - allocate( fix_tmp( ireal_radiag ) ) - end if - -! Read data record - - if (header_fix%iextra == 0) then - read(ftin,IOSTAT=iflag) fix_tmp, data_tmp - else - read(ftin,IOSTAT=iflag) fix_tmp, data_tmp, extra_tmp - endif - - -! Transfer fix_tmp record to output structure - data_fix%lat = fix_tmp(1) - data_fix%lon = fix_tmp(2) - data_fix%zsges = fix_tmp(3) - data_fix%obstime = fix_tmp(4) - data_fix%senscn_pos = fix_tmp(5) - data_fix%satzen_ang = fix_tmp(6) - data_fix%satazm_ang = fix_tmp(7) - data_fix%solzen_ang = fix_tmp(8) - data_fix%solazm_ang = fix_tmp(9) - data_fix%sungln_ang = fix_tmp(10) - data_fix%water_frac = fix_tmp(11) - data_fix%land_frac = fix_tmp(12) - data_fix%ice_frac = fix_tmp(13) - data_fix%snow_frac = fix_tmp(14) - data_fix%water_temp = fix_tmp(15) - data_fix%land_temp = fix_tmp(16) - data_fix%ice_temp = fix_tmp(17) - data_fix%snow_temp = fix_tmp(18) - data_fix%soil_temp = fix_tmp(19) - data_fix%soil_mois = fix_tmp(20) - data_fix%land_type = fix_tmp(21) - data_fix%veg_frac = fix_tmp(22) - data_fix%snow_depth = fix_tmp(23) - data_fix%sfc_wndspd = fix_tmp(24) - data_fix%qcdiag1 = fix_tmp(25) - data_fix%qcdiag2 = fix_tmp(26) - - if ( header_fix%iversion <= iversion_radiag_1 ) then - data_fix%tref = rmiss_radiag - data_fix%dtw = rmiss_radiag - data_fix%dtc = rmiss_radiag - data_fix%tz_tr = rmiss_radiag - else - data_fix%tref = fix_tmp(27) - data_fix%dtw = fix_tmp(28) - data_fix%dtc = fix_tmp(29) - data_fix%tz_tr = fix_tmp(30) - end if - - -! Transfer data record to output structure - do ich=1,header_fix%nchan - data_chan(ich)%tbobs =data_tmp(1,ich) - data_chan(ich)%omgbc =data_tmp(2,ich) - data_chan(ich)%omgnbc=data_tmp(3,ich) - data_chan(ich)%errinv=data_tmp(4,ich) - data_chan(ich)%qcmark=data_tmp(5,ich) - data_chan(ich)%emiss =data_tmp(6,ich) - data_chan(ich)%tlap =data_tmp(7,ich) - data_chan(ich)%tb_tz =data_tmp(8,ich) - end do - if (header_fix%iversion < iversion_radiag_1) then - do ich=1,header_fix%nchan - data_chan(ich)%bifix(1)=data_tmp(8,ich) - data_chan(ich)%bilap =data_tmp(9,ich) - data_chan(ich)%bilap2 =data_tmp(10,ich) - data_chan(ich)%bicons =data_tmp(11,ich) - data_chan(ich)%biang =data_tmp(12,ich) - data_chan(ich)%biclw =data_tmp(13,ich) - data_chan(ich)%bisst = rmiss_radiag - if (retrieval) then - data_chan(ich)%biclw =rmiss_radiag - data_chan(ich)%bisst =data_tmp(13,ich) - endif - end do - elseif ( header_fix%iversion < iversion_radiag_2 .and. header_fix%iversion >= iversion_radiag_1 ) then - do ich=1,header_fix%nchan - data_chan(ich)%bicons=data_tmp(8,ich) - data_chan(ich)%biang =data_tmp(9,ich) - data_chan(ich)%biclw =data_tmp(10,ich) - data_chan(ich)%bilap2=data_tmp(11,ich) - data_chan(ich)%bilap =data_tmp(12,ich) - end do - do ich=1,header_fix%nchan - do iang=1,header_fix%angord+1 - data_chan(ich)%bifix(iang)=data_tmp(12+iang,ich) - end do - data_chan(ich)%bisst = data_tmp(12+header_fix%angord+2,ich) - end do - elseif ( header_fix%iversion < iversion_radiag_3 .and. header_fix%iversion >= iversion_radiag_2 ) then - do ich=1,header_fix%nchan - data_chan(ich)%bicons=data_tmp(9,ich) - data_chan(ich)%biang =data_tmp(10,ich) - data_chan(ich)%biclw =data_tmp(11,ich) - data_chan(ich)%bilap2=data_tmp(12,ich) - data_chan(ich)%bilap =data_tmp(13,ich) - end do - do ich=1,header_fix%nchan - do iang=1,header_fix%angord+1 - data_chan(ich)%bifix(iang)=data_tmp(13+iang,ich) - end do - data_chan(ich)%bisst = data_tmp(13+header_fix%angord+2,ich) - end do - elseif ( header_fix%iversion < iversion_radiag_4 .and. header_fix%iversion >= iversion_radiag_3 ) then - do ich=1,header_fix%nchan - data_chan(ich)%bicons=data_tmp(9,ich) - data_chan(ich)%biang =data_tmp(10,ich) - data_chan(ich)%biclw =data_tmp(11,ich) - data_chan(ich)%bilap2=data_tmp(12,ich) - data_chan(ich)%bilap =data_tmp(13,ich) - data_chan(ich)%bicos =data_tmp(14,ich) ! 1st bias correction term node*cos(lat) for SSMIS - data_chan(ich)%bisin =data_tmp(15,ich) ! 2nd bias correction term sin(lat) for SSMI - end do - do ich=1,header_fix%nchan - do iang=1,header_fix%angord+1 - data_chan(ich)%bifix(iang)=data_tmp(15+iang,ich) - end do - data_chan(ich)%bisst = data_tmp(15+header_fix%angord+2,ich) - end do - else - do ich=1,header_fix%nchan - data_chan(ich)%bicons=data_tmp(9,ich) - data_chan(ich)%biang =data_tmp(10,ich) - data_chan(ich)%biclw =data_tmp(11,ich) - data_chan(ich)%bilap2=data_tmp(12,ich) - data_chan(ich)%bilap =data_tmp(13,ich) - data_chan(ich)%bicos =data_tmp(14,ich) - data_chan(ich)%bisin =data_tmp(15,ich) - data_chan(ich)%biemis=data_tmp(16,ich) - end do - do ich=1,header_fix%nchan - do iang=1,header_fix%angord+1 - data_chan(ich)%bifix(iang)=data_tmp(16+iang,ich) - end do - data_chan(ich)%bisst = data_tmp(16+header_fix%angord+2,ich) - end do - endif - - if (header_fix%iextra > 0) then - do j=1,header_fix%jextra - do i=1,header_fix%iextra - data_extra(i,j)%extra=extra_tmp(i,j) - end do - end do - endif - - deallocate(data_tmp, fix_tmp) - if (header_fix%iextra > 0) deallocate(extra_tmp) - -end subroutine read_radiag_data - -end module read_diag - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radbcoef.fd/readme b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radbcoef.fd/readme deleted file mode 100644 index a229412533..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radbcoef.fd/readme +++ /dev/null @@ -1,23 +0,0 @@ -Instructions for building radmon_bcoef executable. - - 1) Load the build module appropriate for your Machine: - i.) - WCOSS: - "module use -a ../../modulefiles/wcoss" - THEIA: - "module use -a ../../modulefiles/theia" - ii.) - "module load RadMonBuild" - - 2) Optional: verify all prerequisites are met by typing: - "make check_prereqs" - - 3) Build the executable by typing: - "make" - - 4) Move the executable to the ../../exec directory by typing: - "make install" - - 5) Unload the build module: - "module unload RadMonBuild" - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radbcor.fd/CMakeLists.txt b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radbcor.fd/CMakeLists.txt deleted file mode 100644 index 182c8cc915..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radbcor.fd/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ -cmake_minimum_required(VERSION 2.6) - file(GLOB RADMON_BCOR_SRC ${CMAKE_CURRENT_SOURCE_DIR}/*90 ) - set(RADMON_BCOR_Fortran_FLAGS "-fp-model strict -assume byterecl -convert big_endian -O3 -traceback -D_REAL8_ ") - set(Util_MODULE_DIR ${PROJECT_BINARY_DIR}/include/radmon_bcor ) - set_source_files_properties( ${RADMON_BCOR_SRC} PROPERTIES COMPILE_FLAGS ${RADMON_BCOR_Fortran_FLAGS} ) - add_executable(radmon_bcor ${RADMON_BCOR_SRC} ) - set_target_properties( radmon_bcor PROPERTIES COMPILE_FLAGS ${RADMON_BCOR_Fortran_FLAGS} ) - set_target_properties( radmon_bcor PROPERTIES Fortran_MODULE_DIRECTORY ${Util_MODULE_DIR} ) - include_directories( ${CORE_INCS} ) - target_link_libraries( radmon_bcor ${W3NCO_4_LIBRARY} ) - if(BUILD_W3NCO) - add_dependencies( radmon_bcor ${W3NCO_4_LIBRARY} ) - endif() - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radbcor.fd/avgsdv.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radbcor.fd/avgsdv.f90 deleted file mode 100755 index 44d1103a97..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radbcor.fd/avgsdv.f90 +++ /dev/null @@ -1,31 +0,0 @@ -subroutine avgsdv(count,sum1,sum2,rmiss) - implicit none - real count,sum1,sum2,rmiss - real avg,sdv,rterm1,rterm2,svar - - if (count>0.) then - rterm1 = 1./count - avg = rterm1*sum1 - if (count>1.) then - rterm2 = 1./(count-1.) - svar = (count*sum2-sum1*sum1)*rterm1*rterm2 - if (svar>0.) then - sdv = sqrt(svar) - else - sdv = rmiss - endif - else - sdv = rmiss - endif - else - count = rmiss - avg = rmiss - sdv = rmiss - endif - - sum1=avg - sum2=sdv - - return -end subroutine avgsdv - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radbcor.fd/bcor.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radbcor.fd/bcor.f90 deleted file mode 100755 index b03bdfc9dd..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radbcor.fd/bcor.f90 +++ /dev/null @@ -1,562 +0,0 @@ -! -! bcor.f90 -! -program bcor - use read_diag - - implicit none - integer ntype,mregion,surf_nregion,max_surf_region - parameter (ntype=30,mregion=25,max_surf_region=5) - integer iglobal, iland, iwater, isnowice, imixed - parameter( iglobal=1, iland=2, iwater=3, isnowice=4, imixed=5 ) - - character(10),dimension(ntype):: ftype - character(20) satname,stringd,satsis,mod_satname - character(10) dum,satype,dplat - character(40) string,diag_rad,data_file,ctl_file - character(40),dimension(max_surf_region):: region - character(10) suffix - - integer luname,lungrd,lunctl,lndiag - integer iyy,imm,idd,ihh,idhh,incr,iread,iflag - integer n_chan,j,idsat,i,k,ii,nsub - integer,dimension(mregion):: jsub - integer,allocatable,dimension(:):: io_chan,nu_chan - integer npred_radiag,angord - - real pen,rread - real weight,rlat,rlon,rmiss,obs,biascor,obsges,obsgesnbc,rterm - real,dimension(2):: cor_total,cor_fixang,cor_lapse,cor_lapse2,& - cor_const,cor_scangl,cor_clw,cor_cos_ssmis,cor_sin_ssmis,& - cor_emiss,cor_ordang4,cor_ordang3,cor_ordang2,cor_ordang1 - - real,dimension(max_surf_region):: rlatmin,rlatmax,rlonmin,rlonmax - - real,allocatable,dimension(:):: wavenumbr - real,allocatable,dimension(:,:):: count,error,use,frequency,penalty - real,allocatable,dimension(:,:,:):: total_cor,fixang_cor,lapse_cor,& - lapse2_cor,const_cor,scangl_cor,clw_cor,cos_ssmis_cor,sin_ssmis_cor,& - emiss_cor,ordang4_cor,ordang3_cor,ordang2_cor,ordang1_cor - - logical no_obs - -! Variables for reading satellite data - type(diag_header_fix_list ) :: header_fix - type(diag_header_chan_list),allocatable :: header_chan(:) - type(diag_data_name_list ) :: data_name - type(diag_data_fix_list ) :: data_fix - type(diag_data_chan_list ),allocatable :: data_chan(:) - type(diag_data_extra_list) ,allocatable :: data_extra(:,:) - - integer nsnow, nland, nwater, nice, nmixed, ntotal - integer nnsnow, nnland, nnwater, nnmixed, nntotal - -! Namelist with defaults - logical :: retrieval = .false. - integer :: nchanl = 19 - integer :: imkctl = 1 - integer :: imkdata = 1 - character(3) :: gesanl = 'ges' - integer :: little_endian = 1 - character(3) :: rad_area = 'glb' - namelist /input/ satname,iyy,imm,idd,ihh,idhh,incr,nchanl,& - suffix,imkctl,imkdata,retrieval,gesanl,little_endian,rad_area - - data luname,lungrd,lunctl,lndiag / 5, 51, 52, 21 / - data rmiss /-999./ - data stringd / '.%y4%m2%d2%h2' / - data ftype / 'count', 'penalty', & - 'avgtotal', 'avgfixang', 'avglapse', 'avglapse2', & - 'avgconst', 'avgscangl', 'avgclw', & - 'avgcos', 'avgsin', 'avgemiss', 'avgordang4', & - 'avgordang3', 'avgordang2', 'avgordang1', & - 'sdvtotal', 'sdvfixang', 'sdvlapse', 'sdvlapse2', & - 'sdvconst', 'sdvscangl', 'sdvclw', & - 'sdvcos', 'sdvsin', 'sdvemiss', 'sdvordang4',& - 'sdvordang3', 'sdvordang2', 'sdvordang1' / - data region / 'global', 'land', 'water', 'ice/snow', 'mixed'/ - data rlonmin / -180., -180., -180., -180., -180./ - data rlonmax / 180., 180., 180., 180., 180./ - data rlatmin / -90., -90., -90., -90., -90./ - data rlatmax / 90., 90., 90., 90., 90./ - - - -!************************************************************************ -! -! Initialize variables - iread=0 - npred_radiag = 12 - -! Read namelist input - read(luname,input) - write(6,input) - write(6,*)'gesanl = ', gesanl - write(6,*)'rad_area = ', rad_area - write(6,*)' ' - - surf_nregion = 5 - if ( trim(rad_area) == 'rgn' ) then - surf_nregion = 1 - endif - - write(6,*)'surf_nregion = ', surf_nregion - - -! Ensure number of requested regions does not exceed specified upper limit - if (surf_nregion>mregion) then - write(6,*)'***ERROR*** too many regions specified' - write(6,*)' maximum allowed: mregion=',mregion - write(6,*)' user requested: surf_nregion=',surf_nregion - call errexit(91) - endif - - -! Create filenames for diagnostic input, binary output file - write(stringd,100) iyy,imm,idd,ihh -100 format('.',i4.4,3i2.2) - - if ( trim(gesanl) == 'ges' ) then - diag_rad = trim(satname) - data_file= trim(satname) // trim(stringd) // '.ieee_d' - ctl_file = trim(satname) // '.ctl' - else - diag_rad = trim(satname) // '_anl' - data_file= trim(satname) // '_anl' // trim(stringd) // '.ieee_d' - ctl_file = trim(satname) // '_anl.ctl' - endif - - write(6,*)'diag_rad =',diag_rad - write(6,*)'data_file=',data_file - write(6,*)'ctl_file =',ctl_file - write(6,*)'suffix =',suffix - - -! Open unit to diagnostic file. Read portion of header to -! see if file exists - open(lndiag,file=diag_rad,form='unformatted') - read(lndiag,err=900,end=900) dum - rewind lndiag - -! File exists. Read header - write(6,*)'call read_diag_header' - call read_radiag_header( lndiag, npred_radiag, retrieval, header_fix,& - header_chan, data_name, iflag ) - if( iflag/=0 ) then - write(6,*)'***ERROR*** problem reading diag file header, iflag=',iflag - call errexit(91) - endif - -! Extract observation type, satellite id, and number of channels - satype = header_fix%obstype - satsis = header_fix%isis - dplat = header_fix%id - n_chan = header_fix%nchan - angord = header_fix%angord - - write(6,*)'satype,dplat,n_chan,angord=',satype,' ',dplat,n_chan,angord - - string = trim(satype)//'_'//trim(dplat) - write(6,*)'string,satname=',string,' ',satname - if ( trim(string) /= trim(satname) ) then - write(6,*)'***ERROR*** inconsistent instrument types' - write(6,*)' satname,string =',satname,' ',string - call errexit(92) - endif - - -! Allocate arrays to hold observational information - write(6,*)' ' - write(6,*)'allocate arrays' - allocate (io_chan(n_chan), nu_chan(n_chan), wavenumbr(n_chan)) - allocate (total_cor(n_chan,mregion,2), fixang_cor(n_chan,mregion,2), & - lapse_cor(n_chan,mregion,2), lapse2_cor(n_chan,mregion,2), & - const_cor(n_chan,mregion,2), scangl_cor(n_chan,mregion,2), & - clw_cor(n_chan,mregion,2), cos_ssmis_cor(n_chan,mregion,2), & - sin_ssmis_cor(n_chan,mregion,2), emiss_cor(n_chan,mregion,2), & - ordang4_cor(n_chan,mregion,2), ordang3_cor(n_chan,mregion,2), & - ordang2_cor(n_chan,mregion,2), ordang1_cor(n_chan,mregion,2), & - count(n_chan,mregion), penalty(n_chan,mregion), & - error(n_chan,mregion), use(n_chan,mregion), & - frequency(n_chan,mregion)) - -! Zero accumulator arrays - do ii=1,2 - do k=1,mregion - do j=1,n_chan - if (ii==1) then - count(j,k) = 0.0 - penalty(j,k) = 0.0 - endif - total_cor(j,k,ii) = 0.0 - fixang_cor(j,k,ii) = 0.0 - lapse_cor(j,k,ii) = 0.0 - lapse2_cor(j,k,ii) = 0.0 - const_cor(j,k,ii) = 0.0 - scangl_cor(j,k,ii) = 0.0 - clw_cor(j,k,ii) = 0.0 - cos_ssmis_cor(j,k,ii) = 0.0 - sin_ssmis_cor(j,k,ii) = 0.0 - emiss_cor(j,k,ii) = 0.0 - ordang4_cor(j,k,ii) = 0.0 - ordang3_cor(j,k,ii) = 0.0 - ordang2_cor(j,k,ii) = 0.0 - ordang1_cor(j,k,ii) = 0.0 - end do - end do - end do - - -! Extract satinfo relative index - do j=1,n_chan - nu_chan(j) = real( header_chan(j)%nuchan, 4 ) - io_chan(j) = real( header_chan(j)%iochan, 4 ) - wavenumbr(j) = real( header_chan(j)%wave, 4 ) - end do - do k=1,mregion - do j=1,n_chan - error(j,k) = real( header_chan(j)%varch, 4) - use(j,k) = real( header_chan(j)%iuse, 4 ) - frequency(j,k) = real( header_chan(j)%freq, 4) - end do - end do - - -! Create GrADS control file - if ( imkctl == 1 ) then - write(6,*)'call create_ctl_bcor' - - if ( trim(gesanl) == 'ges' ) then - mod_satname = trim(satname) - else - mod_satname = trim(satname) // '_anl' - endif - - - call create_ctl_bcor(ntype,ftype,n_chan,iyy,imm,idd,ihh,idhh,& - incr,ctl_file,lunctl,rmiss,mod_satname,satype,dplat,surf_nregion,& - region,rlonmin,rlonmax,rlatmin,rlatmax,nu_chan,use(1,1),error(1,1),& - frequency(1,1),wavenumbr,little_endian) - - endif - - nwater = 0; nnwater = 0 - nland = 0; nnland = 0 - nsnow = 0; nnsnow = 0 - nice = 0 - nmixed = 0; nnmixed = 0 - ntotal = 0 - -! Loop to read entries in diagnostic file - if ( imkdata == 1 ) then - iflag = 0 - loopd: do while (iflag == 0) - -! Read a record. If read flag, iflag does not equal zero, exit loopd - call read_radiag_data( lndiag, header_fix, retrieval, data_fix, data_chan,& - data_extra, iflag ) - if( iflag /= 0 ) exit loopd - iread=iread+1 - -! Extract obervation location and mpi weight. Convert (0-360) lon to (-180,180) - rlat = data_fix%lat - rlon = data_fix%lon - if (rlon>180.) rlon = rlon - 360. - rread = rread + 1.0 - - ntotal = ntotal + 1 - jsub(1)= iglobal - nsub = 1 - - if ( surf_nregion > 1 ) then - if ( data_fix%water_frac > 0.99 ) then - nwater = nwater + 1 - else if ( data_fix%land_frac > 0.99 ) then - nland = nland + 1 - else if ( data_fix%snow_frac > 0.99 ) then - nsnow = nsnow + 1 - else if ( data_fix%ice_frac > 0.99 ) then - nice = nice + 1 - else - nmixed = nmixed + 1 - end if - - - -! Detemine into which subdomains the observation falls. -! These are now based on surface type, not geography. All -! obs match global (surf_region 1). -! - ii=0; -!jsub=0; - if ( data_fix%land_frac > 0.99 ) then - jsub(2)=iland - nsub=2 - nnland=nnland+1 - else if ( data_fix%water_frac > 0.99 ) then - jsub(2)=iwater - nsub=2 - nnwater=nnwater+1 - else if (( data_fix%snow_frac > 0.99 ) .OR. ( data_fix%ice_frac > 0.99 )) then - jsub(2)=isnowice - nsub=2 - nnsnow=nnsnow+1 - else - jsub(2)=imixed - nsub=2 - nnmixed=nnmixed+1 - write(6,*)'data_fix%land_frac,water,snow,ice = ',data_fix%land_frac, data_fix%water_frac, data_fix%snow_frac, data_fix%ice_frac - end if - end if - - -! Channel loop - do j = 1, n_chan - -! If observation was assimilated, accumulate sums in appropriate regions - if (data_chan(j)%errinv > 1.e-6) then -! pen = data_chan(j)%errinv*(data_chan(j)%omgbc)**2 - pen = (data_chan(j)%errinv*(data_chan(j)%omgbc))**2 - cor_total(1) = (data_chan(j)%omgnbc - data_chan(j)%omgbc) - cor_fixang(1) = data_chan(j)%bifix(angord+1) - cor_lapse(1) = data_chan(j)%bilap - cor_lapse2(1) = data_chan(j)%bilap2 - cor_const(1) = data_chan(j)%bicons - cor_scangl(1) = data_chan(j)%biang - cor_clw(1) = data_chan(j)%biclw - cor_cos_ssmis(1) = data_chan(j)%bicos - cor_sin_ssmis(1) = data_chan(j)%bisin - cor_emiss(1) = data_chan(j)%biemis - if (angord >= 4 ) then - cor_ordang4(1) = data_chan(j)%bifix(1) - cor_ordang3(1) = data_chan(j)%bifix(2) - cor_ordang2(1) = data_chan(j)%bifix(3) - cor_ordang1(1) = data_chan(j)%bifix(4) - else - cor_ordang4(1) = 0.0 - cor_ordang3(1) = 0.0 - cor_ordang2(1) = 0.0 - cor_ordang1(1) = 0.0 - endif -! do i=1,angord -! cor_ordang4 -! write(string,'(i2.2)') header_fix%angord-i+1 -! data_name%chn(15+i)= 'bifix' // string -! end do - - - cor_total(2) = (data_chan(j)%omgnbc - data_chan(j)%omgbc)**2 - cor_fixang(2) = (data_chan(j)%bifix(angord+1))**2 - cor_lapse(2) = (data_chan(j)%bilap)**2 - cor_lapse2(2) = (data_chan(j)%bilap2)**2 - cor_const(2) = (data_chan(j)%bicons)**2 - cor_scangl(2) = (data_chan(j)%biang)**2 - cor_clw(2) = (data_chan(j)%biclw)**2 - cor_cos_ssmis(2) = data_chan(j)%bicos**2 - cor_sin_ssmis(2) = data_chan(j)%bisin**2 - cor_emiss(2) = data_chan(j)%biemis**2 - if (angord >= 4 ) then - cor_ordang4(1) = data_chan(j)%bifix(1)**2 - cor_ordang3(1) = data_chan(j)%bifix(2)**2 - cor_ordang2(1) = data_chan(j)%bifix(3)**2 - cor_ordang1(1) = data_chan(j)%bifix(4)**2 - else - cor_ordang4(2) = 0.0 - cor_ordang3(2) = 0.0 - cor_ordang2(2) = 0.0 - cor_ordang1(2) = 0.0 - end if - - do i=1,nsub - k=jsub(i) - count(j,k) = count(j,k) +1.0 - penalty(j,k) = penalty(j,k) + pen - - do ii=1,2 - total_cor(j,k,ii) = total_cor(j,k,ii) + cor_total(ii) - fixang_cor(j,k,ii) = fixang_cor(j,k,ii) + cor_fixang(ii) - lapse_cor(j,k,ii) = lapse_cor(j,k,ii) + cor_lapse(ii) - lapse2_cor(j,k,ii) = lapse2_cor(j,k,ii) + cor_lapse2(ii) - const_cor(j,k,ii) = const_cor(j,k,ii) + cor_const(ii) - scangl_cor(j,k,ii) = scangl_cor(j,k,ii) + cor_scangl(ii) - clw_cor(j,k,ii) = clw_cor(j,k,ii) + cor_clw(ii) - cos_ssmis_cor(j,k,ii) = cos_ssmis_cor(j,k,ii) + cor_cos_ssmis(ii) - sin_ssmis_cor(j,k,ii) = sin_ssmis_cor(j,k,ii) + cor_sin_ssmis(ii) - emiss_cor(j,k,ii) = emiss_cor(j,k,ii) + cor_emiss(ii) - ordang4_cor(j,k,ii) = ordang4_cor(j,k,ii) + cor_ordang4(ii) - ordang3_cor(j,k,ii) = ordang3_cor(j,k,ii) + cor_ordang3(ii) - ordang2_cor(j,k,ii) = ordang2_cor(j,k,ii) + cor_ordang2(ii) - ordang1_cor(j,k,ii) = ordang1_cor(j,k,ii) + cor_ordang1(ii) - end do - - end do - endif - - enddo ! channel loop - -! End of loop over diagnostic file - enddo loopd - close(lndiag) - write(6,*)' ' - write(6,*)'read in ',iread,' obs ',rread - write(6,*)' ' - - write(6,*)'nwater, nland, nice, nsnow, nmixed, ntotal = ', nwater, nland, nice, nsnow, nmixed, ntotal - nntotal=nnwater+nnland+nnsnow+nnmixed - write(6,*)'nnwater, nnland, nnsnow, nnmixed, nntotal = ', nnwater, nnland, nnsnow, nnmixed, nntotal - -! Compute average and standard deviation - do k=1,surf_nregion - do j=1,n_chan - call avgsdv(count(j,k),total_cor(j,k,1), total_cor(j,k,2), rmiss) - call avgsdv(count(j,k),fixang_cor(j,k,1), fixang_cor(j,k,2), rmiss) - call avgsdv(count(j,k),lapse_cor(j,k,1), lapse_cor(j,k,2), rmiss) - call avgsdv(count(j,k),lapse2_cor(j,k,1), lapse2_cor(j,k,2), rmiss) - call avgsdv(count(j,k),const_cor(j,k,1), const_cor(j,k,2), rmiss) - call avgsdv(count(j,k),scangl_cor(j,k,1), scangl_cor(j,k,2), rmiss) - call avgsdv(count(j,k),clw_cor(j,k,1), clw_cor(j,k,2), rmiss) - call avgsdv(count(j,k),cos_ssmis_cor(j,k,1), cos_ssmis_cor(j,k,2), rmiss) - call avgsdv(count(j,k),sin_ssmis_cor(j,k,1), sin_ssmis_cor(j,k,2), rmiss) - call avgsdv(count(j,k),emiss_cor(j,k,1), emiss_cor(j,k,2), rmiss) - call avgsdv(count(j,k),ordang4_cor(j,k,1), ordang4_cor(j,k,2), rmiss) - call avgsdv(count(j,k),ordang3_cor(j,k,1), ordang3_cor(j,k,2), rmiss) - call avgsdv(count(j,k),ordang2_cor(j,k,1), ordang2_cor(j,k,2), rmiss) - call avgsdv(count(j,k),ordang1_cor(j,k,1), ordang1_cor(j,k,2), rmiss) - - if (count(j,k)>0) then - penalty(j,k)=penalty(j,k)/count(j,k) - else - count(j,k)=rmiss - penalty(j,k)=rmiss - endif - end do - end do - -! Write output to binary output file - write(6,*)' ' - open(lungrd,file=data_file,form='unformatted') - write(lungrd) ((count(j,k),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((penalty(j,k),j=1,n_chan),k=1,surf_nregion) - do ii=1,2 - write(lungrd) ((total_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((fixang_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((lapse_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((lapse2_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((const_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((scangl_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((clw_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((cos_ssmis_cor(j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((sin_ssmis_cor(j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((emiss_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((ordang4_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((ordang3_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((ordang2_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((ordang1_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - end do - write(6,*)'write output to lungrd=',lungrd,', file=',trim(data_file) - close(lungrd) - endif - -! Deallocate arrays - write(6,*)' ' - write(6,*)'deallocate arrays' - if(allocated(io_chan)) deallocate (io_chan) - if(allocated(nu_chan)) deallocate (nu_chan) - if(allocated(wavenumbr)) deallocate (wavenumbr) - if(allocated(total_cor)) deallocate (total_cor) - if(allocated(fixang_cor)) deallocate (fixang_cor) - if(allocated(lapse_cor)) deallocate (lapse_cor) - if(allocated(lapse2_cor)) deallocate (lapse2_cor) - if(allocated(const_cor)) deallocate (const_cor) - if(allocated(scangl_cor)) deallocate (scangl_cor) - if(allocated(clw_cor)) deallocate (clw_cor) - if(allocated(cos_ssmis_cor)) deallocate (cos_ssmis_cor) - if(allocated(sin_ssmis_cor)) deallocate (sin_ssmis_cor) - if(allocated(emiss_cor)) deallocate (emiss_cor) - if(allocated(ordang4_cor)) deallocate (ordang4_cor) - if(allocated(ordang3_cor)) deallocate (ordang3_cor) - if(allocated(ordang2_cor)) deallocate (ordang2_cor) - if(allocated(ordang1_cor)) deallocate (ordang1_cor) - if(allocated(count)) deallocate (count) - if(allocated(penalty)) deallocate (penalty) - if(allocated(error)) deallocate (error) - if(allocated(use)) deallocate (use) - if(allocated(frequency)) deallocate (frequency) - - -! deallocate(io_chan,nu_chan,wavenumbr,total_cor,fixang_cor,lapse_cor,& -! lapse2_cor,const_cor,scangl_cor,clw_cor,count,penalty,error,use,& -! frequency) - - write(6,*)'deallocated arrays' - goto 950 - -! Jump to here if eof or error reading diagnostic file. -900 continue - write(6,*)'***PROBLEM reading diagnostic file. diag_rad=',diag_rad - close(lndiag) - - n_chan=nchanl - if (n_chan<=0) then - write(6,*)'***ERROR*** invalid nchanl=',nchanl,' STOP program' - call errexit(93) - endif - - write(6,*)'load missing value ',rmiss,' into output arrays. ',& - surf_nregion,n_chan - allocate(count(n_chan,surf_nregion),penalty(n_chan,surf_nregion)) - allocate(total_cor(n_chan,mregion,2), fixang_cor(n_chan,mregion,2), & - lapse_cor(n_chan,mregion,2), lapse2_cor(n_chan,mregion,2), & - const_cor(n_chan,mregion,2), scangl_cor(n_chan,mregion,2), & - clw_cor(n_chan,mregion,2)) - - write(6,*)'load missing value ',rmiss,' into output arrays' - do ii=1,2 - do k=1,surf_nregion - do j=1,n_chan - if (ii==1) then - count(j,k) =rmiss - penalty(j,k)=rmiss - endif - total_cor(j,k,ii) =rmiss - fixang_cor(j,k,ii)=rmiss - lapse_cor(j,k,ii) =rmiss - lapse2_cor(j,k,ii)=rmiss - const_cor(j,k,ii) =rmiss - scangl_cor(j,k,ii)=rmiss - clw_cor(j,k,ii) =rmiss - end do - end do - end do - - if ( imkdata == 1 ) then - open(lungrd,file=data_file,form='unformatted') - write(lungrd) ((count(j,k),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((penalty(j,k),j=1,n_chan),k=1,surf_nregion) - do ii=1,2 - write(lungrd) ((total_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((fixang_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((lapse_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((lapse2_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((const_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((scangl_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((clw_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((cos_ssmis_cor(j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((sin_ssmis_cor(j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((emiss_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((ordang4_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((ordang3_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((ordang2_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((ordang1_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - end do - write(6,*)'write output to lungrd=',lungrd,', file=',trim(data_file) - close(lungrd) - endif - deallocate(count,penalty,total_cor,fixang_cor,lapse_cor,lapse2_cor,& - const_cor,scangl_cor,clw_cor) - -! End of program -950 continue - write(6,*) 'exiting program bcor' - stop -end program bcor diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radbcor.fd/kinds.F90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radbcor.fd/kinds.F90 deleted file mode 100644 index 8b3a2fcc4e..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radbcor.fd/kinds.F90 +++ /dev/null @@ -1,112 +0,0 @@ -module kinds -!$$$ module documentation block -! . . . . -! module: kinds -! prgmmr: treadon org: np23 date: 2004-08-15 -! -! abstract: Module to hold specification kinds for variable declaration. -! This module is based on (copied from) Paul vanDelst's -! type_kinds module found in the community radiative transfer -! model -! -! module history log: -! 2004-08-15 treadon -! 2011-07-04 todling - define main precision during compilation -! -! Subroutines Included: -! -! Functions Included: -! -! remarks: -! The numerical data types defined in this module are: -! i_byte - specification kind for byte (1-byte) integer variable -! i_short - specification kind for short (2-byte) integer variable -! i_long - specification kind for long (4-byte) integer variable -! i_llong - specification kind for double long (8-byte) integer variable -! r_single - specification kind for single precision (4-byte) real variable -! r_double - specification kind for double precision (8-byte) real variable -! r_quad - specification kind for quad precision (16-byte) real variable -! -! i_kind - generic specification kind for default integer -! r_kind - generic specification kind for default floating point -! -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ end documentation block - implicit none - private - -! Integer type definitions below - -! Integer types - integer, parameter, public :: i_byte = selected_int_kind(1) ! byte integer - integer, parameter, public :: i_short = selected_int_kind(4) ! short integer - integer, parameter, public :: i_long = selected_int_kind(8) ! long integer - integer, parameter, private :: llong_t = selected_int_kind(16) ! llong integer - integer, parameter, public :: i_llong = max( llong_t, i_long ) - -! Expected 8-bit byte sizes of the integer kinds - integer, parameter, public :: num_bytes_for_i_byte = 1 - integer, parameter, public :: num_bytes_for_i_short = 2 - integer, parameter, public :: num_bytes_for_i_long = 4 - integer, parameter, public :: num_bytes_for_i_llong = 8 - -! Define arrays for default definition - integer, parameter, private :: num_i_kinds = 4 - integer, parameter, dimension( num_i_kinds ), private :: integer_types = (/ & - i_byte, i_short, i_long, i_llong /) - integer, parameter, dimension( num_i_kinds ), private :: integer_byte_sizes = (/ & - num_bytes_for_i_byte, num_bytes_for_i_short, & - num_bytes_for_i_long, num_bytes_for_i_llong /) - -! Default values -! **** CHANGE THE FOLLOWING TO CHANGE THE DEFAULT INTEGER TYPE KIND *** - integer, parameter, private :: default_integer = 3 ! 1=byte, - ! 2=short, - ! 3=long, - ! 4=llong - integer, parameter, public :: i_kind = integer_types( default_integer ) - integer, parameter, public :: num_bytes_for_i_kind = & - integer_byte_sizes( default_integer ) - - -! Real definitions below - -! Real types - integer, parameter, public :: r_single = selected_real_kind(6) ! single precision - integer, parameter, public :: r_double = selected_real_kind(15) ! double precision - integer, parameter, private :: quad_t = selected_real_kind(20) ! quad precision - integer, parameter, public :: r_quad = max( quad_t, r_double ) - -! Expected 8-bit byte sizes of the real kinds - integer, parameter, public :: num_bytes_for_r_single = 4 - integer, parameter, public :: num_bytes_for_r_double = 8 - integer, parameter, public :: num_bytes_for_r_quad = 16 - -! Define arrays for default definition - integer, parameter, private :: num_r_kinds = 3 - integer, parameter, dimension( num_r_kinds ), private :: real_kinds = (/ & - r_single, r_double, r_quad /) - integer, parameter, dimension( num_r_kinds ), private :: real_byte_sizes = (/ & - num_bytes_for_r_single, num_bytes_for_r_double, & - num_bytes_for_r_quad /) - -! Default values -! **** CHANGE THE FOLLOWING TO CHANGE THE DEFAULT REAL TYPE KIND *** -#ifdef _REAL4_ - integer, parameter, private :: default_real = 1 ! 1=single, -#endif -#ifdef _REAL8_ - integer, parameter, private :: default_real = 2 ! 2=double, -#endif -#ifdef _REAL16_ - integer, parameter, private :: default_real = 3 ! 3=quad -#endif - integer, parameter, public :: r_kind = real_kinds( default_real ) - integer, parameter, public :: num_bytes_for_r_kind = & - real_byte_sizes( default_real ) - -end module kinds diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radbcor.fd/makefile b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radbcor.fd/makefile deleted file mode 100755 index 7fbeb607ee..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radbcor.fd/makefile +++ /dev/null @@ -1,52 +0,0 @@ -# ***************************************************************** -# makefile.bcor -# -# Make the radmon_bcor executable. -# -# ***************************************************************** - -BINDIR = ${dir_root}/exec - -LIBS = $(W3NCO_LIB4) - -OBJS = kinds.o read_diag.o bcor.o avgsdv.o create_ctl_bcor.o - -# -# ***************************************************************** -# - -CMD = radmon_bcor - -all: $(CMD) - -clean: - rm -f *.o - rm -f *.mod - rm -f radmon_bcor - -check_prereqs: - $(CHECK_LIBS) $(LIBS) - -install: - cp -f $(CMD) $(BINDIR)/ - -debug: FFLAGS = $(D_FFLAGS) -debug: $(CMD) - -$(CMD): $(OBJS) - $(CF) $(FFLAGS) $(LDFLAGS) -o $(@) $(OBJS) $(LIBS) - -read_diag.o : read_diag.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -bcor.o : bcor.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -avgsdv.o : avgsdv.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -create_ctl_bcor.o : create_ctl_bcor.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -kinds.o : kinds.F90 - $(CF) $(FFLAGS) -c $(*).F90 diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radbcor.fd/read_diag.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radbcor.fd/read_diag.f90 deleted file mode 100755 index 7a4d6cdc49..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radbcor.fd/read_diag.f90 +++ /dev/null @@ -1,659 +0,0 @@ -!$$$ subprogram documentation block -! . . . . -! subprogram: read_raddiag read rad diag file -! prgmmr: tahara org: np20 date: 2003-01-01 -! -! abstract: This module contains code to process radiance -! diagnostic files. The module defines structures -! to contain information from the radiance -! diagnostic files and then provides two routines -! to access contents of the file. -! -! program history log: -! 2005-07-22 treadon - add this doc block -! 2010-10-05 treadon - refactor code to GSI standard -! 2010-10-08 zhu - use data_tmp to handle various npred values -! 2011-02-22 kleist - changes related to memory allocate/deallocate -! 2011-04-08 li - add tref, dtw, dtc to diag_data_fix_list, add tb_tz to diag_data_chan_list -! - correspondingly, change ireal_radiag (26 -> 30) and ipchan_radiag (7 -> 8) -! 2011-07-24 safford - make structure size for reading data_fix data version dependent -! 2013-11-21 todling - revisit how versions are set (add set/get_radiag) -! 2014-01-27 todling - add ob sensitivity index -! -! contains -! read_radiag_header - read radiance diagnostic file header -! read_radiag_data - read radiance diagnostic file data -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ - -module read_diag - - use kinds, only: i_kind,r_single - implicit none - -! Declare public and private - private - - public :: diag_header_fix_list - public :: diag_header_chan_list - public :: diag_data_name_list - public :: diag_data_fix_list - public :: diag_data_chan_list - public :: diag_data_extra_list - public :: read_radiag_header - public :: read_radiag_data -! public :: iversion_radiag -! public :: iversion_radiag_1 -! public :: iversion_radiag_2 -! public :: iversion_radiag_3 -! public :: iversion_radiag_4 - public :: ireal_radiag - public :: ipchan_radiag - public :: set_radiag - public :: get_radiag - - interface set_radiag - module procedure set_radiag_int_ ! internal procedure for integers - end interface - interface get_radiag - module procedure get_radiag_int_ ! internal procedure for integers - end interface - - integer(i_kind),parameter :: ireal_radiag = 30 ! number of real entries per spot in radiance diagnostic file - integer(i_kind),parameter :: ireal_old_radiag = 26 ! number of real entries per spot in versions older than iversion_radiag_2 - integer(i_kind),parameter :: ipchan_radiag = 8 ! number of entries per channel per spot in radiance diagnostic file - -! Declare structures for radiance diagnostic file information - type diag_header_fix_list - character(len=20) :: isis ! sat and sensor type - character(len=10) :: id ! sat type - character(len=10) :: obstype ! observation type - integer(i_kind) :: jiter ! outer loop counter - integer(i_kind) :: nchan ! number of channels in the sensor - integer(i_kind) :: npred ! number of updating bias correction predictors - integer(i_kind) :: idate ! time (yyyymmddhh) - integer(i_kind) :: ireal ! # of real elements in the fix part of a data record - integer(i_kind) :: ipchan ! # of elements for each channel except for bias correction terms - integer(i_kind) :: iextra ! # of extra elements for each channel - integer(i_kind) :: jextra ! # of extra elements - integer(i_kind) :: idiag ! first dimension of diag_data_chan - integer(i_kind) :: angord ! order of polynomial for adp_anglebc option - integer(i_kind) :: iversion ! radiance diagnostic file version number - integer(i_kind) :: inewpc ! indicator of newpc4pred (1 on, 0 off) - integer(i_kind) :: isens ! sensitivity index - end type diag_header_fix_list - - type diag_data_name_list - character(len=10),dimension(ireal_radiag) :: fix - character(len=10),dimension(:),allocatable :: chn - end type diag_data_name_list - - type diag_header_chan_list - real(r_single) :: freq ! frequency (Hz) - real(r_single) :: polar ! polarization - real(r_single) :: wave ! wave number (cm^-1) - real(r_single) :: varch ! error variance (or SD error?) - real(r_single) :: tlapmean ! mean lapse rate - integer(i_kind):: iuse ! use flag - integer(i_kind):: nuchan ! sensor relative channel number - integer(i_kind):: iochan ! satinfo relative channel number - end type diag_header_chan_list - - type diag_data_fix_list - real(r_single) :: lat ! latitude (deg) - real(r_single) :: lon ! longitude (deg) - real(r_single) :: zsges ! guess elevation at obs location (m) - real(r_single) :: obstime ! observation time relative to analysis - real(r_single) :: senscn_pos ! sensor scan position (integer(i_kind)) - real(r_single) :: satzen_ang ! satellite zenith angle (deg) - real(r_single) :: satazm_ang ! satellite azimuth angle (deg) - real(r_single) :: solzen_ang ! solar zenith angle (deg) - real(r_single) :: solazm_ang ! solar azimumth angle (deg) - real(r_single) :: sungln_ang ! sun glint angle (deg) - real(r_single) :: water_frac ! fractional coverage by water - real(r_single) :: land_frac ! fractional coverage by land - real(r_single) :: ice_frac ! fractional coverage by ice - real(r_single) :: snow_frac ! fractional coverage by snow - real(r_single) :: water_temp ! surface temperature over water (K) - real(r_single) :: land_temp ! surface temperature over land (K) - real(r_single) :: ice_temp ! surface temperature over ice (K) - real(r_single) :: snow_temp ! surface temperature over snow (K) - real(r_single) :: soil_temp ! soil temperature (K) - real(r_single) :: soil_mois ! soil moisture - real(r_single) :: land_type ! land type (integer(i_kind)) - real(r_single) :: veg_frac ! vegetation fraction - real(r_single) :: snow_depth ! snow depth - real(r_single) :: sfc_wndspd ! surface wind speed - real(r_single) :: qcdiag1 ! ir=cloud fraction, mw=cloud liquid water - real(r_single) :: qcdiag2 ! ir=cloud top pressure, mw=total column water - real(r_single) :: tref ! reference temperature (Tr) in NSST - real(r_single) :: dtw ! dt_warm at zob - real(r_single) :: dtc ! dt_cool at zob - real(r_single) :: tz_tr ! d(Tz)/d(Tr) - end type diag_data_fix_list - - type diag_data_chan_list - real(r_single) :: tbobs ! Tb (obs) (K) - real(r_single) :: omgbc ! Tb_(obs) - Tb_(simulated w/ bc) (K) - real(r_single) :: omgnbc ! Tb_(obs) - Tb_(simulated_w/o bc) (K) - real(r_single) :: errinv ! inverse error (K**(-1)) - real(r_single) :: qcmark ! quality control mark - real(r_single) :: emiss ! surface emissivity - real(r_single) :: tlap ! temperature lapse rate - real(r_single) :: tb_tz ! d(Tb)/d(Tz) - real(r_single) :: bicons ! constant bias correction term - real(r_single) :: biang ! scan angle bias correction term - real(r_single) :: biclw ! CLW bias correction term - real(r_single) :: bilap2 ! square lapse rate bias correction term - real(r_single) :: bilap ! lapse rate bias correction term - real(r_single) :: bicos ! node*cos(lat) bias correction term - real(r_single) :: bisin ! sin(lat) bias correction term - real(r_single) :: biemis ! emissivity sensitivity bias correction term - real(r_single),dimension(:),allocatable :: bifix ! angle dependent bias - real(r_single) :: bisst ! SST bias correction term - end type diag_data_chan_list - - type diag_data_extra_list - real(r_single) :: extra ! extra information - end type diag_data_extra_list - - integer(i_kind),save :: iversion_radiag ! Current version (see set routine) - integer(i_kind),parameter:: iversion_radiag_1 = 11104 ! Version when bias-correction entries were modified - integer(i_kind),parameter:: iversion_radiag_2 = 13784 ! Version when NSST entries were added - integer(i_kind),parameter:: iversion_radiag_3 = 19180 ! Version when SSMIS added - integer(i_kind),parameter:: iversion_radiag_4 = 30303 ! Version when emissivity predictor added - - real(r_single),parameter:: rmiss_radiag = -9.9e11_r_single - -contains - -subroutine set_radiag_int_ (what,iv,ier) -character(len=*),intent(in) :: what -integer(i_kind),intent(in) :: iv -integer(i_kind),intent(out):: ier -ier=-1 -if(trim(what)=='version') then - iversion_radiag = iv - ier=0 -endif -end subroutine set_radiag_int_ - -subroutine get_radiag_int_ (what,iv,ier) -character(len=*),intent(in) :: what -integer(i_kind),intent(out):: iv -integer(i_kind),intent(out):: ier -ier=-1 -if(trim(what)=='version') then - iv = iversion_radiag - ier=0 -endif -end subroutine get_radiag_int_ - -subroutine read_radiag_header(ftin,npred_radiag,retrieval,header_fix,header_chan,data_name,iflag,lverbose) -! . . . . -! subprogram: read_diag_header read rad diag header -! prgmmr: tahara org: np20 date: 2003-01-01 -! -! abstract: This routine reads the header record from a radiance -! diagnostic file -! -! program history log: -! 2010-10-05 treadon - add this doc block -! 2011-02-22 kleist - changes related to memory allocation and standard output -! -! input argument list: -! ftin - unit number connected to diagnostic file -! npred_radiag - number of bias correction terms -! retrieval - .true. if sst retrieval -! -! output argument list: -! header_fix - header information structure -! header_chan - channel information structure -! data_name - diag file data names -! iflag - error code -! lverbose - optional flag to turn off default output to standard out -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ - -! Declare passed arguments - integer(i_kind),intent(in) :: ftin - integer(i_kind),intent(in) :: npred_radiag - logical,intent(in) :: retrieval - type(diag_header_fix_list ),intent(out):: header_fix - type(diag_header_chan_list),allocatable :: header_chan(:) - type(diag_data_name_list) :: data_name - integer(i_kind),intent(out) :: iflag - logical,optional,intent(in) :: lverbose - -! Declare local variables - character(len=2):: string - character(len=10):: satid,sentype - character(len=20):: sensat - integer(i_kind) :: i,ich - integer(i_kind):: jiter,nchanl,npred,ianldate,ireal,ipchan,iextra,jextra - integer(i_kind):: idiag,angord,iversion,inewpc,isens - integer(i_kind):: iuse_tmp,nuchan_tmp,iochan_tmp - real(r_single) :: freq_tmp,polar_tmp,wave_tmp,varch_tmp,tlapmean_tmp - logical loutall - - loutall=.true. - if(present(lverbose)) loutall=lverbose - -! Read header (fixed_part). - read(ftin,IOSTAT=iflag) sensat,satid,sentype,jiter,nchanl,npred,ianldate,& - ireal,ipchan,iextra,jextra,idiag,angord,iversion,inewpc,isens - if (iflag/=0) then - rewind(ftin) - read(ftin,IOSTAT=iflag) sensat,satid,sentype,jiter,nchanl,npred,ianldate,& - ireal,ipchan,iextra,jextra,idiag,angord,iversion,inewpc - isens=0 - end if - - if (iflag/=0) then - rewind(ftin) - read(ftin,IOSTAT=iflag) sensat,satid,sentype,jiter,nchanl,npred,ianldate,& - ireal,ipchan,iextra,jextra - idiag=ipchan+npred+1 - angord=0 - iversion=0 - inewpc=0 - isens=0 - if (iflag/=0) then - write(6,*)'READ_RADIAG_HEADER: ***ERROR*** Unknown file format. Cannot read' - return - endif - endif - - header_fix%isis = sensat - header_fix%id = satid - header_fix%obstype = sentype - header_fix%jiter = jiter - header_fix%nchan = nchanl - header_fix%npred = npred - header_fix%idate = ianldate - header_fix%ireal = ireal - header_fix%ipchan = ipchan - header_fix%iextra = iextra - header_fix%jextra = jextra - header_fix%idiag = idiag - header_fix%angord = angord - header_fix%iversion= iversion - header_fix%inewpc = inewpc - header_fix%isens = isens - - if (loutall) then - write(6,*)'READ_RADIAG_HEADER: isis=',header_fix%isis,& - ' nchan=',header_fix%nchan,& - ' npred=',header_fix%npred,& - ' angord=',header_fix%angord,& - ' idiag=',header_fix%idiag,& - ' iversion=',header_fix%iversion,& - ' inewpc=',header_fix%inewpc,& - ' isens=',header_fix%isens - - if ( header_fix%iextra /= 0) & - write(6,*)'READ_RADIAG_HEADER: extra diagnostic information available, ',& - 'iextra=',header_fix%iextra - end if - - if (header_fix%npred /= npred_radiag) & - write(6,*) 'READ_RADIAG_HEADER: **WARNING** header_fix%npred,npred=',& - header_fix%npred,npred_radiag - -! Allocate and initialize as needed - if (allocated(header_chan)) deallocate(header_chan) - if (allocated(data_name%chn)) deallocate(data_name%chn) - - allocate(header_chan( header_fix%nchan)) - allocate(data_name%chn(header_fix%idiag)) - - data_name%fix(1) ='lat ' - data_name%fix(2) ='lon ' - data_name%fix(3) ='zsges ' - data_name%fix(4) ='obstim ' - data_name%fix(5) ='scanpos ' - data_name%fix(6) ='satzen ' - data_name%fix(7) ='satazm ' - data_name%fix(8) ='solzen ' - data_name%fix(9) ='solazm ' - data_name%fix(10)='sungln ' - data_name%fix(11)='fwater ' - data_name%fix(12)='fland ' - data_name%fix(13)='fice ' - data_name%fix(14)='fsnow ' - data_name%fix(15)='twater ' - data_name%fix(16)='tland ' - data_name%fix(17)='tice ' - data_name%fix(18)='tsnow ' - data_name%fix(19)='tsoil ' - data_name%fix(20)='soilmoi ' - data_name%fix(21)='landtyp ' - data_name%fix(22)='vegfrac ' - data_name%fix(23)='snowdep ' - data_name%fix(24)='wndspd ' - data_name%fix(25)='qc1 ' - data_name%fix(26)='qc2 ' - data_name%fix(27)='tref ' - data_name%fix(28)='dtw ' - data_name%fix(29)='dtc ' - data_name%fix(30)='tz_tr ' - - data_name%chn(1)='obs ' - data_name%chn(2)='omgbc ' - data_name%chn(3)='omgnbc ' - data_name%chn(4)='errinv ' - data_name%chn(5)='qcmark ' - data_name%chn(6)='emiss ' - data_name%chn(7)='tlap ' - data_name%chn(8)='tb_tz ' - - if (header_fix%iversion < iversion_radiag_1) then - data_name%chn( 8)= 'bifix ' - data_name%chn( 9)= 'bilap ' - data_name%chn(10)= 'bilap2 ' - data_name%chn(11)= 'bicons ' - data_name%chn(12)= 'biang ' - data_name%chn(13)= 'biclw ' - if (retrieval) data_name%chn(13)= 'bisst ' - elseif ( header_fix%iversion < iversion_radiag_2 .and. header_fix%iversion >= iversion_radiag_1 ) then - data_name%chn( 8)= 'bicons ' - data_name%chn( 9)= 'biang ' - data_name%chn(10)= 'biclw ' - data_name%chn(11)= 'bilap2 ' - data_name%chn(12)= 'bilap ' - do i=1,header_fix%angord - write(string,'(i2.2)') header_fix%angord-i+1 - data_name%chn(12+i)= 'bifix' // string - end do - data_name%chn(12+header_fix%angord+1)= 'bifix ' - data_name%chn(12+header_fix%angord+2)= 'bisst ' - elseif ( header_fix%iversion < iversion_radiag_3 .and. header_fix%iversion >= iversion_radiag_2 ) then - data_name%chn( 9)= 'bicons ' - data_name%chn(10)= 'biang ' - data_name%chn(11)= 'biclw ' - data_name%chn(12)= 'bilap2 ' - data_name%chn(13)= 'bilap ' - do i=1,header_fix%angord - write(string,'(i2.2)') header_fix%angord-i+1 - data_name%chn(13+i)= 'bifix' // string - end do - data_name%chn(13+header_fix%angord+1)= 'bifix ' - data_name%chn(13+header_fix%angord+2)= 'bisst ' - elseif ( header_fix%iversion < iversion_radiag_4 .and. header_fix%iversion >= iversion_radiag_3 ) then - data_name%chn( 9)= 'bicons ' - data_name%chn(10)= 'biang ' - data_name%chn(11)= 'biclw ' - data_name%chn(12)= 'bilap2 ' - data_name%chn(13)= 'bilap ' - data_name%chn(14)= 'bicos ' - data_name%chn(15)= 'bisin ' - do i=1,header_fix%angord - write(string,'(i2.2)') header_fix%angord-i+1 - data_name%chn(15+i)= 'bifix' // string - end do - data_name%chn(15+header_fix%angord+1)= 'bifix ' - data_name%chn(15+header_fix%angord+2)= 'bisst ' - else - data_name%chn( 9)= 'bicons ' - data_name%chn(10)= 'biang ' - data_name%chn(11)= 'biclw ' - data_name%chn(12)= 'bilap2 ' - data_name%chn(13)= 'bilap ' - data_name%chn(14)= 'bicos ' - data_name%chn(15)= 'bisin ' - data_name%chn(16)= 'biemis ' - do i=1,header_fix%angord - write(string,'(i2.2)') header_fix%angord-i+1 - data_name%chn(16+i)= 'bifix' // string - end do - data_name%chn(16+header_fix%angord+1)= 'bifix ' - data_name%chn(16+header_fix%angord+2)= 'bisst ' - endif - -! Read header (channel part) - do ich=1, header_fix%nchan - read(ftin,IOSTAT=iflag) freq_tmp,polar_tmp,wave_tmp,varch_tmp,tlapmean_tmp,iuse_tmp,nuchan_tmp,iochan_tmp - header_chan(ich)%freq = freq_tmp - header_chan(ich)%polar = polar_tmp - header_chan(ich)%wave = wave_tmp - header_chan(ich)%varch = varch_tmp - header_chan(ich)%tlapmean = tlapmean_tmp - header_chan(ich)%iuse = iuse_tmp - header_chan(ich)%nuchan = nuchan_tmp - header_chan(ich)%iochan = iochan_tmp - if (iflag/=0) return - end do - -! Construct array containing menonics for data record entries - - -end subroutine read_radiag_header - -subroutine read_radiag_data(ftin,header_fix,retrieval,data_fix,data_chan,data_extra,iflag ) -! . . . . -! subprogram: read_radiag_dat read rad diag data -! prgmmr: tahara org: np20 date: 2003-01-01 -! -! abstract: This routine reads the data record from a radiance -! diagnostic file -! -! program history log: -! 2010-10-05 treadon - add this doc block -! 2011-02-22 kleist - changes related to memory allocation -! -! input argument list: -! ftin - unit number connected to diagnostic file -! header_fix - header information structure -! -! output argument list: -! data_fix - spot header information structure -! data_chan - spot channel information structure -! data_extra - spot extra information -! iflag - error code -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ - - -! Declare passed arguments - integer(i_kind),intent(in) :: ftin - type(diag_header_fix_list ),intent(in) :: header_fix - logical,intent(in) :: retrieval - type(diag_data_fix_list) ,intent(out):: data_fix - type(diag_data_chan_list) ,allocatable :: data_chan(:) - type(diag_data_extra_list) ,allocatable :: data_extra(:,:) - integer(i_kind),intent(out) :: iflag - - integer(i_kind) :: ich,iang,i,j - real(r_single),dimension(:,:),allocatable :: data_tmp - real(r_single),dimension(:),allocatable :: fix_tmp - real(r_single),dimension(:,:),allocatable :: extra_tmp - -! Allocate arrays as needed - if (allocated(data_chan)) deallocate(data_chan) - allocate(data_chan(header_fix%nchan)) - - do ich=1,header_fix%nchan - if (allocated(data_chan(ich)%bifix)) deallocate(data_chan(ich)%bifix) - allocate(data_chan(ich)%bifix(header_fix%angord+1)) - end do - - if (header_fix%iextra > 0) then - if (allocated(data_extra)) deallocate(data_extra) - allocate(data_extra(header_fix%iextra,header_fix%jextra)) - allocate(extra_tmp(header_fix%iextra,header_fix%jextra)) - end if - -! Allocate arrays to hold data record - allocate(data_tmp(header_fix%idiag,header_fix%nchan)) - - if (header_fix%iversion < iversion_radiag_2) then - allocate( fix_tmp( ireal_old_radiag ) ) - else - allocate( fix_tmp( ireal_radiag ) ) - end if - -! Read data record - - if (header_fix%iextra == 0) then - read(ftin,IOSTAT=iflag) fix_tmp, data_tmp - else - read(ftin,IOSTAT=iflag) fix_tmp, data_tmp, extra_tmp - endif - - -! Transfer fix_tmp record to output structure - data_fix%lat = fix_tmp(1) - data_fix%lon = fix_tmp(2) - data_fix%zsges = fix_tmp(3) - data_fix%obstime = fix_tmp(4) - data_fix%senscn_pos = fix_tmp(5) - data_fix%satzen_ang = fix_tmp(6) - data_fix%satazm_ang = fix_tmp(7) - data_fix%solzen_ang = fix_tmp(8) - data_fix%solazm_ang = fix_tmp(9) - data_fix%sungln_ang = fix_tmp(10) - data_fix%water_frac = fix_tmp(11) - data_fix%land_frac = fix_tmp(12) - data_fix%ice_frac = fix_tmp(13) - data_fix%snow_frac = fix_tmp(14) - data_fix%water_temp = fix_tmp(15) - data_fix%land_temp = fix_tmp(16) - data_fix%ice_temp = fix_tmp(17) - data_fix%snow_temp = fix_tmp(18) - data_fix%soil_temp = fix_tmp(19) - data_fix%soil_mois = fix_tmp(20) - data_fix%land_type = fix_tmp(21) - data_fix%veg_frac = fix_tmp(22) - data_fix%snow_depth = fix_tmp(23) - data_fix%sfc_wndspd = fix_tmp(24) - data_fix%qcdiag1 = fix_tmp(25) - data_fix%qcdiag2 = fix_tmp(26) - - if ( header_fix%iversion <= iversion_radiag_1 ) then - data_fix%tref = rmiss_radiag - data_fix%dtw = rmiss_radiag - data_fix%dtc = rmiss_radiag - data_fix%tz_tr = rmiss_radiag - else - data_fix%tref = fix_tmp(27) - data_fix%dtw = fix_tmp(28) - data_fix%dtc = fix_tmp(29) - data_fix%tz_tr = fix_tmp(30) - end if - - -! Transfer data record to output structure - do ich=1,header_fix%nchan - data_chan(ich)%tbobs =data_tmp(1,ich) - data_chan(ich)%omgbc =data_tmp(2,ich) - data_chan(ich)%omgnbc=data_tmp(3,ich) - data_chan(ich)%errinv=data_tmp(4,ich) - data_chan(ich)%qcmark=data_tmp(5,ich) - data_chan(ich)%emiss =data_tmp(6,ich) - data_chan(ich)%tlap =data_tmp(7,ich) - data_chan(ich)%tb_tz =data_tmp(8,ich) - end do - if (header_fix%iversion < iversion_radiag_1) then - do ich=1,header_fix%nchan - data_chan(ich)%bifix(1)=data_tmp(8,ich) - data_chan(ich)%bilap =data_tmp(9,ich) - data_chan(ich)%bilap2 =data_tmp(10,ich) - data_chan(ich)%bicons =data_tmp(11,ich) - data_chan(ich)%biang =data_tmp(12,ich) - data_chan(ich)%biclw =data_tmp(13,ich) - data_chan(ich)%bisst = rmiss_radiag - if (retrieval) then - data_chan(ich)%biclw =rmiss_radiag - data_chan(ich)%bisst =data_tmp(13,ich) - endif - end do - elseif ( header_fix%iversion < iversion_radiag_2 .and. header_fix%iversion >= iversion_radiag_1 ) then - do ich=1,header_fix%nchan - data_chan(ich)%bicons=data_tmp(8,ich) - data_chan(ich)%biang =data_tmp(9,ich) - data_chan(ich)%biclw =data_tmp(10,ich) - data_chan(ich)%bilap2=data_tmp(11,ich) - data_chan(ich)%bilap =data_tmp(12,ich) - end do - do ich=1,header_fix%nchan - do iang=1,header_fix%angord+1 - data_chan(ich)%bifix(iang)=data_tmp(12+iang,ich) - end do - data_chan(ich)%bisst = data_tmp(12+header_fix%angord+2,ich) - end do - elseif ( header_fix%iversion < iversion_radiag_3 .and. header_fix%iversion >= iversion_radiag_2 ) then - do ich=1,header_fix%nchan - data_chan(ich)%bicons=data_tmp(9,ich) - data_chan(ich)%biang =data_tmp(10,ich) - data_chan(ich)%biclw =data_tmp(11,ich) - data_chan(ich)%bilap2=data_tmp(12,ich) - data_chan(ich)%bilap =data_tmp(13,ich) - end do - do ich=1,header_fix%nchan - do iang=1,header_fix%angord+1 - data_chan(ich)%bifix(iang)=data_tmp(13+iang,ich) - end do - data_chan(ich)%bisst = data_tmp(13+header_fix%angord+2,ich) - end do - elseif ( header_fix%iversion < iversion_radiag_4 .and. header_fix%iversion >= iversion_radiag_3 ) then - do ich=1,header_fix%nchan - data_chan(ich)%bicons=data_tmp(9,ich) - data_chan(ich)%biang =data_tmp(10,ich) - data_chan(ich)%biclw =data_tmp(11,ich) - data_chan(ich)%bilap2=data_tmp(12,ich) - data_chan(ich)%bilap =data_tmp(13,ich) - data_chan(ich)%bicos =data_tmp(14,ich) ! 1st bias correction term node*cos(lat) for SSMIS - data_chan(ich)%bisin =data_tmp(15,ich) ! 2nd bias correction term sin(lat) for SSMI - end do - do ich=1,header_fix%nchan - do iang=1,header_fix%angord+1 - data_chan(ich)%bifix(iang)=data_tmp(15+iang,ich) - end do - data_chan(ich)%bisst = data_tmp(15+header_fix%angord+2,ich) - end do - else - do ich=1,header_fix%nchan - data_chan(ich)%bicons=data_tmp(9,ich) - data_chan(ich)%biang =data_tmp(10,ich) - data_chan(ich)%biclw =data_tmp(11,ich) - data_chan(ich)%bilap2=data_tmp(12,ich) - data_chan(ich)%bilap =data_tmp(13,ich) - data_chan(ich)%bicos =data_tmp(14,ich) - data_chan(ich)%bisin =data_tmp(15,ich) - data_chan(ich)%biemis=data_tmp(16,ich) - end do - do ich=1,header_fix%nchan - do iang=1,header_fix%angord+1 - data_chan(ich)%bifix(iang)=data_tmp(16+iang,ich) - end do - data_chan(ich)%bisst = data_tmp(16+header_fix%angord+2,ich) - end do - endif - - if (header_fix%iextra > 0) then - do j=1,header_fix%jextra - do i=1,header_fix%iextra - data_extra(i,j)%extra=extra_tmp(i,j) - end do - end do - endif - - deallocate(data_tmp, fix_tmp) - if (header_fix%iextra > 0) deallocate(extra_tmp) - -end subroutine read_radiag_data - -end module read_diag - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radbcor.fd/readme b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radbcor.fd/readme deleted file mode 100644 index 6957c66f6f..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radbcor.fd/readme +++ /dev/null @@ -1,23 +0,0 @@ -Instructions for building radmon_bcor executable. - - 1) Load the build module appropriate for your Machine: - i.) - WCOSS: - "module use -a ../../modulefiles/wcoss" - THEIA: - "module use -a ../../modulefiles/theia" - ii.) - "module load RadMonBuild" - - 2) Optional: verify all prerequisites are met by typing: - "make check_prereqs" - - 3) Build the executable by typing: - "make" - - 4) Move the executable to the ../../exec directory by typing: - "make install" - - 5) Unload the build module: - "module unload RadMonBuild" - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radtime.fd/CMakeLists.txt b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radtime.fd/CMakeLists.txt deleted file mode 100644 index 6d35353bb0..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radtime.fd/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ -cmake_minimum_required(VERSION 2.6) - file(GLOB RADMON_TIME_SRC ${CMAKE_CURRENT_SOURCE_DIR}/*90 ) - set(RADMON_TIME_Fortran_FLAGS "-fp-model strict -assume byterecl -convert big_endian -O3 -traceback -D_REAL8_ ") - set(Util_MODULE_DIR ${PROJECT_BINARY_DIR}/include/radmon_time ) - set_source_files_properties( ${RADMON_TIME_SRC} PROPERTIES COMPILE_FLAGS ${RADMON_TIME_Fortran_FLAGS} ) - add_executable(radmon_time ${RADMON_TIME_SRC} ) - set_target_properties( radmon_time PROPERTIES COMPILE_FLAGS ${RADMON_TIME_Fortran_FLAGS} ) - set_target_properties( radmon_time PROPERTIES Fortran_MODULE_DIRECTORY ${Util_MODULE_DIR} ) - include_directories( ${CORE_INCS} ) - target_link_libraries( radmon_time ${W3NCO_4_LIBRARY} ) - if(BUILD_W3NCO) - add_dependencies( radmon_time ${W3NCO_4_LIBRARY} ) - endif() - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radtime.fd/bad_chan.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radtime.fd/bad_chan.f90 deleted file mode 100644 index eaac10cff6..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radtime.fd/bad_chan.f90 +++ /dev/null @@ -1,94 +0,0 @@ -!$$$ subprogram documentation block -! . . . -! subprogram: bad_chan build bad_chan.txt file -! prgmmr: safford date: 2009-11 -! -! abstract: This module contains code to build the bad_chan.txt file. -! The bad_chan.txt file reports the satellite and channel for -! which zero obs were found on a channel that is set for use -! and normally has data. -! -! program history log: -! 2009-12-22 safford - initial coding -! -! contains: -! -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ - -module bad_chan - - implicit none - - private - - public :: open_bad_chan_file - public :: write_bad_chan - public :: close_bad_chan_file - - integer, parameter :: funit = 14 - - contains - - - !------------------------------------------------------------- - ! create the bad_chan file - !------------------------------------------------------------- - - subroutine open_bad_chan_file( date, cycle, fios ) - - !--- interface - character(8), intent( in ) :: date - character(8), intent( in ) :: cycle - integer, intent( out ) :: fios - - !--- variables - logical :: lexist = .FALSE. - character(60) :: fname - - -! write(*,*) '--> open_bad_chan_file, date, cycle = ', date, cycle - !--- build the file name - fname = 'bad_chan.' // trim(date) // trim(cycle) - - write(*,*) ' fname = ', fname - - !--- open file and write the header - inquire(file=fname, exist=lexist) - if( lexist .eqv. .FALSE. ) then - write(6,*) ' opening new bad_chan file' - open( UNIT=funit, FILE=fname, STATUS='NEW', IOSTAT=fios ) - else - write(6,*) ' opening existing bad_chan.txt file' - open( UNIT=funit, FILE=fname, STATUS='OLD', POSITION='APPEND', IOSTAT=fios ) - end if - - end subroutine open_bad_chan_file - - - subroutine write_bad_chan( satname, channel ) - - !--- interface - character(20), intent( in ) :: satname - integer, intent( in ) :: channel - - !--- variables - real :: count - - write(6,*) 'write_bad_chan, satname, channel', satname, channel - - write(funit,*) satname, 'channel= ', channel - - end subroutine write_bad_chan - - - subroutine close_bad_chan_file( ) -! write(6,*) '--> close_bad_chan_file' - close( funit ) - end subroutine close_bad_chan_file - -end module bad_chan diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radtime.fd/bad_obs.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radtime.fd/bad_obs.f90 deleted file mode 100644 index 9962b00bb3..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radtime.fd/bad_obs.f90 +++ /dev/null @@ -1,99 +0,0 @@ -!$$$ subprogram documentation block -! . . . -! subprogram: bad_obs build bad_obs.txt file -! prgmmr: safford date: 2009-11 -! -! abstract: This module contains code to build the bad_obs.txt file. -! The bad_obs.txt file reports the satellite and channel for -! which an unexpected number of observations were found in -! assimilated radiance data. -! -! program history log: -! 2009-11-23 safford - initial coding -! -! contains: -! -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ - -module bad_obs - - implicit none - - private - - public :: open_bad_obs_file - public :: write_bad_obs - public :: close_bad_obs_file - - integer, parameter :: funit = 10 - - contains - - - !------------------------------------------------------------- - ! create the bad_obs file - !------------------------------------------------------------- - - subroutine open_bad_obs_file( date, cycle, fios ) - - !--- interface - character(8), intent( in ) :: date - character(8), intent( in ) :: cycle - integer, intent( out ) :: fios - - !--- variables - logical :: lexist = .FALSE. - character(60) :: fname - - - write(*,*) '--> open_bad_obs_file, date, cycle = ', date, cycle - !--- build the file name - fname = 'bad_obs.' // trim(date) // trim(cycle) - - !--- open file and write the header - inquire(file=fname, exist=lexist) - if( lexist .eqv. .FALSE. ) then - write(*,*) ' opening new bad_obs file' - open( UNIT=funit, FILE=fname, STATUS='NEW', IOSTAT=fios ) - else - write(*,*) ' opening existing bad_obs.txt file' - open( UNIT=funit, FILE=fname, STATUS='OLD', POSITION='APPEND', IOSTAT=fios ) - end if - - end subroutine open_bad_obs_file - - - subroutine write_bad_obs( satname, channel, region, num_obs ) - - !--- interface - character(20), intent( in ) :: satname - integer, intent( in ) :: channel - integer, intent( in ) :: region - real, intent( in ) :: num_obs - - !--- variables - real :: count - - !--- -! if( num_obs < 0.0 ) then -! count = 0.0 -! else - count = num_obs -! end if - - write(funit,*) satname, 'channel= ', channel, ' region= ', region, ' num_obs= ', count - - end subroutine write_bad_obs - - - subroutine close_bad_obs_file( ) - write(*,*) '--> close_bad_obs_file' - close( funit ) - end subroutine close_bad_obs_file - -end module bad_obs diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radtime.fd/bad_penalty.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radtime.fd/bad_penalty.f90 deleted file mode 100644 index 55c822c7e8..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radtime.fd/bad_penalty.f90 +++ /dev/null @@ -1,100 +0,0 @@ -!$$$ subprogram documentation block -! . . . -! subprogram: penalty build penalty.txt file -! prgmmr: safford date: 2009-11 -! -! abstract: This module contains code to build the penalty.txt file. -! The penalty.txt file reports the satellite and channel for -! which a penalty value is likely out of range. -! -! program history log: -! 2009-11-23 safford - initial coding -! -! contains: -! -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ - -module bad_penalty - - implicit none - - private - - public :: open_bad_penalty_file - public :: write_bad_penalty - public :: close_bad_penalty_file - - integer, parameter :: funit = 11 - - contains - - - !------------------------------------------------------------- - ! open the bad_pen file - !------------------------------------------------------------- - - subroutine open_bad_penalty_file( date, cycle, fios ) - - !--- interface - character(8), intent( in ) :: date - character(8), intent( in ) :: cycle - integer, intent( out ) :: fios - - !--- variables - logical :: lexist = .FALSE. - character(60) :: fname - -! write(*,*) '--> open_bad_penalty_file, date, cycle = ', date, cycle - - !--- build the file name - fname= 'bad_pen.' // trim(date) // trim(cycle) - write(*,*) ' fname = ', fname - - !--- open file and write the header - inquire(file=fname, exist=lexist) - if( lexist .eqv. .FALSE. ) then - write(*,*) ' opening new bad_pen file' - open( UNIT=funit, FILE=fname, STATUS='NEW', IOSTAT=fios ) - else - write(*,*) ' opening existing bad_penalty.txt file' - open( UNIT=funit, FILE=fname, STATUS='OLD', POSITION='APPEND', IOSTAT=fios ) - end if - - end subroutine open_bad_penalty_file - - - !------------------------------------------------------------- - ! add an entry to the bad_penalty.txt file - !------------------------------------------------------------- - subroutine write_bad_penalty( satname, channel, region, penalty, bound ) - - !--- interface - character(20), intent( in ) :: satname - integer, intent( in ) :: channel - integer, intent( in ) :: region - real, intent( in ) :: penalty - real, intent( in ) :: bound - character(60) :: myformat - - myformat = "(A20,A10,I5,A9,I1,A10,ES15.7E2,A8,ES15.7E2)" - - - write(funit,myformat) satname, ' channel= ',channel, ' region= ', region, ' penalty= ', penalty, ' bound= ', bound - - end subroutine write_bad_penalty - - - !------------------------------------------------------------- - ! close the bad_penalty.txt file - !------------------------------------------------------------- - subroutine close_bad_penalty_file( ) -! write(*,*) '--> close_bad_penalty_file' - close( funit ) - end subroutine close_bad_penalty_file - -end module bad_penalty diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radtime.fd/kinds.F90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radtime.fd/kinds.F90 deleted file mode 100644 index 8b3a2fcc4e..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radtime.fd/kinds.F90 +++ /dev/null @@ -1,112 +0,0 @@ -module kinds -!$$$ module documentation block -! . . . . -! module: kinds -! prgmmr: treadon org: np23 date: 2004-08-15 -! -! abstract: Module to hold specification kinds for variable declaration. -! This module is based on (copied from) Paul vanDelst's -! type_kinds module found in the community radiative transfer -! model -! -! module history log: -! 2004-08-15 treadon -! 2011-07-04 todling - define main precision during compilation -! -! Subroutines Included: -! -! Functions Included: -! -! remarks: -! The numerical data types defined in this module are: -! i_byte - specification kind for byte (1-byte) integer variable -! i_short - specification kind for short (2-byte) integer variable -! i_long - specification kind for long (4-byte) integer variable -! i_llong - specification kind for double long (8-byte) integer variable -! r_single - specification kind for single precision (4-byte) real variable -! r_double - specification kind for double precision (8-byte) real variable -! r_quad - specification kind for quad precision (16-byte) real variable -! -! i_kind - generic specification kind for default integer -! r_kind - generic specification kind for default floating point -! -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ end documentation block - implicit none - private - -! Integer type definitions below - -! Integer types - integer, parameter, public :: i_byte = selected_int_kind(1) ! byte integer - integer, parameter, public :: i_short = selected_int_kind(4) ! short integer - integer, parameter, public :: i_long = selected_int_kind(8) ! long integer - integer, parameter, private :: llong_t = selected_int_kind(16) ! llong integer - integer, parameter, public :: i_llong = max( llong_t, i_long ) - -! Expected 8-bit byte sizes of the integer kinds - integer, parameter, public :: num_bytes_for_i_byte = 1 - integer, parameter, public :: num_bytes_for_i_short = 2 - integer, parameter, public :: num_bytes_for_i_long = 4 - integer, parameter, public :: num_bytes_for_i_llong = 8 - -! Define arrays for default definition - integer, parameter, private :: num_i_kinds = 4 - integer, parameter, dimension( num_i_kinds ), private :: integer_types = (/ & - i_byte, i_short, i_long, i_llong /) - integer, parameter, dimension( num_i_kinds ), private :: integer_byte_sizes = (/ & - num_bytes_for_i_byte, num_bytes_for_i_short, & - num_bytes_for_i_long, num_bytes_for_i_llong /) - -! Default values -! **** CHANGE THE FOLLOWING TO CHANGE THE DEFAULT INTEGER TYPE KIND *** - integer, parameter, private :: default_integer = 3 ! 1=byte, - ! 2=short, - ! 3=long, - ! 4=llong - integer, parameter, public :: i_kind = integer_types( default_integer ) - integer, parameter, public :: num_bytes_for_i_kind = & - integer_byte_sizes( default_integer ) - - -! Real definitions below - -! Real types - integer, parameter, public :: r_single = selected_real_kind(6) ! single precision - integer, parameter, public :: r_double = selected_real_kind(15) ! double precision - integer, parameter, private :: quad_t = selected_real_kind(20) ! quad precision - integer, parameter, public :: r_quad = max( quad_t, r_double ) - -! Expected 8-bit byte sizes of the real kinds - integer, parameter, public :: num_bytes_for_r_single = 4 - integer, parameter, public :: num_bytes_for_r_double = 8 - integer, parameter, public :: num_bytes_for_r_quad = 16 - -! Define arrays for default definition - integer, parameter, private :: num_r_kinds = 3 - integer, parameter, dimension( num_r_kinds ), private :: real_kinds = (/ & - r_single, r_double, r_quad /) - integer, parameter, dimension( num_r_kinds ), private :: real_byte_sizes = (/ & - num_bytes_for_r_single, num_bytes_for_r_double, & - num_bytes_for_r_quad /) - -! Default values -! **** CHANGE THE FOLLOWING TO CHANGE THE DEFAULT REAL TYPE KIND *** -#ifdef _REAL4_ - integer, parameter, private :: default_real = 1 ! 1=single, -#endif -#ifdef _REAL8_ - integer, parameter, private :: default_real = 2 ! 2=double, -#endif -#ifdef _REAL16_ - integer, parameter, private :: default_real = 3 ! 3=quad -#endif - integer, parameter, public :: r_kind = real_kinds( default_real ) - integer, parameter, public :: num_bytes_for_r_kind = & - real_byte_sizes( default_real ) - -end module kinds diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radtime.fd/makefile b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radtime.fd/makefile deleted file mode 100755 index e0d8765fd6..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radtime.fd/makefile +++ /dev/null @@ -1,62 +0,0 @@ -# ***************************************************************** -# makefile -# -# Make the radmon_time executable. -# -# ***************************************************************** - -BINDIR = $(dir_root)/exec - -LIBS = $(W3NCO_LIB4) - -OBJS = kinds.o read_diag.o bad_obs.o bad_penalty.o bad_chan.o valid.o \ - time.o create_ctl_time.o - -# -# ***************************************************************** -# - -CMD = radmon_time - -all: $(CMD) - -clean: - rm -f *.o - rm -f *.mod - rm -f radmon_time - -check_prereqs: - $(CHECK_LIBS) $(LIBS) - -install: - cp -f $(CMD) $(BINDIR)/ - -debug: FFLAGS = $(D_FFLAGS) -debug: $(CMD) - -$(CMD): $(OBJS) - $(CF) $(FFLAGS) $(LDFLAGS) -o $(@) $(OBJS) $(LIBS) - -read_diag.o : read_diag.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -bad_obs.o : bad_obs.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -bad_penalty.o : bad_penalty.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -bad_chan.o : bad_chan.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -valid.o : valid.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -time.o : time.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -create_ctl_time.o : create_ctl_time.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -kinds.o : kinds.F90 - $(CF) $(FFLAGS) -c $(*).F90 diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radtime.fd/read_diag.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radtime.fd/read_diag.f90 deleted file mode 100755 index 7a4d6cdc49..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radtime.fd/read_diag.f90 +++ /dev/null @@ -1,659 +0,0 @@ -!$$$ subprogram documentation block -! . . . . -! subprogram: read_raddiag read rad diag file -! prgmmr: tahara org: np20 date: 2003-01-01 -! -! abstract: This module contains code to process radiance -! diagnostic files. The module defines structures -! to contain information from the radiance -! diagnostic files and then provides two routines -! to access contents of the file. -! -! program history log: -! 2005-07-22 treadon - add this doc block -! 2010-10-05 treadon - refactor code to GSI standard -! 2010-10-08 zhu - use data_tmp to handle various npred values -! 2011-02-22 kleist - changes related to memory allocate/deallocate -! 2011-04-08 li - add tref, dtw, dtc to diag_data_fix_list, add tb_tz to diag_data_chan_list -! - correspondingly, change ireal_radiag (26 -> 30) and ipchan_radiag (7 -> 8) -! 2011-07-24 safford - make structure size for reading data_fix data version dependent -! 2013-11-21 todling - revisit how versions are set (add set/get_radiag) -! 2014-01-27 todling - add ob sensitivity index -! -! contains -! read_radiag_header - read radiance diagnostic file header -! read_radiag_data - read radiance diagnostic file data -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ - -module read_diag - - use kinds, only: i_kind,r_single - implicit none - -! Declare public and private - private - - public :: diag_header_fix_list - public :: diag_header_chan_list - public :: diag_data_name_list - public :: diag_data_fix_list - public :: diag_data_chan_list - public :: diag_data_extra_list - public :: read_radiag_header - public :: read_radiag_data -! public :: iversion_radiag -! public :: iversion_radiag_1 -! public :: iversion_radiag_2 -! public :: iversion_radiag_3 -! public :: iversion_radiag_4 - public :: ireal_radiag - public :: ipchan_radiag - public :: set_radiag - public :: get_radiag - - interface set_radiag - module procedure set_radiag_int_ ! internal procedure for integers - end interface - interface get_radiag - module procedure get_radiag_int_ ! internal procedure for integers - end interface - - integer(i_kind),parameter :: ireal_radiag = 30 ! number of real entries per spot in radiance diagnostic file - integer(i_kind),parameter :: ireal_old_radiag = 26 ! number of real entries per spot in versions older than iversion_radiag_2 - integer(i_kind),parameter :: ipchan_radiag = 8 ! number of entries per channel per spot in radiance diagnostic file - -! Declare structures for radiance diagnostic file information - type diag_header_fix_list - character(len=20) :: isis ! sat and sensor type - character(len=10) :: id ! sat type - character(len=10) :: obstype ! observation type - integer(i_kind) :: jiter ! outer loop counter - integer(i_kind) :: nchan ! number of channels in the sensor - integer(i_kind) :: npred ! number of updating bias correction predictors - integer(i_kind) :: idate ! time (yyyymmddhh) - integer(i_kind) :: ireal ! # of real elements in the fix part of a data record - integer(i_kind) :: ipchan ! # of elements for each channel except for bias correction terms - integer(i_kind) :: iextra ! # of extra elements for each channel - integer(i_kind) :: jextra ! # of extra elements - integer(i_kind) :: idiag ! first dimension of diag_data_chan - integer(i_kind) :: angord ! order of polynomial for adp_anglebc option - integer(i_kind) :: iversion ! radiance diagnostic file version number - integer(i_kind) :: inewpc ! indicator of newpc4pred (1 on, 0 off) - integer(i_kind) :: isens ! sensitivity index - end type diag_header_fix_list - - type diag_data_name_list - character(len=10),dimension(ireal_radiag) :: fix - character(len=10),dimension(:),allocatable :: chn - end type diag_data_name_list - - type diag_header_chan_list - real(r_single) :: freq ! frequency (Hz) - real(r_single) :: polar ! polarization - real(r_single) :: wave ! wave number (cm^-1) - real(r_single) :: varch ! error variance (or SD error?) - real(r_single) :: tlapmean ! mean lapse rate - integer(i_kind):: iuse ! use flag - integer(i_kind):: nuchan ! sensor relative channel number - integer(i_kind):: iochan ! satinfo relative channel number - end type diag_header_chan_list - - type diag_data_fix_list - real(r_single) :: lat ! latitude (deg) - real(r_single) :: lon ! longitude (deg) - real(r_single) :: zsges ! guess elevation at obs location (m) - real(r_single) :: obstime ! observation time relative to analysis - real(r_single) :: senscn_pos ! sensor scan position (integer(i_kind)) - real(r_single) :: satzen_ang ! satellite zenith angle (deg) - real(r_single) :: satazm_ang ! satellite azimuth angle (deg) - real(r_single) :: solzen_ang ! solar zenith angle (deg) - real(r_single) :: solazm_ang ! solar azimumth angle (deg) - real(r_single) :: sungln_ang ! sun glint angle (deg) - real(r_single) :: water_frac ! fractional coverage by water - real(r_single) :: land_frac ! fractional coverage by land - real(r_single) :: ice_frac ! fractional coverage by ice - real(r_single) :: snow_frac ! fractional coverage by snow - real(r_single) :: water_temp ! surface temperature over water (K) - real(r_single) :: land_temp ! surface temperature over land (K) - real(r_single) :: ice_temp ! surface temperature over ice (K) - real(r_single) :: snow_temp ! surface temperature over snow (K) - real(r_single) :: soil_temp ! soil temperature (K) - real(r_single) :: soil_mois ! soil moisture - real(r_single) :: land_type ! land type (integer(i_kind)) - real(r_single) :: veg_frac ! vegetation fraction - real(r_single) :: snow_depth ! snow depth - real(r_single) :: sfc_wndspd ! surface wind speed - real(r_single) :: qcdiag1 ! ir=cloud fraction, mw=cloud liquid water - real(r_single) :: qcdiag2 ! ir=cloud top pressure, mw=total column water - real(r_single) :: tref ! reference temperature (Tr) in NSST - real(r_single) :: dtw ! dt_warm at zob - real(r_single) :: dtc ! dt_cool at zob - real(r_single) :: tz_tr ! d(Tz)/d(Tr) - end type diag_data_fix_list - - type diag_data_chan_list - real(r_single) :: tbobs ! Tb (obs) (K) - real(r_single) :: omgbc ! Tb_(obs) - Tb_(simulated w/ bc) (K) - real(r_single) :: omgnbc ! Tb_(obs) - Tb_(simulated_w/o bc) (K) - real(r_single) :: errinv ! inverse error (K**(-1)) - real(r_single) :: qcmark ! quality control mark - real(r_single) :: emiss ! surface emissivity - real(r_single) :: tlap ! temperature lapse rate - real(r_single) :: tb_tz ! d(Tb)/d(Tz) - real(r_single) :: bicons ! constant bias correction term - real(r_single) :: biang ! scan angle bias correction term - real(r_single) :: biclw ! CLW bias correction term - real(r_single) :: bilap2 ! square lapse rate bias correction term - real(r_single) :: bilap ! lapse rate bias correction term - real(r_single) :: bicos ! node*cos(lat) bias correction term - real(r_single) :: bisin ! sin(lat) bias correction term - real(r_single) :: biemis ! emissivity sensitivity bias correction term - real(r_single),dimension(:),allocatable :: bifix ! angle dependent bias - real(r_single) :: bisst ! SST bias correction term - end type diag_data_chan_list - - type diag_data_extra_list - real(r_single) :: extra ! extra information - end type diag_data_extra_list - - integer(i_kind),save :: iversion_radiag ! Current version (see set routine) - integer(i_kind),parameter:: iversion_radiag_1 = 11104 ! Version when bias-correction entries were modified - integer(i_kind),parameter:: iversion_radiag_2 = 13784 ! Version when NSST entries were added - integer(i_kind),parameter:: iversion_radiag_3 = 19180 ! Version when SSMIS added - integer(i_kind),parameter:: iversion_radiag_4 = 30303 ! Version when emissivity predictor added - - real(r_single),parameter:: rmiss_radiag = -9.9e11_r_single - -contains - -subroutine set_radiag_int_ (what,iv,ier) -character(len=*),intent(in) :: what -integer(i_kind),intent(in) :: iv -integer(i_kind),intent(out):: ier -ier=-1 -if(trim(what)=='version') then - iversion_radiag = iv - ier=0 -endif -end subroutine set_radiag_int_ - -subroutine get_radiag_int_ (what,iv,ier) -character(len=*),intent(in) :: what -integer(i_kind),intent(out):: iv -integer(i_kind),intent(out):: ier -ier=-1 -if(trim(what)=='version') then - iv = iversion_radiag - ier=0 -endif -end subroutine get_radiag_int_ - -subroutine read_radiag_header(ftin,npred_radiag,retrieval,header_fix,header_chan,data_name,iflag,lverbose) -! . . . . -! subprogram: read_diag_header read rad diag header -! prgmmr: tahara org: np20 date: 2003-01-01 -! -! abstract: This routine reads the header record from a radiance -! diagnostic file -! -! program history log: -! 2010-10-05 treadon - add this doc block -! 2011-02-22 kleist - changes related to memory allocation and standard output -! -! input argument list: -! ftin - unit number connected to diagnostic file -! npred_radiag - number of bias correction terms -! retrieval - .true. if sst retrieval -! -! output argument list: -! header_fix - header information structure -! header_chan - channel information structure -! data_name - diag file data names -! iflag - error code -! lverbose - optional flag to turn off default output to standard out -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ - -! Declare passed arguments - integer(i_kind),intent(in) :: ftin - integer(i_kind),intent(in) :: npred_radiag - logical,intent(in) :: retrieval - type(diag_header_fix_list ),intent(out):: header_fix - type(diag_header_chan_list),allocatable :: header_chan(:) - type(diag_data_name_list) :: data_name - integer(i_kind),intent(out) :: iflag - logical,optional,intent(in) :: lverbose - -! Declare local variables - character(len=2):: string - character(len=10):: satid,sentype - character(len=20):: sensat - integer(i_kind) :: i,ich - integer(i_kind):: jiter,nchanl,npred,ianldate,ireal,ipchan,iextra,jextra - integer(i_kind):: idiag,angord,iversion,inewpc,isens - integer(i_kind):: iuse_tmp,nuchan_tmp,iochan_tmp - real(r_single) :: freq_tmp,polar_tmp,wave_tmp,varch_tmp,tlapmean_tmp - logical loutall - - loutall=.true. - if(present(lverbose)) loutall=lverbose - -! Read header (fixed_part). - read(ftin,IOSTAT=iflag) sensat,satid,sentype,jiter,nchanl,npred,ianldate,& - ireal,ipchan,iextra,jextra,idiag,angord,iversion,inewpc,isens - if (iflag/=0) then - rewind(ftin) - read(ftin,IOSTAT=iflag) sensat,satid,sentype,jiter,nchanl,npred,ianldate,& - ireal,ipchan,iextra,jextra,idiag,angord,iversion,inewpc - isens=0 - end if - - if (iflag/=0) then - rewind(ftin) - read(ftin,IOSTAT=iflag) sensat,satid,sentype,jiter,nchanl,npred,ianldate,& - ireal,ipchan,iextra,jextra - idiag=ipchan+npred+1 - angord=0 - iversion=0 - inewpc=0 - isens=0 - if (iflag/=0) then - write(6,*)'READ_RADIAG_HEADER: ***ERROR*** Unknown file format. Cannot read' - return - endif - endif - - header_fix%isis = sensat - header_fix%id = satid - header_fix%obstype = sentype - header_fix%jiter = jiter - header_fix%nchan = nchanl - header_fix%npred = npred - header_fix%idate = ianldate - header_fix%ireal = ireal - header_fix%ipchan = ipchan - header_fix%iextra = iextra - header_fix%jextra = jextra - header_fix%idiag = idiag - header_fix%angord = angord - header_fix%iversion= iversion - header_fix%inewpc = inewpc - header_fix%isens = isens - - if (loutall) then - write(6,*)'READ_RADIAG_HEADER: isis=',header_fix%isis,& - ' nchan=',header_fix%nchan,& - ' npred=',header_fix%npred,& - ' angord=',header_fix%angord,& - ' idiag=',header_fix%idiag,& - ' iversion=',header_fix%iversion,& - ' inewpc=',header_fix%inewpc,& - ' isens=',header_fix%isens - - if ( header_fix%iextra /= 0) & - write(6,*)'READ_RADIAG_HEADER: extra diagnostic information available, ',& - 'iextra=',header_fix%iextra - end if - - if (header_fix%npred /= npred_radiag) & - write(6,*) 'READ_RADIAG_HEADER: **WARNING** header_fix%npred,npred=',& - header_fix%npred,npred_radiag - -! Allocate and initialize as needed - if (allocated(header_chan)) deallocate(header_chan) - if (allocated(data_name%chn)) deallocate(data_name%chn) - - allocate(header_chan( header_fix%nchan)) - allocate(data_name%chn(header_fix%idiag)) - - data_name%fix(1) ='lat ' - data_name%fix(2) ='lon ' - data_name%fix(3) ='zsges ' - data_name%fix(4) ='obstim ' - data_name%fix(5) ='scanpos ' - data_name%fix(6) ='satzen ' - data_name%fix(7) ='satazm ' - data_name%fix(8) ='solzen ' - data_name%fix(9) ='solazm ' - data_name%fix(10)='sungln ' - data_name%fix(11)='fwater ' - data_name%fix(12)='fland ' - data_name%fix(13)='fice ' - data_name%fix(14)='fsnow ' - data_name%fix(15)='twater ' - data_name%fix(16)='tland ' - data_name%fix(17)='tice ' - data_name%fix(18)='tsnow ' - data_name%fix(19)='tsoil ' - data_name%fix(20)='soilmoi ' - data_name%fix(21)='landtyp ' - data_name%fix(22)='vegfrac ' - data_name%fix(23)='snowdep ' - data_name%fix(24)='wndspd ' - data_name%fix(25)='qc1 ' - data_name%fix(26)='qc2 ' - data_name%fix(27)='tref ' - data_name%fix(28)='dtw ' - data_name%fix(29)='dtc ' - data_name%fix(30)='tz_tr ' - - data_name%chn(1)='obs ' - data_name%chn(2)='omgbc ' - data_name%chn(3)='omgnbc ' - data_name%chn(4)='errinv ' - data_name%chn(5)='qcmark ' - data_name%chn(6)='emiss ' - data_name%chn(7)='tlap ' - data_name%chn(8)='tb_tz ' - - if (header_fix%iversion < iversion_radiag_1) then - data_name%chn( 8)= 'bifix ' - data_name%chn( 9)= 'bilap ' - data_name%chn(10)= 'bilap2 ' - data_name%chn(11)= 'bicons ' - data_name%chn(12)= 'biang ' - data_name%chn(13)= 'biclw ' - if (retrieval) data_name%chn(13)= 'bisst ' - elseif ( header_fix%iversion < iversion_radiag_2 .and. header_fix%iversion >= iversion_radiag_1 ) then - data_name%chn( 8)= 'bicons ' - data_name%chn( 9)= 'biang ' - data_name%chn(10)= 'biclw ' - data_name%chn(11)= 'bilap2 ' - data_name%chn(12)= 'bilap ' - do i=1,header_fix%angord - write(string,'(i2.2)') header_fix%angord-i+1 - data_name%chn(12+i)= 'bifix' // string - end do - data_name%chn(12+header_fix%angord+1)= 'bifix ' - data_name%chn(12+header_fix%angord+2)= 'bisst ' - elseif ( header_fix%iversion < iversion_radiag_3 .and. header_fix%iversion >= iversion_radiag_2 ) then - data_name%chn( 9)= 'bicons ' - data_name%chn(10)= 'biang ' - data_name%chn(11)= 'biclw ' - data_name%chn(12)= 'bilap2 ' - data_name%chn(13)= 'bilap ' - do i=1,header_fix%angord - write(string,'(i2.2)') header_fix%angord-i+1 - data_name%chn(13+i)= 'bifix' // string - end do - data_name%chn(13+header_fix%angord+1)= 'bifix ' - data_name%chn(13+header_fix%angord+2)= 'bisst ' - elseif ( header_fix%iversion < iversion_radiag_4 .and. header_fix%iversion >= iversion_radiag_3 ) then - data_name%chn( 9)= 'bicons ' - data_name%chn(10)= 'biang ' - data_name%chn(11)= 'biclw ' - data_name%chn(12)= 'bilap2 ' - data_name%chn(13)= 'bilap ' - data_name%chn(14)= 'bicos ' - data_name%chn(15)= 'bisin ' - do i=1,header_fix%angord - write(string,'(i2.2)') header_fix%angord-i+1 - data_name%chn(15+i)= 'bifix' // string - end do - data_name%chn(15+header_fix%angord+1)= 'bifix ' - data_name%chn(15+header_fix%angord+2)= 'bisst ' - else - data_name%chn( 9)= 'bicons ' - data_name%chn(10)= 'biang ' - data_name%chn(11)= 'biclw ' - data_name%chn(12)= 'bilap2 ' - data_name%chn(13)= 'bilap ' - data_name%chn(14)= 'bicos ' - data_name%chn(15)= 'bisin ' - data_name%chn(16)= 'biemis ' - do i=1,header_fix%angord - write(string,'(i2.2)') header_fix%angord-i+1 - data_name%chn(16+i)= 'bifix' // string - end do - data_name%chn(16+header_fix%angord+1)= 'bifix ' - data_name%chn(16+header_fix%angord+2)= 'bisst ' - endif - -! Read header (channel part) - do ich=1, header_fix%nchan - read(ftin,IOSTAT=iflag) freq_tmp,polar_tmp,wave_tmp,varch_tmp,tlapmean_tmp,iuse_tmp,nuchan_tmp,iochan_tmp - header_chan(ich)%freq = freq_tmp - header_chan(ich)%polar = polar_tmp - header_chan(ich)%wave = wave_tmp - header_chan(ich)%varch = varch_tmp - header_chan(ich)%tlapmean = tlapmean_tmp - header_chan(ich)%iuse = iuse_tmp - header_chan(ich)%nuchan = nuchan_tmp - header_chan(ich)%iochan = iochan_tmp - if (iflag/=0) return - end do - -! Construct array containing menonics for data record entries - - -end subroutine read_radiag_header - -subroutine read_radiag_data(ftin,header_fix,retrieval,data_fix,data_chan,data_extra,iflag ) -! . . . . -! subprogram: read_radiag_dat read rad diag data -! prgmmr: tahara org: np20 date: 2003-01-01 -! -! abstract: This routine reads the data record from a radiance -! diagnostic file -! -! program history log: -! 2010-10-05 treadon - add this doc block -! 2011-02-22 kleist - changes related to memory allocation -! -! input argument list: -! ftin - unit number connected to diagnostic file -! header_fix - header information structure -! -! output argument list: -! data_fix - spot header information structure -! data_chan - spot channel information structure -! data_extra - spot extra information -! iflag - error code -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ - - -! Declare passed arguments - integer(i_kind),intent(in) :: ftin - type(diag_header_fix_list ),intent(in) :: header_fix - logical,intent(in) :: retrieval - type(diag_data_fix_list) ,intent(out):: data_fix - type(diag_data_chan_list) ,allocatable :: data_chan(:) - type(diag_data_extra_list) ,allocatable :: data_extra(:,:) - integer(i_kind),intent(out) :: iflag - - integer(i_kind) :: ich,iang,i,j - real(r_single),dimension(:,:),allocatable :: data_tmp - real(r_single),dimension(:),allocatable :: fix_tmp - real(r_single),dimension(:,:),allocatable :: extra_tmp - -! Allocate arrays as needed - if (allocated(data_chan)) deallocate(data_chan) - allocate(data_chan(header_fix%nchan)) - - do ich=1,header_fix%nchan - if (allocated(data_chan(ich)%bifix)) deallocate(data_chan(ich)%bifix) - allocate(data_chan(ich)%bifix(header_fix%angord+1)) - end do - - if (header_fix%iextra > 0) then - if (allocated(data_extra)) deallocate(data_extra) - allocate(data_extra(header_fix%iextra,header_fix%jextra)) - allocate(extra_tmp(header_fix%iextra,header_fix%jextra)) - end if - -! Allocate arrays to hold data record - allocate(data_tmp(header_fix%idiag,header_fix%nchan)) - - if (header_fix%iversion < iversion_radiag_2) then - allocate( fix_tmp( ireal_old_radiag ) ) - else - allocate( fix_tmp( ireal_radiag ) ) - end if - -! Read data record - - if (header_fix%iextra == 0) then - read(ftin,IOSTAT=iflag) fix_tmp, data_tmp - else - read(ftin,IOSTAT=iflag) fix_tmp, data_tmp, extra_tmp - endif - - -! Transfer fix_tmp record to output structure - data_fix%lat = fix_tmp(1) - data_fix%lon = fix_tmp(2) - data_fix%zsges = fix_tmp(3) - data_fix%obstime = fix_tmp(4) - data_fix%senscn_pos = fix_tmp(5) - data_fix%satzen_ang = fix_tmp(6) - data_fix%satazm_ang = fix_tmp(7) - data_fix%solzen_ang = fix_tmp(8) - data_fix%solazm_ang = fix_tmp(9) - data_fix%sungln_ang = fix_tmp(10) - data_fix%water_frac = fix_tmp(11) - data_fix%land_frac = fix_tmp(12) - data_fix%ice_frac = fix_tmp(13) - data_fix%snow_frac = fix_tmp(14) - data_fix%water_temp = fix_tmp(15) - data_fix%land_temp = fix_tmp(16) - data_fix%ice_temp = fix_tmp(17) - data_fix%snow_temp = fix_tmp(18) - data_fix%soil_temp = fix_tmp(19) - data_fix%soil_mois = fix_tmp(20) - data_fix%land_type = fix_tmp(21) - data_fix%veg_frac = fix_tmp(22) - data_fix%snow_depth = fix_tmp(23) - data_fix%sfc_wndspd = fix_tmp(24) - data_fix%qcdiag1 = fix_tmp(25) - data_fix%qcdiag2 = fix_tmp(26) - - if ( header_fix%iversion <= iversion_radiag_1 ) then - data_fix%tref = rmiss_radiag - data_fix%dtw = rmiss_radiag - data_fix%dtc = rmiss_radiag - data_fix%tz_tr = rmiss_radiag - else - data_fix%tref = fix_tmp(27) - data_fix%dtw = fix_tmp(28) - data_fix%dtc = fix_tmp(29) - data_fix%tz_tr = fix_tmp(30) - end if - - -! Transfer data record to output structure - do ich=1,header_fix%nchan - data_chan(ich)%tbobs =data_tmp(1,ich) - data_chan(ich)%omgbc =data_tmp(2,ich) - data_chan(ich)%omgnbc=data_tmp(3,ich) - data_chan(ich)%errinv=data_tmp(4,ich) - data_chan(ich)%qcmark=data_tmp(5,ich) - data_chan(ich)%emiss =data_tmp(6,ich) - data_chan(ich)%tlap =data_tmp(7,ich) - data_chan(ich)%tb_tz =data_tmp(8,ich) - end do - if (header_fix%iversion < iversion_radiag_1) then - do ich=1,header_fix%nchan - data_chan(ich)%bifix(1)=data_tmp(8,ich) - data_chan(ich)%bilap =data_tmp(9,ich) - data_chan(ich)%bilap2 =data_tmp(10,ich) - data_chan(ich)%bicons =data_tmp(11,ich) - data_chan(ich)%biang =data_tmp(12,ich) - data_chan(ich)%biclw =data_tmp(13,ich) - data_chan(ich)%bisst = rmiss_radiag - if (retrieval) then - data_chan(ich)%biclw =rmiss_radiag - data_chan(ich)%bisst =data_tmp(13,ich) - endif - end do - elseif ( header_fix%iversion < iversion_radiag_2 .and. header_fix%iversion >= iversion_radiag_1 ) then - do ich=1,header_fix%nchan - data_chan(ich)%bicons=data_tmp(8,ich) - data_chan(ich)%biang =data_tmp(9,ich) - data_chan(ich)%biclw =data_tmp(10,ich) - data_chan(ich)%bilap2=data_tmp(11,ich) - data_chan(ich)%bilap =data_tmp(12,ich) - end do - do ich=1,header_fix%nchan - do iang=1,header_fix%angord+1 - data_chan(ich)%bifix(iang)=data_tmp(12+iang,ich) - end do - data_chan(ich)%bisst = data_tmp(12+header_fix%angord+2,ich) - end do - elseif ( header_fix%iversion < iversion_radiag_3 .and. header_fix%iversion >= iversion_radiag_2 ) then - do ich=1,header_fix%nchan - data_chan(ich)%bicons=data_tmp(9,ich) - data_chan(ich)%biang =data_tmp(10,ich) - data_chan(ich)%biclw =data_tmp(11,ich) - data_chan(ich)%bilap2=data_tmp(12,ich) - data_chan(ich)%bilap =data_tmp(13,ich) - end do - do ich=1,header_fix%nchan - do iang=1,header_fix%angord+1 - data_chan(ich)%bifix(iang)=data_tmp(13+iang,ich) - end do - data_chan(ich)%bisst = data_tmp(13+header_fix%angord+2,ich) - end do - elseif ( header_fix%iversion < iversion_radiag_4 .and. header_fix%iversion >= iversion_radiag_3 ) then - do ich=1,header_fix%nchan - data_chan(ich)%bicons=data_tmp(9,ich) - data_chan(ich)%biang =data_tmp(10,ich) - data_chan(ich)%biclw =data_tmp(11,ich) - data_chan(ich)%bilap2=data_tmp(12,ich) - data_chan(ich)%bilap =data_tmp(13,ich) - data_chan(ich)%bicos =data_tmp(14,ich) ! 1st bias correction term node*cos(lat) for SSMIS - data_chan(ich)%bisin =data_tmp(15,ich) ! 2nd bias correction term sin(lat) for SSMI - end do - do ich=1,header_fix%nchan - do iang=1,header_fix%angord+1 - data_chan(ich)%bifix(iang)=data_tmp(15+iang,ich) - end do - data_chan(ich)%bisst = data_tmp(15+header_fix%angord+2,ich) - end do - else - do ich=1,header_fix%nchan - data_chan(ich)%bicons=data_tmp(9,ich) - data_chan(ich)%biang =data_tmp(10,ich) - data_chan(ich)%biclw =data_tmp(11,ich) - data_chan(ich)%bilap2=data_tmp(12,ich) - data_chan(ich)%bilap =data_tmp(13,ich) - data_chan(ich)%bicos =data_tmp(14,ich) - data_chan(ich)%bisin =data_tmp(15,ich) - data_chan(ich)%biemis=data_tmp(16,ich) - end do - do ich=1,header_fix%nchan - do iang=1,header_fix%angord+1 - data_chan(ich)%bifix(iang)=data_tmp(16+iang,ich) - end do - data_chan(ich)%bisst = data_tmp(16+header_fix%angord+2,ich) - end do - endif - - if (header_fix%iextra > 0) then - do j=1,header_fix%jextra - do i=1,header_fix%iextra - data_extra(i,j)%extra=extra_tmp(i,j) - end do - end do - endif - - deallocate(data_tmp, fix_tmp) - if (header_fix%iextra > 0) deallocate(extra_tmp) - -end subroutine read_radiag_data - -end module read_diag - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radtime.fd/readme b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radtime.fd/readme deleted file mode 100644 index b6fdcbaf0e..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radtime.fd/readme +++ /dev/null @@ -1,23 +0,0 @@ -Instructions for building radmon_time executable. - - 1) Load the build module appropriate for your Machine: - i.) - WCOSS: - "module use -a ../../modulefiles/wcoss" - THEIA: - "module use -a ../../modulefiles/theia" - ii.) - "module load RadMonBuild" - - 2) Optional: verify all prerequisites are met by typing: - "make check_prereqs" - - 3) Build the executable by typing: - "make" - - 4) Move the executable to the ../../exec directory by typing: - "make install" - - 5) Unload the build module: - "module unload RadMonBuild" - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radtime.fd/time.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radtime.fd/time.f90 deleted file mode 100755 index 79ebf4cc3c..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radtime.fd/time.f90 +++ /dev/null @@ -1,493 +0,0 @@ -program time -!************************************************************************ -! -! time.f90 -! -! log -! 05/2010 safford reduce validation to just region 1 (global) -! 07/2010 safford redefine regions to surface types -!************************************************************************ - - use read_diag - use bad_obs - use bad_penalty - use bad_chan - use valid - - implicit none - integer ntype,mregion,surf_nregion,max_surf_region - parameter (ntype=8,mregion=25, max_surf_region=5) - integer iglobal, iland, iwater, isnowice, imixed - parameter (iglobal=1, iland=2, iwater=3, isnowice=4, imixed=5) - - character(10),dimension(ntype):: ftype - character(8) stid - character(20) satname,stringd,satsis - character(10) dum,satype,dplat - character(40) string,diag_rad,data_file,dfile,ctl_file - character(40),dimension(max_surf_region):: region - character(40),dimension(mregion):: surf_region - character :: command - character(8) date,suffix,cycle - - integer luname,lungrd,lunctl,lndiag,nregion - integer iyy,imm,idd,ihh,idhh,incr,iread,iflag - integer n_chan,j,idsat,i,k,ii,nreg - integer,dimension(mregion):: jsub - integer,allocatable,dimension(:):: io_chan,nu_chan - integer :: ios = 0 - integer :: channel_obs - integer :: iret, ier, ver - integer npred_radiag - - real rread, pen, bound - real rlat, rlon, rmiss, obs - real,dimension(2):: cor_tot,nbc_omg,bc_omg - real,dimension(max_surf_region):: rlatmin,rlatmax,rlonmin,rlonmax - - real,allocatable,dimension(:):: wavenumbr,channel_count - real,allocatable,dimension(:,:):: count,error,use,frequency,penalty,test_pen - real,allocatable,dimension(:,:,:):: tot_cor,omg_nbc,omg_bc - -! Variables for reading satellite data - type(diag_header_fix_list ) :: header_fix - type(diag_header_chan_list),allocatable :: header_chan(:) - type(diag_data_name_list ) :: data_name - type(diag_data_fix_list ) :: data_fix - type(diag_data_chan_list ),allocatable :: data_chan(:) - type(diag_data_extra_list) ,allocatable :: data_extra(:,:) - - logical valid_count, valid_penalty - integer nsnow, nland, nwater, nice, nmixed, ntotal - integer nnsnow, nnland, nnwater, nnmixed, nntotal - -! Namelist with defaults - logical :: retrieval = .false. - integer :: nchanl = 19 - integer :: imkctl = 1 - integer :: imkdata = 1 - character(3) :: gesanl = 'ges' - integer :: little_endian = 1 - character(3) :: rad_area = 'glb' - namelist /input/ satname,iyy,imm,idd,ihh,idhh,incr,nchanl,& - suffix,imkctl,imkdata,retrieval,gesanl,little_endian,rad_area - - data luname,lungrd,lunctl,lndiag / 5, 51, 52, 21 / - data rmiss /-999./ - data stringd / '.%y4%m2%d2%h2' / - data ftype / 'count','penalty','omgnbc','total','omgbc','omgnbc2','total2','omgbc2'/ - data region / 'global', 'land', 'water', 'ice/snow', 'mixed'/ - data rlonmin / -180., -180., -180., -180., -180./ - data rlonmax / 180., 180., 180., 180., 180./ - data rlatmin / -90., -90., -90., -90., -90./ - data rlatmax / 90., 90., 90., 90., 90./ - - -!************************************************************************ -! -! Initialize variables - iread=0 - npred_radiag = 12 - -! Read namelist input - read(luname,input) - write(6,input) - write(6,*)' ' - write(6,*)'gesanl = ', gesanl - write(6,*)'imkdata = ', imkdata - - if ( trim(gesanl) == 'anl' ) then - ftype(3) = 'omanbc' - ftype(5) = 'omabc' - ftype(6) = 'omanbc2' - ftype(8) = 'omabc2' - endif - - surf_nregion = 5 - if ( trim(rad_area) == 'rgn' ) then - surf_nregion = 1 - endif - - nregion=surf_nregion - write(6,*)'surf_nregion = ', surf_nregion - - - nregion=surf_nregion - -! Ensure number of requested regions does not exceed specified upper limit - if (nregion>mregion) then - write(6,*)'***ERROR*** too many regions specified' - write(6,*)' maximum allowed: mregion=',mregion - write(6,*)' user requested: nregion=',nregion - call errexit(91) - endif - - -! Create filenames for diagnostic input, binary output file - write(stringd,100) iyy,imm,idd,ihh -100 format('.',i4.4,3i2.2) - - if ( trim(gesanl) == 'ges' ) then - diag_rad = trim(satname) - data_file= trim(satname) // trim(stringd) // '.ieee_d' - ctl_file = trim(satname) // '.ctl' - else - diag_rad = trim(satname) // '_anl' - data_file= trim(satname) // '_anl' // trim(stringd) // '.ieee_d' - ctl_file = trim(satname) // '_anl.ctl' - endif - - write(6,*)'diag_rad =',diag_rad - write(6,*)'data_file=',data_file - write(6,*)'ctl_file =',ctl_file - write(6,*)'suffix =',suffix - -! Open unit to diagnostic file. Read portion of -! header to see if file exists - open(lndiag,file=diag_rad,form='unformatted') - read(lndiag,err=900,end=900) dum - rewind lndiag - -! File exists. Read header - call get_radiag ('version',ver,ier) - write(6,*)'read_diag version = ', ver, ier - - write(6,*)'call read_diag_header' - call read_radiag_header( lndiag, npred_radiag, retrieval, header_fix,& - header_chan, data_name, iflag ) - if( iflag/=0 ) then - write(6,*)'***ERROR*** problem reading diag file header, iflag=',iflag - call errexit(91) - endif - -! Extract observation type, satellite id, and number of channels - satype = header_fix%obstype - satsis = header_fix%isis - dplat = header_fix%id - n_chan = header_fix%nchan - - string = trim(satype)//'_'//trim(dplat) - write(6,*)'string,satname=',string,' ',satname - if ( trim(string) /= trim(satname) ) then - write(6,*)'***ERROR*** inconsistent instrument types' - write(6,*)' satname,string =',satname,' ',string - call errexit(92) - endif - -! -! initialize data integrity check flags, open output file for email warning(s) -! - date = stringd(2:9) - cycle = stringd(10:11) - -! call open_bad_obs_file( date, cycle, ios ) - if ( trim(gesanl) == 'ges' ) then - call open_bad_penalty_file( date, cycle, ios ) - call open_bad_chan_file( date, cycle, ios ) - - call load_base( satname, ios ) - endif - - -! Allocate arrays to hold observational information - allocate (io_chan(n_chan), nu_chan(n_chan), wavenumbr(n_chan)) - allocate (tot_cor(n_chan,mregion,2), omg_nbc(n_chan,mregion,2), & - omg_bc(n_chan,mregion,2), count(n_chan,mregion), & - penalty(n_chan,mregion), test_pen(n_chan,mregion), & - error(n_chan,mregion), use(n_chan,mregion), & - frequency(n_chan,mregion), channel_count(n_chan)) - -! Zero accumulator arrays - do ii=1,2 - do k=1,mregion - do j=1,n_chan - if (ii==1) then - count(j,k) = 0.0 - penalty(j,k) = 0.0 - if( j==1) then - channel_count = 0.0 - endif - endif - tot_cor(j,k,ii) = 0.0 - omg_nbc(j,k,ii) = 0.0 - omg_bc(j,k,ii) = 0.0 - end do - end do - end do - - -! Extract satinfo relative index - do j=1,n_chan - nu_chan(j) = real( header_chan(j)%nuchan, 4 ) - io_chan(j) = real( header_chan(j)%iochan, 4 ) - wavenumbr(j) = real( header_chan(j)%wave, 4 ) - end do - do k=1,mregion - do j=1,n_chan - error(j,k) = real( header_chan(j)%varch, 4) - use(j,k) = real( header_chan(j)%iuse, 4 ) - frequency(j,k) = real( header_chan(j)%freq, 4) - end do - end do - - -! Create control file - if ( imkctl == 1 ) then - write(6,*)'call create_ctl_time' - - if ( trim(gesanl) == 'ges' ) then - dfile = trim(satname) - else - dfile = trim(satname) // '_anl' - endif - - call create_ctl_time(ntype,ftype,n_chan,iyy,imm,idd,ihh,idhh,& - incr,ctl_file,lunctl,rmiss,dfile,satype,dplat,nregion,& - region,rlonmin,rlonmax,rlatmin,rlatmax,nu_chan,use(1,1),& - error(1,1),frequency(1,1),wavenumbr,little_endian) - endif - - nwater = 0; nnwater=0 - nice = 0 - nsnow = 0; nnsnow=0 - nland = 0; nnland=0 - nmixed = 0; nnmixed=0 - ntotal = 0 - -! Loop to read entries in diagnostic file - if ( imkdata == 1 ) then - iflag = 0 - loopd: do while (iflag == 0) - -! Read a record. If read flag, iflag does not equal zero, exit loopd - call read_radiag_data( lndiag, header_fix, retrieval, data_fix, data_chan,& - data_extra, iflag ) - if( iflag /= 0 ) exit loopd - iread=iread+1 - -! Extract observation location. -! Convert (0-360) lon to (-180,180) - rlat = data_fix%lat - rlon = data_fix%lon - if (rlon>180.) rlon = rlon - 360. - rread = rread +1.0 - -! Detemine which subdomains the observation falls into. -! These are now based on surface type, not geography. All -! obs match global (surf_region 1). - - ii=0; jsub=0; - jsub(1)=iglobal - nreg=1 - - if ( nregion > 1 ) then - if ( data_fix%land_frac > 0.99 ) then - jsub(2)=iland - nreg=2 - nnland=nnland+1 - else if ( data_fix%water_frac > 0.99 ) then - jsub(2)=iwater - nreg=2 - nnwater=nnwater+1 - else if (( data_fix%snow_frac > 0.99 ) .OR. ( data_fix%ice_frac > 0.99 )) then - jsub(2)=isnowice - nreg=2 - nnsnow=nnsnow+1 - else - jsub(2)=imixed - nreg=2 - nnmixed=nnmixed+1 - write(6,*)'data_fix%land_frac,water,snow,ice = ',data_fix%land_frac, data_fix%water_frac, data_fix%snow_frac, data_fix%ice_frac - end if - end if - - -! Channel loop - do j = 1, n_chan - -! If observation was assimilated, accumulate sums in appropriate regions - if (data_chan(j)%errinv > 1.e-6) then -! pen = data_chan(j)%errinv*(data_chan(j)%omgbc)**2 - pen = (data_chan(j)%errinv*(data_chan(j)%omgbc))**2 - cor_tot(1) = (data_chan(j)%omgnbc - data_chan(j)%omgbc) - nbc_omg(1) = - data_chan(j)%omgnbc - bc_omg(1) = - data_chan(j)%omgbc - - cor_tot(2) = (data_chan(j)%omgnbc - data_chan(j)%omgbc)**2 - nbc_omg(2) = (data_chan(j)%omgnbc)**2 - bc_omg(2) = (data_chan(j)%omgbc)**2 - - do i=1,nreg - k=jsub(i) - - count(j,k) = count(j,k) + 1.0 - penalty(j,k) = penalty(j,k) + pen - channel_count(j) = channel_count(j) + 1.0 - - do ii=1,2 - tot_cor(j,k,ii) = tot_cor(j,k,ii) + cor_tot(ii) - omg_nbc(j,k,ii) = omg_nbc(j,k,ii) + nbc_omg(ii) - omg_bc(j,k,ii) = omg_bc(j,k,ii) + bc_omg(ii) - end do - - end do - - endif - - enddo ! channel loop - - -! End of loop over diagnostic file - enddo loopd - - - write(6,*)' ' - write(6,*)'read in ',iread,' obs ',rread - write(6,*)' ' - -! -! Compute average and standard deviation -! - do k=1,nregion - do j=1,n_chan - - ! --- validate the count value for region 1 (global) - ! -! if ( use(j,k) > 0.0 .AND. k == 1 .AND. imkdata == 1 ) then -! call validate_count( j, k, count(j,k), valid_count, iret ) -! write (*,*) ' valid_count, iret = ', valid_count, iret -! if ( (iret == 0) .AND. (valid_count .eqv. .FALSE.) ) then -! write (*,*) ' calling write_bad_obs ' -! call write_bad_obs( satname, nu_chan(j), k, count(j,k) ) -! end if -! end if - - if (count(j,k)>0) then - test_pen(j,k)=penalty(j,k)/count(j,k) - - !--- check for valid penalty value for region 1 (global) - ! - if ( use(j,k) > 0.0 .AND. k == 1 .AND. imkdata == 1 .AND. trim(gesanl) == 'ges' ) then - call validate_penalty( j, k, test_pen(j,k), valid_penalty, bound, iret ) - if( (iret == 0) .AND. (valid_penalty .eqv. .FALSE.) ) then - call write_bad_penalty( satname, nu_chan(j), k, test_pen(j,k), bound ) - endif - endif - - else - count(j,k)=rmiss - penalty(j,k)=rmiss - endif - - end do - end do - -! -! Check each assimilated channel to see if we -! have a 0 count (no obs) for that channel. If so, report -! it using write_bad_chan(). -! - -! -! This is for testing purposes only -! channel_count(1) = 0.0 -! write(6,*)' header_chan(j)%iuse, channel_count(1) = ', header_chan(1)%iuse, channel_count(1) -! - do j=1,n_chan -! write(6,*)' j, header_chan(j)%iuse, channel_count(j) = ', j, header_chan(j)%iuse, channel_count(j) -! if( header_chan(j)%iuse > 0.0 ) then -! write(6,*)' header_chan(j)%iuse > 0.0', header_chan(j)%iuse -! else -! write(6,*)' header_chan(j)%iuse <= 0.0', header_chan(j)%iuse -! endif - -! if( channel_count(j) < 1.0 ) then -! write(6,*)' channel_count(j) < 1.0', channel_count(j) -! else -! write(6,*)' channel_count(j) >= 1.0', channel_count(j) -! endif - - if( header_chan(j)%iuse > 0.0 .and. channel_count(j) < 1.0 .AND. trim(gesanl) == 'ges' ) then - write(6,*)' calling write_bad_chan, satname, j, nu_chan(j) = ', satname, j, nu_chan(j) - call write_bad_chan( satname, nu_chan(j) ) - end if ! if header_chan%iuse - - end do ! channel loop - - if ( trim(gesanl) == 'ges' ) then -! call close_bad_obs_file() - call close_bad_penalty_file() - call close_bad_chan_file() - endif - - -! Write output to binary output file - - write(6,*)' ' - open(lungrd,file=data_file,form='unformatted') - write(lungrd) ((count(j,k),j=1,n_chan),k=1,nregion) - write(lungrd) ((penalty(j,k),j=1,n_chan),k=1,nregion) - do ii=1,2 - write(lungrd) ((omg_nbc(j,k,ii),j=1,n_chan),k=1,nregion) - write(lungrd) ((tot_cor(j,k,ii),j=1,n_chan),k=1,nregion) - write(lungrd) ((omg_bc (j,k,ii),j=1,n_chan),k=1,nregion) - end do - write(6,*)'write output to lungrd=',lungrd,', file=',trim(data_file) - close(lungrd) - endif - -! Deallocate arrays - write(6,*)' ' - write(6,*)'deallocate arrays' - deallocate(io_chan,nu_chan,wavenumbr,tot_cor,omg_nbc,omg_bc,count,& - penalty,error,use,frequency) - goto 950 - -! Jump to here if eof or error reading diagnostic file. -900 continue - write(6,*)'***PROBLEM reading diagnostic file. diag_rad=',diag_rad - close(lndiag) - - n_chan=nchanl - if (n_chan<=0) then - write(6,*)'***ERROR*** invalid nchanl=',nchanl,' STOP program' - call errexit(93) - endif - - write(6,*)'load missing value ',rmiss,' into output arrays. ',& - nregion,n_chan - allocate(count(n_chan,nregion),penalty(n_chan,nregion),& - omg_nbc(n_chan,nregion,2),tot_cor(n_chan,nregion,2),& - omg_bc(n_chan,nregion,2)) - do ii=1,2 - do k=1,nregion - do j=1,n_chan - if (ii==1) then - count(j,k) = rmiss - penalty(j,k)= rmiss - endif - omg_nbc(j,k,ii) = rmiss - tot_cor(j,k,ii) = rmiss - omg_bc(j,k,ii) = rmiss - end do - end do - end do - - if ( imkdata == 1 ) then - open(lungrd,file=data_file,form='unformatted') - write(lungrd) ((count(j,k),j=1,n_chan),k=1,nregion) - write(lungrd) ((penalty(j,k),j=1,n_chan),k=1,nregion) - do ii=1,2 - write(lungrd) ((omg_nbc(j,k,ii),j=1,n_chan),k=1,nregion) - write(lungrd) ((tot_cor(j,k,ii),j=1,n_chan),k=1,nregion) - write(lungrd) ((omg_bc (j,k,ii),j=1,n_chan),k=1,nregion) - end do - write(6,*)'write output to lungrd=',lungrd,', file=',trim(data_file) - close(lungrd) - endif - deallocate(count,penalty,omg_nbc,tot_cor,omg_bc) - -! End of program -950 continue - stop -end program time diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radtime.fd/valid.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radtime.fd/valid.f90 deleted file mode 100755 index b2065e3318..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radtime.fd/valid.f90 +++ /dev/null @@ -1,289 +0,0 @@ -!$$$ subprogram documentation block -! . . . -! subprogram: valid validate the obs and penalty values -! prgmmr: safford date: 2009-12 -! -! abstract: This module contains code to read a given satellite's -! base file and then validate new obs(count) and penalty -! values by comparing them to the baseline values. -! -! program history log: -! 2009-12-07 safford - initial coding -! -! contains: -! -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ - -module valid - - implicit none - - private - -! --- module routines - public :: load_base - public :: validate_count - public :: validate_penalty - -! --- module parameters - integer, parameter :: funit = 17 - real,parameter :: rmiss = -999.0 - -! --- module vars - logical :: base_loaded = .FALSE. - integer :: nchan, nregion, j, k, dummy - - real,allocatable,dimension(:,:):: avg_count, sdv_count - real,allocatable,dimension(:,:):: min_count, max_count - real,allocatable,dimension(:,:):: avg_penalty, sdv_penalty - real,allocatable,dimension(:,:):: min_penalty, max_penalty - - integer,allocatable,dimension(:):: nu_chan - - contains - - !------------------------------------------------------------- - ! load the base file for the given satellite - !------------------------------------------------------------- - - subroutine load_base( satname, iret ) - - !--- interface - character(20), intent( in ) :: satname - integer, intent( out ) :: iret - - !--- variables - character(20) fname - character(20) test_satname - character(10) base_date - - integer fios - integer chan, region - - logical fexist - - - !--- initialization - iret = -1 - fname = trim(satname) // '.base' - fexist = .FALSE. - - write(*,*) '--> valid, satname, fname = ', satname, fname - - !--- verify file exists and open the file - inquire( file = fname, exist = fexist ) - if( fexist .eqv. .FALSE. ) then - fios = -1 - else - open( UNIT=funit, FILE=fname, IOSTAT=fios ) - write(*,*) ' fios = ', fios - end if - - if( fios == 0 ) then - !--- read the file header - read(funit,*) test_satname, base_date, nchan, nregion - write(*,*) ' test_satname, base_date, nchan, nregion = ', test_satname, base_date, nchan, nregion - - allocate( avg_count(nchan,nregion), sdv_count(nchan,nregion), & - avg_penalty(nchan,nregion), sdv_penalty(nchan,nregion), & - min_count(nchan,nregion), max_count(nchan,nregion), & - min_penalty(nchan,nregion), max_penalty(nchan,nregion) ) - - ! --- set all missing - do k=1,nregion - do j=1,nchan - avg_count(j,k) = rmiss - sdv_count(j,k) = rmiss - min_count(j,k) = rmiss - max_count(j,k) = rmiss - avg_penalty(j,k) = rmiss - sdv_penalty(j,k) = rmiss - min_penalty(j,k) = rmiss - max_penalty(j,k) = rmiss - end do - end do - - do k=1,nregion - do j=1,nchan - read(funit,*) chan, region, avg_count(j,k), sdv_count(j,k), min_count(j,k), max_count(j,k), & - avg_penalty(j,k), sdv_penalty(j,k), min_penalty(j,k), max_penalty(j,k) - end do - end do - - iret = 0 - base_loaded = .TRUE. - else - write(*,*) 'unable to load fname for data error checking' - end if - - end subroutine load_base - - - !--------------------------------------------------------------- - ! validate a count - ! given a count value for a channel and region, determine - ! if the count is within +/- 2*sdv - ! - ! iret 0 = normal - ! -1 = invalid channel - ! -2 = invalid region - ! 1 = base file wasn't loaded, unable to validate - !--------------------------------------------------------------- - subroutine validate_count( channel, region, count, valid, iret ) - - !--- interface - integer, intent( in ) :: channel - integer, intent( in ) :: region - real, intent( in ) :: count - logical, intent( out ) :: valid - integer, intent( out ) :: iret - - !--- vars - real cnt, hi, lo, sdv2 - - write(*,*) '--> validate_count, channel, region, count ', channel, region, count - !--- initialize vars - iret = 0 - cnt = count - valid = .FALSE. - - if( base_loaded .eqv. .TRUE. ) then - if( channel < 1 .OR. channel > nchan ) then - iret = -1 - write(*,*) 'Warning: In validate_count attempt to validate channel out of range', channel - valid = .TRUE. - else if( region < 1 .OR. region > nregion ) then - iret = -2 - write(*,*) 'Warnig: In validate_count attempt to validate region out of range', region - valid = .TRUE. - else - ! - ! all unassimilated channels in the base files will have an rmiss - ! value and are considered valid for verification purposes - ! - if( avg_count(channel,region) < 0.0 ) then - valid = .TRUE. - else - sdv2 = 2 * sdv_count( channel, region ) - hi = avg_count(channel,region) + sdv2 - lo = avg_count(channel,region) - sdv2 - - ! - ! Consider any count valid if: - ! cnt is 2 sdvs from avg or - ! cnt is within the established min/max range for chan,region - ! - if( cnt > 0.0 ) then - valid = .TRUE. - end if - !if( cnt <= hi .AND. cnt >= lo ) then - ! valid = .TRUE. - !else if( (cnt > 0) .AND. (cnt >= min_count( channel,region )) .AND. & - ! (cnt <= max_count( channel,region )) ) then - ! valid = .TRUE. - !end if - end if - - end if - - if ( valid .eqv. .FALSE. ) then - write(*,*) ' avg_count(channel,region), sdv2, hi, lo = ', avg_count(channel,region), sdv2, hi, lo - end if - write (*,*) '<-- valid, iret=', valid, iret - else - !--- base file was not loaded, so return a warning that validation isn't possible - iret = 1 - end if - end subroutine validate_count - - - !------------------------------------------------------------- - ! validate a penalty value - ! given a penalty value for a channel and region, determine - ! if the penalty is within +/- 2*sdv - ! - ! iret 0 = normal - ! -1 = invalid channel - ! -2 = invalid region - !------------------------------------------------------------- - subroutine validate_penalty( channel, region, penalty, valid, bound, iret ) - - !--- interface - integer, intent( in ) :: channel - integer, intent( in ) :: region - real, intent( in ) :: penalty - logical, intent( out ) :: valid - real, intent( out ) :: bound - integer, intent( out ) :: iret - - !--- vars - real hi, lo, sdv2 - - write(*,*) '--> validate_penalty, channel, region, penalty ', channel, region, penalty - - !--- initialize vars - iret = 0 - valid = .FALSE. - bound = rmiss - - if( base_loaded .eqv. .TRUE. .AND. nchan > 1 ) then - if( channel < 1 .OR. channel > nchan ) then - iret = -1 - write(*,*) 'Warning: In validate_penalty attempt to validate channel out of range', channel - valid = .TRUE. - else if( region < 1 .OR. region > nregion ) then - iret = -2 - write(*,*) 'Warning: In validate_penalty attempt to validate region out of range', region - valid = .TRUE. - else - ! - ! all unassimilated channels in the base files will have an rmiss - ! value and are considered valid for verification purposes - ! - bound = max_penalty( channel,region ) - - if( avg_penalty(channel,region) < 0.0 ) then - valid = .TRUE. - else - sdv2 = 2 * sdv_penalty( channel, region ) - hi = avg_penalty(channel,region) + sdv2 - lo = avg_penalty(channel,region) - sdv2 - - ! - ! Consider any penalty value valid if: - ! penalty is 2 sdvs from avg or - ! penalty is greater than the established max range for - ! chan,region by 20% or more --> idea here is to stage - ! two levels of warning, say a 20% exceedence and then - ! maybe a 25% or 30% exceedence for a yellow and red - ! level warning. - ! - if( (penalty >= 0.0) .AND. penalty <= hi ) then - valid = .TRUE. - else if( (penalty > 0.0) .AND. & - (penalty <= (max_penalty( channel,region )*1.2) ) ) then - valid = .TRUE. - end if - - end if - end if - - if ( valid .eqv. .FALSE. ) then - write(*,*) ' BAD: penalty, avg_penalty(channel,region), sdv2, hi, lo, bound = ', penalty, avg_penalty(channel,region), sdv2, hi, lo, bound - end if - write (*,*) '<-- valid, iret=', valid, iret - else - !--- base file was not loaded, or nchan was 0 so return - !--- a warning that validation isn't possible - write (*,*) 'Warning: base file not loaded or nchan < 1, nchan= ', nchan - iret = 1 - end if - end subroutine validate_penalty - - -end module valid diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/ush/radmon_ck_stdout.sh b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/ush/radmon_ck_stdout.sh deleted file mode 100755 index a918c9204f..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/ush/radmon_ck_stdout.sh +++ /dev/null @@ -1,112 +0,0 @@ -#!/bin/ksh - -################################################################################ -#### UNIX Script Documentation Block -# . . -# Script name: radmon_ck_stdout.sh -# Script description: Scan stdout files for problems reading the diagnostic -# files. -# -# Author: Ed Safford Org: NP23 Date: 2012-02-02 -# -# Abstract: This script scans the stdout files produced by the radmon_time -# executable for problems reading the diagnostic files. -# -# This script is a child script of radmon_verf_time.sh. The parent -# script generates the stdout files which this script examines. -# -# -# Script history log: -# 2012-02-02 Safford initial script -# -# Usage: radmon_ck_stdout.sh outfile -# -# Input script positional parameters: -# outfile output file name -# required -# -# Imported Shell Variables: -# SATYPE list of satellite/instrument sources -# defaults to none -# VERBOSE Verbose flag (YES or NO) -# defaults to NO -# -# Exported Shell Variables: -# err Last return code -# -# Modules and files referenced: -# scripts : -# -# programs : -# -# fixed data : -# -# input data : $data_file -# -# output data: $outfile -# -# Remarks: -# -# Condition codes -# 0 - no problem encountered -# >0 - some problem encountered -# -# Control variable resolution priority -# 1 Command line argument. -# 2 Environment variable. -# 3 Inline default. -# -# Attributes: -# Language: POSIX shell -# Machine: IBM SP -#################################################################### -export scr=radmon_ck_stdout.sh -msg="${scr} HAS STARTED" -postmsg "$jlogfile" "$msg" - - -# Command line arguments. -outfile=${1:-${outfile:?}} - -# Other variables -SATYPE=${SATYPE:-} -err=0 - -if [[ "$VERBOSE" = "YES" ]]; then - set -ax - echo "$(date) executing $0 $* >&2" -fi -################################################################################ -# Preprocessing - -outfile=$1 -error_msg="PROBLEM reading diagnostic file" - -for type in ${SATYPE}; do - if [[ "$VERBOSE" = "YES" ]]; then - echo ${type} - fi - if [[ -s "stdout.${type}" ]]; then - if [[ "$VERBOSE" = "YES" ]]; then - echo stdout.${type} - fi - match=`gawk "/$error_msg/" stdout.$type` - - match_len=`echo ${#match}` - if [[ $match_len > 0 ]]; then - echo "${type} ${match}" >> $outfile - fi - fi -done - -################################################################################ -# Post processing -if [[ "$VERBOSE" = "YES" ]]; then - echo $(date) EXITING $0 with error code ${err} >&2 -fi - -msg="${scr} HAS ENDED" -postmsg "$jlogfile" "$msg" - -set +x -exit ${err} diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/ush/radmon_err_rpt.sh b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/ush/radmon_err_rpt.sh deleted file mode 100755 index b565d8ddca..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/ush/radmon_err_rpt.sh +++ /dev/null @@ -1,238 +0,0 @@ -#!/bin/ksh - -################################################################################ -#### UNIX Script Documentation Block -# . . -# Script name: radmon_err_rpt.sh -# Script description: Compare the contents of error files from two different -# cycles. -# -# Author: Ed Safford Org: NP23 Date: 2012-02-02 -# -# Abstract: This script compares the contents of two error files from two different -# sets of radiance diagnostic files (which are an output from GSI runs). -# All unique satellite instrument/channel/region combinations that appear -# in both files are reported. -# -# This script is run as a child script of radmon_verf_time.sh. The parent -# script creates/copies the error files into a temporary working -# directory before invoking this script. -# -# -# Script history log: -# 2012-02-02 Safford initial script -# -# Usage: radmon_err_rpt.sh file1 file2 type cycle1 cycle2 diag_rpt outfile -# -# Input script positional parameters: -# file1 obs, penalty, or channel error file -# required -# file2 obs, penalty, or channel error file -# required -# type type of error file -# choises are obs, pen, or chan; required -# cycle1 first cycle processing date -# yyyymmddcc format; required -# cycle2 second cycle processing date -# yyyymmddcc format; required -# diag_rpt diagnostic report text file -# required -# outfile output file name -# required -# -# Imported Shell Variables: -# -# HOMEradmon package's nwprod subdirectory -# defaults to pwd -# -# Exported Shell Variables: -# err Last return code -# -# Modules and files referenced: -# scripts : -# -# fixed data : $ctlfile -# -# input data : $file1 -# $file2 -# -# output data: $outfile -# -# Remarks: -# -# Condition codes -# 0 - no problem encountered -# >0 - some problem encountered -#################################################################### -export scr=radmon_err_rpt.sh - -msg="${scr} HAS STARTED" -postmsg "$jlogfile" "$msg" - -# Command line arguments. -file1=${1:-${file1:?}} -file2=${2:-${file2:?}} -type=${3:-${type:?}} -cycle1=${4:-${cycle1:?}} -cycle2=${5:-${cycle2:?}} -diag_rpt=${6:-${diag_rpt:?}} -outfile=${7:-${outfile:?}} - -# Directories -HOMEradmon=${HOMEradmon:-$(pwd)} - -# Other variables -VERBOSE=${VERBOSE:-NO} -err=0 -RADMON_SUFFIX=${RADMON_SUFFIX} - -if [[ "$VERBOSE" = "YES" ]]; then - echo EXECUTING $0 $* >&2 - set -ax -fi - - -have_diag_rpt=0 -if [[ -s $diag_rpt ]]; then - have_diag_rpt=1 -else - err=1 -fi - - -#----------------------------------------------------------------------------- -# read each line in the $file1 -# search $file2 for the same satname, channel, and region -# if same combination is in both files, add the values to the output file -# -{ while read myline; do - bound="" - - echo $myline - satname=`echo $myline | gawk '{print $1}'` - echo satname = $satname - channel=`echo $myline | gawk '{print $3}'` - echo channel = $channel - region=`echo $myline | gawk '{print $5}'` - echo region = $region - value1=`echo $myline | gawk '{print $7}'` - echo value1 = $value1 - bound=`echo $myline | gawk '{print $9}'` - -# -# Check findings against diag_report. If the satellite/instrument is on the -# diagnostic report it means the diagnostic file file for the -# satelite/instrument is missing for this cycle, so skip any additional -# error checking for that source. Otherwise, evaluate as per normal. -# - - diag_match="" - diag_match_len=0 - - if [[ $have_diag_rpt == 1 ]]; then - diag_match=`gawk "/$satname/" $diag_rpt` - diag_match_len=`echo ${#diag_match}` - fi - - - if [[ $diag_match_len == 0 ]]; then - - if [[ $type == "chan" ]]; then - echo "looking for match for $satname and $channel" - { while read myline2; do - echo $myline - satname2=`echo $myline2 | gawk '{print $1}'` - echo satname = $satname - channel2=`echo $myline2 | gawk '{print $3}'` - echo channel = $channel - - if [[ $satname == $satname2 && $channel == $channel2 ]]; then - match="$satname channel= $channel" - echo "match from gawk = $match" - break; - else - match="" - fi - - done } < $file2 - - else - match=`gawk "/$satname/ && /channel= $channel / && /region= $region /" $file2` - echo match = $match - - match_len=`echo ${#match}` - if [[ $match_len > 0 ]]; then - channel2=`echo $match | gawk '{print $3}'` - echo channel2 = $channel2 - if [[ $channel2 != $channel ]]; then - match="" - fi - fi - echo match = $match - fi - match_len=`echo ${#match}` - - if [[ $match_len > 0 ]]; then - echo $match_len - value2=`echo $match | gawk '{print $7}'` - bound2=`echo $match | gawk '{print $9}'` - - if [[ $type == "chan" ]]; then - tmpa=" $satname channel= $channel" - tmpb="" - - elif [[ $type == "pen" ]]; then - tmpa="$satname channel= $channel region= $region" - tmpb="$cycle1 $value1 $bound" - - else - tmpa="$satname channel= $channel region= $region" - tmpb="$cycle1: $type= $value1" - fi - - line1="$tmpa $tmpb" - echo "$line1" >> $outfile - - if [[ $type != "chan" ]]; then - tmpc=`echo $tmpa |sed 's/[a-z]/ /g' | sed 's/[0-9]/ /g' | sed 's/=/ /g' | sed 's/_/ /g' | sed 's/-/ /g'` - - if [[ $type == "pen" ]]; then - line2=" $tmpc $cycle2 $value2 $bound2" - else - line2=" $tmpc $cycle2: $type= $value2" - fi - - echo "$line2" >> $outfile - fi - - #---------------------------------------------------------- - # Access the control file to deterimine channel grouping - # number. Not all sources have consecutively numbered - # channels, and we need to map the channel to the correct - # grouping number in order to produce an accurate hyperlink. - # - # Update: with the new js plotting the actual channel number - # can be sent so the chgrp is no longer used here. - - line3=" http://www.emc.ncep.noaa.gov/gmb/gdas/radiance/es_rad/${RADMON_SUFFIX}/index.html?sat=${satname}®ion=${region}&channel=${channel}&stat=${type}" - if [[ $channel -gt 0 ]]; then - echo "$line3" >> $outfile - echo "" >> $outfile - fi - fi - fi -done } < $file1 - - -################################################################################ -# Post processing -if [[ "$VERBOSE" = "YES" ]]; then - echo $(date) EXITING $0 with error code ${err} >&2 -fi - -msg="${scr} HAS ENDED" -postmsg "$jlogfile" "$msg" - -set +x -exit ${err} - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/ush/radmon_verf_angle.sh b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/ush/radmon_verf_angle.sh deleted file mode 100755 index 44446b58be..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/ush/radmon_verf_angle.sh +++ /dev/null @@ -1,237 +0,0 @@ -#!/bin/ksh - -################################################################################ -#### UNIX Script Documentation Block -# . . -# Script name: radmon_verf_angle.sh -# Script description: Extract angle dependent data from radiance -# diagnostic files. -# -# Author: Ed Safford Org: NP23 Date: 2012-02-02 -# -# Abstract: This script extracts angle dependent data from radiance -# diagnostic files (which are an output from GSI runs), -# storing the extracted data in small binary files. -# -# This script is a child script of exgdas_vrfyrad.sh.sms. The parent -# script opens and uncompresses the radiance diagnostic file and copies -# other supporting files into a temporary working directory. -# -# -# Usage: radmon_verf_angle.sh PDATE -# -# Input script positional parameters: -# PDATE processing date -# yyyymmddcc format; required -# -# Imported Shell Variables: -# RADMON_SUFFIX data source suffix -# defauls to opr -# MAKE_CTL switch to construct the meta-data control file -# defaults to 1 (on) -# MAKE_DATA switch to construct the binary data file -# defaults to 1 (on) -# EXECradmon executable directory -# defaults to current directory -# RAD_AREA global or regional flag -# defaults to global -# TANKverf_rad data repository -# defaults to current directory -# SATYPE list of satellite/instrument sources -# defaults to none -# VERBOSE Verbose flag (YES or NO) -# defaults to NO -# LITTLE_ENDIAN flag to indicate LE machine -# defaults to 0 (big endian) -# USE_ANL use analysis files as inputs in addition to -# the ges files. Default is 0 (ges only) -# -# Modules and files referenced: -# scripts : -# -# programs : $NCP -# $angle_exec -# -# fixed data : $scaninfo -# -# input data : $data_file -# -# output data: $angle_file -# $angle_ctl -# $pgmout -# -# Remarks: -# -# Condition codes -# 0 - no problem encountered -# >0 - some problem encountered -# -#################################################################### -# Command line arguments. - -RAD_AREA=${RAD_AREA:-glb} -REGIONAL_RR=${REGIONAL_RR:-0} # rapid refresh model flag -rgnHH=${rgnHH:-} -rgnTM=${rgnTM:-} - -export PDATE=${1:-${PDATE:?}} - -scr=radmon_verf_angle.sh -msg="${scr} HAS STARTED" -postmsg "$jlogfile" "$msg" -echo " REGIONAL_RR, rgnHH, rgnTM = $REGIONAL_RR, $rgnHH, $rgnTM" - -which prep_step -which startmsg - -if [[ "$VERBOSE" = "YES" ]]; then - set -ax -fi - -# Directories -FIXgdas=${FIXgdas:-$(pwd)} -EXECradmon=${EXECradmon:-$(pwd)} -TANKverf_rad=${TANKverf_rad:-$(pwd)} - -# File names -export pgmout=${pgmout:-${jlogfile}} -touch $pgmout - -# Other variables -MAKE_CTL=${MAKE_CTL:-1} -MAKE_DATA=${MAKE_DATA:-1} -SATYPE=${SATYPE:-} -VERBOSE=${VERBOSE:-NO} -LITTLE_ENDIAN=${LITTLE_ENDIAN:-0} -USE_ANL=${USE_ANL:-0} - -if [[ $USE_ANL -eq 1 ]]; then - gesanl="ges anl" -else - gesanl="ges" -fi - -err=0 -angle_exec=radmon_angle -shared_scaninfo=${shared_scaninfo:-$FIXgdas/gdas_radmon_scaninfo.txt} -scaninfo=scaninfo.txt - -#-------------------------------------------------------------------- -# Copy extraction program and supporting files to working directory - -$NCP ${EXECradmon}/${angle_exec} ./ -$NCP $shared_scaninfo ./${scaninfo} - -if [[ ! -s ./${angle_exec} || ! -s ./${scaninfo} ]]; then - err=2 -else -#-------------------------------------------------------------------- -# Run program for given time - - export pgm=${angle_exec} - - iyy=`echo $PDATE | cut -c1-4` - imm=`echo $PDATE | cut -c5-6` - idd=`echo $PDATE | cut -c7-8` - ihh=`echo $PDATE | cut -c9-10` - - ctr=0 - fail=0 - touch "./errfile" - - for type in ${SATYPE}; do - - if [[ ! -s ${type} ]]; then - echo "ZERO SIZED: ${type}" - continue - fi - - for dtype in ${gesanl}; do - - echo "pgm = $pgm" - echo "pgmout = $pgmout" - prep_step - - ctr=`expr $ctr + 1` - - if [[ $dtype == "anl" ]]; then - data_file=${type}_anl.${PDATE}.ieee_d - ctl_file=${type}_anl.ctl - angl_ctl=angle.${ctl_file} - else - data_file=${type}.${PDATE}.ieee_d - ctl_file=${type}.ctl - angl_ctl=angle.${ctl_file} - fi - - if [[ $REGIONAL_RR -eq 1 ]]; then - angl_file=${rgnHH}.angle.${data_file}.${rgnTM} - else - angl_file=angle.${data_file} - fi - - - rm input - - nchanl=-999 -cat << EOF > input - &INPUT - satname='${type}', - iyy=${iyy}, - imm=${imm}, - idd=${idd}, - ihh=${ihh}, - idhh=-720, - incr=${CYCLE_INTERVAL}, - nchanl=${nchanl}, - suffix='${RADMON_SUFFIX}', - imkctl=${MAKE_CTL}, - imkdata=${MAKE_DATA}, - gesanl='${dtype}', - little_endian=${LITTLE_ENDIAN}, - rad_area='${RAD_AREA}', - / -EOF - - startmsg - ./${angle_exec} < input >> ${pgmout} 2>>errfile - export err=$?; err_chk - if [[ $err -ne 0 ]]; then - fail=`expr $fail + 1` - fi - -#------------------------------------------------------------------- -# move data, control, and stdout files to $TANKverf_rad and compress - - if [[ -s ${data_file} ]]; then - mv ${data_file} ${angl_file} - ${COMPRESS} -f ${angle_file} - mv ${angl_file}* $TANKverf_rad/. - fi - - if [[ -s ${ctl_file} ]]; then - mv ${ctl_file} ${angl_ctl} - ${COMPRESS} -f ${angl_ctl} - mv ${angl_ctl}* ${TANKverf_rad}/. - fi - - done # for dtype in ${gesanl} loop - - done # for type in ${SATYPE} loop - - if [[ $fail -eq $ctr || $fail -gt $ctr ]]; then - err=3 - fi -fi - -################################################################################ -# Post processing - -if [[ "$VERBOSE" = "YES" ]]; then - echo $(date) EXITING $0 error code ${err} >&2 -fi - -msg="${scr} HAS ENDED" -postmsg "$jlogfile" "$msg" - -exit ${err} diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/ush/radmon_verf_bcoef.sh b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/ush/radmon_verf_bcoef.sh deleted file mode 100755 index c5319e7632..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/ush/radmon_verf_bcoef.sh +++ /dev/null @@ -1,234 +0,0 @@ -#!/bin/ksh - -################################################################################ -#### UNIX Script Documentation Block -# . . -# Script name: radmon_verf_bcoef.sh -# Script description: Extract bias correction coefficients data from radiance -# diagnostic files. -# -# Author: Ed Safford Org: NP23 Date: 2012-02-02 -# -# Abstract: This script extracts bias correction coefficient related data from -# radiance diagnostic files (which are an output from GSI runs), -# storing the extracted data in small binary files. -# -# This script is a child script of exgdas_vrfyrad.sh.sms. The parent -# script opens and uncompresses the radiance diagnostic file and copies -# other supporting files into a temporary working directory. -# -# -# Usage: radmon_verf_bcoef.sh PDATE -# -# Input script positional parameters: -# PDATE processing date -# yyyymmddcc format; required -# -# Imported Shell Variables: -# RADMON_SUFFIX data source suffix -# defauls to opr -# MAKE_CTL switch to construct the meta-data control file -# defaults to 1 (on) -# MAKE_DATA switch to construct the binary data file -# defaults to 1 (on) -# EXECradmon executable directory -# defaults to current directory -# FIXradmon fixed data directory -# defaults to current directory -# RAD_AREA global or regional flag -# defaults to global -# TANKverf_rad data repository -# defaults to current directory -# SATYPE list of satellite/instrument sources -# defaults to none -# VERBOSE Verbose flag (YES or NO) -# defaults to NO -# LITTLE_ENDIAN flag for LE machine -# defaults to 0 (big endian) -# USE_ANL use analysis files as inputs in addition to -# the ges files. Default is 0 (ges only) -# -# Modules and files referenced: -# scripts : -# -# programs : $NCP -# $bcoef_exec -# -# fixed data : $biascr -# -# input data : $data_file -# -# output data: $bcoef_file -# $bcoef_ctl -# $pgmout -# -# Remarks: -# -# Condition codes -# 0 - no problem encountered -# >0 - some problem encountered -# -#################################################################### -# Command line arguments. -export PDATE=${1:-${PDATE:?}} - -scr=radmon_verf_bcoef.sh -msg="${scr} HAS STARTED" -postmsg "$jlogfile" "$msg" - -if [[ "$VERBOSE" = "YES" ]]; then - set -ax -fi - - -# Directories -FIXgdas=${FIXgdas:-$(pwd)} -EXECradmon=${EXECradmon:-$(pwd)} -TANKverf_rad=${TANKverf_rad:-$(pwd)} - -# File names -pgmout=${pgmout:-${jlogfile}} -touch $pgmout - -# Other variables -MAKE_CTL=${MAKE_CTL:-1} -MAKE_DATA=${MAKE_DATA:-1} -RAD_AREA=${RAD_AREA:-glb} -REGIONAL_RR=${REGIONAL_RR:-0} -rgnHH=${rgnHH:-} -rgnTM=${rgnTM:-} -SATYPE=${SATYPE:-} -VERBOSE=${VERBOSE:-NO} -LITTLE_ENDIAN=${LITTLE_ENDIAN:-0} -USE_ANL=${USE_ANL:-0} - -err=0 -bcoef_exec=radmon_bcoef - -if [[ $USE_ANL -eq 1 ]]; then - gesanl="ges anl" -else - gesanl="ges" -fi - -#-------------------------------------------------------------------- -# Copy extraction program and supporting files to working directory - -$NCP $EXECradmon/${bcoef_exec} ./${bcoef_exec} -$NCP ${biascr} ./biascr.txt - -if [[ ! -s ./${bcoef_exec} || ! -s ./biascr.txt ]]; then - err=4 -else - - -#-------------------------------------------------------------------- -# Run program for given time - - export pgm=${bcoef_exec} - - iyy=`echo $PDATE | cut -c1-4` - imm=`echo $PDATE | cut -c5-6` - idd=`echo $PDATE | cut -c7-8` - ihh=`echo $PDATE | cut -c9-10` - - ctr=0 - fail=0 - - nchanl=-999 - npredr=5 - - for type in ${SATYPE}; do - - if [[ ! -s ${type} ]]; then - echo "ZERO SIZED: ${type}" - continue - fi - - for dtype in ${gesanl}; do - - prep_step - - ctr=`expr $ctr + 1` - - if [[ $dtype == "anl" ]]; then - data_file=${type}_anl.${PDATE}.ieee_d - ctl_file=${type}_anl.ctl - bcoef_ctl=bcoef.${ctl_file} - else - data_file=${type}.${PDATE}.ieee_d - ctl_file=${type}.ctl - bcoef_ctl=bcoef.${ctl_file} - fi - - if [[ $REGIONAL_RR -eq 1 ]]; then - bcoef_file=${rgnHH}.bcoef.${data_file}.${rgnTM} - else - bcoef_file=bcoef.${data_file} - fi - - - rm input - - -cat << EOF > input - &INPUT - satname='${type}', - npredr=${npredr}, - nchanl=${nchanl}, - iyy=${iyy}, - imm=${imm}, - idd=${idd}, - ihh=${ihh}, - idhh=-720, - incr=${CYCLE_INTERVAL}, - suffix='${RADMON_SUFFIX}', - imkctl=${MAKE_CTL}, - imkdata=${MAKE_DATA}, - gesanl='${dtype}', - little_endian=${LITTLE_ENDIAN}, - / -EOF - startmsg - ./${bcoef_exec} < input >>${pgmout} 2>>errfile - export err=$?; err_chk - if [[ $err -ne 0 ]]; then - fail=`expr $fail + 1` - fi - - -#------------------------------------------------------------------- -# move data, control, and stdout files to $TANKverf_rad and compress -# - - if [[ -s ${data_file} ]]; then - mv ${data_file} ${bcoef_file} - ${COMPRESS} -f ${bcoef_file} - mv ${bcoef_file}* $TANKverf_rad/. - fi - - if [[ -s ${ctl_file} ]]; then - mv ${ctl_file} ${bcoef_ctl} - ${COMPRESS} -f ${bcoef_ctl} - mv ${bcoef_ctl}* ${TANKverf_rad}/. - fi - - done # dtype in $gesanl loop - done # type in $SATYPE loop - - if [[ $fail -eq $ctr || $fail -gt $ctr ]]; then - err=5 - fi -fi - - -################################################################################ -# Post processing -if [[ "$VERBOSE" = "YES" ]]; then - echo $(date) EXITING $0 with error code ${err} >&2 -fi - -msg="${scr} HAS ENDED" -postmsg "$jlogfile" "$msg" - -exit ${err} diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/ush/radmon_verf_bcor.sh b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/ush/radmon_verf_bcor.sh deleted file mode 100755 index f1365c75d5..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/ush/radmon_verf_bcor.sh +++ /dev/null @@ -1,239 +0,0 @@ -#!/bin/ksh - -################################################################################ -#### UNIX Script Documentation Block -# . . -# Script name: radmon_verf_bcor.sh -# Script description: Extract bias correction data from radiance diagnostic -# files. -# -# Author: Ed Safford Org: NP23 Date: 2012-02-02 -# -# Abstract: This script extracts bias correction related data from radiance -# diagnostic files (which are an output from GSI runs), storing the -# extracted data in small binary files. -# -# This script is a child script of exgdas_vrfyrad.sh.sms. The parent -# script opens and uncompresses the radiance diagnostic file and copies -# other supporting files into a temporary working directory. -# -# -# Usage: radmon_verf_bcor.sh PDATE -# -# Input script positional parameters: -# PDATE processing date -# yyyymmddcc format; required -# -# Imported Shell Variables: -# RADMON_SUFFIX data source suffix -# defauls to opr -# MAKE_CTL switch to construct the meta-data control file -# defaults to 1 (on) -# MAKE_DATA switch to construct the binary data file -# defaults to 1 (on) -# EXECradmon executable directory -# defaults to current directory -# RAD_AREA global or regional flag -# defaults to global -# TANKverf_rad data repository -# defaults to current directory -# SATYPE list of satellite/instrument sources -# defaults to none -# VERBOSE Verbose flag (YES or NO) -# defaults to NO -# LITTLE_ENDIAN flag for little endian machine -# defaults to 0 (big endian) -# USE_ANL use analysis files as inputs in addition to -# the ges files. Default is 0 (ges only) -# -# Modules and files referenced: -# scripts : -# -# programs : $NCP -# $bcor_exec -# -# fixed data : none -# -# input data : $data_file -# -# output data: $bcor_file -# $bcor_ctl -# $pgmout -# -# Remarks: -# -# Condition codes -# 0 - no problem encountered -# >0 - some problem encountered -# -#################################################################### - -# Command line arguments. -export PDATE=${1:-${PDATE:?}} - -scr=radmon_verf_bcor.sh -msg="${scr} HAS STARTED" -postmsg "$jlogfile" "$msg" - - -if [[ "$VERBOSE" = "YES" ]]; then - set -ax -fi - -# Directories -EXECradmon=${EXECradmon:-$(pwd)} -TANKverf_rad=${TANKverf_rad:-$(pwd)} - -# File names -pgmout=${pgmout:-${jlogfile}} -touch $pgmout - -# Other variables -MAKE_CTL=${MAKE_CTL:-1} -MAKE_DATA=${MAKE_DATA:-1} -RAD_AREA=${RAD_AREA:-glb} -SATYPE=${SATYPE:-} -VERBOSE=${VERBOSE:-NO} -LITTLE_ENDIAN=${LITTLE_ENDIAN:-0} -USE_ANL=${USE_ANL:-0} - -bcor_exec=radmon_bcor -err=0 - -if [[ $USE_ANL -eq 1 ]]; then - gesanl="ges anl" -else - gesanl="ges" -fi - - -#-------------------------------------------------------------------- -# Copy extraction program to working directory - -$NCP ${EXECradmon}/${bcor_exec} ./${bcor_exec} - -if [[ ! -s ./${bcor_exec} ]]; then - err=6 -else - - -#-------------------------------------------------------------------- -# Run program for given time - - export pgm=${bcor_exec} - - iyy=`echo $PDATE | cut -c1-4` - imm=`echo $PDATE | cut -c5-6` - idd=`echo $PDATE | cut -c7-8` - ihh=`echo $PDATE | cut -c9-10` - - ctr=0 - fail=0 - touch "./errfile" - - for type in ${SATYPE}; do - - for dtype in ${gesanl}; do - - prep_step - - ctr=`expr $ctr + 1` - - if [[ $dtype == "anl" ]]; then - data_file=${type}_anl.${PDATE}.ieee_d - bcor_file=bcor.${data_file} - ctl_file=${type}_anl.ctl - bcor_ctl=bcor.${ctl_file} - stdout_file=stdout.${type}_anl - bcor_stdout=bcor.${stdout_file} - input_file=${type}_anl - else - data_file=${type}.${PDATE}.ieee_d - bcor_file=bcor.${data_file} - ctl_file=${type}.ctl - bcor_ctl=bcor.${ctl_file} - stdout_file=stdout.${type} - bcor_stdout=bcor.${stdout_file} - input_file=${type} - fi - - rm input - - # Check for 0 length input file here and avoid running - # the executable if $input_file doesn't exist or is 0 bytes - # - if [[ -s $input_file ]]; then - nchanl=-999 - -cat << EOF > input - &INPUT - satname='${type}', - iyy=${iyy}, - imm=${imm}, - idd=${idd}, - ihh=${ihh}, - idhh=-720, - incr=6, - nchanl=${nchanl}, - suffix='${RADMON_SUFFIX}', - imkctl=${MAKE_CTL}, - imkdata=${MAKE_DATA}, - gesanl='${dtype}', - little_endian=${LITTLE_ENDIAN}, - rad_area='${RAD_AREA}', - / -EOF - - startmsg - ./${bcor_exec} < input >> ${pgmout} 2>>errfile - export err=$?; err_chk - if [[ $? -ne 0 ]]; then - fail=`expr $fail + 1` - fi - - -#------------------------------------------------------------------- -# move data, control, and stdout files to $TANKverf_rad and compress -# - - if [[ -s ${data_file} ]]; then - mv ${data_file} ${bcor_file} - mv ${bcor_file} $TANKverf_rad/. - ${COMPRESS} -f $TANKverf_rad/${bcor_file} - fi - - if [[ -s ${ctl_file} ]]; then - mv ${ctl_file} ${bcor_ctl} - mv ${bcor_ctl} ${TANKverf_rad}/. - ${COMPRESS} -f ${TANKverf_rad}/${bcor_ctl} - fi - - if [[ -s ${stdout_file} ]]; then - mv ${stdout_file} ${bcor_stdout} - mv ${bcor_stdout} ${TANKverf_rad}/. - ${COMPRESS} -f ${TANKverf_rad}/${bcor_stdout} - fi - - fi # -s $data_file - - done # dtype in $gesanl loop - done # type in $SATYPE loop - - - if [[ $fail -eq $ctr || $fail -gt $ctr ]]; then - err=7 - fi -fi - -################################################################################ -# Post processing - -if [[ "$VERBOSE" = "YES" ]]; then - echo $(date) EXITING $0 error code ${err} >&2 -fi - -msg="${scr} HAS ENDED" -postmsg "$jlogfile" "$msg" - -exit ${err} - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/ush/radmon_verf_time.sh b/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/ush/radmon_verf_time.sh deleted file mode 100755 index 23119d3ea5..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/ush/radmon_verf_time.sh +++ /dev/null @@ -1,544 +0,0 @@ -#!/bin/ksh - -################################################################################ -#### UNIX Script Documentation Block -# . . -# Script name: radmon_verf_time.sh -# Script description: Extract time data from radiance diagnostic files, -# perform data integrity checks. -# -# Author: Ed Safford Org: NP23 Date: 2012-02-02 -# -# Abstract: This script extracts time related data from radiance diagnostic -# files (which are an output from GSI runs), storing the extracted -# data in small binary files. Data integrity checks are performed -# on the data and mail messages are sent if potential errors are -# detected. -# -# This script is a child script of exgdas_vrfyrad.sh.sms. The parent -# script opens and uncompresses the radiance diagnostic file and copies -# other supporting files into a temporary working directory. -# -# -# Usage: radmon_verf_time.sh PDATE -# -# Input script positional parameters: -# PDATE processing date -# yyyymmddcc format; required -# -# Imported Shell Variables: -# DO_DIAG_RPT switch to build the diagnostic report -# defaults to 1 (on) -# DO_DATA_RPT switch to build the data report -# defaults to 1 (on) -# RADMON_SUFFIX data source suffix -# defauls to opr -# MAKE_CTL switch to construct the meta-data control file -# defaults to 1 (on) -# MAKE_DATA switch to construct the binary data file -# defaults to 1 (on) -# EXECradmon executable directory -# defaults to current directory -# FIXgdas fixed data directory -# defaults to current directory -# RAD_AREA global or regional flag -# defaults to global -# TANKverf_rad data repository -# defaults to current directory -# SATYPE list of satellite/instrument sources -# defaults to none -# MAIL_TO email recipients -# defaults to none -# MAIL_CC email cc recipients -# defaults to none -# VERBOSE Verbose flag (YES or NO) -# defaults to NO -# LITTLE_ENDIAN flag for little endian machine -# defaults to 0 (big endian) -# USE_ANL use analysis files as inputs in addition to -# the ges files. Default is 0 (ges only) -# -# Modules and files referenced: -# scripts : -# -# programs : $NCP -# $time_exec -# -# fixed data : gdas_radmon_base.tar -# -# input data : $data_file -# -# output data: $time_file -# $time_ctl -# $pgmout -# $bad_pen -# $bad_chan -# $report -# $diag_report -# -# -# Remarks: -# -# Condition codes -# 0 - no problem encountered -# >0 - some problem encountered -# -#################################################################### - -# Command line arguments. -export PDATE=${1:-${PDATE:?}} - -scr=radmon_verf_time.sh -msg="${scr} HAS STARTED" -postmsg "$jlogfile" "$msg" - -if [[ "$VERBOSE" = "YES" ]]; then - set -ax -fi - -# Directories -FIXgdas=${FIXgdas:-$(pwd)} -EXECradmon=${EXECradmon:-$(pwd)} -TANKverf_rad=${TANKverf_rad:-$(pwd)} - -# File names -pgmout=${pgmout:-${jlogfile}} -touch $pgmout - -radmon_err_rpt=${radmon_err_rpt:-${USHradmon}/radmon_err_rpt.sh} -base_file=${base_file:-$FIXgdas/gdas_radmon_base.tar} -report=report.txt -disclaimer=disclaimer.txt -region=region.txt -diag_report=diag_report.txt -diag_hdr=diag_hdr.txt -diag=diag.txt -obs_err=obs_err.txt -obs_hdr=obs_hdr.txt -pen_err=pen_err.txt -pen_hdr=pen_hdr.txt -chan_err=chan_err.txt -chan_hdr=chan_hdr.txt - -# Other variables -DO_DIAG_RPT=${DO_DIAG_RPT:-1} -DO_DATA_RPT=${DO_DATA_RPT:-1} -RADMON_SUFFIX=${RADMON_SUFFIX:-opr} -MAKE_CTL=${MAKE_CTL:-1} -MAKE_DATA=${MAKE_DATA:-1} -RAD_AREA=${RAD_AREA:-glb} -REGIONAL_RR=${REGIONAL_RR:-0} -rgnHH=${rgnHH:-} -rgnTM=${rgnTM:-} -SATYPE=${SATYPE:-} -MAIL_TO=${MAIL_TO:-} -MAIL_CC=${MAIL_CC:-} -VERBOSE=${VERBOSE:-NO} -LITTLE_ENDIAN=${LITTLE_ENDIAN:-0} -USE_MAIL=${USE_MAIL:-0} - -time_exec=radmon_time -USE_ANL=${USE_ANL:-0} -err=0 - -if [[ $USE_ANL -eq 1 ]]; then - gesanl="ges anl" -else - gesanl="ges" -fi - - -#-------------------------------------------------------------------- -# Copy extraction program and base files to working directory -#------------------------------------------------------------------- -$NCP ${EXECradmon}/${time_exec} ./ -if [[ ! -s ./${time_exec} ]]; then - err=8 -fi - -iyy=`echo $PDATE | cut -c1-4` -imm=`echo $PDATE | cut -c5-6` -idd=`echo $PDATE | cut -c7-8` -ihh=`echo $PDATE | cut -c9-10` -cyc=$ihh -CYCLE=$cyc - -local_base="local_base" -if [[ $DO_DATA_RPT -eq 1 ]]; then - - if [[ -e ${base_file}.${Z} ]]; then - $NCP ${base_file}.${Z} ./${local_base}.{Z} - ${UNCOMPRESS} ${local_base}.${Z} - else - $NCP ${base_file} ./${local_base} - fi - - if [[ ! -s ./${local_base} ]]; then - echo "RED LIGHT: local_base file not found" - else - echo "Confirming local_base file is good = ${local_base}" - tar -xf ./${local_base} - echo "local_base is untarred" - fi -fi - -if [[ $err -eq 0 ]]; then - ctr=0 - fail=0 - - export pgm=${time_exec} -#-------------------------------------------------------------------- -# Loop over each entry in SATYPE -#-------------------------------------------------------------------- - for type in ${SATYPE}; do - - if [[ ! -s ${type} ]]; then - echo "ZERO SIZED: ${type}" - echo ${type} >> ${diag} - continue - fi - - ctr=`expr $ctr + 1` - - for dtype in ${gesanl}; do - - prep_step - - rm input - - if [[ $dtype == "anl" ]]; then - data_file=${type}_anl.${PDATE}.ieee_d - ctl_file=${type}_anl.ctl - time_ctl=time.${ctl_file} - else - data_file=${type}.${PDATE}.ieee_d - ctl_file=${type}.ctl - time_ctl=time.${ctl_file} - fi - - if [[ $REGIONAL_RR -eq 1 ]]; then - time_file=${rgnHH}.time.${data_file}.${rgnTM} - else - time_file=time.${data_file} - fi - -#-------------------------------------------------------------------- -# Run program for given satellite/instrument -#-------------------------------------------------------------------- - nchanl=-999 -cat << EOF > input - &INPUT - satname='${type}', - iyy=${iyy}, - imm=${imm}, - idd=${idd}, - ihh=${ihh}, - idhh=-720, - incr=${CYCLE_INTERVAL}, - nchanl=${nchanl}, - suffix='${RADMON_SUFFIX}', - imkctl=${MAKE_CTL}, - imkdata=${MAKE_DATA}, - gesanl='${dtype}', - little_endian=${LITTLE_ENDIAN}, - rad_area='${RAD_AREA}', - / -EOF - startmsg - - ./${time_exec} < input >> stdout.${type} 2>>errfile - export err=$?; err_chk - - # - # stdout.${type} is needed by radmon_ck_stdout.sh - # NCO requirement is executable output goes to jlogfile, so - # cat it there now: - cat stdout.${type} >> ${pgmout} - - if [[ $err -ne 0 ]]; then - fail=`expr $fail + 1` - fi - -#------------------------------------------------------------------- -# move data, control, and stdout files to $TANKverf_rad and compress -#------------------------------------------------------------------- - - if [[ -s ${data_file} ]]; then - mv ${data_file} ${time_file} - ${COMPRESS} -f ${time_file} - mv ${time_file}* $TANKverf_rad/. - fi - - if [[ -s ${ctl_file} ]]; then - $NCP ${ctl_file} ${time_ctl} - ${COMPRESS} -f ${time_ctl} - $NCP ${time_ctl}* ${TANKverf_rad}/. - fi - - done - done - if [[ $fail -eq $ctr || $fail -gt $ctr ]]; then - echo "fail, ctr = $fail, $ctr" - err=10 - fi - -fi - - - -#################################################################### -#------------------------------------------------------------------- -# Begin error analysis and reporting -#------------------------------------------------------------------- -#################################################################### - -if [[ $DO_DIAG_RPT -eq 1 ]]; then - echo "DOING DIAG RPT!!!" -# build the disclaimer and region files - - cat << EOF > ${disclaimer} - - -*********************** WARNING *************************** -THIS IS AN AUTOMATED EMAIL. REPLIES TO SENDER WILL NOT BE -RECEIVED. PLEASE DIRECT REPLIES TO edward.safford@noaa.gov -*********************** WARNING *************************** -EOF - - cat << EOF > ${region} - Region Definitions: - - 1 Global (90S-90N, 0-360E) -EOF - - -#------------------------------------------------------------------- -# Check stdout file for any reported problem(s) reading the -# diagnostic file by calling ck_stdout.sh -# - ${USHradmon}/radmon_ck_stdout.sh ${diag} - - if [[ -s ${diag} ]]; then - cat << EOF > ${diag_hdr} - -Problem Reading Diagnostic File - - $PDATE - - Problems were encountered reading the diagnostic file for - the following sources: - -EOF - - cat ${diag_hdr} >> ${diag_report} - cat ${diag} >> ${diag_report} - if [[ $USE_MAIL -eq 1 ]]; then - cat ${disclaimer} >> ${diag_report} - else - echo End Problem Reading Diagnostic File >> ${diag_report} - echo >> ${diag_report} - fi - rm ${diag} ${diag_hdr} - fi - -#------------------------------------------------------------------- -# mail error notifications or dump to log file - - if [[ -s ${diag_report} ]]; then - lines=`wc -l <${diag_report}` - if [[ $lines -gt 1 ]]; then - - if [[ $USE_MAIL -eq 1 ]]; then - if [[ $MAIL_CC == "" ]]; then - /bin/mail -v -s diagnostic_error_report ${MAIL_TO}< ${diag_report} - else - /bin/mail -v -s diagnostic_error_report -c "${MAIL_CC}" ${MAIL_TO}< ${diag_report} - fi - else - - cat ${diag_report} - fi - fi - fi - -fi - - -#------------------------------------------------------------------- -# Assemble the bad penalty/channel report - -if [[ $DO_DATA_RPT -eq 1 ]]; then - - #---------------------------------------------------------------- - # Identify bad_pen and bad_chan files for this cycle and - # previous cycle - - bad_pen=bad_pen.${PDATE} - bad_chan=bad_chan.${PDATE} - - qdate=`$NDATE -${CYCLE_INTERVAL} $PDATE` - pday=`echo $qdate | cut -c1-8` - - prev_bad_pen=bad_pen.${qdate} - prev_bad_chan=bad_chan.${qdate} - - if [[ $CYCLE == "00" ]]; then - prev_bad_pen=${TANKverf_radM1}/${prev_bad_pen} - prev_bad_chan=${TANKverf_radM1}/${prev_bad_chan} - else - prev_bad_pen=${TANKverf_rad}/${prev_bad_pen} - prev_bad_chan=${TANKverf_rad}/${prev_bad_chan} - fi - - do_pen=0 - do_chan=0 - if [[ -s $bad_pen && -s $prev_bad_pen ]]; then - do_pen=1 - fi - - #-------------------------------------------------------------------- - # avoid doing the bad_chan report for REGIONAL_RR sources -- because - # they run hourly they often have 0 count channels for off-hour runs. - # - if [[ -s $bad_chan && -s $prev_bad_chan && REGIONAL_RR -eq 0 ]]; then - do_chan=1 - fi - -#-------------------------------------------------------------------- -# Remove extra spaces in new bad_pen file -# - gawk '{$1=$1}1' $bad_pen > tmp.bad_pen - mv -f tmp.bad_pen $bad_pen - - - if [[ $do_pen -eq 1 || $do_chan -eq 1 ]]; then - - if [[ $do_pen -eq 1 ]]; then - - $NCP ${TANKverf_radM1}/${prev_bad_pen} ./ - ${radmon_err_rpt} ${prev_bad_pen} ${bad_pen} pen ${qdate} \ - ${PDATE} ${diag_report} ${pen_err} - fi - - if [[ $do_chan -eq 1 ]]; then - - $NCP ${TANKverf_radM1}/${prev_bad_chan} ./ - ${radmon_err_rpt} ${prev_bad_chan} ${bad_chan} chan ${qdate} \ - ${PDATE} ${diag_report} ${chan_err} - fi - -#------------------------------------------------------------------- -# put together the unified error report with any obs, chan, and -# penalty problems and mail it - - if [[ -s ${obs_err} || -s ${pen_err} || -s ${chan_err} ]]; then - - echo DOING ERROR REPORTING - - echo "Begin Cycle Data Integrity Report" > $report - - cat << EOF >> $report -Cycle Data Integrity Report - $PDATE - -EOF - - cat ${region} >> $report - - if [[ -s ${chan_err} ]]; then - - echo OUTPUTING CHAN_ERR - - cat << EOF > ${chan_hdr} - - The following channels report 0 observational counts over the past two cycles: - - Satellite/Instrument Channel - ==================== ======= - -EOF - - cat ${chan_hdr} >> $report - cat ${chan_err} >> $report - - fi - - if [[ -s ${pen_err} ]]; then - - cat << EOF > ${pen_hdr} - - - Penalty values outside of the established normal range were found - for these sensor/channel/regions in the past two cycles: - - Questionable Penalty Values - ============ ======= ====== Cycle Penalty Bound - ----- ------- ----- -EOF - cat ${pen_hdr} >> $report - cat ${pen_err} >> $report - rm -f ${pen_hdr} - rm -f ${pen_err} - fi - - if [[ $USE_MAIL -eq 1 ]]; then - cat ${disclaimer} >> $report - else - echo End Cycle Data Integrity Report >> $report - echo >> $report - fi - fi - -#------------------------------------------------------------------- -# mail error notifications or dump to log file -# - if [[ -s ${report} ]]; then - lines=`wc -l <${report}` - if [[ $lines -gt 2 ]]; then - if [[ $USE_MAIL -eq 1 ]]; then - if [[ $MAIL_CC == "" ]]; then - /bin/mail -v -s cycle_report ${MAIL_TO}< ${report} - else - /bin/mail -v -s cycle_report -c "${MAIL_CC}" ${MAIL_TO}< ${report} - fi - else - cat ${report} - fi - fi - fi - - fi - -#------------------------------------------------------------------- -# copy new bad_pen and bad_chan files to $TANKverf_rad - - if [[ -s ${bad_chan} ]]; then - $NCP ${bad_chan} ${TANKverf_rad}/. - fi - - if [[ -s ${bad_pen} ]]; then - $NCP ${bad_pen} ${TANKverf_rad}/. - fi - -fi - -for type in ${SATYPE}; do - rm -f stdout.${type} -done - -################################################################################ -#------------------------------------------------------------------- -# end error reporting section -#------------------------------------------------------------------- -################################################################################ - -################################################################################ -# Post processing -if [[ "$VERBOSE" = "YES" ]]; then - echo $(date) EXITING $0 error code ${err} >&2 -fi - -msg="${scr} HAS ENDED" -postmsg "$jlogfile" "$msg" - -exit ${err} diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/exec/.gitignore b/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/exec/.gitignore deleted file mode 100644 index d6b7ef32c8..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/exec/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -* -!.gitignore diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/modulefiles/cray/RadMonBuild b/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/modulefiles/cray/RadMonBuild deleted file mode 100644 index 635191146a..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/modulefiles/cray/RadMonBuild +++ /dev/null @@ -1,17 +0,0 @@ -#%Module################################################################# -proc ModulesHelp { } { - puts stderr "Set environment variables for WCOSS(cray) radmon build" -} - -module-whatis "Set environment variables for WCOSS(cray) radmon build" - -set FCOMP ifort - -setenv CF $FCOMP -setenv FC $FCOMP -setenv FFLAGS "-O3 -fp-model strict -D_REAL8_ -traceback -convert big_endian -assume byterecl" -setenv CHECK_LIBS "/gpfs/hps/nco/ops/nwprod/spa_util/check_libs.bash" -setenv D_FFLAGS "-O3 -fp-model strict -D_REAL8_ -traceback -convert big_endian -assume byterecl -debug" -module load intel -module load w3nco-intel - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/modulefiles/theia/RadMonBuild b/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/modulefiles/theia/RadMonBuild deleted file mode 100644 index 4e82c58cfd..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/modulefiles/theia/RadMonBuild +++ /dev/null @@ -1,18 +0,0 @@ -#%Module################################################################# -proc ModulesHelp { } { - puts stderr "Set environment variables for THEIA radmon build" -} - -module-whatis "Set environment variables for THEIA radmon build" - -module load intel - -set FCOMP ifort - -setenv CF $FCOMP -setenv FC $FCOMP -setenv FFLAGS "-O3 -fp-model strict -D_REAL8_ -traceback -convert big_endian -assume byterecl" -setenv D_FFLAGS "-O3 -fp-model strict -D_REAL8_ -traceback -convert big_endian -assume byterecl -debug" - -setenv W3NCO_LIB4 "-L/scratch3/NCEPDEV/nwprod/lib -lw3nco_4" - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/modulefiles/wcoss/RadMonBuild b/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/modulefiles/wcoss/RadMonBuild deleted file mode 100644 index 7268764804..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/modulefiles/wcoss/RadMonBuild +++ /dev/null @@ -1,18 +0,0 @@ -#%Module################################################################# -proc ModulesHelp { } { - puts stderr "Set environment variables for WCOSS radmon build" -} - -module-whatis "Set environment variables for WCOSS radmon build" - -set ver 2.0.2 -set FCOMP ifort - -setenv CF $FCOMP -setenv FC $FCOMP -setenv FFLAGS "-O3 -fp-model strict -D_REAL8_ -traceback -convert big_endian -assume byterecl" -setenv D_FFLAGS "-O3 -fp-model strict -D_REAL8_ -traceback -convert big_endian -assume byterecl -debug" -setenv CHECK_LIBS "/nwprod/spa_util/check_libs.bash" -module load ics -module load w3nco - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/modulefiles/wcoss_d/RadMonBuild b/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/modulefiles/wcoss_d/RadMonBuild deleted file mode 100644 index fb02983797..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/modulefiles/wcoss_d/RadMonBuild +++ /dev/null @@ -1,17 +0,0 @@ -#%Module################################################################# -proc ModulesHelp { } { - puts stderr "Set environment variables for WCOSS(dell) radmon build" -} - -module-whatis "Set environment variables for WCOSS(dell) radmon build" - -set FCOMP ifort - -setenv CF $FCOMP -setenv FC $FCOMP -setenv FFLAGS "-O3 -fp-model strict -D_REAL8_ -traceback -convert big_endian -assume byterecl" -setenv CHECK_LIBS "/gpfs/hps/nco/ops/nwprod/spa_util/check_libs.bash" -setenv D_FFLAGS "-O3 -fp-model strict -D_REAL8_ -traceback -convert big_endian -assume byterecl -debug" -module load ips/18.0.1.163 -module load w3nco/2.0.6 - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/build_radmon.sh b/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/build_radmon.sh deleted file mode 100755 index fc3faa6b22..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/build_radmon.sh +++ /dev/null @@ -1,34 +0,0 @@ - -this_sys=`hostname` -two=`echo $this_sys | cut -c1-2` -one=`echo $this_sys | cut -c1` - -# System is either wcoss, cray, or theia -# (# = a digit) -# hostnames on theia are tfe## -# cray are s|tlogin# -# wcoss are t|g##a# - -system="wcoss" -if [[ $two = "tf" ]]; then - system="theia" -elif [[ $two = "tl" || $two = "sl" ]]; then - system="cray": -fi - -echo "system = $system" - -module use -a ../modulefiles/${system} -module load RadMonBuild - - -for dir in verf_radbcoef.fd verf_radtime.fd verf_radang.fd verf_radbcor.fd -do - cd $dir - make check_prereqs - make - make install - cd ../ -done - -module unload RadMonBuild diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/readme b/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/readme deleted file mode 100644 index 2ec020294c..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/readme +++ /dev/null @@ -1,29 +0,0 @@ -Instructions for building executables. - - Run the build_radmon.sh script OR perform these steps: - - 1) Load the build module appropriate for your Machine: - i.) - WCOSS: - "module use -a ../modulefiles/wcoss" - CRAY: - "module use -a ../modulefiles/cray" - THEIA: - "module use -a ../modulefiles/theia" - ii.) type: - "module load RadMonBuild" - - 2) cd into each executable directory (*.fd) - - 3) Optional: verify all prerequisites are met by typing: - "make check_prereqs" - - 4) Build the executable by typing: - "make" - - 5) Move the executable to the ../../exec directory by typing: - "make install" - - 6) When all executable have been built unload the build module: - "module unload RadMonBuild" - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radang.fd/create_ctl_angle.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radang.fd/create_ctl_angle.f90 deleted file mode 100755 index ecd6e64727..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radang.fd/create_ctl_angle.f90 +++ /dev/null @@ -1,176 +0,0 @@ -subroutine create_ctl_angle(ntype,ftype,n_chan,iyy,imm,idd,ihh,incr,& - ctl_file,lunctl,rmiss,satname,satype,dplat,nregion,& - region,rlonmin,rlonmax,rlatmin,rlatmax,nu_chan,use,error,& - frequency,wavenumbr,nstep,start,step, little_endian) - - implicit none - - integer ntype - - character(2) cword - character(3),dimension(12):: mon - character(3):: clatmin,clatmax - character(4):: clonmin,clonmax - character(10),dimension(ntype):: ftype - character(13) stringd - character(20) satname - character(10) satype,dplat - character(40) ctl_file,grad_file - character(80) string - character(40),dimension(nregion):: region - character(80),dimension(nregion):: stringr - - integer nregion,iuse,klev,nstep - integer lunctl,iyy,imm,idd,ihh,j,i,n_chan,idhh,incr - integer iyy2,imm2,idd2,ihh2,ntime - integer, dimension(8):: ida,jda - integer,dimension(n_chan):: nu_chan - integer little_endian - - real rmiss,wavelength,start,step - real,dimension(5):: fha - real,dimension(n_chan):: error,use,frequency,wavenumbr - real,dimension(nregion):: rlonmin,rlonmax,rlatmin,rlatmax - - data stringd / '.%y4%m2%d2%h2' / - data mon / 'jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', & - 'aug', 'sep', 'oct', 'nov', 'dec' / - -!************************************************************************** - - write(6,*)'start create_ctl_angle' - write(6,*)' n_chan = ', n_chan - -! Create date for tdef based on given date and hour offset - - idhh=-720 ! this is 30 days back in hours. -! incr=6 ! cycle interval - - fha=0.0; ida=0; jda=0; ntime=0 - iyy2=iyy; imm2=imm; idd2=idd; ihh2=ihh - if (idhh/=0) then - ntime = abs(idhh)/incr - fha(2)=idhh - ida(1)=iyy - ida(2)=imm - ida(3)=idd - ida(4)=0 - ida(5)=ihh - call w3movdat(fha,ida,jda) - iyy2=jda(1) - imm2=jda(2) - idd2=jda(3) - ihh2=jda(5) - endif - ntime=ntime+1 - -! Open unit to GrADS control file - open(lunctl,file=ctl_file,form='formatted') - -!******************************************************************* -! Construct the region strings if this is for a global source, -! which is defined as nregion > 1. -! - if (nregion > 1) then - do i=1,nregion - if (rlatmin(i)>0.) then - write(clatmin,10) int(rlatmin(i)) - else - write(clatmin,20) abs(int(rlatmin(i))) - endif - if (rlatmax(i)>0.) then - write(clatmax,10) int(rlatmax(i)) - else - write(clatmax,20) abs(int(rlatmax(i))) - endif - if (rlonmin(i)>0.) then - write(clonmin,30) int(rlonmin(i)) - else - write(clonmin,40) abs(int(rlonmin(i))) - endif - if (rlonmax(i)>0.) then - write(clonmax,30) int(rlonmax(i)) - else - write(clonmax,40) abs(int(rlonmax(i))) - endif - stringr(i) = trim(region(i)) // ' (' // & - trim(clonmin) // '-' // trim(clonmax) // ', ' // & - trim(clatmin) // '-' // trim(clatmax) // ')' - end do - endif -10 format(i2,'N') -20 format(i2,'S') -30 format(i3,'E') -40 format(i3,'W') - -! Write header information - grad_file = trim(satname) // stringd // '.ieee_d' - write(lunctl,100) grad_file - if (little_endian == 1 ) then - write( lunctl,112 ) - else - write( lunctl,110 ) - endif - write(lunctl,120) rmiss - write(lunctl,130) adjustl(satype),dplat,n_chan - write(lunctl,132) - write(lunctl,134) - do i=1,n_chan - iuse = nint(use(i)) - wavelength = 10000./wavenumbr(i) - write(lunctl,136) i,nu_chan(i),iuse,error(i),wavelength,frequency(i) - end do - write(lunctl,138) - - if (nregion > 1) then - do i=1,nregion - write(cword,'(i2)') i - string = '* region=' // cword // ' ' // trim(stringr(i)) - write(lunctl,140) string - end do - endif - write(lunctl,145) nstep,start,step - write(lunctl,150) n_chan - write(lunctl,160) nregion - write(lunctl,170) ntime,ihh2,idd2,mon(imm2),iyy2,incr - write(lunctl,180) ntype - -100 format('dset ^',a40) -110 format('options template big_endian sequential') -112 format('options template little_endian sequential') -120 format('undef ',f5.0) -130 format('title ',a10,1x,a10,1x,i4) -132 format('*XDEF is scan position') -134 format('*YDEF is channel number') -136 format('* y= ',i4,', channel= ',i4,' , iuse= ',i2,' , error= ',f8.3,& - ' , wlth= ',f9.2,' , freq= ',f9.2) -138 format('*ZDEF is geographic region') -140 format(a80) -145 format('xdef ',i3,' linear ',f5.1,1x,f5.1) -150 format('ydef ',i4,' linear 1.0 1.0') -160 format('zdef ',i2,' linear 1.0 1.0') -170 format('tdef ',i4,' linear ',i2.2,'Z',i2.2,a3,i4.4,' ',i2.2,'hr') -180 format('vars ',i7) - -! Write data portion of GraDS control file - do i=1,ntype - string = trim(ftype(i)) - klev=nregion - if (i==1) klev=1 - write(lunctl,190) adjustl(string),klev,trim(ftype(i)) -190 format(a10,1x,i2,' 0 ',a10) - end do - -! Write trminating "endvars" record - write(lunctl,200) -200 format('endvars') - - -! Close ctl file - close(lunctl) - - write(6,*)'finish create_ctl_angle' - -! Return - return -end subroutine create_ctl_angle diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radang.fd/kinds.F90 b/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radang.fd/kinds.F90 deleted file mode 100644 index 8b3a2fcc4e..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radang.fd/kinds.F90 +++ /dev/null @@ -1,112 +0,0 @@ -module kinds -!$$$ module documentation block -! . . . . -! module: kinds -! prgmmr: treadon org: np23 date: 2004-08-15 -! -! abstract: Module to hold specification kinds for variable declaration. -! This module is based on (copied from) Paul vanDelst's -! type_kinds module found in the community radiative transfer -! model -! -! module history log: -! 2004-08-15 treadon -! 2011-07-04 todling - define main precision during compilation -! -! Subroutines Included: -! -! Functions Included: -! -! remarks: -! The numerical data types defined in this module are: -! i_byte - specification kind for byte (1-byte) integer variable -! i_short - specification kind for short (2-byte) integer variable -! i_long - specification kind for long (4-byte) integer variable -! i_llong - specification kind for double long (8-byte) integer variable -! r_single - specification kind for single precision (4-byte) real variable -! r_double - specification kind for double precision (8-byte) real variable -! r_quad - specification kind for quad precision (16-byte) real variable -! -! i_kind - generic specification kind for default integer -! r_kind - generic specification kind for default floating point -! -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ end documentation block - implicit none - private - -! Integer type definitions below - -! Integer types - integer, parameter, public :: i_byte = selected_int_kind(1) ! byte integer - integer, parameter, public :: i_short = selected_int_kind(4) ! short integer - integer, parameter, public :: i_long = selected_int_kind(8) ! long integer - integer, parameter, private :: llong_t = selected_int_kind(16) ! llong integer - integer, parameter, public :: i_llong = max( llong_t, i_long ) - -! Expected 8-bit byte sizes of the integer kinds - integer, parameter, public :: num_bytes_for_i_byte = 1 - integer, parameter, public :: num_bytes_for_i_short = 2 - integer, parameter, public :: num_bytes_for_i_long = 4 - integer, parameter, public :: num_bytes_for_i_llong = 8 - -! Define arrays for default definition - integer, parameter, private :: num_i_kinds = 4 - integer, parameter, dimension( num_i_kinds ), private :: integer_types = (/ & - i_byte, i_short, i_long, i_llong /) - integer, parameter, dimension( num_i_kinds ), private :: integer_byte_sizes = (/ & - num_bytes_for_i_byte, num_bytes_for_i_short, & - num_bytes_for_i_long, num_bytes_for_i_llong /) - -! Default values -! **** CHANGE THE FOLLOWING TO CHANGE THE DEFAULT INTEGER TYPE KIND *** - integer, parameter, private :: default_integer = 3 ! 1=byte, - ! 2=short, - ! 3=long, - ! 4=llong - integer, parameter, public :: i_kind = integer_types( default_integer ) - integer, parameter, public :: num_bytes_for_i_kind = & - integer_byte_sizes( default_integer ) - - -! Real definitions below - -! Real types - integer, parameter, public :: r_single = selected_real_kind(6) ! single precision - integer, parameter, public :: r_double = selected_real_kind(15) ! double precision - integer, parameter, private :: quad_t = selected_real_kind(20) ! quad precision - integer, parameter, public :: r_quad = max( quad_t, r_double ) - -! Expected 8-bit byte sizes of the real kinds - integer, parameter, public :: num_bytes_for_r_single = 4 - integer, parameter, public :: num_bytes_for_r_double = 8 - integer, parameter, public :: num_bytes_for_r_quad = 16 - -! Define arrays for default definition - integer, parameter, private :: num_r_kinds = 3 - integer, parameter, dimension( num_r_kinds ), private :: real_kinds = (/ & - r_single, r_double, r_quad /) - integer, parameter, dimension( num_r_kinds ), private :: real_byte_sizes = (/ & - num_bytes_for_r_single, num_bytes_for_r_double, & - num_bytes_for_r_quad /) - -! Default values -! **** CHANGE THE FOLLOWING TO CHANGE THE DEFAULT REAL TYPE KIND *** -#ifdef _REAL4_ - integer, parameter, private :: default_real = 1 ! 1=single, -#endif -#ifdef _REAL8_ - integer, parameter, private :: default_real = 2 ! 2=double, -#endif -#ifdef _REAL16_ - integer, parameter, private :: default_real = 3 ! 3=quad -#endif - integer, parameter, public :: r_kind = real_kinds( default_real ) - integer, parameter, public :: num_bytes_for_r_kind = & - real_byte_sizes( default_real ) - -end module kinds diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radang.fd/makefile b/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radang.fd/makefile deleted file mode 100755 index 391673ceb9..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radang.fd/makefile +++ /dev/null @@ -1,52 +0,0 @@ -# ***************************************************************** -# makefile.angle_bias -# -# Make the radmon_angle executable. -# -# ***************************************************************** - -#BINDIR = $(dir_root)/exec -BINDIR = ../../exec - -LIBS = $(W3NCO_LIB4) - -OBJS = kinds.o read_diag.o angle_bias.o create_ctl_angle.o - -# -# ***************************************************************** -# - -CMD = radmon_angle.x - -all: $(CMD) - -clean: - rm -f *.o - rm -f *.mod - rm -f $(CMD) - -check_prereqs: - $(PRE_REQ) $(LIBS) - -install: - cp -f $(CMD) $(BINDIR)/ - -debug: FFLAGS = $(D_FFLAGS) -debug: $(CMD) - -$(CMD): $(OBJS) - $(CF) $(FFLAGS) $(LDFLAGS) -o $(@) $(OBJS) $(LIBS) - - -kinds.o : kinds.F90 - $(CF) $(FFLAGS) -c $(*).F90 - -read_diag.o : read_diag.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -angle_bias.o : angle_bias.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -create_ctl_angle.o : create_ctl_angle.f90 - $(CF) $(FFLAGS) -c $(*).f90 - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radang.fd/readme b/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radang.fd/readme deleted file mode 100644 index da9740f8d3..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radang.fd/readme +++ /dev/null @@ -1,25 +0,0 @@ -Instructions for building radmon_angle executable. - - 1) Load the build module appropriate for your Machine: - i.) - WCOSS: - "module use -a ../../modulefiles/wcoss" - CRAY: - "module use -a ../../modulefiles/cray" - THEIA: - "module use -a ../../modulefiles/theia" - ii.) - "module load RadMonBuild" - - 2) Optional: verify all prerequisites are met by typing: - "make check_prereqs" - - 3) Build the executable by typing: - "make" - - 4) Move the executable to the ../../exec directory by typing: - "make install" - - 5) Unload the build module: - "module unload RadMonBuild" - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radbcoef.fd/create_ctl_bcoef.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radbcoef.fd/create_ctl_bcoef.f90 deleted file mode 100755 index 1092b18cd3..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radbcoef.fd/create_ctl_bcoef.f90 +++ /dev/null @@ -1,147 +0,0 @@ -subroutine create_ctl_bcoef(ntype,ftype,n_chan,iyy,imm,idd,ihh,idhh,& - incr,ctl_file,lunctl,rmiss,satname,satype,dplat,& - nu_chan,use,ratio,frequency,wavenumbr,little_endian) - - implicit none - - integer ntype - - character(2) cword - character(3),dimension(12):: mon - character(3):: clatmin,clatmax - character(4):: clonmin,clonmax - character(10),dimension(ntype):: ftype - character(13) stringd - character(20) satname - character(10) satype,dplat - character(40) ctl_file,grad_file - character(80) string - - integer idsat,iuse,little_endian - integer lunctl,iyy,imm,idd,ihh,j,i,n_chan,idhh,incr - integer iyy2,imm2,idd2,ihh2,ntime - integer,dimension(8):: ida,jda - integer,dimension(n_chan):: nu_chan - - real rmiss,wavelength - real,dimension(5):: fha - real,dimension(n_chan):: ratio,use,frequency,wavenumbr - - data stringd / '.%y4%m2%d2%h2' / - data mon / 'jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', & - 'aug', 'sep', 'oct', 'nov', 'dec' / - -!************************************************************************** -! Create date for tdef based on given date and hour offset - fha=0.0; ida=0; jda=0; ntime=0 - iyy2=iyy; imm2=imm; idd2=idd; ihh2=ihh - if (idhh/=0) then - ntime = abs(idhh)/incr - fha(2)=idhh - ida(1)=iyy - ida(2)=imm - ida(3)=idd - ida(4)=0 - ida(5)=ihh - call w3movdat(fha,ida,jda) - iyy2=jda(1) - imm2=jda(2) - idd2=jda(3) - ihh2=jda(5) - endif - ntime=ntime+1 - -! Open unit to GrADS control file - open(lunctl,file=ctl_file,form='formatted') - - -! Write header information - grad_file = trim(satname) // stringd // '.ieee_d' - write(lunctl,100) grad_file - if ( little_endian == 1 ) then - write(lunctl,112) - else - write(lunctl,110) - endif - write(lunctl,120) rmiss - write(lunctl,130) adjustl(satype),dplat,n_chan - write(lunctl,132) - do i=1,n_chan - iuse = nint(use(i)) - wavelength = 10000./wavenumbr(i) - write(lunctl,134) i,nu_chan(i),iuse,ratio(i),wavelength,frequency(i) - end do - - write(lunctl,210) - write(lunctl,211) - write(lunctl,212) - write(lunctl,213) - write(lunctl,214) - write(lunctl,215) - write(lunctl,216) - write(lunctl,217) - write(lunctl,218) - write(lunctl,219) - write(lunctl,220) - write(lunctl,221) - write(lunctl,222) - write(lunctl,223) - write(lunctl,224) - write(lunctl,210) - - write(lunctl,140) n_chan - write(lunctl,150) - write(lunctl,160) - write(lunctl,170) ntime,ihh2,idd2,mon(imm2),iyy2,incr - write(lunctl,180) ntype - -100 format('dset ^',a40) -110 format('options template big_endian sequential') -112 format('options template little_endian sequential') -120 format('undef ',f5.0) -130 format('title ',a10,1x,a10,1x,i4) -132 format('*XDEF is channel number') -134 format('* x= ',i4,', channel= ',i4,' , iuse= ',i2,' , ratio= ',f8.3,& - ' , wlth= ',f9.2,' , freq= ',f9.2) -136 format('* ',a70) -140 format('xdef ',i4,' linear 1.0 1.0') -150 format('ydef 1 linear 1.0 1.0') -160 format('zdef 1 linear 1.0 1.0') -170 format('tdef ',i4,' linear ',i2.2,'Z',i2.2,a3,i4.4,' ',i2.2'hr') -180 format('vars ',i7) - -210 format('*') -211 format('* Explanation of data terms:') -212 format('* penalty penalty value') -213 format('* mean global offset (mean)') -214 format('* atmpath not used when adp_anglebc=.true. and newpc4pred=.true.') -215 format('* clw cloud liquid water term') -216 format('* lapse2 temperature lapse rate**2') -217 format('* lapse temperature lapse rate') -218 format('* cos_ssmis cosine term for SSMIS') -219 format('* sin_ssmis sine term for SSMIS') -220 format('* emiss emissivity sensitivity term') -221 format('* 4ordang 4th order angle term') -222 format('* 3ordang 3rd order angle term') -223 format('* 2ordang 2nd order angle term') -224 format('* 1ordang 1st order angle term') - - -! Write data portion of GraDS control file - do i=1,ntype - string = trim(ftype(i)) - write(lunctl,190) adjustl(string),trim(ftype(i)) -190 format(a10,' 0 0 ',a10) - end do - -! Write trminating "endvars" record - write(lunctl,200) -200 format('endvars') - - -! Close ctl file - close(lunctl) - -! Return - return -end subroutine create_ctl_bcoef diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radbcoef.fd/kinds.F90 b/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radbcoef.fd/kinds.F90 deleted file mode 100644 index 8b3a2fcc4e..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radbcoef.fd/kinds.F90 +++ /dev/null @@ -1,112 +0,0 @@ -module kinds -!$$$ module documentation block -! . . . . -! module: kinds -! prgmmr: treadon org: np23 date: 2004-08-15 -! -! abstract: Module to hold specification kinds for variable declaration. -! This module is based on (copied from) Paul vanDelst's -! type_kinds module found in the community radiative transfer -! model -! -! module history log: -! 2004-08-15 treadon -! 2011-07-04 todling - define main precision during compilation -! -! Subroutines Included: -! -! Functions Included: -! -! remarks: -! The numerical data types defined in this module are: -! i_byte - specification kind for byte (1-byte) integer variable -! i_short - specification kind for short (2-byte) integer variable -! i_long - specification kind for long (4-byte) integer variable -! i_llong - specification kind for double long (8-byte) integer variable -! r_single - specification kind for single precision (4-byte) real variable -! r_double - specification kind for double precision (8-byte) real variable -! r_quad - specification kind for quad precision (16-byte) real variable -! -! i_kind - generic specification kind for default integer -! r_kind - generic specification kind for default floating point -! -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ end documentation block - implicit none - private - -! Integer type definitions below - -! Integer types - integer, parameter, public :: i_byte = selected_int_kind(1) ! byte integer - integer, parameter, public :: i_short = selected_int_kind(4) ! short integer - integer, parameter, public :: i_long = selected_int_kind(8) ! long integer - integer, parameter, private :: llong_t = selected_int_kind(16) ! llong integer - integer, parameter, public :: i_llong = max( llong_t, i_long ) - -! Expected 8-bit byte sizes of the integer kinds - integer, parameter, public :: num_bytes_for_i_byte = 1 - integer, parameter, public :: num_bytes_for_i_short = 2 - integer, parameter, public :: num_bytes_for_i_long = 4 - integer, parameter, public :: num_bytes_for_i_llong = 8 - -! Define arrays for default definition - integer, parameter, private :: num_i_kinds = 4 - integer, parameter, dimension( num_i_kinds ), private :: integer_types = (/ & - i_byte, i_short, i_long, i_llong /) - integer, parameter, dimension( num_i_kinds ), private :: integer_byte_sizes = (/ & - num_bytes_for_i_byte, num_bytes_for_i_short, & - num_bytes_for_i_long, num_bytes_for_i_llong /) - -! Default values -! **** CHANGE THE FOLLOWING TO CHANGE THE DEFAULT INTEGER TYPE KIND *** - integer, parameter, private :: default_integer = 3 ! 1=byte, - ! 2=short, - ! 3=long, - ! 4=llong - integer, parameter, public :: i_kind = integer_types( default_integer ) - integer, parameter, public :: num_bytes_for_i_kind = & - integer_byte_sizes( default_integer ) - - -! Real definitions below - -! Real types - integer, parameter, public :: r_single = selected_real_kind(6) ! single precision - integer, parameter, public :: r_double = selected_real_kind(15) ! double precision - integer, parameter, private :: quad_t = selected_real_kind(20) ! quad precision - integer, parameter, public :: r_quad = max( quad_t, r_double ) - -! Expected 8-bit byte sizes of the real kinds - integer, parameter, public :: num_bytes_for_r_single = 4 - integer, parameter, public :: num_bytes_for_r_double = 8 - integer, parameter, public :: num_bytes_for_r_quad = 16 - -! Define arrays for default definition - integer, parameter, private :: num_r_kinds = 3 - integer, parameter, dimension( num_r_kinds ), private :: real_kinds = (/ & - r_single, r_double, r_quad /) - integer, parameter, dimension( num_r_kinds ), private :: real_byte_sizes = (/ & - num_bytes_for_r_single, num_bytes_for_r_double, & - num_bytes_for_r_quad /) - -! Default values -! **** CHANGE THE FOLLOWING TO CHANGE THE DEFAULT REAL TYPE KIND *** -#ifdef _REAL4_ - integer, parameter, private :: default_real = 1 ! 1=single, -#endif -#ifdef _REAL8_ - integer, parameter, private :: default_real = 2 ! 2=double, -#endif -#ifdef _REAL16_ - integer, parameter, private :: default_real = 3 ! 3=quad -#endif - integer, parameter, public :: r_kind = real_kinds( default_real ) - integer, parameter, public :: num_bytes_for_r_kind = & - real_byte_sizes( default_real ) - -end module kinds diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radbcoef.fd/makefile b/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radbcoef.fd/makefile deleted file mode 100755 index 732a36914c..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radbcoef.fd/makefile +++ /dev/null @@ -1,50 +0,0 @@ -# ***************************************************************** -# makefile.bcoef -# -# Make the radmon_bcoef executable. -# -# ***************************************************************** - -#BINDIR = ${dir_root}/exec -BINDIR = ../../exec - -LIBS = $(W3NCO_LIB4) - -OBJS = kinds.o read_diag.o bcoef.o create_ctl_bcoef.o - -# -# ***************************************************************** -# - -CMD = radmon_bcoef.x - -all: $(CMD) - -clean: - rm -f *.o - rm -f *.mod - rm -f radmon_bcoef - -check_prereqs: - $(CHECK_LIBS) $(LIBS) - -install: - cp -f $(CMD) $(BINDIR)/ - -debug: FFLAGS = $(D_FFLAGS) -debug: $(CMD) - -$(CMD): $(OBJS) - $(CF) $(FFLAGS) $(LDFLAGS) -o $(@) $(OBJS) $(LIBS) - -read_diag.o : read_diag.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -bcoef.o : bcoef.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -create_ctl_bcoef.o : create_ctl_bcoef.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -kinds.o : kinds.F90 - $(CF) $(FFLAGS) -c $(*).F90 diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radbcoef.fd/readme b/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radbcoef.fd/readme deleted file mode 100644 index a229412533..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radbcoef.fd/readme +++ /dev/null @@ -1,23 +0,0 @@ -Instructions for building radmon_bcoef executable. - - 1) Load the build module appropriate for your Machine: - i.) - WCOSS: - "module use -a ../../modulefiles/wcoss" - THEIA: - "module use -a ../../modulefiles/theia" - ii.) - "module load RadMonBuild" - - 2) Optional: verify all prerequisites are met by typing: - "make check_prereqs" - - 3) Build the executable by typing: - "make" - - 4) Move the executable to the ../../exec directory by typing: - "make install" - - 5) Unload the build module: - "module unload RadMonBuild" - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radbcor.fd/avgsdv.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radbcor.fd/avgsdv.f90 deleted file mode 100755 index 44d1103a97..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radbcor.fd/avgsdv.f90 +++ /dev/null @@ -1,31 +0,0 @@ -subroutine avgsdv(count,sum1,sum2,rmiss) - implicit none - real count,sum1,sum2,rmiss - real avg,sdv,rterm1,rterm2,svar - - if (count>0.) then - rterm1 = 1./count - avg = rterm1*sum1 - if (count>1.) then - rterm2 = 1./(count-1.) - svar = (count*sum2-sum1*sum1)*rterm1*rterm2 - if (svar>0.) then - sdv = sqrt(svar) - else - sdv = rmiss - endif - else - sdv = rmiss - endif - else - count = rmiss - avg = rmiss - sdv = rmiss - endif - - sum1=avg - sum2=sdv - - return -end subroutine avgsdv - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radbcor.fd/bcor.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radbcor.fd/bcor.f90 deleted file mode 100755 index 21641237d7..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radbcor.fd/bcor.f90 +++ /dev/null @@ -1,581 +0,0 @@ -!----------------------------------------------------------- -! bcor.f90 -! - -program bcor - use read_diag - use kinds, only : i_kind - - implicit none - integer ntype,mregion,surf_nregion,max_surf_region - parameter (ntype=30,mregion=25,max_surf_region=5) - integer iglobal, iland, iwater, isnowice, imixed - parameter( iglobal=1, iland=2, iwater=3, isnowice=4, imixed=5 ) - - character(10),dimension(ntype):: ftype - character(20) satname,stringd,satsis,mod_satname - character(10) dum,satype,dplat - character(80) string,data_file,ctl_file - character(500) diag_rad - character(40),dimension(max_surf_region):: region - character(10) suffix - - integer luname,lungrd,lunctl,lndiag - integer iyy,imm,idd,ihh,idhh,incr,iread,iflag - integer n_chan,j,idsat,i,k,ii,nsub - integer,dimension(mregion):: jsub - integer,allocatable,dimension(:):: io_chan,nu_chan - integer npred_radiag,angord - integer(i_kind) :: istatus - - real pen,rread - real weight,rlat,rlon,rmiss,obs,biascor,obsges,obsgesnbc,rterm - real,dimension(2):: cor_total,cor_fixang,cor_lapse,cor_lapse2,& - cor_const,cor_scangl,cor_clw,cor_cos_ssmis,cor_sin_ssmis,& - cor_emiss,cor_ordang4,cor_ordang3,cor_ordang2,cor_ordang1 - - real,dimension(max_surf_region):: rlatmin,rlatmax,rlonmin,rlonmax - - real,allocatable,dimension(:):: wavenumbr - real,allocatable,dimension(:,:):: count,error,use,frequency,penalty - real,allocatable,dimension(:,:,:):: total_cor,fixang_cor,lapse_cor,& - lapse2_cor,const_cor,scangl_cor,clw_cor,cos_ssmis_cor,sin_ssmis_cor,& - emiss_cor,ordang4_cor,ordang3_cor,ordang2_cor,ordang1_cor - - logical no_obs - -! Variables for reading satellite data - type(diag_header_fix_list ) :: header_fix - type(diag_header_chan_list),allocatable :: header_chan(:) - type(diag_data_name_list ) :: data_name - type(diag_data_fix_list ) :: data_fix - type(diag_data_chan_list ),allocatable :: data_chan(:) - type(diag_data_extra_list) ,allocatable :: data_extra(:,:) - - integer nsnow, nland, nwater, nice, nmixed, ntotal - integer nnsnow, nnland, nnwater, nnmixed, nntotal - -! Namelist with defaults - logical :: retrieval = .false. - integer :: nchanl = 19 - integer :: imkctl = 1 - integer :: imkdata = 1 - character(3) :: gesanl = 'ges' - integer :: little_endian = 1 - character(3) :: rad_area = 'glb' - logical :: netcdf = .false. - namelist /input/ satname,iyy,imm,idd,ihh,idhh,incr,nchanl,& - suffix,imkctl,imkdata,retrieval,gesanl,little_endian,rad_area,netcdf - - data luname,lungrd,lunctl,lndiag / 5, 51, 52, 21 / - data rmiss /-999./ - data stringd / '.%y4%m2%d2%h2' / - data ftype / 'count', 'penalty', & - 'avgtotal', 'avgfixang', 'avglapse', 'avglapse2', & - 'avgconst', 'avgscangl', 'avgclw', & - 'avgcos', 'avgsin', 'avgemiss', 'avgordang4', & - 'avgordang3', 'avgordang2', 'avgordang1', & - 'sdvtotal', 'sdvfixang', 'sdvlapse', 'sdvlapse2', & - 'sdvconst', 'sdvscangl', 'sdvclw', & - 'sdvcos', 'sdvsin', 'sdvemiss', 'sdvordang4',& - 'sdvordang3', 'sdvordang2', 'sdvordang1' / - data region / 'global', 'land', 'water', 'ice/snow', 'mixed'/ - data rlonmin / -180., -180., -180., -180., -180./ - data rlonmax / 180., 180., 180., 180., 180./ - data rlatmin / -90., -90., -90., -90., -90./ - data rlatmax / 90., 90., 90., 90., 90./ - - - -!************************************************************************ -! -! Initialize variables - iread=0 - npred_radiag = 12 - -! Read namelist input - read(luname,input) - write(6,input) - write(6,*)'gesanl = ', gesanl - write(6,*)'rad_area = ', rad_area - write(6,*)' ' - - surf_nregion = 5 - if ( trim(rad_area) == 'rgn' ) then - surf_nregion = 1 - endif - - write(6,*)'surf_nregion = ', surf_nregion - - -! Ensure number of requested regions does not exceed specified upper limit - if (surf_nregion>mregion) then - write(6,*)'***ERROR*** too many regions specified' - write(6,*)' maximum allowed: mregion=',mregion - write(6,*)' user requested: surf_nregion=',surf_nregion - call errexit(91) - endif - - -! Create filenames for diagnostic input, binary output file - write(stringd,100) iyy,imm,idd,ihh -100 format('.',i4.4,3i2.2) - - if ( trim(gesanl) == 'ges' ) then - diag_rad = trim(satname) - data_file= 'bcor.' // trim(satname) // trim(stringd) // '.ieee_d' - ctl_file = 'bcor.' // trim(satname) // '.ctl' - else - diag_rad = trim(satname) // '_anl' - data_file= 'bcor.' // trim(satname) // '_anl' // trim(stringd) // '.ieee_d' - ctl_file = 'bcor.' // trim(satname) // '_anl.ctl' - endif - - write(6,*)'diag_rad =',diag_rad - write(6,*)'data_file=',data_file - write(6,*)'ctl_file =',ctl_file - write(6,*)'suffix =',suffix - - -!! Open unit to diagnostic file. Read portion of header to -!! see if file exists -! open(lndiag,file=diag_rad,form='unformatted') -! read(lndiag,err=900,end=900) dum -! rewind lndiag - - !----------------------------------------------------- - ! Note: Ideally the open_radiag routine would - ! return an iret code indicating success or - ! failure of the attempt to open the diag file. - ! It's ok in this case, only because the calling - ! script only starts the executable if the - ! diag file is > 0 sized, and the calls to - ! actually read the data do support return codes. - ! Still, if time permits it would be useful to add - ! an iret value to open_radiag(). - ! - call set_netcdf_read( netcdf ) - call open_radiag( diag_rad, lndiag, istatus ) - -! File exists. Read header - write(6,*)'call read_diag_header' - call read_radiag_header( lndiag, npred_radiag, retrieval, header_fix,& - header_chan, data_name, iflag ) - if( iflag/=0 ) then - write(6,*)'***ERROR*** problem reading diag file header, iflag=',iflag - call errexit(91) - endif - -! Extract observation type, satellite id, and number of channels - satype = header_fix%obstype - satsis = header_fix%isis - dplat = header_fix%id - n_chan = header_fix%nchan - angord = header_fix%angord - - write(6,*)'satype,dplat,n_chan,angord=',satype,' ',dplat,n_chan,angord - - string = trim(satype)//'_'//trim(dplat) - write(6,*)'string,satname=',string,' ',satname - if ( trim(string) /= trim(satname) ) then - write(6,*)'***ERROR*** inconsistent instrument types' - write(6,*)' satname,string =',satname,' ',string - call errexit(92) - endif - - -! Allocate arrays to hold observational information - write(6,*)' ' - write(6,*)'allocate arrays' - allocate (io_chan(n_chan), nu_chan(n_chan), wavenumbr(n_chan)) - allocate (total_cor(n_chan,mregion,2), fixang_cor(n_chan,mregion,2), & - lapse_cor(n_chan,mregion,2), lapse2_cor(n_chan,mregion,2), & - const_cor(n_chan,mregion,2), scangl_cor(n_chan,mregion,2), & - clw_cor(n_chan,mregion,2), cos_ssmis_cor(n_chan,mregion,2), & - sin_ssmis_cor(n_chan,mregion,2), emiss_cor(n_chan,mregion,2), & - ordang4_cor(n_chan,mregion,2), ordang3_cor(n_chan,mregion,2), & - ordang2_cor(n_chan,mregion,2), ordang1_cor(n_chan,mregion,2), & - count(n_chan,mregion), penalty(n_chan,mregion), & - error(n_chan,mregion), use(n_chan,mregion), & - frequency(n_chan,mregion)) - -! Zero accumulator arrays - do ii=1,2 - do k=1,mregion - do j=1,n_chan - if (ii==1) then - count(j,k) = 0.0 - penalty(j,k) = 0.0 - endif - total_cor(j,k,ii) = 0.0 - fixang_cor(j,k,ii) = 0.0 - lapse_cor(j,k,ii) = 0.0 - lapse2_cor(j,k,ii) = 0.0 - const_cor(j,k,ii) = 0.0 - scangl_cor(j,k,ii) = 0.0 - clw_cor(j,k,ii) = 0.0 - cos_ssmis_cor(j,k,ii) = 0.0 - sin_ssmis_cor(j,k,ii) = 0.0 - emiss_cor(j,k,ii) = 0.0 - ordang4_cor(j,k,ii) = 0.0 - ordang3_cor(j,k,ii) = 0.0 - ordang2_cor(j,k,ii) = 0.0 - ordang1_cor(j,k,ii) = 0.0 - end do - end do - end do - - -! Extract satinfo relative index - do j=1,n_chan - nu_chan(j) = real( header_chan(j)%nuchan, 4 ) - io_chan(j) = real( header_chan(j)%iochan, 4 ) - wavenumbr(j) = real( header_chan(j)%wave, 4 ) - end do - do k=1,mregion - do j=1,n_chan - error(j,k) = real( header_chan(j)%varch, 4) - use(j,k) = real( header_chan(j)%iuse, 4 ) - frequency(j,k) = real( header_chan(j)%freq, 4) - end do - end do - - -! Create GrADS control file - if ( imkctl == 1 ) then - write(6,*)'call create_ctl_bcor' - - if ( trim(gesanl) == 'ges' ) then - mod_satname = trim(satname) - else - mod_satname = trim(satname) // '_anl' - endif - - - call create_ctl_bcor(ntype,ftype,n_chan,iyy,imm,idd,ihh,idhh,& - incr,ctl_file,lunctl,rmiss,mod_satname,satype,dplat,surf_nregion,& - region,rlonmin,rlonmax,rlatmin,rlatmax,nu_chan,use(1,1),error(1,1),& - frequency(1,1),wavenumbr,little_endian) - - endif - - nwater = 0; nnwater = 0 - nland = 0; nnland = 0 - nsnow = 0; nnsnow = 0 - nice = 0 - nmixed = 0; nnmixed = 0 - ntotal = 0 - -! Loop to read entries in diagnostic file - if ( imkdata == 1 ) then - iflag = 0 - loopd: do while (iflag == 0) - -! Read a record. If read flag, iflag does not equal zero, exit loopd - call read_radiag_data( lndiag, header_fix, retrieval, data_fix, data_chan,& - data_extra, iflag ) - if( iflag /= 0 ) exit loopd - iread=iread+1 - -! Extract obervation location and mpi weight. Convert (0-360) lon to (-180,180) - rlat = data_fix%lat - rlon = data_fix%lon - if (rlon>180.) rlon = rlon - 360. - rread = rread + 1.0 - - ntotal = ntotal + 1 - jsub(1)= iglobal - nsub = 1 - - if ( surf_nregion > 1 ) then - if ( data_fix%water_frac > 0.99 ) then - nwater = nwater + 1 - else if ( data_fix%land_frac > 0.99 ) then - nland = nland + 1 - else if ( data_fix%snow_frac > 0.99 ) then - nsnow = nsnow + 1 - else if ( data_fix%ice_frac > 0.99 ) then - nice = nice + 1 - else - nmixed = nmixed + 1 - end if - - - -! Detemine into which subdomains the observation falls. -! These are now based on surface type, not geography. All -! obs match global (surf_region 1). -! - ii=0; -!jsub=0; - if ( data_fix%land_frac > 0.99 ) then - jsub(2)=iland - nsub=2 - nnland=nnland+1 - else if ( data_fix%water_frac > 0.99 ) then - jsub(2)=iwater - nsub=2 - nnwater=nnwater+1 - else if (( data_fix%snow_frac > 0.99 ) .OR. ( data_fix%ice_frac > 0.99 )) then - jsub(2)=isnowice - nsub=2 - nnsnow=nnsnow+1 - else - jsub(2)=imixed - nsub=2 - nnmixed=nnmixed+1 - write(6,*)'data_fix%land_frac,water,snow,ice = ',data_fix%land_frac, data_fix%water_frac, data_fix%snow_frac, data_fix%ice_frac - end if - end if - - -! Channel loop - do j = 1, n_chan - -! If observation was assimilated, accumulate sums in appropriate regions - if (data_chan(j)%errinv > 1.e-6) then -! pen = data_chan(j)%errinv*(data_chan(j)%omgbc)**2 - pen = (data_chan(j)%errinv*(data_chan(j)%omgbc))**2 - cor_total(1) = (data_chan(j)%omgnbc - data_chan(j)%omgbc) - cor_fixang(1) = data_chan(j)%bifix(angord+1) - cor_lapse(1) = data_chan(j)%bilap - cor_lapse2(1) = data_chan(j)%bilap2 - cor_const(1) = data_chan(j)%bicons - cor_scangl(1) = data_chan(j)%biang - cor_clw(1) = data_chan(j)%biclw - cor_cos_ssmis(1) = data_chan(j)%bicos - cor_sin_ssmis(1) = data_chan(j)%bisin - cor_emiss(1) = data_chan(j)%biemis - if (angord >= 4 ) then - cor_ordang4(1) = data_chan(j)%bifix(1) - cor_ordang3(1) = data_chan(j)%bifix(2) - cor_ordang2(1) = data_chan(j)%bifix(3) - cor_ordang1(1) = data_chan(j)%bifix(4) - else - cor_ordang4(1) = 0.0 - cor_ordang3(1) = 0.0 - cor_ordang2(1) = 0.0 - cor_ordang1(1) = 0.0 - endif -! do i=1,angord -! cor_ordang4 -! write(string,'(i2.2)') header_fix%angord-i+1 -! data_name%chn(15+i)= 'bifix' // string -! end do - - - cor_total(2) = (data_chan(j)%omgnbc - data_chan(j)%omgbc)**2 - cor_fixang(2) = (data_chan(j)%bifix(angord+1))**2 - cor_lapse(2) = (data_chan(j)%bilap)**2 - cor_lapse2(2) = (data_chan(j)%bilap2)**2 - cor_const(2) = (data_chan(j)%bicons)**2 - cor_scangl(2) = (data_chan(j)%biang)**2 - cor_clw(2) = (data_chan(j)%biclw)**2 - cor_cos_ssmis(2) = data_chan(j)%bicos**2 - cor_sin_ssmis(2) = data_chan(j)%bisin**2 - cor_emiss(2) = data_chan(j)%biemis**2 - if (angord >= 4 ) then - cor_ordang4(1) = data_chan(j)%bifix(1)**2 - cor_ordang3(1) = data_chan(j)%bifix(2)**2 - cor_ordang2(1) = data_chan(j)%bifix(3)**2 - cor_ordang1(1) = data_chan(j)%bifix(4)**2 - else - cor_ordang4(2) = 0.0 - cor_ordang3(2) = 0.0 - cor_ordang2(2) = 0.0 - cor_ordang1(2) = 0.0 - end if - - do i=1,nsub - k=jsub(i) - count(j,k) = count(j,k) +1.0 - penalty(j,k) = penalty(j,k) + pen - - do ii=1,2 - total_cor(j,k,ii) = total_cor(j,k,ii) + cor_total(ii) - fixang_cor(j,k,ii) = fixang_cor(j,k,ii) + cor_fixang(ii) - lapse_cor(j,k,ii) = lapse_cor(j,k,ii) + cor_lapse(ii) - lapse2_cor(j,k,ii) = lapse2_cor(j,k,ii) + cor_lapse2(ii) - const_cor(j,k,ii) = const_cor(j,k,ii) + cor_const(ii) - scangl_cor(j,k,ii) = scangl_cor(j,k,ii) + cor_scangl(ii) - clw_cor(j,k,ii) = clw_cor(j,k,ii) + cor_clw(ii) - cos_ssmis_cor(j,k,ii) = cos_ssmis_cor(j,k,ii) + cor_cos_ssmis(ii) - sin_ssmis_cor(j,k,ii) = sin_ssmis_cor(j,k,ii) + cor_sin_ssmis(ii) - emiss_cor(j,k,ii) = emiss_cor(j,k,ii) + cor_emiss(ii) - ordang4_cor(j,k,ii) = ordang4_cor(j,k,ii) + cor_ordang4(ii) - ordang3_cor(j,k,ii) = ordang3_cor(j,k,ii) + cor_ordang3(ii) - ordang2_cor(j,k,ii) = ordang2_cor(j,k,ii) + cor_ordang2(ii) - ordang1_cor(j,k,ii) = ordang1_cor(j,k,ii) + cor_ordang1(ii) - end do - - end do - endif - - enddo ! channel loop - -! End of loop over diagnostic file - enddo loopd - close(lndiag) - write(6,*)' ' - write(6,*)'read in ',iread,' obs ',rread - write(6,*)' ' - - write(6,*)'nwater, nland, nice, nsnow, nmixed, ntotal = ', nwater, nland, nice, nsnow, nmixed, ntotal - nntotal=nnwater+nnland+nnsnow+nnmixed - write(6,*)'nnwater, nnland, nnsnow, nnmixed, nntotal = ', nnwater, nnland, nnsnow, nnmixed, nntotal - -! Compute average and standard deviation - do k=1,surf_nregion - do j=1,n_chan - call avgsdv(count(j,k),total_cor(j,k,1), total_cor(j,k,2), rmiss) - call avgsdv(count(j,k),fixang_cor(j,k,1), fixang_cor(j,k,2), rmiss) - call avgsdv(count(j,k),lapse_cor(j,k,1), lapse_cor(j,k,2), rmiss) - call avgsdv(count(j,k),lapse2_cor(j,k,1), lapse2_cor(j,k,2), rmiss) - call avgsdv(count(j,k),const_cor(j,k,1), const_cor(j,k,2), rmiss) - call avgsdv(count(j,k),scangl_cor(j,k,1), scangl_cor(j,k,2), rmiss) - call avgsdv(count(j,k),clw_cor(j,k,1), clw_cor(j,k,2), rmiss) - call avgsdv(count(j,k),cos_ssmis_cor(j,k,1), cos_ssmis_cor(j,k,2), rmiss) - call avgsdv(count(j,k),sin_ssmis_cor(j,k,1), sin_ssmis_cor(j,k,2), rmiss) - call avgsdv(count(j,k),emiss_cor(j,k,1), emiss_cor(j,k,2), rmiss) - call avgsdv(count(j,k),ordang4_cor(j,k,1), ordang4_cor(j,k,2), rmiss) - call avgsdv(count(j,k),ordang3_cor(j,k,1), ordang3_cor(j,k,2), rmiss) - call avgsdv(count(j,k),ordang2_cor(j,k,1), ordang2_cor(j,k,2), rmiss) - call avgsdv(count(j,k),ordang1_cor(j,k,1), ordang1_cor(j,k,2), rmiss) - - if (count(j,k)>0) then - penalty(j,k)=penalty(j,k)/count(j,k) - else - count(j,k)=rmiss - penalty(j,k)=rmiss - endif - end do - end do - -! Write output to binary output file - write(6,*)' ' - open(lungrd,file=data_file,form='unformatted') - write(lungrd) ((count(j,k),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((penalty(j,k),j=1,n_chan),k=1,surf_nregion) - do ii=1,2 - write(lungrd) ((total_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((fixang_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((lapse_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((lapse2_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((const_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((scangl_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((clw_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((cos_ssmis_cor(j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((sin_ssmis_cor(j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((emiss_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((ordang4_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((ordang3_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((ordang2_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((ordang1_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - end do - write(6,*)'write output to lungrd=',lungrd,', file=',trim(data_file) - close(lungrd) - endif - -! Deallocate arrays - write(6,*)' ' - write(6,*)'deallocate arrays' - if(allocated(io_chan)) deallocate (io_chan) - if(allocated(nu_chan)) deallocate (nu_chan) - if(allocated(wavenumbr)) deallocate (wavenumbr) - if(allocated(total_cor)) deallocate (total_cor) - if(allocated(fixang_cor)) deallocate (fixang_cor) - if(allocated(lapse_cor)) deallocate (lapse_cor) - if(allocated(lapse2_cor)) deallocate (lapse2_cor) - if(allocated(const_cor)) deallocate (const_cor) - if(allocated(scangl_cor)) deallocate (scangl_cor) - if(allocated(clw_cor)) deallocate (clw_cor) - if(allocated(cos_ssmis_cor)) deallocate (cos_ssmis_cor) - if(allocated(sin_ssmis_cor)) deallocate (sin_ssmis_cor) - if(allocated(emiss_cor)) deallocate (emiss_cor) - if(allocated(ordang4_cor)) deallocate (ordang4_cor) - if(allocated(ordang3_cor)) deallocate (ordang3_cor) - if(allocated(ordang2_cor)) deallocate (ordang2_cor) - if(allocated(ordang1_cor)) deallocate (ordang1_cor) - if(allocated(count)) deallocate (count) - if(allocated(penalty)) deallocate (penalty) - if(allocated(error)) deallocate (error) - if(allocated(use)) deallocate (use) - if(allocated(frequency)) deallocate (frequency) - - -! deallocate(io_chan,nu_chan,wavenumbr,total_cor,fixang_cor,lapse_cor,& -! lapse2_cor,const_cor,scangl_cor,clw_cor,count,penalty,error,use,& -! frequency) - - write(6,*)'deallocated arrays' - goto 950 - -! Jump to here if eof or error reading diagnostic file. -900 continue - write(6,*)'***PROBLEM reading diagnostic file. diag_rad=',diag_rad - close(lndiag) - - n_chan=nchanl - if (n_chan<=0) then - write(6,*)'***ERROR*** invalid nchanl=',nchanl,' STOP program' - call errexit(93) - endif - - write(6,*)'load missing value ',rmiss,' into output arrays. ',& - surf_nregion,n_chan - allocate(count(n_chan,surf_nregion),penalty(n_chan,surf_nregion)) - allocate(total_cor(n_chan,mregion,2), fixang_cor(n_chan,mregion,2), & - lapse_cor(n_chan,mregion,2), lapse2_cor(n_chan,mregion,2), & - const_cor(n_chan,mregion,2), scangl_cor(n_chan,mregion,2), & - clw_cor(n_chan,mregion,2)) - - write(6,*)'load missing value ',rmiss,' into output arrays' - do ii=1,2 - do k=1,surf_nregion - do j=1,n_chan - if (ii==1) then - count(j,k) =rmiss - penalty(j,k)=rmiss - endif - total_cor(j,k,ii) =rmiss - fixang_cor(j,k,ii)=rmiss - lapse_cor(j,k,ii) =rmiss - lapse2_cor(j,k,ii)=rmiss - const_cor(j,k,ii) =rmiss - scangl_cor(j,k,ii)=rmiss - clw_cor(j,k,ii) =rmiss - end do - end do - end do - - if ( imkdata == 1 ) then - open(lungrd,file=data_file,form='unformatted') - write(lungrd) ((count(j,k),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((penalty(j,k),j=1,n_chan),k=1,surf_nregion) - do ii=1,2 - write(lungrd) ((total_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((fixang_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((lapse_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((lapse2_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((const_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((scangl_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((clw_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((cos_ssmis_cor(j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((sin_ssmis_cor(j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((emiss_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((ordang4_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((ordang3_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((ordang2_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - write(lungrd) ((ordang1_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) - end do - write(6,*)'write output to lungrd=',lungrd,', file=',trim(data_file) - close(lungrd) - endif - deallocate(count,penalty,total_cor,fixang_cor,lapse_cor,lapse2_cor,& - const_cor,scangl_cor,clw_cor) - -! End of program -950 continue - write(6,*) 'exiting program bcor' - stop -end program bcor diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radbcor.fd/create_ctl_bcor.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radbcor.fd/create_ctl_bcor.f90 deleted file mode 100755 index 53ed20e9f9..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radbcor.fd/create_ctl_bcor.f90 +++ /dev/null @@ -1,163 +0,0 @@ -subroutine create_ctl_bcor(ntype,ftype,n_chan,iyy,imm,idd,ihh,idhh,& - incr,ctl_file,lunctl,rmiss,satname,satype,dplat,nregion,& - region,rlonmin,rlonmax,rlatmin,rlatmax,nu_chan,use,error,& - frequency,wavenumbr,little_endian) - - implicit none - - integer ntype - - character(2) cword - character(3),dimension(12):: mon - character(3):: clatmin,clatmax - character(4):: clonmin,clonmax - character(10),dimension(ntype):: ftype - character(13) stringd - character(20) satname - character(10) satype,dplat - character(40) ctl_file,grad_file - character(80) string - character(40),dimension(nregion):: region - character(80),dimension(nregion):: stringr - - integer idsat,nregion,iuse,little_endian - integer lunctl,iyy,imm,idd,ihh,j,i,n_chan,idhh,incr - integer iyy2,imm2,idd2,ihh2,ntime - integer,dimension(8):: ida,jda - integer,dimension(n_chan):: nu_chan - - real rmiss,wavelength - real,dimension(5):: fha - real,dimension(n_chan):: error,use,frequency,wavenumbr - real,dimension(nregion):: rlonmin,rlonmax,rlatmin,rlatmax - - data stringd / '.%y4%m2%d2%h2' / - data mon / 'jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', & - 'aug', 'sep', 'oct', 'nov', 'dec' / - -!************************************************************************** -! Create date for tdef based on given date and hour offset - fha=0.0; ida=0; jda=0; ntime=0 - iyy2=iyy; imm2=imm; idd2=idd; ihh2=ihh - if (idhh/=0) then - ntime = abs(idhh)/incr - fha(2)=idhh - ida(1)=iyy - ida(2)=imm - ida(3)=idd - ida(4)=0 - ida(5)=ihh - call w3movdat(fha,ida,jda) - iyy2=jda(1) - imm2=jda(2) - idd2=jda(3) - ihh2=jda(5) - endif - ntime=ntime+1 - -! Open unit to GrADS control file - open(lunctl,file=ctl_file,form='formatted') - -!******************************************************************* -! Construct the region strings if this is for a global source, -! which is defined as nregion > 1. -! - if (nregion > 1) then - - do i=1,nregion - if (rlatmin(i)>0.) then - write(clatmin,10) int(rlatmin(i)) - else - write(clatmin,20) abs(int(rlatmin(i))) - endif - if (rlatmax(i)>0.) then - write(clatmax,10) int(rlatmax(i)) - else - write(clatmax,20) abs(int(rlatmax(i))) - endif - if (rlonmin(i)>0.) then - write(clonmin,30) int(rlonmin(i)) - else - write(clonmin,40) abs(int(rlonmin(i))) - endif - if (rlonmax(i)>0.) then - write(clonmax,30) int(rlonmax(i)) - else - write(clonmax,40) abs(int(rlonmax(i))) - endif - stringr(i) = trim(region(i)) // ' (' // & - trim(clonmin) // '-' // trim(clonmax) // ', ' // & - trim(clatmin) // '-' // trim(clatmax) // ')' - end do - endif -10 format(i2,'N') -20 format(i2,'S') -30 format(i3,'E') -40 format(i3,'W') - -! Write header information - grad_file = trim(satname) // stringd // '.ieee_d' - write(lunctl,100) grad_file - if ( little_endian == 1 ) then - write(lunctl,112) - else - write(lunctl,110) - endif - write(lunctl,120) rmiss - write(lunctl,130) adjustl(satype),dplat,n_chan - write(lunctl,132) - do i=1,n_chan - iuse = nint(use(i)) - wavelength = 10000./wavenumbr(i) - write(lunctl,134) i,nu_chan(i),iuse,error(i),wavelength,frequency(i) - end do - write(lunctl,136) - - if (nregion > 1) then - do i=1,nregion - write(cword,'(i2)') i - string = '* region=' // cword // ' ' // trim(stringr(i)) - write(lunctl,138) string - end do - endif - - write(lunctl,140) n_chan - write(lunctl,150) nregion - write(lunctl,160) - write(lunctl,170) ntime,ihh2,idd2,mon(imm2),iyy2,incr - write(lunctl,180) ntype - -100 format('dset ^',a40) -110 format('options template big_endian sequential') -112 format('options template little_endian sequential') -120 format('undef ',f5.0) -130 format('title ',a10,1x,a10,1x,i4) -132 format('*XDEF is channel number') -134 format('* x= ',i4,', channel= ',i4,' , iuse= ',i2,' , error= ',f8.3,& - ' , wlth= ',f9.2,' , freq= ',f9.2) -136 format('*YDEF is geographic region') -138 format(a80) -140 format('xdef ',i4,' linear 1.0 1.0') -150 format('ydef ',i2,' linear 1.0 1.0') -160 format('zdef 1 linear 1.0 1.0') -170 format('tdef ',i4,' linear ',i2.2,'Z',i2.2,a3,i4.4,' ',i2.2,'hr') -180 format('vars ',i7) - -! Write data portion of GraDS control file - do i=1,ntype - string = trim(ftype(i)) - write(lunctl,190) adjustl(string),trim(ftype(i)) -190 format(a10,' 0 0 ',a10) - end do - -! Write trminating "endvars" record - write(lunctl,200) -200 format('endvars') - - -! Close ctl file - close(lunctl) - -! Return - return -end subroutine create_ctl_bcor diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radbcor.fd/kinds.F90 b/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radbcor.fd/kinds.F90 deleted file mode 100644 index 8b3a2fcc4e..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radbcor.fd/kinds.F90 +++ /dev/null @@ -1,112 +0,0 @@ -module kinds -!$$$ module documentation block -! . . . . -! module: kinds -! prgmmr: treadon org: np23 date: 2004-08-15 -! -! abstract: Module to hold specification kinds for variable declaration. -! This module is based on (copied from) Paul vanDelst's -! type_kinds module found in the community radiative transfer -! model -! -! module history log: -! 2004-08-15 treadon -! 2011-07-04 todling - define main precision during compilation -! -! Subroutines Included: -! -! Functions Included: -! -! remarks: -! The numerical data types defined in this module are: -! i_byte - specification kind for byte (1-byte) integer variable -! i_short - specification kind for short (2-byte) integer variable -! i_long - specification kind for long (4-byte) integer variable -! i_llong - specification kind for double long (8-byte) integer variable -! r_single - specification kind for single precision (4-byte) real variable -! r_double - specification kind for double precision (8-byte) real variable -! r_quad - specification kind for quad precision (16-byte) real variable -! -! i_kind - generic specification kind for default integer -! r_kind - generic specification kind for default floating point -! -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ end documentation block - implicit none - private - -! Integer type definitions below - -! Integer types - integer, parameter, public :: i_byte = selected_int_kind(1) ! byte integer - integer, parameter, public :: i_short = selected_int_kind(4) ! short integer - integer, parameter, public :: i_long = selected_int_kind(8) ! long integer - integer, parameter, private :: llong_t = selected_int_kind(16) ! llong integer - integer, parameter, public :: i_llong = max( llong_t, i_long ) - -! Expected 8-bit byte sizes of the integer kinds - integer, parameter, public :: num_bytes_for_i_byte = 1 - integer, parameter, public :: num_bytes_for_i_short = 2 - integer, parameter, public :: num_bytes_for_i_long = 4 - integer, parameter, public :: num_bytes_for_i_llong = 8 - -! Define arrays for default definition - integer, parameter, private :: num_i_kinds = 4 - integer, parameter, dimension( num_i_kinds ), private :: integer_types = (/ & - i_byte, i_short, i_long, i_llong /) - integer, parameter, dimension( num_i_kinds ), private :: integer_byte_sizes = (/ & - num_bytes_for_i_byte, num_bytes_for_i_short, & - num_bytes_for_i_long, num_bytes_for_i_llong /) - -! Default values -! **** CHANGE THE FOLLOWING TO CHANGE THE DEFAULT INTEGER TYPE KIND *** - integer, parameter, private :: default_integer = 3 ! 1=byte, - ! 2=short, - ! 3=long, - ! 4=llong - integer, parameter, public :: i_kind = integer_types( default_integer ) - integer, parameter, public :: num_bytes_for_i_kind = & - integer_byte_sizes( default_integer ) - - -! Real definitions below - -! Real types - integer, parameter, public :: r_single = selected_real_kind(6) ! single precision - integer, parameter, public :: r_double = selected_real_kind(15) ! double precision - integer, parameter, private :: quad_t = selected_real_kind(20) ! quad precision - integer, parameter, public :: r_quad = max( quad_t, r_double ) - -! Expected 8-bit byte sizes of the real kinds - integer, parameter, public :: num_bytes_for_r_single = 4 - integer, parameter, public :: num_bytes_for_r_double = 8 - integer, parameter, public :: num_bytes_for_r_quad = 16 - -! Define arrays for default definition - integer, parameter, private :: num_r_kinds = 3 - integer, parameter, dimension( num_r_kinds ), private :: real_kinds = (/ & - r_single, r_double, r_quad /) - integer, parameter, dimension( num_r_kinds ), private :: real_byte_sizes = (/ & - num_bytes_for_r_single, num_bytes_for_r_double, & - num_bytes_for_r_quad /) - -! Default values -! **** CHANGE THE FOLLOWING TO CHANGE THE DEFAULT REAL TYPE KIND *** -#ifdef _REAL4_ - integer, parameter, private :: default_real = 1 ! 1=single, -#endif -#ifdef _REAL8_ - integer, parameter, private :: default_real = 2 ! 2=double, -#endif -#ifdef _REAL16_ - integer, parameter, private :: default_real = 3 ! 3=quad -#endif - integer, parameter, public :: r_kind = real_kinds( default_real ) - integer, parameter, public :: num_bytes_for_r_kind = & - real_byte_sizes( default_real ) - -end module kinds diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radbcor.fd/makefile b/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radbcor.fd/makefile deleted file mode 100755 index 343cf9ccd2..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radbcor.fd/makefile +++ /dev/null @@ -1,53 +0,0 @@ -# ***************************************************************** -# makefile.bcor -# -# Make the radmon_bcor executable. -# -# ***************************************************************** - -#BINDIR = ${dir_root}/exec -BINDIR = ../../exec - -LIBS = $(W3NCO_LIB4) - -OBJS = kinds.o read_diag.o bcor.o avgsdv.o create_ctl_bcor.o - -# -# ***************************************************************** -# - -CMD = radmon_bcor.x - -all: $(CMD) - -clean: - rm -f *.o - rm -f *.mod - rm -f radmon_bcor - -check_prereqs: - $(CHECK_LIBS) $(LIBS) - -install: - cp -f $(CMD) $(BINDIR)/ - -debug: FFLAGS = $(D_FFLAGS) -debug: $(CMD) - -$(CMD): $(OBJS) - $(CF) $(FFLAGS) $(LDFLAGS) -o $(@) $(OBJS) $(LIBS) - -read_diag.o : read_diag.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -bcor.o : bcor.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -avgsdv.o : avgsdv.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -create_ctl_bcor.o : create_ctl_bcor.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -kinds.o : kinds.F90 - $(CF) $(FFLAGS) -c $(*).F90 diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radbcor.fd/readme b/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radbcor.fd/readme deleted file mode 100644 index 6957c66f6f..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radbcor.fd/readme +++ /dev/null @@ -1,23 +0,0 @@ -Instructions for building radmon_bcor executable. - - 1) Load the build module appropriate for your Machine: - i.) - WCOSS: - "module use -a ../../modulefiles/wcoss" - THEIA: - "module use -a ../../modulefiles/theia" - ii.) - "module load RadMonBuild" - - 2) Optional: verify all prerequisites are met by typing: - "make check_prereqs" - - 3) Build the executable by typing: - "make" - - 4) Move the executable to the ../../exec directory by typing: - "make install" - - 5) Unload the build module: - "module unload RadMonBuild" - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radtime.fd/bad_chan.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radtime.fd/bad_chan.f90 deleted file mode 100644 index eaac10cff6..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radtime.fd/bad_chan.f90 +++ /dev/null @@ -1,94 +0,0 @@ -!$$$ subprogram documentation block -! . . . -! subprogram: bad_chan build bad_chan.txt file -! prgmmr: safford date: 2009-11 -! -! abstract: This module contains code to build the bad_chan.txt file. -! The bad_chan.txt file reports the satellite and channel for -! which zero obs were found on a channel that is set for use -! and normally has data. -! -! program history log: -! 2009-12-22 safford - initial coding -! -! contains: -! -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ - -module bad_chan - - implicit none - - private - - public :: open_bad_chan_file - public :: write_bad_chan - public :: close_bad_chan_file - - integer, parameter :: funit = 14 - - contains - - - !------------------------------------------------------------- - ! create the bad_chan file - !------------------------------------------------------------- - - subroutine open_bad_chan_file( date, cycle, fios ) - - !--- interface - character(8), intent( in ) :: date - character(8), intent( in ) :: cycle - integer, intent( out ) :: fios - - !--- variables - logical :: lexist = .FALSE. - character(60) :: fname - - -! write(*,*) '--> open_bad_chan_file, date, cycle = ', date, cycle - !--- build the file name - fname = 'bad_chan.' // trim(date) // trim(cycle) - - write(*,*) ' fname = ', fname - - !--- open file and write the header - inquire(file=fname, exist=lexist) - if( lexist .eqv. .FALSE. ) then - write(6,*) ' opening new bad_chan file' - open( UNIT=funit, FILE=fname, STATUS='NEW', IOSTAT=fios ) - else - write(6,*) ' opening existing bad_chan.txt file' - open( UNIT=funit, FILE=fname, STATUS='OLD', POSITION='APPEND', IOSTAT=fios ) - end if - - end subroutine open_bad_chan_file - - - subroutine write_bad_chan( satname, channel ) - - !--- interface - character(20), intent( in ) :: satname - integer, intent( in ) :: channel - - !--- variables - real :: count - - write(6,*) 'write_bad_chan, satname, channel', satname, channel - - write(funit,*) satname, 'channel= ', channel - - end subroutine write_bad_chan - - - subroutine close_bad_chan_file( ) -! write(6,*) '--> close_bad_chan_file' - close( funit ) - end subroutine close_bad_chan_file - -end module bad_chan diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radtime.fd/bad_penalty.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radtime.fd/bad_penalty.f90 deleted file mode 100644 index 55c822c7e8..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radtime.fd/bad_penalty.f90 +++ /dev/null @@ -1,100 +0,0 @@ -!$$$ subprogram documentation block -! . . . -! subprogram: penalty build penalty.txt file -! prgmmr: safford date: 2009-11 -! -! abstract: This module contains code to build the penalty.txt file. -! The penalty.txt file reports the satellite and channel for -! which a penalty value is likely out of range. -! -! program history log: -! 2009-11-23 safford - initial coding -! -! contains: -! -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ - -module bad_penalty - - implicit none - - private - - public :: open_bad_penalty_file - public :: write_bad_penalty - public :: close_bad_penalty_file - - integer, parameter :: funit = 11 - - contains - - - !------------------------------------------------------------- - ! open the bad_pen file - !------------------------------------------------------------- - - subroutine open_bad_penalty_file( date, cycle, fios ) - - !--- interface - character(8), intent( in ) :: date - character(8), intent( in ) :: cycle - integer, intent( out ) :: fios - - !--- variables - logical :: lexist = .FALSE. - character(60) :: fname - -! write(*,*) '--> open_bad_penalty_file, date, cycle = ', date, cycle - - !--- build the file name - fname= 'bad_pen.' // trim(date) // trim(cycle) - write(*,*) ' fname = ', fname - - !--- open file and write the header - inquire(file=fname, exist=lexist) - if( lexist .eqv. .FALSE. ) then - write(*,*) ' opening new bad_pen file' - open( UNIT=funit, FILE=fname, STATUS='NEW', IOSTAT=fios ) - else - write(*,*) ' opening existing bad_penalty.txt file' - open( UNIT=funit, FILE=fname, STATUS='OLD', POSITION='APPEND', IOSTAT=fios ) - end if - - end subroutine open_bad_penalty_file - - - !------------------------------------------------------------- - ! add an entry to the bad_penalty.txt file - !------------------------------------------------------------- - subroutine write_bad_penalty( satname, channel, region, penalty, bound ) - - !--- interface - character(20), intent( in ) :: satname - integer, intent( in ) :: channel - integer, intent( in ) :: region - real, intent( in ) :: penalty - real, intent( in ) :: bound - character(60) :: myformat - - myformat = "(A20,A10,I5,A9,I1,A10,ES15.7E2,A8,ES15.7E2)" - - - write(funit,myformat) satname, ' channel= ',channel, ' region= ', region, ' penalty= ', penalty, ' bound= ', bound - - end subroutine write_bad_penalty - - - !------------------------------------------------------------- - ! close the bad_penalty.txt file - !------------------------------------------------------------- - subroutine close_bad_penalty_file( ) -! write(*,*) '--> close_bad_penalty_file' - close( funit ) - end subroutine close_bad_penalty_file - -end module bad_penalty diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radtime.fd/create_ctl_time.f90 b/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radtime.fd/create_ctl_time.f90 deleted file mode 100755 index 46279a476a..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radtime.fd/create_ctl_time.f90 +++ /dev/null @@ -1,162 +0,0 @@ -subroutine create_ctl_time(ntype,ftype,n_chan,iyy,imm,idd,ihh,idhh,& - incr,ctl_file,lunctl,rmiss,satname,satype,dplat,nregion,& - region,rlonmin,rlonmax,rlatmin,rlatmax,nu_chan,use,error,& - frequency,wavenumbr,little_endian) - - implicit none - - integer ntype - - character(2) cword - character(3),dimension(12):: mon - character(3):: clatmin,clatmax - character(4):: clonmin,clonmax - character(10),dimension(ntype):: ftype - character(13) stringd - character(20) satname,satsis - character(10) satype,dplat - character(40) ctl_file,grad_file - character(80) string - character(40),dimension(nregion):: region - character(80),dimension(nregion):: stringr - - integer idsat,nregion,iuse,little_endian - integer lunctl,iyy,imm,idd,ihh,j,i,n_chan,idhh,incr - integer iyy2,imm2,idd2,ihh2,ntime - integer,dimension(8):: ida,jda - integer,dimension(n_chan):: nu_chan - - real rmiss,wavelength - real,dimension(5):: fha - real,dimension(n_chan):: error,use,frequency,wavenumbr - real,dimension(nregion):: rlonmin,rlonmax,rlatmin,rlatmax - - data stringd / '.%y4%m2%d2%h2' / - data mon / 'jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', & - 'aug', 'sep', 'oct', 'nov', 'dec' / - -!************************************************************************** -! Create date for tdef based on given date and hour offset - fha=0.0; ida=0; jda=0; ntime=0 - iyy2=iyy; imm2=imm; idd2=idd; ihh2=ihh - if (idhh/=0) then - ntime = abs(idhh)/incr - fha(2)=idhh - ida(1)=iyy - ida(2)=imm - ida(3)=idd - ida(4)=0 - ida(5)=ihh - call w3movdat(fha,ida,jda) - iyy2=jda(1) - imm2=jda(2) - idd2=jda(3) - ihh2=jda(5) - endif - ntime=ntime+1 - -! Open unit to GrADS control file - open(lunctl,file=ctl_file,form='formatted') - -!******************************************************************* -! Construct the region strings if this is for a global source, -! which is defined as nregion > 1. -! - if (nregion > 1) then - do i=1,nregion - if (rlatmin(i)>0.) then - write(clatmin,10) int(rlatmin(i)) - else - write(clatmin,20) abs(int(rlatmin(i))) - endif - if (rlatmax(i)>0.) then - write(clatmax,10) int(rlatmax(i)) - else - write(clatmax,20) abs(int(rlatmax(i))) - endif - if (rlonmin(i)>0.) then - write(clonmin,30) int(rlonmin(i)) - else - write(clonmin,40) abs(int(rlonmin(i))) - endif - if (rlonmax(i)>0.) then - write(clonmax,30) int(rlonmax(i)) - else - write(clonmax,40) abs(int(rlonmax(i))) - endif - stringr(i) = trim(region(i)) // ' (' // & - trim(clonmin) // '-' // trim(clonmax) // ', ' // & - trim(clatmin) // '-' // trim(clatmax) // ')' - end do - endif -10 format(i2,'N') -20 format(i2,'S') -30 format(i3,'E') -40 format(i3,'W') - -! Write header information - grad_file = trim(satname) // stringd // '.ieee_d' - write(lunctl,100) grad_file - if ( little_endian == 1 ) then - write(lunctl,112) - else - write(lunctl,110) - endif - write(lunctl,120) rmiss - write(lunctl,130) adjustl(satype),dplat,n_chan - write(lunctl,132) - do i=1,n_chan - iuse = nint(use(i)) - wavelength = 10000./wavenumbr(i) - write(lunctl,134) i,nu_chan(i),iuse,error(i),wavelength,frequency(i) - end do - write(lunctl,136) - - if (nregion > 1) then - do i=1,nregion - write(cword,'(i2)') i - string = '* region=' // cword // ' ' // trim(stringr(i)) - write(lunctl,138) string - end do - endif - - write(lunctl,140) n_chan - write(lunctl,150) nregion - write(lunctl,160) - write(lunctl,170) ntime,ihh2,idd2,mon(imm2),iyy2,incr - write(lunctl,180) ntype - -100 format('dset ^',a40) -110 format('options template big_endian sequential') -112 format('options template little_endian sequential') -120 format('undef ',f5.0) -130 format('title ',a10,1x,a10,1x,i4) -132 format('*XDEF is channel number') -134 format('* x= ',i4,', channel= ',i4,' , iuse= ',i2,' , error= ',f8.3,& - ' , wlth= ',f9.2,' , freq= ',f9.2) -136 format('*YDEF is geographic region') -138 format(a80) -140 format('xdef ',i4,' linear 1.0 1.0') -150 format('ydef ',i2,' linear 1.0 1.0') -160 format('zdef 1 linear 1.0 1.0') -170 format('tdef ',i4,' linear ',i2.2,'Z',i2.2,a3,i4.4,' ',i2.2,'hr') -180 format('vars ',i7) - -! Write data portion of GraDS control file - do i=1,ntype - string = trim(ftype(i)) - write(lunctl,190) adjustl(string),trim(ftype(i)) -190 format(a10,' 0 0 ',a10) - end do - -! Write trminating "endvars" record - write(lunctl,200) -200 format('endvars') - - -! Close ctl file - close(lunctl) - -! Return - return -end subroutine create_ctl_time diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radtime.fd/kinds.F90 b/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radtime.fd/kinds.F90 deleted file mode 100644 index 8b3a2fcc4e..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radtime.fd/kinds.F90 +++ /dev/null @@ -1,112 +0,0 @@ -module kinds -!$$$ module documentation block -! . . . . -! module: kinds -! prgmmr: treadon org: np23 date: 2004-08-15 -! -! abstract: Module to hold specification kinds for variable declaration. -! This module is based on (copied from) Paul vanDelst's -! type_kinds module found in the community radiative transfer -! model -! -! module history log: -! 2004-08-15 treadon -! 2011-07-04 todling - define main precision during compilation -! -! Subroutines Included: -! -! Functions Included: -! -! remarks: -! The numerical data types defined in this module are: -! i_byte - specification kind for byte (1-byte) integer variable -! i_short - specification kind for short (2-byte) integer variable -! i_long - specification kind for long (4-byte) integer variable -! i_llong - specification kind for double long (8-byte) integer variable -! r_single - specification kind for single precision (4-byte) real variable -! r_double - specification kind for double precision (8-byte) real variable -! r_quad - specification kind for quad precision (16-byte) real variable -! -! i_kind - generic specification kind for default integer -! r_kind - generic specification kind for default floating point -! -! -! attributes: -! language: f90 -! machine: ibm RS/6000 SP -! -!$$$ end documentation block - implicit none - private - -! Integer type definitions below - -! Integer types - integer, parameter, public :: i_byte = selected_int_kind(1) ! byte integer - integer, parameter, public :: i_short = selected_int_kind(4) ! short integer - integer, parameter, public :: i_long = selected_int_kind(8) ! long integer - integer, parameter, private :: llong_t = selected_int_kind(16) ! llong integer - integer, parameter, public :: i_llong = max( llong_t, i_long ) - -! Expected 8-bit byte sizes of the integer kinds - integer, parameter, public :: num_bytes_for_i_byte = 1 - integer, parameter, public :: num_bytes_for_i_short = 2 - integer, parameter, public :: num_bytes_for_i_long = 4 - integer, parameter, public :: num_bytes_for_i_llong = 8 - -! Define arrays for default definition - integer, parameter, private :: num_i_kinds = 4 - integer, parameter, dimension( num_i_kinds ), private :: integer_types = (/ & - i_byte, i_short, i_long, i_llong /) - integer, parameter, dimension( num_i_kinds ), private :: integer_byte_sizes = (/ & - num_bytes_for_i_byte, num_bytes_for_i_short, & - num_bytes_for_i_long, num_bytes_for_i_llong /) - -! Default values -! **** CHANGE THE FOLLOWING TO CHANGE THE DEFAULT INTEGER TYPE KIND *** - integer, parameter, private :: default_integer = 3 ! 1=byte, - ! 2=short, - ! 3=long, - ! 4=llong - integer, parameter, public :: i_kind = integer_types( default_integer ) - integer, parameter, public :: num_bytes_for_i_kind = & - integer_byte_sizes( default_integer ) - - -! Real definitions below - -! Real types - integer, parameter, public :: r_single = selected_real_kind(6) ! single precision - integer, parameter, public :: r_double = selected_real_kind(15) ! double precision - integer, parameter, private :: quad_t = selected_real_kind(20) ! quad precision - integer, parameter, public :: r_quad = max( quad_t, r_double ) - -! Expected 8-bit byte sizes of the real kinds - integer, parameter, public :: num_bytes_for_r_single = 4 - integer, parameter, public :: num_bytes_for_r_double = 8 - integer, parameter, public :: num_bytes_for_r_quad = 16 - -! Define arrays for default definition - integer, parameter, private :: num_r_kinds = 3 - integer, parameter, dimension( num_r_kinds ), private :: real_kinds = (/ & - r_single, r_double, r_quad /) - integer, parameter, dimension( num_r_kinds ), private :: real_byte_sizes = (/ & - num_bytes_for_r_single, num_bytes_for_r_double, & - num_bytes_for_r_quad /) - -! Default values -! **** CHANGE THE FOLLOWING TO CHANGE THE DEFAULT REAL TYPE KIND *** -#ifdef _REAL4_ - integer, parameter, private :: default_real = 1 ! 1=single, -#endif -#ifdef _REAL8_ - integer, parameter, private :: default_real = 2 ! 2=double, -#endif -#ifdef _REAL16_ - integer, parameter, private :: default_real = 3 ! 3=quad -#endif - integer, parameter, public :: r_kind = real_kinds( default_real ) - integer, parameter, public :: num_bytes_for_r_kind = & - real_byte_sizes( default_real ) - -end module kinds diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radtime.fd/makefile b/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radtime.fd/makefile deleted file mode 100755 index 1e917fb058..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radtime.fd/makefile +++ /dev/null @@ -1,63 +0,0 @@ -# ***************************************************************** -# makefile -# -# Make the radmon_time executable. -# -# ***************************************************************** - -#BINDIR = $(dir_root)/exec -BINDIR = ../../exec - -LIBS = $(W3NCO_LIB4) - -OBJS = kinds.o read_diag.o bad_obs.o bad_penalty.o bad_chan.o valid.o \ - time.o create_ctl_time.o - -# -# ***************************************************************** -# - -CMD = radmon_time.x - -all: $(CMD) - -clean: - rm -f *.o - rm -f *.mod - rm -f radmon_time - -check_prereqs: - $(CHECK_LIBS) $(LIBS) - -install: - cp -f $(CMD) $(BINDIR)/ - -debug: FFLAGS = $(D_FFLAGS) -debug: $(CMD) - -$(CMD): $(OBJS) - $(CF) $(FFLAGS) $(LDFLAGS) -o $(@) $(OBJS) $(LIBS) - -read_diag.o : read_diag.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -bad_obs.o : bad_obs.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -bad_penalty.o : bad_penalty.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -bad_chan.o : bad_chan.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -valid.o : valid.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -time.o : time.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -create_ctl_time.o : create_ctl_time.f90 - $(CF) $(FFLAGS) -c $(*).f90 - -kinds.o : kinds.F90 - $(CF) $(FFLAGS) -c $(*).F90 diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radtime.fd/readme b/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radtime.fd/readme deleted file mode 100644 index b6fdcbaf0e..0000000000 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radtime.fd/readme +++ /dev/null @@ -1,23 +0,0 @@ -Instructions for building radmon_time executable. - - 1) Load the build module appropriate for your Machine: - i.) - WCOSS: - "module use -a ../../modulefiles/wcoss" - THEIA: - "module use -a ../../modulefiles/theia" - ii.) - "module load RadMonBuild" - - 2) Optional: verify all prerequisites are met by typing: - "make check_prereqs" - - 3) Build the executable by typing: - "make" - - 4) Move the executable to the ../../exec directory by typing: - "make install" - - 5) Unload the build module: - "module unload RadMonBuild" - diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/exec/.gitignore b/util/Radiance_Monitor/nwprod/radmon_shared/exec/.gitignore similarity index 100% rename from util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/exec/.gitignore rename to util/Radiance_Monitor/nwprod/radmon_shared/exec/.gitignore diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/modulefiles/cray/RadMonBuild b/util/Radiance_Monitor/nwprod/radmon_shared/modulefiles/cray/RadMonBuild similarity index 100% rename from util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/modulefiles/cray/RadMonBuild rename to util/Radiance_Monitor/nwprod/radmon_shared/modulefiles/cray/RadMonBuild diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/modulefiles/theia/RadMonBuild b/util/Radiance_Monitor/nwprod/radmon_shared/modulefiles/theia/RadMonBuild similarity index 100% rename from util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/modulefiles/theia/RadMonBuild rename to util/Radiance_Monitor/nwprod/radmon_shared/modulefiles/theia/RadMonBuild diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radang.fd/CMakeLists.txt b/util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radang.fd/CMakeLists.txt similarity index 86% rename from util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radang.fd/CMakeLists.txt rename to util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radang.fd/CMakeLists.txt index b60da32a7d..19aba63061 100644 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radang.fd/CMakeLists.txt +++ b/util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radang.fd/CMakeLists.txt @@ -7,7 +7,7 @@ cmake_minimum_required(VERSION 2.6) set_target_properties( radmon_angle.x PROPERTIES COMPILE_FLAGS ${RADMON_ANGLE_Fortran_FLAGS} ) set_target_properties( radmon_angle.x PROPERTIES Fortran_MODULE_DIRECTORY ${Util_MODULE_DIR} ) include_directories( ${CORE_INCS} ${NCDIAG_INCS} ) - target_link_libraries( radmon_angle.x ${W3NCO_4_LIBRARY} ${NCDIAG_LIBRARIES} ${NETCDF_LIBRARIES_F90} ${NETCDF_LIBRARIES} ${HDF5_Fortran_HL_LIBRARIES} ${HDF5_LIBRARIES} ${MPI_Fortran_LIBRARIES} ) + target_link_libraries( radmon_angle.x ${W3NCO_4_LIBRARY} ${NCDIAG_LIBRARIES} ${NETCDF_Fortran_LIBRARIES} ${NETCDF_C_LIBRARIES} ${MPI_Fortran_LIBRARIES} ) if(BUILD_W3NCO) add_dependencies( radmon_angle.x ${W3NCO_4_LIBRARY} ) endif() diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radang.fd/angle_bias.f90 b/util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radang.fd/angle_bias.f90 similarity index 71% rename from util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radang.fd/angle_bias.f90 rename to util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radang.fd/angle_bias.f90 index 1755994495..1f62294187 100755 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radang.fd/angle_bias.f90 +++ b/util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radang.fd/angle_bias.f90 @@ -3,35 +3,34 @@ program angle use kinds, only: i_kind implicit none + integer ntype,mregion,mstep,surf_nregion,max_surf_region parameter (ntype=35,mregion=25,mstep=150,max_surf_region=5) integer iglobal, iland, iwater, isnowice, imixed parameter (iglobal=1, iland=2, iwater=3, isnowice=4, imixed=5) character(10),dimension(ntype):: ftype - character(8) stid character(20) satname,stringd character(10) satype,dplat - character(20) dum,satsis,satscan_sis + character(20) satsis,satscan_sis character(80) string,data_file,dfile,ctl_file character(500) diag_rad character(40),dimension(max_surf_region):: surf_region character(8) date,suffix,cycle - character(len=1024) :: command integer luname,lungrd,lndiag,lunang,lunctl integer iyy,imm,idd,ihh,idhh,incr,iread,iflag,ipos integer n_chan,j,i,k,ii,nsub,jiter,jj integer,dimension(mregion):: jsub integer,allocatable,dimension(:):: io_chan,nu_chan - integer imatch, npred_radiag, angord + integer npred_radiag, angord integer(i_kind) :: istatus real start,step integer nstep,iscan character(1) cflg real rang,pen - real weight,rlat,rlon,rmiss,obs,biascor,obsges,obsgesnbc,rterm,rread + real weight,rlat,rlon,rmiss,obs,biascor,obsges,obsgesnbc,rread real,dimension(2):: cor_tot,nbc_omg,bc_omg real,dimension(2):: cor_fixang,cor_lapse,cor_lapse2,cor_const,cor_scangl,cor_clw real,dimension(2):: cor_cos,cor_sin,cor_emiss @@ -61,14 +60,12 @@ program angle ! Namelist with defaults logical :: retrieval = .false. integer :: nchanl = 19 - integer :: imkctl = 1 - integer :: imkdata = 1 character(3) :: gesanl = 'ges' integer :: little_endian = 1 character(3) :: rad_area = 'glb' logical :: netcdf = .false. namelist /input/ satname,iyy,imm,idd,ihh,idhh,incr,nchanl,& - suffix,imkctl,imkdata,retrieval,gesanl,little_endian,& + suffix,retrieval,gesanl,little_endian,& rad_area,netcdf data luname,lungrd,lunctl,lndiag,iscan / 5, 51, 52, 21, 31 / @@ -148,8 +145,6 @@ program angle write(6,*)'data_file=',data_file write(6,*)'suffix =',suffix write(6,*)'ctl_file =',ctl_file - write(6,*)'imkctl =',imkctl - write(6,*)'imkdata =',imkdata write(6,*)'little_endian =', little_endian @@ -208,7 +203,6 @@ program angle if( iflag /= 0 ) exit if(trim(satname) == trim(satscan_sis)) exit enddo -!1000 format(a1,a20,2f10.2,i10) 1000 format(a1,a20,2f10.3,i10) write(6,*) 'satscan_sis,start,step,nstep=',satscan_sis,start,step,nstep @@ -283,7 +277,6 @@ program angle error(j) = real( header_chan(j)%varch, 4) use(j) = real( header_chan(j)%iuse, 4 ) frequency(j) = real( header_chan(j)%freq, 4) -! print *,nu_chan(j),io_chan(j),wavenumbr(j),error(j),use(j),frequency(j) end do @@ -300,7 +293,6 @@ program angle iflag = 0 loopd: do while (iflag == 0) -! write(6,*) ' top of do loop, reading record' ! Read a record. If read flag, iflag does not equal zero, exit loopd call read_radiag_data( lndiag, header_fix, retrieval, data_fix, data_chan,& @@ -386,15 +378,12 @@ program angle cor_ordang1 = 0.0 if (data_chan(j)%errinv > 1.e-6) then -! pen = data_chan(j)%errinv*(data_chan(j)%omgbc)**2 pen = (data_chan(j)%errinv*(data_chan(j)%omgbc))**2 - cor_tot(1) = (data_chan(j)%omgnbc - data_chan(j)%omgbc) nbc_omg(1) = - (data_chan(j)%omgnbc) bc_omg(1) = - (data_chan(j)%omgbc) - if ( trim(rad_area) == 'rgn' ) then write(6,*) 'chan,pen,cor_tot(1),nbc_omg(1),bc_omb(1) = ', j,pen,cor_tot(1),nbc_omg(1),bc_omg(1) endif @@ -495,226 +484,112 @@ program angle ! Create Control file - if ( imkctl == 1 ) then - write(6,*)'call create_ctl_angle' - if ( trim(gesanl) == 'ges' ) then - dfile = trim(satname) - else - dfile = trim(satname) // '_anl' - endif - - call create_ctl_angle(ntype,ftype,n_chan,iyy,imm,idd,ihh,incr,& + write(6,*)'call create_ctl_angle' + if ( trim(gesanl) == 'ges' ) then + dfile = trim(satname) + else + dfile = trim(satname) // '_anl' + endif + + call create_ctl_angle(ntype,ftype,n_chan,iyy,imm,idd,ihh,incr,& ctl_file,lunctl,rmiss,dfile,satype,dplat,surf_nregion,& surf_region,surf_rlonmin,surf_rlonmax,surf_rlatmin,surf_rlatmax,& nu_chan,use, error, frequency,wavenumbr,nstep,start,step, little_endian) - else - write(6,*) 'imkctl =',imkctl - endif ! Write output to data file - if ( imkdata == 1 ) then - write(6,*)' ' - open(lungrd,file=data_file,form='unformatted') - write(lungrd) ((timang(i,j),i=1,nstep),j=1,n_chan) + write(6,*)' ' + open(lungrd,file=data_file,form='unformatted') + write(lungrd) ((timang(i,j),i=1,nstep),j=1,n_chan) + do k=1,surf_nregion + write(lungrd) ((count(i,j,k),i=1,nstep),j=1,n_chan) + end do + do k=1,surf_nregion + write(lungrd) ((penalty(i,j,k),i=1,nstep),j=1,n_chan) + end do + do ii=1,2 do k=1,surf_nregion - write(lungrd) ((count(i,j,k),i=1,nstep),j=1,n_chan) + write(lungrd)((omg_nbc(i,j,k,ii),i=1,nstep),j=1,n_chan) end do do k=1,surf_nregion - write(lungrd) ((penalty(i,j,k),i=1,nstep),j=1,n_chan) + write(lungrd)((tot_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) end do - do ii=1,2 - do k=1,surf_nregion - write(lungrd)((omg_nbc(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((tot_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((omg_bc(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((fixang_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((lapse_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((lapse2_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((const_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((scangl_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((clw_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((cos_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((sin_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((emiss_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((ordang4_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((ordang3_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((ordang2_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((ordang1_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do + do k=1,surf_nregion + write(lungrd)((omg_bc(i,j,k,ii),i=1,nstep),j=1,n_chan) end do - write(6,*)'write output to lungrd=',lungrd,', file=',trim(data_file) - close(lungrd) - else - write(6,*) 'imkctl =',imkctl - endif - - -! Deallocate arrays - write(6,*)' ' - write(6,*)'deallocate arrays' - deallocate(penalty,io_chan,nu_chan,wavenumbr,error,use,frequency) - deallocate(timang,tot_cor,omg_nbc,omg_bc,count) - goto 950 - - -! Jump to here if eof or error reading diagnostic file. -900 continue - write(6,*)'***PROBLEM reading diagnostic file. diag_rad=',diag_rad - close(lndiag) - - n_chan=nchanl - if (n_chan<=0) then - write(6,*)'***ERROR*** invalid nchanl=',nchanl,' STOP program' - call errexit(93) - endif - - allocate(timang(mstep,n_chan)) - allocate(count(mstep,n_chan,surf_nregion),& - penalty(mstep,n_chan,surf_nregion),& - omg_nbc(mstep,n_chan,surf_nregion,2),& - tot_cor(mstep,n_chan,surf_nregion,2),& - omg_bc(mstep,n_chan,surf_nregion,2)) - -! -! Initialze all output variables to rmiss -! -! - do j=1,n_chan - do i=1,mstep - timang(i,j) = rmiss + do k=1,surf_nregion + write(lungrd)((fixang_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) end do - end do - - write(6,*)'load missing value ',rmiss,' into output arrays. ',& - nstep,surf_nregion,n_chan - do ii=1,2 do k=1,surf_nregion - do j=1,n_chan - do i=1,mstep - if (ii==1) then - count(i,j,k) = rmiss - penalty(i,j,k)= rmiss - endif - omg_nbc(i,j,k,ii) = rmiss - tot_cor(i,j,k,ii) = rmiss - omg_bc(i,j,k,ii) = rmiss - fixang_cor(i,j,k,ii) = rmiss - lapse_cor(i,j,k,ii) = rmiss - lapse2_cor(i,j,k,ii) = rmiss - clw_cor(i,j,k,ii) = rmiss - const_cor(i,j,k,ii) = rmiss - scangl_cor(i,j,k,ii) = rmiss - cos_cor(i,j,k,ii) = rmiss - sin_cor(i,j,k,ii) = rmiss - emiss_cor(i,j,k,ii) = rmiss - ordang4_cor(i,j,k,ii) = rmiss - ordang3_cor(i,j,k,ii) = rmiss - ordang2_cor(i,j,k,ii) = rmiss - ordang1_cor(i,j,k,ii) = rmiss - end do - end do + write(lungrd)((lapse_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) end do - end do - - if ( imkdata == 1 ) then - open(lungrd,file=data_file,form='unformatted') - write(lungrd) ((timang(i,j),i=1,nstep),j=1,n_chan) do k=1,surf_nregion - write(lungrd) ((count(i,j,k),i=1,nstep),j=1,n_chan) + write(lungrd)((lapse2_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) end do do k=1,surf_nregion - write(lungrd) ((penalty(i,j,k),i=1,nstep),j=1,n_chan) + write(lungrd)((const_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) end do - do ii=1,2 - do k=1,surf_nregion - write(lungrd)((omg_nbc(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((tot_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((omg_bc(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((fixang_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((lapse_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((lapse2_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((const_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((scangl_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((clw_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((cos_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((sin_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((emiss_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((ordang4_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((ordang3_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((ordang2_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do - do k=1,surf_nregion - write(lungrd)((ordang1_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) - end do + do k=1,surf_nregion + write(lungrd)((scangl_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) end do - write(6,*)'write output to lungrd=',lungrd,', file=',trim(data_file) - close(lungrd) - endif - write(6,*) '....deallocating arrays' - deallocate(timang,count,penalty,omg_nbc,omg_bc,tot_cor,& - fixang_cor,lapse_cor,lapse2_cor,const_cor,scangl_cor,clw_cor) - deallocate(cos_cor,sin_cor,emiss_cor,ordang1_cor,ordang2_cor,ordang3_cor,ordang4_cor) + do k=1,surf_nregion + write(lungrd)((clw_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) + end do + do k=1,surf_nregion + write(lungrd)((cos_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) + end do + do k=1,surf_nregion + write(lungrd)((sin_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) + end do + do k=1,surf_nregion + write(lungrd)((emiss_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) + end do + do k=1,surf_nregion + write(lungrd)((ordang4_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) + end do + do k=1,surf_nregion + write(lungrd)((ordang3_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) + end do + do k=1,surf_nregion + write(lungrd)((ordang2_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) + end do + do k=1,surf_nregion + write(lungrd)((ordang1_cor(i,j,k,ii),i=1,nstep),j=1,n_chan) + end do + end do + write(6,*)'write output to lungrd=',lungrd,', file=',trim(data_file) + close(lungrd) + + +! Deallocate arrays + write(6,*)' ' + write(6,*)'deallocate arrays' + + if(allocated(penalty)) deallocate (penalty) + if(allocated(io_chan)) deallocate (io_chan) + if(allocated(nu_chan)) deallocate (nu_chan) + if(allocated(wavenumbr)) deallocate (wavenumbr) + if(allocated(error)) deallocate (error) + if(allocated(use)) deallocate (use) + if(allocated(frequency)) deallocate (frequency) + if(allocated(timang)) deallocate (timang) + if(allocated(tot_cor)) deallocate (tot_cor) + if(allocated(omg_nbc)) deallocate (omg_nbc) + if(allocated(omg_bc)) deallocate (omg_bc) + if(allocated(count)) deallocate (count) + if(allocated(fixang_cor)) deallocate (fixang_cor) + if(allocated(lapse_cor)) deallocate (lapse_cor) + if(allocated(lapse2_cor)) deallocate (lapse2_cor) + if(allocated(const_cor)) deallocate (const_cor) + if(allocated(scangl_cor)) deallocate (scangl_cor) + if(allocated(clw_cor)) deallocate (clw_cor) + if(allocated(cos_cor)) deallocate (cos_cor) + if(allocated(sin_cor)) deallocate (sin_cor) + if(allocated(emiss_cor)) deallocate (emiss_cor) + if(allocated(ordang1_cor)) deallocate (ordang1_cor) + if(allocated(ordang2_cor)) deallocate (ordang2_cor) + if(allocated(ordang3_cor)) deallocate (ordang3_cor) + if(allocated(ordang4_cor)) deallocate (ordang4_cor) -! End of program -950 continue stop end program angle diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radang.fd/create_ctl_angle.f90 b/util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radang.fd/create_ctl_angle.f90 similarity index 83% rename from util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radang.fd/create_ctl_angle.f90 rename to util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radang.fd/create_ctl_angle.f90 index ecd6e64727..415bb00a02 100755 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radang.fd/create_ctl_angle.f90 +++ b/util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radang.fd/create_ctl_angle.f90 @@ -5,32 +5,36 @@ subroutine create_ctl_angle(ntype,ftype,n_chan,iyy,imm,idd,ihh,incr,& implicit none - integer ntype + integer, intent(in) :: ntype,n_chan,iyy,imm,idd,ihh,incr + character(10),dimension(ntype),intent(in) :: ftype + character(40),intent(in) :: ctl_file + integer, intent(in) :: lunctl, nregion,nstep,little_endian + real, intent(in) :: rmiss + character(20),intent(in) :: satname + character(10),intent(in) :: satype,dplat + character(40),dimension(nregion),intent(in) :: region + real,dimension(nregion), intent(in) :: rlonmin,rlonmax,rlatmin,rlatmax + integer,dimension(n_chan), intent(in) :: nu_chan + real,dimension(n_chan), intent(in) :: error,use,frequency,wavenumbr + real, intent(in) :: start,step + character(2) cword character(3),dimension(12):: mon character(3):: clatmin,clatmax character(4):: clonmin,clonmax - character(10),dimension(ntype):: ftype character(13) stringd - character(20) satname - character(10) satype,dplat - character(40) ctl_file,grad_file + character(40) grad_file character(80) string - character(40),dimension(nregion):: region character(80),dimension(nregion):: stringr - integer nregion,iuse,klev,nstep - integer lunctl,iyy,imm,idd,ihh,j,i,n_chan,idhh,incr + integer iuse,klev + integer j,i,idhh integer iyy2,imm2,idd2,ihh2,ntime integer, dimension(8):: ida,jda - integer,dimension(n_chan):: nu_chan - integer little_endian - real rmiss,wavelength,start,step + real wavelength real,dimension(5):: fha - real,dimension(n_chan):: error,use,frequency,wavenumbr - real,dimension(nregion):: rlonmin,rlonmax,rlatmin,rlatmax data stringd / '.%y4%m2%d2%h2' / data mon / 'jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', & @@ -44,7 +48,6 @@ subroutine create_ctl_angle(ntype,ftype,n_chan,iyy,imm,idd,ihh,incr,& ! Create date for tdef based on given date and hour offset idhh=-720 ! this is 30 days back in hours. -! incr=6 ! cycle interval fha=0.0; ida=0; jda=0; ntime=0 iyy2=iyy; imm2=imm; idd2=idd; ihh2=ihh diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radbcoef.fd/kinds.F90 b/util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radang.fd/kinds.F90 similarity index 100% rename from util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radbcoef.fd/kinds.F90 rename to util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radang.fd/kinds.F90 diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radbcoef.fd/read_diag.f90 b/util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radang.fd/read_diag.f90 similarity index 96% rename from util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radbcoef.fd/read_diag.f90 rename to util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radang.fd/read_diag.f90 index 93ccabe4ca..6fd698ab99 100755 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radbcoef.fd/read_diag.f90 +++ b/util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radang.fd/read_diag.f90 @@ -64,11 +64,6 @@ module read_diag public :: iversion_radiag_5 public :: ireal_old_radiag public :: set_netcdf_read -! public :: iversion_radiag -! public :: iversion_radiag_1 -! public :: iversion_radiag_2 -! public :: iversion_radiag_3 -! public :: iversion_radiag_4 public :: ireal_radiag public :: ipchan_radiag public :: set_radiag @@ -102,7 +97,7 @@ module read_diag integer(i_kind) :: angord ! order of polynomial for adp_anglebc option integer(i_kind) :: iversion ! radiance diagnostic file version number integer(i_kind) :: inewpc ! indicator of newpc4pred (1 on, 0 off) - integer(i_kind) :: ijacob ! indicates whether jacobian included (1 yes, 0 no) + integer(i_kind) :: ijacob ! indicates whether jacobian included (1 yes, 0 no) integer(i_kind) :: isens ! sensitivity index end type diag_header_fix_list @@ -267,8 +262,8 @@ subroutine open_radiag(filename, ftin, istatus) if (nopen_ncdiag >= MAX_OPEN_NCDIAG) then write(6,*) 'OPEN_RADIAG: ***ERROR*** Cannot open more than ', & MAX_OPEN_NCDIAG, ' netcdf diag files.' -! call stop2(456) endif + call nc_diag_read_init(filename,ftin) istatus=0 do i = 1, MAX_OPEN_NCDIAG @@ -308,8 +303,8 @@ subroutine close_radiag(filename, ftin) if (id < 0) then write(6,*) 'CLOSE_RADIAG: ***ERROR*** ncdiag file ', filename, & ' was not opened' -! call stop2(456) endif + call nc_diag_read_close(filename) ncdiag_open_id(id) = -1 ncdiag_open_status(id)%nc_read = .false. @@ -361,14 +356,14 @@ subroutine read_radiag_header(ftin,npred_radiag,retrieval,header_fix,header_chan !$$$ ! Declare passed arguments - integer(i_kind),intent(in) :: ftin - integer(i_kind),intent(in) :: npred_radiag - logical,intent(in) :: retrieval - type(diag_header_fix_list ),intent(out):: header_fix + integer(i_kind),intent(in) :: ftin + integer(i_kind),intent(in) :: npred_radiag + logical,intent(in) :: retrieval + type(diag_header_fix_list ),intent(out) :: header_fix type(diag_header_chan_list),allocatable :: header_chan(:) - type(diag_data_name_list) :: data_name - integer(i_kind),intent(out) :: iflag - logical,optional,intent(in) :: lverbose + type(diag_data_name_list) :: data_name + integer(i_kind),intent(out) :: iflag + logical,optional,intent(in) :: lverbose iflag = 0 if (netcdf) then @@ -379,6 +374,7 @@ subroutine read_radiag_header(ftin,npred_radiag,retrieval,header_fix,header_chan end subroutine read_radiag_header + subroutine read_radiag_header_nc(ftin,header_fix,header_chan,iflag) ! . . . . ! subprogram: read_diag_header_nc read rad diag header @@ -404,25 +400,24 @@ subroutine read_radiag_header_nc(ftin,header_fix,header_chan,iflag) ! !$$$ ! Declare passed arguments - integer(i_kind),intent(in) :: ftin - type(diag_header_fix_list ),intent(out):: header_fix + integer(i_kind),intent(in) :: ftin + type(diag_header_fix_list ),intent(out) :: header_fix type(diag_header_chan_list),allocatable :: header_chan(:) - integer(i_kind),intent(out) :: iflag + integer(i_kind),intent(out) :: iflag ! local variables - integer(i_kind) :: nchan_dim - real(r_kind),allocatable,dimension(:) :: r_var_stor - integer(i_kind),allocatable,dimension(:) :: i_var_stor - character(20) :: isis - character(10) :: id, obstype + integer(i_kind) :: nchan_dim + real(r_kind),allocatable,dimension(:) :: r_var_stor + integer(i_kind),allocatable,dimension(:) :: i_var_stor + character(20) :: isis + character(10) :: id, obstype ! integer(i_kind),dimension(:),allocatable :: jiter, nchan_diag, npred, idate, & - integer(i_kind) :: jiter, nchan_diag, npred, idate, & - ireal, ipchan, iextra, jextra, & - idiag, angord, iversion, inewpc, & - isens, ijacob + integer(i_kind) :: jiter, nchan_diag, npred, idate, & + ireal, ipchan, iextra, jextra, & + idiag, angord, iversion, inewpc, & + isens, ijacob iflag = 0 -! allocate(nchan_diag(1) ) nchan_dim = nc_diag_read_get_dim(ftin,'nchans') header_fix%nchan = nchan_dim @@ -430,7 +425,6 @@ subroutine read_radiag_header_nc(ftin,header_fix,header_chan,iflag) if (nchan_dim /= nchan_diag) then write(*,*)'ERROR: Number of channels from dimension do not match those from header, aborting.' -! call stop2(321) endif call nc_diag_read_get_global_attr(ftin, "Satellite_Sensor", isis) ; header_fix%isis = isis @@ -458,7 +452,6 @@ subroutine read_radiag_header_nc(ftin,header_fix,header_chan,iflag) if (allocated(i_var_stor)) deallocate(i_var_stor) allocate(r_var_stor(nchan_dim), & i_var_stor(nchan_dim) ) -! call nc_diag_read_get_var('Var', var_stor) call nc_diag_read_get_var(ftin, 'frequency',r_var_stor) ; header_chan%freq = r_var_stor call nc_diag_read_get_var(ftin, 'polarization',i_var_stor) ; header_chan%polar = i_var_stor call nc_diag_read_get_var(ftin, 'wavenumber',r_var_stor) ; header_chan%wave = r_var_stor @@ -468,9 +461,9 @@ subroutine read_radiag_header_nc(ftin,header_fix,header_chan,iflag) call nc_diag_read_get_var(ftin, 'sensor_chan',i_var_stor) ; header_chan%nuchan = i_var_stor call nc_diag_read_get_var(ftin, 'satinfo_chan',i_var_stor) ; header_chan%iochan = i_var_stor - end subroutine read_radiag_header_nc + subroutine read_radiag_header_bin(ftin,npred_radiag,retrieval,header_fix,header_chan,data_name,iflag,lverbose) ! . . . . ! subprogram: read_diag_header_bin read rad diag header @@ -504,14 +497,14 @@ subroutine read_radiag_header_bin(ftin,npred_radiag,retrieval,header_fix,header_ !$$$ ! Declare passed arguments - integer(i_kind),intent(in) :: ftin - integer(i_kind),intent(in) :: npred_radiag - logical,intent(in) :: retrieval - type(diag_header_fix_list ),intent(out):: header_fix + integer(i_kind),intent(in) :: ftin + integer(i_kind),intent(in) :: npred_radiag + logical,intent(in) :: retrieval + type(diag_header_fix_list ),intent(out) :: header_fix type(diag_header_chan_list),allocatable :: header_chan(:) - type(diag_data_name_list) :: data_name - integer(i_kind),intent(out) :: iflag - logical,optional,intent(in) :: lverbose + type(diag_data_name_list) :: data_name + integer(i_kind),intent(out) :: iflag + logical,optional,intent(in) :: lverbose ! Declare local variables character(len=2):: string @@ -722,9 +715,9 @@ subroutine read_radiag_header_bin(ftin,npred_radiag,retrieval,header_fix,header_ ! Construct array containing menonics for data record entries - end subroutine read_radiag_header_bin + integer(i_kind) function find_ncdiag_id(ftin) integer(i_kind), intent(in) :: ftin @@ -741,6 +734,7 @@ integer(i_kind) function find_ncdiag_id(ftin) end function find_ncdiag_id + subroutine read_radiag_data(ftin,header_fix,retrieval,data_fix,data_chan,data_extra,iflag ) ! . . . . ! subprogram: read_radiag_dat read rad diag data @@ -772,13 +766,13 @@ subroutine read_radiag_data(ftin,header_fix,retrieval,data_fix,data_chan,data_ex ! Declare passed arguments - integer(i_kind),intent(in) :: ftin - type(diag_header_fix_list ),intent(in) :: header_fix - logical,intent(in) :: retrieval - type(diag_data_fix_list) ,intent(out):: data_fix + integer(i_kind),intent(in) :: ftin + type(diag_header_fix_list ),intent(in) :: header_fix + logical,intent(in) :: retrieval + type(diag_data_fix_list) ,intent(out) :: data_fix type(diag_data_chan_list) ,allocatable :: data_chan(:) type(diag_data_extra_list) ,allocatable :: data_extra(:,:) - integer(i_kind),intent(out) :: iflag + integer(i_kind),intent(out) :: iflag integer(i_kind) :: id @@ -817,6 +811,8 @@ subroutine read_radiag_data(ftin,header_fix,retrieval,data_fix,data_chan,data_ex end subroutine read_radiag_data + + subroutine read_radiag_data_nc_init(ftin, diag_status, header_fix, retrieval, iflag) ! . . . . ! subprogram: read_radiag_data_nc_init read rad diag data @@ -997,10 +993,6 @@ subroutine read_radiag_data_nc_init(ftin, diag_status, header_fix, retrieval, if endif cdatum = 1 -! allocate( all_data_fix(nrecord) ) -! allocate( all_data_chan(nrecord, nchan)) - - do ir=1,nrecord clat = Latitude(cdatum) clon = Longitude(cdatum) @@ -1122,9 +1114,10 @@ subroutine read_radiag_data_nc_init(ftin, diag_status, header_fix, retrieval, if deallocate(Observation_Operator_Jacobian) endif - end subroutine read_radiag_data_nc_init + + subroutine read_radiag_data_nc(diag_status,header_fix,data_fix,data_chan,data_extra,iflag ) ! . . . . ! subprogram: read_radiag_dat read rad diag data @@ -1171,6 +1164,8 @@ subroutine read_radiag_data_nc(diag_status,header_fix,data_fix,data_chan,data_ex end subroutine read_radiag_data_nc + + subroutine read_radiag_data_bin(ftin,header_fix,retrieval,data_fix,data_chan,data_extra,iflag ) ! . . . . ! subprogram: read_radiag_dat read rad diag data @@ -1420,5 +1415,6 @@ subroutine read_radiag_data_bin(ftin,header_fix,retrieval,data_fix,data_chan,dat end subroutine read_radiag_data_bin + end module read_diag diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radang.fd/sparsearr.f90 b/util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radang.fd/sparsearr.f90 similarity index 100% rename from util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radang.fd/sparsearr.f90 rename to util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radang.fd/sparsearr.f90 diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radbcoef.fd/CMakeLists.txt b/util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radbcoef.fd/CMakeLists.txt similarity index 86% rename from util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radbcoef.fd/CMakeLists.txt rename to util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radbcoef.fd/CMakeLists.txt index 4a94749272..5068244458 100644 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radbcoef.fd/CMakeLists.txt +++ b/util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radbcoef.fd/CMakeLists.txt @@ -7,7 +7,7 @@ cmake_minimum_required(VERSION 2.6) set_target_properties( radmon_bcoef.x PROPERTIES COMPILE_FLAGS ${RADMON_BCOEF_Fortran_FLAGS} ) set_target_properties( radmon_bcoef.x PROPERTIES Fortran_MODULE_DIRECTORY ${Util_MODULE_DIR} ) include_directories( ${CORE_INCS} ${NCDIAG_INCS} ) - target_link_libraries( radmon_bcoef.x ${W3NCO_4_LIBRARY} ${NCDIAG_LIBRARIES} ${NETCDF_LIBRARIES_F90} ${NETCDF_LIBRARIES} ${HDF5_Fortran_HL_LIBRARIES} ${HDF5_LIBRARIES} ${MPI_Fortran_LIBRARIES} ) + target_link_libraries( radmon_bcoef.x ${W3NCO_4_LIBRARY} ${NCDIAG_LIBRARIES} ${NETCDF_Fortran_LIBRARIES} ${NETCDF_C_LIBRARIES} ${MPI_Fortran_LIBRARIES}) if(BUILD_W3NCO) add_dependencies( radmon_bcoef.x ${W3NCO_4_LIBRARY} ) endif() diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radbcoef.fd/bcoef.f90 b/util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radbcoef.fd/bcoef.f90 similarity index 82% rename from util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radbcoef.fd/bcoef.f90 rename to util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radbcoef.fd/bcoef.f90 index 3f61852cbc..8c348f1ebf 100755 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radbcoef.fd/bcoef.f90 +++ b/util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radbcoef.fd/bcoef.f90 @@ -1,4 +1,5 @@ program bcoef + use read_diag use kinds, only: r_kind,i_kind,r_quad @@ -41,13 +42,11 @@ program bcoef integer :: npredr = 12 logical :: retrieval = .false. integer :: nchanl = 19 - integer :: imkctl = 1 - integer :: imkdata = 1 character(3) :: gesanl ='ges' integer :: little_endian = 1 logical :: netcdf = .false. namelist /input/ satname,npredr,nchanl,iyy,imm,idd,ihh,idhh,& - incr,suffix,imkctl,imkdata,retrieval,gesanl,little_endian,netcdf + incr,suffix,retrieval,gesanl,little_endian,netcdf data luname,lungrd,lunctl / 5, 51, 52 / data lncoef,lndiag / 21, 22 / @@ -145,13 +144,6 @@ program bcoef call set_netcdf_read( netcdf ) call open_radiag( diag_rad, lndiag, istatus ) -!! Open unit to diagnostic file. Read portion of header to -!! see if file exists -! open(lndiag,file=diag_rad,form='unformatted') -! read(lndiag,err=900,end=900) dum -! rewind lndiag - -! File exists. Read header write(6,*)'call read_diag_header' call read_radiag_header( lndiag, npred_radiag, retrieval, header_fix,& header_chan, data_name, iflag ) @@ -262,9 +254,6 @@ program bcoef 120 format(I5,1x,A20,1x,I5,10f12.6) 122 format(I5,1x,A20,1x,I5,2e15.6,1x,I5/2(4x,10f12.6/)) -!read(lunin,'(I5,1x,A20,1x,I5,2e15.6,1x,I5/2(4x,10f12.6/))',iostat=istat,end=1333) -!ich,isis,& ichan,tlapm,tsum,ntlapupdate,(predr(ip),ip=1,npred), where npred=12 - ! Read coefficient file allocate(predr(npredr)) i=0 @@ -294,74 +283,31 @@ program bcoef deallocate(predr) ! Create Control file - if ( imkctl == 1 ) then - write(6,*)'call create_ctl_bcoef' + write(6,*)'call create_ctl_bcoef' - if ( trim(gesanl) == 'ges' ) then - mod_satname = trim(satname) - else - mod_satname = trim(satname) // '_anl' - endif + if ( trim(gesanl) == 'ges' ) then + mod_satname = trim(satname) + else + mod_satname = trim(satname) // '_anl' + endif - call create_ctl_bcoef(ntype,ftype,n_chan,iyy,imm,idd,ihh,idhh,& + call create_ctl_bcoef(ntype,ftype,n_chan,iyy,imm,idd,ihh,idhh,& incr,ctl_file,lunctl,rmiss,mod_satname,satype,dplat,& nu_chan,use,penalty,frequency,wavenumbr,little_endian) - else - write(6,*) 'imkctl =',imkctl - endif ! Write data to binary output file - if ( imkdata == 1 ) then - write(6,*)'write data to lungrd=',lungrd - open(lungrd,file=data_file,form='unformatted') - write(lungrd) (penalty(k),k=1,n_chan) - do j=1,maxpred - write(lungrd) (coefs(k,j),k=1,n_chan) - end do - close(lungrd) - endif + write(6,*)'write data to lungrd=',lungrd + open(lungrd,file=data_file,form='unformatted') + write(lungrd) (penalty(k),k=1,n_chan) + do j=1,maxpred + write(lungrd) (coefs(k,j),k=1,n_chan) + end do + close(lungrd) ! Deallocate arrays write(6,*)'deallocate arrays' deallocate(coefs,io_chan,nu_chan,wavenumbr,count,penalty,use,frequency) - goto 950 - - -! Jump here if problem reading diagnostic file -900 continue - write(6,*)'***PROBLEM*** reading diagnostic file' - - n_chan=nchanl - if (n_chan<=0) then - write(6,*)'***ERROR*** invalid nchanl=',nchanl,' STOP program' - call errexit(94) - endif - - write(6,*)'load missing value ',rmiss,' into output arrays. ',& - n_chan,npredr - allocate(penalty(n_chan),coefs(n_chan,npredr)) - do k=1,n_chan - penalty(k)=rmiss - end do - do j=1,npredr - do k=1,n_chan - coefs(k,j)=rmiss - end do - end do - - if ( imkdata == 1 ) then - open(lungrd,file=data_file,form='unformatted') - write(lungrd) (penalty(k),k=1,n_chan) - do j=1,npredr - write(lungrd) (coefs(k,j),k=1,n_chan) - end do - write(6,*)'write output to lungrd=',lungrd,', file=',trim(data_file) - close(lungrd) - endif - deallocate(penalty,coefs) - - goto 950 ! Jump here if problem reading coefficient file @@ -370,6 +316,5 @@ program bcoef ! End of program -950 continue stop end program bcoef diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radbcoef.fd/create_ctl_bcoef.f90 b/util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radbcoef.fd/create_ctl_bcoef.f90 similarity index 85% rename from util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radbcoef.fd/create_ctl_bcoef.f90 rename to util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radbcoef.fd/create_ctl_bcoef.f90 index 1092b18cd3..19184c5830 100755 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radbcoef.fd/create_ctl_bcoef.f90 +++ b/util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radbcoef.fd/create_ctl_bcoef.f90 @@ -4,28 +4,30 @@ subroutine create_ctl_bcoef(ntype,ftype,n_chan,iyy,imm,idd,ihh,idhh,& implicit none - integer ntype + integer, intent(in) :: ntype,n_chan,iyy,imm,idd,ihh,idhh + character(10),dimension(ntype),intent(in) :: ftype + integer, intent(in) :: lunctl,incr,little_endian + character(40),intent(in) :: ctl_file + real, intent(in) :: rmiss + character(20),intent(in) :: satname + character(10),intent(in) :: satype,dplat + integer,dimension(n_chan),intent(in) :: nu_chan + real,dimension(n_chan),intent(in) :: ratio,use,frequency,wavenumbr + - character(2) cword character(3),dimension(12):: mon character(3):: clatmin,clatmax character(4):: clonmin,clonmax - character(10),dimension(ntype):: ftype character(13) stringd - character(20) satname - character(10) satype,dplat - character(40) ctl_file,grad_file + character(40) grad_file character(80) string - integer idsat,iuse,little_endian - integer lunctl,iyy,imm,idd,ihh,j,i,n_chan,idhh,incr + integer iuse,j,i integer iyy2,imm2,idd2,ihh2,ntime integer,dimension(8):: ida,jda - integer,dimension(n_chan):: nu_chan - real rmiss,wavelength + real wavelength real,dimension(5):: fha - real,dimension(n_chan):: ratio,use,frequency,wavenumbr data stringd / '.%y4%m2%d2%h2' / data mon / 'jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', & diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radbcor.fd/kinds.F90 b/util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radbcoef.fd/kinds.F90 similarity index 100% rename from util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radbcor.fd/kinds.F90 rename to util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radbcoef.fd/kinds.F90 diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radang.fd/read_diag.f90 b/util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radbcoef.fd/read_diag.f90 similarity index 96% rename from util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radang.fd/read_diag.f90 rename to util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radbcoef.fd/read_diag.f90 index 93ccabe4ca..6fd698ab99 100755 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radang.fd/read_diag.f90 +++ b/util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radbcoef.fd/read_diag.f90 @@ -64,11 +64,6 @@ module read_diag public :: iversion_radiag_5 public :: ireal_old_radiag public :: set_netcdf_read -! public :: iversion_radiag -! public :: iversion_radiag_1 -! public :: iversion_radiag_2 -! public :: iversion_radiag_3 -! public :: iversion_radiag_4 public :: ireal_radiag public :: ipchan_radiag public :: set_radiag @@ -102,7 +97,7 @@ module read_diag integer(i_kind) :: angord ! order of polynomial for adp_anglebc option integer(i_kind) :: iversion ! radiance diagnostic file version number integer(i_kind) :: inewpc ! indicator of newpc4pred (1 on, 0 off) - integer(i_kind) :: ijacob ! indicates whether jacobian included (1 yes, 0 no) + integer(i_kind) :: ijacob ! indicates whether jacobian included (1 yes, 0 no) integer(i_kind) :: isens ! sensitivity index end type diag_header_fix_list @@ -267,8 +262,8 @@ subroutine open_radiag(filename, ftin, istatus) if (nopen_ncdiag >= MAX_OPEN_NCDIAG) then write(6,*) 'OPEN_RADIAG: ***ERROR*** Cannot open more than ', & MAX_OPEN_NCDIAG, ' netcdf diag files.' -! call stop2(456) endif + call nc_diag_read_init(filename,ftin) istatus=0 do i = 1, MAX_OPEN_NCDIAG @@ -308,8 +303,8 @@ subroutine close_radiag(filename, ftin) if (id < 0) then write(6,*) 'CLOSE_RADIAG: ***ERROR*** ncdiag file ', filename, & ' was not opened' -! call stop2(456) endif + call nc_diag_read_close(filename) ncdiag_open_id(id) = -1 ncdiag_open_status(id)%nc_read = .false. @@ -361,14 +356,14 @@ subroutine read_radiag_header(ftin,npred_radiag,retrieval,header_fix,header_chan !$$$ ! Declare passed arguments - integer(i_kind),intent(in) :: ftin - integer(i_kind),intent(in) :: npred_radiag - logical,intent(in) :: retrieval - type(diag_header_fix_list ),intent(out):: header_fix + integer(i_kind),intent(in) :: ftin + integer(i_kind),intent(in) :: npred_radiag + logical,intent(in) :: retrieval + type(diag_header_fix_list ),intent(out) :: header_fix type(diag_header_chan_list),allocatable :: header_chan(:) - type(diag_data_name_list) :: data_name - integer(i_kind),intent(out) :: iflag - logical,optional,intent(in) :: lverbose + type(diag_data_name_list) :: data_name + integer(i_kind),intent(out) :: iflag + logical,optional,intent(in) :: lverbose iflag = 0 if (netcdf) then @@ -379,6 +374,7 @@ subroutine read_radiag_header(ftin,npred_radiag,retrieval,header_fix,header_chan end subroutine read_radiag_header + subroutine read_radiag_header_nc(ftin,header_fix,header_chan,iflag) ! . . . . ! subprogram: read_diag_header_nc read rad diag header @@ -404,25 +400,24 @@ subroutine read_radiag_header_nc(ftin,header_fix,header_chan,iflag) ! !$$$ ! Declare passed arguments - integer(i_kind),intent(in) :: ftin - type(diag_header_fix_list ),intent(out):: header_fix + integer(i_kind),intent(in) :: ftin + type(diag_header_fix_list ),intent(out) :: header_fix type(diag_header_chan_list),allocatable :: header_chan(:) - integer(i_kind),intent(out) :: iflag + integer(i_kind),intent(out) :: iflag ! local variables - integer(i_kind) :: nchan_dim - real(r_kind),allocatable,dimension(:) :: r_var_stor - integer(i_kind),allocatable,dimension(:) :: i_var_stor - character(20) :: isis - character(10) :: id, obstype + integer(i_kind) :: nchan_dim + real(r_kind),allocatable,dimension(:) :: r_var_stor + integer(i_kind),allocatable,dimension(:) :: i_var_stor + character(20) :: isis + character(10) :: id, obstype ! integer(i_kind),dimension(:),allocatable :: jiter, nchan_diag, npred, idate, & - integer(i_kind) :: jiter, nchan_diag, npred, idate, & - ireal, ipchan, iextra, jextra, & - idiag, angord, iversion, inewpc, & - isens, ijacob + integer(i_kind) :: jiter, nchan_diag, npred, idate, & + ireal, ipchan, iextra, jextra, & + idiag, angord, iversion, inewpc, & + isens, ijacob iflag = 0 -! allocate(nchan_diag(1) ) nchan_dim = nc_diag_read_get_dim(ftin,'nchans') header_fix%nchan = nchan_dim @@ -430,7 +425,6 @@ subroutine read_radiag_header_nc(ftin,header_fix,header_chan,iflag) if (nchan_dim /= nchan_diag) then write(*,*)'ERROR: Number of channels from dimension do not match those from header, aborting.' -! call stop2(321) endif call nc_diag_read_get_global_attr(ftin, "Satellite_Sensor", isis) ; header_fix%isis = isis @@ -458,7 +452,6 @@ subroutine read_radiag_header_nc(ftin,header_fix,header_chan,iflag) if (allocated(i_var_stor)) deallocate(i_var_stor) allocate(r_var_stor(nchan_dim), & i_var_stor(nchan_dim) ) -! call nc_diag_read_get_var('Var', var_stor) call nc_diag_read_get_var(ftin, 'frequency',r_var_stor) ; header_chan%freq = r_var_stor call nc_diag_read_get_var(ftin, 'polarization',i_var_stor) ; header_chan%polar = i_var_stor call nc_diag_read_get_var(ftin, 'wavenumber',r_var_stor) ; header_chan%wave = r_var_stor @@ -468,9 +461,9 @@ subroutine read_radiag_header_nc(ftin,header_fix,header_chan,iflag) call nc_diag_read_get_var(ftin, 'sensor_chan',i_var_stor) ; header_chan%nuchan = i_var_stor call nc_diag_read_get_var(ftin, 'satinfo_chan',i_var_stor) ; header_chan%iochan = i_var_stor - end subroutine read_radiag_header_nc + subroutine read_radiag_header_bin(ftin,npred_radiag,retrieval,header_fix,header_chan,data_name,iflag,lverbose) ! . . . . ! subprogram: read_diag_header_bin read rad diag header @@ -504,14 +497,14 @@ subroutine read_radiag_header_bin(ftin,npred_radiag,retrieval,header_fix,header_ !$$$ ! Declare passed arguments - integer(i_kind),intent(in) :: ftin - integer(i_kind),intent(in) :: npred_radiag - logical,intent(in) :: retrieval - type(diag_header_fix_list ),intent(out):: header_fix + integer(i_kind),intent(in) :: ftin + integer(i_kind),intent(in) :: npred_radiag + logical,intent(in) :: retrieval + type(diag_header_fix_list ),intent(out) :: header_fix type(diag_header_chan_list),allocatable :: header_chan(:) - type(diag_data_name_list) :: data_name - integer(i_kind),intent(out) :: iflag - logical,optional,intent(in) :: lverbose + type(diag_data_name_list) :: data_name + integer(i_kind),intent(out) :: iflag + logical,optional,intent(in) :: lverbose ! Declare local variables character(len=2):: string @@ -722,9 +715,9 @@ subroutine read_radiag_header_bin(ftin,npred_radiag,retrieval,header_fix,header_ ! Construct array containing menonics for data record entries - end subroutine read_radiag_header_bin + integer(i_kind) function find_ncdiag_id(ftin) integer(i_kind), intent(in) :: ftin @@ -741,6 +734,7 @@ integer(i_kind) function find_ncdiag_id(ftin) end function find_ncdiag_id + subroutine read_radiag_data(ftin,header_fix,retrieval,data_fix,data_chan,data_extra,iflag ) ! . . . . ! subprogram: read_radiag_dat read rad diag data @@ -772,13 +766,13 @@ subroutine read_radiag_data(ftin,header_fix,retrieval,data_fix,data_chan,data_ex ! Declare passed arguments - integer(i_kind),intent(in) :: ftin - type(diag_header_fix_list ),intent(in) :: header_fix - logical,intent(in) :: retrieval - type(diag_data_fix_list) ,intent(out):: data_fix + integer(i_kind),intent(in) :: ftin + type(diag_header_fix_list ),intent(in) :: header_fix + logical,intent(in) :: retrieval + type(diag_data_fix_list) ,intent(out) :: data_fix type(diag_data_chan_list) ,allocatable :: data_chan(:) type(diag_data_extra_list) ,allocatable :: data_extra(:,:) - integer(i_kind),intent(out) :: iflag + integer(i_kind),intent(out) :: iflag integer(i_kind) :: id @@ -817,6 +811,8 @@ subroutine read_radiag_data(ftin,header_fix,retrieval,data_fix,data_chan,data_ex end subroutine read_radiag_data + + subroutine read_radiag_data_nc_init(ftin, diag_status, header_fix, retrieval, iflag) ! . . . . ! subprogram: read_radiag_data_nc_init read rad diag data @@ -997,10 +993,6 @@ subroutine read_radiag_data_nc_init(ftin, diag_status, header_fix, retrieval, if endif cdatum = 1 -! allocate( all_data_fix(nrecord) ) -! allocate( all_data_chan(nrecord, nchan)) - - do ir=1,nrecord clat = Latitude(cdatum) clon = Longitude(cdatum) @@ -1122,9 +1114,10 @@ subroutine read_radiag_data_nc_init(ftin, diag_status, header_fix, retrieval, if deallocate(Observation_Operator_Jacobian) endif - end subroutine read_radiag_data_nc_init + + subroutine read_radiag_data_nc(diag_status,header_fix,data_fix,data_chan,data_extra,iflag ) ! . . . . ! subprogram: read_radiag_dat read rad diag data @@ -1171,6 +1164,8 @@ subroutine read_radiag_data_nc(diag_status,header_fix,data_fix,data_chan,data_ex end subroutine read_radiag_data_nc + + subroutine read_radiag_data_bin(ftin,header_fix,retrieval,data_fix,data_chan,data_extra,iflag ) ! . . . . ! subprogram: read_radiag_dat read rad diag data @@ -1420,5 +1415,6 @@ subroutine read_radiag_data_bin(ftin,header_fix,retrieval,data_fix,data_chan,dat end subroutine read_radiag_data_bin + end module read_diag diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radbcoef.fd/sparsearr.f90 b/util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radbcoef.fd/sparsearr.f90 similarity index 100% rename from util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radbcoef.fd/sparsearr.f90 rename to util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radbcoef.fd/sparsearr.f90 diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radbcor.fd/CMakeLists.txt b/util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radbcor.fd/CMakeLists.txt similarity index 86% rename from util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radbcor.fd/CMakeLists.txt rename to util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radbcor.fd/CMakeLists.txt index 607d841e09..59ac8532da 100644 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radbcor.fd/CMakeLists.txt +++ b/util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radbcor.fd/CMakeLists.txt @@ -7,7 +7,7 @@ cmake_minimum_required(VERSION 2.6) set_target_properties( radmon_bcor.x PROPERTIES COMPILE_FLAGS ${RADMON_BCOR_Fortran_FLAGS} ) set_target_properties( radmon_bcor.x PROPERTIES Fortran_MODULE_DIRECTORY ${Util_MODULE_DIR} ) include_directories( ${CORE_INCS} ${NCDIAG_INCS} ) - target_link_libraries( radmon_bcor.x ${W3NCO_4_LIBRARY} ${NCDIAG_LIBRARIES} ${NETCDF_LIBRARIES_F90} ${NETCDF_LIBRARIES} ${HDF5_Fortran_HL_LIBRARIES} ${HDF5_LIBRARIES} ${MPI_Fortran_LIBRARIES} ) + target_link_libraries( radmon_bcor.x ${W3NCO_4_LIBRARY} ${NCDIAG_LIBRARIES} ${NETCDF_Fortran_LIBRARIES} ${NETCDF_C_LIBRARIES} ${MPI_Fortran_LIBRARIES} ) if(BUILD_W3NCO) add_dependencies( radmon_bcor.x ${W3NCO_4_LIBRARY} ) endif() diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radbcor.fd/avgsdv.f90 b/util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radbcor.fd/avgsdv.f90 similarity index 100% rename from util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radbcor.fd/avgsdv.f90 rename to util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radbcor.fd/avgsdv.f90 diff --git a/util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radbcor.fd/bcor.f90 b/util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radbcor.fd/bcor.f90 new file mode 100755 index 0000000000..1ded0a0bb1 --- /dev/null +++ b/util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radbcor.fd/bcor.f90 @@ -0,0 +1,486 @@ +!----------------------------------------------------------- +! bcor.f90 +! + +program bcor + use read_diag + use kinds, only : i_kind + + implicit none + integer ntype,mregion,surf_nregion,max_surf_region + parameter (ntype=30,mregion=25,max_surf_region=5) + integer iglobal, iland, iwater, isnowice, imixed + parameter( iglobal=1, iland=2, iwater=3, isnowice=4, imixed=5 ) + + character(10),dimension(ntype):: ftype + character(20) satname,stringd,satsis,mod_satname + character(10) dum,satype,dplat + character(80) string,data_file,ctl_file + character(500) diag_rad + character(40),dimension(max_surf_region):: region + character(10) suffix + + integer luname,lungrd,lunctl,lndiag + integer iyy,imm,idd,ihh,idhh,incr,iread,iflag + integer n_chan,j,idsat,i,k,ii,nsub + integer,dimension(mregion):: jsub + integer,allocatable,dimension(:):: io_chan,nu_chan + integer npred_radiag,angord + integer(i_kind) :: istatus + + real pen,rread + real weight,rlat,rlon,rmiss,obs,biascor,obsges,obsgesnbc,rterm + real,dimension(2):: cor_total,cor_fixang,cor_lapse,cor_lapse2,& + cor_const,cor_scangl,cor_clw,cor_cos_ssmis,cor_sin_ssmis,& + cor_emiss,cor_ordang4,cor_ordang3,cor_ordang2,cor_ordang1 + + real,dimension(max_surf_region):: rlatmin,rlatmax,rlonmin,rlonmax + + real,allocatable,dimension(:):: wavenumbr + real,allocatable,dimension(:,:):: count,error,use,frequency,penalty + real,allocatable,dimension(:,:,:):: total_cor,fixang_cor,lapse_cor,& + lapse2_cor,const_cor,scangl_cor,clw_cor,cos_ssmis_cor,sin_ssmis_cor,& + emiss_cor,ordang4_cor,ordang3_cor,ordang2_cor,ordang1_cor + + logical no_obs + +! Variables for reading satellite data + type(diag_header_fix_list ) :: header_fix + type(diag_header_chan_list),allocatable :: header_chan(:) + type(diag_data_name_list ) :: data_name + type(diag_data_fix_list ) :: data_fix + type(diag_data_chan_list ),allocatable :: data_chan(:) + type(diag_data_extra_list) ,allocatable :: data_extra(:,:) + + integer nsnow, nland, nwater, nice, nmixed, ntotal + integer nnsnow, nnland, nnwater, nnmixed, nntotal + +! Namelist with defaults + logical :: retrieval = .false. + integer :: nchanl = 19 + character(3) :: gesanl = 'ges' + integer :: little_endian = 1 + character(3) :: rad_area = 'glb' + logical :: netcdf = .false. + namelist /input/ satname,iyy,imm,idd,ihh,idhh,incr,nchanl,& + suffix,retrieval,gesanl,little_endian,rad_area,netcdf + + data luname,lungrd,lunctl,lndiag / 5, 51, 52, 21 / + data rmiss /-999./ + data stringd / '.%y4%m2%d2%h2' / + data ftype / 'count', 'penalty', & + 'avgtotal', 'avgfixang', 'avglapse', 'avglapse2', & + 'avgconst', 'avgscangl', 'avgclw', & + 'avgcos', 'avgsin', 'avgemiss', 'avgordang4', & + 'avgordang3', 'avgordang2', 'avgordang1', & + 'sdvtotal', 'sdvfixang', 'sdvlapse', 'sdvlapse2', & + 'sdvconst', 'sdvscangl', 'sdvclw', & + 'sdvcos', 'sdvsin', 'sdvemiss', 'sdvordang4',& + 'sdvordang3', 'sdvordang2', 'sdvordang1' / + data region / 'global', 'land', 'water', 'ice/snow', 'mixed'/ + data rlonmin / -180., -180., -180., -180., -180./ + data rlonmax / 180., 180., 180., 180., 180./ + data rlatmin / -90., -90., -90., -90., -90./ + data rlatmax / 90., 90., 90., 90., 90./ + + + +!************************************************************************ +! +! Initialize variables + iread=0 + npred_radiag = 12 + +! Read namelist input + read(luname,input) + write(6,input) + write(6,*)'gesanl = ', gesanl + write(6,*)'rad_area = ', rad_area + write(6,*)' ' + + surf_nregion = 5 + if ( trim(rad_area) == 'rgn' ) then + surf_nregion = 1 + endif + + write(6,*)'surf_nregion = ', surf_nregion + + +! Ensure number of requested regions does not exceed specified upper limit + if (surf_nregion>mregion) then + write(6,*)'***ERROR*** too many regions specified' + write(6,*)' maximum allowed: mregion=',mregion + write(6,*)' user requested: surf_nregion=',surf_nregion + call errexit(91) + endif + + +! Create filenames for diagnostic input, binary output file + write(stringd,100) iyy,imm,idd,ihh +100 format('.',i4.4,3i2.2) + + if ( trim(gesanl) == 'ges' ) then + diag_rad = trim(satname) + data_file= 'bcor.' // trim(satname) // trim(stringd) // '.ieee_d' + ctl_file = 'bcor.' // trim(satname) // '.ctl' + else + diag_rad = trim(satname) // '_anl' + data_file= 'bcor.' // trim(satname) // '_anl' // trim(stringd) // '.ieee_d' + ctl_file = 'bcor.' // trim(satname) // '_anl.ctl' + endif + + write(6,*)'diag_rad =',diag_rad + write(6,*)'data_file=',data_file + write(6,*)'ctl_file =',ctl_file + write(6,*)'suffix =',suffix + + + !----------------------------------------------------- + ! Note: Ideally the open_radiag routine would + ! return an iret code indicating success or + ! failure of the attempt to open the diag file. + ! It's ok in this case, only because the calling + ! script only starts the executable if the + ! diag file is > 0 sized, and the calls to + ! actually read the data do support return codes. + ! Still, if time permits it would be useful to add + ! an iret value to open_radiag(). + ! + call set_netcdf_read( netcdf ) + call open_radiag( diag_rad, lndiag, istatus ) + +! File exists. Read header + write(6,*)'call read_diag_header' + call read_radiag_header( lndiag, npred_radiag, retrieval, header_fix,& + header_chan, data_name, iflag ) + if( iflag/=0 ) then + write(6,*)'***ERROR*** problem reading diag file header, iflag=',iflag + call errexit(91) + endif + +! Extract observation type, satellite id, and number of channels + satype = header_fix%obstype + satsis = header_fix%isis + dplat = header_fix%id + n_chan = header_fix%nchan + angord = header_fix%angord + + write(6,*)'satype,dplat,n_chan,angord=',satype,' ',dplat,n_chan,angord + + string = trim(satype)//'_'//trim(dplat) + write(6,*)'string,satname=',string,' ',satname + if ( trim(string) /= trim(satname) ) then + write(6,*)'***ERROR*** inconsistent instrument types' + write(6,*)' satname,string =',satname,' ',string + call errexit(92) + endif + + +! Allocate arrays to hold observational information + write(6,*)' ' + write(6,*)'allocate arrays' + allocate (io_chan(n_chan), nu_chan(n_chan), wavenumbr(n_chan)) + allocate (total_cor(n_chan,mregion,2), fixang_cor(n_chan,mregion,2), & + lapse_cor(n_chan,mregion,2), lapse2_cor(n_chan,mregion,2), & + const_cor(n_chan,mregion,2), scangl_cor(n_chan,mregion,2), & + clw_cor(n_chan,mregion,2), cos_ssmis_cor(n_chan,mregion,2), & + sin_ssmis_cor(n_chan,mregion,2), emiss_cor(n_chan,mregion,2), & + ordang4_cor(n_chan,mregion,2), ordang3_cor(n_chan,mregion,2), & + ordang2_cor(n_chan,mregion,2), ordang1_cor(n_chan,mregion,2), & + count(n_chan,mregion), penalty(n_chan,mregion), & + error(n_chan,mregion), use(n_chan,mregion), & + frequency(n_chan,mregion)) + +! Zero accumulator arrays + do ii=1,2 + do k=1,mregion + do j=1,n_chan + if (ii==1) then + count(j,k) = 0.0 + penalty(j,k) = 0.0 + endif + total_cor(j,k,ii) = 0.0 + fixang_cor(j,k,ii) = 0.0 + lapse_cor(j,k,ii) = 0.0 + lapse2_cor(j,k,ii) = 0.0 + const_cor(j,k,ii) = 0.0 + scangl_cor(j,k,ii) = 0.0 + clw_cor(j,k,ii) = 0.0 + cos_ssmis_cor(j,k,ii) = 0.0 + sin_ssmis_cor(j,k,ii) = 0.0 + emiss_cor(j,k,ii) = 0.0 + ordang4_cor(j,k,ii) = 0.0 + ordang3_cor(j,k,ii) = 0.0 + ordang2_cor(j,k,ii) = 0.0 + ordang1_cor(j,k,ii) = 0.0 + end do + end do + end do + + +! Extract satinfo relative index + do j=1,n_chan + nu_chan(j) = real( header_chan(j)%nuchan, 4 ) + io_chan(j) = real( header_chan(j)%iochan, 4 ) + wavenumbr(j) = real( header_chan(j)%wave, 4 ) + end do + do k=1,mregion + do j=1,n_chan + error(j,k) = real( header_chan(j)%varch, 4) + use(j,k) = real( header_chan(j)%iuse, 4 ) + frequency(j,k) = real( header_chan(j)%freq, 4) + end do + end do + + +! Create GrADS control file + write(6,*)'call create_ctl_bcor' + + if ( trim(gesanl) == 'ges' ) then + mod_satname = trim(satname) + else + mod_satname = trim(satname) // '_anl' + endif + + + call create_ctl_bcor(ntype,ftype,n_chan,iyy,imm,idd,ihh,idhh,& + incr,ctl_file,lunctl,rmiss,mod_satname,satype,dplat,surf_nregion,& + region,rlonmin,rlonmax,rlatmin,rlatmax,nu_chan,use(1,1),error(1,1),& + frequency(1,1),wavenumbr,little_endian) + + + nwater = 0; nnwater = 0 + nland = 0; nnland = 0 + nsnow = 0; nnsnow = 0 + nice = 0 + nmixed = 0; nnmixed = 0 + ntotal = 0 + +! Loop to read entries in diagnostic file + iflag = 0 + loopd: do while (iflag == 0) + +! Read a record. If read flag, iflag does not equal zero, exit loopd + call read_radiag_data( lndiag, header_fix, retrieval, data_fix, data_chan,& + data_extra, iflag ) + if( iflag /= 0 ) exit loopd + iread=iread+1 + +! Extract obervation location and mpi weight. Convert (0-360) lon to (-180,180) + rlat = data_fix%lat + rlon = data_fix%lon + if (rlon>180.) rlon = rlon - 360. + rread = rread + 1.0 + + ntotal = ntotal + 1 + jsub(1)= iglobal + nsub = 1 + + if ( surf_nregion > 1 ) then + if ( data_fix%water_frac > 0.99 ) then + nwater = nwater + 1 + else if ( data_fix%land_frac > 0.99 ) then + nland = nland + 1 + else if ( data_fix%snow_frac > 0.99 ) then + nsnow = nsnow + 1 + else if ( data_fix%ice_frac > 0.99 ) then + nice = nice + 1 + else + nmixed = nmixed + 1 + end if + +! Determine into which subdomains the observation falls. +! These are now based on surface type, not geography. All +! obs match global (surf_region 1). +! + ii=0; + if ( data_fix%land_frac > 0.99 ) then + jsub(2)=iland + nsub=2 + nnland=nnland+1 + else if ( data_fix%water_frac > 0.99 ) then + jsub(2)=iwater + nsub=2 + nnwater=nnwater+1 + else if (( data_fix%snow_frac > 0.99 ) .OR. ( data_fix%ice_frac > 0.99 )) then + jsub(2)=isnowice + nsub=2 + nnsnow=nnsnow+1 + else + jsub(2)=imixed + nsub=2 + nnmixed=nnmixed+1 + write(6,*)'data_fix%land_frac,water,snow,ice = ',data_fix%land_frac, data_fix%water_frac, data_fix%snow_frac, data_fix%ice_frac + end if + end if + + +! Channel loop + do j = 1, n_chan + +! If observation was assimilated, accumulate sums in appropriate regions + if (data_chan(j)%errinv > 1.e-6) then + pen = (data_chan(j)%errinv*(data_chan(j)%omgbc))**2 + cor_total(1) = (data_chan(j)%omgnbc - data_chan(j)%omgbc) + cor_fixang(1) = data_chan(j)%bifix(angord+1) + cor_lapse(1) = data_chan(j)%bilap + cor_lapse2(1) = data_chan(j)%bilap2 + cor_const(1) = data_chan(j)%bicons + cor_scangl(1) = data_chan(j)%biang + cor_clw(1) = data_chan(j)%biclw + cor_cos_ssmis(1) = data_chan(j)%bicos + cor_sin_ssmis(1) = data_chan(j)%bisin + cor_emiss(1) = data_chan(j)%biemis + if (angord >= 4 ) then + cor_ordang4(1) = data_chan(j)%bifix(1) + cor_ordang3(1) = data_chan(j)%bifix(2) + cor_ordang2(1) = data_chan(j)%bifix(3) + cor_ordang1(1) = data_chan(j)%bifix(4) + else + cor_ordang4(1) = 0.0 + cor_ordang3(1) = 0.0 + cor_ordang2(1) = 0.0 + cor_ordang1(1) = 0.0 + endif + + cor_total(2) = (data_chan(j)%omgnbc - data_chan(j)%omgbc)**2 + cor_fixang(2) = (data_chan(j)%bifix(angord+1))**2 + cor_lapse(2) = (data_chan(j)%bilap)**2 + cor_lapse2(2) = (data_chan(j)%bilap2)**2 + cor_const(2) = (data_chan(j)%bicons)**2 + cor_scangl(2) = (data_chan(j)%biang)**2 + cor_clw(2) = (data_chan(j)%biclw)**2 + cor_cos_ssmis(2) = data_chan(j)%bicos**2 + cor_sin_ssmis(2) = data_chan(j)%bisin**2 + cor_emiss(2) = data_chan(j)%biemis**2 + if (angord >= 4 ) then + cor_ordang4(1) = data_chan(j)%bifix(1)**2 + cor_ordang3(1) = data_chan(j)%bifix(2)**2 + cor_ordang2(1) = data_chan(j)%bifix(3)**2 + cor_ordang1(1) = data_chan(j)%bifix(4)**2 + else + cor_ordang4(2) = 0.0 + cor_ordang3(2) = 0.0 + cor_ordang2(2) = 0.0 + cor_ordang1(2) = 0.0 + end if + + do i=1,nsub + k=jsub(i) + count(j,k) = count(j,k) +1.0 + penalty(j,k) = penalty(j,k) + pen + + do ii=1,2 + total_cor(j,k,ii) = total_cor(j,k,ii) + cor_total(ii) + fixang_cor(j,k,ii) = fixang_cor(j,k,ii) + cor_fixang(ii) + lapse_cor(j,k,ii) = lapse_cor(j,k,ii) + cor_lapse(ii) + lapse2_cor(j,k,ii) = lapse2_cor(j,k,ii) + cor_lapse2(ii) + const_cor(j,k,ii) = const_cor(j,k,ii) + cor_const(ii) + scangl_cor(j,k,ii) = scangl_cor(j,k,ii) + cor_scangl(ii) + clw_cor(j,k,ii) = clw_cor(j,k,ii) + cor_clw(ii) + cos_ssmis_cor(j,k,ii) = cos_ssmis_cor(j,k,ii) + cor_cos_ssmis(ii) + sin_ssmis_cor(j,k,ii) = sin_ssmis_cor(j,k,ii) + cor_sin_ssmis(ii) + emiss_cor(j,k,ii) = emiss_cor(j,k,ii) + cor_emiss(ii) + ordang4_cor(j,k,ii) = ordang4_cor(j,k,ii) + cor_ordang4(ii) + ordang3_cor(j,k,ii) = ordang3_cor(j,k,ii) + cor_ordang3(ii) + ordang2_cor(j,k,ii) = ordang2_cor(j,k,ii) + cor_ordang2(ii) + ordang1_cor(j,k,ii) = ordang1_cor(j,k,ii) + cor_ordang1(ii) + end do + + end do + endif + + enddo ! channel loop + +! End of loop over diagnostic file + enddo loopd + close(lndiag) + write(6,*)' ' + write(6,*)'read in ',iread,' obs ',rread + write(6,*)' ' + + write(6,*)'nwater, nland, nice, nsnow, nmixed, ntotal = ', nwater, nland, nice, nsnow, nmixed, ntotal + nntotal=nnwater+nnland+nnsnow+nnmixed + write(6,*)'nnwater, nnland, nnsnow, nnmixed, nntotal = ', nnwater, nnland, nnsnow, nnmixed, nntotal + +! Compute average and standard deviation + do k=1,surf_nregion + do j=1,n_chan + call avgsdv(count(j,k),total_cor(j,k,1), total_cor(j,k,2), rmiss) + call avgsdv(count(j,k),fixang_cor(j,k,1), fixang_cor(j,k,2), rmiss) + call avgsdv(count(j,k),lapse_cor(j,k,1), lapse_cor(j,k,2), rmiss) + call avgsdv(count(j,k),lapse2_cor(j,k,1), lapse2_cor(j,k,2), rmiss) + call avgsdv(count(j,k),const_cor(j,k,1), const_cor(j,k,2), rmiss) + call avgsdv(count(j,k),scangl_cor(j,k,1), scangl_cor(j,k,2), rmiss) + call avgsdv(count(j,k),clw_cor(j,k,1), clw_cor(j,k,2), rmiss) + call avgsdv(count(j,k),cos_ssmis_cor(j,k,1), cos_ssmis_cor(j,k,2), rmiss) + call avgsdv(count(j,k),sin_ssmis_cor(j,k,1), sin_ssmis_cor(j,k,2), rmiss) + call avgsdv(count(j,k),emiss_cor(j,k,1), emiss_cor(j,k,2), rmiss) + call avgsdv(count(j,k),ordang4_cor(j,k,1), ordang4_cor(j,k,2), rmiss) + call avgsdv(count(j,k),ordang3_cor(j,k,1), ordang3_cor(j,k,2), rmiss) + call avgsdv(count(j,k),ordang2_cor(j,k,1), ordang2_cor(j,k,2), rmiss) + call avgsdv(count(j,k),ordang1_cor(j,k,1), ordang1_cor(j,k,2), rmiss) + + if (count(j,k)>0) then + penalty(j,k)=penalty(j,k)/count(j,k) + else + count(j,k)=rmiss + penalty(j,k)=rmiss + endif + end do + end do + +! Write output to binary output file + write(6,*)' ' + open(lungrd,file=data_file,form='unformatted') + write(lungrd) ((count(j,k),j=1,n_chan),k=1,surf_nregion) + write(lungrd) ((penalty(j,k),j=1,n_chan),k=1,surf_nregion) + do ii=1,2 + write(lungrd) ((total_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) + write(lungrd) ((fixang_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) + write(lungrd) ((lapse_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) + write(lungrd) ((lapse2_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) + write(lungrd) ((const_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) + write(lungrd) ((scangl_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) + write(lungrd) ((clw_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) + write(lungrd) ((cos_ssmis_cor(j,k,ii),j=1,n_chan),k=1,surf_nregion) + write(lungrd) ((sin_ssmis_cor(j,k,ii),j=1,n_chan),k=1,surf_nregion) + write(lungrd) ((emiss_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) + write(lungrd) ((ordang4_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) + write(lungrd) ((ordang3_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) + write(lungrd) ((ordang2_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) + write(lungrd) ((ordang1_cor (j,k,ii),j=1,n_chan),k=1,surf_nregion) + end do + write(6,*)'write output to lungrd=',lungrd,', file=',trim(data_file) + close(lungrd) + +! Deallocate arrays + write(6,*)' ' + write(6,*)'deallocate arrays' + if(allocated(io_chan)) deallocate (io_chan) + if(allocated(nu_chan)) deallocate (nu_chan) + if(allocated(wavenumbr)) deallocate (wavenumbr) + if(allocated(total_cor)) deallocate (total_cor) + if(allocated(fixang_cor)) deallocate (fixang_cor) + if(allocated(lapse_cor)) deallocate (lapse_cor) + if(allocated(lapse2_cor)) deallocate (lapse2_cor) + if(allocated(const_cor)) deallocate (const_cor) + if(allocated(scangl_cor)) deallocate (scangl_cor) + if(allocated(clw_cor)) deallocate (clw_cor) + if(allocated(cos_ssmis_cor)) deallocate (cos_ssmis_cor) + if(allocated(sin_ssmis_cor)) deallocate (sin_ssmis_cor) + if(allocated(emiss_cor)) deallocate (emiss_cor) + if(allocated(ordang4_cor)) deallocate (ordang4_cor) + if(allocated(ordang3_cor)) deallocate (ordang3_cor) + if(allocated(ordang2_cor)) deallocate (ordang2_cor) + if(allocated(ordang1_cor)) deallocate (ordang1_cor) + if(allocated(count)) deallocate (count) + if(allocated(penalty)) deallocate (penalty) + if(allocated(error)) deallocate (error) + if(allocated(use)) deallocate (use) + if(allocated(frequency)) deallocate (frequency) + + + write(6,*) 'exiting program bcor' + stop +end program bcor diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radbcor.fd/create_ctl_bcor.f90 b/util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radbcor.fd/create_ctl_bcor.f90 similarity index 83% rename from util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radbcor.fd/create_ctl_bcor.f90 rename to util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radbcor.fd/create_ctl_bcor.f90 index 53ed20e9f9..abfdb22a30 100755 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radbcor.fd/create_ctl_bcor.f90 +++ b/util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radbcor.fd/create_ctl_bcor.f90 @@ -5,31 +5,33 @@ subroutine create_ctl_bcor(ntype,ftype,n_chan,iyy,imm,idd,ihh,idhh,& implicit none - integer ntype + integer,intent(in) :: ntype,lunctl,nregion,little_endian + character(10),dimension(ntype),intent(in) :: ftype + integer,intent(in) :: n_chan,iyy,imm,idd,ihh,idhh,incr + character(40),intent(in) :: ctl_file + real,intent(in) :: rmiss + character(20),intent(in) :: satname + character(10),intent(in) :: satype,dplat + character(40),dimension(nregion),intent(in):: region + real,dimension(nregion),intent(in) :: rlonmin,rlonmax,rlatmin,rlatmax + integer,dimension(n_chan),intent(in) :: nu_chan + real,dimension(n_chan),intent(in) :: error,use,frequency,wavenumbr + character(2) cword character(3),dimension(12):: mon character(3):: clatmin,clatmax character(4):: clonmin,clonmax - character(10),dimension(ntype):: ftype character(13) stringd - character(20) satname - character(10) satype,dplat - character(40) ctl_file,grad_file + character(40) grad_file character(80) string - character(40),dimension(nregion):: region character(80),dimension(nregion):: stringr - integer idsat,nregion,iuse,little_endian - integer lunctl,iyy,imm,idd,ihh,j,i,n_chan,idhh,incr - integer iyy2,imm2,idd2,ihh2,ntime + integer iyy2,imm2,idd2,ihh2,ntime,j,i,iuse integer,dimension(8):: ida,jda - integer,dimension(n_chan):: nu_chan - real rmiss,wavelength + real wavelength real,dimension(5):: fha - real,dimension(n_chan):: error,use,frequency,wavenumbr - real,dimension(nregion):: rlonmin,rlonmax,rlatmin,rlatmax data stringd / '.%y4%m2%d2%h2' / data mon / 'jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', & diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radtime.fd/kinds.F90 b/util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radbcor.fd/kinds.F90 similarity index 100% rename from util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radtime.fd/kinds.F90 rename to util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radbcor.fd/kinds.F90 diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radbcor.fd/read_diag.f90 b/util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radbcor.fd/read_diag.f90 similarity index 96% rename from util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radbcor.fd/read_diag.f90 rename to util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radbcor.fd/read_diag.f90 index 93ccabe4ca..6fd698ab99 100755 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radbcor.fd/read_diag.f90 +++ b/util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radbcor.fd/read_diag.f90 @@ -64,11 +64,6 @@ module read_diag public :: iversion_radiag_5 public :: ireal_old_radiag public :: set_netcdf_read -! public :: iversion_radiag -! public :: iversion_radiag_1 -! public :: iversion_radiag_2 -! public :: iversion_radiag_3 -! public :: iversion_radiag_4 public :: ireal_radiag public :: ipchan_radiag public :: set_radiag @@ -102,7 +97,7 @@ module read_diag integer(i_kind) :: angord ! order of polynomial for adp_anglebc option integer(i_kind) :: iversion ! radiance diagnostic file version number integer(i_kind) :: inewpc ! indicator of newpc4pred (1 on, 0 off) - integer(i_kind) :: ijacob ! indicates whether jacobian included (1 yes, 0 no) + integer(i_kind) :: ijacob ! indicates whether jacobian included (1 yes, 0 no) integer(i_kind) :: isens ! sensitivity index end type diag_header_fix_list @@ -267,8 +262,8 @@ subroutine open_radiag(filename, ftin, istatus) if (nopen_ncdiag >= MAX_OPEN_NCDIAG) then write(6,*) 'OPEN_RADIAG: ***ERROR*** Cannot open more than ', & MAX_OPEN_NCDIAG, ' netcdf diag files.' -! call stop2(456) endif + call nc_diag_read_init(filename,ftin) istatus=0 do i = 1, MAX_OPEN_NCDIAG @@ -308,8 +303,8 @@ subroutine close_radiag(filename, ftin) if (id < 0) then write(6,*) 'CLOSE_RADIAG: ***ERROR*** ncdiag file ', filename, & ' was not opened' -! call stop2(456) endif + call nc_diag_read_close(filename) ncdiag_open_id(id) = -1 ncdiag_open_status(id)%nc_read = .false. @@ -361,14 +356,14 @@ subroutine read_radiag_header(ftin,npred_radiag,retrieval,header_fix,header_chan !$$$ ! Declare passed arguments - integer(i_kind),intent(in) :: ftin - integer(i_kind),intent(in) :: npred_radiag - logical,intent(in) :: retrieval - type(diag_header_fix_list ),intent(out):: header_fix + integer(i_kind),intent(in) :: ftin + integer(i_kind),intent(in) :: npred_radiag + logical,intent(in) :: retrieval + type(diag_header_fix_list ),intent(out) :: header_fix type(diag_header_chan_list),allocatable :: header_chan(:) - type(diag_data_name_list) :: data_name - integer(i_kind),intent(out) :: iflag - logical,optional,intent(in) :: lverbose + type(diag_data_name_list) :: data_name + integer(i_kind),intent(out) :: iflag + logical,optional,intent(in) :: lverbose iflag = 0 if (netcdf) then @@ -379,6 +374,7 @@ subroutine read_radiag_header(ftin,npred_radiag,retrieval,header_fix,header_chan end subroutine read_radiag_header + subroutine read_radiag_header_nc(ftin,header_fix,header_chan,iflag) ! . . . . ! subprogram: read_diag_header_nc read rad diag header @@ -404,25 +400,24 @@ subroutine read_radiag_header_nc(ftin,header_fix,header_chan,iflag) ! !$$$ ! Declare passed arguments - integer(i_kind),intent(in) :: ftin - type(diag_header_fix_list ),intent(out):: header_fix + integer(i_kind),intent(in) :: ftin + type(diag_header_fix_list ),intent(out) :: header_fix type(diag_header_chan_list),allocatable :: header_chan(:) - integer(i_kind),intent(out) :: iflag + integer(i_kind),intent(out) :: iflag ! local variables - integer(i_kind) :: nchan_dim - real(r_kind),allocatable,dimension(:) :: r_var_stor - integer(i_kind),allocatable,dimension(:) :: i_var_stor - character(20) :: isis - character(10) :: id, obstype + integer(i_kind) :: nchan_dim + real(r_kind),allocatable,dimension(:) :: r_var_stor + integer(i_kind),allocatable,dimension(:) :: i_var_stor + character(20) :: isis + character(10) :: id, obstype ! integer(i_kind),dimension(:),allocatable :: jiter, nchan_diag, npred, idate, & - integer(i_kind) :: jiter, nchan_diag, npred, idate, & - ireal, ipchan, iextra, jextra, & - idiag, angord, iversion, inewpc, & - isens, ijacob + integer(i_kind) :: jiter, nchan_diag, npred, idate, & + ireal, ipchan, iextra, jextra, & + idiag, angord, iversion, inewpc, & + isens, ijacob iflag = 0 -! allocate(nchan_diag(1) ) nchan_dim = nc_diag_read_get_dim(ftin,'nchans') header_fix%nchan = nchan_dim @@ -430,7 +425,6 @@ subroutine read_radiag_header_nc(ftin,header_fix,header_chan,iflag) if (nchan_dim /= nchan_diag) then write(*,*)'ERROR: Number of channels from dimension do not match those from header, aborting.' -! call stop2(321) endif call nc_diag_read_get_global_attr(ftin, "Satellite_Sensor", isis) ; header_fix%isis = isis @@ -458,7 +452,6 @@ subroutine read_radiag_header_nc(ftin,header_fix,header_chan,iflag) if (allocated(i_var_stor)) deallocate(i_var_stor) allocate(r_var_stor(nchan_dim), & i_var_stor(nchan_dim) ) -! call nc_diag_read_get_var('Var', var_stor) call nc_diag_read_get_var(ftin, 'frequency',r_var_stor) ; header_chan%freq = r_var_stor call nc_diag_read_get_var(ftin, 'polarization',i_var_stor) ; header_chan%polar = i_var_stor call nc_diag_read_get_var(ftin, 'wavenumber',r_var_stor) ; header_chan%wave = r_var_stor @@ -468,9 +461,9 @@ subroutine read_radiag_header_nc(ftin,header_fix,header_chan,iflag) call nc_diag_read_get_var(ftin, 'sensor_chan',i_var_stor) ; header_chan%nuchan = i_var_stor call nc_diag_read_get_var(ftin, 'satinfo_chan',i_var_stor) ; header_chan%iochan = i_var_stor - end subroutine read_radiag_header_nc + subroutine read_radiag_header_bin(ftin,npred_radiag,retrieval,header_fix,header_chan,data_name,iflag,lverbose) ! . . . . ! subprogram: read_diag_header_bin read rad diag header @@ -504,14 +497,14 @@ subroutine read_radiag_header_bin(ftin,npred_radiag,retrieval,header_fix,header_ !$$$ ! Declare passed arguments - integer(i_kind),intent(in) :: ftin - integer(i_kind),intent(in) :: npred_radiag - logical,intent(in) :: retrieval - type(diag_header_fix_list ),intent(out):: header_fix + integer(i_kind),intent(in) :: ftin + integer(i_kind),intent(in) :: npred_radiag + logical,intent(in) :: retrieval + type(diag_header_fix_list ),intent(out) :: header_fix type(diag_header_chan_list),allocatable :: header_chan(:) - type(diag_data_name_list) :: data_name - integer(i_kind),intent(out) :: iflag - logical,optional,intent(in) :: lverbose + type(diag_data_name_list) :: data_name + integer(i_kind),intent(out) :: iflag + logical,optional,intent(in) :: lverbose ! Declare local variables character(len=2):: string @@ -722,9 +715,9 @@ subroutine read_radiag_header_bin(ftin,npred_radiag,retrieval,header_fix,header_ ! Construct array containing menonics for data record entries - end subroutine read_radiag_header_bin + integer(i_kind) function find_ncdiag_id(ftin) integer(i_kind), intent(in) :: ftin @@ -741,6 +734,7 @@ integer(i_kind) function find_ncdiag_id(ftin) end function find_ncdiag_id + subroutine read_radiag_data(ftin,header_fix,retrieval,data_fix,data_chan,data_extra,iflag ) ! . . . . ! subprogram: read_radiag_dat read rad diag data @@ -772,13 +766,13 @@ subroutine read_radiag_data(ftin,header_fix,retrieval,data_fix,data_chan,data_ex ! Declare passed arguments - integer(i_kind),intent(in) :: ftin - type(diag_header_fix_list ),intent(in) :: header_fix - logical,intent(in) :: retrieval - type(diag_data_fix_list) ,intent(out):: data_fix + integer(i_kind),intent(in) :: ftin + type(diag_header_fix_list ),intent(in) :: header_fix + logical,intent(in) :: retrieval + type(diag_data_fix_list) ,intent(out) :: data_fix type(diag_data_chan_list) ,allocatable :: data_chan(:) type(diag_data_extra_list) ,allocatable :: data_extra(:,:) - integer(i_kind),intent(out) :: iflag + integer(i_kind),intent(out) :: iflag integer(i_kind) :: id @@ -817,6 +811,8 @@ subroutine read_radiag_data(ftin,header_fix,retrieval,data_fix,data_chan,data_ex end subroutine read_radiag_data + + subroutine read_radiag_data_nc_init(ftin, diag_status, header_fix, retrieval, iflag) ! . . . . ! subprogram: read_radiag_data_nc_init read rad diag data @@ -997,10 +993,6 @@ subroutine read_radiag_data_nc_init(ftin, diag_status, header_fix, retrieval, if endif cdatum = 1 -! allocate( all_data_fix(nrecord) ) -! allocate( all_data_chan(nrecord, nchan)) - - do ir=1,nrecord clat = Latitude(cdatum) clon = Longitude(cdatum) @@ -1122,9 +1114,10 @@ subroutine read_radiag_data_nc_init(ftin, diag_status, header_fix, retrieval, if deallocate(Observation_Operator_Jacobian) endif - end subroutine read_radiag_data_nc_init + + subroutine read_radiag_data_nc(diag_status,header_fix,data_fix,data_chan,data_extra,iflag ) ! . . . . ! subprogram: read_radiag_dat read rad diag data @@ -1171,6 +1164,8 @@ subroutine read_radiag_data_nc(diag_status,header_fix,data_fix,data_chan,data_ex end subroutine read_radiag_data_nc + + subroutine read_radiag_data_bin(ftin,header_fix,retrieval,data_fix,data_chan,data_extra,iflag ) ! . . . . ! subprogram: read_radiag_dat read rad diag data @@ -1420,5 +1415,6 @@ subroutine read_radiag_data_bin(ftin,header_fix,retrieval,data_fix,data_chan,dat end subroutine read_radiag_data_bin + end module read_diag diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radbcor.fd/sparsearr.f90 b/util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radbcor.fd/sparsearr.f90 similarity index 100% rename from util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radbcor.fd/sparsearr.f90 rename to util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radbcor.fd/sparsearr.f90 diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radtime.fd/CMakeLists.txt b/util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radtime.fd/CMakeLists.txt similarity index 86% rename from util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radtime.fd/CMakeLists.txt rename to util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radtime.fd/CMakeLists.txt index 8c59a6349b..3bb4e4b2ec 100644 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radtime.fd/CMakeLists.txt +++ b/util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radtime.fd/CMakeLists.txt @@ -7,7 +7,7 @@ cmake_minimum_required(VERSION 2.6) set_target_properties( radmon_time.x PROPERTIES COMPILE_FLAGS ${RADMON_TIME_Fortran_FLAGS} ) set_target_properties( radmon_time.x PROPERTIES Fortran_MODULE_DIRECTORY ${Util_MODULE_DIR} ) include_directories( ${CORE_INCS} ${NCDIAG_INCS} ) - target_link_libraries( radmon_time.x ${W3NCO_4_LIBRARY} ${NCDIAG_LIBRARIES} ${NETCDF_LIBRARIES_F90} ${NETCDF_LIBRARIES} ${HDF5_Fortran_HL_LIBRARIES} ${HDF5_LIBRARIES} ${MPI_Fortran_LIBRARIES} ) + target_link_libraries( radmon_time.x ${W3NCO_4_LIBRARY} ${NCDIAG_LIBRARIES} ${NETCDF_Fortran_LIBRARIES} ${NETCDF_C_LIBRARIES} ${MPI_Fortran_LIBRARIES}) if(BUILD_W3NCO) add_dependencies( radmon_time.x ${W3NCO_4_LIBRARY} ) endif() diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radtime.fd/bad_chan.f90 b/util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radtime.fd/bad_chan.f90 similarity index 100% rename from util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radtime.fd/bad_chan.f90 rename to util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radtime.fd/bad_chan.f90 diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radtime.fd/bad_penalty.f90 b/util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radtime.fd/bad_penalty.f90 similarity index 100% rename from util/Radiance_Monitor/nwprod/radmon_shared.v2.0.0/sorc/verf_radtime.fd/bad_penalty.f90 rename to util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radtime.fd/bad_penalty.f90 diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radtime.fd/create_ctl_time.f90 b/util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radtime.fd/create_ctl_time.f90 similarity index 83% rename from util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radtime.fd/create_ctl_time.f90 rename to util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radtime.fd/create_ctl_time.f90 index 46279a476a..51446212a7 100755 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.4/sorc/verf_radtime.fd/create_ctl_time.f90 +++ b/util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radtime.fd/create_ctl_time.f90 @@ -5,31 +5,36 @@ subroutine create_ctl_time(ntype,ftype,n_chan,iyy,imm,idd,ihh,idhh,& implicit none - integer ntype + integer,intent(in) :: ntype + character(10),dimension(ntype),intent(in) :: ftype + integer,intent(in) :: n_chan,lunctl,iyy,imm,idd,ihh,idhh,incr + character(40),intent(in) :: ctl_file + real,intent(in) :: rmiss + character(20),intent(in) :: satname + character(10),intent(in) :: satype,dplat + integer,intent(in) :: nregion,little_endian + character(40),dimension(nregion),intent(in) :: region + real,dimension(nregion),intent(in) :: rlonmin,rlonmax,rlatmin,rlatmax + integer,dimension(n_chan),intent(in) :: nu_chan + real,dimension(n_chan),intent(in) :: error,use,frequency,wavenumbr + character(2) cword character(3),dimension(12):: mon character(3):: clatmin,clatmax character(4):: clonmin,clonmax - character(10),dimension(ntype):: ftype character(13) stringd - character(20) satname,satsis - character(10) satype,dplat - character(40) ctl_file,grad_file + character(40) grad_file character(80) string - character(40),dimension(nregion):: region character(80),dimension(nregion):: stringr - integer idsat,nregion,iuse,little_endian - integer lunctl,iyy,imm,idd,ihh,j,i,n_chan,idhh,incr + integer iuse + integer j,i integer iyy2,imm2,idd2,ihh2,ntime integer,dimension(8):: ida,jda - integer,dimension(n_chan):: nu_chan - real rmiss,wavelength + real wavelength real,dimension(5):: fha - real,dimension(n_chan):: error,use,frequency,wavenumbr - real,dimension(nregion):: rlonmin,rlonmax,rlatmin,rlatmax data stringd / '.%y4%m2%d2%h2' / data mon / 'jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', & diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radang.fd/kinds.F90 b/util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radtime.fd/kinds.F90 similarity index 100% rename from util/Radiance_Monitor/nwprod/radmon_shared.v2.0.3/sorc/verf_radang.fd/kinds.F90 rename to util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radtime.fd/kinds.F90 diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radtime.fd/bad_obs.f90 b/util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radtime.fd/low_count.f90 similarity index 50% rename from util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radtime.fd/bad_obs.f90 rename to util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radtime.fd/low_count.f90 index 9962b00bb3..a35d456a12 100644 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v2.0.2/sorc/verf_radtime.fd/bad_obs.f90 +++ b/util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radtime.fd/low_count.f90 @@ -1,12 +1,12 @@ !$$$ subprogram documentation block ! . . . -! subprogram: bad_obs build bad_obs.txt file +! subprogram: low_count build low_count.txt file ! prgmmr: safford date: 2009-11 ! -! abstract: This module contains code to build the bad_obs.txt file. -! The bad_obs.txt file reports the satellite and channel for -! which an unexpected number of observations were found in -! assimilated radiance data. +! abstract: This module contains code to build the low_count.txt file. +! The low_count.txt file reports the satellite and channel for +! which an unexpectedly low number of observations were found +! in the assimilated radiance data. ! ! program history log: ! 2009-11-23 safford - initial coding @@ -20,15 +20,15 @@ ! !$$$ -module bad_obs +module low_count implicit none private - public :: open_bad_obs_file - public :: write_bad_obs - public :: close_bad_obs_file + public :: open_low_count_file + public :: write_low_count + public :: close_low_count_file integer, parameter :: funit = 10 @@ -36,10 +36,10 @@ module bad_obs !------------------------------------------------------------- - ! create the bad_obs file + ! create the low_count file !------------------------------------------------------------- - subroutine open_bad_obs_file( date, cycle, fios ) + subroutine open_low_count_file( date, cycle, fios ) !--- interface character(8), intent( in ) :: date @@ -51,49 +51,46 @@ subroutine open_bad_obs_file( date, cycle, fios ) character(60) :: fname - write(*,*) '--> open_bad_obs_file, date, cycle = ', date, cycle + write(*,*) '--> open_low_count_file, date, cycle = ', date, cycle !--- build the file name - fname = 'bad_obs.' // trim(date) // trim(cycle) + fname = 'low_count.' // trim(date) // trim(cycle) !--- open file and write the header inquire(file=fname, exist=lexist) if( lexist .eqv. .FALSE. ) then - write(*,*) ' opening new bad_obs file' + write(*,*) ' opening new low_count file' open( UNIT=funit, FILE=fname, STATUS='NEW', IOSTAT=fios ) else - write(*,*) ' opening existing bad_obs.txt file' + write(*,*) ' opening existing low_count.txt file' open( UNIT=funit, FILE=fname, STATUS='OLD', POSITION='APPEND', IOSTAT=fios ) end if - end subroutine open_bad_obs_file + end subroutine open_low_count_file - subroutine write_bad_obs( satname, channel, region, num_obs ) + subroutine write_low_count( satname, channel, region, num_obs, avg_cnt ) !--- interface character(20), intent( in ) :: satname integer, intent( in ) :: channel integer, intent( in ) :: region real, intent( in ) :: num_obs - - !--- variables - real :: count - + real, intent( in ) :: avg_cnt !--- -! if( num_obs < 0.0 ) then -! count = 0.0 -! else - count = num_obs -! end if + character(len=50) :: fmt + + fmt = "(A16,A10,I5,A9,I1,A10,I7,A10,F9.2)" - write(funit,*) satname, 'channel= ', channel, ' region= ', region, ' num_obs= ', count + write(funit, fmt) satname, ' channel= ', channel, & + ' region= ', region, ' num_obs= ', & + INT(num_obs), ' avg_obs= ', avg_cnt - end subroutine write_bad_obs + end subroutine write_low_count - subroutine close_bad_obs_file( ) - write(*,*) '--> close_bad_obs_file' + subroutine close_low_count_file( ) + write(*,*) '--> close_low_count_file' close( funit ) - end subroutine close_bad_obs_file + end subroutine close_low_count_file -end module bad_obs +end module low_count diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radtime.fd/read_diag.f90 b/util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radtime.fd/read_diag.f90 similarity index 96% rename from util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radtime.fd/read_diag.f90 rename to util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radtime.fd/read_diag.f90 index 93ccabe4ca..6fd698ab99 100755 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radtime.fd/read_diag.f90 +++ b/util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radtime.fd/read_diag.f90 @@ -64,11 +64,6 @@ module read_diag public :: iversion_radiag_5 public :: ireal_old_radiag public :: set_netcdf_read -! public :: iversion_radiag -! public :: iversion_radiag_1 -! public :: iversion_radiag_2 -! public :: iversion_radiag_3 -! public :: iversion_radiag_4 public :: ireal_radiag public :: ipchan_radiag public :: set_radiag @@ -102,7 +97,7 @@ module read_diag integer(i_kind) :: angord ! order of polynomial for adp_anglebc option integer(i_kind) :: iversion ! radiance diagnostic file version number integer(i_kind) :: inewpc ! indicator of newpc4pred (1 on, 0 off) - integer(i_kind) :: ijacob ! indicates whether jacobian included (1 yes, 0 no) + integer(i_kind) :: ijacob ! indicates whether jacobian included (1 yes, 0 no) integer(i_kind) :: isens ! sensitivity index end type diag_header_fix_list @@ -267,8 +262,8 @@ subroutine open_radiag(filename, ftin, istatus) if (nopen_ncdiag >= MAX_OPEN_NCDIAG) then write(6,*) 'OPEN_RADIAG: ***ERROR*** Cannot open more than ', & MAX_OPEN_NCDIAG, ' netcdf diag files.' -! call stop2(456) endif + call nc_diag_read_init(filename,ftin) istatus=0 do i = 1, MAX_OPEN_NCDIAG @@ -308,8 +303,8 @@ subroutine close_radiag(filename, ftin) if (id < 0) then write(6,*) 'CLOSE_RADIAG: ***ERROR*** ncdiag file ', filename, & ' was not opened' -! call stop2(456) endif + call nc_diag_read_close(filename) ncdiag_open_id(id) = -1 ncdiag_open_status(id)%nc_read = .false. @@ -361,14 +356,14 @@ subroutine read_radiag_header(ftin,npred_radiag,retrieval,header_fix,header_chan !$$$ ! Declare passed arguments - integer(i_kind),intent(in) :: ftin - integer(i_kind),intent(in) :: npred_radiag - logical,intent(in) :: retrieval - type(diag_header_fix_list ),intent(out):: header_fix + integer(i_kind),intent(in) :: ftin + integer(i_kind),intent(in) :: npred_radiag + logical,intent(in) :: retrieval + type(diag_header_fix_list ),intent(out) :: header_fix type(diag_header_chan_list),allocatable :: header_chan(:) - type(diag_data_name_list) :: data_name - integer(i_kind),intent(out) :: iflag - logical,optional,intent(in) :: lverbose + type(diag_data_name_list) :: data_name + integer(i_kind),intent(out) :: iflag + logical,optional,intent(in) :: lverbose iflag = 0 if (netcdf) then @@ -379,6 +374,7 @@ subroutine read_radiag_header(ftin,npred_radiag,retrieval,header_fix,header_chan end subroutine read_radiag_header + subroutine read_radiag_header_nc(ftin,header_fix,header_chan,iflag) ! . . . . ! subprogram: read_diag_header_nc read rad diag header @@ -404,25 +400,24 @@ subroutine read_radiag_header_nc(ftin,header_fix,header_chan,iflag) ! !$$$ ! Declare passed arguments - integer(i_kind),intent(in) :: ftin - type(diag_header_fix_list ),intent(out):: header_fix + integer(i_kind),intent(in) :: ftin + type(diag_header_fix_list ),intent(out) :: header_fix type(diag_header_chan_list),allocatable :: header_chan(:) - integer(i_kind),intent(out) :: iflag + integer(i_kind),intent(out) :: iflag ! local variables - integer(i_kind) :: nchan_dim - real(r_kind),allocatable,dimension(:) :: r_var_stor - integer(i_kind),allocatable,dimension(:) :: i_var_stor - character(20) :: isis - character(10) :: id, obstype + integer(i_kind) :: nchan_dim + real(r_kind),allocatable,dimension(:) :: r_var_stor + integer(i_kind),allocatable,dimension(:) :: i_var_stor + character(20) :: isis + character(10) :: id, obstype ! integer(i_kind),dimension(:),allocatable :: jiter, nchan_diag, npred, idate, & - integer(i_kind) :: jiter, nchan_diag, npred, idate, & - ireal, ipchan, iextra, jextra, & - idiag, angord, iversion, inewpc, & - isens, ijacob + integer(i_kind) :: jiter, nchan_diag, npred, idate, & + ireal, ipchan, iextra, jextra, & + idiag, angord, iversion, inewpc, & + isens, ijacob iflag = 0 -! allocate(nchan_diag(1) ) nchan_dim = nc_diag_read_get_dim(ftin,'nchans') header_fix%nchan = nchan_dim @@ -430,7 +425,6 @@ subroutine read_radiag_header_nc(ftin,header_fix,header_chan,iflag) if (nchan_dim /= nchan_diag) then write(*,*)'ERROR: Number of channels from dimension do not match those from header, aborting.' -! call stop2(321) endif call nc_diag_read_get_global_attr(ftin, "Satellite_Sensor", isis) ; header_fix%isis = isis @@ -458,7 +452,6 @@ subroutine read_radiag_header_nc(ftin,header_fix,header_chan,iflag) if (allocated(i_var_stor)) deallocate(i_var_stor) allocate(r_var_stor(nchan_dim), & i_var_stor(nchan_dim) ) -! call nc_diag_read_get_var('Var', var_stor) call nc_diag_read_get_var(ftin, 'frequency',r_var_stor) ; header_chan%freq = r_var_stor call nc_diag_read_get_var(ftin, 'polarization',i_var_stor) ; header_chan%polar = i_var_stor call nc_diag_read_get_var(ftin, 'wavenumber',r_var_stor) ; header_chan%wave = r_var_stor @@ -468,9 +461,9 @@ subroutine read_radiag_header_nc(ftin,header_fix,header_chan,iflag) call nc_diag_read_get_var(ftin, 'sensor_chan',i_var_stor) ; header_chan%nuchan = i_var_stor call nc_diag_read_get_var(ftin, 'satinfo_chan',i_var_stor) ; header_chan%iochan = i_var_stor - end subroutine read_radiag_header_nc + subroutine read_radiag_header_bin(ftin,npred_radiag,retrieval,header_fix,header_chan,data_name,iflag,lverbose) ! . . . . ! subprogram: read_diag_header_bin read rad diag header @@ -504,14 +497,14 @@ subroutine read_radiag_header_bin(ftin,npred_radiag,retrieval,header_fix,header_ !$$$ ! Declare passed arguments - integer(i_kind),intent(in) :: ftin - integer(i_kind),intent(in) :: npred_radiag - logical,intent(in) :: retrieval - type(diag_header_fix_list ),intent(out):: header_fix + integer(i_kind),intent(in) :: ftin + integer(i_kind),intent(in) :: npred_radiag + logical,intent(in) :: retrieval + type(diag_header_fix_list ),intent(out) :: header_fix type(diag_header_chan_list),allocatable :: header_chan(:) - type(diag_data_name_list) :: data_name - integer(i_kind),intent(out) :: iflag - logical,optional,intent(in) :: lverbose + type(diag_data_name_list) :: data_name + integer(i_kind),intent(out) :: iflag + logical,optional,intent(in) :: lverbose ! Declare local variables character(len=2):: string @@ -722,9 +715,9 @@ subroutine read_radiag_header_bin(ftin,npred_radiag,retrieval,header_fix,header_ ! Construct array containing menonics for data record entries - end subroutine read_radiag_header_bin + integer(i_kind) function find_ncdiag_id(ftin) integer(i_kind), intent(in) :: ftin @@ -741,6 +734,7 @@ integer(i_kind) function find_ncdiag_id(ftin) end function find_ncdiag_id + subroutine read_radiag_data(ftin,header_fix,retrieval,data_fix,data_chan,data_extra,iflag ) ! . . . . ! subprogram: read_radiag_dat read rad diag data @@ -772,13 +766,13 @@ subroutine read_radiag_data(ftin,header_fix,retrieval,data_fix,data_chan,data_ex ! Declare passed arguments - integer(i_kind),intent(in) :: ftin - type(diag_header_fix_list ),intent(in) :: header_fix - logical,intent(in) :: retrieval - type(diag_data_fix_list) ,intent(out):: data_fix + integer(i_kind),intent(in) :: ftin + type(diag_header_fix_list ),intent(in) :: header_fix + logical,intent(in) :: retrieval + type(diag_data_fix_list) ,intent(out) :: data_fix type(diag_data_chan_list) ,allocatable :: data_chan(:) type(diag_data_extra_list) ,allocatable :: data_extra(:,:) - integer(i_kind),intent(out) :: iflag + integer(i_kind),intent(out) :: iflag integer(i_kind) :: id @@ -817,6 +811,8 @@ subroutine read_radiag_data(ftin,header_fix,retrieval,data_fix,data_chan,data_ex end subroutine read_radiag_data + + subroutine read_radiag_data_nc_init(ftin, diag_status, header_fix, retrieval, iflag) ! . . . . ! subprogram: read_radiag_data_nc_init read rad diag data @@ -997,10 +993,6 @@ subroutine read_radiag_data_nc_init(ftin, diag_status, header_fix, retrieval, if endif cdatum = 1 -! allocate( all_data_fix(nrecord) ) -! allocate( all_data_chan(nrecord, nchan)) - - do ir=1,nrecord clat = Latitude(cdatum) clon = Longitude(cdatum) @@ -1122,9 +1114,10 @@ subroutine read_radiag_data_nc_init(ftin, diag_status, header_fix, retrieval, if deallocate(Observation_Operator_Jacobian) endif - end subroutine read_radiag_data_nc_init + + subroutine read_radiag_data_nc(diag_status,header_fix,data_fix,data_chan,data_extra,iflag ) ! . . . . ! subprogram: read_radiag_dat read rad diag data @@ -1171,6 +1164,8 @@ subroutine read_radiag_data_nc(diag_status,header_fix,data_fix,data_chan,data_ex end subroutine read_radiag_data_nc + + subroutine read_radiag_data_bin(ftin,header_fix,retrieval,data_fix,data_chan,data_extra,iflag ) ! . . . . ! subprogram: read_radiag_dat read rad diag data @@ -1420,5 +1415,6 @@ subroutine read_radiag_data_bin(ftin,header_fix,retrieval,data_fix,data_chan,dat end subroutine read_radiag_data_bin + end module read_diag diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radtime.fd/sparsearr.f90 b/util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radtime.fd/sparsearr.f90 similarity index 100% rename from util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radtime.fd/sparsearr.f90 rename to util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radtime.fd/sparsearr.f90 diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radtime.fd/time.f90 b/util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radtime.fd/time.f90 similarity index 86% rename from util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radtime.fd/time.f90 rename to util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radtime.fd/time.f90 index b53da60d01..df93ce2c5e 100755 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radtime.fd/time.f90 +++ b/util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radtime.fd/time.f90 @@ -100,7 +100,7 @@ program time write(6,input) write(6,*)' ' write(6,*)'gesanl = ', gesanl - write(6,*)'imkdata = ', imkdata +! write(6,*)'imkdata = ', imkdata if ( trim(gesanl) == 'anl' ) then ftype(3) = 'omanbc' @@ -236,7 +236,7 @@ program time ! Create control file - if ( imkctl == 1 ) then +! if ( imkctl == 1 ) then write(6,*)'call create_ctl_time' if ( trim(gesanl) == 'ges' ) then @@ -249,7 +249,7 @@ program time incr,ctl_file,lunctl,rmiss,dfile,satype,dplat,nregion,& region,rlonmin,rlonmax,rlatmin,rlatmax,nu_chan,use(1,1),& error(1,1),frequency(1,1),wavenumbr,little_endian) - endif +! endif nwater = 0; nnwater=0 nice = 0 @@ -259,7 +259,7 @@ program time ntotal = 0 ! Loop to read entries in diagnostic file - if ( imkdata == 1 ) then +! if ( imkdata == 1 ) then iflag = 0 loopd: do while (iflag == 0) @@ -395,19 +395,6 @@ program time ! do j=1,n_chan -! write(6,*)' j, header_chan(j)%iuse, channel_count(j) = ', j, header_chan(j)%iuse, channel_count(j) -! if( header_chan(j)%iuse > 0.0 ) then -! write(6,*)' header_chan(j)%iuse > 0.0', header_chan(j)%iuse -! else -! write(6,*)' header_chan(j)%iuse <= 0.0', header_chan(j)%iuse -! endif - -! if( channel_count(j) < 1.0 ) then -! write(6,*)' channel_count(j) < 1.0', channel_count(j) -! else -! write(6,*)' channel_count(j) >= 1.0', channel_count(j) -! endif - if( header_chan(j)%iuse > 0.0 .and. channel_count(j) < 1.0 .AND. trim(gesanl) == 'ges' ) then write(6,*)' calling write_bad_chan, satname, j, nu_chan(j) = ', satname, j, nu_chan(j) call write_bad_chan( satname, nu_chan(j) ) @@ -435,60 +422,13 @@ program time end do write(6,*)'write output to lungrd=',lungrd,', file=',trim(data_file) close(lungrd) - endif +! endif ! Deallocate arrays write(6,*)' ' write(6,*)'deallocate arrays' deallocate(io_chan,nu_chan,wavenumbr,tot_cor,omg_nbc,omg_bc,count,& penalty,error,use,frequency) - goto 950 - -! Jump to here if eof or error reading diagnostic file. -900 continue - write(6,*)'***PROBLEM reading diagnostic file. diag_rad=',diag_rad - close(lndiag) - - n_chan=nchanl - if (n_chan<=0) then - write(6,*)'***ERROR*** invalid nchanl=',nchanl,' STOP program' - call errexit(93) - endif - - write(6,*)'load missing value ',rmiss,' into output arrays. ',& - nregion,n_chan - allocate(count(n_chan,nregion),penalty(n_chan,nregion),& - omg_nbc(n_chan,nregion,2),tot_cor(n_chan,nregion,2),& - omg_bc(n_chan,nregion,2)) - do ii=1,2 - do k=1,nregion - do j=1,n_chan - if (ii==1) then - count(j,k) = rmiss - penalty(j,k)= rmiss - endif - omg_nbc(j,k,ii) = rmiss - tot_cor(j,k,ii) = rmiss - omg_bc(j,k,ii) = rmiss - end do - end do - end do - - if ( imkdata == 1 ) then - open(lungrd,file=data_file,form='unformatted') - write(lungrd) ((count(j,k),j=1,n_chan),k=1,nregion) - write(lungrd) ((penalty(j,k),j=1,n_chan),k=1,nregion) - do ii=1,2 - write(lungrd) ((omg_nbc(j,k,ii),j=1,n_chan),k=1,nregion) - write(lungrd) ((tot_cor(j,k,ii),j=1,n_chan),k=1,nregion) - write(lungrd) ((omg_bc (j,k,ii),j=1,n_chan),k=1,nregion) - end do - write(6,*)'write output to lungrd=',lungrd,', file=',trim(data_file) - close(lungrd) - endif - deallocate(count,penalty,omg_nbc,tot_cor,omg_bc) -! End of program -950 continue stop end program time diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radtime.fd/valid.f90 b/util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radtime.fd/valid.f90 similarity index 94% rename from util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radtime.fd/valid.f90 rename to util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radtime.fd/valid.f90 index 445d5708c5..92596f2fce 100755 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/sorc/verf_radtime.fd/valid.f90 +++ b/util/Radiance_Monitor/nwprod/radmon_shared/sorc/verf_radtime.fd/valid.f90 @@ -128,27 +128,6 @@ subroutine load_base( satname, iret ) end do end do - !--------------------------------------------------- - ! adjust max_penalty values for iasi and cris - ! sources -- see explanation above - ! - -! multiply_by = 1 - -! if ( satname(1:4) == 'iasi' ) then -! multiply_by = 5 -! else if ( satname(1:4) == 'cris' ) then -! multiply_by = 6 -! end if - -! if ( multiply_by > 1 ) then -! do k=1,nregion -! do j=1,nchan -! max_penalty(j,k) = max_penalty(j,k) * multiply_by -! end do -! end do -! end if - iret = 0 base_loaded = .TRUE. else @@ -213,7 +192,8 @@ subroutine validate_count( channel, region, count, valid, avg_cnt, iret ) ! cnt is within 2 sdvs from avg ! sdv2 = 2 * sdv_count( channel, region ) - lo = avg_count(channel,region) - sdv2 +! lo = avg_count(channel,region) - sdv2 + lo = avg_count(channel,region) * 0.67 if( cnt >= lo ) then valid = .TRUE. diff --git a/util/Radiance_Monitor/nwprod/radmon_shared/ush/clean_tankdir.sh b/util/Radiance_Monitor/nwprod/radmon_shared/ush/clean_tankdir.sh new file mode 100755 index 0000000000..55634d2dbb --- /dev/null +++ b/util/Radiance_Monitor/nwprod/radmon_shared/ush/clean_tankdir.sh @@ -0,0 +1,123 @@ +#!/bin/bash + +#------------------------------------------------------------------ +# +# clean_tankdir.sh +# +#------------------------------------------------------------------ + + echo "--> clean_tankdir.sh" + rc=0 + + area=$1 + days_to_keep=$2 + echo " area, days_to_keep = ${area}, ${days_to_keep}" + + #--------------------------------------------------------------- + # Algorithm + # + # 1. Build list of $run.${PDY} || radmon.${PDY} sudirectories. + # 2. All subdirectories older than $days_to_keep get deleted. + #--------------------------------------------------------------- + if [[ ${area} = 'rgn' ]]; then + subdir="radmon" + else + subdir=${RUN} + fi + + echo "TANKverf = ${TANKverf}" + + dirs=`ls ${TANKverf}` + echo "dirs = ${dirs}" + + + if [[ ${area} = 'rgn' ]]; then + echo " in rgn" + #----------------------------------------------- + # Determine number of days from $PDATE for all + # directories that start with "radmon". Note + # that this expects the directories to be in + # the format of ${RUN}.yyyymmdd. + # + for dir in $dirs; do + file_name="${dir##*/}" + file="${file_name%.*}" + file_extension="${file_name##*.}" + echo "file, file_extension = ${file}, ${file_extension}" + + if [ ${file} = ${subdir} ]; then + + #---------------------------------------------- + # Use date utility to determine number of days + # from PDATE. Note that time difference is + # calculated in seconds, hence the division + # by the number of seconds/day. + # + days=$(( ($(date --date=${PDY} +%s) - $(date --date=${file_extension} +%s) )/(60*60*24) )) + echo "days = ${days}" + + #---------------------------------------- + # rm anything older than $days_to_keep + # + if [ $days -gt ${days_to_keep} ]; then + + cycle_dir="${TANKverf}/${dir}" + echo "cycle_dir = ${cycle_dir}" + + if [[ -d ${cycle_dir} ]]; then + echo "RM ${cycle_dir}" + rm -rf ${cycle_dir} + fi + fi + + fi + done + + else + + #----------------------------------------------- + # Determine number of days from $PDATE for all + # directories that start with "gdas". Note + # that this expects the directories to be in + # the format of ${RUN}.yyyymmdd. + # + for dir in $dirs; do + file_name="${dir##*/}" + file="${file_name%.*}" + file_extension="${file_name##*.}" + + if [ ${file} = ${subdir} ]; then + + #---------------------------------------------- + # Use date utility to determine number of days + # from PDATE. Note that time difference is + # calculated in seconds, hence the division + # by the number of seconds/day. + # + days=$(( ($(date --date=${PDY} +%s) - $(date --date=${file_extension} +%s) )/(60*60*24) )) + + #---------------------------------------- + # rm anything older than $days_to_keep + # + if [ $days -gt ${days_to_keep} ]; then + cycles="00 06 12 18" + + for cyc in $cycles; do + cycle_dir="${TANKverf}/${dir}/${cyc}/radmon" + if [[ -d ${cycle_dir} ]]; then + echo "RM ${cycle_dir}" + rm -rf ${cycle_dir} + fi + done + + fi + + fi + + done + fi + + echo "<-- clean_tankdir.sh" + +exit ${rc} + diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/ush/radmon_ck_stdout.sh b/util/Radiance_Monitor/nwprod/radmon_shared/ush/radmon_ck_stdout.sh similarity index 100% rename from util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/ush/radmon_ck_stdout.sh rename to util/Radiance_Monitor/nwprod/radmon_shared/ush/radmon_ck_stdout.sh diff --git a/util/Radiance_Monitor/nwprod/radmon_shared/ush/radmon_diag_ck.sh b/util/Radiance_Monitor/nwprod/radmon_shared/ush/radmon_diag_ck.sh new file mode 100755 index 0000000000..142e99f8c7 --- /dev/null +++ b/util/Radiance_Monitor/nwprod/radmon_shared/ush/radmon_diag_ck.sh @@ -0,0 +1,175 @@ +#!/bin/bash + +#---------------------------------------------------------------- +# Check the contents of the radstat file and compare to +# the ${run}_radmon_satype.txt file. Report any missing +# or zero sized diag files. +# + + function usage { + echo "Usage: radmon_diag_ck.sh -rad radstat --sat satype --out output " + echo "" + echo " -r,--rad radstat file (required)" + echo " File name or path to radstat file." + echo "" + echo " -s,--sat satype file (required)" + echo " File name or path to satype file." + echo "" + echo " -o,--out output file name (required)" + echo " File name for missing diag file report." + } + + +echo "--> radmon_diag_ck.sh" + + +#-------------------------- +# Process input arguments +# + nargs=$# + if [[ $nargs -ne 6 ]]; then + usage + exit 1 + fi + + while [[ $# -ge 1 ]] + do + key="$1" + echo $key + + case $key in + -r|--rad) + radstat_file="$2" + shift # past argument + ;; + -s|--sat) + satype_file="$2" + shift # past argument + ;; + -o|--out) + output_file="$2" + shift # past argument + ;; + *) + #unspecified key + echo " unsupported key = $key" + ;; + esac + + shift + done + +# set -ax + + echo " radstat_file = ${radstat_file}" + echo " satype_file = ${satype_file}" + echo " output_file = ${output_file}" + + missing_diag="" + zero_len_diag="" + + #--------------------------------------------- + # get list of diag files in the radstat file + # + radstat_contents=`tar -tf ${radstat_file} | grep '_ges' | + gawk -F"diag_" '{print $2}' | + gawk -F"_ges" '{print $1}'` + + + #--------------------------------------------- + # load contents of satype_file into an array + # + satype_contents=`cat ${satype_file}` + + + #------------------------------------------------- + # compare $satype_contents and $radstat_contents + # report anything missing + # + for sat in $satype_contents; do + test=`echo $radstat_contents | grep $sat` + + if [[ ${#test} -le 0 ]]; then + missing_diag="${missing_diag} ${sat}" + fi + + done + + echo "" + echo "missing_diag = ${missing_diag}" + echo "" + + + #--------------------------------------------------------- + # Check for zero sized diag files. The diag files in + # the radstat file (which is a tar file) are gzipped. + # I find that 0 sized, gzipped file has a size of ~52 + # (I assume that's for header and block size). + # + # So for this check we'll assume anything in the radstat + # file with a size of > 1000 bytes is suspect. (That's + # overkill, 100 is probably sufficient, but I'm the + # nervous type.) So we'll extract, uncompress, and check + # the actual file size of those. Anything with an + # uncompressed size of 0 goes on the zero_len_diag list. + # + verbose_contents=`tar -tvf ${radstat_file} | grep '_ges'` + + + #------------------------------------------------------- + # note: need to reset the IFS to line breaks otherwise + # the $vc value in the for loop below will break + # on all white space, not the line break. + SAVEIFS=$IFS + IFS=$(echo -en "\n\b") + + + for vc in ${verbose_contents}; do + + gzip_len=`echo ${vc} | gawk '{print $3}'` + + if [[ ${gzip_len} -le 1000 ]]; then + test_file=`echo ${vc} | gawk '{print $6}'` + tar -xf ${radstat_file} ${test_file} + + gunzip ${test_file} + unzipped_file=`echo ${test_file%.*}` + + uz_file_size=`ls -la ${unzipped_file} | gawk '{print $5}'` + + if [[ ${uz_file_size} -le 0 ]]; then + sat=`echo ${unzipped_file} | gawk -F"diag_" '{print $2}' | + gawk -F"_ges" '{print $1}'` + + zero_len_diag="${zero_len_diag} ${sat}" + fi + + rm -f ${unzipped_file} + fi + done + + IFS=${SAVEIFS} # reset IFS to default (white space) + + echo "" + echo "zero_len_diag = ${zero_len_diag}" + echo "" + + + #----------------------------------------- + # Write results to $output_file + # + if [[ ${#zero_len_diag} -gt 0 ]]; then + for zld in ${zero_len_diag}; do + echo " Zero Length diagnostic file: $zld" >> $output_file + done + fi + + if [[ ${#missing_diag} -gt 0 ]]; then + for md in ${missing_diag}; do + echo " Missing diagnostic file : $md" >> $output_file + done + fi + + +echo "<-- radmon_diag_ck.sh" +exit diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/ush/radmon_err_rpt.sh b/util/Radiance_Monitor/nwprod/radmon_shared/ush/radmon_err_rpt.sh similarity index 98% rename from util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/ush/radmon_err_rpt.sh rename to util/Radiance_Monitor/nwprod/radmon_shared/ush/radmon_err_rpt.sh index 4c7173ca7c..93cf376c9c 100755 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/ush/radmon_err_rpt.sh +++ b/util/Radiance_Monitor/nwprod/radmon_shared/ush/radmon_err_rpt.sh @@ -181,9 +181,9 @@ echo "have_diag_rpt = $have_diag_rpt" echo "$line2" >> $outfile fi - !----------------------------------------- - ! add hyperlink to warning entry - ! + #----------------------------------------- + # add hyperlink to warning entry + # line3=" http://www.emc.ncep.noaa.gov/gmb/gdas/radiance/es_rad/${RADMON_SUFFIX}/index.html?sat=${satname}®ion=${region}&channel=${channel}&stat=${type}" if [[ $channel -gt 0 ]]; then echo "$line3" >> $outfile diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/ush/radmon_verf_angle.sh b/util/Radiance_Monitor/nwprod/radmon_shared/ush/radmon_verf_angle.sh similarity index 92% rename from util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/ush/radmon_verf_angle.sh rename to util/Radiance_Monitor/nwprod/radmon_shared/ush/radmon_verf_angle.sh index 288630cc9a..b592c76990 100755 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/ush/radmon_verf_angle.sh +++ b/util/Radiance_Monitor/nwprod/radmon_shared/ush/radmon_verf_angle.sh @@ -27,10 +27,6 @@ # Imported Shell Variables: # RADMON_SUFFIX data source suffix # defauls to opr -# MAKE_CTL switch to construct the meta-data control file -# defaults to 1 (on) -# MAKE_DATA switch to construct the binary data file -# defaults to 1 (on) # EXECradmon executable directory # defaults to current directory # RAD_AREA global or regional flag @@ -76,9 +72,6 @@ rgnTM=${rgnTM:-} export PDATE=${1:-${PDATE:?}} -scr=radmon_verf_angle.sh -msg="${scr} HAS STARTED" -postmsg "$jlogfile" "$msg" echo " REGIONAL_RR, rgnHH, rgnTM = $REGIONAL_RR, $rgnHH, $rgnTM" netcdf_boolean=".false." if [[ $RADMON_NETCDF -eq 1 ]]; then @@ -103,8 +96,6 @@ export pgmout=${pgmout:-${jlogfile}} touch $pgmout # Other variables -MAKE_CTL=${MAKE_CTL:-1} -MAKE_DATA=${MAKE_DATA:-1} SATYPE=${SATYPE:-} VERBOSE=${VERBOSE:-NO} LITTLE_ENDIAN=${LITTLE_ENDIAN:-0} @@ -171,10 +162,10 @@ else fi if [[ $REGIONAL_RR -eq 1 ]]; then -! angl_file=${rgnHH}.angle.${data_file}.${rgnTM} +# angl_file=${rgnHH}.angle.${data_file}.${rgnTM} angl_file=${rgnHH}.${data_file}.${rgnTM} -! else -! angl_file=angle.${data_file} +# else +# angl_file=angle.${data_file} fi @@ -192,8 +183,6 @@ cat << EOF > input incr=${CYCLE_INTERVAL}, nchanl=${nchanl}, suffix='${RADMON_SUFFIX}', - imkctl=${MAKE_CTL}, - imkdata=${MAKE_DATA}, gesanl='${dtype}', little_endian=${LITTLE_ENDIAN}, rad_area='${RAD_AREA}', @@ -263,8 +252,6 @@ if [[ "$VERBOSE" = "YES" ]]; then echo $(date) EXITING $0 error code ${err} >&2 fi -msg="${scr} HAS ENDED" -postmsg "$jlogfile" "$msg" echo "<-- radmon_verf_angle.sh" exit ${err} diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/ush/radmon_verf_bcoef.sh b/util/Radiance_Monitor/nwprod/radmon_shared/ush/radmon_verf_bcoef.sh similarity index 92% rename from util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/ush/radmon_verf_bcoef.sh rename to util/Radiance_Monitor/nwprod/radmon_shared/ush/radmon_verf_bcoef.sh index 93c56226b0..14a5905a81 100755 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/ush/radmon_verf_bcoef.sh +++ b/util/Radiance_Monitor/nwprod/radmon_shared/ush/radmon_verf_bcoef.sh @@ -27,10 +27,6 @@ # Imported Shell Variables: # RADMON_SUFFIX data source suffix # defauls to opr -# MAKE_CTL switch to construct the meta-data control file -# defaults to 1 (on) -# MAKE_DATA switch to construct the binary data file -# defaults to 1 (on) # EXECradmon executable directory # defaults to current directory # FIXradmon fixed data directory @@ -72,10 +68,6 @@ # Command line arguments. export PDATE=${1:-${PDATE:?}} -scr=radmon_verf_bcoef.sh -msg="${scr} HAS STARTED" -postmsg "$jlogfile" "$msg" - netcdf_boolean=".false." if [[ $RADMON_NETCDF -eq 1 ]]; then netcdf_boolean=".true." @@ -97,8 +89,6 @@ pgmout=${pgmout:-${jlogfile}} touch $pgmout # Other variables -MAKE_CTL=${MAKE_CTL:-1} -MAKE_DATA=${MAKE_DATA:-1} RAD_AREA=${RAD_AREA:-glb} REGIONAL_RR=${REGIONAL_RR:-0} rgnHH=${rgnHH:-} @@ -190,8 +180,6 @@ cat << EOF > input idhh=-720, incr=${CYCLE_INTERVAL}, suffix='${RADMON_SUFFIX}', - imkctl=${MAKE_CTL}, - imkdata=${MAKE_DATA}, gesanl='${dtype}', little_endian=${LITTLE_ENDIAN}, netcdf=${netcdf_boolean}, @@ -246,7 +234,5 @@ if [[ "$VERBOSE" = "YES" ]]; then echo $(date) EXITING $0 with error code ${err} >&2 fi -msg="${scr} HAS ENDED" -postmsg "$jlogfile" "$msg" exit ${err} diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/ush/radmon_verf_bcor.sh b/util/Radiance_Monitor/nwprod/radmon_shared/ush/radmon_verf_bcor.sh similarity index 92% rename from util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/ush/radmon_verf_bcor.sh rename to util/Radiance_Monitor/nwprod/radmon_shared/ush/radmon_verf_bcor.sh index cfba7367de..553cb8111f 100755 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/ush/radmon_verf_bcor.sh +++ b/util/Radiance_Monitor/nwprod/radmon_shared/ush/radmon_verf_bcor.sh @@ -27,10 +27,6 @@ # Imported Shell Variables: # RADMON_SUFFIX data source suffix # defauls to opr -# MAKE_CTL switch to construct the meta-data control file -# defaults to 1 (on) -# MAKE_DATA switch to construct the binary data file -# defaults to 1 (on) # EXECradmon executable directory # defaults to current directory # RAD_AREA global or regional flag @@ -71,10 +67,6 @@ # Command line arguments. export PDATE=${1:-${PDATE:?}} -scr=radmon_verf_bcor.sh -msg="${scr} HAS STARTED" -postmsg "$jlogfile" "$msg" - if [[ "$VERBOSE" = "YES" ]]; then set -ax @@ -89,8 +81,6 @@ pgmout=${pgmout:-${jlogfile}} touch $pgmout # Other variables -MAKE_CTL=${MAKE_CTL:-1} -MAKE_DATA=${MAKE_DATA:-1} RAD_AREA=${RAD_AREA:-glb} SATYPE=${SATYPE:-} VERBOSE=${VERBOSE:-NO} @@ -181,8 +171,6 @@ cat << EOF > input incr=6, nchanl=${nchanl}, suffix='${RADMON_SUFFIX}', - imkctl=${MAKE_CTL}, - imkdata=${MAKE_DATA}, gesanl='${dtype}', little_endian=${LITTLE_ENDIAN}, rad_area='${RAD_AREA}', @@ -239,8 +227,5 @@ if [[ "$VERBOSE" = "YES" ]]; then echo $(date) EXITING $0 error code ${err} >&2 fi -msg="${scr} HAS ENDED" -postmsg "$jlogfile" "$msg" - exit ${err} diff --git a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/ush/radmon_verf_time.sh b/util/Radiance_Monitor/nwprod/radmon_shared/ush/radmon_verf_time.sh similarity index 92% rename from util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/ush/radmon_verf_time.sh rename to util/Radiance_Monitor/nwprod/radmon_shared/ush/radmon_verf_time.sh index ba42a0dba4..0b3506e20a 100755 --- a/util/Radiance_Monitor/nwprod/radmon_shared.v3.0.0/ush/radmon_verf_time.sh +++ b/util/Radiance_Monitor/nwprod/radmon_shared/ush/radmon_verf_time.sh @@ -33,10 +33,6 @@ # defaults to 1 (on) # RADMON_SUFFIX data source suffix # defauls to opr -# MAKE_CTL switch to construct the meta-data control file -# defaults to 1 (on) -# MAKE_DATA switch to construct the binary data file -# defaults to 1 (on) # EXECradmon executable directory # defaults to current directory # FIXgdas fixed data directory @@ -106,7 +102,6 @@ radmon_err_rpt=${radmon_err_rpt:-${USHradmon}/radmon_err_rpt.sh} base_file=${base_file:-$FIXgdas/gdas_radmon_base.tar} report=report.txt disclaimer=disclaimer.txt -region=region.txt diag_report=diag_report.txt diag_hdr=diag_hdr.txt @@ -130,8 +125,6 @@ fi DO_DIAG_RPT=${DO_DIAG_RPT:-1} DO_DATA_RPT=${DO_DATA_RPT:-1} RADMON_SUFFIX=${RADMON_SUFFIX:-opr} -MAKE_CTL=${MAKE_CTL:-1} -MAKE_DATA=${MAKE_DATA:-1} RAD_AREA=${RAD_AREA:-glb} REGIONAL_RR=${REGIONAL_RR:-0} rgnHH=${rgnHH:-} @@ -141,6 +134,7 @@ MAIL_TO=${MAIL_TO:-} MAIL_CC=${MAIL_CC:-} VERBOSE=${VERBOSE:-NO} LITTLE_ENDIAN=${LITTLE_ENDIAN:-0} +USE_MAIL=${USE_MAIL:-1} time_exec=radmon_time.x USE_ANL=${USE_ANL:-0} @@ -199,7 +193,6 @@ if [[ $err -eq 0 ]]; then if [[ ! -s ${type} ]]; then echo "ZERO SIZED: ${type}" - echo ${type} >> ${diag} continue fi @@ -240,8 +233,6 @@ cat << EOF > input incr=${CYCLE_INTERVAL}, nchanl=${nchanl}, suffix='${RADMON_SUFFIX}', - imkctl=${MAKE_CTL}, - imkdata=${MAKE_DATA}, gesanl='${dtype}', little_endian=${LITTLE_ENDIAN}, rad_area='${RAD_AREA}', @@ -313,25 +304,19 @@ RECEIVED. PLEASE DIRECT REPLIES TO edward.safford@noaa.gov *********************** WARNING *************************** EOF - cat << EOF > ${region} - Region Definitions: - - 1 Global (90S-90N, 0-360E) -EOF - #------------------------------------------------------------------- -# Check stdout file for any reported problem(s) reading the -# diagnostic file by calling ck_stdout.sh +# Check for missing diag files # - ${USHradmon}/radmon_ck_stdout.sh ${diag} + tmp_satype="./tmp_satype.txt" + echo ${SATYPE} > ${tmp_satype} + ${USHradmon}/radmon_diag_ck.sh --rad ${radstat} --sat ${tmp_satype} --out ${diag} if [[ -s ${diag} ]]; then cat << EOF > ${diag_hdr} -Problem Reading Diagnostic File + Problem Reading Diagnostic File - $PDATE Problems were encountered reading the diagnostic file for the following sources: @@ -341,21 +326,23 @@ EOF cat ${diag_hdr} >> ${diag_report} cat ${diag} >> ${diag_report} - echo End Problem Reading Diagnostic File >> ${diag_report} echo >> ${diag_report} - rm ${diag} ${diag_hdr} + rm ${diag_hdr} fi #------------------------------------------------------------------- -# mail error notifications or dump to log file - - if [[ -s ${diag_report} ]]; then - lines=`wc -l <${diag_report}` - echo "lines in diag_report = $lines" - +# move warning notification to TANKverf +# + if [[ -s ${diag} ]]; then + lines=`wc -l <${diag}` + echo "lines in diag = $lines" + if [[ $lines -gt 1 ]]; then cat ${diag_report} + cp ${diag} ${TANKverf_rad}/bad_diag.${PDATE} + else + rm ${diag_report} fi fi @@ -437,7 +424,7 @@ if [[ $DO_DATA_RPT -eq 1 ]]; then echo " do_pen, do_chan, do_cnt = $do_pen, $do_chan, $do_cnt" echo " diag_report = $diag_report " - if [[ $do_pen -eq 1 || $do_chan -eq 1 || $do_cnt -eq 1 ]]; then + if [[ $do_pen -eq 1 || $do_chan -eq 1 || $do_cnt -eq 1 || -s ${diag_report} ]]; then if [[ $do_pen -eq 1 ]]; then @@ -466,19 +453,25 @@ if [[ $DO_DATA_RPT -eq 1 ]]; then # put together the unified error report with any obs, chan, and # penalty problems and mail it - if [[ -s ${obs_err} || -s ${pen_err} || -s ${chan_err} || -s ${count_err} ]]; then + if [[ -s ${obs_err} || -s ${pen_err} || -s ${chan_err} || -s ${count_err} || -s ${diag_report} ]]; then echo DOING ERROR REPORTING - echo "Begin Cycle Data Integrity Report" > $report +# echo "Begin Cycle Data Integrity Report" > $report - cat << EOF >> $report -Cycle Data Integrity Report - $PDATE + cat << EOF > $report +Radiance Monitor warning report + + Net: ${RADMON_SUFFIX} + Run: ${RUN} + Cycle: $PDATE EOF - cat ${region} >> $report + if [[ -s ${diag_report} ]]; then + echo OUTPUTING DIAG_REPORT + cat ${diag_report} >> $report + fi if [[ -s ${chan_err} ]]; then @@ -534,8 +527,13 @@ EOF rm -f ${pen_err} fi - echo End Cycle Data Integrity Report >> $report - echo >> $report +# if [[ $USE_MAIL -eq 1 ]]; then + echo >> $report + cat ${disclaimer} >> $report +# else +# echo End Cycle Data Integrity Report >> $report + echo >> $report +# fi fi #------------------------------------------------------------------- @@ -545,6 +543,8 @@ EOF lines=`wc -l <${report}` if [[ $lines -gt 2 ]]; then cat ${report} + + $NCP ${report} ${TANKverf_rad}/warning.${PDATE} fi fi @@ -565,6 +565,8 @@ EOF if [[ -s ${low_count} ]]; then $NCP ${low_count} ${TANKverf_rad}/. fi + + fi for type in ${SATYPE}; do diff --git a/util/Radiance_Monitor/parm/Makefile.conf.theia b/util/Radiance_Monitor/parm/Makefile.conf.theia deleted file mode 100755 index d890db2160..0000000000 --- a/util/Radiance_Monitor/parm/Makefile.conf.theia +++ /dev/null @@ -1,24 +0,0 @@ -# This config file contains the compile options for compilation -# of the RadMon code on Zeus. - -# ---------------------------------- -# Redefine variables for Zeus -# ---------------------------------- - CORELIB = /scratch3/NCEPDEV/nwprod/lib - -# ---------------------------- -# Fortran compiler and options -# ---------------------------- - - CF = ifort - FC = $(CF) - - FFLAGS = -O3 -fp-model strict -D_REAL8_ -traceback -convert big_endian -assume byterecl - -# ------------------ -# Linker and options -# ------------------ - - LIBS = -L$(CORELIB) -lw3nco_4 - LDFLAGS = - diff --git a/util/Radiance_Monitor/parm/Makefile.conf.wcoss b/util/Radiance_Monitor/parm/Makefile.conf.wcoss deleted file mode 100755 index 9cba163a3e..0000000000 --- a/util/Radiance_Monitor/parm/Makefile.conf.wcoss +++ /dev/null @@ -1,26 +0,0 @@ -# This config file contains the compile options for compilation -# of the RadMon code on WCOSS. - -# ---------------------------------- -# Redefine variables for WCOSS -# ---------------------------------- - CORELIB = /nwprod/lib - W3NCO_VER = v2.0.6 - W3NCO_LIB4=$(CORELIB)/w3nco/$(W3NCO_VER)/libw3nco_$(W3NCO_VER)_4.a - -# ---------------------------- -# Fortran compiler and options -# ---------------------------- - - CF = ifort - FC = $(CF) - - FFLAGS = -O3 -fp-model strict -D_REAL8_ -traceback -convert big_endian -assume byterecl - -# ------------------ -# Linker and options -# ------------------ - - LIBS = $(W3NCO_LIB4) - LDFLAGS = - diff --git a/util/Radiance_Monitor/parm/README b/util/Radiance_Monitor/parm/README index df05ba31a3..891900a829 100644 --- a/util/Radiance_Monitor/parm/README +++ b/util/Radiance_Monitor/parm/README @@ -9,32 +9,7 @@ specific entries in that script within your interactive shell. If you have not done so already, please run the RadMon_install.sh script located in the directory one level from here. RadMon_install.sh will update the RadMon_config and RadMon_user_settings files and set some defaults based -on the system you're running on (wcoss or theia). It will also run the makeall.sh -script which will build all the necessary executables and move them to the -appropriate exec directories within the package. - -Next, edit or override specific values in the RadMon_user_settings script as -necessary. For example, the default $RADSTAT_LOCATION, or directory which -contains the *.radstat files you want to process, is set by default to -/com2/gfs/prod. You may edit this location in the file to anything you want -or set a value for $RADSTAT_LOCATION in your shell. The values of any -variables in RadMon_user_settings will be overriden by the same variables -declared in your interactive shell. To override the RADSTAT_LOCATION the -the command is generally: - -> export RADSTAT_LOCATION=/my/directory/not/the/default - -Depending on which interactive shell you are using the command might be -slightly different. The above example works on csh and bash. - -If you are working from a centrally installed RadMon package supporting -multiple users you will probably want to define $MY_TANKDIR to someplace in your -local filespace. - -If you want to swap in your own copy of either the RadMon_config or -RadMon_user_settings files you can similarly declare that within your -shell: - -> export RADMON_CONFIG=/my/directory/not/the/default/my_radmon_config -> export RADMON_USER_SETTINGS=/my/directory/not/the/default/my_radmon_user_settings +on the system you're running on (wcoss_c|d or hera). It will also run the +makeall.sh script which will build all the necessary executables and move +them to the appropriate exec directories within the package. diff --git a/util/Radiance_Monitor/parm/RadMon_config b/util/Radiance_Monitor/parm/RadMon_config index 908c2553a5..fc0918a77f 100644 --- a/util/Radiance_Monitor/parm/RadMon_config +++ b/util/Radiance_Monitor/parm/RadMon_config @@ -20,7 +20,7 @@ export MONITOR=radmon # you checked out only the Radiance_Monitor portion of the branch then # MY_RADMON should point to that. # -export MY_RADMON=${MY_RADMON:-/gpfs/dell2/emc/modeling/noscrub/Edward.Safford/ProdGSI/util/Radiance_Monitor} +export MY_RADMON=${MY_RADMON:-/gpfs/dell2/emc/modeling/noscrub/Edward.Safford/GSI/util/Radiance_Monitor} # # The MY_TANKDIR will be the location for the extracted data files and @@ -28,7 +28,7 @@ export MY_RADMON=${MY_RADMON:-/gpfs/dell2/emc/modeling/noscrub/Edward.Safford/Pr # and the succedding scripts will construct and use subdirectories under # this location. # -export MY_TANKDIR=${MY_TANKDIR:-/gpfs/dell2/emc/modeling/noscrub/Edward.Safford/nbns} +export MY_TANKDIR=${MY_TANKDIR:-/u/Edward.Safford/nbns} export RUN=${RUN:-gdas} @@ -79,29 +79,16 @@ export PTMP_USER=${PTMP_USER:-${MY_PTMP}/${LOGNAME}} export MY_STMP=${MY_STMP:-/gpfs/dell2/stmp} export STMP_USER=${STMP_USER:-${MY_STMP}/${LOGNAME}} -export LOGSverf_rad=${LOGSverf_rad:-${PTMP_USER}/logs} -export LOGSverf=${LOGSverf_rad:-${PTMP_USER}/logs/rad${RADMON_SUFFIX}} - LOGdir=${LOGdir:-${PTMP_USER}/logs/${RADMON_SUFFIX}} if [[ $TANK_USE_RUN -eq 1 ]]; then LOGdir=${LOGdir}/${RUN} fi export LOGdir=${LOGdir}/radmon -export PLOT_WORK_DIR=${PLOT_WORK_DIR:-${STMP_USER}/plotjobs_${RADMON_SUFFIX}} +export PLOT_WORK_DIR=${PLOT_WORK_DIR:-${STMP_USER}/${RADMON_SUFFIX}/${RUN}/radmon/plot} export WORKverf_rad=${WORKverf_rad:-${STMP_USER}} -# -# Job queue check definition -# -if [[ $MY_MACHINE = "wcoss" ]]; then - export CHECKQ=${CHECKQ:-"bjobs"} -else - export CHECKQ=${CHECKQ:-"showq -u $LOGNAME"} -fi - - # # Definitions for internal reference # @@ -118,18 +105,16 @@ export IG_SCRIPTS=${IG_SCRIPTS:-${RADMON_IMAGE_GEN}/ush} export RADMON_PARM=${RADMON_PARM:-${MY_RADMON}/parm} -. $RADMON_PARM/radmon.ver - -export HOMEgdas=${HOMEgdas:-${MY_RADMON}/nwprod/gdas_radmon.${gdas_radmon_ver}} +export HOMEgdas=${HOMEgdas:-${MY_RADMON}/nwprod/gdas_radmon} export HOMEgfs=${HOMEgfs:-${HOMEgdas}} -export HOMEnam=${HOMEnam:-${MY_RADMON}/nwprod/nam_radmon.${nam_radmon_ver}} -export HOMEradmon=${HOMEradmon:-${MY_RADMON}/nwprod/radmon_shared.${radmon_shared_ver}} +export HOMEnam=${HOMEnam:-${MY_RADMON}/nwprod/nam_radmon} +export HOMEradmon=${HOMEradmon:-${MY_RADMON}/nwprod/radmon_shared} export FIXgdas=${FIXgdas:-${HOMEgdas}/fix} export PARMgdas=${PARMgdas:-${HOMEgdas}/parm} export parm_file=${parm_file:-${PARMgdas}/gdas_radmon.parm} -export DATAROOT=${DATAROOT:-${STMP_USER}} +export DATAROOT=${DATAROOT:-${STMP_USER}/${RADMON_SUFFIX}/${RUN}/radmon} # # Definitions for parm files. This allows users to swap in @@ -146,27 +131,22 @@ export RADMON_USER_SETTINGS=${RADMON_USER_SETTINGS:-${RADMON_PARM}/RadMon_user_s export NCP=${NCP:-"/bin/cp -f"} export Z=${Z:-"gz"} -if [[ $MY_MACHINE = "wcoss" ]]; then - shell=sh - . /usrx/local/Modules/default/init/${shell} - module load lsf - module load prod_util - - export SUB="bsub" - export NWPROD=/nwprod - export NDATE=${NWPROD}/util/exec/ndate - export COMPRESS=/usrx/local/bin/pigz - export UNCOMPRESS="/usrx/local/bin/unpigz -f" - -elif [[ $MY_MACHINE = "wcoss_d" ]]; then +if [[ $MY_MACHINE = "wcoss_d" ]]; then shell=sh source /usrx/local/prod/lmod/lmod/init/${shell} export MODULEPATH=/usrx/local/prod/lmod/lmod/modulefiles/Core:/usrx/local/prod/modulefiles/core_third:/usrx/local/prod/modulefiles/defs:/gpfs/dell1/nco/ops/nwprod/modulefiles/core_prod:/usrx/local/dev/modulefiles + + module purge + module load ips/18.0.1.163 + module load impi/18.0.1 + module load NetCDF-parallel/4.7.4 + + module load HDF5-parallel/1.10.6 module load metplus/2.1 module load lsf/10.1 - module load prod_util/1.1.2 + module load prod_util/1.1.5 module load GrADS/2.2.0 export GRADS=`which grads` @@ -174,7 +154,7 @@ elif [[ $MY_MACHINE = "wcoss_d" ]]; then export COMPRESS=/usr/bin/gzip export UNCOMPRESS="/usr/bin/gunzip -f" -elif [[ $MY_MACHINE = "cray" ]]; then +elif [[ $MY_MACHINE = "wcoss_c" ]]; then . /opt/modules/3.2.6.7/init/sh module use -a /gpfs/hps/nco/ops/nwprod/modulefiles module load prod_util # defines $NDATE among other things @@ -184,39 +164,20 @@ elif [[ $MY_MACHINE = "cray" ]]; then export COMPRESS="gzip -f" export UNCOMPRESS="gunzip -f" -elif [[ $MY_MACHINE = "theia" ]]; then +elif [[ $MY_MACHINE = "hera" ]]; then + + module load grads/2.2.1 + export GRADS=`which grads` + export STNMAP=`which stnmap` export SUB=/apps/slurm/default/bin/sbatch - NWPROD=${NWPROD:-/scratch4/NCEPDEV/global/save/glopara/nwpara/util} - NWPRODush=${NWPRODush:=${NWPROD}/ush} - NWPRODexec=${NWPRODexec:=${NWPROD}/exec} - export NDATE=${NDATE:-${NWPRODexec}/ndate} - export COMPRESS=gzip - export UNCOMPRESS="gunzip -f" - export LOADLQ="squeue -u $LOGNAME" - - #------------------------------------------------------------------------ - # The links below are a hack around the modules that are available - # on the wcoss ibm & cray machines but not here on theia. The alternative - # was a bunch of contitional executions within the scripts to avoid the - # nco mandated log and error requirements. - #------------------------------------------------------------------------ + export NDATE=/home/Edward.Safford/bin/ndate + export COMPRESS=${COMPRESS:-gzip} + export UNCOMPRESS=${UNCOMPRESS:-"gunzip -f"} + prevday=`$NDATE -24 $PDATE` export PDYm1=`echo $prevday | cut -c1-8` - ln -s ${NWPRODush}/startmsg.sh ${STMP_USER}/startmsg - ln -s ${NWPRODush}/postmsg.sh ${STMP_USER}/postmsg - ln -s ${NWPRODush}/prep_step.sh ${STMP_USER}/prep_step - ln -s ${NWPRODush}/err_chk.sh ${STMP_USER}/err_chk - export PATH=$PATH:${STMP_USER} - - #------------------------------------------------------------------------ - # err_chk "helpfully" calls postmsg.sh directly so we need to override - # the utilscript location on theia to defeat err_chk's helpfulness and - # avoid a fatal error. - #------------------------------------------------------------------------ - export utilscript=${utilscript:-${NWPRODush}} - - + fi diff --git a/util/Radiance_Monitor/parm/RadMon_user_settings b/util/Radiance_Monitor/parm/RadMon_user_settings index 6541dae1f2..f14fc0bd14 100644 --- a/util/Radiance_Monitor/parm/RadMon_user_settings +++ b/util/Radiance_Monitor/parm/RadMon_user_settings @@ -22,7 +22,7 @@ export PROJECT=${PROJECT:-GDAS-T2O} # JOB_QUEUE is used on wcoss only with the bjob -q flag. It is # empty on other platforms. # -export JOB_QUEUE=${JOB_QUEUE:-dev} +export JOB_QUEUE=${JOB_QUEUE:-dev_shared} # # RAD_AREA is either glb (global) or rgn (regional) @@ -55,11 +55,6 @@ export PLOT_ALL_REGIONS=${PLOT_ALL_REGIONS:-1} # such as the 7 day avgs in the summary plots. 0 = off, 1 = on export PLOT_SUB_AVGS=${PLOT_SUB_AVGS:-1} -# -# PLOT_HORIZ switches on/off plotting of horizontal data. 0=off, 1 = on. -# -export PLOT_HORIZ=${PLOT_HORIZ:-0} - # # PLOT_STATIC_IMGS switches on/off generation of static summary image plots. # Image plotting is moving towards client browser drawn images and plotting @@ -78,23 +73,11 @@ export PLOT_STATIC_IMGS=${PLOT_STATIC_IMGS:-0} # files. export USE_TM=${USE_TM:-tm12} -# -# DO_ARCHIVE switches on archiving of extracted data files. This is generally -# used for the operational data sets (GDAS, NDAS) and isn't normally necessary -# for parallels. 0 = off, 1 = on -export DO_ARCHIVE=${DO_ARCHIVE:-0} -export ARCHIVE_DIR=${ARCHIVE_DIR:-' '} - -# -# HPSS_DIR is the location for archived data on the hpss. It will only -# be used if DO_ARCHIVE is set to on (1). -export HPSS_DIR=${HPSS_DIR:-/NCEPDEV/hpssuser/g01/Edward.Safford/nbns/stats} - # # USE_STATIC_SATYPE switches on/off use of static satype list. This is primarily # intended for use with diagnotic file error reporting and isn't needed # for most parallels. 0 = off, 1 = on -export USE_STATIC_SATYPE=${USE_STATIC_SATYPE:-0} +export USE_STATIC_SATYPE=${USE_STATIC_SATYPE:-1} # # DO_DIAG_RPT switches on/off the diagnostic error reporting. This is check @@ -103,26 +86,29 @@ export USE_STATIC_SATYPE=${USE_STATIC_SATYPE:-0} # is desirable. It is not normally necessary in parallels. 0 = off, 1 = on export DO_DIAG_RPT=${DO_DIAG_RPT:-0} + # DO_DATA_RPT switches on/off error checking and reporting of the penalty values # by channel for each sat/instrument source. This is a check primarily intended # for use iwth the operational data sets (GDAS,NDAS) where detection and # reporting of drifting channel(s) on specific sat/instrument sources is # desirable. It is not normally necesary to apply this to parallels. 0 = off, 1 = on export DO_DATA_RPT=${DO_DATA_RPT:-0} -export MAIL_TO=${MAIL_TO:-' '} -export MAIL_CC=${MAIL_CC:-' '} -# -# RUN_ONLY_ON_DEV switches on/off the constraint to run only on the development machine. -# 0 = prod or dev, 1 = dev only. -# -export RUN_ONLY_ON_DEV=${RUN_ONLY_ON_DEV:-1} + +export MAIL_TO=${MAIL_TO:-'edward.safford@noaa.gov'} + +if [[ -e /u/${LOGNAME}/bin/get_cc_list.pl ]]; then + cc_list=`/u/${LOGNAME}/bin/get_cc_list.pl --nr ${RADMON_SUFFIX}_${RUN} --mon RadMon` + else + cc_list="" + fi +export MAIL_CC=${MAIL_CC:=${cc_list}} # # KEEPDATA switches on/off allowing the work directory to remain after data extraction. # YES=keep working directory, NO=rm working directory. # -export KEEPDATA=${KEEPDATA:-"YES"} +export KEEPDATA=${KEEPDATA:-"NO"} # # REGIONAL_RR flags the data source as a regional rapid refresh. The output data files @@ -134,7 +120,11 @@ export REGIONAL_RR=${REGIONAL_RR:-0} # CYCLE_INTERVAL indicates the period of time between cycle runs for any given # data source. This is generally 6 hrs, but can be 3 or 1 hr for rapid refresh sources. # -export CYCLE_INTERVAL=${CYCLE_INTERVAL:-6} +if [[ ${RAD_AREA} = "rgn" ]]; then + export CYCLE_INTERVAL=${CYCLE_INTERVAL:-1} +else + export CYCLE_INTERVAL=${CYCLE_INTERVAL:-6} +fi # # RUN_TRANSFER allows for an immediate invocation of the Transfer.sh script @@ -142,4 +132,11 @@ export CYCLE_INTERVAL=${CYCLE_INTERVAL:-6} # # 0 = do not run transfer, 1 = run transfer # -export RUN_TRANSFER=${RUN_TRANSFER:-0} +export RUN_TRANSFER=${RUN_TRANSFER:-1} + +# +# CLEAN_TANKDIR orders automatic delete of data files in $TANKverf deleted +# if older than 40 days. +# +# 0 = do not clean TANKverf, 1 = clean TANKverf +export CLEAN_TANKVERF=${CLEAN_TANKVERF:-1} diff --git a/util/Radiance_Monitor/parm/radmon.ver b/util/Radiance_Monitor/parm/radmon.ver deleted file mode 100644 index 54ab33160c..0000000000 --- a/util/Radiance_Monitor/parm/radmon.ver +++ /dev/null @@ -1,3 +0,0 @@ -export gdas_radmon_ver=v3.0.0 -export nam_radmon_ver=v2.0.0 -export radmon_shared_ver=v3.0.0 diff --git a/util/bufr_tools/CMakeLists.txt b/util/bufr_tools/CMakeLists.txt index c271543f68..093c19ea4f 100644 --- a/util/bufr_tools/CMakeLists.txt +++ b/util/bufr_tools/CMakeLists.txt @@ -6,56 +6,45 @@ cmake_minimum_required(VERSION 2.6) set_source_files_properties( ${LOCAL_SRC} PROPERTIES COMPILE_FLAGS ${UTIL_COM_Fortran_FLAGS} ) add_executable(bufr_append_sample.x bufr_append_sample.f90 ) - add_dependencies( bufr_append_sample.x ${BUFR_LIBRARY} ) set_target_properties( bufr_append_sample.x PROPERTIES COMPILE_FLAGS ${UTIL_COM_Fortran_FLAGS} ) target_link_libraries( bufr_append_sample.x ${BUFR_LIBRARY} ) add_executable(bufr_decode_sample.x bufr_decode_sample.f90 ) - add_dependencies( bufr_decode_sample.x ${BUFR_LIBRARY} ) set_target_properties( bufr_decode_sample.x PROPERTIES COMPILE_FLAGS ${UTIL_COM_Fortran_FLAGS} ) target_link_libraries( bufr_decode_sample.x ${BUFR_LIBRARY} ) add_executable(bufr_encode_sample.x bufr_encode_sample.f90 ) - add_dependencies( bufr_encode_sample.x ${BUFR_LIBRARY} ) set_target_properties( bufr_encode_sample.x PROPERTIES COMPILE_FLAGS ${UTIL_COM_Fortran_FLAGS} ) target_link_libraries( bufr_encode_sample.x ${BUFR_LIBRARY} ) add_executable(bufr_decode_radiance.x bufr_decode_radiance.f90 ) - add_dependencies( bufr_decode_radiance.x ${BUFR_LIBRARY} ) set_target_properties( bufr_decode_radiance.x PROPERTIES COMPILE_FLAGS ${UTIL_COM_Fortran_FLAGS} ) target_link_libraries( bufr_decode_radiance.x ${BUFR_LIBRARY} ) add_executable(prepbufr_decode_all.x prepbufr_decode_all.f90 ) - add_dependencies( prepbufr_decode_all.x ${BUFR_LIBRARY} ) set_target_properties( prepbufr_decode_all.x PROPERTIES COMPILE_FLAGS ${UTIL_COM_Fortran_FLAGS} ) target_link_libraries( prepbufr_decode_all.x ${BUFR_LIBRARY} ) add_executable(prepbufr_encode_surface.x prepbufr_encode_surface.f90 ) - add_dependencies( prepbufr_encode_surface.x ${BUFR_LIBRARY} ) set_target_properties( prepbufr_encode_surface.x PROPERTIES COMPILE_FLAGS ${UTIL_COM_Fortran_FLAGS} ) target_link_libraries( prepbufr_encode_surface.x ${BUFR_LIBRARY} ) add_executable(prepbufr_encode_upperair.x prepbufr_encode_upperair.f90 ) - add_dependencies( prepbufr_encode_upperair.x ${BUFR_LIBRARY} ) set_target_properties( prepbufr_encode_upperair.x PROPERTIES COMPILE_FLAGS ${UTIL_COM_Fortran_FLAGS} ) target_link_libraries( prepbufr_encode_upperair.x ${BUFR_LIBRARY} ) add_executable(prepbufr_inventory.x prepbufr_inventory.f90 ) - add_dependencies( prepbufr_inventory.x ${BUFR_LIBRARY} ) set_target_properties( prepbufr_inventory.x PROPERTIES COMPILE_FLAGS ${UTIL_COM_Fortran_FLAGS} ) target_link_libraries( prepbufr_inventory.x ${BUFR_LIBRARY} ) add_executable(prepbufr_append_retrieve.x prepbufr_append_retrieve.f90 ) - add_dependencies( prepbufr_append_retrieve.x ${BUFR_LIBRARY} ) set_target_properties( prepbufr_append_retrieve.x PROPERTIES COMPILE_FLAGS ${UTIL_COM_Fortran_FLAGS} ) target_link_libraries( prepbufr_append_retrieve.x ${BUFR_LIBRARY} ) add_executable(prepbufr_append_surface.x prepbufr_append_surface.f90 ) - add_dependencies( prepbufr_append_surface.x ${BUFR_LIBRARY} ) set_target_properties( prepbufr_append_surface.x PROPERTIES COMPILE_FLAGS ${UTIL_COM_Fortran_FLAGS} ) target_link_libraries( prepbufr_append_surface.x ${BUFR_LIBRARY} ) add_executable(prepbufr_append_upperair.x prepbufr_append_upperair.f90 ) - add_dependencies( prepbufr_append_upperair.x ${BUFR_LIBRARY} ) set_target_properties( prepbufr_append_upperair.x PROPERTIES COMPILE_FLAGS ${UTIL_COM_Fortran_FLAGS} ) target_link_libraries( prepbufr_append_upperair.x ${BUFR_LIBRARY} ) diff --git a/util/ndate/CMakeLists.txt b/util/ndate/CMakeLists.txt index 10316106a7..70b3d1ad3c 100644 --- a/util/ndate/CMakeLists.txt +++ b/util/ndate/CMakeLists.txt @@ -4,6 +4,5 @@ cmake_minimum_required(VERSION 2.6) set_source_files_properties( ${NDATE_SRC} PROPERTIES COMPILE_FLAGS ${NDATE_Fortran_FLAGS} ) add_executable( ndate.x ${NDATE_SRC} ) - add_dependencies( ndate.x ${W3NCO_4_LIBRARY} ) target_link_libraries( ndate.x ${W3NCO_4_LIBRARY} ) diff --git a/util/netcdf_io/calc_analysis.fd/CMakeLists.txt b/util/netcdf_io/calc_analysis.fd/CMakeLists.txt index 06927e8e7c..45d7484741 100644 --- a/util/netcdf_io/calc_analysis.fd/CMakeLists.txt +++ b/util/netcdf_io/calc_analysis.fd/CMakeLists.txt @@ -8,6 +8,6 @@ if(BUILD_NCIO_UTIL) set_target_properties( calc_analysis.x PROPERTIES COMPILE_FLAGS ${UTIL_Fortran_FLAGS} ) set_target_properties( calc_analysis.x PROPERTIES Fortran_MODULE_DIRECTORY ${Util_MODULE_DIRECTORY} ) SET( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_Fortran_FLAGS}" ) - include_directories( ${UTIL_INC} ${NEMSIOINC} ${NETCDF_INCLUDES} ${MPI_Fortran_INCLUDE_PATH} ${FV3GFS_NCIO_INCS}) - target_link_libraries( calc_analysis.x ${NEMSIO_LIBRARY} ${BACIO_LIBRARY} ${W3NCO_4_LIBRARY} ${NETCDF_LIBRARIES_F90} ${NETCDF_LIBRARIES} ${MPI_Fortran_LIBRARIES} ${HDF5_Fortran_HL_LIBRARIES} ${HDF5_LIBRARIES} ${ZLIB_LIBRARIES} ${CURL_LIBRARIES} ${FV3GFS_NCIO_LIBRARIES}) + include_directories( ${UTIL_INC} ${NEMSIOINC} ${NETCDF_INCLUDE_DIRS} ${MPI_Fortran_INCLUDE_PATH} ${FV3GFS_NCIO_INCS}) + target_link_libraries( calc_analysis.x ${FV3GFS_NCIO_LIBRARIES} ${NEMSIO_LIBRARY} ${BACIO_LIBRARY} ${W3NCO_4_LIBRARY} ${NETCDF_Fortran_LIBRARIES} ${NETCDF_C_LIBRARIES} ${MPI_Fortran_LIBRARIES} ) endif() diff --git a/util/netcdf_io/interp_inc.fd/CMakeLists.txt b/util/netcdf_io/interp_inc.fd/CMakeLists.txt index 98abb9c90c..5881fbf229 100644 --- a/util/netcdf_io/interp_inc.fd/CMakeLists.txt +++ b/util/netcdf_io/interp_inc.fd/CMakeLists.txt @@ -8,6 +8,6 @@ if(BUILD_NCIO_UTIL) set_target_properties( interp_inc.x PROPERTIES COMPILE_FLAGS ${UTIL_Fortran_FLAGS} ) set_target_properties( interp_inc.x PROPERTIES Fortran_MODULE_DIRECTORY ${Util_MODULE_DIRECTORY} ) SET( CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_Fortran_FLAGS}" ) - include_directories( ${UTIL_INC} ${NETCDF_INCLUDES} ${MPI_Fortran_INCLUDE_PATH}) - target_link_libraries( interp_inc.x ${W3NCO_4_LIBRARY} ${NETCDF_LIBRARIES_F90} ${NETCDF_LIBRARIES} ${MPI_Fortran_LIBRARIES} ${HDF5_Fortran_HL_LIBRARIES} ${HDF5_LIBRARIES} ${ZLIB_LIBRARIES} ${CURL_LIBRARIES} ${IP_LIBRARY} ${SP_LIBRARY}) + include_directories( ${UTIL_INC} ${NETCDF_INCLUDE_DIRS} ${MPI_Fortran_INCLUDE_PATH}) + target_link_libraries( interp_inc.x ${W3NCO_4_LIBRARY} ${NETCDF_Fortran_LIBRARIES} ${NETCDF_C_LIBRARIES} ${MPI_Fortran_LIBRARIES} ${IP_LIBRARY} ${SP_LIBRARY}) endif() diff --git a/util/radar_process/reflectivity/CMakeLists.txt b/util/radar_process/reflectivity/CMakeLists.txt index edb1cbcba3..85922a290e 100644 --- a/util/radar_process/reflectivity/CMakeLists.txt +++ b/util/radar_process/reflectivity/CMakeLists.txt @@ -1,9 +1,9 @@ cmake_minimum_required(VERSION 2.6) file(GLOB LOCAL_SRC ${CMAKE_CURRENT_SOURCE_DIR}/*.f90) set_source_files_properties( ${LOCAL_SRC} PROPERTIES COMPILE_FLAGS ${UTIL_COM_Fortran_FLAGS} ) - include_directories( ${NETCDF_INCLUDES} ${MPI_Fortran_INCLUDE_PATH} ) + include_directories( ${NETCDF_INCLUDE_DIRS} ${MPI_Fortran_INCLUDE_PATH} ) add_executable(process_NSSL_mosaic.x ${LOCAL_SRC} ) - add_dependencies(process_NSSL_mosaic.x ${GSILIB} ${GSISHAREDLIB} ${BUFR_LIBRARY} ) + add_dependencies(process_NSSL_mosaic.x ${GSILIB} ${GSISHAREDLIB} ) set_target_properties( process_NSSL_mosaic.x PROPERTIES COMPILE_FLAGS ${UTIL_COM_Fortran_FLAGS} ) - target_link_libraries( process_NSSL_mosaic.x ${GSISHAREDLIB} ${BUFR_LIBRARY} ${NETCDF_LIBRARIES} ${MPI_Fortran_LIBRARIES} ) + target_link_libraries( process_NSSL_mosaic.x ${GSISHAREDLIB} ${BUFR_LIBRARY} ${NETCDF_Fortran_LIBRARIES} ${NETCDF_C_LIBRARIES} ${MPI_Fortran_LIBRARIES} )