diff --git a/CMakeLists.txt b/CMakeLists.txt index c7ccd01..f776e3f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,8 +6,27 @@ option(OPENMP "Build crtm with OpenMP support" ON) list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) set(CMAKE_DIRECTORY_LABELS ${PROJECT_NAME}) -set(CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_BINARY_DIR} CACHE PATH "default install path" ) -message("CMAKE_INSTALL_PREFIX set to ${CMAKE_INSTALL_PREFIX}") + +# Set the default install path to /lib, but allow overriding + +#set(CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_BINARY_DIR} CACHE PATH "default install path") +if( CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT ) + set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR} CACHE PATH "Install path prefix" FORCE) +endif() + +# Include GNUInstallDirs to get the standard installation directory variables +include(GNUInstallDirs) + +# Force the installation directory for libraries to be "lib" regardless of architecture +set(CMAKE_INSTALL_LIBDIR "${CMAKE_INSTALL_PREFIX}" CACHE STRING "Installation directory for libraries" FORCE) + +# Set output directory for built libraries to /lib +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) + +# Optionally, set the runtime output directory (for executables) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) + # Function to get the current git commit hash function(get_git_hash result) @@ -31,6 +50,12 @@ set(GREEN "${ESCAPE}[32m") # Output the project name, version, and hash in green text message(STATUS "${GREEN}[${PROJECT_NAME}] (${PROJECT_VERSION}) [${PROJECT_HASH}]${RESET}") +# Output the various install/output paths +message("CMAKE_INSTALL_PREFIX set to ${CMAKE_INSTALL_PREFIX}") +message("CMAKE_INSTALL_LIBDIR set to ${CMAKE_INSTALL_LIBDIR}") +message("CMAKE_LIBRARY_OUTPUT_DIRECTORY set to ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}") + + ## Configuration options include(${PROJECT_NAME}_compiler_flags) include(GNUInstallDirs) @@ -69,6 +94,10 @@ configure_file( ) # Installation +set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin ) +set( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib ) +set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib ) + install(TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}-config ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} @@ -101,6 +130,8 @@ export(EXPORT ${PROJECT_NAME}-config FILE "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-targets.cmake" ) +set(CRTM_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) + add_subdirectory(test) include(CTest) @@ -127,4 +158,7 @@ else() message(STATUS "No build type specified, defaulting to Release.") endif() -set(crtm_LIBRARIES crtm) +#export the CRTM_SOURCE_DIR for use in the test framework (ensures compatibility with jedi-bundle) + + +#set(crtm_LIBRARIES crtm) diff --git a/Get_CRTM_Binary_Files.sh b/Get_CRTM_Binary_Files.sh index bb4fd18..8f17bc7 100755 --- a/Get_CRTM_Binary_Files.sh +++ b/Get_CRTM_Binary_Files.sh @@ -1,9 +1,9 @@ -#https://bin.ssec.wisc.edu/pub/s4/CRTM/fix_REL-3.1.1.0.tgz (use this for jedi and stand-alone, some files have changed). +#https://bin.ssec.wisc.edu/pub/s4/CRTM/fix_REL-3.1.1.2.tgz (use this for jedi and stand-alone, some files have changed). # This script is used to manually download the tarball of binary and netcdf coefficient files. # The same files also download automatically during the cmake step, so you don't have to actually run this manually. -foldername="fix_REL-3.1.1.0" +foldername="fix_REL-3.1.1.2" filename="${foldername}.tgz" echo "$filename" break @@ -20,7 +20,7 @@ if test -f "$filename"; then fi else #download, untar, move - echo "Downloading $filename, please wait about 5 minutes (4 GB tar file)" + echo "Downloading $filename, please wait about 7 minutes (7 GB tar file: sorry!)" wget https://bin.ssec.wisc.edu/pub/s4/CRTM/$filename # CRTM binary files, add "-q" to suppress output. #untar the file and move directory to fix diff --git a/README.md b/README.md index 4a153cf..d54fc1c 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -CRTM REL-3.1.0 +CRTM REL-3.1.1 ==================== [![Build Status](https://app.travis-ci.com/JCSDA-internal/crtm.svg?token=r6aaq9P13fHcTi8yBgdM&branch=develop)](https://app.travis-ci.com/JCSDA-internal/crtm) @@ -6,8 +6,9 @@ CRTM REL-3.1.0 Preamble -------- -CRTM v3.1.0 release (`REL-3.1.0`) +CRTM v3.1.1 release (`REL-3.1.1`) +v3.1.1 released August 12, 2024 v3.1.0 (alpha) Released October 31, 2023 v3.0.0 Released March, 2023 v2.4.1-alpha Released on April 1, 2021 (internal realease only) @@ -17,7 +18,7 @@ This is an experimental release of CRTM v3.0, some features may not be fully fun v3.x features will be rolled out in incremental updates. Basic requirements: -(1) A Fortran 2003 compatible compiler +(1) A Fortran 2008 compatible compiler (2) A netCDF4 / HDF5 library that has been built with the compiler you're going to use (module environments are helpful here) (3) A linux, macOS, or unix-style environment. This has not been tested under any Windows Fortran environments. (4) Bash shell is preferred. @@ -26,7 +27,7 @@ Basic requirements: ========================================================= -**JEDI NOTE** This develop branch is also designed to work directly in a JEDI container or JEDI environment. If you're doing JEDI things, you're probably in the right spot. However, you should stop reading right now and have a look at the README_JEDI.md file. +**JEDI NOTE** This release branch is also designed to work directly in a JEDI container or JEDI environment. If you're doing JEDI things, you're probably in the right spot. However, you should stop reading right now and have a look at the README_JEDI.md file. If you're looking for an older version of CRTM (v2.3.0 or older) you should obtain the appropriate tarball from https://bin.ssec.wisc.edu/pub/s4/CRTM/ OR https://github.com/JCSDA/crtm (old versions). @@ -55,12 +56,9 @@ Contents Configuration, building, and testing the library ================================================ -JCSDA CRTM v3.0.x Build Instructions +JCSDA CRTM v3.1.1 Build Instructions -- Development Repository Build -- Note: the development repository build differs from a release build. - -The CRTM **development** repository directory structure looks like: +The CRTM repository directory structure looks (something) like:
  .
@@ -117,26 +115,42 @@ But after a clean clone of the development repository, none of the links to sour
 
 Configuration
 -------------
-At present, the `fix/` directory is provided either through ftp or during the ctest step. We're working on a way to make the process of getting binary data equitable and easy for all users.
+At present, the `fix/` directory is provided through ftp using the Get_CRTM_Binary_Files.sh script to obtain and unpack the dataset. 
+If this directory doesn't exist during the `cmake` step, then cmake will download and install into `build/test_data/fix_REL-3.1.1.x/fix/`...
 
-The files therein are gzipped (*.gz extension).  Use the Get_CRTM_Binary_Files.sh script to obtain and unpack the dataset.    
+The fix/ directory (as of v3.1.1) contains most of the netCDF SpcCoeff and TauCoeff files, as part of our ongoing effort to transition toward netCDF-only CRTM.  We expect to deprecate the binary formats in v3.2.x 
 
-As of CRTM v3.0.0, we no longer support legacy build system using autotools. (i.e., configure/make).  Only cmake / ecbuild (a cmake wrapper, but not required) is supported. 
+As of CRTM v3.0.0, we no longer support legacy build system using autotools. (i.e., configure/make).  Only cmake / ecbuild (a cmake wrapper, but not required) is supported.   Many standalone Makefiles, make.dependencies, etc. have been removed, but not entirely.  Cleanup occurs as we work our way through the repository updating other things.  
 
 **Build Step 1**
 From the top level of the CRTM directory, e.g., `CRTMv3/` 
 
 mkdir build/
 cd build/
-cmake ..
+cmake -D ..
 make clean
 make -j8
+make install (optional, see -DCMAKE_INSTALL_PREFIX below, default install location is `/.`)
 ctest -j8
 
`-j8` runs 8 processes in parallel, adjust to your system. Now we have compiled the linked source codes that reside in the `src/` directory, and the ctests are built as well. +The CMake variables of interest are: +`-DCMAKE_BUILD_TYPE = RELEASE / DEBUG / RELWITHDEBINFO` (default is `RELEASE` if not specified) +`-DCMAKE_SHARED_LIBS = ON / OFF` (build shared lib (`/lib/libcrtm.so`) or static lib (`/lib/libcrtm.a`) -- default is `ON` if not specified) +`-DCMAKE_INSTALL_PREFIX=` (You have to run `make install` to install the libcrtm* into your desired directory `/path-to-install`). + + +example: +``` +cmake -DCMAKE_BUILD_TYPE=DEBUG -DCMAKE_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX=./install .. +``` +this would make a debug build of CRTM, static library (`libcrtm.a`) and set the optional install location to `/install/.` (or something similar, search for `libcrtm.*` and `*.mod`). Custom Install only happens if you issue the `make install` command. + +The first time you run `cmake`, it will check for a `fix/` directory one level above, and if it does't find it, it will download the binary files (according to `test/CMakeLists.txt` file information), and store them in `/test_data/**`. + Linking to the library ---------------------- @@ -152,15 +166,16 @@ LIBS="-lcrtm ${LIBS}" **Feedback and Contact Information** -CRTM SUPPORT EMAIL: crtm-support@googlegroups.com OR visit https://forums.jcsda.org/ +CRTM SUPPORT: visit https://forums.jcsda.org/ or visit https://github.com/JCSDA/CRTMv3 and post an issue (be sure to assign someone from the team). -If you have problems building the library please include the generated "config.log" file in your email correspondence. Known Issues ------------ (1) Any "Transmitance Coefficient" generation codes included in src/ are not functional. Contact CRTM support above for details. -(2) No testing was done on PGI, XLF, or other less commonr compilers. Feedback from users suggest that there's no major concerns though. Please contact us with specifics. +(2) No testing was done on PGI, XLF, or other less common compilers. Feedback from users suggest that there's no major concerns though. Please contact us with specifics. Tested on GCC v5 and higher, and ifort v18 and higher. Some specific compiler versions have issues, contact support if you run into problems. + + diff --git a/TEST_CRTM_Liu/README_testData b/TEST_CRTM_Liu/README_testData deleted file mode 100644 index 38a64d0..0000000 --- a/TEST_CRTM_Liu/README_testData +++ /dev/null @@ -1,12 +0,0 @@ - -The three data files CRTM_atm100.bin, CRTM_geo100.bin, CRTM_sfc100.bin in big endian - contain 100 profiles, which are constructed from 5000 ECMWF profiles. - 67 tmospheric profiles over water, - 23 profiles over land, - 6 profile over snow and - 5 profiles over ice - - The profile even number (2,4,...,100) are clear sky cases. The profile odd number is for - one type cloud. All profiles include one aerosol profile. - - Quanhua Liu diff --git a/cmake/compiler_flags_Intel_Fortran.cmake b/cmake/compiler_flags_Intel_Fortran.cmake index 134a0c5..f864319 100644 --- a/cmake/compiler_flags_Intel_Fortran.cmake +++ b/cmake/compiler_flags_Intel_Fortran.cmake @@ -1,16 +1,8 @@ -# (C) Copyright 2009-2016 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. - #################################################################### # FLAGS COMMON TO ALL BUILD TYPES #################################################################### -set( CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -assume byterecl -fPIC") +set( CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -assume byterecl") if( HAVE_AUTOPROFILE ) set( CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -finstrument-functions") @@ -28,6 +20,12 @@ set( CMAKE_Fortran_FLAGS_RELEASE "-O3 -ip -unroll -inline -no-heap-arrays" ) set( CMAKE_Fortran_FLAGS_DEBUG "-O0 -g -check bounds -traceback -warn -heap-arrays -fpe-all=0 -fpe:0 -ftz -check all" ) +#################################################################### +# RELEASE WITH DEBUG INFO FLAGS +#################################################################### + +set( CMAKE_Fortran_FLAGS_RELWITHDEBINFO "-O3 -ip -unroll -inline -g -DNDEBUG -check bounds -traceback -no-heap-arrays -assume byterecl" ) + #################################################################### # BIT REPRODUCIBLE FLAGS #################################################################### @@ -42,7 +40,4 @@ set( CMAKE_Fortran_LINK_FLAGS "" ) #################################################################### -# Meaning of flags -# ---------------- -# todo diff --git a/configuration/ftn.setup b/configuration/ftn.setup deleted file mode 100644 index fe5f3aa..0000000 --- a/configuration/ftn.setup +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh -#-------------------------------------------------------------------------------# -# PRODUCTION build settings for ftn compiler on EMC Linux Cray machine -#-------------------------------------------------------------------------------# - -export FC="ftn" - -export FCFLAGS="\ --O3 \ --axCore-AVX2 \ --fp-model source \ --convert big_endian \ --free \ --assume byterecl" - -export LDFLAGS="" - -export LIBS="" diff --git a/configuration/ftn.setup.csh b/configuration/ftn.setup.csh deleted file mode 100644 index b516544..0000000 --- a/configuration/ftn.setup.csh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/csh -#-------------------------------------------------------------------------------# -# PRODUCTION build settings for ftn compiler on EMC Linux Cray machine -#-------------------------------------------------------------------------------# - -setenv FC "ftn" -setenv FCFLAGS "-O3 -axCore-AVX2 -fp-model source -convert big_endian -free -assume byterecl" -setenv LDFLAGS "" -setenv LIBS "" diff --git a/configuration/g95-debug.setup.csh b/configuration/g95-debug.setup.csh deleted file mode 100644 index a6ce1eb..0000000 --- a/configuration/g95-debug.setup.csh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/csh -#-------------------------------------------------------------------------------# -# DEBUG build settings for Linux g95 compiler -#-------------------------------------------------------------------------------# - -setenv FC "g95" -setenv FCFLAGS "-fbounds-check -ffree-form -fno-second-underscore -ftrace=frame -malign-double -Wall" -setenv LDFLAGS "" -setenv LIBS "" - diff --git a/configuration/g95.setup.csh b/configuration/g95.setup.csh deleted file mode 100644 index f7ce791..0000000 --- a/configuration/g95.setup.csh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/csh -#-------------------------------------------------------------------------------# -# PRODUCTION build settings for Linux g95 compiler -#-------------------------------------------------------------------------------# - -setenv FC "g95" -setenv FCFLAGS "-O2 -ffast-math -ffree-form -fno-second-underscore -funroll-loops -malign-double" -setenv LDFLAGS "" -setenv LIBS "" diff --git a/configuration/gfortran-debug.setup b/configuration/gfortran-debug.setup deleted file mode 100644 index 62fab64..0000000 --- a/configuration/gfortran-debug.setup +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/sh -#-------------------------------------------------------------------------------# -# DEBUG build settings for Linux gfortran compiler -#-------------------------------------------------------------------------------# - -uname=$(uname -s) - -export FC="gfortran" - -if [[ "$uname" == "Linux" ]] ; then - export NC4_DIR=/usr/local/ #singularity container only - export HDF_DIR=/usr/local/ #singularity container only -elif [[ "$uname" == "Darwin" ]] ; then - export NC4_DIR="/usr/local/Cellar/netcdf/4.9.2_1" #mac OS, brew install - export NC4F_DIR="/usr/local/Cellar/netcdf-fortran/4.6.1" #mac OS, brew install - export HDF_DIR="/usr/local/Cellar/hdf5/1.14.3_1" #mac OS, brew install -fi - -#set the number of openmp threads -export OMP_NUM_THREADS=4 #set here for testing purposes, probably want to override this - -export FCFLAGS="\ --fbounds-check \ --mieee-fp \ --fimplicit-none \ --ffpe-trap=overflow,zero,invalid \ --ffree-form \ --fno-second-underscore \ --frecord-marker=4 \ --ggdb \ --fopenmp \ --Wall \ --Wconversion \ --std=f2008" - -export LDFLAGS="-fopenmp" - -export LIBS="" - -if [[ "$uname" == "Darwin" ]] || [[ "$uname" == "Linux" ]] ; then #mac OS, brew install or Linux (singularity) - export LIBS="\ - -L $NC4_DIR/lib -lnetcdf \ - -L $NC4F_DIR/lib -lnetcdff \ - -L $HDF_DIR/lib -lhdf5 \ - -I $NC4_DIR/include \ - -I $NC4F_DIR/include \ - -I $HDF_DIR/include " -else - export LIBS="" -fi - diff --git a/configuration/gfortran-debug.setup.csh b/configuration/gfortran-debug.setup.csh deleted file mode 100644 index b34c005..0000000 --- a/configuration/gfortran-debug.setup.csh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/csh -#-------------------------------------------------------------------------------# -# DEBUG build settings for Linux gfortran compiler -#-------------------------------------------------------------------------------# - -setenv FC "gfortran" -setenv FCFLAGS "-fbounds-check -fimplicit-none -ffpe-trap=overflow,zero,invalid -ffree-form -fno-second-underscore -frecord-marker=4 -ggdb -Wall -Wconversion -std=f2008" -setenv LDFLAGS "" -setenv LIBS "" diff --git a/configuration/gfortran.setup b/configuration/gfortran.setup deleted file mode 100644 index 64322e2..0000000 --- a/configuration/gfortran.setup +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/sh -#-------------------------------------------------------------------------------# -# PRODUCTION build settings for Linux gfortran compiler -#-------------------------------------------------------------------------------# - -uname=$(uname -s) - -export FC="gfortran" - -if [[ "$uname" == "Linux" ]] ; then - export NC4_DIR=/usr/local #singularity container only - export HDF_DIR=/usr/local #singularity container only -elif [[ "$uname" == "Darwin" ]] ; then - export NC4_DIR="/usr/local/Cellar/netcdf/4.9.2_1" - export NC4F_DIR="/usr/local/Cellar/netcdf-fortran/4.6.1" #mac OS (brew install) - export HDF_DIR="/usr/local/Cellar/hdf5/1.14.3_1" #mac OS (brew install) -fi - -#set the number of openmp threads -export OMP_NUM_THREADS=4 #set here for testing purposes, probably want to override this - -export FCFLAGS="\ --O3 \ --fimplicit-none \ --ffree-form \ --fno-second-underscore \ --frecord-marker=4 \ --funroll-loops \ --fopenmp \ --Wall \ --Wconversion \ --mieee-fp \ --fbounds-check \ --std=f2008" - -export LDFLAGS="-fopenmp" - -export LIBS="" - -if [[ "$uname" == "Darwin" ]] || [[ "$uname" == "Linux" ]] ; then #mac OS, brew install or linux (singularity) - export LIBS="\ - -L $NC4_DIR/lib -lnetcdf \ - -L $NC4F_DIR/lib -lnetcdff \ - -L $HDF_DIR/lib -lhdf5 \ - -I $NC4F_DIR/include \ - -I $NC4_DIR/include \ - -I $HDF_DIR/include " -else - export LIBS="" -fi diff --git a/configuration/gfortran.setup.csh b/configuration/gfortran.setup.csh deleted file mode 100644 index 0aa6314..0000000 --- a/configuration/gfortran.setup.csh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/csh -#-------------------------------------------------------------------------------# -# PRODUCTION build settings for Linux gfortran compiler -#-------------------------------------------------------------------------------# - -setenv FC "gfortran" -setenv FCFLAGS "-O3 -fimplicit-none -ffree-form -fno-second-underscore -frecord-marker=4 -funroll-loops -ggdb -Wall -Wconversion -std=f2008" -setenv LDFLAGS "" -setenv LIBS "" diff --git a/configuration/ifort-debug.setup b/configuration/ifort-debug.setup deleted file mode 100644 index d4866d3..0000000 --- a/configuration/ifort-debug.setup +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/sh -#-------------------------------------------------------------------------------# -# DEBUG build settings for Linux ifort compiler -#-------------------------------------------------------------------------------# - -hostname=$(hostname) -export FC="ifort" -export NC4_DIR="/opt/netcdf4/4.6.2-intel-18.0.3" -export HDF_DIR="/opt/hdf5/1.8.21-intel-18.0.3" -#export HDF4_DIR="/opt/hdf4/4.2.14-intel-18.0.3" - -export OMP_NUM_THREADS=4 #set here for testing purposes, probably want to override this - -export FCFLAGS="\ --g \ --check bounds \ --e08 \ --traceback \ --free \ --assume byterecl,realloc_lhs \ --qopenmp \ --fp-stack-check \ --mieee-fp" - -export LDFLAGS="-qopenmp" - -if [[ "$hostname" == "s4-submit.ssec.wisc.edu" ]] ; then #S4 - export LIBS="\ - -L $NC4_DIR/lib -lnetcdf -lnetcdff \ - -L $HDF_DIR/lib -lhdf5 \ - -g -fpp -traceback -check bounds \ - -I $NC4_DIR/include \ - -I $HDF_DIR/include " -else - export LIBS="" -fi - diff --git a/configuration/ifort-debug.setup.csh b/configuration/ifort-debug.setup.csh deleted file mode 100644 index 82c5fb8..0000000 --- a/configuration/ifort-debug.setup.csh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/csh -#-------------------------------------------------------------------------------# -# DEBUG build settings for Linux ifort compiler -#-------------------------------------------------------------------------------# - -setenv FC "ifort" -setenv FCFLAGS "-g -check bounds -e08 -traceback -free -assume byterecl,realloc_lhs -fp-stack-check -mieee-fp" -setenv LDFLAGS "" -setenv LIBS "" diff --git a/configuration/ifort.setup b/configuration/ifort.setup deleted file mode 100644 index fc241c8..0000000 --- a/configuration/ifort.setup +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/sh -#-------------------------------------------------------------------------------# -# PRODUCTION build settings for Linux ifort compiler -#-------------------------------------------------------------------------------# - -hostname=$(hostname) -export FC="ifort" - -export OMP_NUM_THREADS=4 #set here for testing purposes, probably want to override this - -export FCFLAGS="\ --O3 \ --fp-model source \ --e08 \ --free \ --qopenmp \ --assume byterecl,realloc_lhs" - -export LDFLAGS="-qopenmp" - -HDF5DISC="/usr/local/other/hdf5/1.13.0/intel-19.1.0.16_impi-20.0.0.166/" - -if [[ "$hostname" == "s4-submit.ssec.wisc.edu" ]] ; then #S4 - export LIBS="\ - -L ${NC4_LIB} -lnetcdf -lnetcdff \ - -L ${HDF5_LIB} -lhdf5 \ - -g -fpp -traceback -check bounds \ - -I ${NC4_INC} \ - -I ${HDF5_INC} " -elif [[ "$hostname" == "discover"* ]] ; then # NCCS Discover - export LIBS="\ - -L $NETCDF/lib -lnetcdf -lnetcdff \ - -L $HDF5DISC/lib -lhdf5 \ - -g -fpp -traceback -check bounds \ - -I $NETCDF/include \ - -I $HDF5DISC/include " -else - export LIBS="" -fi diff --git a/configuration/ifort.setup.csh b/configuration/ifort.setup.csh deleted file mode 100644 index 18ec964..0000000 --- a/configuration/ifort.setup.csh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/csh -#-------------------------------------------------------------------------------# -# PRODUCTION build settings for Linux ifort compiler -#-------------------------------------------------------------------------------# - -setenv FC "ifort" -setenv FCFLAGS "-O2 -fp-model source -free -e08 -assume byterecl,realloc_lhs" -setenv LDFLAGS "" -setenv LIBS "" diff --git a/configuration/pgf95-debug.setup b/configuration/pgf95-debug.setup deleted file mode 100644 index e5e956b..0000000 --- a/configuration/pgf95-debug.setup +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh -#-------------------------------------------------------------------------------# -# DEBUG build settings for Linux pgf95 compiler -#-------------------------------------------------------------------------------# - -export FC="pgf95" - -export FCFLAGS="\ --g \ --Ktrap=ovf,divz -Mdaz \ --Mbounds \ --Mchkstk \ --Mdclchk \ --Minform,inform \ --Mnosave \ --Mref_externals \ --Kieee" - -export LDFLAGS="-Kieee" - -export LIBS="" diff --git a/configuration/pgf95-debug.setup.csh b/configuration/pgf95-debug.setup.csh deleted file mode 100644 index 8401d37..0000000 --- a/configuration/pgf95-debug.setup.csh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/csh -#-------------------------------------------------------------------------------# -# DEBUG build settings for Linux pgf95 compiler -#-------------------------------------------------------------------------------# - -setenv FC "pgf95" -setenv FCFLAGS "-g -Ktrap=ovf,divz -Mdaz -Mbounds -Mchkstk -Mdclchk -Minform,inform -Mnosave -Mref_externals -Kieee" -setenv LDFLAGS "-Kieee" -setenv LIBS "" diff --git a/configuration/pgf95.setup b/configuration/pgf95.setup deleted file mode 100644 index 3231a9e..0000000 --- a/configuration/pgf95.setup +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh -#-------------------------------------------------------------------------------# -# PRODUCTION build settings for Linux pgf95 compiler -#-------------------------------------------------------------------------------# - -export FC="pgf95" - -export FCFLAGS="\ --g \ --fast" - -export LDFLAGS="" - -export LIBS="" diff --git a/configuration/pgf95.setup.csh b/configuration/pgf95.setup.csh deleted file mode 100644 index ead785e..0000000 --- a/configuration/pgf95.setup.csh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/csh -#-------------------------------------------------------------------------------# -# PRODUCTION build settings for Linux pgf95 compiler -#-------------------------------------------------------------------------------# - -setenv FC "pgf95" -setenv FCFLAGS "-g -fast" -setenv LDFLAGS "" -setenv LIBS "" diff --git a/configuration/xlf2003-debug.setup b/configuration/xlf2003-debug.setup deleted file mode 100644 index 3fef057..0000000 --- a/configuration/xlf2003-debug.setup +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh -#-------------------------------------------------------------------------------# -# DEBUG build settings for IBM AIX xlf2003 compiler -#-------------------------------------------------------------------------------# - -export FC="xlf2003" - -export FCFLAGS="\ --qcheck \ --qdbg \ --qextchk \ --qfloat=nomaf:rndsngl \ --qflttrap=ov:zero:en \ --qinitauto \ --qhalt=W \ --qlanglvl=2008pure \ --qmaxmem=-1 \ --qsuffix=f=f90:cpp=fpp:cpp=F90" - -export LDFLAGS="" - -export LIBS="" diff --git a/configuration/xlf2003-debug.setup.csh b/configuration/xlf2003-debug.setup.csh deleted file mode 100644 index 9cac6cb..0000000 --- a/configuration/xlf2003-debug.setup.csh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/csh -#-------------------------------------------------------------------------------# -# DEBUG build settings for IBM AIX xlf2003 compiler -#-------------------------------------------------------------------------------# - -setenv FC "xlf2003" -setenv FCFLAGS "-qcheck -qdbg -qextchk -qfloat=nomaf:rndsngl -qflttrap=ov:zero:en -qinitauto -qhalt=W -qlanglvl=2008pure -qmaxmem=-1 -qsuffix=f=f90:cpp=fpp:cpp=F90" -setenv LDFLAGS "" -setenv LIBS "" diff --git a/configuration/xlf2003.setup b/configuration/xlf2003.setup deleted file mode 100644 index d3e91c3..0000000 --- a/configuration/xlf2003.setup +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh -#-------------------------------------------------------------------------------# -# PRODUCTION build settings for IBM AIX xlf2003 compiler -#-------------------------------------------------------------------------------# - -export FC="xlf2003" - -export FCFLAGS="\ --qdbg \ --qarch=auto \ --qhalt=W \ --qlanglvl=2008pure \ --qsuffix=f=f90:cpp=F90 \ --qstrict \ --NS32768 \ --O3" - -export LDFLAGS="-O3" - -export LIBS="-lmass -lm" diff --git a/configuration/xlf2003.setup.csh b/configuration/xlf2003.setup.csh deleted file mode 100644 index 9c0f255..0000000 --- a/configuration/xlf2003.setup.csh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/csh -#-------------------------------------------------------------------------------# -# PRODUCTION build settings for IBM AIX xlf2003 compiler -#-------------------------------------------------------------------------------# - -setenv FC "xlf2003" -setenv FCFLAGS "-qdbg -qarch=auto -qhalt=W -qlanglvl=2008pure -qsuffix=f=f90:cpp=fpp:cpp=F90 -qstrict -NS32768 -O3" -setenv LDFLAGS "-O3" -setenv LIBS "-lmass -lm" diff --git a/scripts/shell/TauProd/tauprod_create_spccoeff.sh b/scripts/shell/TauProd/tauprod_create_spccoeff.sh deleted file mode 100755 index 9668cbd..0000000 --- a/scripts/shell/TauProd/tauprod_create_spccoeff.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/bash - -# -# Bash script to run the Create_SpcCoeff application for all the required -# sensors for which there are oSRF datafiles in this directory hierarchy. -# -# Format of the "create_spccoeff.config" include file is an array of descriptors -# including the sensor id and the final SpcCoeff data version number using ":" as -# the delimiter, e.g.: -# -# CONFIG=( [1]=sensor1_platform1:1 -# [2]=sensor1_platform2:4 -# ... -# [I]=sensorN_platformK:2 ) -# - -# Check for existence of SensorInfo -if [ ! -f SensorInfo ]; then - echo "SensorInfo file not found" - exit 1 -fi - - -# Link in the solar files -link_solar.sh -link_solar.sh dF_0.0025.Solar.nc - - -# Define the sensors to be processed and their **NEW** data version number -source ./tauprod_create_spccoeff.config - - -# Loop over the sensors to convert -for (( element = 1 ; element <= ${#CONFIG[@]} ; element++ )) do - - # Extract out sensor id and data version - sensor_id=`echo ${CONFIG[$element]} | cut -d: -f1` - version=`echo ${CONFIG[$element]} | cut -d: -f2` - - # Create data filename - osrf_filename="${sensor_id}.osrf.nc" - - # Run the conversion program - Create_SpcCoeff <<-EOF - ${sensor_id}/${osrf_filename} - ${version} - EOF - -done - - -# Clean up -rm -f *.Solar.nc *.signal diff --git a/scripts/shell/Utility/README.link_coeffs b/scripts/shell/Utility/README.link_coeffs deleted file mode 100644 index 06fff71..0000000 --- a/scripts/shell/Utility/README.link_coeffs +++ /dev/null @@ -1,208 +0,0 @@ -CRTM v2.1 link_coeff.sh Instructions -==================================== - -$Revision$ - - - CRTM SUPPORT EMAIL: ncep.list.emc.jcsda_crtm.support@noaa.gov - - -0) PREAMBLE ------------ - The coefficient files required to use the CRTM are distributed throughout subdirectories - that reflect their logical grouping (well, logical to me). - - However, the CRTM initialisation function, CRTM_Init(), only has a single argument to - specify the coefficient file path. What this means is that all of the coefficients have - to reside in a single directory. As some user's who are reading this will attest, moving, - copying, or linking all those files is not a simple task. - - Currently it's not possible to release the CRTM coefficient files in a single directory - (the best solution, and we're working on it). As a stop gap measure, we've put together - a little bash shell script to do the linking, "link_coeffs.sh". - - -1) ENVIRONMENT SETUP --------------------- - The main script, link_coeffs.sh, uses a bash shell helper script called "linkfiles.sh" - to search directory trees for requested files and then link them in. For the link_coeffs.sh - script to work this helper script linkfiles.sh *must* be executable AND in a directory - specified in your $PATH environment variable. - - Ideally (I hope obviously) both scripts should be in that $PATH location. - - -2) link_coeffs.sh HELP OUTPUT ------------------------------ - The script usage can be displayed via the -h command line argument, - - $ link_coeffs.sh -h - - $Revision$ $LastChangedDate: 2012-09-24 13:50:50 -0400 (Mon, 24 Sep 2012) $ - Mon Sep 24 14:04:18 EDT 2012 - Support email: NCEP.List.EMC.JCSDA_CRTM.Support@noaa.gov - - Usage: link_coeffs.sh [-xhla] source-dir dest-dir - - Link in CRTM release fixfiles into a single directory. - - Options: - -l - Link in little-endian files. BIG-ENDIAN is the default. - - -a - Link in ODAS TauCoeff files. ODPS is the default. - - Note: Currently there are no ODPS TauCoeff files - for visible sensors (we're working on it). - - -x - Turn on execution tracing - - -h - Print this message - - Arguments: - source-dir - The /fix directory location of the CRTM release. - This directory must already exist. - - dest-dir - The directory into which the coefficients will be linked. - If this directory does not exist, it is created. - - - I will reiterate some of the things mentioned in the above help output: - 1) BIG_ENDIAN files are linked by default. - 2) ODPS transmittance algorithm files are linked by default. - 3) There are no ODPS files for visible sensors. - - A consequence of #3 above means that the script has top be run twice if you want - to use visible sensors, but ODPS files for other (IR and MW) sensors. - - -3) link_coeffs.sh USAGE ------------------------ - Let's say you've built and installed the CRTM library in - - $HOME/local/REL-2.1 - - where $HOME is your user root directory. The release would contain - - local/REL-2.1 : ls -lhF - total 100K - -rw-r--r-- 1 user grp 9.7K Sep 20 14:38 README - drwxr-xr-x 2 user grp 4.0K Sep 20 14:17 configure/ - drwxr-xr-x 7 user grp 4.0K Sep 20 14:09 fix/ - drwxr-xr-x 2 user grp 12K Sep 20 14:45 libsrc/ - -rw-r--r-- 1 user grp 21K Sep 20 14:38 make.macros - -rw-r--r-- 1 user grp 1002 Sep 20 14:38 make.rules - -rw-r--r-- 1 user grp 1.8K Sep 20 14:38 makefile - drwxr-xr-x 4 user grp 4.0K Sep 20 14:13 test/ - - - And let's further say that you want to link all of the files into the main /fix - subdirectory that contains all the subdirectories that in turn contain all the - coefficient files. - - Currently, the /fix directory contains, - - local/REL-2.1 : ls -lhF fix - total 40K - drwxr-xr-x 4 user grp 4.0K Sep 20 14:30 AerosolCoeff/ - drwxr-xr-x 4 user grp 4.0K Sep 20 14:30 CloudCoeff/ - drwxr-xr-x 12 user grp 4.0K Sep 20 14:09 EmisCoeff/ - drwxr-xr-x 4 user grp 4.0K Sep 20 14:30 SpcCoeff/ - drwxr-xr-x 4 user grp 4.0K Sep 20 14:09 TauCoeff/ - - If you invoke the script like so - - local/REL-2.1 : link_coeffs.sh fix fix - - the output will look like - - $Revision$ $LastChangedDate: 2012-09-24 13:50:50 -0400 (Mon, 24 Sep 2012) $ - Mon Sep 24 16:47:40 EDT 2012 - Support email: NCEP.List.EMC.JCSDA_CRTM.Support@noaa.gov - - Linking coefficient files from root source directory, - /usr1/user/local/REL-2.1/fix - to destination directory, - fix - - ...linking sensor-independent coefficient files... - linkfiles.sh: Searching for files to link... - - ...linking SpcCoeff coefficient files... - linkfiles.sh: Searching for files to link... - - ...linking TauCoeff coefficient files... - linkfiles.sh: Searching for files to link... - - If you now inspect the /fix subdirectory you should see something like: - - local/REL-2.1 : ls -lhF fix | more - total 8.3M - drwxr-xr-x 4 user grp 4.0K Sep 20 14:30 AerosolCoeff/ - lrwxrwxrwx 1 user grp 71 Sep 24 16:47 AerosolCoeff.bin -> .../local/REL-2.1/fix/AerosolCoeff/Big_Endian/AerosolCoeff.bin - drwxr-xr-x 4 user grp 4.0K Sep 20 14:30 CloudCoeff/ - lrwxrwxrwx 1 user grp 67 Sep 24 16:47 CloudCoeff.bin -> .../local/REL-2.1/fix/CloudCoeff/Big_Endian/CloudCoeff.bin - drwxr-xr-x 12 user grp 4.0K Sep 20 14:09 EmisCoeff/ - lrwxrwxrwx 1 user grp 90 Sep 24 16:47 FASTEM4.MWwater.EmisCoeff.bin -> .../local/REL-2.1/fix/EmisCoeff/MW_Water/Big_Endian/FASTEM4.MWwater.EmisCoeff.bin - lrwxrwxrwx 1 user grp 90 Sep 24 16:47 FASTEM5.MWwater.EmisCoeff.bin -> .../local/REL-2.1/fix/EmisCoeff/MW_Water/Big_Endian/FASTEM5.MWwater.EmisCoeff.bin - lrwxrwxrwx 1 user grp 96 Sep 24 16:47 IGBP.IRland.EmisCoeff.bin -> .../local/REL-2.1/fix/EmisCoeff/IR_Land/SEcategory/Big_Endian/IGBP.IRland.EmisCoeff.bin - ...etc... - lrwxrwxrwx 1 user grp 79 Sep 24 16:47 iasi616_metop-b.SpcCoeff.bin -> .../local/REL-2.1/fix/SpcCoeff/Big_Endian/iasi616_metop-b.SpcCoeff.bin - lrwxrwxrwx 1 user grp 84 Sep 24 16:47 iasi616_metop-b.TauCoeff.bin -> .../local/REL-2.1/fix/TauCoeff/ODPS/Big_Endian/iasi616_metop-b.TauCoeff.bin - ...etc... - - where all of the files are linked in. - - If you also wanted to be able to use the visible sensor coefficients, you will need to run - the script a second time specifying the "-a" command line option to select the ODAS files - for those instruments, e.g. - - local/REL-2.1 : link_coeffs.sh -a fix fix - - $Revision$ $LastChangedDate: 2012-09-24 13:50:50 -0400 (Mon, 24 Sep 2012) $ - Mon Sep 24 16:55:53 EDT 2012 - Support email: NCEP.List.EMC.JCSDA_CRTM.Support@noaa.gov - - Linking coefficient files from root source directory, - /usr1/user/local/REL-2.1/fix - to destination directory, - fix - - ...linking sensor-independent coefficient files... - linkfiles.sh: Searching for files to link... - linkfiles.sh: All required files are present so nothing to do. Exiting. - - ...linking SpcCoeff coefficient files... - linkfiles.sh: Searching for files to link... - linkfiles.sh: All required files are present so nothing to do. Exiting. - - ...linking TauCoeff coefficient files... - linkfiles.sh: Searching for files to link... - - where you will see the visible sensor files: - - local/REL-2.1 : ls -lhF fix | grep "ODAS" - lrwxrwxrwx 1 user grp 77 Sep 24 16:55 v.abi_gr.TauCoeff.bin -> .../local/REL-2.1/fix/TauCoeff/ODAS/Big_Endian/v.abi_gr.TauCoeff.bin - lrwxrwxrwx 1 user grp 85 Sep 24 16:55 v.avhrr3_metop-a.TauCoeff.bin -> .../local/REL-2.1/fix/TauCoeff/ODAS/Big_Endian/v.avhrr3_metop-a.TauCoeff.bin - ...etc... - - - Note that the script will not link "over" already existing links in the directory. that's - what the - - linkfiles.sh: All required files are present so nothing to do. Exiting. - - output means. - - -4) FEEDBACK AND CONTACT INFO ----------------------------- - That's it. Any questions or bug reports or suggestions for improvement/features - can be sent to CRTM Support at - - ncep.list.emc.jcsda_crtm.support@noaa.gov diff --git a/scripts/shell/Utility/crtm_cleanup.sh b/scripts/shell/Utility/crtm_cleanup.sh deleted file mode 100755 index 5ec94ed..0000000 --- a/scripts/shell/Utility/crtm_cleanup.sh +++ /dev/null @@ -1,171 +0,0 @@ -#!/bin/bash - -# Script to clean up a CRTM working copy, removing the library build products -# as well as the regression builds and results. -# -# $Id$ - -script_id() -{ - REVISION='$Revision$' - LAST_CHANGED_DATE='$LastChangedDate$' - echo - echo "${SCRIPT_NAME} ${REVISION} ${LAST_CHANGED_DATE}" - echo " "`date` - echo " Support email: NCEP.List.EMC.JCSDA_CRTM.Support@noaa.gov" -} - -usage() -{ - echo - echo " Usage: crtm_cleanup.sh [-hx]" - echo - echo " Script to clean up a CRTM working copy, removing the library build" - echo " products as well as the regression builds and results." - echo - echo " Options:" - echo " -h" - echo " Print this message and exit" - echo - echo " -x" - echo " Turn on execution tracing" - echo - echo -} - -error_message() -{ - MESSAGE=$1 - echo >&2 - echo " *********************" >&2 - echo " ${SCRIPT_NAME}(ERROR): ${MESSAGE}" >&2 - echo " *********************" >&2 -} - - -info_message() -{ - MESSAGE=$1 - echo " ${SCRIPT_NAME}(INFORMATION): ${MESSAGE}" -} - - - -######################################################################## -# MAIN SCRIPT BEGINS # -######################################################################## - -# Setup -SCRIPT_NAME=`basename $0` -# ...Definitions -SUCCESS=0; TRUE=0 -FAILURE=1; FALSE=1 -REMOVE="rm -fr" - - -# Parse the command line options -while getopts :hx OPTVAL; do - # Exit if option argument looks like another option - case ${OPTARG} in - -*) break ;; - esac - # Parse the valid options - case ${OPTVAL} in - h) usage | more; exit ${SUCCESS} ;; - x) script_id; set -x ;; - \?) OPTVAL=${OPTARG}; break ;; - esac -done -# ...Remove the options processed -shift $((OPTIND - 1)) -# ...Output invalidities based on OPTVAL -case ${OPTVAL} in - # If OPTVAL contains nothing, then all options - # have been successfully parsed - \?) : ;; - # Invalid option - ?) usage - error_message "Invalid option '-${OPTARG}'" - exit ${FAILURE} ;; -esac - - -# ================= -# Start the cleanup -# ================= - -CURRENT_DIR=${PWD} - -# Determine the CRTM version -CRTM_VERSION=`tr -d "'" < ${CRTM_SOURCE_ROOT}/CRTM_Version.inc` -CRTM_LIB_DIR="crtm_${CRTM_VERSION}" - - -# Clean up the library -cd ${CRTM_SOURCE_ROOT}/Build -if [ $? -ne 0 ]; then - error_message "Error changing to CRTM build directory, ${CRTM_SOURCE_ROOT}/Build" - cd ${CURRENT_DIR}; exit ${FAILURE} -fi -# ...Use makefile if it exists -if [ -f Makefile ]; then - # Uninstall library - make uninstall - if [ $? -ne 0 ]; then - error_message "Error uninstalling CRTM library" - cd ${CURRENT_DIR}; exit ${FAILURE} - fi - # Clean up build products - make distclean - if [ $? -ne 0 ]; then - error_message "Error cleaning up CRTM library build products" - cd ${CURRENT_DIR}; exit ${FAILURE} - fi -# ...Otherwise just delete the directory -elif [ -d ${CRTM_LIB_DIR} ]; then - # Explicitly delete the library directory - ${REMOVE} ${CRTM_LIB_DIR} - if [ $? -ne 0 ]; then - error_message "Error deleting the CRTM library directory, ${CRTM_LIB_DIR}" - cd ${CURRENT_DIR}; exit ${FAILURE} - fi -else - info_message "No library build makefile or ${CRTM_LIB_DIR} directory. Nothing to cleanup!" -fi - - -# Clean up the source links -cd ${CRTM_SOURCE_ROOT} -if [ $? -ne 0 ]; then - error_message "Error changing to CRTM source directory, ${CRTM_SOURCE_ROOT}" - cd ${CURRENT_DIR}; exit ${FAILURE} -fi -make realclean -if [ $? -ne 0 ]; then - error_message "Error cleaning up CRTM library source links" - cd ${CURRENT_DIR}; exit ${FAILURE} -fi - - -# Clean up the regression build -CRTM_REGTEST_DIR="${CRTM_TEST_ROOT}/Main/regression_tests" -cd ${CRTM_REGTEST_DIR} -if [ $? -ne 0 ]; then - error_message "Error changing to CRTM regression test directory, ${CRTM_REGTEST_DIR}" - cd ${CURRENT_DIR}; exit ${FAILURE} -fi - -# ...Use makefile if it exists -if [ -f Makefile ]; then - make realclean - if [ $? -ne 0 ]; then - error_message "Error cleaning up CRTM regression test build products" - cd ${CURRENT_DIR}; exit ${FAILURE} - fi -else - info_message "No regression test makefile. Nothing to cleanup!" -fi - - -# Return to original directory -cd ${CURRENT_DIR} diff --git a/scripts/shell/Utility/crtm_env.sh b/scripts/shell/Utility/crtm_env.sh deleted file mode 100755 index 814fc92..0000000 --- a/scripts/shell/Utility/crtm_env.sh +++ /dev/null @@ -1,148 +0,0 @@ -#!/bin/bash - -# Script to display the values of the CRTM environment variables -# in the current session. -# -# $Id$ - -script_id() -{ - REVISION='$Revision$' - LAST_CHANGED_DATE='$LastChangedDate: $' - echo - echo "${SCRIPT_NAME} ${REVISION} ${LAST_CHANGED_DATE}" - echo " "`date` - echo " Support email: NCEP.List.EMC.JCSDA_CRTM.Support@noaa.gov" -} - -usage() -{ - echo - echo " Usage: crtm_env.sh [-hx] [-o [file]]" - echo - echo " Script to display the values of the CRTM environment variables" - echo " in the current session." - echo - echo " The CRTM envars displayed are:" - echo " CRTM_ROOT : The CRTM working copy root directory" - echo " CRTM_SOURCE_ROOT : The CRTM source code subdirectory" - echo " CRTM_FIXFILE_ROOT : The CRTM fixed file subdirectory" - echo " CRTM_TEST_ROOT : The CRTM test code subdirectory" - echo " CRTM_EXTERNALS_ROOT : The CRTM externals subdirectory" - echo " CRTM_SCRIPTS_ROOT : The CRTM scripts subdirectory" - echo " CRTM_VALIDATION_ROOT: The CRTM validation subdirectory" - echo " CRTM_CONFIG_ROOT : The CRTM configuration subdirectory" - echo - echo " NOTE: These envars are used in various scripts and makefiles within" - echo " the CRTM repository heirarchy so if you are going to change" - echo " them, make sure you know what you are doing!" - echo - echo - echo " Options:" - echo " -h" - echo " Print this message and exit" - echo - echo " -x" - echo " Turn on execution tracing" - echo - echo " -o [file]" - echo " Output envar settings to file for export. If no file is" - echo ' specified, the default is $HOME/.crtm_env' - echo -} - - -error_message() -{ - MESSAGE=$1 - echo >&2 - echo " *********************" >&2 - echo " ${SCRIPT_NAME}(ERROR): ${MESSAGE}" >&2 - echo " *********************" >&2 -} - - -info_message() -{ - MESSAGE=$1 - echo " ${SCRIPT_NAME}(INFORMATION): ${MESSAGE}" -} - - -######################################################################## -# MAIN SCRIPT BEGINS # -######################################################################## - -# Set up -# ...Script name for error messages -SCRIPT_NAME=$(basename $BASH_SOURCE) -# ...Version number for output file -VERSION_ID='$Revision$' -# ...Definitions -SUCCESS=0; TRUE=0 -FAILURE=1; FALSE=1 -# ...Defaults -OUTPUT=${FALSE} -OUTPUT_FILE_DEFAULT="${HOME}/.crtm_env" - - -# Parse the command line options -while getopts :hxo: OPTVAL; do - # Exit if option argument looks like another option - case ${OPTARG} in - -*) break ;; - esac - # Parse the valid options - case ${OPTVAL} in - h) usage | more; exit ${SUCCESS} ;; - x) script_id; set -x ;; - o) OUTPUT=${TRUE}; OUTPUT_FILE=${OPTARG} ;; - \?) OPTVAL=${OPTARG}; break ;; - esac -done -# ...Remove the options processed -shift $((OPTIND - 1)) -# ...Output invalidities based on OPTVAL -case ${OPTVAL} in - # If OPTVAL contains nothing, then all options - # have been successfully parsed - \?) : ;; - # Valid option, but missing argument - o) OUTPUT=${TRUE} - OUTPUT_FILE=${OUTPUT_FILE_DEFAULT} ;; - # Invalid option - ?) usage - error_message "Invalid option '-${OPTARG}'" - exit ${FAILURE} ;; -esac - - -# Create the output file -if [ ${OUTPUT} -eq ${TRUE} ]; then - echo "Creating output file ${OUTPUT_FILE}..."; echo - echo "#" > ${OUTPUT_FILE} - echo "# This file created by ${SCRIPT_NAME} ${VERSION_ID}" >> ${OUTPUT_FILE} - echo "#" >> ${OUTPUT_FILE} - echo "# CRTM environment variables" >> ${OUTPUT_FILE} - echo "#" >> ${OUTPUT_FILE} -fi - - -# Display the envars -ENVAR_LIST="CRTM_ROOT \ - CRTM_SOURCE_ROOT \ - CRTM_FIXFILE_ROOT \ - CRTM_TEST_ROOT \ - CRTM_EXTERNALS_ROOT \ - CRTM_SCRIPTS_ROOT \ - CRTM_VALIDATION_ROOT \ - CRTM_CONFIG_ROOT" -for ENVAR in ${ENVAR_LIST}; do - SETTING=`env | grep $ENVAR=` - if [ -n "${SETTING}" ]; then - echo ${SETTING} - if [ ${OUTPUT} -eq ${TRUE} ]; then - echo "export ${SETTING}" >> ${OUTPUT_FILE} - fi - fi -done diff --git a/scripts/shell/Utility/crtm_rebuild.sh b/scripts/shell/Utility/crtm_rebuild.sh deleted file mode 100755 index 560c158..0000000 --- a/scripts/shell/Utility/crtm_rebuild.sh +++ /dev/null @@ -1,176 +0,0 @@ -#!/bin/bash - -# Script to perform a clean rebuild of the CRTM library -# -# $Id$ - -script_id() -{ - REVISION='$Revision$' - LAST_CHANGED_DATE='$LastChangedDate$' - echo - echo "${SCRIPT_NAME} ${REVISION} ${LAST_CHANGED_DATE}" - echo " "`date` - echo " Support email: NCEP.List.EMC.JCSDA_CRTM.Support@noaa.gov" -} - -usage() -{ - echo - echo " Usage: crtm_rerebuild.sh [-dhx] [-c compiler]" - echo - echo " Script to perform a clean rebuild of the CRTM library." - echo - echo " Options:" - echo " -d" - echo " Use DEBUG compilation switches. Default is PRODUCTION." - echo - echo " -h" - echo " Print this message" - echo - echo " -x" - echo " Turn on execution tracing" - echo - echo " -c compiler" - echo " Use this option to specify the compiler. Valid compilers are:" - echo " * gfortran [DEFAULT]" - echo " * ifort" - echo " * pgf95" - echo " * g95" - echo " * xlf2003" - echo -} - -error_message() -{ - MESSAGE=$1 - echo >&2 - echo " *********************" >&2 - echo " ${SCRIPT_NAME}(ERROR): ${MESSAGE}" >&2 - echo " *********************" >&2 -} - -compiler_exists () { - command -v $1 >/dev/null 2>&1 -} - -######################################################################## -# MAIN SCRIPT BEGINS # -######################################################################## - -# Setup -SCRIPT_NAME=`basename $0` -# ...Defintiions -SUCCESS=0 -FAILURE=1 -# ..Define defaults -DEBUG="" -COMPILER=${FC} -echo "Compiler:" $COMPILER - - -# Parse command line options -while getopts :dhxc: OPTVAL; do - # Exit if option argument looks like another option - case ${OPTARG} in - -*) break;; - esac - # Parse the valid options - case ${OPTVAL} in - d) DEBUG="-debug" ;; - h) usage | more; exit ${SUCCESS} ;; - x) script_id; set -x ;; - c) COMPILER="${OPTARG}" ;; - \?) OPTVAL=${OPTARG}; break ;; - esac -done -# ...Remove the options processed -shift $((OPTIND - 1)) -# ...Output invalidities based on OPTVAL -case ${OPTVAL} in - # If OPTVAL contains nothing, then all options - # have been successfully parsed. - \?) : ;; - # Valid options, but missing arguments - c) usage - error_message "'-${OPTVAL}' option requires an argument" - exit ${FAILURE} ;; - # Invalid option - ?) usage - error_message "Invalid option '-${OPTARG}'" - exit ${FAILURE} ;; -esac - - -# Check the compiler option -compiler_exists ${COMPILER} -if [ $? -ne 0 ]; then - error_message "Cannot find ${COMPILER} compiler" - exit ${FAILURE} -fi - - -# ================= -# Start the process -# ================= - -CURRENT_DIR=${PWD} - -cd ${CRTM_SOURCE_ROOT} -if [ $? -ne 0 ]; then - error_message "Error changing to CRTM source directory, ${CRTM_SOURCE_ROOT}" - cd ${CURRENT_DIR}; exit ${FAILURE} -fi - -make create_links -if [ $? -ne 0 ]; then - error_message "Error linking in source code and data" - cd ${CURRENT_DIR}; exit ${FAILURE} -fi - -cd Build -if [ $? -ne 0 ]; then - error_message "Error changing to CRTM build directory" - cd ${CURRENT_DIR}; exit ${FAILURE} -fi - -. config-setup/${COMPILER}${DEBUG}.setup - -NETCDF_DIR=${NETCDF} ./configure --prefix=${PWD} -if [ $? -ne 0 ]; then - error_message "Error configuring the CRTM library build" - cd ${CURRENT_DIR}; exit ${FAILURE} -fi - -make uninstall -if [ $? -ne 0 ]; then - error_message "Error uninstalling prior to CRTM library build" - cd ${CURRENT_DIR}; exit ${FAILURE} -fi - -make clean -if [ $? -ne 0 ]; then - error_message "Error cleaning prior to CRTM library build" - cd ${CURRENT_DIR}; exit ${FAILURE} -fi - -make -if [ $? -ne 0 ]; then - error_message "Error building the CRTM library" - cd ${CURRENT_DIR}; exit ${FAILURE} -fi - -make check -if [ $? -ne 0 ]; then - error_message "Error checking the CRTM library build" - cd ${CURRENT_DIR}; exit ${FAILURE} -fi - -make install -if [ $? -ne 0 ]; then - error_message "Error installing the CRTM library" - cd ${CURRENT_DIR}; exit ${FAILURE} -fi - -# Return to original directory -cd ${CURRENT_DIR} diff --git a/scripts/shell/Utility/endian_wrapper.sh b/scripts/shell/Utility/endian_wrapper.sh deleted file mode 100755 index fd4921f..0000000 --- a/scripts/shell/Utility/endian_wrapper.sh +++ /dev/null @@ -1,130 +0,0 @@ -#!/bin/sh - -# $Id$ - -usage() -{ - echo " Usage: endian_wrapper -l|-b [-h] exe_file" - echo - echo " Run any Fortran executable for either little- or big-endian" - echo " unformatted file access regardless of how the executable was" - echo " originally built." - echo - echo " l Read and/or write little-endian binary output files" - echo - echo " b Read and/or write big-endian binary output files" - echo - echo " h Print this message and exit" - echo - echo " Note the endian-ness option is only setup for the following" - echo " compilers that allow for run-time conversion via environment" - echo " variables:" - echo " - AIX xlf" - echo " - Linux gfortran" - echo " - Linux ifort (Intel)" - echo " - Linux g95" - echo -} - -error_message() -{ - MESSAGE=$1 - echo; echo " ${SCRIPT_NAME}(ERROR): ${MESSAGE}" -} - - -######################################################################## -# MAIN SCRIPT BEGINS # -######################################################################## - -# Define defaults -SCRIPT_NAME="`basename $0`" -ENDIAN_TYPE="NONE" -OVERWRITE="NO" -REMOVE="rm -f" - - -# Parse command line options -while getopts :hlb OPTVAL; do - - # If option argument looks like another option exit the loop - case ${OPTARG} in - -*) break;; - esac - - # Parse the valid options here - case ${OPTVAL} in - l) ENDIAN_TYPE="little";; - b) ENDIAN_TYPE="big";; - h) usage; exit 0;; - \?) OPTVAL=${OPTARG}; break;; - esac -done - -# Remove the options processed -shift $((OPTIND - 1)) - -# Now output invalidities based on OPTVAL -# Need to do this as getopts does not handle -# the situations where an option is passed -# as an argument to another option. -case ${OPTVAL} in - - # If OPTVAL contains nothing, then all options - # have been successfully parsed - \?) if [ $# -lt 1 ]; then - usage - error_message "Missing 'exe_file' argument" - exit 1 - fi;; - - # Invalid option - ?) usage - error_message " Invalid option '-${OPTARG}'" - exit 1;; -esac - -# Assign, and check, executable argument -INPUT_FILE=$1 -EXE_FILE="`which ${INPUT_FILE}`" -if [ ! -f "${EXE_FILE}" ]; then - error_message "${INPUT_FILE} is not a regular file" - exit 2 -fi -if [ ! -x "${EXE_FILE}" ]; then - error_message "${INPUT_FILE} is not executable" - exit 2 -fi - -# Check endian type for run time options -# ...Save the current envar options -XLFRTEOPTS_SAVE=${XLFRTEOPTS} -GFORTRAN_CONVERT_UNIT_SAVE=${GFORTRAN_CONVERT_UNIT} -F_UFMTENDIAN_SAVE=${F_UFMTENDIAN} -G95_ENDIAN_SAVE=${G95_ENDIAN} -# ...Set the non-switchable envars -case ${ENDIAN_TYPE} in - "little") export XLFRTEOPTS="ufmt_littleendian=-100";; - "big") export XLFRTEOPTS="";; - *) usage; error_message "Must specify an endian type, -l or -b" - exit 3;; -esac -# ...Switchable envars -export GFORTRAN_CONVERT_UNIT="${ENDIAN_TYPE}_endian" -export F_UFMTENDIAN="${ENDIAN_TYPE}" -export G95_ENDIAN="${ENDIAN_TYPE}" - - -# Assign processing parameters -LOG_FILE="${EXE_FILE}.${ENDIAN_TYPE}_endian.log" - - -# Run the executable -${EXE_FILE} - - -# Restore the run-time option environment variables -export XLFRTEOPTS="${XLFRTEOPTS_SAVE}" -export GFORTRAN_CONVERT_UNIT="${GFORTRAN_CONVERT_UNIT_SAVE}" -export F_UFMTENDIAN="${F_UFMTENDIAN_SAVE}" -export G95_ENDIAN="${G95_ENDIAN_SAVE}" diff --git a/scripts/shell/Utility/link_atmprofile.sh b/scripts/shell/Utility/link_atmprofile.sh deleted file mode 100755 index 41c88bd..0000000 --- a/scripts/shell/Utility/link_atmprofile.sh +++ /dev/null @@ -1,153 +0,0 @@ -#!/bin/sh - -# $Id$ - -script_id() -{ - REVISION='$Revision$' - LAST_CHANGED_DATE='$LastChangedDate$' - echo - echo "${SCRIPT_NAME} ${REVISION} ${LAST_CHANGED_DATE}" - echo " "`date` - echo " Support email: NCEP.List.EMC.JCSDA_CRTM.Support@noaa.gov" - echo -} - -usage() -{ - echo - echo "Usage: link_atmprofile.sh [-hx] [atm_id]" - echo - echo " Script to link in the netCDF atmospheric profile datafile from the" - echo " CRTM fixfile repository." - echo - echo " The valid atmospheric profile set identifiers are:" - echo " * UMBC48 : The UMBC 48-profile data set." - echo " * ECMWF52: The ECMWF 52-profile data set." - echo " * ECMWF83: The ECMWF 83-profile data set. [DEFAULT]" - echo " * ECMWF5K: The ECMWF 5000-profile data set." - echo " * CIMSS32: The CIMSS 32-profile data set." - echo " * Model6 : The Model climatology 6-profile data set." - echo ' If the optional [atm_id] argument is not specified, the "ECMWF83" profile' - echo " set datafile is linked in by default." - echo - echo - echo " Options:" - echo " -h" - echo " Print this message." - echo - echo " -x" - echo " Turn on execution tracing" - echo - echo " Optional arguments:" - echo " atm_id" - echo " The atmospheric profile ids identifying the profile data set to link in." - echo ' If not specified, the "ECMWF83" data set is linked by default.' - echo -} - -error_message() -{ - MESSAGE=$1 - echo >&2 - echo " *********************" >&2 - echo " ${SCRIPT_NAME}(ERROR): ${MESSAGE}" >&2 - echo " *********************" >&2 -} - - -######################################################################## -# MAIN SCRIPT BEGINS # -######################################################################## - -# Set up -# ...Script name for error messages -SCRIPT_NAME=$(basename $0) -# ...Defintiions -SUCCESS=0; TRUE=0 -FAILURE=1; FALSE=1 -DEFAULT_ID="ECMWF83" -VALID_IDS="${DEFAULT_ID} UMBC48 ECMWF52 ECMWF5K CIMSS32 Model6" -# ...Define helper script, and make sure it can be found -LINK_SCRIPT="linkfiles.sh" -type ${LINK_SCRIPT} >/dev/null 2>&1 || { - error_message "Cannot find ${LINK_SCRIPT} helper script. Exiting..." - exit ${FAILURE} -} - - -# Parse the command line options -while getopts :hx OPTVAL; do - # If option argument looks like another option exit the loop - case ${OPTARG} in - -*) break;; - esac - # Parse the valid options - case ${OPTVAL} in - h) usage | more; exit ${SUCCESS};; - x) script_id; set -x;; - \?) OPTVAL=${OPTARG}; break;; - esac -done -# Remove the options processed -shift $(expr ${OPTIND} - 1) -# Output invalidities based on OPTVAL -case ${OPTVAL} in - # If OPTVAL contains nothing, then all options - # have been successfully parsed - \?) break;; - # Invalid option - ?) usage; error_message " Invalid option '-${OPTARG}'"; exit ${FAILURE};; -esac - - -# Check that the mandatory envar is defined -if [ -z "${CRTM_FIXFILE_ROOT}" ]; then - error_message "CRTM_FIXFILE_ROOT envar is not defined." - exit ${FAILURE} -fi - - -# Determine the file to link -# ...Set the default id -ATMPROFILE_ID=${DEFAULT_ID} -# ...Was one specified? -if [ $# -ne 0 ]; then - ATMPROFILE_ID=$1 -fi -# ...Is the id valid? -NO_MATCH=${TRUE} -for ID in ${VALID_IDS}; do - if [ "${ID}" = "${ATMPROFILE_ID}" ]; then - NO_MATCH=${FALSE} - break - fi -done -if [ ${NO_MATCH} -eq ${TRUE} ]; then - error_message "AtmProfile id, ${ATMPROFILE_ID}, is not recognised." - exit ${FAILURE} -fi -# ...Construct the filename -ATMPROFILE_FILE="${ATMPROFILE_ID}.AtmProfile.nc" - - -# Output some user info -echo; echo "${SCRIPT_NAME}: Linking in the file ${ATMPROFILE_FILE}"; echo - - -# Link in the file -if [ ! -f ${ATMPROFILE_FILE} ]; then - ${LINK_SCRIPT} -q ${CRTM_FIXFILE_ROOT} ${ATMPROFILE_FILE} - if [ $? -ne 0 ]; then - error_message "Error occuring linking ${ATMPROFILE_FILE} to ${PWD}/${ATMPROFILE_FILE}" - exit ${FAILURE} - fi -else - error_message "${ATMPROFILE_FILE} file already exists in this directory!" - exit ${FAILURE} -fi - - -# Done -exit ${SUCCESS} - diff --git a/scripts/shell/Utility/link_coeffs.sh b/scripts/shell/Utility/link_coeffs.sh deleted file mode 100755 index 783f290..0000000 --- a/scripts/shell/Utility/link_coeffs.sh +++ /dev/null @@ -1,262 +0,0 @@ -#!/bin/sh - -# Link script to link in CRTM release fixfiles into a single directory. -# -# $Id$ - -script_id() -{ - REVISION='$Revision$' - LAST_CHANGED_DATE='$LastChangedDate$' - echo - echo "${SCRIPT_NAME} ${REVISION} ${LAST_CHANGED_DATE}" - echo " "`date` - echo " Support email: NCEP.List.EMC.JCSDA_CRTM.Support@noaa.gov" -} - -usage() -{ - echo - echo " Usage: link_coeffs.sh [-achx] [-t file-type] source-dir dest-dir [sensor_id1 sensor id2 ... sensor_idN]" - echo - echo " Link in CRTM release fixfiles into a single directory." - echo - echo " Options:" - echo " -a" - echo " Link in ODAS TauCoeff files. ODPS is the default." - echo - echo " Note: Currently there are no ODPS TauCoeff files" - echo " for visible sensors (we're working on it)." - echo - echo " -c" - echo " Perform additional special case linking for the AIRS 281 and" - echo " CrIS 399 channel subset datafiles for use with the GSI satinfo" - echo " file. The naming convention is:" - echo " airs281SUBSET_aqua.[Spc|Tau]Coeff.* -> airs281_aqua.[Spc|Tau]Coeff.*" - echo " cris_npp.[Spc|Tau]Coeff.* -> cris399_aqua.[Spc|Tau]Coeff.*" - echo - echo " -h" - echo " Print this message" - echo - echo " -x" - echo " Turn on execution tracing" - echo - echo " -t file-type" - echo " Use this option to specify the type of coefficient files to link." - echo " Valid targets are:" - echo " * big-endian [DEFAULT]" - echo " * little-endian" - echo " * netcdf" - echo - echo " Arguments:" - echo " source-dir" - echo " The /fix directory location of the CRTM release." - echo " This directory must already exist." - echo - echo " dest-dir" - echo " The directory into which the coefficients will be linked." - echo " If this directory does not exist, it is created." - echo - echo " Optional arguments:" - echo " sensor_id1 sensor id2 ... sensor_idN" - echo " A list of sensor ids identifying the particular sensors for which" - echo " the SpcCoeff and TauCoeff files are required. If not specified, all" - echo " available sensor files are linked." - echo -} - -error_message() -{ - MESSAGE=$1 - echo >&2 - echo " *********************" >&2 - echo " ${SCRIPT_NAME}(ERROR): ${MESSAGE}" >&2 - echo " *********************" >&2 -} - - -######################################################################## -# MAIN SCRIPT BEGINS # -######################################################################## - -# Setup -SCRIPT_NAME=`basename $0` -# ...Defintiions -SUCCESS=0 -FAILURE=1 -# ..Define defaults -FILE_TYPE="big-endian" -TAUCOEFF_TYPE="ODPS" -ALL_SENSORS="yes" -SPECIAL_CASE="no" -# ...Define commands -LINK="ln -sf" -# ...Define helper script, and make sure it can be found -LINK_SCRIPT="linkfiles.sh" -type ${LINK_SCRIPT} >/dev/null 2>&1 || { - error_message "Cannot find ${LINK_SCRIPT} helper script. Exiting..." - exit ${FAILURE} -} - - - -# Parse command line options -while getopts :achxt: OPTVAL; do - # Exit if option argument looks like another option - case ${OPTARG} in - -*) break;; - esac - # Parse the valid options - case ${OPTVAL} in - a) TAUCOEFF_TYPE="ODAS" ;; - c) SPECIAL_CASE="yes";; - h) usage | more; exit ${SUCCESS} ;; - x) script_id; set -x ;; - t) FILE_TYPE="${OPTARG}" ;; - \?) OPTVAL=${OPTARG}; break ;; - esac -done -# ...Remove the options processed -shift $((OPTIND - 1)) -# ...Output invalidities based on OPTVAL -case ${OPTVAL} in - # If OPTVAL contains nothing, then all options - # have been successfully parsed. - # So, check for presence of mandatory arguments. - \?) if [ $# -lt 2 ]; then - usage - error_message "Missing source-dir and/or dest-dir arguments" - exit ${FAILURE} - fi;; - # Valid options, but missing arguments - t) usage; error_message "'-${OPTVAL}' option requires an argument"; exit ${FAILURE} ;; - # Invalid option - ?) usage; error_message "Invalid option '-${OPTARG}'"; exit ${FAILURE};; -esac - - -# Check the file type option -case ${FILE_TYPE} in - "big-endian") FILE_DIR="Big_Endian" ; FILE_EXT="bin" ;; - "little-endian") FILE_DIR="Little_Endian"; FILE_EXT="bin" ;; - "netcdf") FILE_DIR="netCDF" ; FILE_EXT="nc" ;; - "netcdf4") FILE_DIR="netCDF" ; FILE_EXT="nc4" ;; - *) usage; error_message "Invalid file type option argument"; exit ${FAILURE} ;; -esac -# ...Define the sensor independent coefficient files. -COMMON_COEFF_FILES="AerosolCoeff.${FILE_EXT} \ -AerosolCoeff.CMAQ.${FILE_EXT} \ -AerosolCoeff.GOCART-GEOS5.${FILE_EXT} \ -AerosolCoeff.NAAPS.${FILE_EXT} \ -IR.CloudCoeff.${FILE_EXT} \ -MW.CloudCoeff.${FILE_EXT} \ -CloudCoeff.${FILE_EXT} \ -FASTEM4.MWwater.EmisCoeff.${FILE_EXT} \ -FASTEM5.MWwater.EmisCoeff.${FILE_EXT} \ -FASTEM6.MWwater.EmisCoeff.${FILE_EXT} \ -Nalli.IRwater.EmisCoeff.${FILE_EXT} \ -WuSmith.IRwater.EmisCoeff.${FILE_EXT} \ -NPOESS.IRice.EmisCoeff.${FILE_EXT} \ -NPOESS.IRland.EmisCoeff.${FILE_EXT} \ -NPOESS.IRsnow.EmisCoeff.${FILE_EXT} \ -NPOESS.VISice.EmisCoeff.${FILE_EXT} \ -NPOESS.VISland.EmisCoeff.${FILE_EXT} \ -NPOESS.VISsnow.EmisCoeff.${FILE_EXT} \ -NPOESS.VISwater.EmisCoeff.${FILE_EXT} \ -IGBP.IRland.EmisCoeff.${FILE_EXT} \ -IGBP.VISland.EmisCoeff.${FILE_EXT} \ -USGS.IRland.EmisCoeff.${FILE_EXT} \ -USGS.VISland.EmisCoeff.${FILE_EXT}" - - -# Transfer, and remove, the arguments -SOURCE_DIR=$1 -DEST_DIR=$2 -shift 2 - - -# Check if sensor ids have been specified -if [ $# -ne 0 ]; then - SENSOR_ID_LIST="$*" - ALL_SENSORS="no" -fi - - -# Check the directory arguments - -# ...Ensure the source directory exists -if [ ! -d ${SOURCE_DIR} ]; then - usage - error_message "Source directory '${SOURCE_DIR}' does not exist. Exiting." - exit ${FAILURE} -fi - -# ...Get the absolute path to the source directory -CURRENT_DIR=${PWD} -cd ${SOURCE_DIR}; SOURCE_DIR=`pwd -L`; cd ${CURRENT_DIR} - -# ...Create the destination directory if necessary -if [ ! -d ${DEST_DIR} ]; then - mkdir ${DEST_DIR} - if [ $? -ne ${SUCCESS} ]; then - error_message "Error creating destination directory '${DEST_DIR}'. Exiting." - exit ${FAILURE} - fi -fi - - - -# Begin the linking process -echo -echo "Linking coefficient files from root source directory," -echo " ${SOURCE_DIR}" -echo "to destination directory," -echo " ${DEST_DIR}" - -# Go to destination -cd ${DEST_DIR} -if [ $? -ne ${SUCCESS} ]; then - error_message "Error cd'ing to destination directory '${DEST_DIR}'. Exiting." - exit ${FAILURE} -fi - - -# Link common files -echo; echo "...linking ${FILE_TYPE} sensor-independent coefficient files..." -${LINK_SCRIPT} -s -d ${FILE_DIR} ${SOURCE_DIR} ${COMMON_COEFF_FILES} - - -# Link the SpcCoeff files -echo; echo "...linking ${FILE_TYPE} SpcCoeff coefficient files..." -if [ "${ALL_SENSORS}" = "yes" ]; then - SPCCOEFF_FILES=`ls ${SOURCE_DIR}/SpcCoeff/${FILE_DIR}` -else - for SENSOR_ID in ${SENSOR_ID_LIST}; do - SPCCOEFF_FILES="${SPCCOEFF_FILES} ${SENSOR_ID}.SpcCoeff.${FILE_EXT}" - done -fi -${LINK_SCRIPT} -s -d ${FILE_DIR} ${SOURCE_DIR} ${SPCCOEFF_FILES} -# ...Perform special case linking if required -if [ "${SPECIAL_CASE}" = "yes" ]; then - ${LINK} airs281_aqua.SpcCoeff.${FILE_EXT} airs281SUBSET_aqua.SpcCoeff.${FILE_EXT} - ${LINK} cris399_npp.SpcCoeff.${FILE_EXT} cris_npp.SpcCoeff.${FILE_EXT} -fi - -# Link the TauCoeff files -echo; echo "...linking ${FILE_TYPE} TauCoeff coefficient files..." -if [ "${ALL_SENSORS}" = "yes" ]; then - TAUCOEFF_FILES=`ls ${SOURCE_DIR}/TauCoeff/${TAUCOEFF_TYPE}/${FILE_DIR}` -else - for SENSOR_ID in ${SENSOR_ID_LIST}; do - TAUCOEFF_FILES="${TAUCOEFF_FILES} ${SENSOR_ID}.TauCoeff.${FILE_EXT}" - done -fi -${LINK_SCRIPT} -s -d ${FILE_DIR} ${SOURCE_DIR}/TauCoeff/${TAUCOEFF_TYPE} ${TAUCOEFF_FILES} -# ...Perform special case linking if required -if [ "${SPECIAL_CASE}" = "yes" ]; then - ${LINK} airs281_aqua.TauCoeff.${FILE_EXT} airs281SUBSET_aqua.TauCoeff.${FILE_EXT} - ${LINK} cris399_npp.TauCoeff.${FILE_EXT} cris_npp.TauCoeff.${FILE_EXT} -fi - -# Return to original directory -cd ${CURRENT_DIR} diff --git a/scripts/shell/Utility/link_sensorinfo.sh b/scripts/shell/Utility/link_sensorinfo.sh deleted file mode 100755 index 956dd0b..0000000 --- a/scripts/shell/Utility/link_sensorinfo.sh +++ /dev/null @@ -1,131 +0,0 @@ -#!/bin/sh - -# $Id$ - -script_id() -{ - REVISION='$Revision$' - LAST_CHANGED_DATE='$LastChangedDate$' - echo - echo "${SCRIPT_NAME} ${REVISION} ${LAST_CHANGED_DATE}" - echo " "`date` - echo " Support email: NCEP.List.EMC.JCSDA_CRTM.Support@noaa.gov" - echo -} - - -usage() -{ - echo - echo "Usage: link_sensorinfo.sh [-hx] [file]" - echo - echo " Script to link in the master sensor information file, SensorInfo, from" - echo " the CRTM fixfile repository." - echo - echo ' If the optional [file] argument is not specified, the "SensorInfo" datafile' - echo " is linked in by default." - echo - echo - echo " Options:" - echo " -h" - echo " Print this message." - echo - echo " -x" - echo " Turn on execution tracing" - echo - echo " Optional arguments:" - echo " file" - echo " The particular sensor information to be linked. If not specified," - echo ' the "SensorInfo" file is linked by default.' - echo echo -} - -error_message() -{ - MESSAGE=$1 - echo >&2 - echo " *********************" >&2 - echo " ${SCRIPT_NAME}(ERROR): ${MESSAGE}" >&2 - echo " *********************" >&2 -} - -######################################################################## -# MAIN SCRIPT BEGINS # -######################################################################## - -# Set up -# ...Script name for error messages -SCRIPT_NAME=$(basename $0) -# ...Defintiions -SUCCESS=0; TRUE=0 -FAILURE=1; FALSE=1 -DEFAULT_FILE="SensorInfo" -# ...Define helper script, and make sure it can be found -LINK_SCRIPT="linkfiles.sh" -type ${LINK_SCRIPT} >/dev/null 2>&1 || { - error_message "Cannot find ${LINK_SCRIPT} helper script. Exiting..." - exit ${FAILURE} -} - - -# Parse the command line options -while getopts :hx OPTVAL; do - # If option argument looks like another option exit the loop - case ${OPTARG} in - -*) break;; - esac - # Parse the valid options - case ${OPTVAL} in - h) usage | more; exit ${SUCCESS};; - x) script_id; set -x;; - \?) OPTVAL=${OPTARG}; break;; - esac -done -# Remove the options processed -shift $(expr ${OPTIND} - 1) -# Output invalidities based on OPTVAL -case ${OPTVAL} in - # If OPTVAL contains nothing, then all options - # have been successfully parsed - \?) break;; - # Invalid option - ?) usage; error_message " Invalid option '-${OPTARG}'"; exit ${FAILURE};; -esac - - -# Check that the mandatory envar is defined -if [ -z "${CRTM_FIXFILE_ROOT}" ]; then - error_message "CRTM_FIXFILE_ROOT envar is not defined." - exit ${FAILURE} -fi - - -# Determine the file to link -# ...Set the default -SENSORINFO_FILE=${DEFAULT_FILE} -# ...Was one specified? -if [ $# -ne 0 ]; then - SENSORINFO_FILE=$1 -fi - - -# Output some user info -echo; echo "${SCRIPT_NAME}: Linking in the file ${SENSORINFO_FILE}"; echo - - -# Link in the file -if [ ! -f ${SENSORINFO_FILE} ]; then - ${LINK_SCRIPT} -q ${CRTM_FIXFILE_ROOT} ${SENSORINFO_FILE} - if [ $? -ne 0 ]; then - error_message "Error occuring linking ${SENSORINFO_FILE} to ${PWD}/${SENSORINFO_FILE}" - exit ${FAILURE} - fi -else - error_message "${SENSORINFO_FILE} file already exists in this directory!" - exit ${FAILURE} -fi - - -# Done -exit ${SUCCESS} - diff --git a/scripts/shell/Utility/link_solar.sh b/scripts/shell/Utility/link_solar.sh deleted file mode 100755 index 93765b5..0000000 --- a/scripts/shell/Utility/link_solar.sh +++ /dev/null @@ -1,145 +0,0 @@ -#!/bin/sh - -# $Id$ - -script_id() -{ - REVISION='$Revision$' - LAST_CHANGED_DATE='$LastChangedDate$' - echo - echo "${SCRIPT_NAME} ${REVISION} ${LAST_CHANGED_DATE}" - echo " "`date` - echo " Support email: NCEP.List.EMC.JCSDA_CRTM.Support@noaa.gov" - echo -} - -usage() -{ - echo - echo "Usage: link_solar.sh [-hx] [file]" - echo - echo " Script to link in the netCDF solar irradiance datafile from the" - echo " CRTM fixfile repository for creation of the instrument SpcCoeff" - echo " datafiles." - echo - echo " The available datafiles for linking are:" - echo " * dF_0.1000.Solar.nc [DEFAULT]" - echo " * dF_0.0025.Solar.nc" - echo " * dF_0.0010.Solar.nc" - echo ' If the optional [file] argument is not specified, the "dF_0.1000.Solar.nc"' - echo " datafile is linked in by default." - echo - echo - echo " Options:" - echo " -h" - echo " Print this message." - echo - echo " -x" - echo " Turn on execution tracing" - echo - echo " Optional arguments:" - echo " file" - echo " The particular solar datafile, from the list above, to be linked." - echo ' If not specified, the "dF_0.1000.Solar.nc" file is linked by default.' - echo -} - -error_message() -{ - MESSAGE=$1 - echo >&2 - echo " *********************" >&2 - echo " ${SCRIPT_NAME}(ERROR): ${MESSAGE}" >&2 - echo " *********************" >&2 -} - -######################################################################## -# MAIN SCRIPT BEGINS # -######################################################################## - -# Set up -# ...Script name for error messages -SCRIPT_NAME=$(basename $0) -# ...Defintiions -SUCCESS=0; TRUE=0 -FAILURE=1; FALSE=1 -DEFAULT_FILE="dF_0.1000.Solar.nc" -VALID_FILES="${DEFAULT_FILE} dF_0.0025.Solar.nc dF_0.0010.Solar.nc" -# ...Define helper script, and make sure it can be found -LINK_SCRIPT="linkfiles.sh" -type ${LINK_SCRIPT} >/dev/null 2>&1 || { - error_message "Cannot find ${LINK_SCRIPT} helper script. Exiting..." - exit ${FAILURE} -} - - -# Parse the command line options -while getopts :hx OPTVAL; do - # If option argument looks like another option exit the loop - case ${OPTARG} in - -*) break;; - esac - # Parse the valid options - case ${OPTVAL} in - h) usage | more; exit ${SUCCESS} ;; - x) script_id; set -x ;; - \?) OPTVAL=${OPTARG}; break ;; - esac -done -# Remove the options processed -shift $(expr ${OPTIND} - 1) -# Output invalidities based on OPTVAL -case ${OPTVAL} in - # If OPTVAL contains nothing, then all options - # have been successfully parsed - \?) : ;; - # Invalid option - ?) usage; error_message " Invalid option '-${OPTARG}'"; exit ${FAILURE};; -esac - - -# Check that the mandatory envar is defined -if [ -z "${CRTM_FIXFILE_ROOT}" ]; then - error_message "CRTM_FIXFILE_ROOT envar is not defined." - exit ${FAILURE} -fi - - -# Determine the file to link -# ...Set the default -SOLAR_FILE=${DEFAULT_FILE} -# ...Was one specified? -if [ $# -ne 0 ]; then - SOLAR_FILE=$1 -fi -# ...Is the filename valid? -NO_MATCH=${TRUE} -for FILE in ${VALID_FILES}; do - if [ "${FILE}" = "${SOLAR_FILE}" ]; then - NO_MATCH=${FALSE} - break - fi -done -if [ ${NO_MATCH} -eq ${TRUE} ]; then - error_message "Solar irradiance datafile, ${SOLAR_FILE}, is not recognised." - exit ${FAILURE} -fi - - -# Output some user info -echo; echo "${SCRIPT_NAME}: Linking in the file ${SOLAR_FILE}"; echo - - -# Link in the file -if [ ! -f ${SOLAR_FILE} ]; then - ${LINK_SCRIPT} -q ${CRTM_FIXFILE_ROOT} ${SOLAR_FILE} - if [ $? -ne 0 ]; then - error_message "Error occuring linking ${SOLAR_FILE} to ${PWD}/${SOLAR_FILE}" - exit ${FAILURE} - fi -fi - - -# Done -exit ${SUCCESS} - diff --git a/scripts/shell/Utility/link_srf.sh b/scripts/shell/Utility/link_srf.sh deleted file mode 100755 index 88a3499..0000000 --- a/scripts/shell/Utility/link_srf.sh +++ /dev/null @@ -1,127 +0,0 @@ -#!/bin/sh - -# $Id$ - -script_id() -{ - REVISION='$Revision$' - LAST_CHANGED_DATE='$LastChangedDate$' - echo - echo "${SCRIPT_NAME} ${REVISION} ${LAST_CHANGED_DATE}" - echo " "`date` - echo " Support email: NCEP.List.EMC.JCSDA_CRTM.Support@noaa.gov" - echo -} - -usage() -{ - echo - echo "Usage: link_srf.sh [-hx] sensor_id [sensor_id2 sensor_id3 ... sensor_idN]" - echo - echo " Script to link in the spectral response function (SRF) for the requested" - echo " sensor from the CRTM SRF repository." - echo - echo - echo " Options:" - echo " -h" - echo " Print this message." - echo - echo " -x" - echo " Turn on execution tracing" - echo - echo " Arguments:" - echo " sensor_id [sensor_id2 sensor_id3 ... sensor_idN]" - echo " A list of sensor ids identifying the particular sensors for which" - echo " the SRF files are required." - echo -} - -error_message() -{ - MESSAGE=$1 - echo >&2 - echo " *********************" >&2 - echo " ${SCRIPT_NAME}(ERROR): ${MESSAGE}" >&2 - echo " *********************" >&2 -} - -######################################################################## -# MAIN SCRIPT BEGINS # -######################################################################## - -# Set up -# ...Script name for error messages -SCRIPT_NAME=$(basename $0) -# ...Defintiions -SUCCESS=0 -FAILURE=1 -# ...Define helper script, and make sure it can be found -LINK_SCRIPT="linkfiles.sh" -type ${LINK_SCRIPT} >/dev/null 2>&1 || { - error_message "Cannot find ${LINK_SCRIPT} helper script. Exiting..." - exit ${FAILURE} -} - - -# Parse the command line options -while getopts :hx OPTVAL; do - # Exit if option argument looks like another option - case ${OPTARG} in - -*) break;; - esac - # Parse the valid options - case ${OPTVAL} in - h) usage | more; exit ${SUCCESS};; - x) script_id; set -x;; - \?) OPTVAL=${OPTARG}; break;; - esac -done -# Remove the options processed -shift $(expr ${OPTIND} - 1) -# Output invalidities based on OPTVAL -case ${OPTVAL} in - # If OPTVAL contains nothing, then all options - # have been successfully parsed and all that - # remains are the arguments - \?) if [ $# -lt 1 ]; then - usage; error_message " Missing 'sensor_id' argument(s)" - exit ${FAILURE} - fi;; - # Invalid option - ?) usage; error_message " Invalid option '-${OPTARG}'"; exit ${FAILURE};; -esac - - -# Assign command line arguments -SENSOR_ID_LIST=$* - - -# Check that the mandatory envar is defined -if [ -z "${CRTM_SRF_ROOT}" ]; then - error_message "CRTM_SRF_ROOT envar is not defined." - exit ${FAILURE} -fi - - -# Construct the list of files to link -SRF_FILE_LIST="" -for SENSOR_ID in ${SENSOR_ID_LIST}; do - SRF_FILE_LIST="${SRF_FILE_LIST} ${SENSOR_ID}.osrf.nc" -done -SRF_FILE_LIST=${SRF_FILE_LIST/[[:space:]]/} - - -# Output some user info -echo; echo "${SCRIPT_NAME}: Linking in the SRF files: ${SRF_FILE_LIST//[[:space:]]/, }"; echo - -# And now link them in -${LINK_SCRIPT} -q ${CRTM_SRF_ROOT} ${SRF_FILE_LIST} -if [ $? -ne 0 ]; then - error_message "Error occuring linking SRF datafiles}" - exit ${FAILURE} -fi - - -# Done. Turn off execution tracing -exit ${SUCCESS} - diff --git a/scripts/shell/Utility/linkfiles.sh b/scripts/shell/Utility/linkfiles.sh deleted file mode 100755 index 8a38b68..0000000 --- a/scripts/shell/Utility/linkfiles.sh +++ /dev/null @@ -1,212 +0,0 @@ -#!/bin/sh - -# $Id$ - -script_id() -{ - REVISION='$Revision$' - LAST_CHANGED_DATE='$LastChangedDate$' - echo - echo "${SCRIPT_NAME} ${REVISION} ${LAST_CHANGED_DATE}" - echo " "`date` - echo " Support email: NCEP.List.EMC.JCSDA_CRTM.Support@noaa.gov" -} - -usage() -{ - echo - echo " Usage: linkfiles.sh [-hqsx] [-d filter-dir] dir file [file2 | file3 | ... | fileN]" - echo - echo " Script to search a directory tree and symlink in the requested" - echo " file(s) to the current directory." - echo - echo " * If multiple files of the same name exist in the directory tree," - echo " the first one found is linked in." - echo - echo - echo " Options:" - echo " -d filter-dir" - echo " Use this option to filter the directory location" - echo " of the requested file(s) to symlink." - echo - echo " -h" - echo " Print this message and exit." - echo - echo " -q" - echo " Suppress informational output." - echo - echo " -s" - echo ' Allow symbolic links to themselves be linked, i.e. "chain-linking"' - echo " the files. Default action is to *NOT* link in symlinks." - echo - echo " -x" - echo " Turn on execution tracing. This also causes extra script" - echo " information to be printed out." - echo - echo " Arguments:" - echo " dir" - echo " Directory at which to begin the search for the" - echo " requested file(s) to symlink." - echo - echo " file" - echo " File for which a symlink is required." - echo - echo " Optional arguments:" - echo " file2 | file3 | ... | fileN" - echo " Additional list of files for which symlinks are required." - echo -} - -error_message() -{ - MESSAGE=$1 - echo >&2 - echo " *********************" >&2 - echo " ${SCRIPT_NAME}(ERROR): ${MESSAGE}" >&2 - echo " *********************" >&2 -} - - - -######################################################################## -# MAIN SCRIPT BEGINS # -######################################################################## - -# Setup -# ...Script name for error messages -SCRIPT_NAME=$(basename $0) -# ...Defintiions -SUCCESS=0 -FAILURE=1 -LINK="ln -sf" -EXCLUDE_SYMLINK="YES" -NOISY="YES" - - -# Parse the command line options -while getopts :hqsxd: OPTVAL; do - - # Exit if option argument looks like another option - case ${OPTARG} in - -*) break;; - esac - - # Parse the valid options - case ${OPTVAL} in - d) FILTER_DIR=${OPTARG} ;; - h) usage | more; exit ${SUCCESS} ;; - q) NOISY= ;; - s) EXCLUDE_SYMLINK= ;; - x) script_id; set -x ;; - :|\?) OPTVAL=${OPTARG}; break ;; - esac -done - -# ...Remove the options processed -shift $(expr ${OPTIND} - 1) - -# ...Output invalidities based on OPTVAL -case ${OPTVAL} in - - # If OPTVAL contains nothing, then all options - # have been successfully parsed and all that - # remains are the arguments - \?) if [ $# -lt 2 ]; then - usage - error_message "Missing 'dir' and 'file' arguments" - exit ${FAILURE} - fi;; - - # Valid options, but missing arguments - d) usage - error_message "'-${OPTVAL}' option requires an argument" - exit ${FAILURE} ;; - - # Invalid option - ?) usage - error_message "Invalid option '-${OPTARG}'" - exit ${FAILURE} ;; -esac - - -# Assign command line arguments -LINKFILE_ROOT=$1 -shift 1 -LINKFILE_LIST=$* - - -# Output some user info -if [ ${NOISY} ]; then - echo "${SCRIPT_NAME}: Searching for file(s) to link..." -fi - -# Build argument list for find -OR="-o" -FINDFILE_LIST="" -for FILE in ${LINKFILE_LIST}; do - # Skip if file already exists - if [ -f ${FILE} ]; then - continue - fi - FINDFILE_LIST="${FINDFILE_LIST} -name ${FILE} ${OR}" -done -FINDFILE_LIST=${FINDFILE_LIST%$OR} - - -# Exit if FINDFILE_LIST is empty -if [ -z "${FINDFILE_LIST}" ]; then - echo "${SCRIPT_NAME}: All required files are present so nothing to do. Exiting." - exit ${SUCCESS} -fi - - -# Find the required files -# ...Specify expressions for find -IGNORE_SVN='-type d -name ".svn" -prune' # Do not search the .svn directories -FILES_TO_FIND="-type f ${FINDFILE_LIST}" # The list of files to actually find -# ...Construct the expression for the find command -EXPRESSION="${IGNORE_SVN} -o ${FILES_TO_FIND}" -# ...Run the command -if [ -z "${FILTER_DIR}" ]; then - LINKFILES=$(find -L ${LINKFILE_ROOT}/ \( ${EXPRESSION} \) | sort -r) -else - LINKFILES=$(find -L ${LINKFILE_ROOT}/ \( ${EXPRESSION} \) | grep ${FILTER_DIR} | sort -r) -fi -if [ $? -ne 0 ]; then - error_message "Find command failed for: ${FINDFILE_LIST}" - exit ${FAILURE} -fi - - -# Set the condition for skipping existing files or symlinks -if [ ${EXCLUDE_SYMLINK} ]; then - SKIP_CONDITION='[ -f $(basename ${FILE}) ] || [ -h ${FILE} ]' - if [ ${NOISY} ]; then - echo "${SCRIPT_NAME}: Skipping symbolic links..." - fi -else - SKIP_CONDITION='[ -f $(basename ${FILE}) ]' -fi - - -# Link in the files found -for FILE in ${LINKFILES}; do - # Skip file if necessary - if eval "${SKIP_CONDITION}"; then - continue - fi - # Link in the file - ${LINK} ${FILE} . - if [ $? -ne 0 ]; then - error_message "Link command failed for ${FILE}" - exit ${FAILURE} - fi -done - - -# Check that all the required files were found -for FILE in ${LINKFILE_LIST}; do - if [ ! -f ${FILE} ]; then - echo "File ${FILE} not found in ${LINKFILE_ROOT} hierarchy." - fi -done diff --git a/scripts/shell/Utility/unlinkfiles.sh b/scripts/shell/Utility/unlinkfiles.sh deleted file mode 100755 index 646b59e..0000000 --- a/scripts/shell/Utility/unlinkfiles.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh - -LINKFILE_LIST=$* -if [ -z "${LINKFILE_LIST}" ]; then - exit 0 -fi - -for FILE in ${LINKFILE_LIST}; do - if [ -h ${FILE} ]; then - rm -f ${FILE} - fi -done - diff --git a/scripts/shell/crtm_install_scripts.sh b/scripts/shell/crtm_install_scripts.sh deleted file mode 100755 index 4569b06..0000000 --- a/scripts/shell/crtm_install_scripts.sh +++ /dev/null @@ -1,201 +0,0 @@ -#!/bin/bash - -script_id() -{ - REVISION='$Revision$' - LAST_CHANGED_DATE='$LastChangedDate$' - echo - echo "${SCRIPT_NAME} ${REVISION} ${LAST_CHANGED_DATE}" - echo " "`date` - echo " Support email: NCEP.List.EMC.JCSDA_CRTM.Support@noaa.gov" - echo -} - - -usage() -{ - echo - echo "Usage: crtm_install_scripts.sh [-hux] [bindir]" - echo - echo " Utility script to link in the various CRTM shell scripts in a user directory" - echo " to contain executable commands, bindir." - echo - echo " * If the optional bindir argument is not specified, the default is ~/bin." - echo - echo " * If bindir does not exist it is created." - echo - echo ' * If bindir is not in $PATH a "crtmrc" file is created that can be sourced to' - echo ' add bindir to the $PATH in the current shell:' - echo " $ . crtmrc" - echo - echo - echo " Options:" - echo - echo " -h" - echo " Print this message." - echo - echo " -u" - echo " Use this option to UNINSTALL (i.e. remove) the CRTM scripts in bindir." - echo - echo " -x" - echo " Turn on execution tracing" - echo - echo - echo " Optional arguments:" - echo - echo " bindir" - echo " A specified directory in which to (un)install the scripts. If it is" - echo " specified and does not exist it is created for installation." - echo; echo -} - - -error_message() -{ - MESSAGE=$1 - echo >&2 - echo " *********************" >&2 - echo " ${SCRIPT_NAME}(ERROR): ${MESSAGE}" >&2 - echo " *********************" >&2 -} - - -info_message() -{ - MESSAGE=$1 - echo " ${SCRIPT_NAME}(INFORMATION): ${MESSAGE}" -} - - -######################################################################## -# MAIN SCRIPT BEGINS # -######################################################################## - -# Set up -# ...Script name for error messages -SCRIPT_NAME=$(basename $BASH_SOURCE) -# ...Commands -LINK="ln -sf" -REMOVE="rm -f" -# ...Definitions -SUCCESS=0; TRUE=0 -FAILURE=1; FALSE=1 -BINDIR_DEFAULT="${HOME}/bin" -INSTALL=${TRUE} -SOURCEFILE="crtmrc" -SCRIPTFILE_GLOB="*.sh" # Only files matching this glob are installed - - -# Parse the command line options -while getopts :hux OPTVAL; do - # If option argument looks like another option exit the loop - case ${OPTARG} in - -*) break;; - esac - # Parse the valid options - case ${OPTVAL} in - h) usage | more; exit ${SUCCESS} ;; - u) INSTALL=${FALSE} ;; - x) script_id; set -x ;; - \?) OPTVAL=${OPTARG}; break ;; - esac -done -# Remove the options processed -shift $(expr ${OPTIND} - 1) -# Output invalidities based on OPTVAL -case ${OPTVAL} in - # If OPTVAL contains nothing, then all options - # have been successfully parsed - \?) : ;; - # Invalid option - *) usage; error_message " Invalid option '-${OPTARG}'"; exit ${FAILURE};; -esac - - -# Check if bindir has been specified -BINDIR=${BINDIR_DEFAULT} -if [ $# -ne 0 ]; then - BINDIR=$1 -fi - - -# Check that the mandatory envars are defined -if [ -z "${CRTM_ROOT}" -o -z "${CRTM_SCRIPTS_ROOT}" ]; then - error_message "CRTM_ROOT and CRTM_SCRIPTS_ROOT envars are not defined." - exit ${FAILURE} -fi -info_message "CRTM root directory is `basename ${CRTM_ROOT}`" - - -# If no BINDIR for uninstallation, do nothing... -if [ ! -d ${BINDIR} -a ${INSTALL} -eq ${FALSE} ]; then - info_message "${BINDIR} does not exist. Cannot uninstall from a non-existant directory" - exit ${SUCCESS} -fi - - -# Does BINDIR exist for installation? -if [ ! -d ${BINDIR} -a ${INSTALL} -eq ${TRUE} ]; then - # Create it - info_message "Creating ${BINDIR} for script installation..." - mkdir ${BINDIR} - if [ $? -ne 0 ]; then - error_message "Error creating ${BINDIR} directory for script installation" - exit ${FAILURE} - fi -else - # Just output info message - info_message "${BINDIR} exists..." -fi - - -# Is BINDIR in PATH? -if [[ ":$PATH:" != *":$BINDIR:"* ]]; then - info_message 'Your $PATH does NOT contain '"$BINDIR..." - if [ ${INSTALL} -eq ${TRUE} ]; then - info_message 'Creating a crtmrc file with $PATH modification. For a permanent change modify your .bash_profile (or similar) file.' - echo "export PATH="'${PATH}'":${BINDIR}" > ${SOURCEFILE} - cat ${SOURCEFILE} - fi -fi - - -# (Un)install all the scripts in BINDIR -( - cd ${CRTM_SCRIPTS_ROOT}/shell - # ...Get the script directory list - SCRIPTDIR_LIST=`ls -d` # current directory - SCRIPTDIR_LIST="${SCRIPTDIR_LIST} `ls -d */`" # subdirectories - # ...Install from each directory. - for SCRIPTDIR in ${SCRIPTDIR_LIST}; do - ( - # Enter directory, but skip if no scripts - cd $SCRIPTDIR - if [ -z "$(find . -maxdepth 1 -name "${SCRIPTFILE_GLOB}" -print -quit)" ]; then - continue - fi - - # Define the info message root to output - MSG_ROOT="`basename ${PWD}` scripts in ${BINDIR}" - - # Define the install type specifics - if [ ${INSTALL} -eq ${TRUE} ]; then - MSG_TYPE="Installing" - COMMAND='${LINK} ${PWD}/${SCRIPT} ${BINDIR}' - else - MSG_TYPE="Uninstalling" - COMMAND='${REMOVE} ${BINDIR}/${SCRIPT}' - fi - - # Perform the (un)installation - info_message "${MSG_TYPE} ${MSG_ROOT}..." - for SCRIPT in `ls ${SCRIPTFILE_GLOB}`; do - eval "${COMMAND}" - if [ $? -ne 0 ]; then - error_message "${MSG_TYPE} ${MSG_ROOT} failed" - exit ${FAILURE} - fi - done - ) - done -) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b887c36..6117f83 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -5,213 +5,232 @@ include(GNUInstallDirs) list( APPEND crtm_src_files - Ancillary/CRTM_AncillaryInput_Define.f90 - AntennaCorrection/CRTM_AntennaCorrection.f90 - AtmAbsorption/CRTM_AtmAbsorption.f90 - AtmAbsorption/CRTM_Predictor_Define.f90 - AtmAbsorption/CRTM_Predictor.f90 - AtmAbsorption/ODAS/ODAS_AtmAbsorption.f90 - AtmAbsorption/ODAS/ODAS_Predictor_Define.f90 - AtmAbsorption/ODAS/ODAS_Predictor.f90 - AtmAbsorption/ODPS/ODPS_AtmAbsorption.f90 - AtmAbsorption/ODPS/ODPS_CoordinateMapping.f90 - AtmAbsorption/ODPS/ODPS_Predictor_Define.f90 - AtmAbsorption/ODPS/ODPS_Predictor.f90 - AtmAbsorption/ODPS/PAFV_Define.f90 - AtmAbsorption/ODSSU/ODSSU_AtmAbsorption.f90 - AtmAbsorption/ODZeeman/ODZeeman_AtmAbsorption.f90 - AtmAbsorption/ODZeeman/ODZeeman_Predictor.f90 - AtmOptics/AOvar_Define.f90 - AtmOptics/CRTM_AtmOptics_Define.f90 - AtmOptics/CRTM_AtmOptics.f90 - Atmosphere/Aerosol/CRTM_Aerosol_Define.f90 - Atmosphere/Cloud/CRTM_CloudCover_Define.f90 - Atmosphere/Cloud/CRTM_Cloud_Define.f90 - Atmosphere/CRTM_Atmosphere_Define.f90 - Atmosphere/CRTM_Hypsometric.f90 - Atmosphere/CRTM_Relative_Humidity.f90 - Atmosphere/CRTM_Atmosphere.f90 - Atmosphere/CRTM_Model_Profiles.f90 - Atmosphere/iAtm_Define.f90 - AtmScatter/AerosolScatter/ASvar_Define.f90 - AtmScatter/CloudScatter/CSvar_Define.f90 - AtmScatter/CRTM_AerosolScatter.f90 - AtmScatter/CRTM_AOD_Module.f90 - AtmScatter/CRTM_CloudScatter.f90 - AtmScatter/CRTM_MoleculeScatter.f90 - ChannelInfo/CRTM_ChannelInfo_Define.f90 - Coefficients/ACCoeff/ACCoeff_Binary_IO.f90 - Coefficients/ACCoeff/ACCoeff_netCDF_IO.f90 - Coefficients/ACCoeff/ACCoeff_Define.f90 - Coefficients/AerosolCoeff/AerosolCoeff_Binary_IO.f90 - Coefficients/AerosolCoeff/AerosolCoeff_Define.f90 - Coefficients/AerosolCoeff/AerosolCoeff_netCDF_IO.f90 - Coefficients/AerosolCoeff/AerosolCoeff_IO.f90 - Coefficients/CloudCoeff/CloudCoeff_Binary_IO.f90 - Coefficients/CloudCoeff/CloudCoeff_Define.f90 - Coefficients/CloudCoeff/CloudCoeff_netCDF_IO.f90 - Coefficients/CloudCoeff/CloudCoeff_IO.f90 - Coefficients/CRTM_AerosolCoeff.f90 - Coefficients/CRTM_CloudCoeff.f90 - Coefficients/CRTM_IRiceCoeff.f90 - Coefficients/CRTM_IRlandCoeff.f90 - Coefficients/CRTM_IRsnowCoeff.f90 - Coefficients/CRTM_IRwaterCoeff.f90 - Coefficients/CRTM_MWwaterCoeff.f90 - Coefficients/CRTM_SpcCoeff.f90 - Coefficients/CRTM_TauCoeff.f90 - Coefficients/CRTM_VISiceCoeff.f90 - Coefficients/CRTM_VISlandCoeff.f90 - Coefficients/CRTM_VISsnowCoeff.f90 - Coefficients/CRTM_VISwaterCoeff.f90 - Coefficients/EmisCoeff/IR_Land/LSEatlas/LSEatlas_Define.f90 - Coefficients/EmisCoeff/IR_Water/IRwaterCoeff_Define.f90 - Coefficients/EmisCoeff/IR_Water/IRwaterCoeff_IO.f90 - Coefficients/EmisCoeff/IR_Water/IRwaterCoeff_netCDF_IO.f90 - Coefficients/EmisCoeff/IR_Snow/IRsnowCoeff_Define.f90 - Coefficients/EmisCoeff/IR_Snow/IRsnowCoeff_IO.f90 - Coefficients/EmisCoeff/IR_Snow/IRsnowCoeff_Binary_IO.f90 - Coefficients/EmisCoeff/IR_Snow/IRsnowCoeff_netCDF_IO.f90 - Coefficients/EmisCoeff/MW_Water/MWwaterCoeff_Define.f90 - Coefficients/EmisCoeff/MW_Water/MWwaterLUT/MWwaterLUT_Define.f90 - Coefficients/EmisCoeff/SEcategory/SEcategory_Define.f90 - Coefficients/EmisCoeff/SEcategory/SEcategory_IO.f90 - Coefficients/EmisCoeff/SEcategory/SEcategory_netCDF_IO.f90 - Coefficients/FitCoeff/FitCoeff_Define.f90 - Coefficients/FitCoeff/FitCoeff_Destroy.inc - Coefficients/FitCoeff/FitCoeff_Equal.inc - Coefficients/FitCoeff/FitCoeff_Info.inc - Coefficients/FitCoeff/FitCoeff_ReadFile.inc - Coefficients/FitCoeff/FitCoeff_SetValue.inc - Coefficients/FitCoeff/FitCoeff_WriteFile.inc - Coefficients/NLTECoeff/NLTECoeff_Binary_IO.f90 - Coefficients/NLTECoeff/NLTECoeff_netCDF_IO.f90 - Coefficients/NLTECoeff/NLTECoeff_Define.f90 - Coefficients/SpcCoeff/SpcCoeff_Binary_IO.f90 - Coefficients/SpcCoeff/SpcCoeff_Define.f90 - Coefficients/SpcCoeff/SpcCoeff_IO.f90 - Coefficients/SpcCoeff/SpcCoeff_netCDF_IO.f90 - Coefficients/TauCoeff/ODAS/ODAS_Binary_IO.f90 - Coefficients/TauCoeff/ODAS/ODAS_netCDF_IO.f90 - Coefficients/TauCoeff/ODAS/ODAS_Define.f90 - Coefficients/TauCoeff/ODAS/ODAS_TauCoeff.f90 - Coefficients/TauCoeff/ODPS/ODPS_Binary_IO.f90 - Coefficients/TauCoeff/ODPS/ODPS_netCDF_IO.f90 - Coefficients/TauCoeff/ODPS/ODPS_Define.f90 - Coefficients/TauCoeff/ODPS/ODPS_TauCoeff.f90 - Coefficients/TauCoeff/ODSSU/ODSSU_Binary_IO.f90 - Coefficients/TauCoeff/ODSSU/ODSSU_Define.f90 - Coefficients/TauCoeff/ODSSU/ODSSU_TauCoeff.f90 - Coefficients/TauCoeff/ODZeeman/ODZeeman_TauCoeff.f90 - Coefficients/TauCoeff/TauCoeff_Define.f90 - CRTM_Adjoint_Module.f90 - CRTM_Forward_Module.f90 - CRTM_K_Matrix_Module.f90 - CRTM_LifeCycle.f90 - CRTM_Module.F90 - CRTM_Parameters.f90 - CRTM_Tangent_Linear_Module.f90 - CRTM_Utility/CRTM_Utility.f90 - CRTM_Version.inc - GeometryInfo/CRTM_Geometry_Define.f90 - GeometryInfo/CRTM_GeometryInfo_Define.f90 - GeometryInfo/CRTM_GeometryInfo.f90 - InstrumentInfo/Instruments/Subset_Define.f90 - InstrumentInfo/SensorInfo/SensorInfo_Parameters.f90 - Interpolation/CRTM_Interpolation.f90 - NLTE/NLTE_Correction/CRTM_NLTECorrection.f90 - NLTE/NLTE_Parameters.f90 - NLTE/NLTE_Predictor/NLTE_Predictor_Define.f90 - NLTE/NLTE_Predictor/NLTE_Predictor_IO.f90 - Options/CRTM_Options_Define.f90 - Options/SSU_Input/SSU_Input_Define.f90 - Options/Zeeman_Input/Zeeman_Input_Define.f90 - RTSolution/ADA/ADA_Module.f90 - RTSolution/Common_RTSolution.f90 - RTSolution/CRTM_RTSolution_Define.f90 - RTSolution/CRTM_RTSolution.f90 - RTSolution/CRTM_Active_Sensor.f90 - RTSolution/Emission/Emission_Module.f90 - RTSolution/RTV_Define.f90 - RTSolution/SOI/SOI_Module.f90 - SensorInfo/CRTM_SensorInfo.f90 - SfcOptics/CRTM_IR_Ice_SfcOptics.f90 - SfcOptics/CRTM_IR_Land_SfcOptics.f90 - SfcOptics/CRTM_IR_Snow_SfcOptics.f90 - SfcOptics/CRTM_IR_Water_SfcOptics.f90 - SfcOptics/CRTM_MW_Ice_SfcOptics.f90 - SfcOptics/CRTM_MW_Land_SfcOptics.f90 - SfcOptics/CRTM_MW_Snow_SfcOptics.f90 - SfcOptics/CRTM_MW_Water_SfcOptics.f90 - SfcOptics/CRTM_SfcOptics_Define.f90 - SfcOptics/CRTM_SfcOptics.f90 - SfcOptics/CRTM_VIS_Ice_SfcOptics.f90 - SfcOptics/CRTM_VIS_Land_SfcOptics.f90 - SfcOptics/CRTM_VIS_Snow_SfcOptics.f90 - SfcOptics/CRTM_VIS_Water_SfcOptics.f90 - SfcOptics/IR_Water/IRSSEM/CRTM_IRSSEM.f90 - SfcOptics/IR_Snow/CRTM_IRSnowEM.f90 - SfcOptics/MW_Water/FASTEM_MWSSEM/Azimuth_Emissivity_F6_Module.f90 - SfcOptics/MW_Water/FASTEM_MWSSEM/Azimuth_Emissivity_Module.f90 - SfcOptics/MW_Water/FASTEM_MWSSEM/CRTM_Fastem1.f90 - SfcOptics/MW_Water/FASTEM_MWSSEM/CRTM_FastemX.f90 - SfcOptics/MW_Water/FASTEM_MWSSEM/Foam_Utility_Module.f90 - SfcOptics/MW_Water/FASTEM_MWSSEM/Large_Scale_Correction_Module.f90 - SfcOptics/MW_Water/FASTEM_MWSSEM/Reflection_Correction_Module.f90 - SfcOptics/MW_Water/FASTEM_MWSSEM/Slope_Variance.f90 - SfcOptics/MW_Water/FASTEM_MWSSEM/Small_Scale_Correction_Module.f90 - SfcOptics/MW_Water/Fresnel/Fresnel.f90 - SfcOptics/MW_Water/LowFrequency_MWSSEM/CRTM_LowFrequency_MWSSEM.f90 - SfcOptics/MW_Water/Ocean_Permittivity/Ellison.f90 - SfcOptics/MW_Water/Ocean_Permittivity/Guillou.f90 - SfcOptics/MW_Water/Ocean_Permittivity/Liu.f90 - SfcOptics/NESDIS_Emissivity/NESDIS_AMSRE_SICEEM_Module.f90 - SfcOptics/NESDIS_Emissivity/NESDIS_AMSRE_SNOWEM_Module.f90 - SfcOptics/NESDIS_Emissivity/NESDIS_AMSU_SICEEM_Module.f90 - SfcOptics/NESDIS_Emissivity/NESDIS_AMSU_SnowEM_Module.f90 - SfcOptics/NESDIS_Emissivity/NESDIS_ATMS_SeaICE_LIB.f90 - SfcOptics/NESDIS_Emissivity/NESDIS_ATMS_SeaICE_Module.f90 - SfcOptics/NESDIS_Emissivity/NESDIS_ATMS_SnowEM_Module.f90 - SfcOptics/NESDIS_Emissivity/NESDIS_LandEM_Module.f90 - SfcOptics/NESDIS_Emissivity/NESDIS_MHS_SICEEM_Module.f90 - SfcOptics/NESDIS_Emissivity/NESDIS_MHS_SnowEM_Module.f90 - SfcOptics/NESDIS_Emissivity/NESDIS_SEAICE_PHYEM_MODULE.f90 - SfcOptics/NESDIS_Emissivity/NESDIS_SnowEM_ATMS_Parameters.f90 - SfcOptics/NESDIS_Emissivity/NESDIS_SnowEM_Parameters.f90 - SfcOptics/NESDIS_Emissivity/NESDIS_SSMI_Module.f90 - SfcOptics/NESDIS_Emissivity/NESDIS_SSMI_SIceEM_Module.f90 - SfcOptics/NESDIS_Emissivity/NESDIS_SSMI_SnowEM_Module.f90 - SfcOptics/NESDIS_Emissivity/NESDIS_SSMIS_SeaIceEM_Module.f90 - SfcOptics/NESDIS_Emissivity/NESDIS_SSMIS_SnowEM_Module.f90 - SfcOptics/SEcategory/CRTM_SEcategory.f90 - Source_Functions/CRTM_Planck_Functions.f90 - Surface/CRTM_Surface_Define.f90 - Surface/SensorData/CRTM_SensorData_Define.f90 - Test_Utility/UnitTest/UnitTest_Define.f90 - Utility/Binary_File_Utility.f90 - Utility/Compare_Float_Numbers.f90 - Utility/DateTime_Utility/DateTime_Utility.f90 - Utility/DateTime_Utility/Date_Utility.f90 - Utility/Endian_Utility/Endian_Utility.f90 - Utility/File_Utility.f90 - Utility/Fundamental_Constants.f90 - Utility/Hyperbolic_Step/Hyperbolic_Step.f90 - Utility/Message_Handler.f90 - Utility/netCDF/netCDF_Attribute_Utility.f90 - Utility/netCDF/netCDF_Dimension_Utility.f90 - Utility/netCDF/netCDF_Utility.f90 - Utility/netCDF/netCDF_Variable_Utility.f90 - Utility/Profile_Utility/Profile_Utility_Parameters.f90 - Utility/Search_Utility/Search_Utility.f90 - Utility/Sort_Utility/Sort_Utility.f90 - Utility/Spectral_Utility/Spectral_Units_Conversion.f90 - Utility/String_Utility.f90 - Utility/Timing_Utility.f90 - Utility/Type_Kinds.f90 - Zeeman/Zeeman_Utility.f90 + Ancillary/CRTM_AncillaryInput_Define.f90 + AntennaCorrection/CRTM_AntennaCorrection.f90 + AtmAbsorption/CRTM_AtmAbsorption.f90 + AtmAbsorption/CRTM_Predictor_Define.f90 + AtmAbsorption/CRTM_Predictor.f90 + AtmAbsorption/ODAS/ODAS_AtmAbsorption.f90 + AtmAbsorption/ODAS/ODAS_Predictor_Define.f90 + AtmAbsorption/ODAS/ODAS_Predictor.f90 + AtmAbsorption/ODPS/ODPS_AtmAbsorption.f90 + AtmAbsorption/ODPS/ODPS_CoordinateMapping.f90 + AtmAbsorption/ODPS/ODPS_Predictor_Define.f90 + AtmAbsorption/ODPS/ODPS_Predictor.f90 + AtmAbsorption/ODPS/PAFV_Define.f90 + AtmAbsorption/ODSSU/ODSSU_AtmAbsorption.f90 + AtmAbsorption/ODZeeman/ODZeeman_AtmAbsorption.f90 + AtmAbsorption/ODZeeman/ODZeeman_Predictor.f90 + AtmOptics/AOvar_Define.f90 + AtmOptics/CRTM_AtmOptics_Define.f90 + AtmOptics/CRTM_AtmOptics.f90 + Atmosphere/Aerosol/CRTM_Aerosol_Define.f90 + Atmosphere/Cloud/CRTM_CloudCover_Define.f90 + Atmosphere/Cloud/CRTM_Cloud_Define.f90 + Atmosphere/CRTM_Atmosphere_Define.f90 + Atmosphere/CRTM_Hypsometric.f90 + Atmosphere/CRTM_Relative_Humidity.f90 + Atmosphere/CRTM_Atmosphere.f90 + Atmosphere/CRTM_Model_Profiles.f90 + Atmosphere/iAtm_Define.f90 + AtmScatter/AerosolScatter/ASvar_Define.f90 + AtmScatter/CloudScatter/CSvar_Define.f90 + AtmScatter/CRTM_AerosolScatter.f90 + AtmScatter/CRTM_AOD_Module.f90 + AtmScatter/CRTM_CloudScatter.f90 + AtmScatter/CRTM_MoleculeScatter.f90 + ChannelInfo/CRTM_ChannelInfo_Define.f90 + Coefficients/ACCoeff/ACCoeff_Binary_IO.f90 + Coefficients/ACCoeff/ACCoeff_netCDF_IO.f90 + Coefficients/ACCoeff/ACCoeff_Define.f90 + Coefficients/AerosolCoeff/AerosolCoeff_Binary_IO.f90 + Coefficients/AerosolCoeff/AerosolCoeff_Define.f90 + Coefficients/AerosolCoeff/AerosolCoeff_netCDF_IO.f90 + Coefficients/AerosolCoeff/AerosolCoeff_IO.f90 + Coefficients/CloudCoeff/CloudCoeff_Binary_IO.f90 + Coefficients/CloudCoeff/CloudCoeff_Define.f90 + Coefficients/CloudCoeff/CloudCoeff_netCDF_IO.f90 + Coefficients/CloudCoeff/CloudCoeff_IO.f90 + Coefficients/CRTM_AerosolCoeff.f90 + Coefficients/CRTM_CloudCoeff.f90 + Coefficients/CRTM_IRiceCoeff.f90 + Coefficients/CRTM_IRlandCoeff.f90 + Coefficients/CRTM_IRsnowCoeff.f90 + Coefficients/CRTM_IRwaterCoeff.f90 + Coefficients/CRTM_MWwaterCoeff.f90 + Coefficients/CRTM_SpcCoeff.f90 + Coefficients/CRTM_TauCoeff.f90 + Coefficients/CRTM_VISiceCoeff.f90 + Coefficients/CRTM_VISlandCoeff.f90 + Coefficients/CRTM_VISsnowCoeff.f90 + Coefficients/CRTM_VISwaterCoeff.f90 + Coefficients/EmisCoeff/IR_Land/LSEatlas/LSEatlas_Define.f90 + Coefficients/EmisCoeff/IR_Water/IRwaterCoeff_Define.f90 + Coefficients/EmisCoeff/IR_Water/IRwaterCoeff_IO.f90 + Coefficients/EmisCoeff/IR_Water/IRwaterCoeff_netCDF_IO.f90 + Coefficients/EmisCoeff/IR_Snow/IRsnowCoeff_Define.f90 + Coefficients/EmisCoeff/IR_Snow/IRsnowCoeff_IO.f90 + Coefficients/EmisCoeff/IR_Snow/IRsnowCoeff_Binary_IO.f90 + Coefficients/EmisCoeff/IR_Snow/IRsnowCoeff_netCDF_IO.f90 + Coefficients/EmisCoeff/MW_Water/MWwaterCoeff_Define.f90 + Coefficients/EmisCoeff/MW_Water/MWwaterLUT/MWwaterLUT_Define.f90 + Coefficients/EmisCoeff/SEcategory/SEcategory_Define.f90 + Coefficients/EmisCoeff/SEcategory/SEcategory_IO.f90 + Coefficients/EmisCoeff/SEcategory/SEcategory_netCDF_IO.f90 + Coefficients/FitCoeff/FitCoeff_Define.f90 + Coefficients/FitCoeff/FitCoeff_Destroy.inc + Coefficients/FitCoeff/FitCoeff_Equal.inc + Coefficients/FitCoeff/FitCoeff_Info.inc + Coefficients/FitCoeff/FitCoeff_ReadFile.inc + Coefficients/FitCoeff/FitCoeff_SetValue.inc + Coefficients/FitCoeff/FitCoeff_WriteFile.inc + Coefficients/NLTECoeff/NLTECoeff_Binary_IO.f90 + Coefficients/NLTECoeff/NLTECoeff_netCDF_IO.f90 + Coefficients/NLTECoeff/NLTECoeff_Define.f90 + Coefficients/SpcCoeff/SpcCoeff_Binary_IO.f90 + Coefficients/SpcCoeff/SpcCoeff_Define.f90 + Coefficients/SpcCoeff/SpcCoeff_IO.f90 + Coefficients/SpcCoeff/SpcCoeff_netCDF_IO.f90 + Coefficients/TauCoeff/ODAS/ODAS_Binary_IO.f90 + Coefficients/TauCoeff/ODAS/ODAS_netCDF_IO.f90 + Coefficients/TauCoeff/ODAS/ODAS_Define.f90 + Coefficients/TauCoeff/ODAS/ODAS_TauCoeff.f90 + Coefficients/TauCoeff/ODPS/ODPS_Binary_IO.f90 + Coefficients/TauCoeff/ODPS/ODPS_netCDF_IO.f90 + Coefficients/TauCoeff/ODPS/ODPS_Define.f90 + Coefficients/TauCoeff/ODPS/ODPS_TauCoeff.f90 + Coefficients/TauCoeff/ODSSU/ODSSU_Binary_IO.f90 + Coefficients/TauCoeff/ODSSU/ODSSU_Define.f90 + Coefficients/TauCoeff/ODSSU/ODSSU_TauCoeff.f90 + Coefficients/TauCoeff/ODZeeman/ODZeeman_TauCoeff.f90 + Coefficients/TauCoeff/TauCoeff_Define.f90 + CRTM_Adjoint_Module.f90 + CRTM_Forward_Module.f90 + CRTM_K_Matrix_Module.f90 + CRTM_LifeCycle.f90 + CRTM_Module.F90 + CRTM_Parameters.f90 + CRTM_Tangent_Linear_Module.f90 + CRTM_Utility/CRTM_Utility.f90 + CRTM_Version.inc + GeometryInfo/CRTM_Geometry_Define.f90 + GeometryInfo/CRTM_GeometryInfo_Define.f90 + GeometryInfo/CRTM_GeometryInfo.f90 + InstrumentInfo/Instruments/Subset_Define.f90 + InstrumentInfo/SensorInfo/SensorInfo_Parameters.f90 + Interpolation/CRTM_Interpolation.f90 + NLTE/NLTE_Correction/CRTM_NLTECorrection.f90 + NLTE/NLTE_Parameters.f90 + NLTE/NLTE_Predictor/NLTE_Predictor_Define.f90 + NLTE/NLTE_Predictor/NLTE_Predictor_IO.f90 + Options/CRTM_Options_Define.f90 + Options/SSU_Input/SSU_Input_Define.f90 + Options/Zeeman_Input/Zeeman_Input_Define.f90 + RTSolution/ADA/ADA_Module.f90 + RTSolution/Common_RTSolution.f90 + RTSolution/CRTM_RTSolution_Define.f90 + RTSolution/CRTM_RTSolution.f90 + RTSolution/CRTM_Active_Sensor.f90 + RTSolution/Emission/Emission_Module.f90 + RTSolution/RTV_Define.f90 + RTSolution/SOI/SOI_Module.f90 + SensorInfo/CRTM_SensorInfo.f90 + SfcOptics/CRTM_IR_Ice_SfcOptics.f90 + SfcOptics/CRTM_IR_Land_SfcOptics.f90 + SfcOptics/CRTM_IR_Snow_SfcOptics.f90 + SfcOptics/CRTM_IR_Water_SfcOptics.f90 + SfcOptics/CRTM_MW_Ice_SfcOptics.f90 + SfcOptics/CRTM_MW_Land_SfcOptics.f90 + SfcOptics/CRTM_MW_Snow_SfcOptics.f90 + SfcOptics/CRTM_MW_Water_SfcOptics.f90 + SfcOptics/CRTM_SfcOptics_Define.f90 + SfcOptics/CRTM_SfcOptics.f90 + SfcOptics/CRTM_VIS_Ice_SfcOptics.f90 + SfcOptics/CRTM_VIS_Land_SfcOptics.f90 + SfcOptics/CRTM_VIS_Snow_SfcOptics.f90 + SfcOptics/CRTM_VIS_Water_SfcOptics.f90 + SfcOptics/IR_Water/IRSSEM/CRTM_IRSSEM.f90 + SfcOptics/IR_Snow/CRTM_IRSnowEM.f90 + SfcOptics/MW_Water/FASTEM_MWSSEM/Azimuth_Emissivity_F6_Module.f90 + SfcOptics/MW_Water/FASTEM_MWSSEM/Azimuth_Emissivity_Module.f90 + SfcOptics/MW_Water/FASTEM_MWSSEM/CRTM_Fastem1.f90 + SfcOptics/MW_Water/FASTEM_MWSSEM/CRTM_FastemX.f90 + SfcOptics/MW_Water/FASTEM_MWSSEM/Foam_Utility_Module.f90 + SfcOptics/MW_Water/FASTEM_MWSSEM/Large_Scale_Correction_Module.f90 + SfcOptics/MW_Water/FASTEM_MWSSEM/Reflection_Correction_Module.f90 + SfcOptics/MW_Water/FASTEM_MWSSEM/Slope_Variance.f90 + SfcOptics/MW_Water/FASTEM_MWSSEM/Small_Scale_Correction_Module.f90 + SfcOptics/MW_Water/Fresnel/Fresnel.f90 + SfcOptics/MW_Water/LowFrequency_MWSSEM/CRTM_LowFrequency_MWSSEM.f90 + SfcOptics/MW_Water/Ocean_Permittivity/Ellison.f90 + SfcOptics/MW_Water/Ocean_Permittivity/Guillou.f90 + SfcOptics/MW_Water/Ocean_Permittivity/Liu.f90 + SfcOptics/NESDIS_Emissivity/NESDIS_AMSRE_SICEEM_Module.f90 + SfcOptics/NESDIS_Emissivity/NESDIS_AMSRE_SNOWEM_Module.f90 + SfcOptics/NESDIS_Emissivity/NESDIS_AMSU_SICEEM_Module.f90 + SfcOptics/NESDIS_Emissivity/NESDIS_AMSU_SnowEM_Module.f90 + SfcOptics/NESDIS_Emissivity/NESDIS_ATMS_SeaICE_LIB.f90 + SfcOptics/NESDIS_Emissivity/NESDIS_ATMS_SeaICE_Module.f90 + SfcOptics/NESDIS_Emissivity/NESDIS_ATMS_SnowEM_Module.f90 + SfcOptics/NESDIS_Emissivity/NESDIS_LandEM_Module.f90 + SfcOptics/NESDIS_Emissivity/NESDIS_MHS_SICEEM_Module.f90 + SfcOptics/NESDIS_Emissivity/NESDIS_MHS_SnowEM_Module.f90 + SfcOptics/NESDIS_Emissivity/NESDIS_SEAICE_PHYEM_MODULE.f90 + SfcOptics/NESDIS_Emissivity/NESDIS_SnowEM_ATMS_Parameters.f90 + SfcOptics/NESDIS_Emissivity/NESDIS_SnowEM_Parameters.f90 + SfcOptics/NESDIS_Emissivity/NESDIS_SSMI_Module.f90 + SfcOptics/NESDIS_Emissivity/NESDIS_SSMI_SIceEM_Module.f90 + SfcOptics/NESDIS_Emissivity/NESDIS_SSMI_SnowEM_Module.f90 + SfcOptics/NESDIS_Emissivity/NESDIS_SSMIS_SeaIceEM_Module.f90 + SfcOptics/NESDIS_Emissivity/NESDIS_SSMIS_SnowEM_Module.f90 + SfcOptics/SEcategory/CRTM_SEcategory.f90 + Source_Functions/CRTM_Planck_Functions.f90 + Surface/CRTM_Surface_Define.f90 + Surface/SensorData/CRTM_SensorData_Define.f90 + Test_Utility/UnitTest/UnitTest_Define.f90 + Utility/Binary_File_Utility.f90 + Utility/Compare_Float_Numbers.f90 + Utility/DateTime_Utility/DateTime_Utility.f90 + Utility/DateTime_Utility/Date_Utility.f90 + Utility/Endian_Utility/Endian_Utility.f90 + Utility/File_Utility.f90 + Utility/Fundamental_Constants.f90 + Utility/Hyperbolic_Step/Hyperbolic_Step.f90 + Utility/Message_Handler.f90 + Utility/netCDF/netCDF_Attribute_Utility.f90 + Utility/netCDF/netCDF_Dimension_Utility.f90 + Utility/netCDF/netCDF_Utility.f90 + Utility/netCDF/netCDF_Variable_Utility.f90 + Utility/Profile_Utility/Profile_Utility_Parameters.f90 + Utility/Search_Utility/Search_Utility.f90 + Utility/Sort_Utility/Sort_Utility.f90 + Utility/Spectral_Utility/Spectral_Units_Conversion.f90 + Utility/String_Utility.f90 + Utility/Timing_Utility.f90 + Utility/Type_Kinds.f90 + Zeeman/Zeeman_Utility.f90 ) -add_library(${PROJECT_NAME} STATIC ${${PROJECT_NAME}_src_files}) +if(((CMAKE_BUILD_TYPE STREQUAL "Debug") OR (CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")) AND CMAKE_Fortran_COMPILER_ID STREQUAL "Intel") + SET_SOURCE_FILES_PROPERTIES(RTSolution/ADA/ADA_Module.f90 APPEND_STRING PROPERTY COMPILE_FLAGS " -check none -check bounds,pointers,uninit") +endif() + +# Option to select between shared and static libraries +option(BUILD_SHARED_LIBS "Build shared libraries instead of static ones" ON) + +# Determine the type of library to build +set(LIBRARY_TYPE STATIC) +if(BUILD_SHARED_LIBS) + set(LIBRARY_TYPE SHARED) +endif() + +# Conditional flags based on the build type and compiler +if(((CMAKE_BUILD_TYPE STREQUAL "Debug") OR (CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")) AND CMAKE_Fortran_COMPILER_ID STREQUAL "Intel") + SET_SOURCE_FILES_PROPERTIES(RTSolution/ADA/ADA_Module.f90 APPEND_STRING PROPERTY COMPILE_FLAGS " -check none -check bounds,pointers,uninit") +endif() + +# Build the library based on the selected type +add_library(${PROJECT_NAME} ${LIBRARY_TYPE} ${${PROJECT_NAME}_src_files}) # Dependencies target_link_libraries(${PROJECT_NAME} PUBLIC OpenMP::OpenMP_Fortran) @@ -222,5 +241,5 @@ set(MODULE_DIR module/${PROJECT_NAME}/${CMAKE_Fortran_COMPILER_ID}/${CMAKE_Fortr set_target_properties(${PROJECT_NAME} PROPERTIES Fortran_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/${MODULE_DIR}) install(DIRECTORY ${CMAKE_BINARY_DIR}/${MODULE_DIR}/ DESTINATION ${MODULE_DIR}) target_include_directories(${PROJECT_NAME} INTERFACE - $ - $) + $ + $) diff --git a/src/Coefficients/SpcCoeff/SpcCoeff_BIN2NC/SpcCoeff_BIN2NC.f90 b/src/Coefficients/SpcCoeff/SpcCoeff_BIN2NC/SpcCoeff_BIN2NC.f90 index 6599137..9070d33 100644 --- a/src/Coefficients/SpcCoeff/SpcCoeff_BIN2NC/SpcCoeff_BIN2NC.f90 +++ b/src/Coefficients/SpcCoeff/SpcCoeff_BIN2NC/SpcCoeff_BIN2NC.f90 @@ -35,9 +35,9 @@ PROGRAM SpcCoeff_BIN2NC INTEGER :: err_stat CHARACTER(256) :: msg CHARACTER(256) :: BIN_filename - CHARACTER(256) :: NC_filename - CHARACTER(256) :: answer + CHARACTER(256) :: NC_filename, tmp_filename CHARACTER(256) :: version_str + INTEGER :: n_args ! Program header CALL CRTM_Version(version_str) @@ -45,17 +45,27 @@ PROGRAM SpcCoeff_BIN2NC 'Program to convert a CRTM SpcCoeff data file from Binary to netCDF format.', & 'CRTM Version: '//TRIM(version_str) ) - ! Get the filenames - IF ( Big_Endian() ) THEN - WRITE(*,FMT='(/5x,"Enter the INPUT Binary [Big Endian] SpcCoeff filename : ")', ADVANCE='NO') - ELSE - WRITE(*,FMT='(/5x,"Enter the INPUT Binary [Little Endian] SpcCoeff filename : ")', ADVANCE='NO') + ! Get the filename ! Check for command line argument + n_args = COMMAND_ARGUMENT_COUNT() + IF ( n_args > 0 ) THEN + CALL GET_COMMAND_ARGUMENT(1, BIN_filename) + tmp_filename = BIN_filename(1:LEN_TRIM(BIN_filename) - 4)//".nc" + NC_filename = TRIM(ADJUSTL(tmp_filename)) + PRINT *, "NC_filename:", NC_filename + ELSE + ! Get the filenames + IF ( Big_Endian() ) THEN + WRITE(*,FMT='(/5x,"Enter the INPUT Binary [Big Endian] SpcCoeff filename : ")', ADVANCE='NO') + ELSE + WRITE(*,FMT='(/5x,"Enter the INPUT Binary [Little Endian] SpcCoeff filename : ")', ADVANCE='NO') + END IF + READ(*,'(a)') BIN_filename + BIN_filename = ADJUSTL(BIN_filename) + WRITE(*,FMT='(/5x,"Enter the OUTPUT netCDF SpcCoeff filename: ")', ADVANCE='NO') + READ(*,'(a)') NC_filename + NC_filename = ADJUSTL(NC_filename) END IF - READ(*,'(a)') BIN_filename - BIN_filename = ADJUSTL(BIN_filename) - WRITE(*,FMT='(/5x,"Enter the OUTPUT netCDF SpcCoeff filename: ")', ADVANCE='NO') - READ(*,'(a)') NC_filename - NC_filename = ADJUSTL(NC_filename) + ! ...Sanity check that they're not the same IF ( bin_filename == nc_filename ) THEN diff --git a/src/Coefficients/SpcCoeff/SpcCoeff_Binary_IO.f90 b/src/Coefficients/SpcCoeff/SpcCoeff_Binary_IO.f90 index 76f1abd..1c4b4e8 100644 --- a/src/Coefficients/SpcCoeff/SpcCoeff_Binary_IO.f90 +++ b/src/Coefficients/SpcCoeff/SpcCoeff_Binary_IO.f90 @@ -418,7 +418,7 @@ FUNCTION SpcCoeff_Binary_ReadFile( & END IF ! ...Read the channel data - IF( dummy%Version > 2 ) THEN + IF( dummy%Version > 3 ) THEN ! Binary coefficient version 3 introduced for TROPICS instrument. ! The SpcCoeff coefficients contain 'PolAngle' as an additional ! array. @@ -435,7 +435,7 @@ FUNCTION SpcCoeff_Binary_ReadFile( & SpcCoeff%Band_C2 , & SpcCoeff%Cosmic_Background_Radiance, & SpcCoeff%Solar_Irradiance - ELSE IF( dummy%Version < 3 ) THEN + ELSE IF( dummy%Version < 4 ) THEN ! Version 2 is the default binary SpcCoeff version for ! REL-2.4.0 and older. READ ( fid, IOSTAT=io_stat, IOMSG=io_msg ) & @@ -693,7 +693,7 @@ FUNCTION SpcCoeff_Binary_WriteFile( & CALL Write_Cleanup(); RETURN END IF ! ...Write the channel data - IF(SpcCoeff%Version > 2) THEN + IF(SpcCoeff%Version > 3) THEN WRITE( fid, IOSTAT=io_stat ) & SpcCoeff%Sensor_Channel , & SpcCoeff%Polarization , & @@ -707,7 +707,7 @@ FUNCTION SpcCoeff_Binary_WriteFile( & SpcCoeff%Band_C2 , & SpcCoeff%Cosmic_Background_Radiance, & SpcCoeff%Solar_Irradiance - ELSE IF(SpcCoeff%Version < 3) THEN + ELSE IF(SpcCoeff%Version < 4) THEN WRITE( fid, IOSTAT=io_stat ) & SpcCoeff%Sensor_Channel , & SpcCoeff%Polarization , & diff --git a/src/Coefficients/SpcCoeff/SpcCoeff_IO.f90 b/src/Coefficients/SpcCoeff/SpcCoeff_IO.f90 index c691731..ead7e49 100644 --- a/src/Coefficients/SpcCoeff/SpcCoeff_IO.f90 +++ b/src/Coefficients/SpcCoeff/SpcCoeff_IO.f90 @@ -26,8 +26,11 @@ MODULE SpcCoeff_IO USE SpcCoeff_netCDF_IO , ONLY: SpcCoeff_netCDF_InquireFile, & SpcCoeff_netCDF_ReadFile , & SpcCoeff_netCDF_WriteFile - USE ACCoeff_netCDF_IO , ONLY: ACCoeff_netCDF_ReadFile - USE NLTECoeff_netCDF_IO, ONLY: NLTECoeff_netCDF_ReadFile + USE ACCoeff_Define , ONLY: ACCoeff_Associated + USE NLTECoeff_Define , ONLY: NLTECoeff_Associated + USE ACCoeff_netCDF_IO , ONLY: ACCoeff_netCDF_ReadFile, ACCoeff_netCDF_WriteFile + USE NLTECoeff_netCDF_IO, ONLY: NLTECoeff_netCDF_ReadFile, NLTECoeff_netCDF_WriteFile + ! Disable implicit typing IMPLICIT NONE @@ -820,26 +823,62 @@ FUNCTION SpcCoeff_Binary_to_netCDF( & END IF END IF - ! Read the substructure netCDF filenames + + ! Read the substructure netCDF filenames ! ...ACCoeff sub_filename = TRIM(spccoeff%Sensor_Id)//'.ACCoeff.nc' IF ( File_Exists(sub_filename) ) THEN err_stat = ACCoeff_netCDF_ReadFile( sub_filename, spccoeff%AC, Quiet = Quiet ) IF ( err_stat /= SUCCESS ) THEN - msg = 'Error reading netCDF file '//TRIM(sub_filename) + msg = 'Error reading existing ACCoeff netCDF file '//TRIM(sub_filename) CALL Display_Message( ROUTINE_NAME, msg, err_stat ) RETURN END IF + ELSE + IF ( ACCoeff_Associated(spccoeff%AC) ) THEN + !** there's no external file, but there's an ACCoeff structure + !** yoink the spccoeff%AC into sub_filename + err_stat = ACCoeff_netCDF_WriteFile( & + sub_filename , & + spccoeff%AC , & + Quiet = Quiet , & + Title = "Earth, Platform, Space antenna efficiencies for "//trim(adjustl(spccoeff%sensor_id))//" for each fov, channel.", & + History = "Extracted from "//trim(adjustl(BIN_Filename))//" using "//trim(adjustl(ROUTINE_NAME))//" Benjamin.T.Johnson@noaa.gov" , & + Comment = "" ) + IF ( err_stat /= SUCCESS ) THEN + msg = 'Error creating ACCoeff netCDF file '//TRIM(sub_filename) + CALL Display_Message( ROUTINE_NAME, msg, err_stat ) + RETURN + END IF + END IF END IF + ! ...NLTECoeff sub_filename = TRIM(spccoeff%Sensor_Id)//'.NLTECoeff.nc' IF ( File_Exists(sub_filename) ) THEN - err_stat = NLTECoeff_netCDF_ReadFile( sub_filename, spccoeff%NC, Quiet = Quiet ) - IF ( err_stat /= SUCCESS ) THEN - msg = 'Error reading netCDF file '//TRIM(sub_filename) - CALL Display_Message( ROUTINE_NAME, msg, err_stat ) - RETURN - END IF + err_stat = NLTECoeff_netCDF_ReadFile( sub_filename, spccoeff%NC, Quiet = Quiet ) + IF ( err_stat /= SUCCESS ) THEN + msg = 'Error reading netCDF file '//TRIM(sub_filename) + CALL Display_Message( ROUTINE_NAME, msg, err_stat ) + RETURN + END IF + ELSE + IF ( NLTECoeff_Associated(spccoeff%NC) ) THEN + !** there's no external file, but there's an NLTECoeff structure + !** yoink the spccoeff%NC into sub_filename + err_stat = NLTECoeff_netCDF_WriteFile( & + sub_filename , & + spccoeff%NC , & + Quiet = Quiet , & + Title = "NLTE Coefficients for "//TRIM(ADJUSTL(spccoeff%sensor_id))//"." , & + History = "Extracted from "//TRIM(ADJUSTL(BIN_Filename))//" using "//TRIM(ADJUSTL(ROUTINE_NAME))//" Benjamin.T.Johnson@noaa.gov" , & + Comment = "" ) + IF ( err_stat /= SUCCESS ) THEN + msg = 'Error creating NLTECoeff netCDF file '//TRIM(sub_filename) + CALL Display_Message( ROUTINE_NAME, msg, err_stat ) + RETURN + END IF + END IF END IF diff --git a/src/Coefficients/SpcCoeff/SpcCoeff_Inspect/SpcCoeff_Inspect.f90 b/src/Coefficients/SpcCoeff/SpcCoeff_Inspect/SpcCoeff_Inspect.f90 index eaf1081..d283509 100644 --- a/src/Coefficients/SpcCoeff/SpcCoeff_Inspect/SpcCoeff_Inspect.f90 +++ b/src/Coefficients/SpcCoeff/SpcCoeff_Inspect/SpcCoeff_Inspect.f90 @@ -1,7 +1,7 @@ ! ! SpcCoeff_Inspect ! -! Program to inspect the contents of a CRTM Binary format SpcCoeff file. +! Program to inspect the contents of a CRTM SpcCoeff file (binary or netCDF) ! ! ! CREATION HISTORY: @@ -19,7 +19,7 @@ PROGRAM SpcCoeff_Inspect USE Message_Handler , ONLY: SUCCESS, FAILURE, Program_Message, Display_Message USE SpcCoeff_Define , ONLY: SpcCoeff_type, SpcCoeff_Destroy, & Inspect => SpcCoeff_Inspect - USE SpcCoeff_Binary_IO, ONLY: SpcCoeff_Binary_ReadFile + USE SpcCoeff_IO, ONLY: SpcCoeff_ReadFile ! Disable implicit typing IMPLICIT NONE @@ -36,6 +36,7 @@ PROGRAM SpcCoeff_Inspect CHARACTER(256) :: filename, msg INTEGER :: n_args TYPE(SpcCoeff_type) :: sc + LOGICAL :: is_nc, is_bin ! Generate a string containing the SpcCoeff release for info WRITE(msg,'(i10)') sc%Release @@ -44,7 +45,7 @@ PROGRAM SpcCoeff_Inspect ! Output program header CALL Program_Message( PROGRAM_NAME, & 'Program to display the contents of a CRTM '//& - 'Binary format R'//TRIM(ADJUSTL(msg))//' SpcCoeff '//& + 'Binary/netCDF format R'//TRIM(ADJUSTL(msg))//' SpcCoeff '//& 'file to stdout.', & '$Revision$' ) @@ -53,7 +54,7 @@ PROGRAM SpcCoeff_Inspect IF ( n_args > 0 ) THEN CALL GET_COMMAND_ARGUMENT(1, filename) ELSE - WRITE( *,FMT='(/5x,"Enter the Binary SpcCoeff filename: ")',ADVANCE='NO' ) + WRITE( *,FMT='(/5x,"Enter the SpcCoeff filename: ")',ADVANCE='NO' ) READ( *,'(a)' ) filename END IF filename = ADJUSTL(filename) @@ -62,10 +63,19 @@ PROGRAM SpcCoeff_Inspect CALL Display_Message( PROGRAM_NAME, msg, FAILURE ); STOP END IF - ! Read the binary data file - err_stat = SpcCoeff_Binary_ReadFile( filename, sc ) + ! Check if filename ends in ".nc" + is_nc = (INDEX(TRIM(filename), '.nc') == LEN_TRIM(filename) - 2) + + ! Check if filename ends in ".bin" + is_bin = (INDEX(TRIM(filename), '.bin') == LEN_TRIM(filename) - 3) + + err_stat = FAILURE + ! Read the data file + If (is_bin) err_stat = SpcCoeff_ReadFile( filename, sc ) + IF (is_nc) err_stat = SpcCoeff_ReadFile( filename, sc, netCDF=.TRUE. ) + IF ( err_stat /= SUCCESS ) THEN - msg = 'Error reading Binary SpcCoeff file '//TRIM(filename) + msg = 'Error reading SpcCoeff file '//TRIM(filename) CALL Display_Message( PROGRAM_NAME, msg, FAILURE ); STOP END IF diff --git a/src/Coefficients/SpcCoeff/SpcCoeff_NC2BIN/SpcCoeff_NC2BIN.f90 b/src/Coefficients/SpcCoeff/SpcCoeff_NC2BIN/SpcCoeff_NC2BIN.f90 index 2fe0b5c..e4e710e 100644 --- a/src/Coefficients/SpcCoeff/SpcCoeff_NC2BIN/SpcCoeff_NC2BIN.f90 +++ b/src/Coefficients/SpcCoeff/SpcCoeff_NC2BIN/SpcCoeff_NC2BIN.f90 @@ -36,9 +36,8 @@ PROGRAM SpcCoeff_NC2BIN INTEGER :: err_stat CHARACTER(256) :: msg, version_str CHARACTER(256) :: nc_filename - CHARACTER(256) :: bin_filename - CHARACTER(256) :: answer - INTEGER :: version + CHARACTER(256) :: bin_filename, tmp_filename + INTEGER :: n_args ! Program header CALL CRTM_Version (version_str) @@ -46,22 +45,32 @@ PROGRAM SpcCoeff_NC2BIN 'Program to convert a CRTM SpcCoeff data file '//& 'from netCDF to Binary format.', & 'CRTM Version:'//trim(version_str) ) - - ! Get the filenames - WRITE(*,FMT='(/5x,"Enter the INPUT netCDF SpcCoeff filename : ")', ADVANCE='NO') - READ(*,'(a)') nc_filename - nc_filename = ADJUSTL(nc_filename) - WRITE(*,FMT='(/5x,"Enter the OUTPUT Binary SpcCoeff filename: ")', ADVANCE='NO') - READ(*,'(a)') bin_filename - bin_filename = ADJUSTL(bin_filename) - ! ...Sanity check that they're not the same - IF ( bin_filename == nc_filename ) THEN - msg = 'SpcCoeff netCDF and Binary filenames are the same!' - CALL Display_Message( PROGRAM_NAME, msg, FAILURE ); STOP + + ! Get the filename + n_args = COMMAND_ARGUMENT_COUNT() + IF ( n_args > 0 ) THEN + CALL GET_COMMAND_ARGUMENT(1, nc_filename) + !** automatically generate the binary filename based on the command line netcdf filename + tmp_filename = nc_filename(1:LEN_TRIM(nc_filename) - 3)//".bin" + bin_filename = TRIM(ADJUSTL(tmp_filename)) + PRINT *, "Output filename:", bin_filename + ELSE + ! Get the filenames + WRITE(*,FMT='(/5x,"Enter the INPUT netCDF SpcCoeff filename : ")', ADVANCE='NO') + READ(*,'(a)') nc_filename + nc_filename = ADJUSTL(nc_filename) + WRITE(*,FMT='(/5x,"Enter the OUTPUT Binary SpcCoeff filename: ")', ADVANCE='NO') + READ(*,'(a)') bin_filename + bin_filename = ADJUSTL(bin_filename) + ! ...Sanity check that they're not the same + IF ( bin_filename == nc_filename ) THEN + msg = 'SpcCoeff netCDF and Binary filenames are the same!' + CALL Display_Message( PROGRAM_NAME, msg, FAILURE ); STOP + END IF END IF - ! Perform the conversion - err_stat = SpcCoeff_netCDF_to_Binary( nc_filename, bin_filename, Version = version ) + ! Perform the conversion (no change to version) + err_stat = SpcCoeff_netCDF_to_Binary( nc_filename, bin_filename ) IF ( err_stat /= SUCCESS ) THEN msg = 'SpcCoeff netCDF -> Binary conversion failed!' CALL Display_Message( PROGRAM_NAME, msg, FAILURE ); STOP diff --git a/src/Coefficients/SpcCoeff/SpcCoeff_netCDF_IO.f90 b/src/Coefficients/SpcCoeff/SpcCoeff_netCDF_IO.f90 index 6730b1e..265fc6e 100644 --- a/src/Coefficients/SpcCoeff/SpcCoeff_netCDF_IO.f90 +++ b/src/Coefficients/SpcCoeff/SpcCoeff_netCDF_IO.f90 @@ -598,7 +598,7 @@ FUNCTION SpcCoeff_netCDF_WriteFile( & CALL Write_Cleanup(); RETURN END IF ! ...Polarization angle variable - IF( SpcCoeff%Version > 2 ) THEN + IF( SpcCoeff%Version > 3 ) THEN NF90_Status = NF90_INQ_VARID( FileId,POLANGLE_VARNAME,VarId ) IF ( NF90_Status /= NF90_NOERR ) THEN msg = 'Error inquiring '//TRIM(Filename)//' for '//POLANGLE_VARNAME//& @@ -983,7 +983,7 @@ FUNCTION SpcCoeff_netCDF_ReadFile( & CALL Read_Cleanup(); RETURN END IF ! ...Polarization angle variable - IF ( SpcCoeff%Version > 2 ) THEN + IF ( SpcCoeff%Version > 3 ) THEN nf90_status = NF90_INQ_VARID( fileid,POLANGLE_VARNAME,varid ) IF ( nf90_status /= NF90_NOERR ) THEN msg = 'Error inquiring '//TRIM(Filename)//' for '//POLANGLE_VARNAME//& @@ -1591,24 +1591,29 @@ FUNCTION CreateFile( & msg = 'Error writing '//POLARIZATION_VARNAME//' variable attributes to '//TRIM(Filename) CALL Create_Cleanup(); RETURN END IF - ! ...Polarization angle variable - nf90_status = NF90_DEF_VAR( FileID, & - POLANGLE_VARNAME, & - POLANGLE_TYPE, & - dimIDs=(/n_channels_dimid/), & - varID=variD ) - IF ( nf90_status /= NF90_NOERR ) THEN - msg = 'Error defining '//POLANGLE_VARNAME//' variable in '//& - TRIM(Filename)//' - '//TRIM(NF90_STRERROR( nf90_status )) - CALL Create_Cleanup(); RETURN - END IF - put_status(1) = NF90_PUT_ATT( FileID,varid,LONGNAME_ATTNAME ,POLANGLE_LONGNAME ) - put_status(2) = NF90_PUT_ATT( FileID,varid,DESCRIPTION_ATTNAME,POLANGLE_DESCRIPTION ) - put_status(3) = NF90_PUT_ATT( FileID,varid,UNITS_ATTNAME ,POLANGLE_UNITS ) - put_status(4) = NF90_PUT_ATT( FileID,varid,FILLVALUE_ATTNAME ,POLANGLE_FILLVALUE ) - IF ( ANY(put_status /= NF90_NOERR) ) THEN - msg = 'Error writing '//POLANGLE_VARNAME//' variable attributes to '//TRIM(Filename) - CALL Create_Cleanup(); RETURN + + IF ( PRESENT(VERSION) ) THEN + IF (VERSION > 3) THEN + ! ...Polarization angle variable + nf90_status = NF90_DEF_VAR( FileID, & + POLANGLE_VARNAME, & + POLANGLE_TYPE, & + dimIDs=(/n_channels_dimid/), & + varID=variD ) + IF ( nf90_status /= NF90_NOERR ) THEN + msg = 'Error defining '//POLANGLE_VARNAME//' variable in '//& + TRIM(Filename)//' - '//TRIM(NF90_STRERROR( nf90_status )) + CALL Create_Cleanup(); RETURN + END IF + put_status(1) = NF90_PUT_ATT( FileID,varid,LONGNAME_ATTNAME ,POLANGLE_LONGNAME ) + put_status(2) = NF90_PUT_ATT( FileID,varid,DESCRIPTION_ATTNAME,POLANGLE_DESCRIPTION ) + put_status(3) = NF90_PUT_ATT( FileID,varid,UNITS_ATTNAME ,POLANGLE_UNITS ) + put_status(4) = NF90_PUT_ATT( FileID,varid,FILLVALUE_ATTNAME ,POLANGLE_FILLVALUE ) + IF ( ANY(put_status /= NF90_NOERR) ) THEN + msg = 'Error writing '//POLANGLE_VARNAME//' variable attributes to '//TRIM(Filename) + CALL Create_Cleanup(); RETURN + END IF + END IF END IF ! ...Channel_Flag variable nf90_status = NF90_DEF_VAR( FileID, & diff --git a/src/Coefficients/TauCoeff/ODAS/ODAS_BIN2NC/ODAS_BIN2NC.f90 b/src/Coefficients/TauCoeff/ODAS/ODAS_BIN2NC/ODAS_BIN2NC.f90 index 9ff2a6e..6eb31a8 100644 --- a/src/Coefficients/TauCoeff/ODAS/ODAS_BIN2NC/ODAS_BIN2NC.f90 +++ b/src/Coefficients/TauCoeff/ODAS/ODAS_BIN2NC/ODAS_BIN2NC.f90 @@ -34,36 +34,47 @@ PROGRAM ODAS_BIN2NC ! --------- ! Variables ! --------- - INTEGER :: Error_Status - CHARACTER(256) :: NC_Filename + INTEGER :: Error_Status, n_args + CHARACTER(256) :: NC_Filename, tmp_filename CHARACTER(256) :: BIN_Filename TYPE(ODAS_type) :: ODAS TYPE(ODAS_type) :: ODAS_Test - ! Output prgram header - CALL Program_Message( PROGRAM_NAME, & - 'Program to convert netCDF format ODAS files to '//& - 'their CRTM Binary format.', & - '$Revision$' ) - ! Get the input and output filenames - WRITE( *, FMT = '( /5x, "Enter the INPUT Binary ODAS file: " )', & - ADVANCE = 'NO' ) - READ( *, '( a )' ) BIN_Filename - BIN_Filename = ADJUSTL( BIN_FileNAME ) - IF ( .NOT. File_Exists( TRIM( BIN_Filename ) ) ) THEN - CALL Display_Message( PROGRAM_NAME, & - 'File '//TRIM( BIN_Filename )//' not found.', & - FAILURE ) - STOP + ! Get the filename + n_args = COMMAND_ARGUMENT_COUNT() + IF ( n_args > 0 ) THEN + CALL GET_COMMAND_ARGUMENT(1, BIN_filename) + !** automatically generate the binary filename based on the command line netcdf filename + tmp_filename = BIN_filename(1:LEN_TRIM(BIN_filename) - 4)//".nc" + NC_filename = TRIM(ADJUSTL(tmp_filename)) + PRINT *, "Output filename:", NC_filename + ELSE + ! Output prgram header + CALL Program_Message( PROGRAM_NAME, & + 'Program to convert netCDF format ODAS files to '//& + 'their CRTM Binary format.', & + '$Revision$' ) + + ! Get the input and output filenames + WRITE( *, FMT = '( /5x, "Enter the INPUT Binary ODAS file: " )', & + ADVANCE = 'NO' ) + READ( *, '( a )' ) BIN_Filename + BIN_Filename = ADJUSTL( BIN_FileNAME ) + IF ( .NOT. File_Exists( TRIM( BIN_Filename ) ) ) THEN + CALL Display_Message( PROGRAM_NAME, & + 'File '//TRIM( BIN_Filename )//' not found.', & + FAILURE ) + STOP + END IF + + WRITE( *, FMT = '( /5x, "Enter the OUTPUT netCDF ODAS file: " )', & + ADVANCE = 'NO' ) + READ( *, '( a )' ) NC_Filename + NC_Filename = ADJUSTL( NC_Filename ) END IF - WRITE( *, FMT = '( /5x, "Enter the OUTPUT netCDF ODAS file: " )', & - ADVANCE = 'NO' ) - READ( *, '( a )' ) NC_Filename - NC_Filename = ADJUSTL( NC_Filename ) - ! Check that the BIN file isn't accidentally overwritten IF ( TRIM( BIN_Filename ) == TRIM( NC_Filename ) ) THEN CALL Display_Message( PROGRAM_NAME, & diff --git a/src/Coefficients/TauCoeff/ODAS/ODAS_NC2BIN/ODAS_NC2BIN.f90 b/src/Coefficients/TauCoeff/ODAS/ODAS_NC2BIN/ODAS_NC2BIN.f90 index b531640..5775270 100644 --- a/src/Coefficients/TauCoeff/ODAS/ODAS_NC2BIN/ODAS_NC2BIN.f90 +++ b/src/Coefficients/TauCoeff/ODAS/ODAS_NC2BIN/ODAS_NC2BIN.f90 @@ -34,36 +34,46 @@ PROGRAM ODAS_NC2BIN ! --------- ! Variables ! --------- - INTEGER :: Error_Status - CHARACTER(256) :: NC_Filename + INTEGER :: Error_Status, n_args + CHARACTER(256) :: NC_Filename, tmp_filename CHARACTER(256) :: BIN_Filename TYPE(ODAS_type) :: ODAS TYPE(ODAS_type) :: ODAS_Test - - ! Output prgram header - CALL Program_Message( PROGRAM_NAME, & - 'Program to convert netCDF format ODAS files to '//& - 'their CRTM Binary format.', & - '$Revision$' ) - - ! Get the input and output filenames - WRITE( *, FMT = '( /5x, "Enter the INPUT netCDF ODAS file: " )', & - ADVANCE = 'NO' ) - READ( *, '( a )' ) NC_Filename - NC_Filename = ADJUSTL( NC_Filename ) - IF ( .NOT. File_Exists( TRIM( NC_Filename ) ) ) THEN - CALL Display_Message( PROGRAM_NAME, & - 'File '//TRIM( NC_Filename )//' not found.', & - FAILURE ) - STOP + ! Get the filename + n_args = COMMAND_ARGUMENT_COUNT() + IF ( n_args > 0 ) THEN + CALL GET_COMMAND_ARGUMENT(1, NC_Filename) + !** automatically generate the binary Filename based on the command line netcdf Filename + tmp_filename = NC_Filename(1:LEN_TRIM(NC_Filename) - 3)//".bin" + BIN_Filename = TRIM(ADJUSTL(tmp_filename)) + PRINT *, "Output filename:", BIN_Filename + + ELSE + ! Output prgram header + CALL Program_Message( PROGRAM_NAME, & + 'Program to convert netCDF format ODAS files to '//& + 'their CRTM Binary format.', & + '$Revision$' ) + + ! Get the input and output filenames + WRITE( *, FMT = '( /5x, "Enter the INPUT netCDF ODAS file: " )', & + ADVANCE = 'NO' ) + READ( *, '( a )' ) NC_Filename + NC_Filename = ADJUSTL( NC_Filename ) + IF ( .NOT. File_Exists( TRIM( NC_Filename ) ) ) THEN + CALL Display_Message( PROGRAM_NAME, & + 'File '//TRIM( NC_Filename )//' not found.', & + FAILURE ) + STOP + END IF + + WRITE( *, FMT = '( /5x, "Enter the OUTPUT Binary ODAS file: " )', & + ADVANCE = 'NO' ) + READ( *, '( a )' ) BIN_Filename + BIN_Filename = ADJUSTL( BIN_Filename ) END IF - WRITE( *, FMT = '( /5x, "Enter the OUTPUT Binary ODAS file: " )', & - ADVANCE = 'NO' ) - READ( *, '( a )' ) BIN_Filename - BIN_Filename = ADJUSTL( BIN_FileNAME ) - ! Check that the netCDF file isn't accidentally overwritten IF ( TRIM( NC_Filename ) == TRIM( BIN_Filename ) ) THEN CALL Display_Message( PROGRAM_NAME, & diff --git a/src/Coefficients/TauCoeff/ODPS/ODPS_BIN2NC/Makefile b/src/Coefficients/TauCoeff/ODPS/ODPS_BIN2NC/Makefile deleted file mode 100644 index 011f1ea..0000000 --- a/src/Coefficients/TauCoeff/ODPS/ODPS_BIN2NC/Makefile +++ /dev/null @@ -1,57 +0,0 @@ -#============================================================================== -# -# Makefile for ODPS_BIN2NC program -# -#============================================================================== - -# Define macros -include $(CRTM_SOURCE_ROOT)/make.macros - -# This makefile -MAKE_FILE = Makefile - -# Executable files -EXE_FILE = ODPS_BIN2NC - -# Source files to link -SRC_FILES = Type_Kinds.f90 \ - File_Utility.f90 \ - Message_Handler.f90 \ - Compare_Float_Numbers.f90 \ - Binary_File_Utility.f90 \ - Endian_Utility.f90 \ - Sort_Utility.f90 \ - netCDF_Utility.f90 \ - netCDF_Dimension_Utility.f90 \ - netCDF_Variable_Utility.f90 \ - netCDF_Attribute_Utility.f90 \ - ODPS_Define.f90 \ - ODPS_Binary_IO.f90 \ - ODPS_netCDF_IO.f90 - -# Obj files used in link phase -OBJ_FILES = ${SRC_FILES:.f90=.o} \ - $(EXE_FILE).o - -# Include and library definitions -INCLUDES = -I$(HOME)/local/netcdf/include -LIBRARIES = -L$(HOME)/local/netcdf/lib -lnetcdf - -# Define common make targets (all, build, clean, install) -include $(CRTM_SOURCE_ROOT)/make.common_targets - -# Source file link creation and removal -create_links: - @linkfiles $(CRTM_SOURCE_ROOT) $(SRC_FILES) - -remove_links: - @unlinkfiles $(SRC_FILES) - -# Squeaky clean target -realclean: clean remove_links - -# Source dependency lists -include make.dependencies - -# Define default rules -include $(CRTM_SOURCE_ROOT)/make.rules diff --git a/src/Coefficients/TauCoeff/ODPS/ODPS_BIN2NC/ODPS_BIN2NC.f90 b/src/Coefficients/TauCoeff/ODPS/ODPS_BIN2NC/ODPS_BIN2NC.f90 index 3b715d3..dc768f3 100644 --- a/src/Coefficients/TauCoeff/ODPS/ODPS_BIN2NC/ODPS_BIN2NC.f90 +++ b/src/Coefficients/TauCoeff/ODPS/ODPS_BIN2NC/ODPS_BIN2NC.f90 @@ -34,8 +34,8 @@ PROGRAM ODPS_BIN2NC ! --------- ! Variables ! --------- - INTEGER :: Error_Status - CHARACTER(256) :: NC_Filename + INTEGER :: Error_Status, n_args + CHARACTER(256) :: NC_Filename, tmp_filename CHARACTER(256) :: BIN_Filename TYPE(ODPS_type) :: ODPS TYPE(ODPS_type) :: ODPS_Test @@ -48,30 +48,40 @@ PROGRAM ODPS_BIN2NC '$Revision$' ) ! Get the input and output filenames - WRITE( *, FMT = '( /5x, "Enter the INPUT Binary ODPS file: " )', & - ADVANCE = 'NO' ) - READ( *, '( a )' ) BIN_Filename - BIN_Filename = ADJUSTL( BIN_FileNAME ) - IF ( .NOT. File_Exists( TRIM( BIN_Filename ) ) ) THEN - CALL Display_Message( PROGRAM_NAME, & - 'File '//TRIM( BIN_Filename )//' not found.', & - FAILURE ) - STOP + ! Get the filename + n_args = COMMAND_ARGUMENT_COUNT() + IF ( n_args > 0 ) THEN + CALL GET_COMMAND_ARGUMENT(1, BIN_filename) + !** automatically generate the binary filename based on the command line netcdf filename + tmp_filename = BIN_filename(1:LEN_TRIM(BIN_filename) - 4)//".nc" + NC_filename = TRIM(ADJUSTL(tmp_filename)) + PRINT *, "Output filename:", NC_filename + ELSE + WRITE( *, FMT = '( /5x, "Enter the INPUT Binary ODPS file: " )', & + ADVANCE = 'NO' ) + READ( *, '( a )' ) BIN_Filename + BIN_Filename = ADJUSTL( BIN_FileNAME ) + IF ( .NOT. File_Exists( TRIM( BIN_Filename ) ) ) THEN + CALL Display_Message( PROGRAM_NAME, & + 'File '//TRIM( BIN_Filename )//' not found.', & + FAILURE ) + STOP + END IF + + WRITE( *, FMT = '( /5x, "Enter the OUTPUT netCDF ODPS file: " )', & + ADVANCE = 'NO' ) + READ( *, '( a )' ) NC_Filename + NC_Filename = ADJUSTL( NC_Filename ) END IF - WRITE( *, FMT = '( /5x, "Enter the OUTPUT netCDF ODPS file: " )', & - ADVANCE = 'NO' ) - READ( *, '( a )' ) NC_Filename - NC_Filename = ADJUSTL( NC_Filename ) - ! Check that the BIN file isn't accidentally overwritten IF ( TRIM( BIN_Filename ) == TRIM( NC_Filename ) ) THEN - CALL Display_Message( PROGRAM_NAME, & - 'Output filename is the same as the input filename!', & - FAILURE ) - STOP + CALL Display_Message( PROGRAM_NAME, & + 'Output filename is the same as the input filename!', & + FAILURE ) + STOP END IF - + ! Read the input binary file WRITE( *, '( /5x, "Reading Binary ODPS data ..." )' ) Error_Status = Read_ODPS_Binary( BIN_Filename, ODPS ) diff --git a/src/Coefficients/TauCoeff/ODPS/ODPS_BIN2NC/make.dependencies b/src/Coefficients/TauCoeff/ODPS/ODPS_BIN2NC/make.dependencies deleted file mode 100644 index 7112d4f..0000000 --- a/src/Coefficients/TauCoeff/ODPS/ODPS_BIN2NC/make.dependencies +++ /dev/null @@ -1,15 +0,0 @@ -Binary_File_Utility.o : Binary_File_Utility.f90 Endian_Utility.o Message_Handler.o File_Utility.o Type_Kinds.o -Compare_Float_Numbers.o : Compare_Float_Numbers.f90 Type_Kinds.o -Endian_Utility.o : Endian_Utility.f90 Type_Kinds.o -File_Utility.o : File_Utility.f90 -Message_Handler.o : Message_Handler.f90 File_Utility.o -ODPS_Binary_IO.o : ODPS_Binary_IO.f90 ODPS_Define.o Binary_File_Utility.o File_Utility.o Message_Handler.o Type_Kinds.o -ODPS_Define.o : ODPS_Define.f90 Sort_Utility.o Compare_Float_Numbers.o Message_Handler.o Type_Kinds.o -ODPS_NC2BIN.o : ODPS_NC2BIN.f90 ODPS_netCDF_IO.o ODPS_Binary_IO.o ODPS_Define.o Message_Handler.o File_Utility.o -ODPS_netCDF_IO.o : ODPS_netCDF_IO.f90 netCDF_Utility.o ODPS_Define.o Message_Handler.o Type_Kinds.o -Sort_Utility.o : Sort_Utility.f90 Type_Kinds.o -Type_Kinds.o : Type_Kinds.f90 -netCDF_Attribute_Utility.o : netCDF_Attribute_Utility.f90 Message_Handler.o Type_Kinds.o -netCDF_Dimension_Utility.o : netCDF_Dimension_Utility.f90 Message_Handler.o Type_Kinds.o -netCDF_Utility.o : netCDF_Utility.f90 netCDF_Attribute_Utility.o netCDF_Variable_Utility.o netCDF_Dimension_Utility.o Message_Handler.o Type_Kinds.o -netCDF_Variable_Utility.o : netCDF_Variable_Utility.f90 Message_Handler.o Type_Kinds.o diff --git a/src/Coefficients/TauCoeff/ODPS/ODPS_NC2BIN/Makefile b/src/Coefficients/TauCoeff/ODPS/ODPS_NC2BIN/Makefile deleted file mode 100644 index 76e91b1..0000000 --- a/src/Coefficients/TauCoeff/ODPS/ODPS_NC2BIN/Makefile +++ /dev/null @@ -1,61 +0,0 @@ -#============================================================================== -# -# Makefile for ODPS_NC2BIN program -# -#============================================================================== - -# Define macros -include $(CRTM_SOURCE_ROOT)/make.macros - -# This makefile -MAKE_FILE = Makefile - -# Executable files -EXE_FILE = ODPS_NC2BIN -SCRIPT_FILE = run_ODPS_NC2BIN.sh - -# Source files to link -SRC_FILES = Type_Kinds.f90 \ - File_Utility.f90 \ - Message_Handler.f90 \ - Compare_Float_Numbers.f90 \ - Binary_File_Utility.f90 \ - Endian_Utility.f90 \ - Sort_Utility.f90 \ - netCDF_Utility.f90 \ - netCDF_Dimension_Utility.f90 \ - netCDF_Variable_Utility.f90 \ - netCDF_Attribute_Utility.f90 \ - ODPS_Define.f90 \ - ODPS_Binary_IO.f90 \ - ODPS_netCDF_IO.f90 \ - CRTM_Parameters.f90 - -# Obj files used in link phase -OBJ_FILES = ${SRC_FILES:.f90=.o} \ - $(EXE_FILE).o - -# Include and library definitions -INCLUDES = -I$(HOME)/local/include -LIBRARIES = -L$(HOME)/local/lib -lnetcdff - -# Define common make targets (all, build, clean, install) -include $(CRTM_SOURCE_ROOT)/make.common_targets - -# Source file link creation and removal -create_links:: - @$(LINK_SCRIPT) $(CRTM_SOURCE_ROOT) $(SRC_FILES) - -remove_links:: - @$(UNLINK_SCRIPT) $(SRC_FILES) - -# Script install target -install_script: - @$(COPY) $(SCRIPT_FILE) ${HOME}/bin - - -# Source dependency lists -include make.dependencies - -# Define default rules -include $(CRTM_SOURCE_ROOT)/make.rules diff --git a/src/Coefficients/TauCoeff/ODPS/ODPS_NC2BIN/ODPS_NC2BIN.f90 b/src/Coefficients/TauCoeff/ODPS/ODPS_NC2BIN/ODPS_NC2BIN.f90 index 2f4433b..0cd2d6a 100644 --- a/src/Coefficients/TauCoeff/ODPS/ODPS_NC2BIN/ODPS_NC2BIN.f90 +++ b/src/Coefficients/TauCoeff/ODPS/ODPS_NC2BIN/ODPS_NC2BIN.f90 @@ -38,36 +38,44 @@ PROGRAM ODPS_NC2BIN ! --------- ! Variables ! --------- - INTEGER :: Error_Status - CHARACTER(256) :: NC_Filename + INTEGER :: Error_Status, n_args + CHARACTER(256) :: NC_Filename, tmp_filename CHARACTER(256) :: BIN_Filename TYPE(ODPS_type) :: ODPS TYPE(ODPS_type) :: ODPS_Test - ! Output prgram header CALL Program_Message( PROGRAM_NAME, & 'Program to convert netCDF format ODPS files to '//& 'their CRTM Binary format.', & '$Revision$' ) - - ! Get the input and output filenames - WRITE( *, FMT = '( /5x, "Enter the INPUT netCDF ODPS file: " )', & - ADVANCE = 'NO' ) - READ( *, '( a )' ) NC_Filename - NC_Filename = ADJUSTL( NC_Filename ) - IF ( .NOT. File_Exists( TRIM( NC_Filename ) ) ) THEN - CALL Display_Message( PROGRAM_NAME, & - 'File '//TRIM( NC_Filename )//' not found.', & - FAILURE ) - STOP + ! Get the filename + n_args = COMMAND_ARGUMENT_COUNT() + IF ( n_args > 0 ) THEN + CALL GET_COMMAND_ARGUMENT(1, NC_Filename) + !** automatically generate the binary Filename based on the command line netcdf Filename + tmp_filename = NC_Filename(1:LEN_TRIM(NC_Filename) - 3)//".bin" + BIN_Filename = TRIM(ADJUSTL(tmp_filename)) + PRINT *, "Output filename:", BIN_Filename + ELSE + ! Get the input and output filenames + WRITE( *, FMT = '( /5x, "Enter the INPUT netCDF ODPS file: " )', & + ADVANCE = 'NO' ) + READ( *, '( a )' ) NC_Filename + NC_Filename = ADJUSTL( NC_Filename ) + IF ( .NOT. File_Exists( TRIM( NC_Filename ) ) ) THEN + CALL Display_Message( PROGRAM_NAME, & + 'File '//TRIM( NC_Filename )//' not found.', & + FAILURE ) + STOP + END IF + + WRITE( *, FMT = '( /5x, "Enter the OUTPUT Binary ODPS file: " )', & + ADVANCE = 'NO' ) + READ( *, '( a )' ) BIN_Filename + BIN_Filename = ADJUSTL( BIN_FileNAME ) END IF - WRITE( *, FMT = '( /5x, "Enter the OUTPUT Binary ODPS file: " )', & - ADVANCE = 'NO' ) - READ( *, '( a )' ) BIN_Filename - BIN_Filename = ADJUSTL( BIN_FileNAME ) - ! Check that the netCDF file isn't accidentally overwritten IF ( TRIM( NC_Filename ) == TRIM( BIN_Filename ) ) THEN CALL Display_Message( PROGRAM_NAME, & diff --git a/src/Coefficients/TauCoeff/ODPS/ODPS_NC2BIN/make.dependencies b/src/Coefficients/TauCoeff/ODPS/ODPS_NC2BIN/make.dependencies deleted file mode 100644 index 6072df6..0000000 --- a/src/Coefficients/TauCoeff/ODPS/ODPS_NC2BIN/make.dependencies +++ /dev/null @@ -1,16 +0,0 @@ -Binary_File_Utility.o : Binary_File_Utility.f90 Endian_Utility.o Message_Handler.o File_Utility.o Type_Kinds.o -CRTM_Parameters.o : CRTM_Parameters.f90 Type_Kinds.o -Compare_Float_Numbers.o : Compare_Float_Numbers.f90 Type_Kinds.o -Endian_Utility.o : Endian_Utility.f90 Type_Kinds.o -File_Utility.o : File_Utility.f90 -Message_Handler.o : Message_Handler.f90 File_Utility.o -ODPS_Binary_IO.o : ODPS_Binary_IO.f90 ODPS_Define.o Binary_File_Utility.o File_Utility.o Message_Handler.o Type_Kinds.o -ODPS_Define.o : ODPS_Define.f90 CRTM_Parameters.o Sort_Utility.o Compare_Float_Numbers.o Message_Handler.o Type_Kinds.o -ODPS_NC2BIN.o : ODPS_NC2BIN.f90 ODPS_netCDF_IO.o ODPS_Binary_IO.o ODPS_Define.o Message_Handler.o File_Utility.o -ODPS_netCDF_IO.o : ODPS_netCDF_IO.f90 netCDF_Utility.o ODPS_Define.o Message_Handler.o Type_Kinds.o -Sort_Utility.o : Sort_Utility.f90 Type_Kinds.o -Type_Kinds.o : Type_Kinds.f90 -netCDF_Attribute_Utility.o : netCDF_Attribute_Utility.f90 Message_Handler.o Type_Kinds.o -netCDF_Dimension_Utility.o : netCDF_Dimension_Utility.f90 Message_Handler.o Type_Kinds.o -netCDF_Utility.o : netCDF_Utility.f90 netCDF_Attribute_Utility.o netCDF_Variable_Utility.o netCDF_Dimension_Utility.o Message_Handler.o Type_Kinds.o -netCDF_Variable_Utility.o : netCDF_Variable_Utility.f90 Message_Handler.o Type_Kinds.o diff --git a/src/Coefficients/TauCoeff/ODPS/ODPS_NC2BIN/run_ODPS_NC2BIN.sh b/src/Coefficients/TauCoeff/ODPS/ODPS_NC2BIN/run_ODPS_NC2BIN.sh deleted file mode 100755 index bfc6d05..0000000 --- a/src/Coefficients/TauCoeff/ODPS/ODPS_NC2BIN/run_ODPS_NC2BIN.sh +++ /dev/null @@ -1,129 +0,0 @@ -#!/bin/sh - -usage() -{ - echo " Usage: run_ODPS_NC2BIN -l|b[fh]" - echo - echo " Convert any netCDF format ODPS TauCoeff files in the current" - echo " directory to Binary format. File with the suffix *.TauCoeff.nc" - echo " are converted into *.TauCoeff.bin files." - echo - echo " l Produce little-endian binary output files" - echo - echo " b Produce big-endian binary output files" - echo - echo " f Force overwrite of output file if it already exists." - echo " Default behaviour is to skip conversion if the output" - echo " file is already present." - echo - echo " h Print this message and exit" - echo - echo " Note the endian-ness option is only setup for the following" - echo " compilers that allow for run-time conversion via environment" - echo " variables:" - echo " - AIX xlf" - echo " - Linux gfortran" - echo " - Linux ifort (Intel)" - echo " - Linux g95" - echo -} - - -# Define defaults -ENDIAN_TYPE="NONE" -OVERWRITE="NO" - - -# Parse command line options -while getopts :hlbf OPTVAL; do - - # If option argument looks like another option exit the loop - case ${OPTARG} in - -*) break;; - esac - - # Parse the valid options here - case ${OPTVAL} in - l) ENDIAN_TYPE="little";; - b) ENDIAN_TYPE="big";; - f) OVERWRITE="YES";; - h) usage - exit 0;; - :|\?) OPTVAL=${OPTARG} - break;; - esac - -done - -# Remove the options processed -shift `expr ${OPTIND} - 1` - -# Now output invalidities based on OPTVAL -# Need to do this as getopts does not handle -# the situations where an option is passed -# as an argument to another option. -case ${OPTVAL} in - - # If OPTVAL contains nothing, then all options - # have been successfully parsed - \?) if [ $# -ne 0 ]; then - ( echo " Invalid argument(s) $*" ; echo ; usage ) | more - exit 2 - fi;; - - # Invalid option - ?) ( echo " Invalid option '-${OPTARG}'" ; usage ) | more - exit 2;; - -esac - -# Check endian type for run time options -# ...Save the current envar options -XLFRTEOPTS_SAVE=${XLFRTEOPTS} -GFORTRAN_CONVERT_UNIT_SAVE=${GFORTRAN_CONVERT_UNIT} -F_UFMTENDIAN_SAVE=${F_UFMTENDIAN} -G95_ENDIAN_SAVE=${G95_ENDIAN} -# ...Set the non-switchable envars -case ${ENDIAN_TYPE} in - "little") export XLFRTEOPTS="ufmt_littleendian=-100";; - "big") export XLFRTEOPTS="";; - *) ( echo " Must specify and endian type, -l or -b" ; echo ; usage ) | more - exit 2;; -esac -# ...Switchable envars -export GFORTRAN_CONVERT_UNIT="${ENDIAN_TYPE}_endian" -export F_UFMTENDIAN="${ENDIAN_TYPE}" -export G95_ENDIAN="${ENDIAN_TYPE}" - - -# Assign processing parameters -EXE_FILE="ODPS_NC2BIN" -LOG_FILE="${EXE_FILE}.${ENDIAN_TYPE}_endian.log" - - -# Process netCDF TauCoeff files -for NC_FILE in `ls *.TauCoeff.nc`; do - - # Create binary filename - BIN_FILE="`basename ${NC_FILE} .nc`.bin" - - # Check to see if the output file exists - if [ -f ${BIN_FILE} -a ${OVERWRITE} = "NO" ]; then - echo " Output file ${BIN_FILE} already exists. Skipping to next file..." - continue - fi - - # Convert the file - echo " Converting ${NC_FILE} to ${ENDIAN_TYPE} endian binary format file ${BIN_FILE}..." - ${EXE_FILE} <<-NoMoreInput >> ${LOG_FILE} - ${NC_FILE} - ${BIN_FILE} - NoMoreInput -done - - -# Restore the run-time option environment variables -export XLFRTEOPTS="${XLFRTEOPTS_SAVE}" -export GFORTRAN_CONVERT_UNIT="${GFORTRAN_CONVERT_UNIT_SAVE}" -export F_UFMTENDIAN="${F_UFMTENDIAN_SAVE}" -export G95_ENDIAN="${G95_ENDIAN_SAVE}" diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 74f4f52..29d8a79 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -65,14 +65,14 @@ IF(EXISTS ${CMAKE_SOURCE_DIR}/fix) else() # Download CRTM coefficients set( CRTM_COEFFS_BRANCH_PREFIX "" ) #preserves the structure of the paths that have been used in jedi previously vs the local path above - set( CRTM_COEFFS_BRANCH "fix_REL-3.1.1.1" ) + set( CRTM_COEFFS_BRANCH "fix_REL-3.1.1.2" ) set(CRTM_COEFFS_PATH ${CMAKE_BINARY_DIR}/test_data/${PROJECT_VERSION}) file(MAKE_DIRECTORY ${CRTM_COEFFS_PATH}) set(DOWNLOAD_BASE_URL "https://bin.ssec.wisc.edu/pub/s4/CRTM/") set(test_files_dirname ${CRTM_COEFFS_BRANCH}.tgz) - set(checksum "1ee0d39f08a2548402cf2ad8d26f2f5a") # MD5SUM of fix_REL-3.1.1.1.tgz + set(checksum "58e0a5c698a438a31dc4914fcda39846") # MD5SUM of fix_REL-3.1.1.2.tgz set(DOWNLOAD_URL "${DOWNLOAD_BASE_URL}/${test_files_dirname}") set(DOWNLOAD_DEST "${CRTM_COEFFS_PATH}/${test_files_dirname}") @@ -259,7 +259,8 @@ list (APPEND TLAD_tests ##################################################################### - +add_executable(check_tropics mains/application/check_tropics.f90) +target_link_libraries(check_tropics PRIVATE crtm) add_executable(test_check_crtm mains/application/check_crtm.F90) target_link_libraries(test_check_crtm PRIVATE crtm) @@ -312,7 +313,7 @@ list (APPEND SCoeff_Utils SpcCoeff_NC2BIN ) foreach(testtype IN LISTS SCoeff_Utils) - add_executable(${testtype} ${CMAKE_SOURCE_DIR}/src/Coefficients/SpcCoeff/${testtype}/${testtype}.f90) + add_executable(${testtype} ${CRTM_SOURCE_DIR}/src/Coefficients/SpcCoeff/${testtype}/${testtype}.f90) target_link_libraries(${testtype} PRIVATE crtm) endforeach() @@ -322,7 +323,7 @@ list (APPEND ODAS_Utils ODAS_NC2BIN ) foreach(testtype IN LISTS ODAS_Utils) - add_executable(${testtype} ${CMAKE_SOURCE_DIR}/src/Coefficients/TauCoeff/ODAS/${testtype}/${testtype}.f90) + add_executable(${testtype} ${CRTM_SOURCE_DIR}/src/Coefficients/TauCoeff/ODAS/${testtype}/${testtype}.f90) target_link_libraries(${testtype} PRIVATE crtm) endforeach() @@ -332,7 +333,7 @@ list (APPEND ODPS_Utils ODPS_NC2BIN ) foreach(testtype IN LISTS ODPS_Utils) - add_executable(${testtype} ${CMAKE_SOURCE_DIR}/src/Coefficients/TauCoeff/ODPS/${testtype}/${testtype}.f90) + add_executable(${testtype} ${CRTM_SOURCE_DIR}/src/Coefficients/TauCoeff/ODPS/${testtype}/${testtype}.f90) target_link_libraries(${testtype} PRIVATE crtm) endforeach() @@ -343,7 +344,7 @@ list (APPEND CCoeff_Utils CloudCoeff_Inspect ) foreach(testtype IN LISTS CCoeff_Utils) - add_executable(${testtype} ${CMAKE_SOURCE_DIR}/src/Coefficients/CloudCoeff/${testtype}/${testtype}.f90) + add_executable(${testtype} ${CRTM_SOURCE_DIR}/src/Coefficients/CloudCoeff/${testtype}/${testtype}.f90) target_link_libraries(${testtype} PRIVATE crtm) endforeach() diff --git a/test/mains/application/check_tropics.f90 b/test/mains/application/check_tropics.f90 new file mode 100644 index 0000000..7346072 --- /dev/null +++ b/test/mains/application/check_tropics.f90 @@ -0,0 +1,1145 @@ +! +! check_crtm_full +! +! Check/example program for the CRTM Forward and K-Matrix functions. +! +! NOTE: No results are output or compared in this program. +! At this stage, it is included as an example only, +! and to determine that the CRTM library built +! correctly such that it can be linked to create +! an executable. +! + +! Aerosol-Index mapping: +! --- CRTM --- +! 1 = Dust +! 2 = Sea salt-SSAM +! 3 = Sea salt-SSCM1 +! 4 = Sea salt-SSCM2 +! 5 = Sea salt-SSCM3 +! 6 = Organic carbon +! 7 = Black carbon +! 8 = Sulfate +! --- CMAQ --- +! 1 = Dust +! 2 = Soot +! 3 = Water soluble +! 4 = Sulfate +! 5 = Sea salt +! 6 = Water +! 7 = Insoluble +! 8 = dust-like +! --- GOCART-GEOS5 --- +! 1 = Dust +! 2 = Sea salt +! 3 = Organic carbon hydrophobic +! 4 = Organic carbon hydrophilic +! 5 = Black carbon hydrophobic +! 6 = Black carbon hydrophilic +! 7 = Sulfate +! 8 = Nitrate +! --- NAAPS --- +! 1 = Dust +! 2 = Smoke +! 3 = Sea Salt +! 4 = Anthropogenic and Biogenic Fine Particles + +PROGRAM check_crtm + + ! ============================================================================ + ! STEP 1. **** ENVIRONMENT SETUP FOR CRTM USAGE **** + ! + ! Module usage + USE CRTM_Module + ! Disable all implicit typing + IMPLICIT NONE + ! ============================================================================ + + + + ! -------------------------- + ! Some non-CRTM-y Parameters + ! -------------------------- + CHARACTER(*), PARAMETER :: PROGRAM_NAME = 'check_crtm' + + ! ============================================================================ + ! STEP 2. **** SET UP SOME PARAMETERS FOR THE CRTM RUN **** + ! + ! Directory location of coefficients + CHARACTER(*), PARAMETER :: COEFFICIENT_PATH='./' + CHARACTER(*), PARAMETER :: NC_COEFFICIENT_PATH='./' + + ! Aerosol/Cloud coefficient format + CHARACTER(LEN=128) :: Coeff_Format, SpcCoeff_Format, TauCoeff_Format + !CHARACTER(*), PARAMETER :: Coeff_Format = 'netCDF' + + ! Aerosol/Cloud coefficient scheme + CHARACTER(*), PARAMETER :: Aerosol_Model = 'CRTM' + !CHARACTER(*), PARAMETER :: Aerosol_Model = 'CMAQ' + !CHARACTER(*), PARAMETER :: Aerosol_Model = 'GOCART-GEOS5' + !CHARACTER(*), PARAMETER :: Aerosol_Model = 'NAAPS' + CHARACTER(*), PARAMETER :: Cloud_Model = 'CRTM' + + ! Profile dimensions + INTEGER, PARAMETER :: N_PROFILES = 4 + INTEGER, PARAMETER :: N_LAYERS = 92 + INTEGER, PARAMETER :: N_ABSORBERS = 2 + INTEGER, PARAMETER :: N_CLOUDS = 1 + INTEGER, PARAMETER :: N_AEROSOLS = 1 + + ! Sensor information + INTEGER , PARAMETER :: N_SENSORS = 7 + CHARACTER(*), PARAMETER :: SENSOR_ID(N_SENSORS) = (/'tms_tropics-01', & + 'tms_tropics-02', & + 'tms_tropics-03', & + 'tms_tropics-04', & + 'tms_tropics-05', & + 'tms_tropics-06', & + 'tms_tropics-07' /) + + ! Some pretend geometry angles. The scan angle is based + ! on the default Re (earth radius) and h (satellite height) + REAL(fp), PARAMETER :: ZENITH_ANGLE = 30.0_fp + REAL(fp), PARAMETER :: SCAN_ANGLE = 26.37293341421_fp + ! ============================================================================ + + ! --------- + ! Variables + ! --------- + CHARACTER(256) :: message, version + CHARACTER(256) :: AerosolCoeff_File + CHARACTER(256) :: AerosolCoeff_Format + CHARACTER(256) :: CloudCoeff_File + CHARACTER(256) :: CloudCoeff_Format + CHARACTER(256) :: Aerosol_Scheme + CHARACTER(256) :: Cloud_Scheme + INTEGER :: err_stat, alloc_stat + INTEGER :: n_channels + INTEGER :: l, m, n, nc, i + ! ============================================================================ + ! STEP 3. **** DEFINE THE CRTM INTERFACE STRUCTURES **** + ! + ! 3a. Define the "non-demoninational" arguments + ! --------------------------------------------- + TYPE(CRTM_ChannelInfo_type) :: chinfo(N_SENSORS) + TYPE(CRTM_Geometry_type) :: geo(N_PROFILES) + + + ! 3b. Define the FORWARD variables + ! -------------------------------- + TYPE(CRTM_Atmosphere_type) :: atm(N_PROFILES) + TYPE(CRTM_Surface_type) :: sfc(N_PROFILES) + TYPE(CRTM_RTSolution_type), ALLOCATABLE :: rts(:,:) + + ! 3c. Define the K-MATRIX variables + ! --------------------------------- + TYPE(CRTM_Atmosphere_type), ALLOCATABLE :: atm_K(:,:) + TYPE(CRTM_Surface_type) , ALLOCATABLE :: sfc_K(:,:) + TYPE(CRTM_RTSolution_type), ALLOCATABLE :: rts_K(:,:) + ! ============================================================================ + + + ! Program header + ! -------------- + CALL CRTM_Version( Version ) + CALL Program_Message( PROGRAM_NAME, & + 'Check/example program for the CRTM Forward and K-Matrix functions using coefficient datafiles', & + 'CRTM Version: '//TRIM(Version) ) + + ! ============================================================================ + ! STEP 4. **** INITIALIZE THE CRTM **** + ! + ! 4a. Initialise all the sensors at once + ! -------------------------------------- + ! ... Cloud coefficient information + IF ( Cloud_Model /= 'CRTM' ) THEN + Cloud_Scheme = Cloud_Model//'.' + ELSE + Cloud_Scheme = ' ' + END IF + ! ... Aerosol coefficient information + IF ( Aerosol_Model /= 'CRTM' ) THEN + Aerosol_Scheme = Aerosol_Model//'.' + ELSE + Aerosol_Scheme = ' ' + END IF + + DO i = 1,2 + if (i==2) Coeff_Format = 'Binary' + IF (i==1) Coeff_Format = 'netCDF' + + ! ... Coefficient table format + IF ( Coeff_Format == 'Binary' ) THEN + AerosolCoeff_Format = 'Binary' + AerosolCoeff_File = 'AerosolCoeff.'//TRIM(Aerosol_Scheme)//'bin' + CloudCoeff_Format = 'Binary' + CloudCoeff_File = 'CloudCoeff.'//TRIM(Cloud_Scheme)//'bin' + SpcCoeff_Format = 'Binary' + TauCoeff_Format = 'Binary' + ELSE IF ( Coeff_Format == 'netCDF' ) THEN + AerosolCoeff_Format = 'netCDF' + AerosolCoeff_File = 'AerosolCoeff.'//TRIM(Aerosol_Scheme)//'nc4' + CloudCoeff_Format = 'netCDF' + CloudCoeff_File = 'CloudCoeff.'//TRIM(Cloud_Scheme)//'nc4' + SpcCoeff_Format = 'netCDF' + TauCoeff_Format = 'netCDF' + END IF + + WRITE( *,'(/5x,"Initializing the CRTM...")' ) + err_stat = CRTM_Init( SENSOR_ID , & + chinfo , & + Aerosol_Model , & + AerosolCoeff_Format, & + AerosolCoeff_File , & + Cloud_Model , & + CloudCoeff_Format , & + CloudCoeff_File , & + SpcCoeff_Format , & + TauCoeff_Format , & + File_Path=COEFFICIENT_PATH , & + NC_File_Path=NC_COEFFICIENT_PATH, & + Quiet=.FALSE.) + IF ( err_stat /= SUCCESS ) THEN + message = 'Error initializing CRTM' + CALL Display_Message( PROGRAM_NAME, message, FAILURE ) + STOP + END IF + + ! 4b. Output some channel information + ! ----------------------------------- + n_channels = SUM(CRTM_ChannelInfo_n_Channels(chinfo)) + WRITE( *,'(/5x,"Processing a total of ",i0," channels...")' ) n_channels + DO n = 1, N_SENSORS + WRITE( *,'(7x,i0," from ",a)' ) & + CRTM_ChannelInfo_n_Channels(chinfo(n)), TRIM(SENSOR_ID(n)) + END DO + ! ============================================================================ + + + + ! Begin loop over sensors + ! ---------------------- + Sensor_Loop: DO n = 1, N_SENSORS + + ! ========================================================================== + ! STEP 5. **** ALLOCATE STRUCTURE ARRAYS **** + ! + ! 5a. Determine the number of channels + ! for the current sensor + ! ------------------------------------ + n_channels = CRTM_ChannelInfo_n_Channels(chinfo(n)) + + ! 5b. Allocate the ARRAYS + ! ----------------------- + ALLOCATE( rts( n_channels, N_PROFILES ), & + atm_K( n_channels, N_PROFILES ), & + sfc_K( n_channels, N_PROFILES ), & + rts_K( n_channels, N_PROFILES ), & + STAT = alloc_stat ) + IF ( alloc_stat /= 0 ) THEN + message = 'Error allocating structure arrays' + CALL Display_Message( PROGRAM_NAME, message, FAILURE ) + STOP + END IF + + + ! 5c. Allocate the STRUCTURE INTERNALS + ! NOTE: Only the Atmosphere structures + ! are allocated in this example + ! ---------------------------------------- + ! The input FORWARD structure + CALL CRTM_Atmosphere_Create( atm, N_LAYERS, N_ABSORBERS, N_CLOUDS, N_AEROSOLS ) + IF ( ANY(.NOT. CRTM_Atmosphere_Associated(atm)) ) THEN + message = 'Error allocating CRTM Forward Atmosphere structure' + CALL Display_Message( PROGRAM_NAME, message, FAILURE ) + STOP + END IF + + ! The output K-MATRIX structure + CALL CRTM_Atmosphere_Create( atm_K, N_LAYERS, N_ABSORBERS, N_CLOUDS, N_AEROSOLS ) + IF ( ANY(.NOT. CRTM_Atmosphere_Associated(atm_K)) ) THEN + message = 'Error allocating CRTM K-matrix Atmosphere structure' + CALL Display_Message( PROGRAM_NAME, message, FAILURE ) + STOP + END IF + ! ========================================================================== + + ! ========================================================================== + ! STEP 6. **** ASSIGN INPUT DATA **** + ! + ! 6a. Atmosphere and Surface input + ! NOTE: that this is the hard part (in my opinion :o). The mechanism by + ! by which the atmosphere and surface data are loaded in to their + ! respective structures below was done purely to keep the step-by-step + ! instructions in this program relatively "clean". + ! ------------------------------------------------------------------------ + CALL Load_Atm_Data() + CALL Load_Sfc_Data() + DO m = 1, 2 + DO nc = 1, atm(m)%n_Clouds + WHERE(atm(m)%Cloud(nc)%Water_Content > ZERO) atm(m)%Cloud_Fraction = ZERO + END DO + END DO + + ! The true fractional cloud fraction cases + atm(3) = atm(1) + atm(4) = atm(2) + sfc(3) = sfc(1) + sfc(4) = sfc(2) + DO m = 3, 4 + DO nc = 1, atm(m)%n_Clouds + WHERE(atm(m)%Cloud(nc)%Water_Content > ZERO) atm(m)%Cloud_Fraction = 0.1426_fp + END DO + END DO + + ! 6b. Geometry input + ! ------------------ + ! All profiles are given the same value + ! The Sensor_Scan_Angle is optional. + CALL CRTM_Geometry_SetValue( geo, & + Sensor_Zenith_Angle = ZENITH_ANGLE, & + Sensor_Scan_Angle = SCAN_ANGLE ) + ! ========================================================================== + + ! ========================================================================== + ! STEP 7. **** INITIALIZE THE K-MATRIX ARGUMENTS **** + ! + ! 7a. Zero the K-matrix OUTPUT structures + ! --------------------------------------- + CALL CRTM_Atmosphere_Zero( atm_K ) + CALL CRTM_Surface_Zero( sfc_K ) + + ! 7b. Inintialize the K-matrix INPUT so + ! that the results are dTb/dx + ! ------------------------------------- + rts_K%Radiance = ZERO + rts_K%Brightness_Temperature = ONE + ! ========================================================================== + + ! ========================================================================== + ! STEP 8. **** CALL THE CRTM FUNCTIONS FOR THE CURRENT SENSOR **** + ! + WRITE( *, '( /5x, "Calling the CRTM functions for ",a,"..." )' ) TRIM(SENSOR_ID(n)) + + ! 8a. The forward model + ! --------------------- + err_stat = CRTM_Forward( atm , & ! Input + sfc , & ! Input + geo , & ! Input + chinfo(n:n), & ! Input + rts ) ! Output + IF ( err_stat /= SUCCESS ) THEN + message = 'Error calling CRTM Forward Model for '//TRIM(SENSOR_ID(n)) + CALL Display_Message( PROGRAM_NAME, message, FAILURE ) + STOP + END IF + + ! 8b. The K-matrix model + ! ---------------------- + err_stat = CRTM_K_Matrix( atm , & ! FORWARD Input + sfc , & ! FORWARD Input + rts_K , & ! K-MATRIX Input + geo , & ! Input + chinfo(n:n), & ! Input + atm_K , & ! K-MATRIX Output + sfc_K , & ! K-MATRIX Output + rts ) ! FORWARD Output + IF ( err_stat /= SUCCESS ) THEN + message = 'Error calling CRTM K-Matrix Model for '//TRIM(SENSOR_ID(n)) + CALL Display_Message( PROGRAM_NAME, message, FAILURE ) + STOP + END IF + ! ========================================================================== + + ! ============================================================================ + ! 8c. **** OUTPUT THE RESULTS TO SCREEN **** + ! + ! User should read the user guide or the source code of the routine + ! CRTM_RTSolution_Inspect in the file CRTM_RTSolution_Define.f90 to + ! select the needed variables for outputs. These variables are contained + ! in the structure RTSolution. +!!$ DO m = 1, N_PROFILES +!!$ WRITE( *,'(//7x,"Profile ",i0," output for ",a )') m, TRIM(Sensor_Id(n)) +!!$ DO l = 1, n_Channels +!!$ WRITE( *, '(/5x,"Channel ",i0," results")') chinfo(n)%Sensor_Channel(l) +!!$ CALL CRTM_RTSolution_Inspect(rts(l,m)) +!!$ CALL CRTM_RTSolution_Inspect(rts_K(l,m)) +!!$ CALL CRTM_Atmosphere_Inspect(atm_K(l,m)) +!!$ CALL CRTM_Surface_Inspect(sfc_K(l,m)) +!!$ +!!$ END DO +!!$ CALL CRTM_Atmosphere_Inspect(atm(m)) +!!$ CALL CRTM_Surface_Inspect(sfc(m)) +!!$ END DO + + + ! ========================================================================== + ! STEP 9. **** CLEAN UP FOR NEXT SENSOR **** + ! + ! 9a. Deallocate the structures + ! ----------------------------- + CALL CRTM_Atmosphere_Destroy(atm_K) + CALL CRTM_Atmosphere_Destroy(atm) + + ! 9b. Deallocate the arrays + ! ------------------------- + DEALLOCATE(rts, rts_K, sfc_k, atm_k, STAT = alloc_stat) + ! ========================================================================== + + END DO Sensor_Loop + + ! ========================================================================== + ! 10. **** DESTROY THE CRTM **** + ! + WRITE( *, '( /5x, "Destroying the CRTM..." )' ) + err_stat = CRTM_Destroy( chinfo ) + IF ( err_stat /= SUCCESS ) THEN + message = 'Error destroying CRTM' + CALL Display_Message( PROGRAM_NAME, message, FAILURE ) + STOP + END IF + ! ========================================================================== + END DO + + + + ! ========================================================================== + ! 11. **** CREATE A SIGNAL FILE FOR TESTING SUCCESS **** + ! + ! This step is just to allow the CRTM library build process + ! to detect success or failure at the shell level + CALL SignalFile_Create() + ! ========================================================================== + + +CONTAINS + + + ! ========================================================================== + ! Below are some internal procedures that load the + ! necessary input structures with some pretend data + ! ========================================================================== + + ! + ! Internal subprogam to load some test profile data + ! + SUBROUTINE Load_Atm_Data() + ! Local variables + INTEGER :: nc + INTEGER :: k1, k2 + + + ! 4a.1 Profile #1 + ! --------------- + ! ...Profile and absorber definitions + atm(1)%Climatology = US_STANDARD_ATMOSPHERE + atm(1)%Absorber_Id(1:2) = (/ H2O_ID , O3_ID /) + atm(1)%Absorber_Units(1:2) = (/ MASS_MIXING_RATIO_UNITS, VOLUME_MIXING_RATIO_UNITS /) + ! ...Profile data + atm(1)%Level_Pressure = & + (/0.714_fp, 0.975_fp, 1.297_fp, 1.687_fp, 2.153_fp, 2.701_fp, 3.340_fp, 4.077_fp, & + 4.920_fp, 5.878_fp, 6.957_fp, 8.165_fp, 9.512_fp, 11.004_fp, 12.649_fp, 14.456_fp, & + 16.432_fp, 18.585_fp, 20.922_fp, 23.453_fp, 26.183_fp, 29.121_fp, 32.274_fp, 35.650_fp, & + 39.257_fp, 43.100_fp, 47.188_fp, 51.528_fp, 56.126_fp, 60.990_fp, 66.125_fp, 71.540_fp, & + 77.240_fp, 83.231_fp, 89.520_fp, 96.114_fp, 103.017_fp, 110.237_fp, 117.777_fp, 125.646_fp, & + 133.846_fp, 142.385_fp, 151.266_fp, 160.496_fp, 170.078_fp, 180.018_fp, 190.320_fp, 200.989_fp, & + 212.028_fp, 223.441_fp, 235.234_fp, 247.409_fp, 259.969_fp, 272.919_fp, 286.262_fp, 300.000_fp, & + 314.137_fp, 328.675_fp, 343.618_fp, 358.967_fp, 374.724_fp, 390.893_fp, 407.474_fp, 424.470_fp, & + 441.882_fp, 459.712_fp, 477.961_fp, 496.630_fp, 515.720_fp, 535.232_fp, 555.167_fp, 575.525_fp, & + 596.306_fp, 617.511_fp, 639.140_fp, 661.192_fp, 683.667_fp, 706.565_fp, 729.886_fp, 753.627_fp, & + 777.790_fp, 802.371_fp, 827.371_fp, 852.788_fp, 878.620_fp, 904.866_fp, 931.524_fp, 958.591_fp, & + 986.067_fp,1013.948_fp,1042.232_fp,1070.917_fp,1100.000_fp/) + + atm(1)%Pressure = & + (/0.838_fp, 1.129_fp, 1.484_fp, 1.910_fp, 2.416_fp, 3.009_fp, 3.696_fp, 4.485_fp, & + 5.385_fp, 6.402_fp, 7.545_fp, 8.822_fp, 10.240_fp, 11.807_fp, 13.532_fp, 15.423_fp, & + 17.486_fp, 19.730_fp, 22.163_fp, 24.793_fp, 27.626_fp, 30.671_fp, 33.934_fp, 37.425_fp, & + 41.148_fp, 45.113_fp, 49.326_fp, 53.794_fp, 58.524_fp, 63.523_fp, 68.797_fp, 74.353_fp, & + 80.198_fp, 86.338_fp, 92.778_fp, 99.526_fp, 106.586_fp, 113.965_fp, 121.669_fp, 129.703_fp, & + 138.072_fp, 146.781_fp, 155.836_fp, 165.241_fp, 175.001_fp, 185.121_fp, 195.606_fp, 206.459_fp, & + 217.685_fp, 229.287_fp, 241.270_fp, 253.637_fp, 266.392_fp, 279.537_fp, 293.077_fp, 307.014_fp, & + 321.351_fp, 336.091_fp, 351.236_fp, 366.789_fp, 382.751_fp, 399.126_fp, 415.914_fp, 433.118_fp, & + 450.738_fp, 468.777_fp, 487.236_fp, 506.115_fp, 525.416_fp, 545.139_fp, 565.285_fp, 585.854_fp, & + 606.847_fp, 628.263_fp, 650.104_fp, 672.367_fp, 695.054_fp, 718.163_fp, 741.693_fp, 765.645_fp, & + 790.017_fp, 814.807_fp, 840.016_fp, 865.640_fp, 891.679_fp, 918.130_fp, 944.993_fp, 972.264_fp, & + 999.942_fp,1028.025_fp,1056.510_fp,1085.394_fp/) + + atm(1)%Temperature = & + (/256.186_fp, 252.608_fp, 247.762_fp, 243.314_fp, 239.018_fp, 235.282_fp, 233.777_fp, 234.909_fp, & + 237.889_fp, 241.238_fp, 243.194_fp, 243.304_fp, 242.977_fp, 243.133_fp, 242.920_fp, 242.026_fp, & + 240.695_fp, 239.379_fp, 238.252_fp, 236.928_fp, 235.452_fp, 234.561_fp, 234.192_fp, 233.774_fp, & + 233.305_fp, 233.053_fp, 233.103_fp, 233.307_fp, 233.702_fp, 234.219_fp, 234.959_fp, 235.940_fp, & + 236.744_fp, 237.155_fp, 237.374_fp, 238.244_fp, 239.736_fp, 240.672_fp, 240.688_fp, 240.318_fp, & + 239.888_fp, 239.411_fp, 238.512_fp, 237.048_fp, 235.388_fp, 233.551_fp, 231.620_fp, 230.418_fp, & + 229.927_fp, 229.511_fp, 229.197_fp, 228.947_fp, 228.772_fp, 228.649_fp, 228.567_fp, 228.517_fp, & + 228.614_fp, 228.861_fp, 229.376_fp, 230.223_fp, 231.291_fp, 232.591_fp, 234.013_fp, 235.508_fp, & + 237.041_fp, 238.589_fp, 240.165_fp, 241.781_fp, 243.399_fp, 244.985_fp, 246.495_fp, 247.918_fp, & + 249.073_fp, 250.026_fp, 251.113_fp, 252.321_fp, 253.550_fp, 254.741_fp, 256.089_fp, 257.692_fp, & + 259.358_fp, 261.010_fp, 262.779_fp, 264.702_fp, 266.711_fp, 268.863_fp, 271.103_fp, 272.793_fp, & + 273.356_fp, 273.356_fp, 273.356_fp, 273.356_fp/) + + atm(1)%Relative_Humidity = & + (/0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp,& + 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp,& + 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp,& + 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp,& + 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp,& + 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp,& + 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp,& + 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp,& + 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp,& + 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp,& + 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp,& + 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp/) + + atm(1)%Absorber(:,1) = & + (/4.187E-03_fp,4.401E-03_fp,4.250E-03_fp,3.688E-03_fp,3.516E-03_fp,3.739E-03_fp,3.694E-03_fp,3.449E-03_fp, & + 3.228E-03_fp,3.212E-03_fp,3.245E-03_fp,3.067E-03_fp,2.886E-03_fp,2.796E-03_fp,2.704E-03_fp,2.617E-03_fp, & + 2.568E-03_fp,2.536E-03_fp,2.506E-03_fp,2.468E-03_fp,2.427E-03_fp,2.438E-03_fp,2.493E-03_fp,2.543E-03_fp, & + 2.586E-03_fp,2.632E-03_fp,2.681E-03_fp,2.703E-03_fp,2.636E-03_fp,2.512E-03_fp,2.453E-03_fp,2.463E-03_fp, & + 2.480E-03_fp,2.499E-03_fp,2.526E-03_fp,2.881E-03_fp,3.547E-03_fp,4.023E-03_fp,4.188E-03_fp,4.223E-03_fp, & + 4.252E-03_fp,4.275E-03_fp,4.105E-03_fp,3.675E-03_fp,3.196E-03_fp,2.753E-03_fp,2.338E-03_fp,2.347E-03_fp, & + 2.768E-03_fp,3.299E-03_fp,3.988E-03_fp,4.531E-03_fp,4.625E-03_fp,4.488E-03_fp,4.493E-03_fp,4.614E-03_fp, & + 7.523E-03_fp,1.329E-02_fp,2.468E-02_fp,4.302E-02_fp,6.688E-02_fp,9.692E-02_fp,1.318E-01_fp,1.714E-01_fp, & + 2.149E-01_fp,2.622E-01_fp,3.145E-01_fp,3.726E-01_fp,4.351E-01_fp,5.002E-01_fp,5.719E-01_fp,6.507E-01_fp, & + 7.110E-01_fp,7.552E-01_fp,8.127E-01_fp,8.854E-01_fp,9.663E-01_fp,1.050E+00_fp,1.162E+00_fp,1.316E+00_fp, & + 1.494E+00_fp,1.690E+00_fp,1.931E+00_fp,2.226E+00_fp,2.574E+00_fp,2.939E+00_fp,3.187E+00_fp,3.331E+00_fp, & + 3.352E+00_fp,3.260E+00_fp,3.172E+00_fp,3.087E+00_fp/) + + atm(1)%Absorber(:,2) = & + (/3.035E+00_fp,3.943E+00_fp,4.889E+00_fp,5.812E+00_fp,6.654E+00_fp,7.308E+00_fp,7.660E+00_fp,7.745E+00_fp, & + 7.696E+00_fp,7.573E+00_fp,7.413E+00_fp,7.246E+00_fp,7.097E+00_fp,6.959E+00_fp,6.797E+00_fp,6.593E+00_fp, & + 6.359E+00_fp,6.110E+00_fp,5.860E+00_fp,5.573E+00_fp,5.253E+00_fp,4.937E+00_fp,4.625E+00_fp,4.308E+00_fp, & + 3.986E+00_fp,3.642E+00_fp,3.261E+00_fp,2.874E+00_fp,2.486E+00_fp,2.102E+00_fp,1.755E+00_fp,1.450E+00_fp, & + 1.208E+00_fp,1.087E+00_fp,1.030E+00_fp,1.005E+00_fp,1.010E+00_fp,1.028E+00_fp,1.068E+00_fp,1.109E+00_fp, & + 1.108E+00_fp,1.071E+00_fp,9.928E-01_fp,8.595E-01_fp,7.155E-01_fp,5.778E-01_fp,4.452E-01_fp,3.372E-01_fp, & + 2.532E-01_fp,1.833E-01_fp,1.328E-01_fp,9.394E-02_fp,6.803E-02_fp,5.152E-02_fp,4.569E-02_fp,4.855E-02_fp, & + 5.461E-02_fp,6.398E-02_fp,7.205E-02_fp,7.839E-02_fp,8.256E-02_fp,8.401E-02_fp,8.412E-02_fp,8.353E-02_fp, & + 8.269E-02_fp,8.196E-02_fp,8.103E-02_fp,7.963E-02_fp,7.741E-02_fp,7.425E-02_fp,7.067E-02_fp,6.702E-02_fp, & + 6.368E-02_fp,6.070E-02_fp,5.778E-02_fp,5.481E-02_fp,5.181E-02_fp,4.920E-02_fp,4.700E-02_fp,4.478E-02_fp, & + 4.207E-02_fp,3.771E-02_fp,3.012E-02_fp,1.941E-02_fp,9.076E-03_fp,2.980E-03_fp,5.117E-03_fp,1.160E-02_fp, & + 1.428E-02_fp,1.428E-02_fp,1.428E-02_fp,1.428E-02_fp/) + + + ! Load CO2 absorber data if there are three absorrbers + IF ( atm(1)%n_Absorbers > 2 ) THEN + atm(1)%Absorber_Id(3) = CO2_ID + atm(1)%Absorber_Units(3) = VOLUME_MIXING_RATIO_UNITS + atm(1)%Absorber(:,3) = 380.0_fp + END IF + + + ! Cloud data + IF ( atm(1)%n_Clouds > 0 ) THEN + k1 = 75 + k2 = 79 + DO nc = 1, atm(1)%n_Clouds + atm(1)%Cloud(nc)%Type = WATER_CLOUD + atm(1)%Cloud(nc)%Effective_Radius(k1:k2) = 20.0_fp ! microns + atm(1)%Cloud(nc)%Water_Content(k1:k2) = 5.0_fp ! kg/m^2 + END DO + END IF + + ! Aerosol data. Three aerosol types can be loaded: + ! Dust, Sulphate, and Sea Salt SSCM3 + Load_Aerosol_Data_1: IF ( atm(1)%n_Aerosols > 0 ) THEN + + atm(1)%Aerosol(1)%Type = 1 ! dust (CRTM, CMAQ, GOCART-GEOS5) + atm(1)%Aerosol(1)%Effective_Radius = & ! microns + (/0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 5.305110E-16_fp, & + 7.340409E-16_fp, 1.037097E-15_fp, 1.496791E-15_fp, 2.207471E-15_fp, 3.327732E-15_fp, & + 5.128933E-15_fp, 8.083748E-15_fp, 1.303055E-14_fp, 2.148368E-14_fp, 3.622890E-14_fp, & + 6.248544E-14_fp, 1.102117E-13_fp, 1.987557E-13_fp, 3.663884E-13_fp, 6.901587E-13_fp, & + 1.327896E-12_fp, 2.608405E-12_fp, 5.228012E-12_fp, 1.068482E-11_fp, 2.225098E-11_fp, & + 4.717675E-11_fp, 1.017447E-10_fp, 2.229819E-10_fp, 4.960579E-10_fp, 1.118899E-09_fp, & + 2.555617E-09_fp, 5.902789E-09_fp, 1.376717E-08_fp, 3.237321E-08_fp, 7.662427E-08_fp, & + 1.822344E-07_fp, 4.346896E-07_fp, 1.037940E-06_fp, 2.475858E-06_fp, 5.887266E-06_fp, & + 1.392410E-05_fp, 3.267943E-05_fp, 7.592447E-05_fp, 1.741777E-04_fp, 3.935216E-04_fp, & + 8.732308E-04_fp, 1.897808E-03_fp, 4.027868E-03_fp, 8.323272E-03_fp, 1.669418E-02_fp, & + 3.239702E-02_fp, 6.063055E-02_fp, 1.090596E-01_fp, 1.878990E-01_fp, 3.089856E-01_fp, & + 4.832092E-01_fp, 7.159947E-01_fp, 1.001436E+00_fp, 1.317052E+00_fp, 1.622354E+00_fp, & + 1.864304E+00_fp, 1.990457E+00_fp, 1.966354E+00_fp, 1.789883E+00_fp, 1.494849E+00_fp, & + 1.140542E+00_fp, 7.915451E-01_fp, 4.974823E-01_fp, 2.818937E-01_fp, 1.433668E-01_fp, & + 6.514795E-02_fp, 2.633057E-02_fp, 9.421763E-03_fp, 2.971053E-03_fp, 8.218245E-04_fp/) + atm(1)%Aerosol(1)%Concentration = & ! kg/m^2 + (/0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 2.458105E-18_fp, 1.983430E-16_fp, & + 1.191432E-14_fp, 5.276880E-13_fp, 1.710270E-11_fp, 4.035105E-10_fp, 6.911389E-09_fp, & + 8.594215E-08_fp, 7.781797E-07_fp, 5.162773E-06_fp, 2.534018E-05_fp, 9.325154E-05_fp, & + 2.617738E-04_fp, 5.727150E-04_fp, 1.002153E-03_fp, 1.446048E-03_fp, 1.782757E-03_fp, & + 1.955759E-03_fp, 1.999206E-03_fp, 1.994698E-03_fp, 1.913109E-03_fp, 1.656122E-03_fp, & + 1.206328E-03_fp, 6.847261E-04_fp, 2.785695E-04_fp, 7.418821E-05_fp, 1.172680E-05_fp, & + 9.900895E-07_fp, 3.987399E-08_fp, 6.786932E-10_fp, 4.291151E-12_fp, 8.785440E-15_fp/) + IF ( Aerosol_Model== 'CMAQ' ) THEN + atm(1)%Aerosol(1)%Effective_Variance = & ! N/A + (/1.0500000E+00_fp, 1.500000E+00_fp, & + 1.100000E+00_fp, 1.100000E+00_fp, 1.100000E+00_fp, 1.100000E+00_fp, 1.100000E+00_fp, & + 1.200000E+00_fp, 1.200000E+00_fp, 1.200000E+00_fp, 1.200000E+00_fp, 1.200000E+00_fp, & + 1.300000E+00_fp, 1.300000E+00_fp, 1.300000E+00_fp, 1.300000E+00_fp, 1.300000E+00_fp, & + 1.400000E+00_fp, 1.400000E+00_fp, 1.400000E+00_fp, 1.400000E+00_fp, 1.400000E+00_fp, & + 1.500000E+00_fp, 1.500000E+00_fp, 1.500000E+00_fp, 1.500000E+00_fp, 1.500000E+00_fp, & + 1.600000E+00_fp, 1.600000E+00_fp, 1.600000E+00_fp, 1.600000E+00_fp, 1.600000E+00_fp, & + 1.700000E+00_fp, 1.700000E+00_fp, 1.700000E+00_fp, 1.700000E+00_fp, 1.700000E+00_fp, & + 1.800000E+00_fp, 1.800000E+00_fp, 1.800000E+00_fp, 1.800000E+00_fp, 1.800000E+00_fp, & + 1.900000E+00_fp, 1.900000E+00_fp, 1.900000E+00_fp, 1.900000E+00_fp, 1.900000E+00_fp, & + 2.000000E+00_fp, 2.000000E+00_fp, 2.000000E+00_fp, 2.000000E+00_fp, 2.000000E+00_fp, & + 2.100000E+00_fp, 2.100000E+00_fp, 2.100000E+00_fp, 2.100000E+00_fp, 2.100000E+00_fp, & + 2.200000E+00_fp, 2.200000E+00_fp, 2.200000E+00_fp, 2.200000E+00_fp, 2.200000E+00_fp, & + 2.300000E+00_fp, 2.300000E+00_fp, 2.300000E+00_fp, 2.300000E+00_fp, 2.300000E+00_fp, & + 2.400000E+00_fp, 2.400000E+00_fp, 2.400000E+00_fp, 2.400000E+00_fp, 2.400000E+00_fp, & + 2.500000E+00_fp, 2.500000E+00_fp, 2.500000E+00_fp, 2.500000E+00_fp, 2.500000E+00_fp, & + 1.200000E+00_fp, 1.200000E+00_fp, 1.200000E+00_fp, 1.200000E+00_fp, 1.200000E+00_fp, & + 1.500000E+00_fp, 1.500000E+00_fp, 1.500000E+00_fp, 1.500000E+00_fp, 1.500000E+00_fp, & + 1.700000E+00_fp, 1.700000E+00_fp, 1.700000E+00_fp, 1.700000E+00_fp, 1.700000E+00_fp/) + END IF + + IF ( atm(1)%n_Aerosols > 1 ) THEN + atm(1)%Aerosol(2)%Type = 8 ! sulfate (CRTM), dust-like (CMAQ), Nitrate (GOCART-GEOS5) + atm(1)%Aerosol(2)%Effective_Radius = & ! microns + (/0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 3.000000E-01_fp, 3.000000E-01_fp, 3.000000E-01_fp, & + 3.000000E-01_fp, 3.000000E-01_fp, 3.000000E-01_fp, 3.000000E-01_fp, 3.000000E-01_fp, & + 3.000000E-01_fp, 3.000000E-01_fp, 3.000000E-01_fp, 3.000000E-01_fp, 3.000000E-01_fp, & + 3.000000E-01_fp, 3.000000E-01_fp, 3.000000E-01_fp, 3.000000E-01_fp, 3.000000E-01_fp, & + 3.000000E-01_fp, 3.000000E-01_fp, 3.000000E-01_fp, 3.000000E-01_fp, 3.000000E-01_fp, & + 3.000000E-01_fp, 3.000000E-01_fp, 3.000000E-01_fp, 3.000000E-01_fp, 3.000000E-01_fp, & + 3.000000E-01_fp, 3.000000E-01_fp, 3.000000E-01_fp, 3.000000E-01_fp, 3.000000E-01_fp, & + 3.000000E-01_fp, 3.000000E-01_fp, 3.000000E-01_fp, 3.000000E-01_fp, 3.000000E-01_fp, & + 3.000000E-01_fp, 3.000000E-01_fp, 3.000000E-01_fp, 3.000000E-01_fp, 3.000000E-01_fp, & + 3.000000E-01_fp, 3.000000E-01_fp, 3.000000E-01_fp, 3.000000E-01_fp, 3.000000E-01_fp, & + 3.000000E-01_fp, 3.000000E-01_fp, 3.000000E-01_fp, 3.000000E-01_fp, 3.000000E-01_fp, & + 3.000000E-01_fp, 3.060238E-01_fp, 3.652677E-01_fp, 4.139419E-01_fp, 4.438249E-01_fp, & + 4.486394E-01_fp, 4.261471E-01_fp, 3.795067E-01_fp, 3.174571E-01_fp, 3.000000E-01_fp, & + 3.000000E-01_fp, 3.000000E-01_fp, 3.000000E-01_fp, 3.243099E-01_fp, 4.662931E-01_fp, & + 6.103025E-01_fp, 6.958640E-01_fp, 6.776480E-01_fp, 5.570077E-01_fp, 3.828734E-01_fp, & + 3.000000E-01_fp, 3.000000E-01_fp, 3.000000E-01_fp, 3.000000E-01_fp, 3.000000E-01_fp/) + atm(1)%Aerosol(2)%Concentration = & ! kg/m^2 + (/0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 7.299549E-21_fp, 2.154532E-20_fp, 6.848207E-20_fp, & + 2.339296E-19_fp, 8.562906E-19_fp, 3.346100E-18_fp, 1.389284E-17_fp, 6.094260E-17_fp, & + 2.805828E-16_fp, 1.345656E-15_fp, 6.665967E-15_fp, 3.378989E-14_fp, 1.734933E-13_fp, & + 8.924837E-13_fp, 4.546743E-12_fp, 2.266249E-11_fp, 1.091369E-10_fp, 5.013496E-10_fp, & + 2.168936E-09_fp, 8.725800E-09_fp, 3.224980E-08_fp, 1.082545E-07_fp, 3.266343E-07_fp, & + 8.780083E-07_fp, 2.087760E-06_fp, 4.370441E-06_fp, 8.038113E-06_fp, 1.300537E-05_fp, & + 1.860671E-05_fp, 2.376757E-05_fp, 2.751048E-05_fp, 2.945706E-05_fp, 2.998589E-05_fp, & + 2.995521E-05_fp, 2.909387E-05_fp, 2.609907E-05_fp, 2.031620E-05_fp, 1.274989E-05_fp, & + 5.920554E-06_fp, 1.842346E-06_fp, 3.429331E-07_fp, 3.355556E-08_fp, 1.506455E-09_fp, & + 1.720306E-10_fp, 1.161071E-09_fp, 7.599420E-09_fp, 4.096076E-08_fp, 1.815570E-07_fp, & + 6.623233E-07_fp, 1.994766E-06_fp, 4.987904E-06_fp, 1.044158E-05_fp, 1.850659E-05_fp, & + 2.817442E-05_fp, 3.750360E-05_fp, 4.459276E-05_fp, 4.857087E-05_fp, 4.990199E-05_fp, & + 4.998888E-05_fp, 4.922362E-05_fp, 4.582548E-05_fp, 3.844906E-05_fp, 2.757877E-05_fp, & + 1.615474E-05_fp, 9.509965E-06_fp, 1.672265E-05_fp, 4.602962E-05_fp, 8.740809E-05_fp, & + 1.165118E-04_fp, 1.248318E-04_fp, 1.240508E-04_fp, 1.095622E-04_fp, 7.116027E-05_fp, & + 2.756351E-05_fp, 5.072010E-06_fp, 3.467497E-07_fp, 6.759169E-09_fp, 2.828000E-11_fp/) + IF ( Aerosol_Model== 'CMAQ' ) THEN + atm(1)%Aerosol(2)%Effective_Variance = & ! N/A + (/1.050000E+00_fp, 1.500000E+00_fp, & + 1.100000E+00_fp, 1.100000E+00_fp, 1.100000E+00_fp, 1.100000E+00_fp, 1.100000E+00_fp, & + 1.200000E+00_fp, 1.200000E+00_fp, 1.200000E+00_fp, 1.200000E+00_fp, 1.200000E+00_fp, & + 1.300000E+00_fp, 1.300000E+00_fp, 1.300000E+00_fp, 1.300000E+00_fp, 1.300000E+00_fp, & + 1.400000E+00_fp, 1.400000E+00_fp, 1.400000E+00_fp, 1.400000E+00_fp, 1.400000E+00_fp, & + 1.500000E+00_fp, 1.500000E+00_fp, 1.500000E+00_fp, 1.500000E+00_fp, 1.500000E+00_fp, & + 1.600000E+00_fp, 1.600000E+00_fp, 1.600000E+00_fp, 1.600000E+00_fp, 1.600000E+00_fp, & + 1.700000E+00_fp, 1.700000E+00_fp, 1.700000E+00_fp, 1.700000E+00_fp, 1.700000E+00_fp, & + 1.800000E+00_fp, 1.800000E+00_fp, 1.800000E+00_fp, 1.800000E+00_fp, 1.800000E+00_fp, & + 1.900000E+00_fp, 1.900000E+00_fp, 1.900000E+00_fp, 1.900000E+00_fp, 1.900000E+00_fp, & + 2.000000E+00_fp, 2.000000E+00_fp, 2.000000E+00_fp, 2.000000E+00_fp, 2.000000E+00_fp, & + 2.100000E+00_fp, 2.100000E+00_fp, 2.100000E+00_fp, 2.100000E+00_fp, 2.100000E+00_fp, & + 2.200000E+00_fp, 2.200000E+00_fp, 2.200000E+00_fp, 2.200000E+00_fp, 2.200000E+00_fp, & + 2.300000E+00_fp, 2.300000E+00_fp, 2.300000E+00_fp, 2.300000E+00_fp, 2.300000E+00_fp, & + 2.400000E+00_fp, 2.400000E+00_fp, 2.400000E+00_fp, 2.400000E+00_fp, 2.400000E+00_fp, & + 2.500000E+00_fp, 2.500000E+00_fp, 2.500000E+00_fp, 2.500000E+00_fp, 2.500000E+00_fp, & + 1.200000E+00_fp, 1.200000E+00_fp, 1.200000E+00_fp, 1.200000E+00_fp, 1.200000E+00_fp, & + 1.500000E+00_fp, 1.500000E+00_fp, 1.500000E+00_fp, 1.500000E+00_fp, 1.500000E+00_fp, & + 1.700000E+00_fp, 1.700000E+00_fp, 1.700000E+00_fp, 1.700000E+00_fp, 1.700000E+00_fp/) + END IF + END IF + + + IF ( atm(1)%n_Aerosols > 2 ) THEN + + atm(1)%Aerosol(3)%Type = 5 ! SEASALT_SSCM3_AEROSOL (CRTM), Sea salt (CMAQ), Black carbon (GOCART-GEOS5) + atm(1)%Aerosol(3)%Effective_Radius = & ! microns + (/7.600000E+00_fp, 7.600000E+00_fp, & + 7.600000E+00_fp, 7.600000E+00_fp, 7.600000E+00_fp, 7.600000E+00_fp, 7.600000E+00_fp, & + 7.600000E+00_fp, 7.600000E+00_fp, 7.600000E+00_fp, 7.600000E+00_fp, 7.600000E+00_fp, & + 7.600000E+00_fp, 7.600000E+00_fp, 7.600000E+00_fp, 7.600000E+00_fp, 7.600000E+00_fp, & + 7.600000E+00_fp, 7.600000E+00_fp, 7.600000E+00_fp, 7.600000E+00_fp, 7.600000E+00_fp, & + 7.600000E+00_fp, 7.600000E+00_fp, 7.600000E+00_fp, 7.600000E+00_fp, 7.600000E+00_fp, & + 7.600000E+00_fp, 7.600000E+00_fp, 7.600000E+00_fp, 7.600000E+00_fp, 7.600000E+00_fp, & + 7.600000E+00_fp, 7.600000E+00_fp, 7.600000E+00_fp, 7.600000E+00_fp, 7.600000E+00_fp, & + 7.600000E+00_fp, 7.600000E+00_fp, 7.600000E+00_fp, 7.600000E+00_fp, 7.600000E+00_fp, & + 7.600000E+00_fp, 7.600000E+00_fp, 7.600000E+00_fp, 7.600000E+00_fp, 7.600000E+00_fp, & + 7.600000E+00_fp, 7.600000E+00_fp, 7.600000E+00_fp, 7.600000E+00_fp, 7.600000E+00_fp, & + 7.600000E+00_fp, 7.600000E+00_fp, 7.600000E+00_fp, 7.600000E+00_fp, 7.600000E+00_fp, & + 7.600000E+00_fp, 7.600000E+00_fp, 7.600000E+00_fp, 7.600000E+00_fp, 7.600000E+00_fp, & + 7.600000E+00_fp, 7.600000E+00_fp, 7.600000E+00_fp, 7.600000E+00_fp, 7.600000E+00_fp, & + 7.600000E+00_fp, 7.600000E+00_fp, 7.600000E+00_fp, 7.600000E+00_fp, 7.600000E+00_fp, & + 7.600000E+00_fp, 7.600000E+00_fp, 7.600000E+00_fp, 7.600000E+00_fp, 7.600000E+00_fp, & + 7.600000E+00_fp, 7.600000E+00_fp, 7.600000E+00_fp, 7.600000E+00_fp, 7.600000E+00_fp, & + 7.600000E+00_fp, 7.600000E+00_fp, 7.600000E+00_fp, 7.600000E+00_fp, 7.600000E+00_fp, & + 7.600000E+00_fp, 7.600000E+00_fp, 7.600000E+00_fp, 7.600000E+00_fp, 7.600000E+00_fp/) + atm(1)%Aerosol(3)%Concentration = & ! kg/m^2 + (/1.834405E-15_fp, 2.004881E-15_fp, & + 2.234084E-15_fp, 2.543453E-15_fp, 2.964461E-15_fp, 3.544295E-15_fp, 4.355235E-15_fp, & + 5.510452E-15_fp, 7.191267E-15_fp, 9.695182E-15_fp, 1.352261E-14_fp, 1.953716E-14_fp, & + 2.926925E-14_fp, 4.550553E-14_fp, 7.346181E-14_fp, 1.231759E-13_fp, 2.145104E-13_fp, & + 3.878653E-13_fp, 7.276576E-13_fp, 1.414927E-12_fp, 2.847645E-12_fp, 5.921044E-12_fp, & + 1.269153E-11_fp, 2.797048E-11_fp, 6.318984E-11_fp, 1.458383E-10_fp, 3.425444E-10_fp, & + 8.153831E-10_fp, 1.958067E-09_fp, 4.720525E-09_fp, 1.136570E-08_fp, 2.718180E-08_fp, & + 6.420674E-08_fp, 1.489302E-07_fp, 3.372331E-07_fp, 7.410874E-07_fp, 1.571399E-06_fp, & + 3.197064E-06_fp, 6.208220E-06_fp, 1.145048E-05_fp, 1.997373E-05_fp, 3.283395E-05_fp, & + 5.072822E-05_fp, 7.354173E-05_fp, 1.000035E-04_fp, 1.276931E-04_fp, 1.535301E-04_fp, & + 1.746342E-04_fp, 1.892127E-04_fp, 1.971011E-04_fp, 1.997815E-04_fp, 1.999842E-04_fp, & + 1.985580E-04_fp, 1.917087E-04_fp, 1.753846E-04_fp, 1.474980E-04_fp, 1.101113E-04_fp, & + 7.010137E-05_fp, 3.636523E-05_fp, 1.460058E-05_fp, 4.282477E-06_fp, 8.603007E-07_fp, & + 1.101800E-07_fp, 8.310010E-09_fp, 3.382006E-10_fp, 6.751810E-12_fp, 3.060195E-13_fp, & + 9.145434E-12_fp, 2.343817E-10_fp, 4.156377E-09_fp, 5.122906E-08_fp, 4.424084E-07_fp, & + 2.708849E-06_fp, 1.194846E-05_fp, 3.874236E-05_fp, 9.466062E-05_fp, 1.795200E-04_fp, & + 2.735688E-04_fp, 3.486493E-04_fp, 3.889143E-04_fp, 3.997242E-04_fp, 3.991008E-04_fp, & + 3.826235E-04_fp, 3.287943E-04_fp, 2.344766E-04_fp, 1.275907E-04_fp, 4.835821E-05_fp, & + 1.156687E-05_fp, 1.570009E-06_fp, 1.078885E-07_fp, 3.321985E-09_fp, 4.023206E-11_fp/) + IF ( Aerosol_Model== 'CMAQ' ) THEN + atm(1)%Aerosol(3)%Effective_Variance = & ! N/A + (/1.050000E+00_fp, 1.500000E+00_fp, & + 1.100000E+00_fp, 1.100000E+00_fp, 1.100000E+00_fp, 1.100000E+00_fp, 1.100000E+00_fp, & + 1.200000E+00_fp, 1.200000E+00_fp, 1.200000E+00_fp, 1.200000E+00_fp, 1.200000E+00_fp, & + 1.300000E+00_fp, 1.300000E+00_fp, 1.300000E+00_fp, 1.300000E+00_fp, 1.300000E+00_fp, & + 1.400000E+00_fp, 1.400000E+00_fp, 1.400000E+00_fp, 1.400000E+00_fp, 1.400000E+00_fp, & + 1.500000E+00_fp, 1.500000E+00_fp, 1.500000E+00_fp, 1.500000E+00_fp, 1.500000E+00_fp, & + 1.600000E+00_fp, 1.600000E+00_fp, 1.600000E+00_fp, 1.600000E+00_fp, 1.600000E+00_fp, & + 1.700000E+00_fp, 1.700000E+00_fp, 1.700000E+00_fp, 1.700000E+00_fp, 1.700000E+00_fp, & + 1.800000E+00_fp, 1.800000E+00_fp, 1.800000E+00_fp, 1.800000E+00_fp, 1.800000E+00_fp, & + 1.900000E+00_fp, 1.900000E+00_fp, 1.900000E+00_fp, 1.900000E+00_fp, 1.900000E+00_fp, & + 2.000000E+00_fp, 2.000000E+00_fp, 2.000000E+00_fp, 2.000000E+00_fp, 2.000000E+00_fp, & + 2.100000E+00_fp, 2.100000E+00_fp, 2.100000E+00_fp, 2.100000E+00_fp, 2.100000E+00_fp, & + 2.200000E+00_fp, 2.200000E+00_fp, 2.200000E+00_fp, 2.200000E+00_fp, 2.200000E+00_fp, & + 2.300000E+00_fp, 2.300000E+00_fp, 2.300000E+00_fp, 2.300000E+00_fp, 2.300000E+00_fp, & + 2.400000E+00_fp, 2.400000E+00_fp, 2.400000E+00_fp, 2.400000E+00_fp, 2.400000E+00_fp, & + 2.500000E+00_fp, 2.500000E+00_fp, 2.500000E+00_fp, 2.500000E+00_fp, 2.500000E+00_fp, & + 1.200000E+00_fp, 1.200000E+00_fp, 1.200000E+00_fp, 1.200000E+00_fp, 1.200000E+00_fp, & + 1.500000E+00_fp, 1.500000E+00_fp, 1.500000E+00_fp, 1.500000E+00_fp, 1.500000E+00_fp, & + 1.700000E+00_fp, 1.700000E+00_fp, 1.700000E+00_fp, 1.700000E+00_fp, 1.700000E+00_fp/) + END IF + END IF + END IF Load_Aerosol_Data_1 + + + + ! 4a.2 Profile #2 + ! --------------- + ! ...Profile and absorber definitions + atm(2)%Climatology = TROPICAL + atm(2)%Absorber_Id(1:2) = (/ H2O_ID , O3_ID /) + atm(2)%Absorber_Units(1:2) = (/ MASS_MIXING_RATIO_UNITS, VOLUME_MIXING_RATIO_UNITS /) + ! ...Profile data + atm(2)%Level_Pressure = & + (/0.714_fp, 0.975_fp, 1.297_fp, 1.687_fp, 2.153_fp, 2.701_fp, 3.340_fp, 4.077_fp, & + 4.920_fp, 5.878_fp, 6.957_fp, 8.165_fp, 9.512_fp, 11.004_fp, 12.649_fp, 14.456_fp, & + 16.432_fp, 18.585_fp, 20.922_fp, 23.453_fp, 26.183_fp, 29.121_fp, 32.274_fp, 35.650_fp, & + 39.257_fp, 43.100_fp, 47.188_fp, 51.528_fp, 56.126_fp, 60.990_fp, 66.125_fp, 71.540_fp, & + 77.240_fp, 83.231_fp, 89.520_fp, 96.114_fp, 103.017_fp, 110.237_fp, 117.777_fp, 125.646_fp, & + 133.846_fp, 142.385_fp, 151.266_fp, 160.496_fp, 170.078_fp, 180.018_fp, 190.320_fp, 200.989_fp, & + 212.028_fp, 223.441_fp, 235.234_fp, 247.409_fp, 259.969_fp, 272.919_fp, 286.262_fp, 300.000_fp, & + 314.137_fp, 328.675_fp, 343.618_fp, 358.967_fp, 374.724_fp, 390.893_fp, 407.474_fp, 424.470_fp, & + 441.882_fp, 459.712_fp, 477.961_fp, 496.630_fp, 515.720_fp, 535.232_fp, 555.167_fp, 575.525_fp, & + 596.306_fp, 617.511_fp, 639.140_fp, 661.192_fp, 683.667_fp, 706.565_fp, 729.886_fp, 753.627_fp, & + 777.790_fp, 802.371_fp, 827.371_fp, 852.788_fp, 878.620_fp, 904.866_fp, 931.524_fp, 958.591_fp, & + 986.067_fp,1013.948_fp,1042.232_fp,1070.917_fp,1100.000_fp/) + + atm(2)%Pressure = & + (/0.838_fp, 1.129_fp, 1.484_fp, 1.910_fp, 2.416_fp, 3.009_fp, 3.696_fp, 4.485_fp, & + 5.385_fp, 6.402_fp, 7.545_fp, 8.822_fp, 10.240_fp, 11.807_fp, 13.532_fp, 15.423_fp, & + 17.486_fp, 19.730_fp, 22.163_fp, 24.793_fp, 27.626_fp, 30.671_fp, 33.934_fp, 37.425_fp, & + 41.148_fp, 45.113_fp, 49.326_fp, 53.794_fp, 58.524_fp, 63.523_fp, 68.797_fp, 74.353_fp, & + 80.198_fp, 86.338_fp, 92.778_fp, 99.526_fp, 106.586_fp, 113.965_fp, 121.669_fp, 129.703_fp, & + 138.072_fp, 146.781_fp, 155.836_fp, 165.241_fp, 175.001_fp, 185.121_fp, 195.606_fp, 206.459_fp, & + 217.685_fp, 229.287_fp, 241.270_fp, 253.637_fp, 266.392_fp, 279.537_fp, 293.077_fp, 307.014_fp, & + 321.351_fp, 336.091_fp, 351.236_fp, 366.789_fp, 382.751_fp, 399.126_fp, 415.914_fp, 433.118_fp, & + 450.738_fp, 468.777_fp, 487.236_fp, 506.115_fp, 525.416_fp, 545.139_fp, 565.285_fp, 585.854_fp, & + 606.847_fp, 628.263_fp, 650.104_fp, 672.367_fp, 695.054_fp, 718.163_fp, 741.693_fp, 765.645_fp, & + 790.017_fp, 814.807_fp, 840.016_fp, 865.640_fp, 891.679_fp, 918.130_fp, 944.993_fp, 972.264_fp, & + 999.942_fp,1028.025_fp,1056.510_fp,1085.394_fp/) + + atm(2)%Temperature = & + (/266.536_fp, 269.608_fp, 270.203_fp, 264.526_fp, 251.578_fp, 240.264_fp, 235.095_fp, 232.959_fp, & + 233.017_fp, 233.897_fp, 234.385_fp, 233.681_fp, 232.436_fp, 231.607_fp, 231.192_fp, 230.808_fp, & + 230.088_fp, 228.603_fp, 226.407_fp, 223.654_fp, 220.525_fp, 218.226_fp, 216.668_fp, 215.107_fp, & + 213.538_fp, 212.006_fp, 210.507_fp, 208.883_fp, 206.793_fp, 204.415_fp, 202.058_fp, 199.718_fp, & + 197.668_fp, 196.169_fp, 194.993_fp, 194.835_fp, 195.648_fp, 196.879_fp, 198.830_fp, 201.091_fp, & + 203.558_fp, 206.190_fp, 208.900_fp, 211.736_fp, 214.601_fp, 217.522_fp, 220.457_fp, 223.334_fp, & + 226.156_fp, 228.901_fp, 231.557_fp, 234.173_fp, 236.788_fp, 239.410_fp, 242.140_fp, 244.953_fp, & + 247.793_fp, 250.665_fp, 253.216_fp, 255.367_fp, 257.018_fp, 258.034_fp, 258.778_fp, 259.454_fp, & + 260.225_fp, 261.251_fp, 262.672_fp, 264.614_fp, 266.854_fp, 269.159_fp, 271.448_fp, 273.673_fp, & + 275.955_fp, 278.341_fp, 280.822_fp, 283.349_fp, 285.826_fp, 288.288_fp, 290.721_fp, 293.135_fp, & + 295.609_fp, 298.173_fp, 300.787_fp, 303.379_fp, 305.960_fp, 308.521_fp, 310.916_fp, 313.647_fp, & + 315.244_fp, 315.244_fp, 315.244_fp, 315.244_fp/) + + atm(2)%Relative_Humidity = & + (/0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp,& + 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp,& + 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp,& + 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp,& + 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp,& + 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp,& + 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp,& + 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp,& + 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp,& + 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp,& + 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp,& + 0.5_fp, 0.5_fp, 0.5_fp, 0.5_fp/) + + atm(2)%Absorber(:,1) = & + (/3.887E-03_fp,3.593E-03_fp,3.055E-03_fp,2.856E-03_fp,2.921E-03_fp,2.555E-03_fp,2.392E-03_fp,2.605E-03_fp, & + 2.573E-03_fp,2.368E-03_fp,2.354E-03_fp,2.333E-03_fp,2.312E-03_fp,2.297E-03_fp,2.287E-03_fp,2.283E-03_fp, & + 2.282E-03_fp,2.286E-03_fp,2.296E-03_fp,2.309E-03_fp,2.324E-03_fp,2.333E-03_fp,2.335E-03_fp,2.335E-03_fp, & + 2.333E-03_fp,2.340E-03_fp,2.361E-03_fp,2.388E-03_fp,2.421E-03_fp,2.458E-03_fp,2.492E-03_fp,2.523E-03_fp, & + 2.574E-03_fp,2.670E-03_fp,2.789E-03_fp,2.944E-03_fp,3.135E-03_fp,3.329E-03_fp,3.530E-03_fp,3.759E-03_fp, & + 4.165E-03_fp,4.718E-03_fp,5.352E-03_fp,6.099E-03_fp,6.845E-03_fp,7.524E-03_fp,8.154E-03_fp,8.381E-03_fp, & + 8.214E-03_fp,8.570E-03_fp,9.672E-03_fp,1.246E-02_fp,1.880E-02_fp,2.720E-02_fp,3.583E-02_fp,4.462E-02_fp, & + 4.548E-02_fp,3.811E-02_fp,3.697E-02_fp,4.440E-02_fp,2.130E-01_fp,6.332E-01_fp,9.945E-01_fp,1.073E+00_fp, & + 1.196E+00_fp,1.674E+00_fp,2.323E+00_fp,2.950E+00_fp,3.557E+00_fp,4.148E+00_fp,4.666E+00_fp,5.092E+00_fp, & + 5.487E+00_fp,5.852E+00_fp,6.137E+00_fp,6.297E+00_fp,6.338E+00_fp,6.234E+00_fp,5.906E+00_fp,5.476E+00_fp, & + 5.176E+00_fp,4.994E+00_fp,4.884E+00_fp,4.832E+00_fp,4.791E+00_fp,4.760E+00_fp,4.736E+00_fp,6.368E+00_fp, & + 7.897E+00_fp,7.673E+00_fp,7.458E+00_fp,7.252E+00_fp/) + + atm(2)%Absorber(:,2) = & + (/2.742E+00_fp,3.386E+00_fp,4.164E+00_fp,5.159E+00_fp,6.357E+00_fp,7.430E+00_fp,8.174E+00_fp,8.657E+00_fp, & + 8.930E+00_fp,9.056E+00_fp,9.077E+00_fp,8.988E+00_fp,8.778E+00_fp,8.480E+00_fp,8.123E+00_fp,7.694E+00_fp, & + 7.207E+00_fp,6.654E+00_fp,6.060E+00_fp,5.464E+00_fp,4.874E+00_fp,4.299E+00_fp,3.739E+00_fp,3.202E+00_fp, & + 2.688E+00_fp,2.191E+00_fp,1.710E+00_fp,1.261E+00_fp,8.835E-01_fp,5.551E-01_fp,3.243E-01_fp,1.975E-01_fp, & + 1.071E-01_fp,7.026E-02_fp,6.153E-02_fp,5.869E-02_fp,6.146E-02_fp,6.426E-02_fp,6.714E-02_fp,6.989E-02_fp, & + 7.170E-02_fp,7.272E-02_fp,7.346E-02_fp,7.383E-02_fp,7.406E-02_fp,7.418E-02_fp,7.424E-02_fp,7.411E-02_fp, & + 7.379E-02_fp,7.346E-02_fp,7.312E-02_fp,7.284E-02_fp,7.274E-02_fp,7.273E-02_fp,7.272E-02_fp,7.270E-02_fp, & + 7.257E-02_fp,7.233E-02_fp,7.167E-02_fp,7.047E-02_fp,6.920E-02_fp,6.803E-02_fp,6.729E-02_fp,6.729E-02_fp, & + 6.753E-02_fp,6.756E-02_fp,6.717E-02_fp,6.615E-02_fp,6.510E-02_fp,6.452E-02_fp,6.440E-02_fp,6.463E-02_fp, & + 6.484E-02_fp,6.487E-02_fp,6.461E-02_fp,6.417E-02_fp,6.382E-02_fp,6.378E-02_fp,6.417E-02_fp,6.482E-02_fp, & + 6.559E-02_fp,6.638E-02_fp,6.722E-02_fp,6.841E-02_fp,6.944E-02_fp,6.720E-02_fp,6.046E-02_fp,4.124E-02_fp, & + 2.624E-02_fp,2.623E-02_fp,2.622E-02_fp,2.622E-02_fp/) + + + ! Load CO2 absorrber data if there are three absorrbers + IF ( atm(2)%n_Absorbers > 2 ) THEN + atm(2)%Absorber_Id(3) = CO2_ID + atm(2)%Absorber_Units(3) = VOLUME_MIXING_RATIO_UNITS + atm(2)%Absorber(:,3) = & + (/1.100e+02_fp,2.700e+02_fp,3.200e+02_fp,3.300e+02_fp,3.200e+02_fp,3.300e+02_fp,3.300e+02_fp,3.300e+02_fp, & + 3.300e+02_fp,3.300e+02_fp,3.300e+02_fp,3.300e+02_fp,3.300e+02_fp,3.300e+02_fp,3.300e+02_fp,3.300e+02_fp, & + 3.300e+02_fp,3.300e+02_fp,3.300e+02_fp,3.300e+02_fp,3.300e+02_fp,3.300e+02_fp,3.300e+02_fp,3.300e+02_fp, & + 3.300e+02_fp,3.300e+02_fp,3.300e+02_fp,3.300e+02_fp,3.300e+02_fp,3.300e+02_fp,3.300e+02_fp,3.300e+02_fp, & + 3.300e+02_fp,3.300e+02_fp,3.300e+02_fp,3.300e+02_fp,3.300e+02_fp,3.300e+02_fp,3.300e+02_fp,3.300e+02_fp, & + 3.300e+02_fp,3.300e+02_fp,3.300e+02_fp,3.300e+02_fp,3.300e+02_fp,3.300e+02_fp,3.300e+02_fp,3.300e+02_fp, & + 3.300e+02_fp,3.300e+02_fp,3.300e+02_fp,3.300e+02_fp,3.300e+02_fp,3.300e+02_fp,3.300e+02_fp,3.300e+02_fp, & + 3.300e+02_fp,3.300e+02_fp,3.300e+02_fp,3.300e+02_fp,3.300e+02_fp,3.300e+02_fp,3.300e+02_fp,3.300e+02_fp, & + 3.300e+02_fp,3.300e+02_fp,3.300e+02_fp,3.300e+02_fp,3.300e+02_fp,3.300e+02_fp,3.300e+02_fp,3.300e+02_fp, & + 3.300e+02_fp,3.300e+02_fp,3.300e+02_fp,3.300e+02_fp,3.300e+02_fp,3.300e+02_fp,3.300e+02_fp,3.300e+02_fp, & + 3.300e+02_fp,3.300e+02_fp,3.300e+02_fp,3.300e+02_fp,3.300e+02_fp,3.300e+02_fp,3.300e+02_fp,3.300e+02_fp, & + 3.300e+02_fp,3.300e+02_fp,3.300e+02_fp,3.300e+02_fp /) + END IF + + ! Cloud data + IF ( atm(2)%n_Clouds > 0 ) THEN + k1 = 73 + k2 = 90 + DO nc = 1, atm(2)%n_Clouds + atm(2)%Cloud(nc)%Type = RAIN_CLOUD + atm(2)%Cloud(nc)%Effective_Radius(k1:k2) = 1000.0_fp ! microns + atm(2)%Cloud(nc)%Water_Content(k1:k2) = 5.0_fp ! kg/m^2 + END DO + END IF + + + ! Aerosol data. Three aerosol types can be loaded: + ! Sea Sat SSAM, Sea Salt SSCM1, and Sea Salt SSCM2 + Load_Aerosol_Data_2: IF ( atm(2)%n_Aerosols > 0 ) THEN + + atm(2)%Aerosol(1)%Type = 2 ! SEASALT_SSAM_AEROSOL (CRTM), Soot (CMAQ), Sea salt (GOCART-GEOS5) + atm(2)%Aerosol(1)%Effective_Radius = & ! microns + (/0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, & + 3.500000E-01_fp, 3.500000E-01_fp, 3.500000E-01_fp, 3.500000E-01_fp, 3.500000E-01_fp, & + 3.500000E-01_fp, 3.500000E-01_fp, 3.500000E-01_fp, 3.500000E-01_fp, 3.500000E-01_fp, & + 3.500000E-01_fp, 3.500000E-01_fp, 3.500000E-01_fp, 3.500000E-01_fp, 3.500000E-01_fp, & + 3.500000E-01_fp, 3.500000E-01_fp, 3.500000E-01_fp, 3.500000E-01_fp, 3.500000E-01_fp, & + 3.500000E-01_fp, 3.500000E-01_fp, 3.500000E-01_fp, 3.500000E-01_fp, 3.500000E-01_fp, & + 3.500000E-01_fp, 3.500000E-01_fp, 3.500000E-01_fp, 3.500000E-01_fp, 3.500000E-01_fp, & + 3.500000E-01_fp, 4.172383E-01_fp, 5.083015E-01_fp, 6.111266E-01_fp, 7.244139E-01_fp, & + 8.457720E-01_fp, 9.716019E-01_fp, 1.097090E+00_fp, 1.216347E+00_fp, 1.322729E+00_fp, & + 1.400000E+00_fp, 1.400000E+00_fp, 1.400000E+00_fp, 1.400000E+00_fp, 1.400000E+00_fp, & + 1.370222E+00_fp, 1.261597E+00_fp, 1.129123E+00_fp, 9.811745E-01_fp, 8.268477E-01_fp/) + atm(2)%Aerosol(1)%Concentration = & ! kg/m^2 + (/0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, & + 3.112058E-19_fp, 1.184702E-18_fp, 4.577011E-18_fp, 1.789488E-17_fp, 7.059239E-17_fp, & + 2.801093E-16_fp, 1.114424E-15_fp, 4.430982E-15_fp, 1.754743E-14_fp, 6.897637E-14_fp, & + 2.681926E-13_fp, 1.027837E-12_fp, 3.868968E-12_fp, 1.425352E-11_fp, 5.121245E-11_fp, & + 1.788308E-10_fp, 6.048330E-10_fp, 1.974708E-09_fp, 6.203527E-09_fp, 1.869357E-08_fp, & + 5.387408E-08_fp, 1.480799E-07_fp, 3.871910E-07_fp, 9.608434E-07_fp, 2.258279E-06_fp, & + 5.017946E-06_fp, 1.052599E-05_fp, 2.082121E-05_fp, 3.880948E-05_fp, 6.814300E-05_fp, & + 1.127227E-04_fp, 1.757803E-04_fp, 2.586908E-04_fp, 3.598829E-04_fp, 4.743266E-04_fp, & + 5.939634E-04_fp, 7.091114E-04_fp, 8.104756E-04_fp, 8.911259E-04_fp, 9.478373E-04_fp, & + 9.814733E-04_fp, 9.964914E-04_fp, 9.999501E-04_fp, 9.994838E-04_fp, 9.921395E-04_fp, & + 9.678320E-04_fp, 9.171414E-04_fp, 8.337592E-04_fp, 7.173667E-04_fp, 5.757384E-04_fp/) + IF ( Aerosol_Model== 'CMAQ' ) THEN + atm(2)%Aerosol(1)%Effective_Variance = & ! N/A + (/1.050000E+00_fp, 1.500000E+00_fp, & + 1.100000E+00_fp, 1.100000E+00_fp, 1.100000E+00_fp, 1.100000E+00_fp, 1.100000E+00_fp, & + 1.200000E+00_fp, 1.200000E+00_fp, 1.200000E+00_fp, 1.200000E+00_fp, 1.200000E+00_fp, & + 1.300000E+00_fp, 1.300000E+00_fp, 1.300000E+00_fp, 1.300000E+00_fp, 1.300000E+00_fp, & + 1.400000E+00_fp, 1.400000E+00_fp, 1.400000E+00_fp, 1.400000E+00_fp, 1.400000E+00_fp, & + 1.500000E+00_fp, 1.500000E+00_fp, 1.500000E+00_fp, 1.500000E+00_fp, 1.500000E+00_fp, & + 1.600000E+00_fp, 1.600000E+00_fp, 1.600000E+00_fp, 1.600000E+00_fp, 1.600000E+00_fp, & + 1.700000E+00_fp, 1.700000E+00_fp, 1.700000E+00_fp, 1.700000E+00_fp, 1.700000E+00_fp, & + 1.800000E+00_fp, 1.800000E+00_fp, 1.800000E+00_fp, 1.800000E+00_fp, 1.800000E+00_fp, & + 1.900000E+00_fp, 1.900000E+00_fp, 1.900000E+00_fp, 1.900000E+00_fp, 1.900000E+00_fp, & + 2.000000E+00_fp, 2.000000E+00_fp, 2.000000E+00_fp, 2.000000E+00_fp, 2.000000E+00_fp, & + 2.100000E+00_fp, 2.100000E+00_fp, 2.100000E+00_fp, 2.100000E+00_fp, 2.100000E+00_fp, & + 2.200000E+00_fp, 2.200000E+00_fp, 2.200000E+00_fp, 2.200000E+00_fp, 2.200000E+00_fp, & + 2.300000E+00_fp, 2.300000E+00_fp, 2.300000E+00_fp, 2.300000E+00_fp, 2.300000E+00_fp, & + 2.400000E+00_fp, 2.400000E+00_fp, 2.400000E+00_fp, 2.400000E+00_fp, 2.400000E+00_fp, & + 2.500000E+00_fp, 2.500000E+00_fp, 2.500000E+00_fp, 2.500000E+00_fp, 2.500000E+00_fp, & + 1.200000E+00_fp, 1.200000E+00_fp, 1.200000E+00_fp, 1.200000E+00_fp, 1.200000E+00_fp, & + 1.500000E+00_fp, 1.500000E+00_fp, 1.500000E+00_fp, 1.500000E+00_fp, 1.500000E+00_fp, & + 1.700000E+00_fp, 1.700000E+00_fp, 1.700000E+00_fp, 1.700000E+00_fp, 1.700000E+00_fp/) + END IF + + IF ( atm(2)%n_Aerosols > 1 ) THEN + atm(2)%Aerosol(2)%Type = 3 ! SEASALT_SSCM1_AEROSOL (CRTM), Water soluble (CMAQ), Organic carbon (GOCART-GEOS5) + atm(2)%Aerosol(2)%Effective_Radius = & ! microns + (/0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 1.200000E+00_fp, 1.200000E+00_fp, 1.200000E+00_fp, 1.200000E+00_fp, & + 1.200000E+00_fp, 1.200000E+00_fp, 1.200000E+00_fp, 1.200000E+00_fp, 1.200000E+00_fp, & + 2.035608E+00_fp, 3.433539E+00_fp, 4.500000E+00_fp, 4.500000E+00_fp, 4.500000E+00_fp, & + 4.500000E+00_fp, 4.500000E+00_fp, 4.500000E+00_fp, 4.500000E+00_fp, 4.500000E+00_fp/) + atm(2)%Aerosol(2)%Concentration = & ! kg/m^2 + (/0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 1.718665E-20_fp, 6.364432E-18_fp, 1.294130E-15_fp, 1.453633E-13_fp, & + 9.116027E-12_fp, 3.241673E-10_fp, 6.673036E-09_fp, 8.162075E-08_fp, 6.123529E-07_fp, & + 2.926244E-06_fp, 9.306878E-06_fp, 2.071874E-05_fp, 3.418072E-05_fp, 4.455191E-05_fp, & + 4.926597E-05_fp, 5.000000E-05_fp, 4.924296E-05_fp, 4.412128E-05_fp, 3.247284E-05_fp/) + IF ( Aerosol_Model== 'CMAQ' ) THEN + atm(2)%Aerosol(2)%Effective_Variance = & ! N/A + (/1.050000E+00_fp, 1.500000E+00_fp, & + 1.100000E+00_fp, 1.100000E+00_fp, 1.100000E+00_fp, 1.100000E+00_fp, 1.100000E+00_fp, & + 1.200000E+00_fp, 1.200000E+00_fp, 1.200000E+00_fp, 1.200000E+00_fp, 1.200000E+00_fp, & + 1.300000E+00_fp, 1.300000E+00_fp, 1.300000E+00_fp, 1.300000E+00_fp, 1.300000E+00_fp, & + 1.400000E+00_fp, 1.400000E+00_fp, 1.400000E+00_fp, 1.400000E+00_fp, 1.400000E+00_fp, & + 1.500000E+00_fp, 1.500000E+00_fp, 1.500000E+00_fp, 1.500000E+00_fp, 1.500000E+00_fp, & + 1.600000E+00_fp, 1.600000E+00_fp, 1.600000E+00_fp, 1.600000E+00_fp, 1.600000E+00_fp, & + 1.700000E+00_fp, 1.700000E+00_fp, 1.700000E+00_fp, 1.700000E+00_fp, 1.700000E+00_fp, & + 1.800000E+00_fp, 1.800000E+00_fp, 1.800000E+00_fp, 1.800000E+00_fp, 1.800000E+00_fp, & + 1.900000E+00_fp, 1.900000E+00_fp, 1.900000E+00_fp, 1.900000E+00_fp, 1.900000E+00_fp, & + 2.000000E+00_fp, 2.000000E+00_fp, 2.000000E+00_fp, 2.000000E+00_fp, 2.000000E+00_fp, & + 2.100000E+00_fp, 2.100000E+00_fp, 2.100000E+00_fp, 2.100000E+00_fp, 2.100000E+00_fp, & + 2.200000E+00_fp, 2.200000E+00_fp, 2.200000E+00_fp, 2.200000E+00_fp, 2.200000E+00_fp, & + 2.300000E+00_fp, 2.300000E+00_fp, 2.300000E+00_fp, 2.300000E+00_fp, 2.300000E+00_fp, & + 2.400000E+00_fp, 2.400000E+00_fp, 2.400000E+00_fp, 2.400000E+00_fp, 2.400000E+00_fp, & + 2.500000E+00_fp, 2.500000E+00_fp, 2.500000E+00_fp, 2.500000E+00_fp, 2.500000E+00_fp, & + 1.200000E+00_fp, 1.200000E+00_fp, 1.200000E+00_fp, 1.200000E+00_fp, 1.200000E+00_fp, & + 1.500000E+00_fp, 1.500000E+00_fp, 1.500000E+00_fp, 1.500000E+00_fp, 1.500000E+00_fp, & + 1.700000E+00_fp, 1.700000E+00_fp, 1.700000E+00_fp, 1.700000E+00_fp, 1.700000E+00_fp/) + END IF + END IF + + IF ( atm(2)%n_Aerosols > 2 ) THEN + atm(2)%Aerosol(3)%Type = 4 ! SEASALT_SSCM2_AEROSOL (CRTM), Sulfate (CMAQ), Organic carbon (GOCART-GEOS5) + atm(2)%Aerosol(3)%Effective_Radius = & ! microns + (/0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 3.500000E+00_fp, 3.500000E+00_fp, 3.500000E+00_fp, & + 3.500000E+00_fp, 3.500000E+00_fp, 3.500000E+00_fp, 3.500000E+00_fp, 3.500000E+00_fp, & + 3.500000E+00_fp, 3.500000E+00_fp, 3.500000E+00_fp, 3.500000E+00_fp, 3.500000E+00_fp, & + 3.500000E+00_fp, 3.500000E+00_fp, 3.500000E+00_fp, 3.500000E+00_fp, 3.500000E+00_fp, & + 3.500000E+00_fp, 3.500000E+00_fp, 3.500000E+00_fp, 3.500000E+00_fp, 3.500000E+00_fp, & + 3.500000E+00_fp, 3.500000E+00_fp, 3.500000E+00_fp, 3.500000E+00_fp, 3.500000E+00_fp, & + 3.500000E+00_fp, 3.500000E+00_fp, 3.500000E+00_fp, 3.500000E+00_fp, 3.500000E+00_fp, & + 3.500000E+00_fp, 3.500000E+00_fp, 3.500000E+00_fp, 3.500000E+00_fp, 3.500000E+00_fp, & + 3.500000E+00_fp, 3.500000E+00_fp, 3.500000E+00_fp, 3.500000E+00_fp, 3.500000E+00_fp, & + 3.500000E+00_fp, 3.500000E+00_fp, 3.500000E+00_fp, 3.500000E+00_fp, 3.500000E+00_fp, & + 3.500000E+00_fp, 3.500000E+00_fp, 3.500000E+00_fp, 3.500000E+00_fp, 3.500000E+00_fp, & + 3.500000E+00_fp, 3.500000E+00_fp, 3.500000E+00_fp, 3.500000E+00_fp, 3.500000E+00_fp, & + 3.500000E+00_fp, 3.500000E+00_fp, 3.500000E+00_fp, 3.500000E+00_fp, 3.500000E+00_fp/) + atm(2)%Aerosol(3)%Concentration = & ! kg/m^2 + (/0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, 0.000000E+00_fp, & + 0.000000E+00_fp, 0.000000E+00_fp, 7.258759E-21_fp, 1.408580E-19_fp, 2.671985E-18_fp, & + 4.861044E-17_fp, 8.316902E-16_fp, 1.311926E-14_fp, 1.870485E-13_fp, 2.363806E-12_fp, & + 2.598250E-11_fp, 2.440107E-10_fp, 1.926085E-09_fp, 1.259490E-08_fp, 6.741174E-08_fp, & + 2.926595E-07_fp, 1.024936E-06_fp, 2.891988E-06_fp, 6.598725E-06_fp, 1.228990E-05_fp, & + 1.898153E-05_fp, 2.488012E-05_fp, 2.855754E-05_fp, 2.988952E-05_fp, 2.999200E-05_fp, & + 2.927621E-05_fp, 2.600524E-05_fp, 1.925823E-05_fp, 1.073490E-05_fp, 4.002469E-06_fp, & + 8.719108E-07_fp, 9.516156E-08_fp, 4.374152E-09_fp, 6.968124E-11_fp, 3.094494E-13_fp, & + 3.007755E-16_fp, 1.306643E-19_fp, 8.973748E-18_fp, 6.907477E-16_fp, 3.699227E-14_fp, & + 1.371784E-12_fp, 3.515726E-11_fp, 6.234566E-10_fp, 7.684359E-09_fp, 6.636126E-08_fp, & + 4.063274E-07_fp, 1.792269E-06_fp, 5.811355E-06_fp, 1.419909E-05_fp, 2.692800E-05_fp, & + 4.103532E-05_fp, 5.229739E-05_fp, 5.833714E-05_fp, 5.995863E-05_fp, 5.986513E-05_fp, & + 5.739352E-05_fp, 4.931915E-05_fp, 3.517150E-05_fp, 1.913860E-05_fp, 7.253731E-06_fp, & + 1.735030E-06_fp, 2.355013E-07_fp, 1.618327E-08_fp, 4.982977E-10_fp, 6.034809E-12_fp/) + IF ( Aerosol_Model== 'CMAQ' ) THEN + atm(2)%Aerosol(3)%Effective_Variance = & ! N/A + (/1.050000E+00_fp, 1.500000E+00_fp, & + 1.100000E+00_fp, 1.100000E+00_fp, 1.100000E+00_fp, 1.100000E+00_fp, 1.100000E+00_fp, & + 1.200000E+00_fp, 1.200000E+00_fp, 1.200000E+00_fp, 1.200000E+00_fp, 1.200000E+00_fp, & + 1.300000E+00_fp, 1.300000E+00_fp, 1.300000E+00_fp, 1.300000E+00_fp, 1.300000E+00_fp, & + 1.400000E+00_fp, 1.400000E+00_fp, 1.400000E+00_fp, 1.400000E+00_fp, 1.400000E+00_fp, & + 1.500000E+00_fp, 1.500000E+00_fp, 1.500000E+00_fp, 1.500000E+00_fp, 1.500000E+00_fp, & + 1.600000E+00_fp, 1.600000E+00_fp, 1.600000E+00_fp, 1.600000E+00_fp, 1.600000E+00_fp, & + 1.700000E+00_fp, 1.700000E+00_fp, 1.700000E+00_fp, 1.700000E+00_fp, 1.700000E+00_fp, & + 1.800000E+00_fp, 1.800000E+00_fp, 1.800000E+00_fp, 1.800000E+00_fp, 1.800000E+00_fp, & + 1.900000E+00_fp, 1.900000E+00_fp, 1.900000E+00_fp, 1.900000E+00_fp, 1.900000E+00_fp, & + 2.000000E+00_fp, 2.000000E+00_fp, 2.000000E+00_fp, 2.000000E+00_fp, 2.000000E+00_fp, & + 2.100000E+00_fp, 2.100000E+00_fp, 2.100000E+00_fp, 2.100000E+00_fp, 2.100000E+00_fp, & + 2.200000E+00_fp, 2.200000E+00_fp, 2.200000E+00_fp, 2.200000E+00_fp, 2.200000E+00_fp, & + 2.300000E+00_fp, 2.300000E+00_fp, 2.300000E+00_fp, 2.300000E+00_fp, 2.300000E+00_fp, & + 2.400000E+00_fp, 2.400000E+00_fp, 2.400000E+00_fp, 2.400000E+00_fp, 2.400000E+00_fp, & + 2.500000E+00_fp, 2.500000E+00_fp, 2.500000E+00_fp, 2.500000E+00_fp, 2.500000E+00_fp, & + 1.200000E+00_fp, 1.200000E+00_fp, 1.200000E+00_fp, 1.200000E+00_fp, 1.200000E+00_fp, & + 1.500000E+00_fp, 1.500000E+00_fp, 1.500000E+00_fp, 1.500000E+00_fp, 1.500000E+00_fp, & + 1.700000E+00_fp, 1.700000E+00_fp, 1.700000E+00_fp, 1.700000E+00_fp, 1.700000E+00_fp/) + END IF + END IF + END IF Load_Aerosol_Data_2 + + END SUBROUTINE Load_Atm_Data + + + ! + ! Internal subprogam to load some test surface data + ! + SUBROUTINE Load_Sfc_Data() + + + ! 4a.0 Surface type definitions for default SfcOptics definitions + ! For IR and VIS, this is the NPOESS reflectivities. + ! --------------------------------------------------------------- + INTEGER, PARAMETER :: TUNDRA_SURFACE_TYPE = 10 ! NPOESS Land surface type for IR/VIS Land SfcOptics + INTEGER, PARAMETER :: SCRUB_SURFACE_TYPE = 7 ! NPOESS Land surface type for IR/VIS Land SfcOptics + INTEGER, PARAMETER :: COARSE_SOIL_TYPE = 1 ! Soil type for MW land SfcOptics + INTEGER, PARAMETER :: GROUNDCOVER_VEGETATION_TYPE = 7 ! Vegetation type for MW Land SfcOptics + INTEGER, PARAMETER :: BARE_SOIL_VEGETATION_TYPE = 11 ! Vegetation type for MW Land SfcOptics + INTEGER, PARAMETER :: SEA_WATER_TYPE = 1 ! Water type for all SfcOptics + INTEGER, PARAMETER :: FRESH_SNOW_TYPE = 2 ! NPOESS Snow type for IR/VIS SfcOptics + INTEGER, PARAMETER :: FRESH_ICE_TYPE = 1 ! NPOESS Ice type for IR/VIS SfcOptics + + + + ! 4a.1 Profile #1 + ! --------------- + ! ...Land surface characteristics + sfc(1)%Land_Coverage = 0.1_fp + sfc(1)%Land_Type = TUNDRA_SURFACE_TYPE + sfc(1)%Land_Temperature = 272.0_fp + sfc(1)%Lai = 0.17_fp + sfc(1)%Soil_Type = COARSE_SOIL_TYPE + sfc(1)%Vegetation_Type = GROUNDCOVER_VEGETATION_TYPE + ! ...Water surface characteristics + sfc(1)%Water_Coverage = 0.5_fp + sfc(1)%Water_Type = SEA_WATER_TYPE + sfc(1)%Water_Temperature = 275.0_fp + ! ...Snow coverage characteristics + sfc(1)%Snow_Coverage = 0.25_fp + sfc(1)%Snow_Type = FRESH_SNOW_TYPE + sfc(1)%Snow_Temperature = 265.0_fp + ! ...Ice surface characteristics + sfc(1)%Ice_Coverage = 0.15_fp + sfc(1)%Ice_Type = FRESH_ICE_TYPE + sfc(1)%Ice_Temperature = 269.0_fp + + + + ! 4a.2 Profile #2 + ! --------------- + ! Surface data + sfc(2)%Land_Coverage = 1.0_fp + sfc(2)%Land_Type = SCRUB_SURFACE_TYPE + sfc(2)%Land_Temperature = 318.0_fp + sfc(2)%Lai = 0.65_fp + sfc(2)%Soil_Type = COARSE_SOIL_TYPE + sfc(2)%Vegetation_Type = BARE_SOIL_VEGETATION_TYPE + + END SUBROUTINE Load_Sfc_Data + + + ! + ! Internal subprogam to create a signal file + ! + SUBROUTINE SignalFile_Create() + CHARACTER(256) :: Filename + INTEGER :: fid + Filename = '.signal' + fid = Get_Lun() + OPEN( fid, FILE = Filename ) + WRITE( fid,* ) TRIM(Filename) + CLOSE( fid ) + END SUBROUTINE SignalFile_Create + +END PROGRAM check_crtm diff --git a/util/checkendian/Makefile b/util/checkendian/Makefile deleted file mode 100644 index 3652135..0000000 --- a/util/checkendian/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -CC = gcc -CFLAGS = -g -O1 -COBJS = main.o - -all: endian - -endian: $(COBJS) - $(CC) -o $@ $^ $(LDFLAGS) - -clean: - $(RM) $(COBJS) endian diff --git a/util/checkendian/main.c b/util/checkendian/main.c deleted file mode 100644 index e04cfd3..0000000 --- a/util/checkendian/main.c +++ /dev/null @@ -1,247 +0,0 @@ -/* -** Purpose: Determine 1) Is this a Fortran sequential binary file? -** 2) What is the endianness and RCW size? -** Usage: $0 input_file -*/ - -#include /* lseek */ -#include /* open */ -#include /* open */ -#include /* lseek, read */ -#include -#include /* uint32_t, uint64_t */ - -extern int IsLittleEndian (void); -extern void printresults (int); - -int main (int argc, char **argv) -{ - char *fn; // input file name - int fd; // file descriptor - extern int check32 (int, char *, int); - extern int check64 (int, char *, int); - - if (argc != 2) { - printf ("Usage: %s input_file\n", argv[0]); - return -1; - } - - fn = argv[1]; - if ((fd = open (fn, O_RDONLY)) == -1) { - printf ("Failed to open %s for reading\n", fn); - return -1; - } - - /* - ** Check combinations of 32- and 64-bit RCW, native endian and byte-swapped - */ - if (check32 (fd, fn, 0) < 0) { - if (check32 (fd, fn, 1) < 0) { - if (check64 (fd, fn, 0) < 0) { - if (check64 (fd, fn, 1) < 0) { - printf ("All tests failed: %s is probably not a Fortran sequential binary file\n", fn); - return -1; - } - } - } - } - return 0; -} - -/* -** check32: See if the 1st record of fn is Fortran sequential binary with 4-byte RCW -** -** Input args -** fd: file descriptor -** swap_bytes: whether to swap bytes or not -** -** Return value: 0 on success (4-byte RCW found at start and end of record) -** -1 on failure -*/ -int check32 (int fd, char *fn, int swap_bytes) -{ - uint32_t rcw[2]; // beginning and ending 4-byte RCW - extern void bswap4 (uint32_t *); - - /* Should always be able to seek to beginning of file */ - if (lseek (fd, (off_t) 0, SEEK_SET) < 0) - return -1; - - if (read (fd, &rcw[0], 4) != 4) { - return -1; - } - - if (swap_bytes) - bswap4 (&rcw[0]); - - if (lseek (fd, (off_t) (rcw[0]+4), SEEK_SET) < 0) { - /* Reposition failed: either swapping is wrong or rcw size is wrong */ - return -1; - } - - /* Now check that a ending rcw matching beginning rcw is found */ - if (read (fd, &rcw[1], 4) != 4) { - return -1; - } - - if (swap_bytes) - bswap4 (&rcw[1]); - - if (rcw[0] == rcw[1]) { - printf ("%s is likely a Fortran sequential binary file.\n", fn); - printf ("It has 4-byte record-control words. The first record is %d bytes long\n", rcw[0]); - printresults (swap_bytes); - return 0; - } else { - /* Ending rcw to match starting rcw not found */ - return -1; - } -} - -/* -** check64: See if the 1st record of fn is Fortran sequential binary with 8-byte RCW -** -** Input args -** fd: file descriptor -** swap_bytes: whether to swap bytes or not -** -** Return value: 0 on success (8-byte RCW found at start and end of record) -** -1 on failure -*/ -int check64 (int fd, char *fn, int swap_bytes) -{ - uint64_t rcw[2]; // beginning and ending 8-byte RCW - extern void bswap8 (uint64_t *); - - /* Should always be able to seek to beginning of file */ - if (lseek (fd, (off_t) 0, SEEK_SET) < 0) - return -1; - - if (read (fd, &rcw[0], 8) != 8) { - return -1; - } - - if (swap_bytes) - bswap8 (&rcw[0]); - - if (lseek (fd, (off_t) (rcw[0]+8), SEEK_SET) < 0) { - /* Reposition failed: either swapping is wrong or rcw size is wrong */ - return -1; - } - - /* Now check that a ending rcw matching beginning rcw is found */ - if (read (fd, &rcw[1], 8) != 8) { - return -1; - } - - if (swap_bytes) - bswap8 (&rcw[1]); - - if (rcw[0] == rcw[1]) { - printf ("%s is likely a Fortran sequential binary file.\n", fn); - printf ("It has 8-byte record-control words. The first record is %d bytes long\n", rcw[0]); - printresults (swap_bytes); - return 0; - } else { - /* Ending rcw to match starting rcw not found */ - return -1; - } -} - -/* -** bswap4: swap the bytes of a 4-byte RCW -*/ -void bswap4 (uint32_t *rcw) -{ - typedef union { - uint32_t intvar; - struct bytes { - unsigned char c1; - unsigned char c2; - unsigned char c3; - unsigned char c4; - } both; - } intbytes; - - intbytes v1, v2; - - /* copy the input */ - v1.intvar = *rcw; - - /* swap the bytes */ - v2.both.c1 = v1.both.c4; - v2.both.c2 = v1.both.c3; - v2.both.c3 = v1.both.c2; - v2.both.c4 = v1.both.c1; - - /* copy the output */ - *rcw = v2.intvar; -} - -/* -** bswap8: swap the bytes of an 8-byte RCW -*/ -void bswap8 (uint64_t *rcw) -{ - typedef union { - uint64_t intvar; - struct bytes { - unsigned char c1; - unsigned char c2; - unsigned char c3; - unsigned char c4; - unsigned char c5; - unsigned char c6; - unsigned char c7; - unsigned char c8; - } both; - } intbytes; - - intbytes v1, v2; - - /* copy the input */ - v1.intvar = *rcw; - - /* swap the bytes */ - v2.both.c1 = v1.both.c8; - v2.both.c2 = v1.both.c7; - v2.both.c3 = v1.both.c6; - v2.both.c4 = v1.both.c5; - v2.both.c5 = v1.both.c4; - v2.both.c6 = v1.both.c3; - v2.both.c7 = v1.both.c2; - v2.both.c8 = v1.both.c1; - - /* copy the output */ - *rcw = v2.intvar; -} - -/* -** IsLittleEndian: Determine if this is a little endian machine or not -*/ -int IsLittleEndian () -{ - int i = 1; - - return (int)*((unsigned char *)&i) == 1; -} - -/* -** printresults: print results of testing input file. -*/ -void printresults (int swap_bytes) -{ - if (swap_bytes) { - if (IsLittleEndian ()) { - printf ("Endianness is BIG: Differs from native so special compiler flags ARE required\n"); - } else { - printf ("Endianness is LITTLE: Differs from native so special compiler flags ARE required\n"); - } - } else { - if (IsLittleEndian ()) { - printf ("Endianness is LITTLE: Matches native so no special compiler flags required.\n"); - } else { - printf ("Endianness is BIG: Matches native so no special compiler flags required.\n"); - } - } -}