diff --git a/util/Ozone_Monitor/CMakeLists.txt b/util/Ozone_Monitor/CMakeLists.txt index b8f928a61d..03f5129cfc 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,20 +64,40 @@ 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() + + 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}") + 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) + if(NETCDF4) + if(CMAKE_MAJOR_VERSION GREATER 2) + find_package( ZLIB ) + endif() + find_package( CURL ) endif() + 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) @@ -86,4 +106,3 @@ 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(data_xtrct/sorc/make_base.fd) - diff --git a/util/Ozone_Monitor/nwprod/gdas_oznmon.v2.0.0/fix/gdas_oznmon_base.tar b/util/Ozone_Monitor/nwprod/gdas_oznmon.v2.0.0/fix/gdas_oznmon_base.tar new file mode 100644 index 0000000000..0526bd1b1e Binary files /dev/null and b/util/Ozone_Monitor/nwprod/gdas_oznmon.v2.0.0/fix/gdas_oznmon_base.tar differ 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.v2.0.0/sorc/oznmon_horiz.fd/horiz.f90 index 60744fdde2..497fc1802f 100644 --- a/util/Ozone_Monitor/nwprod/oznmon_shared.v2.0.0/sorc/oznmon_horiz.fd/horiz.f90 +++ b/util/Ozone_Monitor/nwprod/oznmon_shared.v2.0.0/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 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.v2.0.0/sorc/oznmon_horiz.fd/oznmon_read_diag.f90 similarity index 90% 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.v2.0.0/sorc/oznmon_horiz.fd/oznmon_read_diag.f90 index 7e592d3a5e..b2c59e9bb8 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.v2.0.0/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 @@ -715,12 +708,13 @@ subroutine read_ozndiag_data_nc( ftin, header_fix, data_fix, data_nlev, data_ext data_fix(ii)%obstime = obstime(ii + ((ii-1)*nlevs) ) 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) ) @@ -769,23 +763,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-1 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 +825,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 +840,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 +865,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 +873,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 +885,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 +962,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/read_diag.f90 b/util/Ozone_Monitor/nwprod/oznmon_shared.v2.0.0/sorc/oznmon_time.fd/oznmon_read_diag.f90 similarity index 90% 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.v2.0.0/sorc/oznmon_time.fd/oznmon_read_diag.f90 index 7e592d3a5e..b2c59e9bb8 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.v2.0.0/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 @@ -715,12 +708,13 @@ subroutine read_ozndiag_data_nc( ftin, header_fix, data_fix, data_nlev, data_ext data_fix(ii)%obstime = obstime(ii + ((ii-1)*nlevs) ) 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) ) @@ -769,23 +763,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-1 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 +825,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 +840,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 +865,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 +873,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 +885,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 +962,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.v2.0.0/sorc/oznmon_time.fd/time.f90 index d6402196aa..d9010cdbd9 100755 --- a/util/Ozone_Monitor/nwprod/oznmon_shared.v2.0.0/sorc/oznmon_time.fd/time.f90 +++ b/util/Ozone_Monitor/nwprod/oznmon_shared.v2.0.0/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 diff --git a/util/Ozone_Monitor/nwprod/oznmon_shared.v2.0.0/ush/ozn_xtrct.sh b/util/Ozone_Monitor/nwprod/oznmon_shared.v2.0.0/ush/ozn_xtrct.sh index 5ee05253fe..f05b0081b3 100755 --- a/util/Ozone_Monitor/nwprod/oznmon_shared.v2.0.0/ush/ozn_xtrct.sh +++ b/util/Ozone_Monitor/nwprod/oznmon_shared.v2.0.0/ush/ozn_xtrct.sh @@ -75,7 +75,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 @@ -153,8 +153,7 @@ else #--------------------------------------------------------------------------- - # 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" for ptype in ${ozn_ptype}; do