diff --git a/CHANGELOG.md b/CHANGELOG.md index a19c0363..3e79e671 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,23 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased 3.7.1] - TBD +### Changed +- Updated version numbers to 3.7.1 +- Make Hg0 emission factors in `hcox_gfed_include_gfed4.H` multipliers of the CO emission factor +- Removed superfluous routine `GetExtSpcVal_Dr` in `src/Core/hco_extlist_mod.F90` +- NetCDF routines in `src/Shared/NcdfUtil` now use the Fortran-90 API +- Overhauled vertical regridding `src/Core/hco_interp_mod.F90` + - Removed `INFLATE` (but retained its behavior only for 47L -> 72L vertical regridding, warning users that this isn't recommended) + - `ModelLev_Interpolate` is only called when the input is 47/48, 72/73, or 102/103 levels (otherwise, MESSy is used). + - A bug that averaged the wrong number of levels in `COLLAPSE` is fixed (and edges are now sampled instead of averaged). + - Removed the now superfluous `NC_ISMODELLEVEL` and `NC_SISIGMALEVEL` from `src/Shared/NcdfUtil/hco_ncdf_mod.F90` + - Removed old code and references to `GEOS-4`. + +### Fixed +- Fixed incorrect `XMIN`, `XMAX` values in `HEMCO_sa_Grid.025x03125.rc` and `HEMCO_sa_Grid.05x0625.rc` +- Fixed line length too long for the `GC_72_EDGE_SIGMA` variable in `src/Core/hcoio_read_std_mod.F90` + ## [3.7.0] - 2023-10-05 ### Added - HEMCO extensions now display a first-time message, whether `Verbose` is `true` or `false`. diff --git a/CMakeLists.txt b/CMakeLists.txt index 77196450..ea235e01 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ # HEMCO/CMakeLists.txt cmake_minimum_required(VERSION 3.5) -project(HEMCO VERSION 3.7.0 LANGUAGES Fortran) +project(HEMCO VERSION 3.7.1 LANGUAGES Fortran) # Reminder: Make sure to also update version in src/Core/hco_error_mod.F90 #----------------------------------------------------------------------------- diff --git a/docs/source/conf.py b/docs/source/conf.py index 15755236..325803c6 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -23,7 +23,7 @@ author = 'GEOS-Chem Support Team' # The full version, including alpha/beta/rc tags -release = '3.7.0' +release = '3.7.1' # -- General configuration --------------------------------------------------- diff --git a/docs/source/geos-chem-shared-docs b/docs/source/geos-chem-shared-docs index dcf759b9..e23eb23d 160000 --- a/docs/source/geos-chem-shared-docs +++ b/docs/source/geos-chem-shared-docs @@ -1 +1 @@ -Subproject commit dcf759b94de42d56ed98d28b092f864002c7d757 +Subproject commit e23eb23dcc5cd2922e62a356e2f59634817bdd95 diff --git a/docs/source/hco-ref-guide/hemco-config.rst b/docs/source/hco-ref-guide/hemco-config.rst index 0615a754..6bcc4186 100644 --- a/docs/source/hco-ref-guide/hemco-config.rst +++ b/docs/source/hco-ref-guide/hemco-config.rst @@ -35,7 +35,21 @@ comment lines: ### BEGIN SECTION SETTINGS ############################################################################### - settings go here + ROOT: /path/to/hemco/data/dir + METDIR: /path/to/hemco/met/dir + GCAPSCENARIO: not_used + GCAPVERTRES: 47 + Logfile: * + DiagnFile: HEMCO_Diagn.rc + DiagnPrefix: ./OutputDir/HEMCO_diagnostics + DiagnFreq: 00000000 010000 + Wildcard: * + Separator: / + Unit tolerance: 1 + Negative values: 0 + Only unitless scale factors: false + Verbose: false + VerboseOnCores: root # Accepted values: root all ### END SECTION SETTINGS ### @@ -60,6 +74,18 @@ These settings control HEMCO simulation options. Root folder of meteorology data files that are needed for HEMCO extensions. Usually this is a subdirectory of :option:`ROOT`. +.. option:: GCAPSCENARIO: + + Specifies the future scenario when using GCAP meteorology. + + Default value: :literal:`not used` + +.. option:: GCAPVERTRES + + Specifies the number of vertical levels for GCAP meteorology. + + Default value: :literal:`47` + .. option:: MODEL If present, the :literal:`$MODEL` token will be set to the @@ -118,20 +144,20 @@ These settings control HEMCO simulation options. .. option:: Verbose - Integer value that controls the amount of additional information - printed to the HEMCO log file. Allowable values are :literal:`0` - (no additional output) to :literal:`3` (lots of additional output). - Setting :literal:`3` is useful for debugging. + Activates (:literal:`true`) or deactivates (:literal:`false`) + additional printout for debugging purposes. - **Default setting**: :literal:`0`. + **Default setting**: :literal:`false` -.. option:: Warnings +.. option:: VerboseOnCores - Integer value that controls the amount of warnings printed - to the HEMCO log file. Allowable values are :literal:`0` (no - warnings) to :literal:`3` (all warnings). + Specifies whether :option:`Verbose` printout will be restricted to + the :literal:`root` core, or will be printed on :literal:`all` + cores. This facilitates running HEMCO in Earth System Models, + where the additional overhead of printing verbose output on every + core could negatively impact performance. - **Default setting**: :literal:`1` (only severe warnings). + **Default setting:** :literal:`root` .. option:: Wildcard diff --git a/docs/source/hco-sa-guide/login-env.rst b/docs/source/hco-sa-guide/login-env.rst index 35ce3fb1..4fdfd64f 100644 --- a/docs/source/hco-sa-guide/login-env.rst +++ b/docs/source/hco-sa-guide/login-env.rst @@ -48,60 +48,72 @@ cluster. This file will load software libraries built with the GNU 10.2.0 compilers. Save the code below (with any appropriate modifications for your own -computer system) to a file named :file:`~/gnu102.env`. +computer system) to a file named :file:`~/gnu10.env`. .. code-block:: bash - # Echo message if we are in a interactive (terminal) session - if [[ $- = *i* ]] ; then - echo "Loading modules for GEOS-Chem, please wait ..." - fi - #============================================================================== - # Modules (specific to Cannon @ Harvard) + # Load software packages (EDIT AS NEEDED) #============================================================================== - # Remove previously-loaded modules + # Unload all modules first module purge - # Load modules for GNU Compilers v10.2.0 - module load git/2.17.0-fasrc01 - module load gcc/10.2.0-fasrc01 - module load openmpi/4.1.0-fasrc01 - module load netcdf-fortran/4.5.3-fasrc03 - module load flex/2.6.4-fasrc01 - module load cmake/3.17.3-fasrc01 + # Load modules + module load gcc/10.2.0-fasrc01 # gcc / g++ / gfortran + module load openmpi/4.1.0-fasrc01 # MPI + module load netcdf-c/4.8.0-fasrc01 # netcdf-c + module load netcdf-fortran/4.5.3-fasrc01 # netcdf-fortran + module load flex/2.6.4-fasrc01 # Flex lexer (needed for KPP) + module load cmake/3.25.2-fasrc01 # CMake (needed to compile) #============================================================================== - # Environment variables + # Environment variables and related settings + # (NOTE: Lmod will define _HOME variables for each loaded module #============================================================================== - # Parallelization settings - export OMP_NUM_THREADS=8 - export OMP_STACKSIZE=500m - # Make all files world-readable by default umask 022 - # Specify compilers - export CC=gcc - export CXX=g++ - export FC=gfortran - - # Netcdf variables for CMake - # NETCDF_HOME and NETCDF_FORTRAN_HOME are automatically - # defined by the "module load" commands on Cannon. - export NETCDF_C_ROOT=${NETCDF_HOME} - export NETCDF_FORTRAN_ROOT=${NETCDF_FORTRAN_HOME} - - # Set memory limits to max allowable - ulimit -c unlimited # coredumpsize - ulimit -l unlimited # memorylocked - ulimit -u 50000 # maxproc - ulimit -v unlimited # vmemoryuse - ulimit -s unlimited # stacksize - - # List modules loaded + # Set number of threads for OpenMP. If running in a SLURM environment, + # use the number of requested cores. Otherwise use 8 cores for OpenMP. + if [[ "x${SLURM_CPUS_PER_TASK}" == "x" ]]; then + export OMP_NUM_THREADS=8 + else + export OMP_NUM_THREADS="${SLURM_CPUS_PER_TASK}" + fi + + # Max out the stacksize memory limit + export OMP_STACKSIZE="500m" + + # Compilers + export CC="gcc" + export CXX="g++" + export FC="gfortran" + export F77="${FC}" + + # netCDF + if [[ "x${NETCDF_HOME}" == "x" ]]; then + export NETCDF_HOME="${NETCDF_C_HOME}" + fi + export NETCDF_C_ROOT="${NETCDF_HOME}" + export NETCDF_FORTRAN_ROOT="${NETCDF_FORTRAN_HOME}" + + # KPP 3.0.0+ + export KPP_FLEX_LIB_DIR="${FLEX_HOME}/lib64" + + #============================================================================== + # Set limits + #============================================================================== + + ulimit -c unlimited # coredumpsize + ulimit -u 50000 # maxproc + ulimit -v unlimited # vmemoryuse + ulimit -s unlimited # stacksize + + #============================================================================== + # Print information + #============================================================================== module list .. tip:: @@ -115,73 +127,85 @@ Then you can activate these seetings from the command line by typing: .. code-block:: console - $ source ~/gnu102.env + $ source ~/gnu10.env .. _hco-sa-login-intel: -============================================== -Sample environment file for Intel 19 compilers -============================================== +================================================ +Sample environment file for Intel 2023 compilers +================================================ -To load software libraries based on the Intel 19 compilers, we can -start from our :ref:`GNU 10.2.0 environment file ` -and add the proper :command:`module load` commands for Intel 19. +Below is a sample environment file from the Harvard Cannon computer +cluster. This file will load software libraries built with the Intel +2023 compilers. Add the code below (with the appropriate modifications for your -system) into a file named :file:`~/intel19.env`. +system) into a file named :file:`~/intel23.env`. .. code-block:: bash - # Echo message if we are in a interactive (terminal) session - if [[ $- = *i* ]] ; then - echo "Loading modules for GEOS-Chem, please wait ..." - fi - #============================================================================== - # Modules (specific to Cannon @ Harvard) + # Load software packages (EDIT AS NEEDED) #============================================================================== - # Remove previously-loaded modules + # Unload all modules first module purge - # Load modules for Intel compilers v19.0.4 - module load git/2.17.0-fasrc01 - module load intel/19.0.5-fasrc01 - module load openmpi/4.0.1-fasrc01 - module load netcdf-fortran/4.5.2-fasrc03 - module load flex/2.6.4-fasrc01 - module load cmake/3.17.3-fasrc01 + # Load modules + module load intel/23.0.0-fasrc01 # icc / i++ / gfortran + module load intelmpi/2021.8.0-fasrc01 # MPI + module load netcdf-fortran/4.6.0-fasrc03 # netCDF-Fortran + module load flex/2.6.4-fasrc01 # Flex lexer (needed for KPP) + module load cmake/3.25.2-fasrc01 # CMake (needed to compile) #============================================================================== - # Environment variables + # Environment variables and related settings + # (NOTE: Lmod will define _HOME variables for each loaded module #============================================================================== - # Parallelization settings - export OMP_NUM_THREADS=8 - export OMP_STACKSIZE=500m - # Make all files world-readable by default umask 022 - # Specify compilers - export CC=icc - export CXX=icpc - export FC=ifort - - # Netcdf variables for CMake - # NETCDF_HOME and NETCDF_FORTRAN_HOME are automatically - # defined by the "module load" commands on Cannon. - export NETCDF_C_ROOT=${NETCDF_HOME} - export NETCDF_FORTRAN_ROOT=${NETCDF_FORTRAN_HOME} - - # Set memory limits to max allowable - ulimit -c unlimited # coredumpsize - ulimit -l unlimited # memorylocked - ulimit -u 50000 # maxproc - ulimit -v unlimited # vmemoryuse - ulimit -s unlimited # stacksize - - # List modules loaded + # Set number of threads for OpenMP. If running in a SLURM environment, + # use the number of requested cores. Otherwise use 8 cores for OpenMP. + if [[ "x${SLURM_CPUS_PER_TASK}" == "x" ]]; then + export OMP_NUM_THREADS=8 + else + export OMP_NUM_THREADS="${SLURM_CPUS_PER_TASK}" + fi + + # Max out the stacksize memory limit + export OMP_STACKSIZE="500m" + + # Compilers + export CC="icx" + export CXX="icx" + export FC="ifort" + export F77="${FC}" + + # netCDF + if [[ "x${NETCDF_HOME}" == "x" ]]; then + export NETCDF_HOME="${NETCDF_C_HOME}" + fi + export NETCDF_C_ROOT="${NETCDF_HOME}" + export NETCDF_FORTRAN_ROOT="${NETCDF_FORTRAN_HOME}" + + # KPP 3.0.0+ + export KPP_FLEX_LIB_DIR="${FLEX_HOME}/lib64" + + #============================================================================== + # Set limits + #============================================================================== + + ulimit -c unlimited # coredumpsize + ulimit -u 50000 # maxproc + ulimit -v unlimited # vmemoryuse + ulimit -s unlimited # stacksize + + #============================================================================== + # Print information + #============================================================================== + module list .. tip:: @@ -195,7 +219,7 @@ Then you can activate these seetings from the command line by typing: .. code-block:: console - $ source intel19.env + $ source intel23.env .. tip:: @@ -217,9 +241,9 @@ specify the compilers that you wish to use: +---------------+------------------+--------------------+-----------------+ | Variable | Specifies the: | GNU name | Intel name | +===============+==================+====================+=================+ - | :envvar:`CC` | C compiler | :envvar:`gcc` | :envvar:`icc` | + | :envvar:`CC` | C compiler | :envvar:`gcc` | :envvar:`icx` | +---------------+------------------+--------------------+-----------------+ - | :envvar:`CXX` | C++ compiler | :envvar:`g++` | :envvar:`icpc` | + | :envvar:`CXX` | C++ compiler | :envvar:`g++` | :envvar:`icx` | +---------------+------------------+--------------------+-----------------+ | :envvar:`FC` | Fortran compiler | :envvar:`gfortran` | :envvar:`ifort` | +---------------+------------------+--------------------+-----------------+ @@ -229,10 +253,15 @@ These environment variables should be defined in your .. note:: - Only the Fortran compiler is needed to compile the HEMCO - standalone. But if you need to :ref:`manually install libraries - `, you will also need the C and C++ - compilers. + HEMCOc only requires the Fortran compiler. But you will + also need the C and C++ compilers if you plan to build other + software packages (:ref:`such as KPP `) or :ref:`install + libraries manually `. + + Also, older Intel compiler versions used :envvar:`icc` as the name + for the C compiler and :envvar:`icpc` as the name of the C++ compiler. + These names have been deprecated in Intel 2023 and will be removed + from future Intel compiler releases. .. _hco-sa-envvar-parallel: @@ -269,7 +298,7 @@ control the OpenMP parallelization settings: .. option:: OMP_STACKSIZE - In order to use HEMCO standalone with `OpenMP + In order to use HEMCO standalone with `OpenMP parallelization `_, you must request the maximum amount of stack memory in your login environment. (The stack memory is where local automatic variables and temporary diff --git a/docs/source/hco-sa-guide/software.rst b/docs/source/hco-sa-guide/software.rst index f241be79..4bb876f8 100644 --- a/docs/source/hco-sa-guide/software.rst +++ b/docs/source/hco-sa-guide/software.rst @@ -50,6 +50,7 @@ these compilers. The GCST has tested :program:`HEMCO` with these versions (but others may work as well): +- 23.0.0 - 19.0.5.281 - 19.0.4 - 18.0.5 @@ -58,14 +59,11 @@ may work as well): - 13.0.079 - 11.1.069 -**Best way to install:** `Direct from Intel +**Best way to install:** With :ref:`Spack ` (Intel 2021 +and later); `Directly +from Intel `_ -(may require purchase of a site license or a student license) - -.. tip:: - - Intel 2021 may be obtained for free, or installed with a - package manager such as :ref:`Spack `. +(older versions). .. _hco-sa-soft-gnu: @@ -81,6 +79,7 @@ are running HEMCO standalone on the Amazon EC2 cloud environment. The GCST has tested HEMCO standalone with these versions (but others may work as well): +- 12.2.0 - 11.2.0 - 11.1.0 - 10.2.0 @@ -170,7 +169,7 @@ horizontal plots from HEMCO output. It also contains scripts to generate plots and tables from HEMCO benchmark simulations. **Best way to install:** -`With Conda (see gcpy.readthedocs.io) `__ +`With Mamba or Conda (see gcpy.readthedocs.io) `__ .. _hco-sa-soft-gdb: diff --git a/run/HEMCO_sa_Grid.025x03125.rc b/run/HEMCO_sa_Grid.025x03125.rc index 4da8a0c2..612e5fbe 100644 --- a/run/HEMCO_sa_Grid.025x03125.rc +++ b/run/HEMCO_sa_Grid.025x03125.rc @@ -1,10 +1,10 @@ # Emission grid specifications: -XMIN: -180.125 -XMAX: 179.875 -YMIN: -90.0 -YMAX: 90.0 -NX: 1152 -NY: 721 -NZ: 47 +XMIN: -180.15625 # Westernmost longitude edge +XMAX: 179.84375 # Easternmost longitude edge +YMIN: -90.0 # Southernmost latitude edge +YMAX: 90.0 # Northernmost latititude edge +NX: 1152 # Number of longitudes in grid +NY: 721 # Number of latitudes in grid +NZ: 47 # Number of levels in grid YEDGE: -90.000 -89.875 -89.625 -89.375 -89.125 -88.875 -88.625 -88.375 -88.125 -87.875 -87.625 -87.375 -87.125 -86.875 -86.625 -86.375 -86.125 -85.875 -85.625 -85.375 -85.125 -84.875 -84.625 -84.375 -84.125 -83.875 -83.625 -83.375 -83.125 -82.875 -82.625 -82.375 -82.125 -81.875 -81.625 -81.375 -81.125 -80.875 -80.625 -80.375 -80.125 -79.875 -79.625 -79.375 -79.125 -78.875 -78.625 -78.375 -78.125 -77.875 -77.625 -77.375 -77.125 -76.875 -76.625 -76.375 -76.125 -75.875 -75.625 -75.375 -75.125 -74.875 -74.625 -74.375 -74.125 -73.875 -73.625 -73.375 -73.125 -72.875 -72.625 -72.375 -72.125 -71.875 -71.625 -71.375 -71.125 -70.875 -70.625 -70.375 -70.125 -69.875 -69.625 -69.375 -69.125 -68.875 -68.625 -68.375 -68.125 -67.875 -67.625 -67.375 -67.125 -66.875 -66.625 -66.375 -66.125 -65.875 -65.625 -65.375 -65.125 -64.875 -64.625 -64.375 -64.125 -63.875 -63.625 -63.375 -63.125 -62.875 -62.625 -62.375 -62.125 -61.875 -61.625 -61.375 -61.125 -60.875 -60.625 -60.375 -60.125 -59.875 -59.625 -59.375 -59.125 -58.875 -58.625 -58.375 -58.125 -57.875 -57.625 -57.375 -57.125 -56.875 -56.625 -56.375 -56.125 -55.875 -55.625 -55.375 -55.125 -54.875 -54.625 -54.375 -54.125 -53.875 -53.625 -53.375 -53.125 -52.875 -52.625 -52.375 -52.125 -51.875 -51.625 -51.375 -51.125 -50.875 -50.625 -50.375 -50.125 -49.875 -49.625 -49.375 -49.125 -48.875 -48.625 -48.375 -48.125 -47.875 -47.625 -47.375 -47.125 -46.875 -46.625 -46.375 -46.125 -45.875 -45.625 -45.375 -45.125 -44.875 -44.625 -44.375 -44.125 -43.875 -43.625 -43.375 -43.125 -42.875 -42.625 -42.375 -42.125 -41.875 -41.625 -41.375 -41.125 -40.875 -40.625 -40.375 -40.125 -39.875 -39.625 -39.375 -39.125 -38.875 -38.625 -38.375 -38.125 -37.875 -37.625 -37.375 -37.125 -36.875 -36.625 -36.375 -36.125 -35.875 -35.625 -35.375 -35.125 -34.875 -34.625 -34.375 -34.125 -33.875 -33.625 -33.375 -33.125 -32.875 -32.625 -32.375 -32.125 -31.875 -31.625 -31.375 -31.125 -30.875 -30.625 -30.375 -30.125 -29.875 -29.625 -29.375 -29.125 -28.875 -28.625 -28.375 -28.125 -27.875 -27.625 -27.375 -27.125 -26.875 -26.625 -26.375 -26.125 -25.875 -25.625 -25.375 -25.125 -24.875 -24.625 -24.375 -24.125 -23.875 -23.625 -23.375 -23.125 -22.875 -22.625 -22.375 -22.125 -21.875 -21.625 -21.375 -21.125 -20.875 -20.625 -20.375 -20.125 -19.875 -19.625 -19.375 -19.125 -18.875 -18.625 -18.375 -18.125 -17.875 -17.625 -17.375 -17.125 -16.875 -16.625 -16.375 -16.125 -15.875 -15.625 -15.375 -15.125 -14.875 -14.625 -14.375 -14.125 -13.875 -13.625 -13.375 -13.125 -12.875 -12.625 -12.375 -12.125 -11.875 -11.625 -11.375 -11.125 -10.875 -10.625 -10.375 -10.125 -9.875 -9.625 -9.375 -9.125 -8.875 -8.625 -8.375 -8.125 -7.875 -7.625 -7.375 -7.125 -6.875 -6.625 -6.375 -6.125 -5.875 -5.625 -5.375 -5.125 -4.875 -4.625 -4.375 -4.125 -3.875 -3.625 -3.375 -3.125 -2.875 -2.625 -2.375 -2.125 -1.875 -1.625 -1.375 -1.125 -0.875 -0.625 -0.375 -0.125 0.125 0.375 0.625 0.875 1.125 1.375 1.625 1.875 2.125 2.375 2.625 2.875 3.125 3.375 3.625 3.875 4.125 4.375 4.625 4.875 5.125 5.375 5.625 5.875 6.125 6.375 6.625 6.875 7.125 7.375 7.625 7.875 8.125 8.375 8.625 8.875 9.125 9.375 9.625 9.875 10.125 10.375 10.625 10.875 11.125 11.375 11.625 11.875 12.125 12.375 12.625 12.875 13.125 13.375 13.625 13.875 14.125 14.375 14.625 14.875 15.125 15.375 15.625 15.875 16.125 16.375 16.625 16.875 17.125 17.375 17.625 17.875 18.125 18.375 18.625 18.875 19.125 19.375 19.625 19.875 20.125 20.375 20.625 20.875 21.125 21.375 21.625 21.875 22.125 22.375 22.625 22.875 23.125 23.375 23.625 23.875 24.125 24.375 24.625 24.875 25.125 25.375 25.625 25.875 26.125 26.375 26.625 26.875 27.125 27.375 27.625 27.875 28.125 28.375 28.625 28.875 29.125 29.375 29.625 29.875 30.125 30.375 30.625 30.875 31.125 31.375 31.625 31.875 32.125 32.375 32.625 32.875 33.125 33.375 33.625 33.875 34.125 34.375 34.625 34.875 35.125 35.375 35.625 35.875 36.125 36.375 36.625 36.875 37.125 37.375 37.625 37.875 38.125 38.375 38.625 38.875 39.125 39.375 39.625 39.875 40.125 40.375 40.625 40.875 41.125 41.375 41.625 41.875 42.125 42.375 42.625 42.875 43.125 43.375 43.625 43.875 44.125 44.375 44.625 44.875 45.125 45.375 45.625 45.875 46.125 46.375 46.625 46.875 47.125 47.375 47.625 47.875 48.125 48.375 48.625 48.875 49.125 49.375 49.625 49.875 50.125 50.375 50.625 50.875 51.125 51.375 51.625 51.875 52.125 52.375 52.625 52.875 53.125 53.375 53.625 53.875 54.125 54.375 54.625 54.875 55.125 55.375 55.625 55.875 56.125 56.375 56.625 56.875 57.125 57.375 57.625 57.875 58.125 58.375 58.625 58.875 59.125 59.375 59.625 59.875 60.125 60.375 60.625 60.875 61.125 61.375 61.625 61.875 62.125 62.375 62.625 62.875 63.125 63.375 63.625 63.875 64.125 64.375 64.625 64.875 65.125 65.375 65.625 65.875 66.125 66.375 66.625 66.875 67.125 67.375 67.625 67.875 68.125 68.375 68.625 68.875 69.125 69.375 69.625 69.875 70.125 70.375 70.625 70.875 71.125 71.375 71.625 71.875 72.125 72.375 72.625 72.875 73.125 73.375 73.625 73.875 74.125 74.375 74.625 74.875 75.125 75.375 75.625 75.875 76.125 76.375 76.625 76.875 77.125 77.375 77.625 77.875 78.125 78.375 78.625 78.875 79.125 79.375 79.625 79.875 80.125 80.375 80.625 80.875 81.125 81.375 81.625 81.875 82.125 82.375 82.625 82.875 83.125 83.375 83.625 83.875 84.125 84.375 84.625 84.875 85.125 85.375 85.625 85.875 86.125 86.375 86.625 86.875 87.125 87.375 87.625 87.875 88.125 88.375 88.625 88.875 89.125 89.375 89.625 89.875 90.000 YMID: -89.9375 -89.75 -89.50 -89.25 -89.00 -88.75 -88.50 -88.25 -88.00 -87.75 -87.50 -87.25 -87.00 -86.75 -86.50 -86.25 -86.00 -85.75 -85.50 -85.25 -85.00 -84.75 -84.50 -84.25 -84.00 -83.75 -83.50 -83.25 -83.00 -82.75 -82.50 -82.25 -82.00 -81.75 -81.50 -81.25 -81.00 -80.75 -80.50 -80.25 -80.00 -79.75 -79.50 -79.25 -79.00 -78.75 -78.50 -78.25 -78.00 -77.75 -77.50 -77.25 -77.00 -76.75 -76.50 -76.25 -76.00 -75.75 -75.50 -75.25 -75.00 -74.75 -74.50 -74.25 -74.00 -73.75 -73.50 -73.25 -73.00 -72.75 -72.50 -72.25 -72.00 -71.75 -71.50 -71.25 -71.00 -70.75 -70.50 -70.25 -70.00 -69.75 -69.50 -69.25 -69.00 -68.75 -68.50 -68.25 -68.00 -67.75 -67.50 -67.25 -67.00 -66.75 -66.50 -66.25 -66.00 -65.75 -65.50 -65.25 -65.00 -64.75 -64.50 -64.25 -64.00 -63.75 -63.50 -63.25 -63.00 -62.75 -62.50 -62.25 -62.00 -61.75 -61.50 -61.25 -61.00 -60.75 -60.50 -60.25 -60.00 -59.75 -59.50 -59.25 -59.00 -58.75 -58.50 -58.25 -58.00 -57.75 -57.50 -57.25 -57.00 -56.75 -56.50 -56.25 -56.00 -55.75 -55.50 -55.25 -55.00 -54.75 -54.50 -54.25 -54.00 -53.75 -53.50 -53.25 -53.00 -52.75 -52.50 -52.25 -52.00 -51.75 -51.50 -51.25 -51.00 -50.75 -50.50 -50.25 -50.00 -49.75 -49.50 -49.25 -49.00 -48.75 -48.50 -48.25 -48.00 -47.75 -47.50 -47.25 -47.00 -46.75 -46.50 -46.25 -46.00 -45.75 -45.50 -45.25 -45.00 -44.75 -44.50 -44.25 -44.00 -43.75 -43.50 -43.25 -43.00 -42.75 -42.50 -42.25 -42.00 -41.75 -41.50 -41.25 -41.00 -40.75 -40.50 -40.25 -40.00 -39.75 -39.50 -39.25 -39.00 -38.75 -38.50 -38.25 -38.00 -37.75 -37.50 -37.25 -37.00 -36.75 -36.50 -36.25 -36.00 -35.75 -35.50 -35.25 -35.00 -34.75 -34.50 -34.25 -34.00 -33.75 -33.50 -33.25 -33.00 -32.75 -32.50 -32.25 -32.00 -31.75 -31.50 -31.25 -31.00 -30.75 -30.50 -30.25 -30.00 -29.75 -29.50 -29.25 -29.00 -28.75 -28.50 -28.25 -28.00 -27.75 -27.50 -27.25 -27.00 -26.75 -26.50 -26.25 -26.00 -25.75 -25.50 -25.25 -25.00 -24.75 -24.50 -24.25 -24.00 -23.75 -23.50 -23.25 -23.00 -22.75 -22.50 -22.25 -22.00 -21.75 -21.50 -21.25 -21.00 -20.75 -20.50 -20.25 -20.00 -19.75 -19.50 -19.25 -19.00 -18.75 -18.50 -18.25 -18.00 -17.75 -17.50 -17.25 -17.00 -16.75 -16.50 -16.25 -16.00 -15.75 -15.50 -15.25 -15.00 -14.75 -14.50 -14.25 -14.00 -13.75 -13.50 -13.25 -13.00 -12.75 -12.50 -12.25 -12.00 -11.75 -11.50 -11.25 -11.00 -10.75 -10.50 -10.25 -10.00 -9.75 -9.50 -9.25 -9.00 -8.75 -8.50 -8.25 -8.00 -7.75 -7.50 -7.25 -7.00 -6.75 -6.50 -6.25 -6.00 -5.75 -5.50 -5.25 -5.00 -4.75 -4.50 -4.25 -4.00 -3.75 -3.50 -3.25 -3.00 -2.75 -2.50 -2.25 -2.00 -1.75 -1.50 -1.25 -1.00 -0.75 -0.50 -0.25 0.00 0.25 0.50 0.75 1.00 1.25 1.50 1.75 2.00 2.25 2.50 2.75 3.00 3.25 3.50 3.75 4.00 4.25 4.50 4.75 5.00 5.25 5.50 5.75 6.00 6.25 6.50 6.75 7.00 7.25 7.50 7.75 8.00 8.25 8.50 8.75 9.00 9.25 9.50 9.75 10.00 10.25 10.50 10.75 11.00 11.25 11.50 11.75 12.00 12.25 12.50 12.75 13.00 13.25 13.50 13.75 14.00 14.25 14.50 14.75 15.00 15.25 15.50 15.75 16.00 16.25 16.50 16.75 17.00 17.25 17.50 17.75 18.00 18.25 18.50 18.75 19.00 19.25 19.50 19.75 20.00 20.25 20.50 20.75 21.00 21.25 21.50 21.75 22.00 22.25 22.50 22.75 23.00 23.25 23.50 23.75 24.00 24.25 24.50 24.75 25.00 25.25 25.50 25.75 26.00 26.25 26.50 26.75 27.00 27.25 27.50 27.75 28.00 28.25 28.50 28.75 29.00 29.25 29.50 29.75 30.00 30.25 30.50 30.75 31.00 31.25 31.50 31.75 32.00 32.25 32.50 32.75 33.00 33.25 33.50 33.75 34.00 34.25 34.50 34.75 35.00 35.25 35.50 35.75 36.00 36.25 36.50 36.75 37.00 37.25 37.50 37.75 38.00 38.25 38.50 38.75 39.00 39.25 39.50 39.75 40.00 40.25 40.50 40.75 41.00 41.25 41.50 41.75 42.00 42.25 42.50 42.75 43.00 43.25 43.50 43.75 44.00 44.25 44.50 44.75 45.00 45.25 45.50 45.75 46.00 46.25 46.50 46.75 47.00 47.25 47.50 47.75 48.00 48.25 48.50 48.75 49.00 49.25 49.50 49.75 50.00 50.25 50.50 50.75 51.00 51.25 51.50 51.75 52.00 52.25 52.50 52.75 53.00 53.25 53.50 53.75 54.00 54.25 54.50 54.75 55.00 55.25 55.50 55.75 56.00 56.25 56.50 56.75 57.00 57.25 57.50 57.75 58.00 58.25 58.50 58.75 59.00 59.25 59.50 59.75 60.00 60.25 60.50 60.75 61.00 61.25 61.50 61.75 62.00 62.25 62.50 62.75 63.00 63.25 63.50 63.75 64.00 64.25 64.50 64.75 65.00 65.25 65.50 65.75 66.00 66.25 66.50 66.75 67.00 67.25 67.50 67.75 68.00 68.25 68.50 68.75 69.00 69.25 69.50 69.75 70.00 70.25 70.50 70.75 71.00 71.25 71.50 71.75 72.00 72.25 72.50 72.75 73.00 73.25 73.50 73.75 74.00 74.25 74.50 74.75 75.00 75.25 75.50 75.75 76.00 76.25 76.50 76.75 77.00 77.25 77.50 77.75 78.00 78.25 78.50 78.75 79.00 79.25 79.50 79.75 80.00 80.25 80.50 80.75 81.00 81.25 81.50 81.75 82.00 82.25 82.50 82.75 83.00 83.25 83.50 83.75 84.00 84.25 84.50 84.75 85.00 85.25 85.50 85.75 86.00 86.25 86.50 86.75 87.00 87.25 87.50 87.75 88.00 88.25 88.50 88.75 89.00 89.25 89.50 89.75 89.9375 \ No newline at end of file diff --git a/run/HEMCO_sa_Grid.05x0625.rc b/run/HEMCO_sa_Grid.05x0625.rc index 5e55f256..185caac3 100644 --- a/run/HEMCO_sa_Grid.05x0625.rc +++ b/run/HEMCO_sa_Grid.05x0625.rc @@ -1,11 +1,11 @@ # Emission grid specifications: -XMIN: -180.25 -XMAX: 179.75 -YMIN: -90.0 -YMAX: 90.0 -NX: 576 -NY: 361 -NZ: 47 +XMIN: -180.3125 # Westernmost longitude edge +XMAX: 179.6875 # Easternmost longitude edge +YMIN: -90.0 # Southernmost latitude edge +YMAX: 90.0 # Northernmost latititude edge +NX: 576 # Number of longitudes in grid +NY: 361 # Number of latitudes in grid +NZ: 47 # Number of levels in grid YEDGE: -90.00 -89.75 -89.25 -88.75 -88.25 -87.75 -87.25 -86.75 -86.25 -85.75 -85.25 -84.75 -84.25 -83.75 -83.25 -82.75 -82.25 -81.75 -81.25 -80.75 -80.25 -79.75 -79.25 -78.75 -78.25 -77.75 -77.25 -76.75 -76.25 -75.75 -75.25 -74.75 -74.25 -73.75 -73.25 -72.75 -72.25 -71.75 -71.25 -70.75 -70.25 -69.75 -69.25 -68.75 -68.25 -67.75 -67.25 -66.75 -66.25 -65.75 -65.25 -64.75 -64.25 -63.75 -63.25 -62.75 -62.25 -61.75 -61.25 -60.75 -60.25 -59.75 -59.25 -58.75 -58.25 -57.75 -57.25 -56.75 -56.25 -55.75 -55.25 -54.75 -54.25 -53.75 -53.25 -52.75 -52.25 -51.75 -51.25 -50.75 -50.25 -49.75 -49.25 -48.75 -48.25 -47.75 -47.25 -46.75 -46.25 -45.75 -45.25 -44.75 -44.25 -43.75 -43.25 -42.75 -42.25 -41.75 -41.25 -40.75 -40.25 -39.75 -39.25 -38.75 -38.25 -37.75 -37.25 -36.75 -36.25 -35.75 -35.25 -34.75 -34.25 -33.75 -33.25 -32.75 -32.25 -31.75 -31.25 -30.75 -30.25 -29.75 -29.25 -28.75 -28.25 -27.75 -27.25 -26.75 -26.25 -25.75 -25.25 -24.75 -24.25 -23.75 -23.25 -22.75 -22.25 -21.75 -21.25 -20.75 -20.25 -19.75 -19.25 -18.75 -18.25 -17.75 -17.25 -16.75 -16.25 -15.75 -15.25 -14.75 -14.25 -13.75 -13.25 -12.75 -12.25 -11.75 -11.25 -10.75 -10.25 -9.75 -9.25 -8.75 -8.25 -7.75 -7.25 -6.75 -6.25 -5.75 -5.25 -4.75 -4.25 -3.75 -3.25 -2.75 -2.25 -1.75 -1.25 -0.75 -0.25 0.25 0.75 1.25 1.75 2.25 2.75 3.25 3.75 4.25 4.75 5.25 5.75 6.25 6.75 7.25 7.75 8.25 8.75 9.25 9.75 10.25 10.75 11.25 11.75 12.25 12.75 13.25 13.75 14.25 14.75 15.25 15.75 16.25 16.75 17.25 17.75 18.25 18.75 19.25 19.75 20.25 20.75 21.25 21.75 22.25 22.75 23.25 23.75 24.25 24.75 25.25 25.75 26.25 26.75 27.25 27.75 28.25 28.75 29.25 29.75 30.25 30.75 31.25 31.75 32.25 32.75 33.25 33.75 34.25 34.75 35.25 35.75 36.25 36.75 37.25 37.75 38.25 38.75 39.25 39.75 40.25 40.75 41.25 41.75 42.25 42.75 43.25 43.75 44.25 44.75 45.25 45.75 46.25 46.75 47.25 47.75 48.25 48.75 49.25 49.75 50.25 50.75 51.25 51.75 52.25 52.75 53.25 53.75 54.25 54.75 55.25 55.75 56.25 56.75 57.25 57.75 58.25 58.75 59.25 59.75 60.25 60.75 61.25 61.75 62.25 62.75 63.25 63.75 64.25 64.75 65.25 65.75 66.25 66.75 67.25 67.75 68.25 68.75 69.25 69.75 70.25 70.75 71.25 71.75 72.25 72.75 73.25 73.75 74.25 74.75 75.25 75.75 76.25 76.75 77.25 77.75 78.25 78.75 79.25 79.75 80.25 80.75 81.25 81.75 82.25 82.75 83.25 83.75 84.25 84.75 85.25 85.75 86.25 86.75 87.25 87.75 88.25 88.75 89.25 89.75 90.00 YMID: -89.875 -89.50 -89.00 -88.50 -88.00 -87.50 -87.00 -86.50 -86.00 -85.50 -85.00 -84.50 -84.00 -83.50 -83.00 -82.50 -82.00 -81.50 -81.00 -80.50 -80.00 -79.50 -79.00 -78.50 -78.00 -77.50 -77.00 -76.50 -76.00 -75.50 -75.00 -74.50 -74.00 -73.50 -73.00 -72.50 -72.00 -71.50 -71.00 -70.50 -70.00 -69.50 -69.00 -68.50 -68.00 -67.50 -67.00 -66.50 -66.00 -65.50 -65.00 -64.50 -64.00 -63.50 -63.00 -62.50 -62.00 -61.50 -61.00 -60.50 -60.00 -59.50 -59.00 -58.50 -58.00 -57.50 -57.00 -56.50 -56.00 -55.50 -55.00 -54.50 -54.00 -53.50 -53.00 -52.50 -52.00 -51.50 -51.00 -50.50 -50.00 -49.50 -49.00 -48.50 -48.00 -47.50 -47.00 -46.50 -46.00 -45.50 -45.00 -44.50 -44.00 -43.50 -43.00 -42.50 -42.00 -41.50 -41.00 -40.50 -40.00 -39.50 -39.00 -38.50 -38.00 -37.50 -37.00 -36.50 -36.00 -35.50 -35.00 -34.50 -34.00 -33.50 -33.00 -32.50 -32.00 -31.50 -31.00 -30.50 -30.00 -29.50 -29.00 -28.50 -28.00 -27.50 -27.00 -26.50 -26.00 -25.50 -25.00 -24.50 -24.00 -23.50 -23.00 -22.50 -22.00 -21.50 -21.00 -20.50 -20.00 -19.50 -19.00 -18.50 -18.00 -17.50 -17.00 -16.50 -16.00 -15.50 -15.00 -14.50 -14.00 -13.50 -13.00 -12.50 -12.00 -11.50 -11.00 -10.50 -10.00 -9.50 -9.00 -8.50 -8.00 -7.50 -7.00 -6.50 -6.00 -5.50 -5.00 -4.50 -4.00 -3.50 -3.00 -2.50 -2.00 -1.50 -1.00 -0.50 0.00 0.50 1.00 1.50 2.00 2.50 3.00 3.50 4.00 4.50 5.00 5.50 6.00 6.50 7.00 7.50 8.00 8.50 9.00 9.50 10.00 10.50 11.00 11.50 12.00 12.50 13.00 13.50 14.00 14.50 15.00 15.50 16.00 16.50 17.00 17.50 18.00 18.50 19.00 19.50 20.00 20.50 21.00 21.50 22.00 22.50 23.00 23.50 24.00 24.50 25.00 25.50 26.00 26.50 27.00 27.50 28.00 28.50 29.00 29.50 30.00 30.50 31.00 31.50 32.00 32.50 33.00 33.50 34.00 34.50 35.00 35.50 36.00 36.50 37.00 37.50 38.00 38.50 39.00 39.50 40.00 40.50 41.00 41.50 42.00 42.50 43.00 43.50 44.00 44.50 45.00 45.50 46.00 46.50 47.00 47.50 48.00 48.50 49.00 49.50 50.00 50.50 51.00 51.50 52.00 52.50 53.00 53.50 54.00 54.50 55.00 55.50 56.00 56.50 57.00 57.50 58.00 58.50 59.00 59.50 60.00 60.50 61.00 61.50 62.00 62.50 63.00 63.50 64.00 64.50 65.00 65.50 66.00 66.50 67.00 67.50 68.00 68.50 69.00 69.50 70.00 70.50 71.00 71.50 72.00 72.50 73.00 73.50 74.00 74.50 75.00 75.50 76.00 76.50 77.00 77.50 78.00 78.50 79.00 79.50 80.00 80.50 81.00 81.50 82.00 82.50 83.00 83.50 84.00 84.50 85.00 85.50 86.00 86.50 87.00 87.50 88.00 88.50 89.00 89.50 89.875 diff --git a/run/HEMCO_sa_Grid.2x25.rc b/run/HEMCO_sa_Grid.2x25.rc index 2390c4eb..b282c9d0 100644 --- a/run/HEMCO_sa_Grid.2x25.rc +++ b/run/HEMCO_sa_Grid.2x25.rc @@ -1,11 +1,11 @@ # Emission grid specifications: -XMIN: -181.25 -XMAX: 178.75 -YMIN: -90.0 -YMAX: 90.0 -NX: 144 -NY: 91 -NZ: 47 +XMIN: -181.25 # Westernmost longitude edge +XMAX: 178.75 # Easternmost longitude edge +YMIN: -90.0 # Southernmost latitude edge +YMAX: 90.0 # Northernmost latititude edge +NX: 144 # Number of longitudes in grid +NY: 91 # Number of latitudes in grid +NZ: 47 # Number of levels in grid YMID: -89.5 -88.0 -86.0 -84.0 -82.0 -80.0 -78.0 -76.0 -74.0 -72.0 -70.0 -68.0 -66.0 -64.0 -62.0 -60.0 -58.0 -56.0 -54.0 -52.0 -50.0 -48.0 -46.0 -44.0 -42.0 -40.0 -38.0 -36.0 -34.0 -32.0 -30.0 -28.0 -26.0 -24.0 -22.0 -20.0 -18.0 -16.0 -14.0 -12.0 -10.0 -8.0 -6.0 -4.0 -2.0 0.0 2.0 4.0 6.0 8.0 10.0 12.0 14.0 16.0 18.0 20.0 22.0 24.0 26.0 28.0 30.0 32.0 34.0 36.0 38.0 40.0 42.0 44.0 46.0 48.0 50.0 52.0 54.0 56.0 58.0 60.0 62.0 64.0 66.0 68.0 70.0 72.0 74.0 76.0 78.0 80.0 82.0 84.0 86.0 88.0 89.5 diff --git a/run/HEMCO_sa_Grid.4x5.rc b/run/HEMCO_sa_Grid.4x5.rc index aaab0d73..53740647 100644 --- a/run/HEMCO_sa_Grid.4x5.rc +++ b/run/HEMCO_sa_Grid.4x5.rc @@ -1,11 +1,11 @@ # Emission grid specifications: -XMIN: -182.5 -XMAX: 177.5 -YMIN: -90.0 -YMAX: 90.0 -NX: 72 -NY: 46 -NZ: 47 +XMIN: -182.5 # Westernmost longitude edge +XMAX: 177.5 # Easternmost longitude edge +YMIN: -90.0 # Southernmost latitude edge +YMAX: 90.0 # Northernmost latititude edge +NX: 72 # Number of longitudes in grid +NY: 46 # Number of latitudes in grid +NZ: 47 # Number of levels in grid YMID: -89.0 -86.0 -82.0 -78.0 -74.0 -70.0 -66.0 -62.0 -58.0 -54.0 -50.0 -46.0 -42.0 -38.0 -34.0 -30.0 -26.0 -22.0 -18.0 -14.0 -10.0 -6.0 -2.0 2.0 6.0 10.0 14.0 18.0 22.0 26.0 30.0 34.0 38.0 42.0 46.0 50.0 54.0 58.0 62.0 66.0 70.0 74.0 78.0 82.0 86.0 89.0 YEDGE: -90.0 -88.0 -84.0 -80.0 -76.0 -72.0 -68.0 -64.0 -60.0 -56.0 -52.0 -48.0 -44.0 -40.0 -36.0 -32.0 -28.0 -24.0 -20.0 -16.0 -12.0 -8.0 -4.0 0.0 4.0 8.0 12.0 16.0 20.0 24.0 28.0 32.0 36.0 40.0 44.0 48.0 52.0 56.0 60.0 64.0 68.0 72.0 76.0 80.0 84.0 88.0 90.0 diff --git a/src/Core/hco_error_mod.F90 b/src/Core/hco_error_mod.F90 index e4d6bb3c..b242dc1c 100644 --- a/src/Core/hco_error_mod.F90 +++ b/src/Core/hco_error_mod.F90 @@ -105,7 +105,7 @@ MODULE HCO_Error_Mod #endif ! HEMCO version number. - CHARACTER(LEN=12), PARAMETER, PUBLIC :: HCO_VERSION = '3.7.0' + CHARACTER(LEN=12), PARAMETER, PUBLIC :: HCO_VERSION = '3.7.1' INTERFACE HCO_Error MODULE PROCEDURE HCO_ErrorNoErr @@ -707,7 +707,7 @@ SUBROUTINE HCO_ERROR_SET( am_I_Root, Err, LogFile, & LOGICAL, INTENT(INOUT) :: doVerbose ! Verbose output T/F? LOGICAL, INTENT(INOUT) :: doVerboseOnRoot ! =T: Verbose on root ! =F: Verbose on all - INTEGER, INTENT(INOUT) :: RC + INTEGER, INTENT(INOUT) :: RC ! ! !REVISION HISTORY: ! 23 Sep 2013 - C. Keller - Initialization @@ -732,7 +732,7 @@ SUBROUTINE HCO_ERROR_SET( am_I_Root, Err, LogFile, & Err%Loc(:) = '' ! Pass values - Err%IsRoot = am_I_Root + Err%IsRoot = am_I_Root Err%LogFile = TRIM(LogFile) ! Specify if verbose will be printed on the root core, or all cores @@ -1059,4 +1059,3 @@ SUBROUTINE HCO_LogFile_Close( Err, ShowSummary ) END SUBROUTINE HCO_LogFile_Close !EOC END MODULE HCO_Error_Mod - diff --git a/src/Core/hco_extlist_mod.F90 b/src/Core/hco_extlist_mod.F90 index 173bc134..6c382e54 100644 --- a/src/Core/hco_extlist_mod.F90 +++ b/src/Core/hco_extlist_mod.F90 @@ -639,22 +639,25 @@ END SUBROUTINE GetExtSpcStr !\\ ! !INTERFACE: ! - SUBROUTINE GetExtSpcVal_Sp( HcoConfig, ExtNr, NSPC, SpcNames, & - Prefix, DefValue, SpcScal, RC ) + SUBROUTINE GetExtSpcVal_sp( HcoConfig, extNr, NSPC, spcNames, & + prefix, defValue, spcScal, RC ) ! ! !INPUT PARAMETERS: ! - TYPE(ConfigObj), POINTER :: HcoConfig - INTEGER, INTENT(IN ) :: ExtNr ! Extension Nr. - INTEGER, INTENT(IN ) :: NSPC ! # of species - CHARACTER(LEN=*), INTENT(IN ) :: SpcNames(NSPC) ! Species string - CHARACTER(LEN=*), INTENT(IN ) :: Prefix ! search prefix - REAL(sp), INTENT(IN ) :: DefValue ! default value + TYPE(ConfigObj), POINTER :: HcoConfig ! HEMCO config obj + INTEGER, INTENT(IN) :: extNr ! Extension Nr. + INTEGER, INTENT(IN) :: NSPC ! # of species + CHARACTER(LEN=*), INTENT(IN) :: spcNames(NSPC) ! Species string + CHARACTER(LEN=*), INTENT(IN) :: prefix ! Search prefix + REAL(sp), INTENT(IN) :: defValue ! Default value ! ! !INPUT/OUTPUT PARAMETERS: ! - REAL(sp), ALLOCATABLE, INTENT(INOUT) :: SpcScal(:) ! Species scale factors - INTEGER, INTENT(INOUT) :: RC ! Success or failure? + REAL(sp), ALLOCATABLE, INTENT(INOUT) :: spcScal(:) ! Species scalefacs +! +! !OUTPUT PARAMETERS: +! + INTEGER, INTENT(OUT) :: RC ! Success or failure? ! ! !REVISION HISTORY: ! 10 Jun 2015 - C. Keller - Initial version @@ -663,19 +666,69 @@ SUBROUTINE GetExtSpcVal_Sp( HcoConfig, ExtNr, NSPC, SpcNames, & !------------------------------------------------------------------------------ !BOC - !====================================================================== - ! GetExtSpcVal_Sp begins here - !====================================================================== + ! Scalars + LOGICAL :: found + INTEGER :: I + REAL(sp) :: scaleFac + + ! Strings + CHARACTER(LEN= 61) :: name + CHARACTER(LEN=255) :: errMsg + CHARACTER(LEN=255) :: thisLoc + + !======================================================================== + ! GetExtSpcVal_sp begins here + !======================================================================== + + ! Initialize + RC = HCO_SUCCESS + errMsg = '' + thisLoc = & + ' -> at GetExtSpcVal_sp (in module src/Core/hco_extlist_mod.F90)' + + !======================================================================== + ! Make sure output array SpcScal is properly allocated + !======================================================================== + IF ( ALLOCATED( spcScal ) ) DEALLOCATE( spcScal ) + ALLOCATE( SpcScal(NSPC), STAT=RC ) + IF ( RC /= HCO_SUCCESS ) THEN + errMsg = 'Could not allocate SpcScal array!' + CALL HCO_ERROR( errMsg, RC, thisLoc ) + RETURN + ENDIF + + ! Initialize to default values + spcScal = defValue - ! Make sure output is properly allocated - IF ( ALLOCATED(SpcScal) ) DEALLOCATE(SpcScal) - ALLOCATE(SpcScal(NSPC)) - SpcScal=DefValue + !======================================================================== + ! Look for species scale factors; save to spcScal array + !======================================================================== + DO I = 1, NSPC - CALL GetExtSpcVal_Dr ( HcoConfig, ExtNr, NSPC, SpcNames, Prefix, RC, & - DefVal_SP=DefValue, SpcScal_SP=SpcScal ) + ! Species name + name = TRIM( prefix ) // '_' // TRIM( spcNames(I) ) + + ! Look for the scale factor + CALL GetExtOpt( & + HcoConfig = HcoConfig, & + extNr = extNr, & + optName = name, & + optValSp = scaleFac, & + found = found, & + RC = RC ) + + ! Trap errors + IF ( RC /= HCO_SUCCESS ) THEN + errMsg = 'Error encountered in "GetExtOpt" routine!' + CALL HCO_ERROR( errMsg, RC, thisLoc ) + RETURN + ENDIF + + ! If scale factor was found, assign it to SpcScal + IF ( found ) spcScal(I) = scaleFac + ENDDO - END SUBROUTINE GetExtSpcVal_sp + END SUBROUTINE GetExtSpcVal_sp !EOC !------------------------------------------------------------------------------ ! Harmonized Emissions Component (HEMCO) ! @@ -694,22 +747,25 @@ END SUBROUTINE GetExtSpcVal_sp !\\ ! !INTERFACE: ! - SUBROUTINE GetExtSpcVal_Int( HcoConfig, ExtNr, NSPC, SpcNames, & - Prefix, DefValue, SpcScal, RC ) + SUBROUTINE GetExtSpcVal_int( HcoConfig, extNr, NSPC, spcNames, & + prefix, defValue, spcScal, RC ) ! ! !INPUT PARAMETERS: ! TYPE(ConfigObj), POINTER :: HcoConfig - INTEGER, INTENT(IN ) :: ExtNr ! Extension Nr. - INTEGER, INTENT(IN ) :: NSPC ! # of species - CHARACTER(LEN=*), INTENT(IN ) :: SpcNames(NSPC) ! Species string - CHARACTER(LEN=*), INTENT(IN ) :: Prefix ! search prefix - INTEGER, INTENT(IN ) :: DefValue ! default value + INTEGER, INTENT(IN) :: extNr ! Extension Nr. + INTEGER, INTENT(IN) :: NSPC ! # of species + CHARACTER(LEN=*), INTENT(IN) :: spcNames(NSPC) ! Species string + CHARACTER(LEN=*), INTENT(IN) :: prefix ! search prefix + INTEGER, INTENT(IN) :: defValue ! default value ! ! !INPUT/OUTPUT PARAMETERS: ! - INTEGER, ALLOCATABLE, INTENT(INOUT) :: SpcScal(:) ! Species scale factors - INTEGER, INTENT(INOUT) :: RC ! Success or failure? + INTEGER, ALLOCATABLE, INTENT(INOUT) :: spcScal(:) ! Species scalefacs +! +! !OUTPUT PARAMETERS:: +! + INTEGER, INTENT(OUT) :: RC ! Success or failure? ! ! !REVISION HISTORY: ! 10 Jun 2015 - C. Keller - Initial version @@ -718,28 +774,78 @@ SUBROUTINE GetExtSpcVal_Int( HcoConfig, ExtNr, NSPC, SpcNames, & !------------------------------------------------------------------------------ !BOC - !====================================================================== - ! GetExtSpcVal_Int begins here - !====================================================================== + ! Scalars + LOGICAL :: found + INTEGER :: I + INTEGER :: scaleFac + + ! Strings + CHARACTER(LEN= 61) :: name + CHARACTER(LEN=255) :: errMsg + CHARACTER(LEN=255) :: thisLoc + + !======================================================================== + ! GetExtSpcVal_int begins here + !======================================================================== + + ! Initialize + RC = HCO_SUCCESS + errMsg = '' + thisLoc = & + ' -> at GetExtSpcVal_Int (in module src/Core/hco_extlist_mod.F90)' + + !======================================================================== + ! Make sure output array SpcScal is properly allocated + !======================================================================== + IF ( ALLOCATED( spcScal ) ) DEALLOCATE( spcScal ) + ALLOCATE( SpcScal(NSPC), STAT=RC ) + IF ( RC /= HCO_SUCCESS ) THEN + errMsg = 'Could not allocate SpcScal array!' + CALL HCO_ERROR( errMsg, RC, thisLoc ) + RETURN + ENDIF + + ! Initialize to default values + spcScal = defValue + + !======================================================================== + ! Look for species scale factors; save to spcScal array + !======================================================================== + DO I = 1, NSPC - ! Make sure output is properly allocated - IF ( ALLOCATED(SpcScal) ) DEALLOCATE(SpcScal) - ALLOCATE(SpcScal(NSPC)) - SpcScal=DefValue + ! Species name + name = TRIM( prefix ) // '_' // TRIM( spcNames(I) ) + + ! Look for the scale factor + CALL GetExtOpt( & + HcoConfig = HcoConfig, & + extNr = extNr, & + optName = name, & + optValInt = scaleFac, & + found = found, & + RC = RC ) + + ! Trap errors + IF ( RC /= HCO_SUCCESS ) THEN + errMsg = 'Error encountered in "GetExtOpt" routine!' + CALL HCO_ERROR( errMsg, RC, thisLoc ) + RETURN + ENDIF - CALL GetExtSpcVal_Dr ( HcoConfig, ExtNr, NSPC, SpcNames, Prefix, RC, & - DefVal_IN=DefValue, SpcScal_IN=SpcScal ) + ! If scale factor was found, assign it to SpcScal + IF ( found ) spcScal(I) = scaleFac + ENDDO - END SUBROUTINE GetExtSpcVal_Int + END SUBROUTINE GetExtSpcVal_int !EOC !------------------------------------------------------------------------------ ! Harmonized Emissions Component (HEMCO) ! !------------------------------------------------------------------------------ !BOP ! -! !ROUTINE: GetExtSpcVal_Char +! !ROUTINE: GetExtSpcVal_char ! -! !DESCRIPTION: Subroutine GetExtSpcVal\_Char returns character values +! !DESCRIPTION: Subroutine GetExtSpcVal\_char returns character values ! associated with the species for a given extension. Specifically, this routine ! searches for extension setting '\_SpecName' for every species passed ! through input argument SpcNames and writes those into output argument SpcScal. @@ -749,22 +855,26 @@ END SUBROUTINE GetExtSpcVal_Int !\\ ! !INTERFACE: ! - SUBROUTINE GetExtSpcVal_Char( HcoConfig, ExtNr, NSPC, SpcNames, & - Prefix, DefValue, SpcScal, RC ) + SUBROUTINE GetExtSpcVal_char( HcoConfig, extNr, NSPC, spcNames, & + prefix, defValue, spcScal, RC ) ! ! !INPUT PARAMETERS: ! - TYPE(ConfigObj), POINTER :: HcoConfig - INTEGER, INTENT(IN ) :: ExtNr ! Extension Nr. - INTEGER, INTENT(IN ) :: NSPC ! # of species - CHARACTER(LEN=*), INTENT(IN ) :: SpcNames(NSPC) ! Species string - CHARACTER(LEN=*), INTENT(IN ) :: Prefix ! search prefix - CHARACTER(LEN=*), INTENT(IN ) :: DefValue ! default value + TYPE(ConfigObj), POINTER :: HcoConfig ! HEMCO config object + INTEGER, INTENT(IN) :: extNr ! Extension Nr. + INTEGER, INTENT(IN) :: NSPC ! # of species + CHARACTER(LEN=*), INTENT(IN) :: spcNames(NSPC) ! Species string + CHARACTER(LEN=*), INTENT(IN) :: prefix ! search prefix + CHARACTER(LEN=*), INTENT(IN) :: defValue ! default value ! ! !INPUT/OUTPUT PARAMETERS: ! - CHARACTER(LEN=*), ALLOCATABLE, INTENT(INOUT) :: SpcScal(:) ! Species scale factors - INTEGER, INTENT(INOUT) :: RC ! Success or failure? + CHARACTER(LEN=*), & + ALLOCATABLE, INTENT(INOUT) :: SpcScal(:) ! Species scale factors +! +! !OUTPUT PARAMETERS: +! + INTEGER, INTENT(OUT) :: RC ! Success or failure? ! ! !REVISION HISTORY: ! 10 Jun 2015 - C. Keller - Initial version @@ -773,115 +883,69 @@ SUBROUTINE GetExtSpcVal_Char( HcoConfig, ExtNr, NSPC, SpcNames, & !------------------------------------------------------------------------------ !BOC - !====================================================================== - ! GetExtSpcVal_Char begins here - !====================================================================== - - ! Make sure output is properly allocated - IF ( ALLOCATED(SpcScal) ) DEALLOCATE(SpcScal) - ALLOCATE(SpcScal(NSPC)) - SpcScal=DefValue + ! Scalars + LOGICAL :: found + INTEGER :: I - CALL GetExtSpcVal_Dr ( HcoConfig, ExtNr, NSPC, SpcNames, Prefix, RC, & - DefVal_Char=DefValue, SpcScal_Char=SpcScal ) + ! Strings + CHARACTER(LEN= 61) :: name + CHARACTER(LEN=255) :: scaleFac + CHARACTER(LEN=255) :: errMsg + CHARACTER(LEN=255) :: thisLoc - END SUBROUTINE GetExtSpcVal_char -!EOC -!------------------------------------------------------------------------------ -! Harmonized Emissions Component (HEMCO) ! -!------------------------------------------------------------------------------ -!BOP -! -! !ROUTINE: GetExtSpcVal_Dr -! -! !DESCRIPTION: Subroutine GetExtSpcVal\_Dr is the GetExtSpcVal driver routine. -!\\ -!\\ -! !INTERFACE: -! - SUBROUTINE GetExtSpcVal_Dr( HcoConfig, ExtNr, NSPC, & - SpcNames, Prefix, RC, & - DefVal_SP, SpcScal_SP, & - DefVal_Char, SpcScal_Char, & - DefVal_IN, SpcScal_IN ) -! -! !INPUT PARAMETERS: -! - TYPE(ConfigObj), POINTER :: HcoConfig - INTEGER, INTENT(IN ) :: ExtNr ! Extension Nr. - INTEGER, INTENT(IN ) :: NSPC ! # of species - CHARACTER(LEN=*), INTENT(IN ) :: SpcNames(NSPC) ! Species string - CHARACTER(LEN=*), INTENT(IN ) :: Prefix ! search prefix - REAL(sp), INTENT(IN ), OPTIONAL :: DefVal_SP ! default value - INTEGER, INTENT(IN ), OPTIONAL :: DefVal_IN ! default value - CHARACTER(LEN=*), INTENT(IN ), OPTIONAL :: DefVal_Char ! default value -! -! !OUTPUT PARAMETERS: -! - REAL(sp), INTENT( OUT), OPTIONAL :: SpcScal_SP(NSPC) ! Species values - INTEGER, INTENT( OUT), OPTIONAL :: SpcScal_IN(NSPC) ! Species values - CHARACTER(LEN=*), INTENT( OUT), OPTIONAL :: SpcScal_Char(NSPC) ! Species values -! -! !INPUT/OUTPUT PARAMETERS: -! - INTEGER, INTENT(INOUT) :: RC ! Success or failure? -! -! !REVISION HISTORY: -! 10 Jun 2015 - C. Keller - Initial version -! See https://github.com/geoschem/hemco for complete history -!EOP -!------------------------------------------------------------------------------ -!BOC -! -! !LOCAL ARGUMENTS: -! - INTEGER :: I - LOGICAL :: FND - REAL(sp) :: iScal_sp - INTEGER :: iScal_in - CHARACTER(LEN=255) :: iScal_char - CHARACTER(LEN= 61) :: IOptName - CHARACTER(LEN=255) :: MSG - CHARACTER(LEN=255) :: LOC = 'GetExtSpcVal_Dr (hco_extlist_mod.F90)' + !======================================================================== + ! GetExtSpcVal_Char begins here + !======================================================================== + + ! Initialize + RC = HCO_SUCCESS + errMsg = '' + thisLoc = & + ' -> at GetExtSpcVal_Char (in module src/Core/hco_extlist_mod.F90)' + + !======================================================================== + ! Make sure output array SpcScal is properly allocated + !======================================================================== + IF ( ALLOCATED( spcScal ) ) DEALLOCATE( spcScal ) + ALLOCATE( SpcScal(NSPC), STAT=RC ) + IF ( RC /= HCO_SUCCESS ) THEN + errMsg = 'Could not allocate SpcScal array!' + CALL HCO_ERROR( errMsg, RC, thisLoc ) + RETURN + ENDIF - !====================================================================== - ! GetExtSpcVal_Dr begins here - !====================================================================== + ! Initialize to default values + spcScal = defValue - ! Do for every species + !======================================================================== + ! Look for species scale factors; save to spcScal array + !======================================================================== DO I = 1, NSPC - IOptName = TRIM(Prefix)//'_'//TRIM(SpcNames(I)) - IF ( PRESENT(SpcScal_sp) ) THEN - CALL GetExtOpt ( HcoConfig, ExtNr, IOptName, OptValSp=iScal_sp, FOUND=FND, RC=RC ) - IF ( RC /= HCO_SUCCESS ) THEN - CALL HCO_ERROR( 'ERROR 1', RC, THISLOC=LOC ) - RETURN - ENDIF - IF ( FND ) SpcScal_sp(I) = iScal_sp - ENDIF - IF ( PRESENT(SpcScal_in) ) THEN - CALL GetExtOpt ( HcoConfig, ExtNr, IOptName, OptValInt=iScal_in, FOUND=FND, RC=RC ) - IF ( RC /= HCO_SUCCESS ) THEN - CALL HCO_ERROR( 'ERROR 2', RC, THISLOC=LOC ) - RETURN - ENDIF - IF ( FND ) SpcScal_in(I) = iScal_in - ENDIF - IF ( PRESENT(SpcScal_char) ) THEN - CALL GetExtOpt ( HcoConfig, ExtNr, IOptName, OptValChar=iScal_char, FOUND=FND, RC=RC ) - IF ( RC /= HCO_SUCCESS ) THEN - CALL HCO_ERROR( 'ERROR 3', RC, THISLOC=LOC ) - RETURN - ENDIF - IF ( FND ) SpcScal_char(I) = iScal_char + ! Species name + name = TRIM( prefix ) // '_' // TRIM( spcNames(I) ) + + ! Look for the scale factor + CALL GetExtOpt( & + HcoConfig = HcoConfig, & + extNr = extNr, & + optName = name, & + optValChar = scaleFac, & + found = found, & + RC = RC ) + + ! Trap errors + IF ( RC /= HCO_SUCCESS ) THEN + errMsg = 'Error encountered in "GetExtOpt" routine!' + CALL HCO_ERROR( errMsg, RC, thisLoc ) + RETURN ENDIF - ENDDO - ! Return w/ success - RC = HCO_SUCCESS + ! If scale factor was found, assign it to SpcScal + IF ( found ) spcScal(I) = scaleFac + ENDDO - END SUBROUTINE GetExtSpcVal_Dr + END SUBROUTINE GetExtSpcVal_char !EOC !------------------------------------------------------------------------------ ! Harmonized Emissions Component (HEMCO) ! diff --git a/src/Core/hco_interp_mod.F90 b/src/Core/hco_interp_mod.F90 index e6c87391..60c3d9bf 100644 --- a/src/Core/hco_interp_mod.F90 +++ b/src/Core/hco_interp_mod.F90 @@ -36,11 +36,9 @@ MODULE HCO_Interp_Mod PUBLIC :: ModelLev_Interpolate PUBLIC :: REGRID_MAPA2A ! -! !PUBLIC MEMBER FUNCTIONS: +! !PRIVATE MEMBER FUNCTIONS: ! - PRIVATE :: GEOS5_TO_GEOS4_LOWLEV PRIVATE :: COLLAPSE - PRIVATE :: INFLATE ! ! !REVISION HISTORY: ! 30 Dec 2014 - C. Keller - Initialization @@ -74,29 +72,6 @@ MODULE HCO_Interp_Mod 6.600001e-02_hp, 4.758501e-02_hp, 3.270000e-02_hp, 2.000000e-02_hp, & 1.000000e-02_hp /) - ! AP parameter of native GEOS-4 grid. Needed to remap GEOS-4 data from native - ! onto the reduced vertical grid. - REAL(hp), TARGET :: G4_EDGE_NATIVE(56) = (/ & - 0.000000_hp, 0.000000_hp, 12.704939_hp, & - 35.465965_hp, 66.098427_hp, 101.671654_hp, & - 138.744400_hp, 173.403183_hp, 198.737839_hp, & - 215.417526_hp, 223.884689_hp, 224.362869_hp, & - 216.864929_hp, 201.192093_hp, 176.929993_hp, & - 150.393005_hp, 127.837006_hp, 108.663429_hp, & - 92.365662_hp, 78.512299_hp, 66.603378_hp, & - 56.387939_hp, 47.643932_hp, 40.175419_hp, & - 33.809956_hp, 28.367815_hp, 23.730362_hp, & - 19.791553_hp, 16.457071_hp, 13.643393_hp, & - 11.276889_hp, 9.292943_hp, 7.619839_hp, & - 6.216800_hp, 5.046805_hp, 4.076567_hp, & - 3.276433_hp, 2.620212_hp, 2.084972_hp, & - 1.650792_hp, 1.300508_hp, 1.019442_hp, & - 0.795134_hp, 0.616779_hp, 0.475806_hp, & - 0.365041_hp, 0.278526_hp, 0.211349_hp, & - 0.159495_hp, 0.119703_hp, 0.089345_hp, & - 0.066000_hp, 0.047585_hp, 0.032700_hp, & - 0.020000_hp, 0.010000_hp /) - ! AP parameter of native 102-layer GISS grid REAL(hp), TARGET :: E102_EDGE_NATIVE(103) = (/ & 0.0000000, 2.7871507, 5.5743014, 8.3614521, 11.1486028, 13.9357536, & @@ -385,7 +360,7 @@ SUBROUTINE REGRID_MAPA2A( HcoState, NcArr, LonE, LatE, Lct, RC ) ENDDO !L ENDDO !T - ! Eventually inflate/collapse levels onto simulation levels. + ! Eventually collapse levels onto simulation levels. IF ( Lct%Dct%Dta%SpaceDim == 3 ) THEN CALL ModelLev_Interpolate( HcoState, REGR_4D, Lct, RC ) IF ( RC /= HCO_SUCCESS ) THEN @@ -517,9 +492,6 @@ SUBROUTINE ModelLev_Check( HcoState, nLev, IsModelLev, RC ) ! Assume success until otherwise RC = HCO_SUCCESS - ! If IsModelLev is already TRUE, nothing to do - IF ( IsModelLev ) RETURN - ! Shadow number of vertical levels on grid nz = HcoState%NZ @@ -527,43 +499,21 @@ SUBROUTINE ModelLev_Check( HcoState, nLev, IsModelLev, RC ) ! levels or levels + 1 (edges) IF ( nlev == nz .OR. nlev == nz + 1 ) THEN IsModelLev = .TRUE. - RETURN - ENDIF - - ! Other supported levels that depend on compiler flags - ! Full grid - IF ( nz == 72 ) THEN - IF ( nlev <= 73 ) THEN - IsModelLev = .TRUE. - ENDIF - ! Reduced grid + ! If input is 72 layer (or 36 layer) and output is 47 layer ELSEIF ( nz == 47 ) THEN - IF ( nlev == 72 .OR. & - nlev == 73 .OR. & - nlev <= 47 ) THEN - IsModelLev = .TRUE. - ENDIF + IsModelLev = ( nlev == 72 .OR. nlev == 73 .OR. nlev == 36) - ! Full GISS 102-layer grid - ELSEIF ( nz == 102 ) THEN - IF ( nlev <= 103 ) THEN - IsModelLev = .TRUE. - ENDIF + ! If input is 102 layer and output is 74 layer + ELSEIF ( nz == 74 ) THEN + IsModelLev = ( nlev == 102 .OR. nlev == 103 ) - ! Full GISS 40-layer grid - ELSEIF ( nz == 40 ) THEN - IF ( nlev <= 41 ) THEN - IsModelLev = .TRUE. - ENDIF + ! If input is 47 layer (or 36 layer) and output is 72 layer + ELSEIF ( nz == 72 ) THEN + IsModelLev = ( nlev == 47 .OR. nlev == 48 .OR. nlev == 36) - ! Reduced GISS 74-layer grid - ELSEIF ( nz == 74 ) THEN - IF ( nlev == 102 .OR. & - nlev == 103 .OR. & - nlev <= 74 ) THEN - IsModelLev = .TRUE. - ENDIF + ELSE + IsModelLev = .FALSE. ENDIF END SUBROUTINE ModelLev_Check @@ -578,46 +528,34 @@ END SUBROUTINE ModelLev_Check ! !DESCRIPTION: Subroutine ModelLev\_Interpolate puts 3D data from an ! arbitrary number of model levels onto the vertical levels of the simulation ! grid. Since the input data is already on model levels, this is only to -! inflate/collapse fields between native/reduced vertical levels, e.g. from -! 72 native GEOS-5 levels onto the reduced 47 levels. The vertical -! interpolation scheme depends on compiler switches. If none of the compiler -! switches listed below is used, no vertical interpolation is performed, -! e.g. the vertical levels of the input grid are retained. -!\\ -!\\ +! collapse fields between native/reduced vertical levels, e.g. from +! 72 native GEOS-5 levels onto the reduced 47 levels. +! +! ! The input data (REGR\_4D) is expected to be already regridded horizontally. ! The 4th dimension of REGR\_4D denotes time. -!\\ -!\\ +! +! ! The 3rd dimension of REGR\_3D holds the vertical levels. It is assumed that ! these are model levels, starting at the surface (level 1). If the input -! data holds 72 input levels, this is interpreted as native data and will -! be collapsed onto the reduced grid. If the input data holds X <=47 levels, -! these levels are interpreted as levels 1-X of the reduced grid. In other -! words, input data with 33 levels will be interpreted as 33 levels on the -! reduced grid, and the data is accordingly mapped onto the simulation grid. -! If data becomes inflated or collapsed, the output data will always extent -! over all vertical levels of the simulation grid. If necessary, the unused -! upper levels will be filled with zeros. If no data interpolation is needed, -! the vertical extent of the output data is limited to the number of used -! levels. For instance, if the input data has 5 vertical levels, the output -! array will only extent over those 5 (bottom) levels. -!\\ -!\\ +! data holds 72/73 input levels, this is interpreted as native data and will +! be collapsed onto the reduced GEOS-5 grid. If the input holds 102/103 input +! levels, this is interpreted as native data and will be collapsed onto the +! reduced GISS grid. If the input holds 47/48 input levels, this is interpreted +! as reduced GEOS-5 data and it will be inflated to the native GEOS-5 grid +! (with a warning, as this is not recommended). If the input holds 36 input levels, +! this is assumed to be the first 36 levels of the GEOS-5 grid, meaning they will be +! written as levels 1-36 of a 47 or 72 level output grid (with the remaining values +! left to be zero) (nbalasus, 8/29/2023). +! +! ! Currently, this routine can remap the following combinations: -!\begin{itemize} -! \item Native GEOS-5 onto reduced GEOS-5 (72 --> 47 levels) -! \item Reduced GEOS-5 onto native GEOS-5 (47 --> 72 levels) -! \item Native GEOS-4 onto reduced GEOS-4 (55 --> 30 levels) -! \item Reduced GEOS-4 onto native GEOS-4 (30 --> 55 levels) -! \item Native GEOS-5 onto native GEOS-4 (72 --> 55 levels) -! \item Reduced GEOS-5 onto native GEOS-4 (47 --> 55 levels) -! \item Native GEOS-5 onto reduced GEOS-4 (72 --> 30 levels) -! \item Reduced GEOS-5 onto reduced GEOS-4 (47 --> 30 levels) -!\end{itemize} -! Interpolation from GEOS-5 onto GEOS-4 levels is currently not supported. -!\\ -!\\ +! +! * Native GEOS-5 onto reduced GEOS-5 (72 --> 47 levels, 73 --> 48 edges) +! * Native GISS onto reduced GISS (102 --> 74 levels, 103 --> 75 edges) +! * Reduced GEOS-5 onto native GEOS-5 (47 --> 72 levels, 48 --> 73 edges) +! * 36 levels onto native/reduced GEOS-5 (36 --> levels 1-36 levels of 47/72 level grid, rest are 0) +! ! !INTERFACE: ! SUBROUTINE ModelLev_Interpolate( HcoState, REGR_4D, Lct, RC ) @@ -646,10 +584,10 @@ SUBROUTINE ModelLev_Interpolate( HcoState, REGR_4D, Lct, RC ) ! !LOCAL VARIABLES: ! INTEGER :: nx, ny, nz, nt + INTEGER :: fineIDX, coarseIDX INTEGER :: minlev, nlev, nout - INTEGER :: L, T, NL + INTEGER :: L, T, NL, I INTEGER :: OS - INTEGER :: G5T4 LOGICAL :: verb, infl, clps LOGICAL :: DONE CHARACTER(LEN=255) :: MSG, LOC @@ -678,10 +616,6 @@ SUBROUTINE ModelLev_Interpolate( HcoState, REGR_4D, Lct, RC ) ny = HcoState%NY nz = HcoState%NZ - ! Variable G5T4 is the # of GEOS-5 levels that need to be mapped - ! onto GEOS-4 levels. - G5T4 = 0 - ! Input data must be on horizontal HEMCO grid IF ( SIZE(REGR_4D,1) /= nx ) THEN WRITE(MSG,*) 'x dimension mismatch ', TRIM(Lct%Dct%cName), & @@ -700,6 +634,19 @@ SUBROUTINE ModelLev_Interpolate( HcoState, REGR_4D, Lct, RC ) nlev = SIZE(REGR_4D,3) nt = SIZE(REGR_4D,4) + ! Check to make sure ModelLev_Interpolate should have been called + IF ( ( ( nlev == nz ) .OR. ( nlev == nz+1 ) ) .OR. & ! write data without doing anything + ( ( nz == 47 ) .AND. ( ( nlev == 72 ) .OR. ( nlev == 73 ) ) ) .OR. & ! collapse native to reduced GEOS-5 + ( ( nz == 74 ) .AND. ( ( nlev == 102 ) .OR. ( nlev == 103 ) ) ) .OR. & ! collapse native to reduced GISS + ( ( nz == 72 ) .AND. ( ( nlev == 47 ) .OR. ( nlev == 48 ) ) ) .OR. & ! inflate reduced to native GEOS-5 + ( ( ( nz == 72 ) .OR. ( nz == 47 ) ) .AND. ( nlev == 36 ) ) ) THEN ! write 36 levels to reduced/native GEOS-5 + ! do nothing + ELSE + WRITE(MSG,*) 'ModelLev_Interpolate was called but MESSy should have been used: ',TRIM(Lct%Dct%cName) + CALL HCO_ERROR( MSG, RC ) + RETURN + ENDIF + ! Vertical interpolation done? DONE = .FALSE. @@ -736,28 +683,26 @@ SUBROUTINE ModelLev_Interpolate( HcoState, REGR_4D, Lct, RC ) IF ( .NOT. DONE ) THEN !---------------------------------------------------------------- - ! Native levels + ! Native to reduced GEOS-5 levels !---------------------------------------------------------------- - IF ( nz == 72 ) THEN - - ! Determine number of output levels. If the input data has - ! 47 or less levels, it is assumed to represent reduced - ! GEOS-5 levels and data is mapped accordingly. If input data - ! has more than 47 levels, it cannot be on the reduced grid - ! and mapping is done 1:1 - IF ( nlev > 36 .AND. nlev <= 48 ) THEN - IF ( nlev == 48 ) THEN - nz = nz + 1 - nout = nz - NL = 37 - ELSE - nout = nz - NL = 36 - ENDIF + IF ( nz == 47 ) THEN + + ! Determine if the variable is on model levels or edges + IF ( nlev == 72 ) THEN + NL = 36 + nout = 47 + ELSEIF ( nlev == 73 ) THEN + NL = 37 + nout = 48 + ELSEIF ( nlev == 36 ) THEN + NL = 36 + nout = 47 ELSE - nout = nlev - NL = nout - ENDIF + MSG = 'Can only remap from native onto reduced GEOS-5 if '// & + 'input data has exactly 72, 73, or 36 levels: '//TRIM(Lct%Dct%cName) + CALL HCO_ERROR( MSG, RC ) + RETURN + ENDIF ! nlev == (72,73,36,ELSE) ! Make sure output array is allocated CALL FileData_ArrCheck( HcoState%Config, Lct%Dct%Dta, nx, ny, nout, nt, RC ) @@ -770,60 +715,76 @@ SUBROUTINE ModelLev_Interpolate( HcoState, REGR_4D, Lct, RC ) Lct%Dct%Dta%V3(T)%Val(:,:,L) = REGR_4D(:,:,L,T) ENDDO !L - ! If needed, inflate from reduced GEOS-5 grid onto native GEOS-5 - IF ( ( NL == 36 .AND. nz == 72 ) .OR. & - ( NL == 37 .AND. nz == 73 ) ) THEN - ! Distribute over 2 levels (e.g. level 38 into 39-40): - CALL INFLATE( Lct, REGR_4D, NL+1 , NL+1, 2, T ) - CALL INFLATE( Lct, REGR_4D, NL+2 , NL+3, 2, T ) - CALL INFLATE( Lct, REGR_4D, NL+3 , NL+5, 2, T ) - CALL INFLATE( Lct, REGR_4D, NL+4 , NL+7, 2, T ) - ! Distribute over 4 levels: - CALL INFLATE( Lct, REGR_4D, NL+5 , NL+9, 4, T ) - CALL INFLATE( Lct, REGR_4D, NL+6 , NL+13, 4, T ) - CALL INFLATE( Lct, REGR_4D, NL+7 , NL+17, 4, T ) - CALL INFLATE( Lct, REGR_4D, NL+8 , NL+21, 4, T ) - CALL INFLATE( Lct, REGR_4D, NL+9 , NL+25, 4, T ) - CALL INFLATE( Lct, REGR_4D, NL+10, NL+29, 4, T ) - CALL INFLATE( Lct, REGR_4D, NL+11, NL+33, 4, T ) - ENDIF + ! If remapping model grid layers, collapse layers + IF ( nlev == 72 ) THEN + ! Collapse two levels (e.g. levels 37-38 into level 37): + CALL COLLAPSE( Lct, REGR_4D, 37, 37, 2, T, 5, RC ) + CALL COLLAPSE( Lct, REGR_4D, 38, 39, 2, T, 5, RC ) + CALL COLLAPSE( Lct, REGR_4D, 39, 41, 2, T, 5, RC ) + CALL COLLAPSE( Lct, REGR_4D, 40, 43, 2, T, 5, RC ) + ! Collapse four levels: + CALL COLLAPSE( Lct, REGR_4D, 41, 45, 4, T, 5, RC ) + CALL COLLAPSE( Lct, REGR_4D, 42, 49, 4, T, 5, RC ) + CALL COLLAPSE( Lct, REGR_4D, 43, 53, 4, T, 5, RC ) + CALL COLLAPSE( Lct, REGR_4D, 44, 57, 4, T, 5, RC ) + CALL COLLAPSE( Lct, REGR_4D, 45, 61, 4, T, 5, RC ) + CALL COLLAPSE( Lct, REGR_4D, 46, 65, 4, T, 5, RC ) + CALL COLLAPSE( Lct, REGR_4D, 47, 69, 4, T, 5, RC ) + ! If remapping model grid edges, sample at edges + ELSEIF ( nlev == 73 ) THEN + Lct%Dct%Dta%V3(T)%Val(:,:,38) = REGR_4D(:,:,39,T) + Lct%Dct%Dta%V3(T)%Val(:,:,39) = REGR_4D(:,:,41,T) + Lct%Dct%Dta%V3(T)%Val(:,:,40) = REGR_4D(:,:,43,T) + Lct%Dct%Dta%V3(T)%Val(:,:,41) = REGR_4D(:,:,45,T) + Lct%Dct%Dta%V3(T)%Val(:,:,42) = REGR_4D(:,:,49,T) + Lct%Dct%Dta%V3(T)%Val(:,:,43) = REGR_4D(:,:,53,T) + Lct%Dct%Dta%V3(T)%Val(:,:,44) = REGR_4D(:,:,57,T) + Lct%Dct%Dta%V3(T)%Val(:,:,45) = REGR_4D(:,:,61,T) + Lct%Dct%Dta%V3(T)%Val(:,:,46) = REGR_4D(:,:,65,T) + Lct%Dct%Dta%V3(T)%Val(:,:,47) = REGR_4D(:,:,69,T) + Lct%Dct%Dta%V3(T)%Val(:,:,48) = REGR_4D(:,:,73,T) + ! If the input is 36 levels, levels 37-47 are set to 0 + ELSEIF ( nlev == 36 ) THEN + DO L = 37,47 + Lct%Dct%Dta%V3(T)%Val(:,:,L) = 0.0_hp + ENDDO !L + ENDIF ! nlev == (72,73,36) ENDDO ! T ! Verbose IF ( HCO_IsVerb( HcoState%Config%Err ) ) THEN - WRITE(MSG,*) 'Mapped ', nlev, ' levels onto native GEOS-5 levels.' + WRITE(MSG,*) 'Mapped ', nlev, ' levels onto reduced GEOS-5 levels.' CALL HCO_MSG(HcoState%Config%Err,MSG) + IF ( nlev == 36 ) THEN + WRITE(MSG,*) 'The input variable has 36 L, which were written to be L 1-36 on the output 47 L grid (remaining values set to 0).' + ELSE + WRITE(MSG,*) 'Pressure-weighted vertical regridding was done - consider if this is appropriate for the variable units.' + CALL HCO_MSG(HcoState%Config%Err,MSG) + ENDIF ENDIF ! Done! DONE = .TRUE. !---------------------------------------------------------------- - ! Reduced levels + ! Native to reduced GISS levels !---------------------------------------------------------------- - ELSEIF ( nz == 47 ) THEN + ELSEIF ( nz == 74 ) THEN - ! Determine number of output levels. If input data is on the - ! native grid, we collapse them onto the reduced GEOS-5 grid. - ! In all other cases, we assume the input data is already on - ! the reduced levels and mappings occurs 1:1. - IF ( nlev == 72 ) THEN - nout = nz - NL = 36 - ELSEIF ( nlev == 73 ) THEN - nz = nz + 1 - nout = nz - NL = 37 - ELSEIF ( nlev > 47 ) THEN - MSG = 'Can only remap from native onto reduced GEOS-5 if '// & - 'input data has exactly 72 or 73 levels: '//TRIM(Lct%Dct%cName) + ! Determine if the variable is on model levels or edges + IF ( nlev == 102 ) THEN + NL = 60 + nout = 74 + ELSEIF ( nlev == 103 ) THEN + NL = 61 + nout = 75 + ELSE + MSG = 'Can only remap from native onto reduced GISS if '// & + 'input data has exactly 102 or 103 levels: '//TRIM(Lct%Dct%cName) CALL HCO_ERROR( MSG, RC ) RETURN - ELSE - nout = nlev - NL = nout - ENDIF + ENDIF ! nlev == (102,103,ELSE) ! Make sure output array is allocated CALL FileData_ArrCheck( HcoState%Config, Lct%Dct%Dta, nx, ny, nout, nt, RC ) @@ -836,36 +797,48 @@ SUBROUTINE ModelLev_Interpolate( HcoState, REGR_4D, Lct, RC ) Lct%Dct%Dta%V3(T)%Val(:,:,L) = REGR_4D(:,:,L,T) ENDDO !L - ! If needed, collapse from native GEOS-5 onto reduced GEOS-5 - IF ( nlev == 72 .OR. nlev == 73 ) THEN - - ! Add one level offset if these are edges - IF ( nlev == 73 ) THEN - OS = 1 - ELSE - OS = 0 - ENDIF - - ! Collapse two levels (e.g. levels 39-40 into level 38): - CALL COLLAPSE( Lct, REGR_4D, 37+OS, 37+OS, 2, T, 5 ) - CALL COLLAPSE( Lct, REGR_4D, 38+OS, 39+OS, 2, T, 5 ) - CALL COLLAPSE( Lct, REGR_4D, 39+OS, 41+OS, 2, T, 5 ) - CALL COLLAPSE( Lct, REGR_4D, 40+OS, 43+OS, 2, T, 5 ) + ! If remapping model grid layers, collapse layers + IF ( nlev == 102 ) THEN + ! Collapse two levels (e.g. levels 61-62 into level 61): + CALL COLLAPSE( Lct, REGR_4D, 61, 61, 2, T, 22, RC ) + CALL COLLAPSE( Lct, REGR_4D, 62, 63, 2, T, 22, RC ) + CALL COLLAPSE( Lct, REGR_4D, 63, 65, 2, T, 22, RC ) + CALL COLLAPSE( Lct, REGR_4D, 64, 67, 2, T, 22, RC ) + CALL COLLAPSE( Lct, REGR_4D, 65, 69, 2, T, 22, RC ) + CALL COLLAPSE( Lct, REGR_4D, 66, 71, 2, T, 22, RC ) + CALL COLLAPSE( Lct, REGR_4D, 67, 73, 2, T, 22, RC ) ! Collapse four levels: - CALL COLLAPSE( Lct, REGR_4D, 41+OS, 45+OS, 4, T, 5 ) - CALL COLLAPSE( Lct, REGR_4D, 42+OS, 49+OS, 4, T, 5 ) - CALL COLLAPSE( Lct, REGR_4D, 43+OS, 53+OS, 4, T, 5 ) - CALL COLLAPSE( Lct, REGR_4D, 44+OS, 57+OS, 4, T, 5 ) - CALL COLLAPSE( Lct, REGR_4D, 45+OS, 61+OS, 4, T, 5 ) - CALL COLLAPSE( Lct, REGR_4D, 46+OS, 65+OS, 4, T, 5 ) - CALL COLLAPSE( Lct, REGR_4D, 47+OS, 69+OS, 4, T, 5 ) - - ENDIF + CALL COLLAPSE( Lct, REGR_4D, 68, 75, 4, T, 22, RC ) + CALL COLLAPSE( Lct, REGR_4D, 69, 79, 4, T, 22, RC ) + CALL COLLAPSE( Lct, REGR_4D, 70, 83, 4, T, 22, RC ) + CALL COLLAPSE( Lct, REGR_4D, 71, 87, 4, T, 22, RC ) + CALL COLLAPSE( Lct, REGR_4D, 72, 91, 4, T, 22, RC ) + CALL COLLAPSE( Lct, REGR_4D, 73, 95, 4, T, 22, RC ) + CALL COLLAPSE( Lct, REGR_4D, 74, 99, 4, T, 22, RC ) + ! If remapping model grid edges, sample at the edges + ELSE + Lct%Dct%Dta%V3(T)%Val(:,:,62) = REGR_4D(:,:,63,T) + Lct%Dct%Dta%V3(T)%Val(:,:,63) = REGR_4D(:,:,65,T) + Lct%Dct%Dta%V3(T)%Val(:,:,64) = REGR_4D(:,:,67,T) + Lct%Dct%Dta%V3(T)%Val(:,:,65) = REGR_4D(:,:,69,T) + Lct%Dct%Dta%V3(T)%Val(:,:,66) = REGR_4D(:,:,71,T) + Lct%Dct%Dta%V3(T)%Val(:,:,67) = REGR_4D(:,:,73,T) + Lct%Dct%Dta%V3(T)%Val(:,:,68) = REGR_4D(:,:,75,T) + Lct%Dct%Dta%V3(T)%Val(:,:,69) = REGR_4D(:,:,79,T) + Lct%Dct%Dta%V3(T)%Val(:,:,70) = REGR_4D(:,:,83,T) + Lct%Dct%Dta%V3(T)%Val(:,:,71) = REGR_4D(:,:,87,T) + Lct%Dct%Dta%V3(T)%Val(:,:,72) = REGR_4D(:,:,91,T) + Lct%Dct%Dta%V3(T)%Val(:,:,73) = REGR_4D(:,:,95,T) + Lct%Dct%Dta%V3(T)%Val(:,:,74) = REGR_4D(:,:,99,T) + Lct%Dct%Dta%V3(T)%Val(:,:,75) = REGR_4D(:,:,103,T) + ENDIF ! nlev == (102,ELSE) ENDDO ! T ! Verbose - IF ( HCO_IsVerb( HcoState%Config%Err ) ) THEN - WRITE(MSG,*) 'Mapped ', nlev, ' levels onto reduced GEOS-5 levels.' + IF ( HCO_IsVerb(HcoState%Config%Err ) ) THEN + WRITE(MSG,*) 'Mapped ', nlev, ' levels onto reduced GISS levels.' + CALL HCO_MSG(HcoState%Config%Err,MSG) + WRITE(MSG,*) 'Pressure-weighted vertical regridding was done - consider if this is appropriate for the variable units.' CALL HCO_MSG(HcoState%Config%Err,MSG) ENDIF @@ -873,25 +846,26 @@ SUBROUTINE ModelLev_Interpolate( HcoState, REGR_4D, Lct, RC ) DONE = .TRUE. !---------------------------------------------------------------- - ! Reduced GISS levels + ! Reduced to native GEOS-5 levels !---------------------------------------------------------------- - ELSEIF ( nz == 74 ) THEN + ELSEIF ( nz == 72 ) THEN - ! Determine number of output levels. If input data is on the - ! native grid, we collapse them onto the reduced GISS grid. - ! In all other cases, we assume the input data is already on - ! the reduced levels and mappings occurs 1:1. - IF ( nlev == 102 ) THEN - nout = nz - NL = 60 - ELSEIF ( nlev == 103 ) THEN - nz = nz + 1 - nout = nz - NL = 61 + ! Determine if the variable is on model levels or edges + IF ( nlev == 47 ) THEN + NL = 36 + nout = 72 + ELSEIF ( nlev == 48 ) THEN + NL = 37 + nout = 73 + ELSEIF ( nlev == 36 ) THEN + NL = 36 + nout = 72 ELSE - nout = nlev - NL = nout - ENDIF + MSG = 'Can only remap from reduced onto native GEOS-5 if '// & + 'input data has exactly 47, 48, or 36 levels: '//TRIM(Lct%Dct%cName) + CALL HCO_ERROR( MSG, RC ) + RETURN + ENDIF ! nlev == (48,48,36,ELSE) ! Make sure output array is allocated CALL FileData_ArrCheck( HcoState%Config, Lct%Dct%Dta, nx, ny, nout, nt, RC ) @@ -904,74 +878,79 @@ SUBROUTINE ModelLev_Interpolate( HcoState, REGR_4D, Lct, RC ) Lct%Dct%Dta%V3(T)%Val(:,:,L) = REGR_4D(:,:,L,T) ENDDO !L - ! If needed, collapse from native GEOS-5 onto reduced GEOS-5 - IF ( nlev == 102 .OR. nlev == 103 ) THEN - - ! Add one level offset if these are edges - IF ( nlev == 103 ) THEN - OS = 1 - ELSE - OS = 0 - ENDIF - - ! Collapse two levels (e.g. levels 61-62 into level 61): - CALL COLLAPSE( Lct, REGR_4D, 61+OS, 61+OS, 2, T, 22 ) - CALL COLLAPSE( Lct, REGR_4D, 62+OS, 63+OS, 2, T, 22 ) - CALL COLLAPSE( Lct, REGR_4D, 63+OS, 65+OS, 2, T, 22 ) - CALL COLLAPSE( Lct, REGR_4D, 64+OS, 67+OS, 2, T, 22 ) - CALL COLLAPSE( Lct, REGR_4D, 65+OS, 69+OS, 2, T, 22 ) - CALL COLLAPSE( Lct, REGR_4D, 66+OS, 71+OS, 2, T, 22 ) - CALL COLLAPSE( Lct, REGR_4D, 67+OS, 73+OS, 2, T, 22 ) - ! Collapse four levels: - CALL COLLAPSE( Lct, REGR_4D, 68+OS, 75+OS, 4, T, 22 ) - CALL COLLAPSE( Lct, REGR_4D, 69+OS, 79+OS, 4, T, 22 ) - CALL COLLAPSE( Lct, REGR_4D, 70+OS, 83+OS, 4, T, 22 ) - CALL COLLAPSE( Lct, REGR_4D, 71+OS, 87+OS, 4, T, 22 ) - CALL COLLAPSE( Lct, REGR_4D, 72+OS, 91+OS, 4, T, 22 ) - CALL COLLAPSE( Lct, REGR_4D, 73+OS, 95+OS, 4, T, 22 ) - CALL COLLAPSE( Lct, REGR_4D, 74+OS, 99+OS, 4, T, 22 ) - - ENDIF + ! If remapping model grid layers, inflate layers + IF ( nlev == 47 ) THEN + + ! Inflate two levels (e.g. levels 37-38 on the fine grid are copies of level 37 on the coarse grid): + coarseIDX = 36 + DO I = 1,8 + fineIDX = 36 + I + IF ( MOD(I,2) /= 0 ) THEN + coarseIDX = coarseIDX + 1 + ENDIF + Lct%Dct%Dta%V3(T)%Val(:,:,fineIDX) = REGR_4D(:,:,coarseIDX,T) + ENDDO ! I + + ! Inflate four levels (e.g. levels 45-48 on the fine grid are copies of level 41 on the coarse grid) + coarseIDX = 40 + DO I = 1,28 + fineIDX = 44 + i + IF ( MOD(I-1,4) == 0 ) THEN + coarseIDX = coarseIDX + 1 + ENDIF + Lct%Dct%Dta%V3(T)%Val(:,:,fineIDX) = REGR_4D(:,:,coarseIDX,T) + ENDDO ! I + + ! If remapping model grid edges, inflate edges + ELSEIF ( nlev == 48 ) THEN + + ! Sample every two edges (e.g. edges 38-39 on the fine grid are copies of edge 38 on the coarse grid) + coarseIDX = 37 + DO I = 1,8 + fineIDX = 37 + I + IF ( MOD(I,2) /= 0 ) THEN + coarseIDX = coarseIDX + 1 + ENDIF + Lct%Dct%Dta%V3(T)%Val(:,:,fineIDX) = REGR_4D(:,:,coarseIDX,T) + ENDDO ! I + + ! Sample every four edges (e.g. edges 46-49 on the fine grid are copies of edge 42 on the coarse grid) + coarseIDX = 40 + DO I = 1,28 + fineIDX = 44 + i + IF ( MOD(I-1,4) == 0 ) THEN + coarseIDX = coarseIDX + 1 + ENDIF + Lct%Dct%Dta%V3(T)%Val(:,:,fineIDX) = REGR_4D(:,:,coarseIDX,T) + ENDDO ! I + + ELSEIF ( nlev == 36 ) THEN + DO L = 37,72 + Lct%Dct%Dta%V3(T)%Val(:,:,L) = 0.0_hp + ENDDO !L + + ENDIF ! nlev == (47,48,36) ENDDO ! T ! Verbose IF ( HCO_IsVerb(HcoState%Config%Err ) ) THEN - WRITE(MSG,*) 'Mapped ', nlev, ' levels onto reduced GISS levels.' + WRITE(MSG,*) 'Mapped ', nlev, ' levels onto native GEOS-5 levels.' + CALL HCO_MSG(HcoState%Config%Err,MSG) + IF ( nlev == 36 ) THEN + WRITE(MSG,*) 'The input variable has 36 L, which were written to be L 1-36 on the output 72 L grid (remaining values set to 0).' + ELSE + WRITE(MSG,*) 'Inflating from 47/48 to 72/73 levels is not recommended and is likely not mass-conserving.' + ENDIF CALL HCO_MSG(HcoState%Config%Err,MSG) ENDIF ! Done! DONE = .TRUE. - ENDIF + ENDIF ! nz == (47,74,72) ENDIF ! Vertical regridding required - !=================================================================== - ! For all other cases, do not do any vertical regridding - !=================================================================== - IF ( .NOT. DONE ) THEN - CALL FileData_ArrCheck( HcoState%Config, Lct%Dct%Dta, nx, ny, nlev, nt, RC ) - IF ( RC /= HCO_SUCCESS ) THEN - CALL HCO_ERROR( 'ERROR 3', RC, THISLOC=LOC ) - RETURN - ENDIF - - DO T = 1, nt - Lct%Dct%Dta%V3(T)%Val(:,:,:) = REGR_4D(:,:,:,T) - ENDDO - - ! Verbose - IF ( HCO_IsVerb( HcoState%Config%Err ) ) THEN - WRITE(MSG,*) 'Could not find vertical interpolation key - ', & - 'kept the original ', nlev, ' levels.' - CALL HCO_MSG(HcoState%Config%Err,MSG) - ENDIF - - ! Done! - DONE = .TRUE. - ENDIF - !=================================================================== ! Error check / verbose mode !=================================================================== @@ -1000,240 +979,17 @@ END SUBROUTINE ModelLev_Interpolate !------------------------------------------------------------------------------ !BOP ! -! !IROUTINE: GEOS5_TO_GEOS4_LOWLEV -! -! !DESCRIPTION: Helper routine to map the lowest 28 GEOS-5 levels onto the -! lowest 11 GEOS-4 levels. The individual level weights were calculated -! offline and are hard-coded here. -! These are the edge pressure values on the lowest 28 GEOS-5 levels: -! 1013.25, 998.05, 982.76, 967.47, 952.19, 936.91 -! 921.62, 906.34, 891.05, 875.77, 860.49, 845.21, -! 829.92, 809.55, 784.08, 758.62, 733.15, 707.69, -! 682.23, 644.05, 605.87, 567.70, 529.54, 491.40, -! 453.26, 415.15, 377.07, 339.00, 288.92 -! -! And these are the edge pressure values on the lowest 12 GEOS-4 levels: -! 1013.25, 998.16, 968.49, 914.79, 841.15, 752.89, -! 655.96, 556.85, 472.64, 401.14, 340.43, 288.92 -! -! The value at every given GEOS-4 level is determined from the GEOS-5 values -! by multiplying the (GEOS-5) input data by the normalized level weights. For -! instance, the first GEOS-5 level is the only level contributing to the 1st -! GEOS-4 level. For the 2nd GEOS-4 level, contributions from GEOS-5 levels -! 1-3 are used. Of GEOS-5 level 1, only 0.7% lies in level 2 of GEOS-4 (99.3% -! is in GEOS-4 level 1), whereas 100% of GEOS-5 level 2 and 93.3% of GEOS-5 -! level 3 contribute to GEOS-4 level 2. The corresponding normalized weights -! become 0.00378,0.515, and 0.481, respectively. -!\\ -!\\ -! The weights don't always add up to exactly 1.00 due to rounding errors. -!\\ -!\\ -! !INTERFACE: -! - SUBROUTINE GEOS5_TO_GEOS4_LOWLEV( HcoState, Lct, REGR_4D, NZ, T, RC ) -! -! !INPUT PARAMETERS: -! - TYPE(HCO_State), POINTER :: HcoState ! HEMCO state object - REAL(sp), POINTER :: REGR_4D(:,:,:,:) ! 4D input data - INTEGER, INTENT(IN) :: T ! Time index - INTEGER, INTENT(IN) :: NZ ! # of vertical levels to remap. Must be 28 or 29 -! -! !INPUT/OUTPUT PARAMETERS: -! - TYPE(ListCont), POINTER :: Lct ! HEMCO list container - INTEGER, INTENT(INOUT) :: RC ! Return code -! -! !REVISION HISTORY: -! 07 Jan 2015 - C. Keller - Initial version. -! See https://github.com/geoschem/hemco for complete history -!EOP -!------------------------------------------------------------------------------ -!BOC - REAL(hp) :: WGHT - CHARACTER(LEN=255) :: MSG - CHARACTER(LEN=255) :: LOC = 'GEOS5_TO_GEOS4_LOWLEV (hco_interp_mod.F90)' - - !================================================================= - ! GEOS5_TO_GEOS4_LOWLEV begins here - !================================================================= - - ! Check number of levels to be used - IF ( NZ /= 28 .AND. NZ /= 29 ) THEN - MSG = 'Cannot map GEOS-5 onto GEOS-4 data, number of levels must be 28 or 29: '//TRIM(Lct%Dct%cName) - CALL HCO_ERROR ( MSG, RC, THISLOC=LOC ) - RETURN - ENDIF - - ! Error check: make sure array REGR_4D has at least NZ levels - IF ( SIZE(REGR_4D,3) < NZ ) THEN - WRITE(MSG,*) 'Cannot map GEOS-5 onto GEOS-4 data, original data has not enough levels: ', & - TRIM(Lct%Dct%cName), ' --> ', SIZE(REGR_4D,3), ' smaller than ', NZ - CALL HCO_ERROR ( MSG, RC, THISLOC=LOC ) - RETURN - ENDIF - - ! Map 28 GEOS-5 levels onto 11 GEOS-4 levels (grid midpoints): - IF ( NZ == 28 ) THEN - - ! Reset - Lct%Dct%Dta%V3(T)%Val(:,:,1:11) = 0.0_sp - - ! Level 1: - Lct%Dct%Dta%V3(T)%Val(:,:, 1) = REGR_4D(:,:,1,T) - - ! Level 2: - Lct%Dct%Dta%V3(T)%Val(:,:, 2) = 3.78e-3_sp * REGR_4D(:,:, 1,T) & - + 0.515_sp * REGR_4D(:,:, 2,T) & - + 0.481_sp * REGR_4D(:,:, 3,T) - - ! Level 3: - Lct%Dct%Dta%V3(T)%Val(:,:, 3) = 1.88e-2_sp * REGR_4D(:,:, 3,T) & - + 0.285_sp * REGR_4D(:,:, 4,T) & - + 0.285_sp * REGR_4D(:,:, 5,T) & - + 0.285_sp * REGR_4D(:,:, 6,T) & - + 0.127_sp * REGR_4D(:,:, 7,T) - - ! Level 4: - Lct%Dct%Dta%V3(T)%Val(:,:, 4) = 0.115_sp * REGR_4D(:,:, 7,T) & - + 0.208_sp * REGR_4D(:,:, 8,T) & - + 0.208_sp * REGR_4D(:,:, 9,T) & - + 0.208_sp * REGR_4D(:,:,10,T) & - + 0.208_sp * REGR_4D(:,:,11,T) & - + 5.51e-2_sp * REGR_4D(:,:,12,T) - - ! Level 5: - Lct%Dct%Dta%V3(T)%Val(:,:, 5) = 0.189_sp * REGR_4D(:,:,12,T) & - + 0.253_sp * REGR_4D(:,:,13,T) & - + 0.253_sp * REGR_4D(:,:,14,T) & - + 0.253_sp * REGR_4D(:,:,15,T) & - + 5.68e-2_sp * REGR_4D(:,:,16,T) - - ! Level 6: - Lct%Dct%Dta%V3(T)%Val(:,:, 6) = 0.224_sp * REGR_4D(:,:,16,T) & - + 0.289_sp * REGR_4D(:,:,17,T) & - + 0.289_sp * REGR_4D(:,:,18,T) & - + 0.199_sp * REGR_4D(:,:,19,T) - - ! Level 7: - Lct%Dct%Dta%V3(T)%Val(:,:, 7) = 0.120_sp * REGR_4D(:,:,19,T) & - + 0.385_sp * REGR_4D(:,:,20,T) & - + 0.385_sp * REGR_4D(:,:,21,T) & - + 0.110_sp * REGR_4D(:,:,22,T) - - ! Level 8: - Lct%Dct%Dta%V3(T)%Val(:,:, 8) = 0.324_sp * REGR_4D(:,:,22,T) & - + 0.453_sp * REGR_4D(:,:,23,T) & - + 0.223_sp * REGR_4D(:,:,24,T) - - ! Level 9: - Lct%Dct%Dta%V3(T)%Val(:,:, 9) = 0.271_sp * REGR_4D(:,:,24,T) & - + 0.533_sp * REGR_4D(:,:,25,T) & - + 0.196_sp * REGR_4D(:,:,26,T) - - ! Level 10: - Lct%Dct%Dta%V3(T)%Val(:,:,10) = 0.396_sp * REGR_4D(:,:,26,T) & - + 0.604_sp * REGR_4D(:,:,27,T) - - ! Level 11: - Lct%Dct%Dta%V3(T)%Val(:,:,11) = 3.63e-2_sp * REGR_4D(:,:,27,T) & - + 0.964_sp * REGR_4D(:,:,28,T) - - ! Map 29 GEOS-5 levels onto 12 GEOS-4 levels (grid edges): - ELSEIF ( NZ == 29 ) THEN - - ! Reset - Lct%Dct%Dta%V3(T)%Val(:,:,1:12) = 0.0_sp - - ! Level 1 - Lct%Dct%Dta%V3(T)%Val(:,:, 1) = REGR_4D(:,:,1,T) - - ! Level 2: - Lct%Dct%Dta%V3(T)%Val(:,:, 2) = 5.01e-3_sp * REGR_4D(:,:, 1,T) & - + 0.680_sp * REGR_4D(:,:, 2,T) & - + 0.314_sp * REGR_4D(:,:, 3,T) - - ! Level 3: - Lct%Dct%Dta%V3(T)%Val(:,:, 3) = 0.197_sp * REGR_4D(:,:, 3,T) & - + 0.366_sp * REGR_4D(:,:, 4,T) & - + 0.366_sp * REGR_4D(:,:, 5,T) & - + 6.98e-2_sp * REGR_4D(:,:, 6,T) - - ! Level 4: - Lct%Dct%Dta%V3(T)%Val(:,:, 4) = 0.194_sp * REGR_4D(:,:, 6,T) & - + 0.240_sp * REGR_4D(:,:, 7,T) & - + 0.240_sp * REGR_4D(:,:, 8,T) & - + 0.240_sp * REGR_4D(:,:, 9,T) & - + 8.55e-2_sp * REGR_4D(:,:,10,T) - - ! Level 5: - Lct%Dct%Dta%V3(T)%Val(:,:, 5) = 0.139_sp * REGR_4D(:,:,10,T) & - + 0.216_sp * REGR_4D(:,:,11,T) & - + 0.216_sp * REGR_4D(:,:,12,T) & - + 0.216_sp * REGR_4D(:,:,13,T) & - + 0.214_sp * REGR_4D(:,:,14,T) - - ! Level 6: - Lct%Dct%Dta%V3(T)%Val(:,:, 6) = 2.20e-2_sp * REGR_4D(:,:,14,T) & - + 0.275_sp * REGR_4D(:,:,15,T) & - + 0.275_sp * REGR_4D(:,:,16,T) & - + 0.275_sp * REGR_4D(:,:,17,T) & - + 0.173_sp * REGR_4D(:,:,18,T) - - ! Level 7: - Lct%Dct%Dta%V3(T)%Val(:,:, 7) = 0.130_sp * REGR_4D(:,:,18,T) & - + 0.345_sp * REGR_4D(:,:,19,T) & - + 0.345_sp * REGR_4D(:,:,20,T) & - + 0.170_sp * REGR_4D(:,:,21,T) - - ! Level 8: - Lct%Dct%Dta%V3(T)%Val(:,:, 8) = 0.214_sp * REGR_4D(:,:,21,T) & - + 0.416_sp * REGR_4D(:,:,22,T) & - + 0.370_sp * REGR_4D(:,:,23,T) - - ! Level 9: - Lct%Dct%Dta%V3(T)%Val(:,:, 9) = 5.49e-2_sp * REGR_4D(:,:,23,T) & - + 0.490_sp * REGR_4D(:,:,24,T) & - + 0.455_sp * REGR_4D(:,:,25,T) - - ! Level 10: - Lct%Dct%Dta%V3(T)%Val(:,:,10) = 4.06e-2_sp * REGR_4D(:,:,25,T) & - + 0.576_sp * REGR_4D(:,:,26,T) & - + 0.383_sp * REGR_4D(:,:,27,T) - - ! Level 11: - Lct%Dct%Dta%V3(T)%Val(:,:,11) = 0.254_sp * REGR_4D(:,:,27,T) & - + 0.746_sp * REGR_4D(:,:,28,T) - - ! Level 12: - Lct%Dct%Dta%V3(T)%Val(:,:,12) = 1.60e-2_sp * REGR_4D(:,:,28,T) & - + 0.984_sp * REGR_4D(:,:,29,T) - - ENDIF - - ! Return with success - RC = HCO_SUCCESS - - END SUBROUTINE GEOS5_TO_GEOS4_LOWLEV -!EOC -!------------------------------------------------------------------------------ -! Harmonized Emissions Component (HEMCO) ! -!------------------------------------------------------------------------------ -!BOP -! ! !IROUTINE: COLLAPSE ! ! !DESCRIPTION: Helper routine to collapse input levels onto the output grid. ! The input data is weighted by the grid box thicknesses defined on top of ! this module. The input parameter T determines the time slice to be considered, -! and MET denotes the met field type of the input data (4 = GEOS-4 levels, GEOS-5 -! otherwise). +! and MET denotes the met field type of the input data (22 = GISS, 5= GEOS-5). !\\ !\\ ! !INTERFACE: ! - SUBROUTINE COLLAPSE ( Lct, REGR_4D, OutLev, InLev1, NLEV, T, MET ) + SUBROUTINE COLLAPSE ( Lct, REGR_4D, OutLev, InLev1, NLEV, T, MET, RC ) ! ! !INPUT PARAMETERS: ! @@ -1242,11 +998,12 @@ SUBROUTINE COLLAPSE ( Lct, REGR_4D, OutLev, InLev1, NLEV, T, MET ) INTEGER, INTENT(IN) :: InLev1 INTEGER, INTENT(IN) :: NLEV INTEGER, INTENT(IN) :: T - INTEGER, INTENT(IN) :: MET ! 4=GEOS-4, 22=GISS E2.2, else GEOS-5 + INTEGER, INTENT(IN) :: MET ! 22=GISS E2.2, else GEOS-5 ! ! !INPUT/OUTPUT PARAMETERS: ! TYPE(ListCont), POINTER :: Lct ! HEMCO list container + INTEGER, INTENT(INOUT) :: RC ! Success or failure? ! ! !REVISION HISTORY: ! 30 Dec 2014 - C. Keller - Initial version @@ -1258,6 +1015,8 @@ SUBROUTINE COLLAPSE ( Lct, REGR_4D, OutLev, InLev1, NLEV, T, MET ) REAL(hp) :: THICK REAL(hp), POINTER :: EDG(:) REAL(hp), ALLOCATABLE :: WGT(:) + CHARACTER(LEN=255) :: MSG + CHARACTER(LEN=255) :: LOC = 'ModelLev_Interpolate (hco_interp_mod.F90)' !================================================================= ! COLLAPSE begins here @@ -1274,24 +1033,26 @@ SUBROUTINE COLLAPSE ( Lct, REGR_4D, OutLev, InLev1, NLEV, T, MET ) IF ( NZ < InLev1 ) RETURN ! Get maximum level to be used for pressure thickness calculations. - TOPLEV = InLev1 + ( NLEV-1 ) + TOPLEV = InLev1 + NLEV ! Get pointer to grid edges on the native input grid - IF ( Met == 4 ) THEN - EDG => G4_EDGE_NATIVE(InLev1:TOPLEV) - ELSE IF ( Met == 22 ) THEN + IF ( Met == 22 ) THEN EDG => E102_EDGE_NATIVE(InLev1:TOPLEV) - ELSE + ELSEIF ( Met == 5 ) THEN EDG => G5_EDGE_NATIVE(InLev1:TOPLEV) + ELSE + WRITE(MSG,*) 'The Met value given was not valid: ', Met + CALL HCO_ERROR( MSG, RC, THISLOC=LOC ) + RETURN ENDIF ! Thickness of output level - THICK = EDG(1) - EDG(NLEV) + THICK = EDG(1) - EDG(NLEV+1) ! Get level weights ALLOCATE(WGT(NLEV)) WGT = 0.0 - DO I = 1, NLEV-1 + DO I = 1, NLEV WGT(I) = ( EDG(I) - EDG(I+1) ) / THICK ENDDO @@ -1310,73 +1071,4 @@ SUBROUTINE COLLAPSE ( Lct, REGR_4D, OutLev, InLev1, NLEV, T, MET ) END SUBROUTINE COLLAPSE !EOC -!------------------------------------------------------------------------------ -! Harmonized Emissions Component (HEMCO) ! -!------------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: INFLATE -! -! !DESCRIPTION: Helper routine to inflate input levels onto the output grid. -! The values on the input data are evenly distributed amongst all output -! levels. -!\\ -!\\ -! !INTERFACE: -! - SUBROUTINE INFLATE ( Lct, REGR_4D, InLev, OutLev1, NLEV, T ) -! -! !INPUT PARAMETERS: -! - REAL(sp), POINTER :: REGR_4D(:,:,:,:) ! 4D input data - INTEGER, INTENT(IN) :: InLev - INTEGER, INTENT(IN) :: OutLev1 - INTEGER, INTENT(IN) :: NLEV - INTEGER, INTENT(IN) :: T -! -! !INPUT/OUTPUT PARAMETERS: -! - TYPE(ListCont), POINTER :: Lct ! HEMCO list container -! -! !REVISION HISTORY: -! 30 Dec 2014 - C. Keller - Initial version -! See https://github.com/geoschem/hemco for complete history -!EOP -!------------------------------------------------------------------------------ -!BOC - INTEGER :: I, DZ, NZ, ILEV - - !================================================================= - ! INFLATE begins here - !================================================================= - - ! Get input data array - NZ = SIZE( REGR_4D, 3 ) - - ! Get size of data array in the HEMCO state (bmy, 22 Mar 2022) - DZ = SIZE( Lct%Dct%Dta%V3(T)%Val, 3 ) - - ! Do for every output level - DO I = 1, NLEV - - ! Current output level - ILEV = OutLev1 + I - 1 - - ! Avoid out-of-bounds errors if ILEV is greater than the - ! number of levels in Lct%Dct%Dta%V3(T)%Val (bmy, 22 Mar 2022) - IF ( ILEV > DZ ) EXIT - - ! If input level is beyond vert. extent of input data, set output - ! data to zero. - IF ( InLev > NZ ) THEN - Lct%Dct%Dta%V3(T)%Val(:,:,ILEV) = 0.0_hp - - ! Otherwise, evenly distribute input data - ELSE - Lct%Dct%Dta%V3(T)%Val(:,:,ILEV) = REGR_4D(:,:,InLev,T) - ENDIF - ENDDO - - END SUBROUTINE INFLATE -!EOC END MODULE HCO_Interp_Mod diff --git a/src/Core/hcoio_read_std_mod.F90 b/src/Core/hcoio_read_std_mod.F90 index fab7a07e..02eb44b9 100644 --- a/src/Core/hcoio_read_std_mod.F90 +++ b/src/Core/hcoio_read_std_mod.F90 @@ -125,8 +125,6 @@ SUBROUTINE HCOIO_Read( HcoState, Lct, RC ) USE HCO_Ncdf_Mod, ONLY : NC_Read_Arr USE HCO_Ncdf_Mod, ONLY : NC_Get_Grid_Edges USE HCO_Ncdf_Mod, ONLY : NC_Get_Sigma_Levels - USE HCO_Ncdf_Mod, ONLY : NC_IsModelLevel - USE HCO_Ncdf_Mod, ONLY : NC_IsSigmaLevel USE HCO_CHARPAK_MOD, ONLY : TRANLC USE HCO_Unit_Mod, ONLY : HCO_Unit_Change USE HCO_Unit_Mod, ONLY : HCO_Unit_ScalCheck @@ -690,32 +688,19 @@ SUBROUTINE HCOIO_Read( HcoState, Lct, RC ) RETURN ENDIF - ! Are these model levels? This will only return true if the long - ! name of the level variable contains "GEOS-Chem level". - ! For now, we assume levels are already on model levels if the - ! number of levels to be read is explicitly set in the configuration - ! file (ckeller, 5/20/15). + ! Are these model levels? This will only return true if + ! (1) the variable is on 72/73 levels and you are going to 47 + ! levels, (2) if you are on 102/103 levels and you are going + ! to 74 levels, (3) if you are on 47/48 levels and you are + ! going to 72 levels. Otherwise, use MESSy (nbalasus, 8/24/2023). IF ( Lct%Dct%Dta%Levels == 0 ) THEN - ! Check if vertical coordinate is GEOS-Chem levels - IsModelLevel = NC_IsModelLevel( ncLun, LevName ) - - ! Further check if the given number of vertical levels should be - ! treated as model levels. This is the case if e.g. the nuber of - ! levels found on the file exactly matches the number of vertical - ! levels of the grid. Some of these assumptions are rather arbitrary. - ! IsModelLev will stay True if is was set so in NC_ISMODELLEVEL - ! above. (ckeller, 9/29/15) CALL ModelLev_Check( HcoState, nlev, IsModelLevel, RC ) IF ( RC /= HCO_SUCCESS ) THEN CALL HCO_ERROR( 'ERROR 3', RC, THISLOC=LOC ) RETURN ENDIF - ! Override IsModelLevel if the long_name contains - ! "atmospheric_hybrid_sigma_pressure_coordinate" - IsModelLevel = ( .not. NC_IsSigmaLevel( ncLun, LevName ) ) - ! Set level indeces to be read lev1 = 1 lev2 = nlev @@ -723,10 +708,6 @@ SUBROUTINE HCOIO_Read( HcoState, Lct, RC ) ! If levels are explicitly given: ELSE - ! If long_name is "atmospheric_hybrid_sigma_pressure_coordinate", - ! then treat it as sigma levels; otherwise assume model levels. - IsModelLevel = ( .not. NC_IsSigmaLevel( ncLun, LevName ) ) - ! Number of levels to be read must be smaller or equal to total ! number of available levels IF ( ABS(Lct%Dct%Dta%Levels) > nlev ) THEN @@ -747,6 +728,9 @@ SUBROUTINE HCOIO_Read( HcoState, Lct, RC ) lev2 = nlev + Lct%Dct%Dta%Levels + 1 ENDIF + ! Use MESSy regridding + IsModelLevel = .FALSE. + ENDIF ! Verbose @@ -755,6 +739,11 @@ SUBROUTINE HCOIO_Read( HcoState, Lct, RC ) CALL HCO_MSG(HcoState%Config%Err,MSG) ENDIF + IF ( HCO_IsVerb( HcoState%Config%Err ) .AND. IsModelLevel ) THEN + WRITE(MSG,*) 'Data is assumed to already be on the model level grid' + CALL HCO_MSG(HcoState%Config%Err,MSG) + ENDIF + ! For 2D data, set lev1 and lev2 to zero. This will ignore ! the level dimension in the netCDF reading call that follows. ELSE diff --git a/src/Core/hcoio_write_std_mod.F90 b/src/Core/hcoio_write_std_mod.F90 index 5119f8d0..14b7688f 100644 --- a/src/Core/hcoio_write_std_mod.F90 +++ b/src/Core/hcoio_write_std_mod.F90 @@ -547,7 +547,7 @@ SUBROUTINE HCOIO_Write( HcoState, ForceWrite, & VarUnit = 'Pa', & DataType = dp, & VarCt = VarCt, & - Compress = .TRUE. ) + Compress = .FALSE. ) CALL NC_Var_Write( fId, 'P0', P0 ) ! Deallocate arrays diff --git a/src/Extensions/hcox_gfed_include_gfed4.H b/src/Extensions/hcox_gfed_include_gfed4.H index d3103e11..148368e2 100644 --- a/src/Extensions/hcox_gfed_include_gfed4.H +++ b/src/Extensions/hcox_gfed_include_gfed4.H @@ -328,12 +328,12 @@ Inst%GFED4_EMFAC(31,6)=Inst%GFED4_EMFAC(1,6) ! AGRI ! HG0 GFED4_SPEC_NAME(32)="Hg0" -Inst%GFED4_EMFAC(32,1)=7.23E-08_hp ! SAV -- SAVA -Inst%GFED4_EMFAC(32,2)=1.50E-07_hp ! FOR -- BORF -Inst%GFED4_EMFAC(32,3)=1.50E-07_hp ! FOR -- TEMP -Inst%GFED4_EMFAC(32,4)=5.85E-08_hp ! DEF -- DEFO -Inst%GFED4_EMFAC(32,5)=7.56E-08_hp ! PET -- PEAT -Inst%GFED4_EMFAC(32,6)=4.48E-08_hp ! AGW -- AGRI +Inst%GFED4_EMFAC(32,1)=7.17E-07_hp * Inst%GFED4_EMFAC(1,1) ! SAV -- SAVA +Inst%GFED4_EMFAC(32,2)=7.17E-07_hp * Inst%GFED4_EMFAC(1,2) ! FOR -- BORF +Inst%GFED4_EMFAC(32,3)=7.17E-07_hp * Inst%GFED4_EMFAC(1,3) ! FOR -- TEMP +Inst%GFED4_EMFAC(32,4)=7.17E-07_hp * Inst%GFED4_EMFAC(1,4) ! DEF -- DEFO +Inst%GFED4_EMFAC(32,5)=7.17E-07_hp * Inst%GFED4_EMFAC(1,5) ! PET -- PEAT +Inst%GFED4_EMFAC(32,6)=7.17E-07_hp * Inst%GFED4_EMFAC(1,6) ! AGW -- AGRI ! HAC - not traced per carbon - from Akagi et al, 2011 GFED4_SPEC_NAME(33)="HAC" diff --git a/src/Shared/NcdfUtil/hco_m_netcdf_io_checks.F90 b/src/Shared/NcdfUtil/hco_m_netcdf_io_checks.F90 index b3fdb2ee..e51043bf 100644 --- a/src/Shared/NcdfUtil/hco_m_netcdf_io_checks.F90 +++ b/src/Shared/NcdfUtil/hco_m_netcdf_io_checks.F90 @@ -1,5 +1,5 @@ !------------------------------------------------------------------------------ -! NcdfUtilities: by Harvard Atmospheric Chemistry Modeling Group ! +! Ncdfutilities: by Harvard Atmospheric Chemistry Modeling Group ! ! and NASA/GSFC, SIVO, Code 610.3 ! !------------------------------------------------------------------------------ !BOP @@ -26,7 +26,7 @@ module HCO_m_netcdf_io_checks ! Jules Kouatchou ! ! !REVISION HISTORY: -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------- !BOC @@ -44,9 +44,7 @@ module HCO_m_netcdf_io_checks ! function Ncdoes_Udim_Exist (ncid) ! - implicit none -! - include "netcdf.inc" + use netCDF ! ! !INPUT PARAMETERS: !! ncid : netCDF file id to check @@ -63,25 +61,18 @@ function Ncdoes_Udim_Exist (ncid) ! John Tannahill (LLNL) and Jules Kouatchou ! ! !REVISION HISTORY: -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC ! ! !LOCAL VARIABLES: - integer :: ierr - integer :: udimid -! - ierr = Nf_Inq_Unlimdim (ncid, udimid) - - if (ierr == NF_NOERR) then - Ncdoes_Udim_Exist = .true. - else - Ncdoes_Udim_Exist = .false. - end if - - return + integer :: ierr, udim_id + Ncdoes_Udim_Exist = .false. + ierr = NF90_Inquire(ncid, unlimitedDimId=udim_id) + IF ( ierr /= NF90_NOERR ) Ncdoes_Udim_Exist = .true. + end function Ncdoes_Udim_Exist !EOC !------------------------------------------------------------------------------ @@ -96,9 +87,7 @@ end function Ncdoes_Udim_Exist ! function Ncdoes_Var_Exist (ncid, varname) ! - implicit none -! - include "netcdf.inc" + use netCDF ! ! !INPUT PARAMETERS: !! ncid : netCDF file id to check @@ -117,7 +106,7 @@ function Ncdoes_Var_Exist (ncid, varname) ! John Tannahill (LLNL) and Jules Kouatchou ! ! !REVISION HISTORY: -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC @@ -126,15 +115,9 @@ function Ncdoes_Var_Exist (ncid, varname) integer :: ierr integer :: varid ! - ierr = Nf_Inq_Varid (ncid, varname, varid) - - if (ierr == NF_NOERR) then - Ncdoes_Var_Exist = .true. - else - Ncdoes_Var_Exist = .false. - end if - - return + ierr = NF90_Inq_Varid(ncid, varname, varid) + Ncdoes_Var_Exist = .false. + if (ierr == NF90_NOERR) Ncdoes_Var_Exist = .true. end function Ncdoes_Var_Exist !EOC @@ -148,11 +131,9 @@ end function Ncdoes_Var_Exist ! ! !INTERFACE: ! - function Ncdoes_Attr_Exist (ncid, varname, attname, attType) + function Ncdoes_Attr_Exist(ncid, varname, attname, attType) ! - implicit none -! - include "netcdf.inc" + use netCDF ! ! !INPUT PARAMETERS: !! ncid : netCDF file id to check @@ -179,33 +160,30 @@ function Ncdoes_Attr_Exist (ncid, varname, attname, attType) ! John Tannahill (LLNL) and Jules Kouatchou ! ! !REVISION HISTORY: -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC ! ! !LOCAL VARIABLES: - integer :: ierr - integer :: varid - INTEGER :: attLen + INTEGER :: ierr, varId, attLen, attNum ! Init Ncdoes_Attr_Exist = .false. attType = -1 ! First check the variable - ierr = Nf_Inq_Varid (ncid, varname, varid) + ierr = NF90_Inq_Varid (ncid, varname, varid) ! Check the attribute if variable was found - IF ( ierr == NF_NOERR ) THEN - ierr = Nf_Inq_Att( ncId, varId, attName, attType, attLen ) - IF ( ierr == NF_NOERR ) THEN + IF ( ierr == NF90_NOERR ) THEN + ierr = NF90_Inquire_Attribute( ncId, varId, attName, & + attType, attLen, attNum ) + IF ( ierr == NF90_NOERR ) THEN NcDoes_Attr_Exist = .TRUE. ENDIF ENDIF - return - end function Ncdoes_Attr_Exist !EOC !------------------------------------------------------------------------------ @@ -220,9 +198,7 @@ end function Ncdoes_Attr_Exist ! function Ncdoes_Dim_Exist (ncid, dimname ) ! - implicit none -! - include "netcdf.inc" + use netCDF ! ! !INPUT PARAMETERS: !! ncid : netCDF file id to check @@ -241,7 +217,7 @@ function Ncdoes_Dim_Exist (ncid, dimname ) ! John Tannahill (LLNL) and Jules Kouatchou ! ! !REVISION HISTORY: -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !----------------------------------------------------------------------------- !BOC @@ -251,14 +227,11 @@ function Ncdoes_Dim_Exist (ncid, dimname ) integer :: dimid ! First check the variable - ierr = Nf_Inq_Dimid (ncid, dimname, dimid) + ierr = NF90_Inq_Dimid(ncid, dimname, dimid) ! Check the attribute if variable was found - if (ierr == NF_NOERR) then - Ncdoes_Dim_Exist = .true. - else - Ncdoes_Dim_Exist = .false. - end if + Ncdoes_Dim_Exist = .false. + if (ierr == NF90_NOERR) Ncdoes_Dim_Exist = .true. return diff --git a/src/Shared/NcdfUtil/hco_m_netcdf_io_close.F90 b/src/Shared/NcdfUtil/hco_m_netcdf_io_close.F90 index 81e2f9d3..4f593a8d 100644 --- a/src/Shared/NcdfUtil/hco_m_netcdf_io_close.F90 +++ b/src/Shared/NcdfUtil/hco_m_netcdf_io_close.F90 @@ -44,11 +44,8 @@ subroutine Nccl (ncid) ! ! !USES: ! + use netCDF use m_do_err_out -! - implicit none -! - include "netcdf.inc" ! ! !INPUT PARAMETERS: !! ncid : netCDF file id @@ -70,10 +67,10 @@ subroutine Nccl (ncid) character (len=512) :: err_msg integer :: ierr ! - ierr = Nf_Close (ncid) + ierr = Nf90_Close (ncid) - if (ierr /= NF_NOERR) then - err_msg = 'In Nccl: ' // Nf_Strerror (ierr) + if (ierr /= NF90_NOERR) then + err_msg = 'In Nccl: ' // Nf90_Strerror (ierr) call Do_Err_Out (err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) end if @@ -93,9 +90,7 @@ end subroutine Nccl ! subroutine Nccl_Noerr (ncid) ! - implicit none -! - include "netcdf.inc" + use netCDF ! ! !INPUT PARAMETERS: !! ncid : netCDF file id @@ -117,7 +112,7 @@ subroutine Nccl_Noerr (ncid) ! !LOCAL VARIABLES: integer :: ierr ! - ierr = Nf_Close (ncid) + ierr = Nf90_Close (ncid) return diff --git a/src/Shared/NcdfUtil/hco_m_netcdf_io_create.F90 b/src/Shared/NcdfUtil/hco_m_netcdf_io_create.F90 index ccf91853..a0ef592a 100644 --- a/src/Shared/NcdfUtil/hco_m_netcdf_io_create.F90 +++ b/src/Shared/NcdfUtil/hco_m_netcdf_io_create.F90 @@ -24,7 +24,7 @@ module HCO_m_netcdf_io_create ! Jules Kouatchou ! ! !REVISION HISTORY: -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC @@ -44,18 +44,15 @@ subroutine Nccr_Wr (ncid, filname, WRITE_NC4) ! ! !USES: ! + use netCDF use m_do_err_out -! - implicit none -! - include "netcdf.inc" ! ! !INPUT PARAMETERS: ! ncid : opened netCDF file id ! filname : name of netCDF file to open for writing - integer , intent(in) :: ncid - character (len=*), intent(in) :: filname - LOGICAL, OPTIONAL, INTENT(IN) :: WRITE_NC4 + integer , intent(INOUT) :: ncid + character (len=*), intent(IN) :: filname + LOGICAL, OPTIONAL, INTENT(IN) :: WRITE_NC4 ! ! !DESCRIPTION: Creates a netCDF file for writing and does some error checking. !\\ @@ -64,13 +61,13 @@ subroutine Nccr_Wr (ncid, filname, WRITE_NC4) ! John Tannahill (LLNL) and Jules Kouatchou ! ! !REMARKS: -! If the netCDF4 library is used, then the NF_CLOBBER flag will write +! If the netCDF4 library is used, then the NF90_CLOBBER flag will write ! a classic (i.e. netCDF3) file. Use OR(NF_NETCDF4,NF_CLASSIC_MODEL) to -! create netCDF-4 file that supports compression and uses "classic" netcdf data model -! (no groups, no user-defined types) +! create netCDF-4 file that supports compression and uses "classic" +! netcdf data model (no groups, no user-defined types) ! ! !REVISION HISTORY: -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------- !BOC @@ -91,17 +88,17 @@ subroutine Nccr_Wr (ncid, filname, WRITE_NC4) IF ( TMP_NC4 ) THEN #if defined( NC_HAS_COMPRESSION ) - mode = IOR( NF_NETCDF4, NF_CLASSIC_MODEL ) ! netCDF4 file - ierr = Nf_Create (filname, mode, ncid) ! w/ compression + mode = IOR( NF90_NETCDF4, NF90_CLASSIC_MODEL ) ! netCDF4 file + ierr = NF90_Create(filname, mode, ncid) ! w/ compression #else - ierr = Nf_Create (filname, NF_64BIT_OFFSET, ncid) ! netCDF4 file - ! w/o compression + ierr = NF90_Create(filname, NF90_64BIT_OFFSET, ncid) ! netCDF4 file + ! w/o compression #endif ELSE - ierr = Nf_Create (filname, NF_CLOBBER, ncid) ! netCDF3 file + ierr = NF90_Create(filname, NF90_CLOBBER, ncid) ! netCDF3 file ENDIF - if (ierr /= NF_NOERR) then + if (ierr /= NF90_NOERR) then err_msg = 'In Nccr_Wr, cannot create: ' // Trim (filname) call Do_Err_Out (err_msg, .true., 0, 0, 0, 0 , 0.0d0, 0.0d0) end if @@ -120,15 +117,12 @@ end subroutine Nccr_Wr ! ! !INTERFACE: ! - subroutine Ncdo_Sync (ncid) + subroutine Ncdo_Sync(ncid) ! ! !USES: ! + use netCDF use m_do_err_out -! - implicit none -! - include "netcdf.inc" ! ! !INPUT PARAMETERS: !! ncid : netCDF file id @@ -141,7 +135,7 @@ subroutine Ncdo_Sync (ncid) ! John Tannahill (LLNL) and Jules Kouatchou ! ! !REVISION HISTORY: -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC @@ -150,15 +144,13 @@ subroutine Ncdo_Sync (ncid) character (len=128) :: err_msg integer :: ierr ! - ierr = Nf_Sync (ncid) + ierr = Nf90_Sync (ncid) - if (ierr /= NF_NOERR) then - err_msg = 'In Ncdo_Sync: ' // Nf_Strerror (ierr) + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncdo_Sync: ' // Nf90_Strerror (ierr) call Do_Err_Out (err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) end if - return - end subroutine Ncdo_Sync !EOC end module HCO_m_netcdf_io_create diff --git a/src/Shared/NcdfUtil/hco_m_netcdf_io_define.F90 b/src/Shared/NcdfUtil/hco_m_netcdf_io_define.F90 index 02c399cf..b97bd365 100644 --- a/src/Shared/NcdfUtil/hco_m_netcdf_io_define.F90 +++ b/src/Shared/NcdfUtil/hco_m_netcdf_io_define.F90 @@ -69,7 +69,7 @@ MODULE HCO_m_netcdf_io_define ! Jules Kouatchou ! ! !REVISION HISTORY: -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC @@ -89,11 +89,8 @@ SUBROUTINE NcDef_dimension(ncid,name,len,id,unlimited) ! ! !USES: ! + USE netCDF USE m_do_err_out -! - IMPLICIT NONE -! - INCLUDE 'netcdf.inc' ! ! !INPUT PARAMETERS: !! ncid : netCDF file id @@ -116,7 +113,7 @@ SUBROUTINE NcDef_dimension(ncid,name,len,id,unlimited) ! Jules Kouatchou and Maharaj Bhat ! ! !REVISION HISTORY: -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC @@ -130,14 +127,14 @@ SUBROUTINE NcDef_dimension(ncid,name,len,id,unlimited) len0 = len if (present(unlimited)) then if (unlimited) then - len0 = NF_UNLIMITED + len0 = NF90_UNLIMITED endif endif - ierr = Nf_Def_Dim (ncid, name, len0, id) + ierr = NF90_Def_Dim(ncid, name, len0, id) - IF (ierr.ne.NF_NOERR) then - err_msg = 'Nf_Def_Dim: can not define dimension : '// Trim (name) + IF (ierr.ne.NF90_NOERR) then + err_msg = 'NF90_Def_Dim: can not define dimension : '// Trim (name) CALL Do_Err_Out (err_msg, .true., 0, 0, 0, 0, 0.0d0, 0.0d0) END IF @@ -153,33 +150,31 @@ END SUBROUTINE NcDef_dimension ! ! !INTERFACE: ! - SUBROUTINE NcDef_variable(ncid,name,type,ndims,dims,var_id,compress) + SUBROUTINE NcDef_variable(ncid, name, xtype, ndims, dims, var_id, compress) ! ! !USES: ! + USE netCDF USE m_do_err_out -! - IMPLICIT NONE -! - INCLUDE 'netcdf.inc' ! ! !INPUT PARAMETERS: ! !! ncid : netCDF file id !! name : name of the variable !! type : type of the variable -!! (NF_FLOAT, NF_CHAR, NF_INT, NF_DOUBLE, NF_BYTE, NF_SHORT) +!! (NF90_FLOAT, NF90_CHAR, NF90_INT, +!! NF90_DOUBLE, NF90_BYTE, NF90_SHORT) !! ndims : number of dimensions of the variable !! dims : netCDF dimension id of the variable CHARACTER (LEN=*), INTENT(IN) :: name INTEGER, INTENT(IN) :: ncid, ndims INTEGER, INTENT(IN) :: dims(ndims) - INTEGER, INTENT(IN) :: type + INTEGER, INTENT(IN) :: xtype LOGICAL, OPTIONAL, INTENT(IN) :: compress ! ! !OUTPUT PARAMETERS: ! -!! varid : netCDF variable id returned by NF_DEF_VAR +!! varid : netCDF variable id returned by NF90_DEF_VAR INTEGER, INTENT(OUT) :: var_id ! ! !DESCRIPTION: Defines a netCDF variable. @@ -189,66 +184,74 @@ SUBROUTINE NcDef_variable(ncid,name,type,ndims,dims,var_id,compress) ! Jules Kouatchou and Maharaj Bhat ! ! !REVISION HISTORY: -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC ! ! !LOCAL VARIABLES: - character (len=512) :: err_msg - integer :: ierr - logical :: doStop - ! Compression settings - ! choose deflate_level=1 for fast, minimal compression. - ! Informal testing suggests minimal benefit from higher compression level - integer, parameter :: shuffle=1, deflate=1, deflate_level=1 -! - ierr = Nf_Def_Var (ncid, name, type, ndims, dims, var_id) - - IF (ierr.ne.NF_NOERR) THEN - err_msg = 'Nf_Def_Var: can not define variable : '// Trim (name) - CALL Do_Err_Out (err_msg, .true., 0, 0, 0, 0, 0.0d0, 0.0d0) - END IF + character(len=512) :: err_msg + integer :: ierr + logical :: doStop -#if defined( NC_HAS_COMPRESSION ) +#ifdef NC_HAS_COMPRESSION !===================================================================== - ! If the optional "compress" variable is used and set to TRUE, - ! then enable variable compression (cdh, 0/17/17) + ! Create a compressed (deflated) netCDF variable ! ! NOTE: We need to block this out with an #ifdef because some - ! netCDF installations might lack the nf_def_var_deflate function + ! netCDF installations might lack the deflation capability, ! which would cause a compile-time error. (bmy, 3/1/17) - ! - ! ALSO NOTE: Newer versions of netCDF balk when you try to compress - ! a scalar variable. This generates an annoying warning message. - ! To avoid this, only compress array variables. (bmy, 11/30/20) - !===================================================================== - if (present(Compress) .and. ndims > 0) then + !======================================================================== + IF ( PRESENT( Compress ) ) then - if (Compress) then + !------------------------------------------------------------------ + ! If COMPRESS is passed as an optional argument, and is TRUE, + ! then define the variable with deflate_level=1. Higher values + ! of deflate_level yield minimal additiional benefit. + ! + ! ALSO NOTE: Newer versions of netCDF balk when you try to compress + ! a scalar variable. This generates an annoying warning message. + ! To avoid this, only compress array variables. (bmy, 11/30/20) + !------------------------------------------------------------------- + IF ( Compress .and. ndims > 0 ) THEN - ! Set compression - ierr = nf_def_var_deflate( ncid, var_id, shuffle, & - deflate, deflate_level ) + ! Create deflated variable + ierr = NF90_Def_Var( ncid, name, xtype, dims, var_id, & + shuffle=.TRUE., deflate_level=1 ) ! Check for errors. ! No message will be generated if the error is simply that the - ! file is not netCDF-4 - ! (i.e. netCDF-3 don't support compression) - IF ( (ierr.ne.NF_NOERR) .and. (ierr.ne.NF_ENOTNC4)) THEN + ! file is not netCDF-4 (as netCDF-3 doesn't support compression) + IF ( (ierr.ne.NF90_NOERR) .and. (ierr.ne.NF90_ENOTNC4)) THEN ! Errors enabling compression will not halt the program doStop = .False. ! Print error - err_msg = 'Nf_Def_Var_Deflate: can not compress variable : '// Trim (name) + err_msg = 'NF90_Def_Var: can not create compressed variable : '//& + Trim(name) CALL Do_Err_Out (err_msg, doStop, 0, 0, 0, 0, 0.0d0, 0.0d0) END IF - endif - endif + ! Return successfully + RETURN + ENDIF + ENDIF #endif + !======================================================================== + ! Create an uncompressed netCDF variable if: + ! (1) COMPRESS is not passed as an optional argument + ! (2) COMPRESS is passed as an optional argument but is FALSE + ! (3) The variable is a scalar (ndims == 0) + !======================================================================== + ierr = NF90_Def_Var( ncid, name, xtype, dims, var_id ) + IF ( ierr /= NF90_NOERR ) THEN + err_msg = 'NF90_Def_Var_Deflate: can not create variable : '// & + Trim (name) + CALL Do_Err_Out (err_msg, doStop, 0, 0, 0, 0, 0.0d0, 0.0d0) + ENDIF + END SUBROUTINE NcDef_variable !EOC !------------------------------------------------------------------------------ @@ -261,14 +264,12 @@ END SUBROUTINE NcDef_variable ! ! !INTERFACE: ! - SUBROUTINE NcDef_var_attributes_c(ncid,var_id,att_name,att_val) + SUBROUTINE NcDef_var_attributes_c(ncid, var_id, att_name, att_val) ! ! !USES: ! + USE netCDF USE m_do_err_out -! - IMPLICIT none - INCLUDE 'netcdf.inc' ! ! !INPUT PARAMETERS: !! ncid : netCDF file id @@ -276,7 +277,7 @@ SUBROUTINE NcDef_var_attributes_c(ncid,var_id,att_name,att_val) !! att_name: attribute name !! att_val : attribute value CHARACTER (LEN=*), INTENT(IN) :: att_name, att_val - INTEGER, INTENT(IN) :: ncid, var_id + INTEGER, INTENT(IN) :: ncid, var_id ! ! !DESCRIPTION: Defines a netCDF variable attribute of type: CHARACTER. !\\ @@ -285,19 +286,18 @@ SUBROUTINE NcDef_var_attributes_c(ncid,var_id,att_name,att_val) ! Bob Yantosca (based on code by Jules Kouatchou and Maharaj Bhat) ! ! !REVISION HISTORY: -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC ! ! !LOCAL VARIABLES: CHARACTER (LEN=512) :: err_msg - INTEGER :: mylen, ierr + INTEGER :: ierr ! - mylen = LEN(att_val) - ierr = Nf_Put_Att_Text (ncid, var_id, att_name, mylen, att_val) + ierr = NF90_Put_Att(ncid, var_id, att_name, att_val) - IF (ierr.ne.NF_NOERR) THEN + IF (ierr /= NF90_NOERR) THEN err_msg = 'NcDef_var_attributes_c: can not define attribute : ' // & TRIM (att_name) CALL Do_Err_Out (err_msg, .true., 0, 0, 0, 0, 0.0d0, 0.0d0) @@ -315,10 +315,11 @@ END SUBROUTINE NcDef_var_attributes_c ! ! !INTERFACE: ! - SUBROUTINE NcDef_var_attributes_i(ncid,var_id,att_name,att_val) + SUBROUTINE NcDef_var_attributes_i(ncid, var_id, att_name, att_val) ! ! !USES: ! + USE netCDF USE m_do_err_out ! IMPLICIT NONE @@ -341,7 +342,7 @@ SUBROUTINE NcDef_var_attributes_i(ncid,var_id,att_name,att_val) ! ! !REVISION HISTORY: ! 26 Sep 2013 - R. Yantosca - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC @@ -350,11 +351,9 @@ SUBROUTINE NcDef_var_attributes_i(ncid,var_id,att_name,att_val) character (len=512) :: err_msg integer :: mylen, ierr ! - mylen = 1 - ierr = Nf_Put_Att_Int( ncid, var_id, att_name, & - NF_INT, mylen, att_val ) + ierr = NF90_Put_Att( ncid, var_id, att_name, att_val ) - IF (ierr.ne.NF_NOERR) THEN + IF (ierr.ne.NF90_NOERR) THEN err_msg = 'NcDef_var_attributes_i: can not define attribute : ' // & TRIM (att_name) CALL Do_Err_Out (err_msg, .true., 0, 0, 0, 0, 0.0d0, 0.0d0) @@ -372,14 +371,12 @@ END SUBROUTINE NcDef_var_attributes_i ! ! !INTERFACE: ! - SUBROUTINE NcDef_var_attributes_r4(ncid,var_id,att_name,att_val) + SUBROUTINE NcDef_var_attributes_r4(ncid, var_id, att_name, att_val) ! ! !USES: ! + USE netCDF USE m_do_err_out - - IMPLICIT NONE - INCLUDE 'netcdf.inc' ! ! !INPUT PARAMETERS: !! ncid : netCDF file id @@ -398,20 +395,18 @@ SUBROUTINE NcDef_var_attributes_r4(ncid,var_id,att_name,att_val) ! ! !REVISION HISTORY: ! 26 Sep 2013 - R. Yantosca - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC ! ! !LOCAL VARIABLES: CHARACTER (LEN=512) :: err_msg - INTEGER :: mylen, ierr + INTEGER :: ierr ! - mylen = 1 - ierr = Nf_Put_Att_Real( ncid, var_id, att_name, & - NF_FLOAT, mylen, att_val ) + ierr = NF90_Put_Att( ncid, var_id, att_name, att_val ) - IF (ierr.ne.NF_NOERR) THEN + IF (ierr.ne.NF90_NOERR) THEN err_msg = 'NcDef_var_attributes_r4: can not define attribute : ' // & TRIM (att_name) CALL Do_Err_Out (err_msg, .true., 0, 0, 0, 0, 0.0d0, 0.0d0) @@ -429,14 +424,12 @@ END SUBROUTINE NcDef_var_attributes_r4 ! ! !INTERFACE: ! - SUBROUTINE NcDef_var_attributes_r8(ncid,var_id,att_name,att_val) + SUBROUTINE NcDef_var_attributes_r8(ncid, var_id, att_name, att_val) ! ! !USES: ! + USE netCDF USE m_do_err_out -! - IMPLICIT none - INCLUDE 'netcdf.inc' ! ! !INPUT PARAMETERS: !! ncid : netCDF file id @@ -455,20 +448,18 @@ SUBROUTINE NcDef_var_attributes_r8(ncid,var_id,att_name,att_val) ! ! !REVISION HISTORY: ! 20 Sep 2013 - R. Yantosca - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC ! ! !LOCAL VARIABLES: CHARACTER (LEN=512) :: err_msg - INTEGER :: mylen, ierr + INTEGER :: ierr ! - mylen = 1 - ierr = Nf_Put_Att_Double( ncid, var_id, att_name, & - NF_DOUBLE, mylen, att_val ) + ierr = NF90_Put_Att( ncid, var_id, att_name, att_val ) - IF (ierr.ne.NF_NOERR) THEN + IF (ierr.ne.NF90_NOERR) THEN err_msg = 'NcDef_var_attributes_r8: can not define attribute : ' // & TRIM (att_name) CALL Do_Err_Out (err_msg, .true., 0, 0, 0, 0, 0.0d0, 0.0d0) @@ -486,14 +477,12 @@ END SUBROUTINE NcDef_var_attributes_r8 ! ! !INTERFACE: ! - SUBROUTINE NcDef_var_attributes_i_arr(ncid,var_id,att_name,att_val) + SUBROUTINE NcDef_var_attributes_i_arr(ncid, var_id, att_name, att_val) ! ! !USES: ! + USE netCDF USE m_do_err_out -! - IMPLICIT none - INCLUDE 'netcdf.inc' ! ! !INPUT PARAMETERS: !! ncid : netCDF file id @@ -512,20 +501,18 @@ SUBROUTINE NcDef_var_attributes_i_arr(ncid,var_id,att_name,att_val) ! ! !REVISION HISTORY: ! 26 Sep 2013 - R. Yantosca - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC ! ! !LOCAL VARIABLES: CHARACTER (LEN=512) :: err_msg - INTEGER :: mylen, ierr + INTEGER :: ierr ! - mylen = SIZE( att_val ) - ierr = Nf_Put_Att_Int( ncid, var_id, att_name, & - NF_INT, mylen, att_val ) + ierr = NF90_Put_Att( ncid, var_id, att_name, att_val ) - iF (ierr.ne.NF_NOERR) THEN + iF (ierr.ne.NF90_NOERR) THEN err_msg = 'NcDef_var_attributes_i_arr: can not define attribute : ' & // TRIM (att_name) CALL Do_Err_Out (err_msg, .true., 0, 0, 0, 0, 0.0d0, 0.0d0) @@ -543,14 +530,12 @@ END SUBROUTINE NcDef_var_attributes_i_arr ! ! !INTERFACE: ! - SUBROUTINE NcDef_var_attributes_r4_arr(ncid,var_id,att_name,att_val) + SUBROUTINE NcDef_var_attributes_r4_arr(ncid, var_id, att_name, att_val) ! ! !USES: ! + USE netCDF USE m_do_err_out -! - IMPLICIT none - INCLUDE 'netcdf.inc' ! ! !INPUT PARAMETERS: !! ncid : netCDF file id @@ -569,20 +554,18 @@ SUBROUTINE NcDef_var_attributes_r4_arr(ncid,var_id,att_name,att_val) ! ! !REVISION HISTORY: ! 26 Sep 2013 - R. Yantosca - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC ! ! !LOCAL VARIABLES: CHARACTER (LEN=512) :: err_msg - INTEGER :: mylen, ierr + INTEGER :: ierr ! - mylen = SIZE( att_val ) - ierr = Nf_Put_Att_Real( ncid, var_id, att_name, & - NF_FLOAT, mylen, att_val ) + ierr = NF90_Put_Att( ncid, var_id, att_name, att_val ) - IF (ierr.ne.NF_NOERR) THEN + IF (ierr.ne.NF90_NOERR) THEN err_msg = 'NcDef_var_attributes_r4_arr: can not define attribute : ' & // TRIM (att_name) CALL Do_Err_Out (err_msg, .true., 0, 0, 0, 0, 0.0d0, 0.0d0) @@ -600,14 +583,12 @@ END SUBROUTINE NcDef_var_attributes_r4_arr ! ! !INTERFACE: ! - SUBROUTINE NcDef_var_attributes_r8_arr(ncid,var_id,att_name,att_val) + SUBROUTINE NcDef_var_attributes_r8_arr(ncid, var_id, att_name, att_val) ! ! !USES: ! + USE netCDF USE m_do_err_out -! - IMPLICIT NONE - INCLUDE 'netcdf.inc' ! ! !INPUT PARAMETERS: !! ncid : netCDF file id @@ -626,20 +607,18 @@ SUBROUTINE NcDef_var_attributes_r8_arr(ncid,var_id,att_name,att_val) ! ! !REVISION HISTORY: ! 20 Sep 2013 - R. Yantosca - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC ! ! !LOCAL VARIABLES: character (len=512) :: err_msg - integer :: mylen, ierr + integer :: ierr ! - mylen = size( att_val ) - ierr = Nf_Put_Att_Double( ncid, var_id, att_name, & - NF_DOUBLE, mylen, att_val ) + ierr = NF90_Put_Att( ncid, var_id, att_name, att_val ) - IF (ierr.ne.NF_NOERR) THEN + IF (ierr.ne.NF90_NOERR) THEN err_msg = 'NcDef_var_attributes_r4_arr: can not define attribute : '& // Trim (att_name) CALL Do_Err_Out (err_msg, .true., 0, 0, 0, 0, 0.0d0, 0.0d0) @@ -657,15 +636,12 @@ END SUBROUTINE NcDef_var_attributes_r8_arr ! ! !INTERFACE: ! - SUBROUTINE NcDef_glob_attributes_c(ncid,att_name,att_val) + SUBROUTINE NcDef_glob_attributes_c(ncid, att_name, att_val) ! ! !USES: ! + USE netCDF USE m_do_err_out -! - IMPLICIT NONE -! - INCLUDE 'netcdf.inc' ! ! !INPUT PARAMETERS: !! ncid : netCDF file id @@ -684,19 +660,18 @@ SUBROUTINE NcDef_glob_attributes_c(ncid,att_name,att_val) ! ! !REVISION HISTORY: ! 26 Sep 2013 - R. Yantosca - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------- !BOC ! ! !LOCAL VARIABLES: CHARACTER (LEN=512) :: err_msg - INTEGER :: mylen, ierr + INTEGER :: ierr ! - mylen = len(att_val) - ierr = Nf_Put_Att_Text (ncid, NF_GLOBAL, att_name, mylen, att_val) + ierr = NF90_Put_Att(ncid, NF90_GLOBAL, att_name, att_val) - IF (ierr.ne.NF_NOERR) THEN + IF (ierr.ne.NF90_NOERR) THEN err_msg = 'NcDef_glob_attributes_c: can not define attribute : ' // & TRIM (att_name) CALL Do_Err_Out (err_msg, .true., 0, 0, 0, 0, 0.0d0, 0.0d0) @@ -714,15 +689,12 @@ END SUBROUTINE NcDef_glob_attributes_c ! ! !INTERFACE: ! - SUBROUTINE NcDef_glob_attributes_i(ncid,att_name,att_val) + SUBROUTINE NcDef_glob_attributes_i(ncid, att_name, att_val) ! ! !USES: ! + USE netCDF USE m_do_err_out -! - IMPLICIT none -! - INCLUDE 'netcdf.inc' ! ! !INPUT PARAMETERS: !! ncid : netCDF file id @@ -741,20 +713,18 @@ SUBROUTINE NcDef_glob_attributes_i(ncid,att_name,att_val) ! ! !REVISION HISTORY: ! 26 Sep 2013 - R. Yantosca - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------- !BOC ! ! !LOCAL VARIABLES: CHARACTER (LEN=512) :: err_msg - INTEGER :: mylen, ierr + INTEGER :: ierr ! - mylen = 1 - ierr = Nf_Put_Att_Int( ncid, NF_GLOBAL, att_name, & - NF_INT, mylen, att_val ) + ierr = NF90_Put_Att( ncid, NF90_GLOBAL, att_name, att_val ) - IF (ierr.ne.NF_NOERR) THEN + IF (ierr.ne.NF90_NOERR) THEN err_msg = 'NcDef_glob_attributes_i: can not define attribute : ' // & TRIM (att_name) CALL Do_Err_Out (err_msg, .true., 0, 0, 0, 0, 0.0d0, 0.0d0) @@ -772,15 +742,12 @@ END SUBROUTINE NcDef_glob_attributes_i ! ! !INTERFACE: ! - SUBROUTINE NcDef_glob_attributes_r4(ncid,att_name,att_val) + SUBROUTINE NcDef_glob_attributes_r4(ncid, att_name, att_val) ! ! !USES: ! + USE netCDF USE m_do_err_out -! - IMPLICIT NONE -! - INCLUDE 'netcdf.inc' ! ! !INPUT PARAMETERS: !! ncid : netCDF file id @@ -799,20 +766,18 @@ SUBROUTINE NcDef_glob_attributes_r4(ncid,att_name,att_val) ! ! !REVISION HISTORY: ! 26 Sep 2013 - R. Yantosca - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------- !BOC ! ! !LOCAL VARIABLES: character (len=512) :: err_msg - integer :: mylen, ierr + integer :: ierr ! - mylen = 1 - ierr = Nf_Put_Att_Real( ncid, NF_GLOBAL, att_name, & - NF_FLOAT, mylen, att_val ) + ierr = NF90_Put_Att( ncid, NF90_GLOBAL, att_name, att_val ) - IF (ierr.ne.NF_NOERR) THEN + IF (ierr.ne.NF90_NOERR) THEN err_msg = 'NcDef_glob_attributes_r4: can not define attribute : ' // & TRIM (att_name) CALL Do_Err_Out (err_msg, .true., 0, 0, 0, 0, 0.0d0, 0.0d0) @@ -830,15 +795,12 @@ END SUBROUTINE NcDef_glob_attributes_r4 ! ! !INTERFACE: ! - SUBROUTINE NcDef_glob_attributes_r8(ncid,att_name,att_val) + SUBROUTINE NcDef_glob_attributes_r8(ncid, att_name, att_val) ! ! !USES: ! + USE netCDF USE m_do_err_out -! - IMPLICIT NONE -! - INCLUDE 'netcdf.inc' ! ! !INPUT PARAMETERS: !! ncid : netCDF file id @@ -857,20 +819,18 @@ SUBROUTINE NcDef_glob_attributes_r8(ncid,att_name,att_val) ! ! !REVISION HISTORY: ! 26 Sep 2013 - R. Yantosca - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------- !BOC ! ! !LOCAL VARIABLES: character (len=512) :: err_msg - integer :: mylen, ierr + integer :: ierr ! - mylen = 1 - ierr = Nf_Put_Att_Double( ncid, NF_GLOBAL, att_name, & - NF_FLOAT, mylen, att_val ) + ierr = NF90_Put_Att( ncid, NF90_GLOBAL, att_name, att_val ) - IF (ierr.ne.NF_NOERR) THEN + IF (ierr.ne.NF90_NOERR) THEN err_msg = 'NcDef_glob_attributes_r8: can not define attribute : ' // & TRIM (att_name) CALL Do_Err_Out (err_msg, .true., 0, 0, 0, 0, 0.0d0, 0.0d0) @@ -888,15 +848,12 @@ END SUBROUTINE NcDef_glob_attributes_r8 ! ! !INTERFACE: ! - SUBROUTINE NcDef_glob_attributes_i_arr(ncid,att_name,att_val) + SUBROUTINE NcDef_glob_attributes_i_arr(ncid, att_name, att_val) ! ! !USES: ! + USE netCDF USE m_do_err_out -! - IMPLICIT NONE -! - INCLUDE 'netcdf.inc' ! ! !INPUT PARAMETERS: !! ncid : netCDF file id @@ -915,20 +872,18 @@ SUBROUTINE NcDef_glob_attributes_i_arr(ncid,att_name,att_val) ! ! !REVISION HISTORY: ! 26 Sep 2013 - R. Yantosca - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------- !BOC ! ! !LOCAL VARIABLES: CHARACTER (LEN=512) :: err_msg - INTEGER :: mylen, ierr + INTEGER :: ierr ! - mylen = SIZE( att_val ) - ierr = Nf_Put_Att_Int( ncid, NF_GLOBAL, att_name, & - NF_INT, mylen, att_val ) + ierr = NF90_Put_Att( ncid, NF90_GLOBAL, att_name, att_val ) - IF (ierr.ne.NF_NOERR) THEN + IF (ierr.ne.NF90_NOERR) THEN err_msg = 'NcDef_glob_attributes_i_arr: can not define attribute : ' & // Trim (att_name) CALL Do_Err_Out (err_msg, .true., 0, 0, 0, 0, 0.0d0, 0.0d0) @@ -950,11 +905,8 @@ SUBROUTINE NcDef_glob_attributes_r4_arr(ncid,att_name,att_val) ! ! !USES: ! + USE netCDF USE m_do_err_out -! - IMPLICIT none -! - INCLUDE 'netcdf.inc' ! ! !INPUT PARAMETERS: !! ncid : netCDF file id @@ -973,20 +925,18 @@ SUBROUTINE NcDef_glob_attributes_r4_arr(ncid,att_name,att_val) ! ! !REVISION HISTORY: ! 26 Sep 2013 - R. Yantosca - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------- !BOC ! ! !LOCAL VARIABLES: character (len=512) :: err_msg - integer :: mylen, ierr + integer :: ierr ! - mylen = SIZE( att_val ) - ierr = Nf_Put_Att_Real( ncid, NF_GLOBAL, att_name, & - NF_FLOAT, mylen, att_val ) + ierr = NF90_Put_Att( ncid, NF90_GLOBAL, att_name, att_val ) - IF (ierr.ne.NF_NOERR) THEN + IF (ierr.ne.NF90_NOERR) THEN err_msg = 'NcDef_glob_attributes_r4_arr: can not define attribute : ' & // TRIM (att_name) CALL Do_Err_Out (err_msg, .true., 0, 0, 0, 0, 0.0d0, 0.0d0) @@ -1004,15 +954,12 @@ END SUBROUTINE NcDef_glob_attributes_r4_arr ! ! !INTERFACE: ! - SUBROUTINE NcDef_glob_attributes_r8_arr(ncid,att_name,att_val) + SUBROUTINE NcDef_glob_attributes_r8_arr(ncid, att_name, att_val) ! ! !USES: ! + USE netCDF USE m_do_err_out -! - IMPLICIT none -! - INCLUDE 'netcdf.inc' ! ! !INPUT PARAMETERS: !! ncid : netCDF file id @@ -1031,20 +978,18 @@ SUBROUTINE NcDef_glob_attributes_r8_arr(ncid,att_name,att_val) ! ! !REVISION HISTORY: ! 26 Sep 2013 - R. Yantosca - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------- !BOC ! ! !LOCAL VARIABLES: character (len=512) :: err_msg - integer :: mylen, ierr + integer :: ierr ! - mylen = SIZE( att_val ) - ierr = Nf_Put_Att_Double( ncid, NF_GLOBAL, att_name, & - NF_FLOAT, mylen, att_val ) + ierr = NF90_Put_Att( ncid, NF90_GLOBAL, att_name, att_val ) - IF (ierr.ne.NF_NOERR) THEN + IF (ierr.ne.NF90_NOERR) THEN err_msg = 'NcDef_glob_attributes_r8_arr: can not define attribute : ' & // TRIM (att_name) CALL Do_Err_Out (err_msg, .true., 0, 0, 0, 0, 0.0d0, 0.0d0) @@ -1062,19 +1007,17 @@ END SUBROUTINE NcDef_glob_attributes_r8_arr ! ! !INTERFACE: ! - SUBROUTINE NcSetFill(ncid,ifill,omode) + SUBROUTINE NcSetFill(ncid, ifill, omode) ! ! !USES: ! + USE netCDF USE m_do_err_out -! - IMPLICIT NONE -! - INCLUDE 'netcdf.inc' ! ! !INPUT PARAMETERS: ! - INTEGER, INTENT(in) :: ncid, ifill,omode + INTEGER, INTENT(IN ) :: ncid, ifill + INTEGER, INTENT(INOUT) :: omode ! ! !DESCRIPTION: Sets fill method. !\\ @@ -1083,19 +1026,19 @@ SUBROUTINE NcSetFill(ncid,ifill,omode) ! Jules Kouatchou ! ! !REVISION HISTORY: -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------- !BOC ! ! !LOCAL VARIABLES: character (len=512) :: err_msg - integer :: mylen, ierr + integer :: mylen, ierr ! - ierr = Nf_Set_Fill (ncid, NF_NOFILL, omode) + ierr = NF90_Set_Fill(ncid, NF90_NOFILL, omode) - IF (ierr.ne.NF_NOERR) THEN - err_msg = 'Nf_Set_FIll: Error in omode ' + IF (ierr.ne.NF90_NOERR) THEN + err_msg = 'NF90_Set_FIll: Error in omode ' CALL Do_Err_Out (err_msg, .true., 0, 0, 0, 0, 0.0d0, 0.0d0) END IF @@ -1115,11 +1058,8 @@ SUBROUTINE NcEnd_Def(ncid) ! ! !USES: ! + USE netCDF USE m_do_err_out -! - IMPLICIT NONE -! - INCLUDE 'netcdf.inc' ! ! !INPUT PARAMETERS: ! @@ -1132,7 +1072,7 @@ SUBROUTINE NcEnd_Def(ncid) ! Jules Kouatchou ! ! !REVISION HISTORY: -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------- !BOC @@ -1141,10 +1081,10 @@ SUBROUTINE NcEnd_Def(ncid) CHARACTER (LEN=512) :: err_msg INTEGER :: ierr ! - ierr = Nf_Enddef (ncid) + ierr = NF90_Enddef(ncid) - IF (ierr.ne.NF_NOERR) THEN - err_msg = 'Nf_EndDef: Error in closing netCDF define mode!' + IF (ierr.ne.NF90_NOERR) THEN + err_msg = 'NF90_EndDef: Error in closing netCDF define mode!' CALL Do_Err_Out (err_msg, .true., 0, 0, 0, 0, 0.0d0, 0.0d0) END IF @@ -1164,11 +1104,8 @@ SUBROUTINE NcBegin_Def(ncid) ! ! !USES: ! + USE netCDF USE m_do_err_out -! - IMPLICIT none -! - INCLUDE 'netcdf.inc' ! ! !INPUT PARAMETERS: ! @@ -1183,7 +1120,7 @@ SUBROUTINE NcBegin_Def(ncid) ! ! !REVISION HISTORY: ! 14 May 2014 - R. Yantosca - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------- !BOC @@ -1192,10 +1129,10 @@ SUBROUTINE NcBegin_Def(ncid) character (len=512) :: err_msg integer :: ierr ! - ierr = Nf_Redef (ncid) + ierr = NF90_Redef (ncid) - IF (ierr.ne.NF_NOERR) THEN - err_msg = 'Nf_ReDef: Error in opening netCDF define mode!' + IF (ierr.ne.NF90_NOERR) THEN + err_msg = 'NF90_ReDef: Error in opening netCDF define mode!' CALL Do_Err_Out (err_msg, .true., 0, 0, 0, 0, 0.0d0, 0.0d0) END IF diff --git a/src/Shared/NcdfUtil/hco_m_netcdf_io_get_dimlen.F90 b/src/Shared/NcdfUtil/hco_m_netcdf_io_get_dimlen.F90 index 2e509746..2bde9a61 100644 --- a/src/Shared/NcdfUtil/hco_m_netcdf_io_get_dimlen.F90 +++ b/src/Shared/NcdfUtil/hco_m_netcdf_io_get_dimlen.F90 @@ -24,7 +24,7 @@ module HCO_m_netcdf_io_get_dimlen ! Jules Kouatchou ! ! !REVISION HISTORY: -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC @@ -40,15 +40,12 @@ module HCO_m_netcdf_io_get_dimlen ! ! !INTERFACE: ! - subroutine Ncget_Dimlen (ncid, dim_name, dim_len ) + subroutine Ncget_Dimlen(ncid, dim_name, dim_len) ! ! !USES: ! + use netCDF use m_do_err_out -! - implicit none -! - include 'netcdf.inc' ! ! !INPUT PARAMETERS: !! dim_name : netCDF dimension name @@ -70,7 +67,7 @@ subroutine Ncget_Dimlen (ncid, dim_name, dim_len ) ! John Tannahill (LLNL) and Jules Kouatchou ! ! !REVISION HISTORY: -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC @@ -80,18 +77,18 @@ subroutine Ncget_Dimlen (ncid, dim_name, dim_len ) integer :: dimid integer :: ierr - ierr = Nf_Inq_Dimid (ncid, dim_name, dimid) + ierr = NF90_Inq_Dimid(ncid, dim_name, dimid) - if (ierr /= NF_NOERR ) then + if (ierr /= NF90_NOERR ) then err_msg = 'In Ncget_Dimlen #1: ' // Trim (dim_name) // & - ', ' // Nf_Strerror (ierr) + ', ' // NF90_Strerror (ierr) call Do_Err_Out (err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) end if - ierr = Nf_Inq_Dimlen (ncid, dimid, dim_len) + ierr = NF90_Inquire_Dimension(ncid, dimid, len=dim_len) - if (ierr /= NF_NOERR) then - err_msg = 'In Ncget_Dimlen #2: ' // Nf_Strerror (ierr) + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncget_Dimlen #2: ' // NF90_Strerror (ierr) call Do_Err_Out (err_msg, .true., 2, ncid, dimid, 0, 0.0d0, 0.0d0) end if @@ -112,11 +109,8 @@ subroutine Ncget_Unlim_Dimlen (ncid, udim_len) ! ! !USES: ! + use netCDF use m_do_err_out -! - implicit none -! - include 'netcdf.inc' ! ! !INPUT PARAMETERS: !! ncid : netCDF file id @@ -133,31 +127,20 @@ subroutine Ncget_Unlim_Dimlen (ncid, udim_len) ! John Tannahill (LLNL) and Jules Kouatchou ! ! !REVISION HISTORY: -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC ! ! !LOCAL VARIABLES: - character (len=512) :: err_msg - integer :: ierr - integer :: udimid -! - ierr = Nf_Inq_Unlimdim (ncid, udimid) + character(len=512) :: err_msg + integer :: ierr, udim_id - if (ierr /= NF_NOERR) then - err_msg = 'In Ncget_Unlim_Dimlen #1: ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) - end if - - ierr = Nf_Inq_Dimlen (ncid, udimid, udim_len) - - if (ierr /= NF_NOERR) then - err_msg = 'In Ncget_Unlim_Dimlen #2: ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 2, ncid, udimid, 0, 0.0d0, 0.0d0) - end if - - return + udim_len = -1 + ierr = NF90_Inquire(ncid, unlimitedDimId=udim_id) + IF ( ierr /= NF90_NOERR ) THEN + ierr = NF90_Inquire_Dimension( ncid, udim_id, len=udim_len ) + ENDIF end subroutine Ncget_Unlim_Dimlen !EOC diff --git a/src/Shared/NcdfUtil/hco_m_netcdf_io_handle_err.F90 b/src/Shared/NcdfUtil/hco_m_netcdf_io_handle_err.F90 index 86474497..b8c81d48 100644 --- a/src/Shared/NcdfUtil/hco_m_netcdf_io_handle_err.F90 +++ b/src/Shared/NcdfUtil/hco_m_netcdf_io_handle_err.F90 @@ -23,7 +23,7 @@ module HCO_m_netcdf_io_handle_err ! Jules Kouatchou ! ! !REVISION HISTORY: -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !----------------------------------------------------------------------------- !BOC @@ -43,11 +43,8 @@ subroutine Nchandle_Err (ierr) ! ! !USES: ! + use netCDF use m_do_err_out -! - implicit none -! - include "netcdf.inc" ! ! !INPUT PARAMETERS: ! ierr : netCDF error number @@ -60,7 +57,7 @@ subroutine Nchandle_Err (ierr) ! John Tannahill (LLNL) and Jules Kouatchou ! ! !REVISION HISTORY: -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------- !BOC @@ -68,7 +65,7 @@ subroutine Nchandle_Err (ierr) ! !LOCAL VARIABLES: character (len=512) :: err_msg ! - err_msg = 'In Nchandle_Err: ' // Nf_Strerror (ierr) + err_msg = 'In Nchandle_Err: ' // Nf90_Strerror (ierr) call Do_Err_Out (err_msg, .true., 0, 0, 0, 0, 0.0d0, 0.0d0) diff --git a/src/Shared/NcdfUtil/hco_m_netcdf_io_open.F90 b/src/Shared/NcdfUtil/hco_m_netcdf_io_open.F90 index 31e8f65e..449c3b8e 100644 --- a/src/Shared/NcdfUtil/hco_m_netcdf_io_open.F90 +++ b/src/Shared/NcdfUtil/hco_m_netcdf_io_open.F90 @@ -24,7 +24,7 @@ module HCO_m_netcdf_io_open ! Jules Kouatchou ! ! !REVISION HISTORY: -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !----------------------------------------------------------------------------- !BOC @@ -40,15 +40,12 @@ module HCO_m_netcdf_io_open ! ! !INTERFACE: ! - subroutine Ncop_Rd (ncid, filname) + subroutine Ncop_Rd (ncid, filname, rc) ! ! !USES: ! + USE netCDF use m_do_err_out -! - implicit none -! - include "netcdf.inc" ! ! !INPUT PARAMETERS: !! filname : name of netCDF file to open for reading @@ -57,6 +54,7 @@ subroutine Ncop_Rd (ncid, filname) ! !OUTPUT PARAMETERS: !! ncid : opened netCDF file id integer , intent (out) :: ncid + integer, optional :: rc ! ! !DESCRIPTION: Opens a netCDF file for reading and does some error checking. !\\ @@ -65,20 +63,21 @@ subroutine Ncop_Rd (ncid, filname) ! John Tannahill (LLNL) and Jules Kouatchou ! ! !REVISION HISTORY: -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC ! ! !LOCAL VARIABLES: - character (len=512) :: err_msg - integer :: ierr + character(len=512) :: err_msg + integer :: ierr ! - ierr = Nf_Open (filname, NF_NOWRITE, ncid) + ierr = Nf90_Open( filname, NF90_NOWRITE, ncid ) - if (ierr /= NF_NOERR) then + if (ierr /= NF90_NOERR) then err_msg = 'In Ncop_Rd, cannot open: ' // Trim (filname) call Do_Err_Out (err_msg, .true., 0, 0, 0, 0, 0.0d0, 0.0d0) + return end if return @@ -99,11 +98,8 @@ subroutine Ncop_Wr (ncid, filname) ! ! !USES: ! + USE netCDF use m_do_err_out -! - implicit none -! - include "netcdf.inc" ! ! !INPUT PARAMETERS: !! filname : name of netCDF file to open for reading @@ -121,7 +117,7 @@ subroutine Ncop_Wr (ncid, filname) ! John Tannahill (LLNL) and Jules Kouatchou ! ! !REVISION HISTORY: -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC @@ -130,9 +126,9 @@ subroutine Ncop_Wr (ncid, filname) character (len=512) :: err_msg integer :: ierr ! - ierr = Nf_Open (filname, NF_WRITE, ncid) + ierr = Nf90_Open (filname, NF90_WRITE, ncid) - if (ierr /= NF_NOERR) then + if (ierr /= NF90_NOERR) then err_msg = 'In Ncop_Rd, cannot open: ' // Trim (filname) call Do_Err_Out (err_msg, .true., 0, 0, 0, 0, 0.0d0, 0.0d0) end if diff --git a/src/Shared/NcdfUtil/hco_m_netcdf_io_read.F90 b/src/Shared/NcdfUtil/hco_m_netcdf_io_read.F90 index 73cf8e25..7c1a8339 100644 --- a/src/Shared/NcdfUtil/hco_m_netcdf_io_read.F90 +++ b/src/Shared/NcdfUtil/hco_m_netcdf_io_read.F90 @@ -1,4 +1,3 @@ -! $Id: m_netcdf_io_read.F90,v 1.1 2009/08/04 14:52:05 bmy Exp $ !------------------------------------------------------------------------- ! NASA/GFSC, SIVO, Code 610.3 !------------------------------------------------------------------------- @@ -8,44 +7,44 @@ ! ! !INTERFACE: ! - MODULE HCO_m_netcdf_io_read +MODULE HCO_m_netcdf_io_read ! ! !USES: ! - IMPLICIT NONE - PRIVATE + IMPLICIT NONE + PRIVATE ! ! !PUBLIC MEMBER FUNCTIONS: ! - ! Public interface - PUBLIC :: NcRd - - ! Private methods overloaded by public interface - ! (see below for info about these routines & the arguments they take) - INTERFACE NcRd - MODULE PROCEDURE Ncrd_Scal - MODULE PROCEDURE Ncrd_Scal_Int - MODULE PROCEDURE Ncrd_1d_R8 - MODULE PROCEDURE Ncrd_1d_R4 - MODULE PROCEDURE Ncrd_1d_Int - MODULE PROCEDURE Ncrd_1d_Char - MODULE PROCEDURE Ncrd_2d_R8 - MODULE PROCEDURE Ncrd_2d_R4 - MODULE PROCEDURE Ncrd_2d_Int - MODULE PROCEDURE Ncrd_2d_Char - MODULE PROCEDURE Ncrd_3d_R8 - MODULE PROCEDURE Ncrd_3d_R4 - MODULE PROCEDURE Ncrd_3d_Int - MODULE PROCEDURE Ncrd_4d_R8 - MODULE PROCEDURE Ncrd_4d_R4 - MODULE PROCEDURE Ncrd_4d_Int - MODULE PROCEDURE Ncrd_5d_R8 - MODULE PROCEDURE Ncrd_5d_R4 - MODULE PROCEDURE Ncrd_6d_R8 - MODULE PROCEDURE Ncrd_6d_R4 - MODULE PROCEDURE Ncrd_7d_R8 - MODULE PROCEDURE Ncrd_7d_R4 - END INTERFACE + ! Public interface + PUBLIC :: NcRd + + ! Private methods overloaded by public interface + ! (see below for info about these routines & the arguments they take) + INTERFACE NcRd + MODULE PROCEDURE Ncrd_Scal + MODULE PROCEDURE Ncrd_Scal_Int + MODULE PROCEDURE Ncrd_1d_R8 + MODULE PROCEDURE Ncrd_1d_R4 + MODULE PROCEDURE Ncrd_1d_Int + MODULE PROCEDURE Ncrd_1d_Char + MODULE PROCEDURE Ncrd_2d_R8 + MODULE PROCEDURE Ncrd_2d_R4 + MODULE PROCEDURE Ncrd_2d_Int + MODULE PROCEDURE Ncrd_2d_Char + MODULE PROCEDURE Ncrd_3d_R8 + MODULE PROCEDURE Ncrd_3d_R4 + MODULE PROCEDURE Ncrd_3d_Int + MODULE PROCEDURE Ncrd_4d_R8 + MODULE PROCEDURE Ncrd_4d_R4 + MODULE PROCEDURE Ncrd_4d_Int + MODULE PROCEDURE Ncrd_5d_R8 + MODULE PROCEDURE Ncrd_5d_R4 + MODULE PROCEDURE Ncrd_6d_R8 + MODULE PROCEDURE Ncrd_6d_R4 + MODULE PROCEDURE Ncrd_7d_R8 + MODULE PROCEDURE Ncrd_7d_R4 + END INTERFACE NcRd ! ! !DESCRIPTION: Routines for reading variables in a netCDF file. !\\ @@ -54,7 +53,7 @@ MODULE HCO_m_netcdf_io_read ! Jules Kouatchou ! ! !REVISION HISTORY: -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------- !BOC @@ -67,25 +66,22 @@ MODULE HCO_m_netcdf_io_read ! ! !INTERFACE: ! - subroutine Ncrd_Scal (varrd_scal, ncid, varname) + subroutine Ncrd_Scal(varrd_scal, ncid, varname) ! ! !USES: ! - use m_do_err_out -! - implicit none -! - include "netcdf.inc" + use netCDF + use m_do_err_out ! ! !INPUT PARAMETERS: -!! ncid : netCDF file id to read variable from -!! varname : netCDF variable name - integer , intent(in) :: ncid - character (len=*), intent(in) :: varname +!! ncid : netCDF file id to read variable from +!! varname : netCDF variable name + integer , intent(in) :: ncid + character (len=*), intent(in) :: varname ! ! !OUTPUT PARAMETERS: -!! varrd_scal : variable to fill - real*8 , intent(out) :: varrd_scal +!! varrd_scal : variable to fill + real*8 , intent(out) :: varrd_scal ! ! !DESCRIPTION: Reads in a netCDF scalar variable. !\\ @@ -94,37 +90,37 @@ subroutine Ncrd_Scal (varrd_scal, ncid, varname) ! John Tannahill (LLNL) and Jules Kouatchou ! ! !REVISION HISTORY: -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------- !BOC ! ! !LOCAL VARIABLES: - character (len=512) :: err_msg - integer :: ierr - integer :: varid - real*4 :: varrd_scal_tmp + character (len=512) :: err_msg + integer :: ierr + integer :: varid + real*4 :: varrd_scal_tmp ! - ierr = Nf_Inq_Varid (ncid, varname, varid) - - if (ierr /= NF_NOERR) then - err_msg = 'In Ncrd_Scal #1: ' // Trim (varname) // & - ', ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) - end if + ierr = NF90_Inq_VarId(ncid, varname, varid) - ierr = Nf_Get_Var_Real (ncid, varid, varrd_scal_tmp) + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncrd_Scal #1: ' // Trim (varname) // & + ', ' // NF90_Strerror(ierr) + call Do_Err_Out (err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) + end if - if (ierr /= NF_NOERR) then - err_msg = 'In Ncrd_Scal #2: ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) - end if + ierr = NF90_Get_Var(ncid, varid, varrd_scal_tmp) - varrd_scal = varrd_scal_tmp + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncrd_Scal #2: ' // NF90_Strerror(ierr) + call Do_Err_Out (err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) + end if + + varrd_scal = varrd_scal_tmp - return + return - end subroutine Ncrd_Scal + end subroutine Ncrd_Scal !EOC !------------------------------------------------------------------------- !BOP @@ -133,25 +129,22 @@ end subroutine Ncrd_Scal ! ! !INTERFACE: ! - subroutine Ncrd_Scal_Int (varrd_scali, ncid, varname) + subroutine Ncrd_Scal_Int(varrd_scali, ncid, varname) ! ! !USES: ! - use m_do_err_out -! - implicit none -! - include "netcdf.inc" + use netCDF + use m_do_err_out ! ! !INPUT PARAMETERS: -!! ncid : netCDF file id to read variable from -!! varname : netCDF variable name - integer , intent(in) :: ncid - character (len=*), intent(in) :: varname +!! ncid : netCDF file id to read variable from +!! varname : netCDF variable name + integer , intent(in) :: ncid + character (len=*), intent(in) :: varname ! ! !OUTPUT PARAMETERS: -!! varrd_scali : integer variable to fill - integer , intent(out) :: varrd_scali +!! varrd_scali : integer variable to fill + integer , intent(out) :: varrd_scali ! ! !DESCRIPTION: Reads in a netCDF integer scalar variable. !\\ @@ -160,34 +153,34 @@ subroutine Ncrd_Scal_Int (varrd_scali, ncid, varname) ! John Tannahill (LLNL) and Jules Kouatchou ! ! !REVISION HISTORY: -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------- !BOC ! ! !LOCAL VARIABLES: - character (len=512) :: err_msg - integer :: ierr - integer :: varid + character (len=512) :: err_msg + integer :: ierr + integer :: varid ! - ierr = Nf_Inq_Varid (ncid, varname, varid) + ierr = NF90_Inq_VarId(ncid, varname, varid) - if (ierr /= NF_NOERR) then - err_msg = 'In Ncrd_Scal_Int #1: ' // Trim (varname) // & - ', ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) - end if + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncrd_Scal_Int #1: ' // Trim (varname) // & + ', ' // NF90_Strerror(ierr) + call Do_Err_Out (err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) + end if + + ierr = NF90_Get_Var(ncid, varid, varrd_scali) - ierr = Nf_Get_Var_Int (ncid, varid, varrd_scali) + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncrd_Scal_Int #2: ' // NF90_Strerror(ierr) + call Do_Err_Out (err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) + end if - if (ierr /= NF_NOERR) then - err_msg = 'In Ncrd_Scal_Int #2: ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) - end if - - return + return - end subroutine Ncrd_Scal_Int + end subroutine Ncrd_Scal_Int !EOC !------------------------------------------------------------------------- !BOP @@ -196,33 +189,29 @@ end subroutine Ncrd_Scal_Int ! ! !INTERFACE: ! - subroutine Ncrd_1d_R8 (varrd_1d, ncid, varname, strt1d, cnt1d, & - err_stop, stat) + subroutine Ncrd_1d_R8(varrd_1d, ncid, varname, strt1d, cnt1d, err_stop, stat) ! ! !USES: ! - use m_do_err_out -! - implicit none -! - include "netcdf.inc" + use netCDF + use m_do_err_out ! ! !INPUT PARAMETERS: -!! ncid : netCDF file id to read array input data from -!! varname : netCDF variable name for array -!! strt1d : vector specifying the index in varrd_1d where -!! the first of the data values will be read -!! cnt1d : varrd_1d dimension - integer , intent(in) :: ncid - character (len=*), intent(in) :: varname - integer , intent(in) :: strt1d(1) - integer , intent(in) :: cnt1d (1) - logical, optional, intent(in) :: err_stop +!! ncid : netCDF file id to read array input data from +!! varname : netCDF variable name for array +!! strt1d : vector specifying the index in varrd_1d where +!! the first of the data values will be read +!! cnt1d : varrd_1d dimension + integer , intent(in) :: ncid + character (len=*), intent(in) :: varname + integer , intent(in) :: strt1d(1) + integer , intent(in) :: cnt1d (1) + logical, optional, intent(in) :: err_stop ! ! !OUTPUT PARAMETERS: -!! varrd_1d : array to fill - real*8 , intent(out) :: varrd_1d(cnt1d(1)) - integer, optional, intent(out) :: stat +!! varrd_1d : array to fill + real*8 , intent(out) :: varrd_1d(cnt1d(1)) + integer, optional, intent(out) :: stat ! ! !DESCRIPTION: Reads in a 1D netCDF real array and does some error checking. !\\ @@ -231,56 +220,53 @@ subroutine Ncrd_1d_R8 (varrd_1d, ncid, varname, strt1d, cnt1d, & ! John Tannahill (LLNL) and Jules Kouatchou ! ! !REVISION HISTORY: -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------- !BOC ! ! !LOCAL VARIABLES: ! - character (len=512) :: err_msg - integer :: ierr - integer :: varid - logical :: dostop + character (len=512) :: err_msg + integer :: ierr + integer :: varid + logical :: dostop - ! set dostop flag - if ( present ( err_stop ) ) then - dostop = err_stop - else - dostop = .true. - endif + ! set dostop flag + dostop = .true. + if ( present ( err_stop ) ) dostop = err_stop - ierr = Nf_Inq_Varid (ncid, varname, varid) + ierr = NF90_Inq_VarId(ncid, varname, varid) - if (ierr /= NF_NOERR) then - if ( dostop ) then + if (ierr /= NF90_NOERR) then + if ( dostop ) then err_msg = 'In Ncrd_1d_R8 #1: ' // Trim (varname) // & - ', ' // Nf_Strerror (ierr) + ', ' // NF90_Strerror(ierr) call Do_Err_Out (err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) - else + else varrd_1d(:) = -999d0 if ( present ( stat ) ) stat = 1 return - end if - end if - - ierr = Nf_Get_Vara_Double (ncid, varid, strt1d, cnt1d, varrd_1d) - - if (ierr /= NF_NOERR) then - if ( dostop ) then - err_msg = 'In Ncrd_1d_R8 #2: ' // Nf_Strerror (ierr) + end if + end if + + ierr = NF90_Get_Var(ncid, varid, varrd_1d, start=strt1d, count=cnt1d) + + if (ierr /= NF90_NOERR) then + if ( dostop ) then + err_msg = 'In Ncrd_1d_R8 #2: ' // NF90_Strerror(ierr) call Do_Err_Out (err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) - else + else varrd_1d(:) = -999d0 if ( present ( stat ) ) stat = 2 return - endif - end if - - ! set stat to 0 (= success) - if ( present ( stat ) ) stat = 0 - - end subroutine Ncrd_1d_R8 + endif + end if + + ! set stat to 0 (= success) + if ( present ( stat ) ) stat = 0 + + end subroutine Ncrd_1d_R8 !EOC !------------------------------------------------------------------------- !BOP @@ -289,33 +275,29 @@ end subroutine Ncrd_1d_R8 ! ! !INTERFACE: ! - subroutine Ncrd_1d_R4 (varrd_1d, ncid, varname, strt1d, cnt1d, & - err_stop, stat) + subroutine Ncrd_1d_R4(varrd_1d, ncid, varname, strt1d, cnt1d, err_stop, stat) ! ! !USES: ! - use m_do_err_out -! - implicit none -! - include "netcdf.inc" + use netCDF + use m_do_err_out ! ! !INPUT PARAMETERS: -!! ncid : netCDF file id to read array input data from -!! varname : netCDF variable name for array -!! strt1d : vector specifying the index in varrd_1d where -!! the first of the data values will be read -!! cnt1d : varrd_1d dimension - integer , intent(in) :: ncid - character (len=*), intent(in) :: varname - integer , intent(in) :: strt1d(1) - integer , intent(in) :: cnt1d (1) - logical, optional, intent(in) :: err_stop +!! ncid : netCDF file id to read array input data from +!! varname : netCDF variable name for array +!! strt1d : vector specifying the index in varrd_1d where +!! the first of the data values will be read +!! cnt1d : varrd_1d dimension + integer , intent(in) :: ncid + character (len=*), intent(in) :: varname + integer , intent(in) :: strt1d(1) + integer , intent(in) :: cnt1d (1) + logical, optional, intent(in) :: err_stop ! ! !OUTPUT PARAMETERS: -!! varrd_1d : array to fill - real*4 , intent(out) :: varrd_1d(cnt1d(1)) - integer, optional, intent(out) :: stat +!! varrd_1d : array to fill + real*4 , intent(out) :: varrd_1d(cnt1d(1)) + integer, optional, intent(out) :: stat ! ! !DESCRIPTION: Reads in a 1D netCDF real array and does some error checking. !\\ @@ -324,57 +306,54 @@ subroutine Ncrd_1d_R4 (varrd_1d, ncid, varname, strt1d, cnt1d, & ! John Tannahill (LLNL) and Jules Kouatchou ! ! !REVISION HISTORY: -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------- !BOC ! ! !LOCAL VARIABLES: ! - character (len=512) :: err_msg - integer :: ierr - integer :: varid - logical :: dostop - - ! set dostop flag - if ( present ( err_stop ) ) then - dostop = err_stop - else - dostop = .true. - endif - - ierr = Nf_Inq_Varid (ncid, varname, varid) - - if (ierr /= NF_NOERR) then - if ( dostop ) then - err_msg = 'In Ncrd_1d_R4 #1: ' // Trim (varname) // & - ', ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) - else + character (len=512) :: err_msg + integer :: ierr + integer :: varid + logical :: dostop + + ! set dostop flag + dostop = .true. + if ( present ( err_stop ) ) dostop = err_stop + + ierr = NF90_Inq_VarId(ncid, varname, varid) + + if (ierr /= NF90_NOERR) then + if ( dostop ) then + err_msg = 'In Ncrd_1d_R4 #1: ' // Trim (varname) // & + ', ' // NF90_Strerror(ierr) + call Do_Err_Out (err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) + else varrd_1d(:) = -999.0 if ( present ( stat ) ) stat = 1 return - end if - end if + end if + end if - ierr = Nf_Get_Vara_Real (ncid, varid, strt1d, cnt1d, varrd_1d) + ierr = NF90_Get_Var(ncid, varid, varrd_1d, start=strt1d, count=cnt1d) - if (ierr /= NF_NOERR) then - if ( dostop ) then - err_msg = 'In Ncrd_1d_R4 #2: ' // Nf_Strerror (ierr) + if (ierr /= NF90_NOERR) then + if ( dostop ) then + err_msg = 'In Ncrd_1d_R4 #2: ' // NF90_Strerror(ierr) call Do_Err_Out (err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) - else + else varrd_1d(:) = -999.0 if ( present ( stat ) ) stat = 2 return - endif - end if + endif + end if - ! set stat to 0 (= success) - if ( present ( stat ) ) stat = 0 - return + ! set stat to 0 (= success) + if ( present ( stat ) ) stat = 0 + return - end subroutine Ncrd_1d_R4 + end subroutine Ncrd_1d_R4 !EOC !------------------------------------------------------------------------- !BOP @@ -383,34 +362,31 @@ end subroutine Ncrd_1d_R4 ! ! !INTERFACE: ! - subroutine Ncrd_1d_Int (varrd_1di, ncid, varname, strt1d, cnt1d, & - err_stop, stat) + subroutine Ncrd_1d_Int(varrd_1di, ncid, varname, strt1d, & + cnt1d, err_stop, stat) ! ! !USES: ! - use m_do_err_out -! - implicit none -! - include "netcdf.inc" + use netCDF + use m_do_err_out ! ! !INPUT PARAMETERS: ! -!! ncid : netCDF file id to read array input data from -!! varname : netCDF variable name for array -!! strt1d : vector specifying the index in varrd_1di where -!! the first of the data values will be read -!! cnt1d : varrd_1di dimension - integer , intent(in) :: ncid - character (len=*), intent(in) :: varname - integer , intent(in) :: strt1d(1) - integer , intent(in) :: cnt1d (1) - logical, optional, intent(in) :: err_stop +!! ncid : netCDF file id to read array input data from +!! varname : netCDF variable name for array +!! strt1d : vector specifying the index in varrd_1di where +!! the first of the data values will be read +!! cnt1d : varrd_1di dimension + integer , intent(in) :: ncid + character (len=*), intent(in) :: varname + integer , intent(in) :: strt1d(1) + integer , intent(in) :: cnt1d (1) + logical, optional, intent(in) :: err_stop ! ! !OUTPUT PARAMETERS: -!! varrd_1di : intger array to fill - integer , intent(out) :: varrd_1di(cnt1d(1)) - integer, optional, intent(out) :: stat +!! varrd_1di : intger array to fill + integer , intent(out) :: varrd_1di(cnt1d(1)) + integer, optional, intent(out) :: stat ! ! !DESCRIPTION: Reads in a 1D netCDF integer array and does some error ! checking. @@ -420,58 +396,55 @@ subroutine Ncrd_1d_Int (varrd_1di, ncid, varname, strt1d, cnt1d, & ! John Tannahill (LLNL) and Jules Kouatchou ! ! !REVISION HISTORY: -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------- !BOC ! ! !LOCAL VARIABLES: ! - character (len=512) :: err_msg - integer :: ierr - integer :: varid - logical :: dostop + character (len=512) :: err_msg + integer :: ierr + integer :: varid + logical :: dostop - ! set dostop flag - if ( present ( err_stop ) ) then - dostop = err_stop - else - dostop = .true. - endif + ! set dostop flag + dostop = .true. + if ( present ( err_stop ) ) dostop = err_stop - ierr = Nf_Inq_Varid (ncid, varname, varid) + ierr = NF90_Inq_VarId(ncid, varname, varid) - if (ierr /= NF_NOERR) then - if ( dostop ) then + if (ierr /= NF90_NOERR) then + if ( dostop ) then err_msg = 'In Ncrd_1d_Int #1: ' // Trim (varname) // & - ', ' // Nf_Strerror (ierr) + ', ' // NF90_Strerror(ierr) call Do_Err_Out (err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) - else + else varrd_1di(:) = -999 if ( present ( stat ) ) stat = 1 return - end if - end if + end if + end if - ierr = Nf_Get_Vara_Int (ncid, varid, strt1d, cnt1d, varrd_1di) + ierr = NF90_Get_Var(ncid, varid, varrd_1di, start=strt1d, count=cnt1d) - if (ierr /= NF_NOERR) then - if ( dostop ) then - err_msg = 'In Ncrd_1d_Int #2: ' // Nf_Strerror (ierr) + if (ierr /= NF90_NOERR) then + if ( dostop ) then + err_msg = 'In Ncrd_1d_Int #2: ' // NF90_Strerror(ierr) call Do_Err_Out (err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) - else + else varrd_1di(:) = -999 if ( present ( stat ) ) stat = 2 return - endif - end if + endif + end if - ! set stat to 0 (= success) - if ( present ( stat ) ) stat = 0 + ! set stat to 0 (= success) + if ( present ( stat ) ) stat = 0 - return + return - end subroutine Ncrd_1d_Int + end subroutine Ncrd_1d_Int !EOC !------------------------------------------------------------------------- !BOP @@ -480,30 +453,26 @@ end subroutine Ncrd_1d_Int ! ! !INTERFACE: ! - subroutine Ncrd_2d_R8 (varrd_2d, ncid, varname, strt2d, cnt2d) + subroutine Ncrd_2d_R8(varrd_2d, ncid, varname, strt2d, cnt2d) ! ! !USES: ! - use m_do_err_out -! - implicit none -! - include "netcdf.inc" -! -! !INPUT PARAMETERS: -!! ncid : netCDF file id to read array input data from -!! varname : netCDF variable name for array -!! strt2d : vector specifying the index in varrd_2d where + use netCDF + use m_do_err_out + +!! ncid : netCDF file id to read array input data from +!! varname : netCDF variable name for array +!! strt2d : vector specifying the index in varrd_2d where !! the first of the data values will be read -!! cnt2d : varrd_2d dimensions - integer , intent(in) :: ncid - character (len=*), intent(in) :: varname - integer , intent(in) :: strt2d(2) - integer , intent(in) :: cnt2d (2) +!! cnt2d : varrd_2d dimensions + integer , intent(in) :: ncid + character (len=*), intent(in) :: varname + integer , intent(in) :: strt2d(2) + integer , intent(in) :: cnt2d (2) ! ! !OUTPUT PARAMETERS: -!! varrd_2d : array to fill - real*8 , intent(out) :: varrd_2d(cnt2d(1), cnt2d(2)) +!! varrd_2d : array to fill + real*8 , intent(out) :: varrd_2d(cnt2d(1), cnt2d(2)) ! ! !DESCRIPTION: Reads in a 2D netCDF real array and does some error checking. !\\ @@ -512,32 +481,32 @@ subroutine Ncrd_2d_R8 (varrd_2d, ncid, varname, strt2d, cnt2d) ! John Tannahill (LLNL) and Jules Kouatchou ! ! !REVISION HISTORY: -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------- !BOC ! ! !LOCAL VARIABLES: - character (len=512) :: err_msg - integer :: ierr - integer :: varid + character (len=512) :: err_msg + integer :: ierr + integer :: varid ! - ierr = Nf_Inq_Varid (ncid, varname, varid) + ierr = NF90_Inq_VarId(ncid, varname, varid) - if (ierr /= NF_NOERR) then - err_msg = 'In Ncrd_2d_R8 #1: ' // Trim (varname) // & - ', ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) - end if + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncrd_2d_R8 #1: ' // Trim (varname) // & + ', ' // NF90_Strerror(ierr) + call Do_Err_Out (err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) + end if - ierr = Nf_Get_Vara_Double (ncid, varid, strt2d, cnt2d, varrd_2d) + ierr = NF90_Get_Var(ncid, varid, varrd_2d, start=strt2d, count=cnt2d) - if (ierr /= NF_NOERR) then - err_msg = 'In Ncrd_2d_R8 #2: ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) - end if + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncrd_2d_R8 #2: ' // NF90_Strerror(ierr) + call Do_Err_Out (err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) + end if - end subroutine Ncrd_2d_R8 + end subroutine Ncrd_2d_R8 !EOC !------------------------------------------------------------------------- !BOP @@ -546,30 +515,27 @@ end subroutine Ncrd_2d_R8 ! ! !INTERFACE: ! - subroutine Ncrd_2d_R4 (varrd_2d, ncid, varname, strt2d, cnt2d) + subroutine Ncrd_2d_R4(varrd_2d, ncid, varname, strt2d, cnt2d) ! ! !USES: ! - use m_do_err_out -! - implicit none -! - include "netcdf.inc" + use netCDF + use m_do_err_out ! ! !INPUT PARAMETERS: -!! ncid : netCDF file id to read array input data from -!! varname : netCDF variable name for array -!! strt2d : vector specifying the index in varrd_2d where -!! the first of the data values will be read -!! cnt2d : varrd_2d dimensions - integer , intent(in) :: ncid - character (len=*), intent(in) :: varname - integer , intent(in) :: strt2d(2) - integer , intent(in) :: cnt2d (2) +!! ncid : netCDF file id to read array input data from +!! varname : netCDF variable name for array +!! strt2d : vector specifying the index in varrd_2d where +!! the first of the data values will be read +!! cnt2d : varrd_2d dimensions + integer , intent(in) :: ncid + character (len=*), intent(in) :: varname + integer , intent(in) :: strt2d(2) + integer , intent(in) :: cnt2d (2) ! ! !OUTPUT PARAMETERS: -!! varrd_2d : array to fill - real*4 , intent(out) :: varrd_2d(cnt2d(1), cnt2d(2)) +!! varrd_2d : array to fill + real*4 , intent(out) :: varrd_2d(cnt2d(1), cnt2d(2)) ! ! !DESCRIPTION: Reads in a 2D netCDF real array and does some error checking. !\\ @@ -578,32 +544,32 @@ subroutine Ncrd_2d_R4 (varrd_2d, ncid, varname, strt2d, cnt2d) ! John Tannahill (LLNL) and Jules Kouatchou ! ! !REVISION HISTORY: -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------- !BOC ! ! !LOCAL VARIABLES: - character (len=512) :: err_msg - integer :: ierr - integer :: varid + character (len=512) :: err_msg + integer :: ierr + integer :: varid ! - ierr = Nf_Inq_Varid (ncid, varname, varid) + ierr = NF90_Inq_VarId(ncid, varname, varid) - if (ierr /= NF_NOERR) then - err_msg = 'In Ncrd_2d_R4 #1: ' // Trim (varname) // & - ', ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) - end if + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncrd_2d_R4 #1: ' // Trim (varname) // & + ', ' // NF90_Strerror(ierr) + call Do_Err_Out (err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) + end if - ierr = Nf_Get_Vara_Real (ncid, varid, strt2d, cnt2d, varrd_2d) + ierr = NF90_Get_Var(ncid, varid, varrd_2d, start=strt2d, count=cnt2d) - if (ierr /= NF_NOERR) then - err_msg = 'In Ncrd_2d_R4 #2: ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) - end if + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncrd_2d_R4 #2: ' // NF90_Strerror(ierr) + call Do_Err_Out (err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) + end if - end subroutine Ncrd_2d_R4 + end subroutine Ncrd_2d_R4 !EOC !------------------------------------------------------------------------- !BOP @@ -612,30 +578,27 @@ end subroutine Ncrd_2d_R4 ! ! !INTERFACE: ! - subroutine Ncrd_2d_Int (varrd_2di, ncid, varname, strt2d, cnt2d) + subroutine Ncrd_2d_Int(varrd_2di, ncid, varname, strt2d, cnt2d) ! ! !USES: ! - use m_do_err_out -! - implicit none -! - include "netcdf.inc" + use netCDF + use m_do_err_out ! ! !INPUT PARAMETERS: -!! ncid : netCDF file id to read array input data from -!! varname : netCDF variable name for array -!! strt2d : vector specifying the index in varrd_2d where -!! the first of the data values will be read -!! cnt2d : varrd_2di dimensions - integer , intent(in) :: ncid - character (len=*), intent(in) :: varname - integer , intent(in) :: strt2d(2) - integer , intent(in) :: cnt2d (2) +!! ncid : netCDF file id to read array input data from +!! varname : netCDF variable name for array +!! strt2d : vector specifying the index in varrd_2d where +!! the first of the data values will be read +!! cnt2d : varrd_2di dimensions + integer , intent(in) :: ncid + character (len=*), intent(in) :: varname + integer , intent(in) :: strt2d(2) + integer , intent(in) :: cnt2d (2) ! ! !OUTPUT PARAMETERS: -!! varrd_2di : intger array to fill - integer , intent(out) :: varrd_2di(cnt2d(1), cnt2d(2)) +!! varrd_2di : intger array to fill + integer , intent(out) :: varrd_2di(cnt2d(1), cnt2d(2)) ! ! !DESCRIPTION: Reads in a 2D netCDF integer array and does some error ! checking. @@ -645,32 +608,32 @@ subroutine Ncrd_2d_Int (varrd_2di, ncid, varname, strt2d, cnt2d) ! John Tannahill (LLNL) and Jules Kouatchou ! ! !REVISION HISTORY: -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------- !BOC ! ! !LOCAL VARIABLES: - character (len=512) :: err_msg - integer :: ierr - integer :: varid + character (len=512) :: err_msg + integer :: ierr + integer :: varid ! - ierr = Nf_Inq_Varid (ncid, varname, varid) + ierr = NF90_Inq_VarId(ncid, varname, varid) - if (ierr /= NF_NOERR) then - err_msg = 'In Ncrd_2d_Int #1: ' // Trim (varname) // & - ', ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) - end if + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncrd_2d_Int #1: ' // Trim (varname) // & + ', ' // NF90_Strerror(ierr) + call Do_Err_Out (err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) + end if - ierr = Nf_Get_Vara_Int (ncid, varid, strt2d, cnt2d, varrd_2di) + ierr = NF90_Get_Var(ncid, varid, varrd_2di, start=strt2d, count=cnt2d) - if (ierr /= NF_NOERR) then - err_msg = 'In Ncrd_2d_Int #2: ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) - end if + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncrd_2d_Int #2: ' // NF90_Strerror(ierr) + call Do_Err_Out (err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) + end if - end subroutine Ncrd_2d_Int + end subroutine Ncrd_2d_Int !EOC !------------------------------------------------------------------------- !BOP @@ -679,31 +642,28 @@ end subroutine Ncrd_2d_Int ! ! !INTERFACE: ! - subroutine Ncrd_3d_R8 (varrd_3d, ncid, varname, strt3d, cnt3d) + subroutine Ncrd_3d_R8(varrd_3d, ncid, varname, strt3d, cnt3d) ! ! !USES: ! - use m_do_err_out -! - implicit none -! - include "netcdf.inc" + use netCDF + use m_do_err_out ! ! !INPUT PARAMETERS: -!! ncid : netCDF file id to read array input data from -!! varname : netCDF variable name for array -!! strt3d : vector specifying the index in varrd_3d where +!! ncid : netCDF file id to read array input data from +!! varname : netCDF variable name for array +!! strt3d : vector specifying the index in varrd_3d where !! the first of the data values will be read -!! cnt3d : varrd_3d dimensions - integer , intent(in) :: ncid - character (len=*), intent(in) :: varname - integer , intent(in) :: strt3d(3) - integer , intent(in) :: cnt3d (3) +!! cnt3d : varrd_3d dimensions + integer , intent(in) :: ncid + character (len=*), intent(in) :: varname + integer , intent(in) :: strt3d(3) + integer , intent(in) :: cnt3d (3) ! ! !OUTPUT PARAMETERS: -!! varrd_3d : array to fill - real*8 , intent(out) :: varrd_3d(cnt3d(1), cnt3d(2), & - cnt3d(3)) +!! varrd_3d : array to fill + real*8 , intent(out) :: varrd_3d(cnt3d(1), cnt3d(2), & + cnt3d(3)) ! ! !DESCRIPTION: Reads in a 3D netCDF real array and does some error checking. !\\ @@ -712,32 +672,32 @@ subroutine Ncrd_3d_R8 (varrd_3d, ncid, varname, strt3d, cnt3d) ! John Tannahill (LLNL) and Jules Kouatchou ! ! !REVISION HISTORY: -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------- !BOC ! ! !LOCAL VARIABLES: - character (len=512) :: err_msg - integer :: ierr - integer :: varid + character (len=512) :: err_msg + integer :: ierr + integer :: varid ! - ierr = Nf_Inq_Varid (ncid, varname, varid) + ierr = NF90_Inq_VarId(ncid, varname, varid) - if (ierr /= NF_NOERR) then - err_msg = 'In Ncrd_3d_R8 #1: ' // Trim (varname) // & - ', ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) - end if + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncrd_3d_R8 #1: ' // Trim (varname) // & + ', ' // NF90_Strerror(ierr) + call Do_Err_Out (err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) + end if - ierr = Nf_Get_Vara_Double (ncid, varid, strt3d, cnt3d, varrd_3d) + ierr = NF90_Get_Var(ncid, varid, varrd_3d, start=strt3d, count=cnt3d) - if (ierr /= NF_NOERR) then - err_msg = 'In Ncrd_3d_R8 #2: ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) - end if + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncrd_3d_R8 #2: ' // NF90_Strerror(ierr) + call Do_Err_Out (err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) + end if - end subroutine Ncrd_3d_R8 + end subroutine Ncrd_3d_R8 !EOC !------------------------------------------------------------------------- !BOP @@ -746,31 +706,28 @@ end subroutine Ncrd_3d_R8 ! ! !INTERFACE: ! - subroutine Ncrd_3d_R4 (varrd_3d, ncid, varname, strt3d, cnt3d) + subroutine Ncrd_3d_R4(varrd_3d, ncid, varname, strt3d, cnt3d) ! ! !USES: ! - use m_do_err_out -! - implicit none -! - include "netcdf.inc" + use netCDF + use m_do_err_out ! ! !INPUT PARAMETERS: -!! ncid : netCDF file id to read array input data from -!! varname : netCDF variable name for array -!! strt3d : vector specifying the index in varrd_3d where -!! the first of the data values will be read -!! cnt3d : varrd_3d dimensions - integer , intent(in) :: ncid - character (len=*), intent(in) :: varname - integer , intent(in) :: strt3d(3) - integer , intent(in) :: cnt3d (3) +!! ncid : netCDF file id to read array input data from +!! varname : netCDF variable name for array +!! strt3d : vector specifying the index in varrd_3d where +!! the first of the data values will be read +!! cnt3d : varrd_3d dimensions + integer , intent(in) :: ncid + character (len=*), intent(in) :: varname + integer , intent(in) :: strt3d(3) + integer , intent(in) :: cnt3d (3) ! ! !OUTPUT PARAMETERS: -!! varrd_3d : array to fill - real*4 , intent(out) :: varrd_3d(cnt3d(1), cnt3d(2), & - cnt3d(3)) +!! varrd_3d : array to fill + real*4 , intent(out) :: varrd_3d(cnt3d(1), cnt3d(2), & + cnt3d(3)) ! ! !DESCRIPTION: Reads in a 3D netCDF real array and does some error checking. !\\ @@ -779,32 +736,32 @@ subroutine Ncrd_3d_R4 (varrd_3d, ncid, varname, strt3d, cnt3d) ! John Tannahill (LLNL) and Jules Kouatchou ! ! !REVISION HISTORY: -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------- !BOC ! ! !LOCAL VARIABLES: - character (len=512) :: err_msg - integer :: ierr - integer :: varid + character (len=512) :: err_msg + integer :: ierr + integer :: varid ! - ierr = Nf_Inq_Varid (ncid, varname, varid) + ierr = NF90_Inq_VarId(ncid, varname, varid) - if (ierr /= NF_NOERR) then - err_msg = 'In Ncrd_3d_R4 #1: ' // Trim (varname) // & - ', ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) - end if + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncrd_3d_R4 #1: ' // Trim (varname) // & + ', ' // NF90_Strerror(ierr) + call Do_Err_Out (err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) + end if - ierr = Nf_Get_Vara_Real (ncid, varid, strt3d, cnt3d, varrd_3d) + ierr = NF90_Get_Var(ncid, varid, varrd_3d, start=strt3d, count=cnt3d) - if (ierr /= NF_NOERR) then - err_msg = 'In Ncrd_3d_R4 #2: ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) - end if + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncrd_3d_R4 #2: ' // NF90_Strerror(ierr) + call Do_Err_Out (err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) + end if - end subroutine Ncrd_3d_R4 + end subroutine Ncrd_3d_R4 !EOC !------------------------------------------------------------------------- !BOP @@ -813,31 +770,28 @@ end subroutine Ncrd_3d_R4 ! ! !INTERFACE: ! - subroutine Ncrd_3d_Int (varrd_3di, ncid, varname, strt3d, cnt3d) + subroutine Ncrd_3d_Int(varrd_3di, ncid, varname, strt3d, cnt3d) ! ! !USES: ! - use m_do_err_out -! - implicit none -! - include "netcdf.inc" + use netCDF + use m_do_err_out ! ! !INPUT PARAMETERS: -!! ncid : netCDF file id to read array input data from -!! varname : netCDF variable name for array -!! strt3d : vector specifying the index in varrd_3d where -!! the first of the data values will be read -!! cnt3d : varrd_3di dimensions - integer , intent(in) :: ncid - character (len=*), intent(in) :: varname - integer , intent(in) :: strt3d(3) - integer , intent(in) :: cnt3d (3) +!! ncid : netCDF file id to read array input data from +!! varname : netCDF variable name for array +!! strt3d : vector specifying the index in varrd_3d where +!! the first of the data values will be read +!! cnt3d : varrd_3di dimensions + integer , intent(in) :: ncid + character (len=*), intent(in) :: varname + integer , intent(in) :: strt3d(3) + integer , intent(in) :: cnt3d (3) ! ! !OUTPUT PARAMETERS: -!! varrd_3di : intger array to fill - integer , intent(out) :: varrd_3di(cnt3d(1), cnt3d(2), & - cnt3d(3)) +!! varrd_3di : intger array to fill + integer , intent(out) :: varrd_3di(cnt3d(1), cnt3d(2), & + cnt3d(3)) ! ! !DESCRIPTION: Reads in a 3D netCDF integer array and does some error ! checking. @@ -847,32 +801,32 @@ subroutine Ncrd_3d_Int (varrd_3di, ncid, varname, strt3d, cnt3d) ! John Tannahill (LLNL) and Jules Kouatchou ! ! !REVISION HISTORY: -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------- !BOC ! ! !LOCAL VARIABLES: - character (len=512) :: err_msg - integer :: ierr - integer :: varid + character (len=512) :: err_msg + integer :: ierr + integer :: varid ! - ierr = Nf_Inq_Varid (ncid, varname, varid) + ierr = NF90_Inq_VarId(ncid, varname, varid) - if (ierr /= NF_NOERR) then - err_msg = 'In Ncrd_3d_Int #1: ' // Trim (varname) // & - ', ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) - end if + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncrd_3d_Int #1: ' // Trim (varname) // & + ', ' // NF90_Strerror(ierr) + call Do_Err_Out (err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) + end if - ierr = Nf_Get_Vara_Int (ncid, varid, strt3d, cnt3d, varrd_3di) + ierr = NF90_Get_Var(ncid, varid, varrd_3di, start=strt3d, count=cnt3d) - if (ierr /= NF_NOERR) then - err_msg = 'In Ncrd_3d_Int #2: ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) - end if + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncrd_3d_Int #2: ' // NF90_Strerror(ierr) + call Do_Err_Out (err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) + end if - end subroutine Ncrd_3d_Int + end subroutine Ncrd_3d_Int !EOC !------------------------------------------------------------------------- !BOP @@ -881,31 +835,30 @@ end subroutine Ncrd_3d_Int ! ! !INTERFACE: ! - subroutine Ncrd_4d_R8 (varrd_4d, ncid, varname, strt4d, cnt4d) + subroutine Ncrd_4d_R8(varrd_4d, ncid, varname, strt4d, cnt4d) ! ! !USES: ! - use m_do_err_out -! - implicit none + use netCDF + use m_do_err_out ! - include "netcdf.inc" + implicit none ! ! !INPUT PARAMETERS: -!! ncid : netCDF file id to read array input data from -!! varname : netCDF variable name for array -!! strt4d : vector specifying the index in varrd_4d where -!! the first of the data values will be read -!! cnt4d : varrd_4d dimensions - integer , intent(in) :: ncid - character (len=*), intent(in) :: varname - integer , intent(in) :: strt4d(4) - integer , intent(in) :: cnt4d (4) +!! ncid : netCDF file id to read array input data from +!! varname : netCDF variable name for array +!! strt4d : vector specifying the index in varrd_4d where +!! the first of the data values will be read +!! cnt4d : varrd_4d dimensions + integer , intent(in) :: ncid + character (len=*), intent(in) :: varname + integer , intent(in) :: strt4d(4) + integer , intent(in) :: cnt4d (4) ! ! !OUTPUT PARAMETERS: -!! varrd_4d : array to fill - real*8 , intent(out) :: varrd_4d(cnt4d(1), cnt4d(2), & - cnt4d(3), cnt4d(4)) +!! varrd_4d : array to fill + real*8 , intent(out) :: varrd_4d(cnt4d(1), cnt4d(2), & + cnt4d(3), cnt4d(4)) ! ! !DESCRIPTION: Reads in a 4D netCDF real array and does some error checking. !\\ @@ -914,33 +867,32 @@ subroutine Ncrd_4d_R8 (varrd_4d, ncid, varname, strt4d, cnt4d) ! John Tannahill (LLNL) and Jules Kouatchou ! ! !REVISION HISTORY: -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------- !BOC ! ! !LOCAL VARIABLES: - character (len=512) :: err_msg - integer :: ierr - integer :: varid + character (len=512) :: err_msg + integer :: ierr + integer :: varid ! - ierr = Nf_Inq_Varid (ncid, varname, varid) - - if (ierr /= NF_NOERR) then - err_msg = 'In Ncrd_4d_R8 #1: ' // Trim (varname) // & - ', ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) - end if + ierr = NF90_Inq_VarId(ncid, varname, varid) + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncrd_4d_R8 #1: ' // Trim (varname) // & + ', ' // NF90_Strerror(ierr) + call Do_Err_Out (err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) + end if - ierr = Nf_Get_Vara_Double (ncid, varid, strt4d, cnt4d, varrd_4d) + ierr = NF90_Get_Var(ncid, varid, varrd_4d, start=strt4d, count=cnt4d) - if (ierr /= NF_NOERR) then - err_msg = 'In Ncrd_4d_R8 #2: ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) - end if + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncrd_4d_R8 #2: ' // NF90_Strerror(ierr) + call Do_Err_Out (err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) + end if - end subroutine Ncrd_4d_R8 + end subroutine Ncrd_4d_R8 !EOC !------------------------------------------------------------------------- !BOP @@ -949,31 +901,28 @@ end subroutine Ncrd_4d_R8 ! ! !INTERFACE: ! - subroutine Ncrd_4d_R4 (varrd_4d, ncid, varname, strt4d, cnt4d) + subroutine Ncrd_4d_R4(varrd_4d, ncid, varname, strt4d, cnt4d) ! ! !USES: ! - use m_do_err_out -! - implicit none -! - include "netcdf.inc" + use netCDF + use m_do_err_out ! ! !INPUT PARAMETERS: -!! ncid : netCDF file id to read array input data from -!! varname : netCDF variable name for array -!! strt4d : vector specifying the index in varrd_4d where -!! the first of the data values will be read -!! cnt4d : varrd_4d dimensions - integer , intent(in) :: ncid - character (len=*), intent(in) :: varname - integer , intent(in) :: strt4d(4) - integer , intent(in) :: cnt4d (4) +!! ncid : netCDF file id to read array input data from +!! varname : netCDF variable name for array +!! strt4d : vector specifying the index in varrd_4d where +!! the first of the data values will be read +!! cnt4d : varrd_4d dimensions + integer , intent(in) :: ncid + character (len=*), intent(in) :: varname + integer , intent(in) :: strt4d(4) + integer , intent(in) :: cnt4d (4) ! ! !OUTPUT PARAMETERS: -!! varrd_4d : array to fill - real*4 , intent(out) :: varrd_4d(cnt4d(1), cnt4d(2), & - cnt4d(3), cnt4d(4)) +!! varrd_4d : array to fill + real*4 , intent(out) :: varrd_4d(cnt4d(1), cnt4d(2), & + cnt4d(3), cnt4d(4)) ! ! !DESCRIPTION: Reads in a 4D netCDF real array and does some error checking. !\\ @@ -982,32 +931,32 @@ subroutine Ncrd_4d_R4 (varrd_4d, ncid, varname, strt4d, cnt4d) ! John Tannahill (LLNL) and Jules Kouatchou ! ! !REVISION HISTORY: -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------- !BOC ! ! !LOCAL VARIABLES: - character (len=512) :: err_msg - integer :: ierr - integer :: varid + character (len=512) :: err_msg + integer :: ierr + integer :: varid ! - ierr = Nf_Inq_Varid (ncid, varname, varid) + ierr = NF90_Inq_VarId(ncid, varname, varid) - if (ierr /= NF_NOERR) then - err_msg = 'In Ncrd_4d_R4 #1: ' // Trim (varname) // & - ', ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) - end if + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncrd_4d_R4 #1: ' // Trim (varname) // & + ', ' // NF90_Strerror(ierr) + call Do_Err_Out (err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) + end if - ierr = Nf_Get_Vara_Real (ncid, varid, strt4d, cnt4d, varrd_4d) + ierr = NF90_Get_Var(ncid, varid, varrd_4d, start=strt4d, count=cnt4d) - if (ierr /= NF_NOERR) then - err_msg = 'In Ncrd_4d_R4 #2: ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) - end if + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncrd_4d_R4 #2: ' // NF90_Strerror(ierr) + call Do_Err_Out (err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) + end if - end subroutine Ncrd_4d_R4 + end subroutine Ncrd_4d_R4 !EOC !------------------------------------------------------------------------- !BOP @@ -1016,31 +965,28 @@ end subroutine Ncrd_4d_R4 ! ! !INTERFACE: ! - subroutine Ncrd_4d_Int (varrd_4di, ncid, varname, strt4d, cnt4d) + subroutine Ncrd_4d_Int(varrd_4di, ncid, varname, strt4d, cnt4d) ! ! !USES: ! - use m_do_err_out -! - implicit none -! - include "netcdf.inc" + use netCDF + use m_do_err_out ! ! !INPUT PARAMETERS: -!! ncid : netCDF file id to read array input data from -!! varname : netCDF variable name for array -!! strt3d : vector specifying the index in varrd_3d where -!! the first of the data values will be read -!! cnt3d : varrd_3di dimensions - integer , intent(in) :: ncid - character (len=*), intent(in) :: varname - integer , intent(in) :: strt4d(4) - integer , intent(in) :: cnt4d (4) +!! ncid : netCDF file id to read array input data from +!! varname : netCDF variable name for array +!! strt3d : vector specifying the index in varrd_3d where +!! the first of the data values will be read +!! cnt3d : varrd_3di dimensions + integer , intent(in) :: ncid + character (len=*), intent(in) :: varname + integer , intent(in) :: strt4d(4) + integer , intent(in) :: cnt4d (4) ! ! !OUTPUT PARAMETERS: -!! varrd_3di : intger array to fill - integer , intent(out) :: varrd_4di(cnt4d(1), cnt4d(2), & - cnt4d(3), cnt4d(4)) +!! varrd_3di : intger array to fill + integer , intent(out) :: varrd_4di(cnt4d(1), cnt4d(2), & + cnt4d(3), cnt4d(4)) ! ! !DESCRIPTION: Reads in a 3D netCDF integer array and does some error ! checking. @@ -1050,32 +996,32 @@ subroutine Ncrd_4d_Int (varrd_4di, ncid, varname, strt4d, cnt4d) ! John Tannahill (LLNL) and Jules Kouatchou ! ! !REVISION HISTORY: -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------- !BOC ! ! !LOCAL VARIABLES: - character (len=512) :: err_msg - integer :: ierr - integer :: varid + character (len=512) :: err_msg + integer :: ierr + integer :: varid ! - ierr = Nf_Inq_Varid (ncid, varname, varid) + ierr = NF90_Inq_VarId(ncid, varname, varid) - if (ierr /= NF_NOERR) then - err_msg = 'In Ncrd_3d_Int #1: ' // Trim (varname) // & - ', ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) - end if + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncrd_3d_Int #1: ' // Trim (varname) // & + ', ' // NF90_Strerror(ierr) + call Do_Err_Out (err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) + end if - ierr = Nf_Get_Vara_Int (ncid, varid, strt4d, cnt4d, varrd_4di) + ierr = NF90_Get_Var(ncid, varid, varrd_4di, start=strt4d, count=cnt4d) - if (ierr /= NF_NOERR) then - err_msg = 'In Ncrd_3d_Int #2: ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) - end if + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncrd_3d_Int #2: ' // NF90_Strerror(ierr) + call Do_Err_Out (err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) + end if - end subroutine Ncrd_4d_Int + end subroutine Ncrd_4d_Int !EOC !------------------------------------------------------------------------- !BOP @@ -1088,28 +1034,25 @@ subroutine Ncrd_5d_R8 (varrd_5d, ncid, varname, strt5d, cnt5d) ! ! !USES: ! - use m_do_err_out -! - implicit none -! - include "netcdf.inc" + use netCDF + use m_do_err_out ! ! !INPUT PARAMETERS: -!! ncid : netCDF file id to read array input data from -!! varname : netCDF variable name for array -!! strt5d : vector specifying the index in varrd_5d where -!! the first of the data values will be read -!! cnt5d : varrd_5d dimensions - integer , intent(in) :: ncid - character (len=*), intent(in) :: varname - integer , intent(in) :: strt5d(5) - integer , intent(in) :: cnt5d (5) +!! ncid : netCDF file id to read array input data from +!! varname : netCDF variable name for array +!! strt5d : vector specifying the index in varrd_5d where +!! the first of the data values will be read +!! cnt5d : varrd_5d dimensions + integer , intent(in) :: ncid + character (len=*), intent(in) :: varname + integer , intent(in) :: strt5d(5) + integer , intent(in) :: cnt5d (5) ! ! !OUTPUT PARAMETERS: -!! varrd_5d : array to fill - real*8 , intent(out) :: varrd_5d(cnt5d(1), cnt5d(2), & - cnt5d(3), cnt5d(4), & - cnt5d(5)) +!! varrd_5d : array to fill + real*8 , intent(out) :: varrd_5d(cnt5d(1), cnt5d(2), & + cnt5d(3), cnt5d(4), & + cnt5d(5)) ! ! !DESCRIPTION: Reads in a 5D netCDF real array and does some error checking. !\\ @@ -1118,32 +1061,32 @@ subroutine Ncrd_5d_R8 (varrd_5d, ncid, varname, strt5d, cnt5d) ! John Tannahill (LLNL) and Jules Kouatchou ! ! !REVISION HISTORY: -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------- !BOC ! ! !LOCAL VARIABLES: - character (len=512) :: err_msg - integer :: ierr - integer :: varid + character (len=512) :: err_msg + integer :: ierr + integer :: varid ! - ierr = Nf_Inq_Varid (ncid, varname, varid) + ierr = NF90_Inq_VarId(ncid, varname, varid) - if (ierr /= NF_NOERR) then + if (ierr /= NF90_NOERR) then err_msg = 'In Ncrd_5d_R8 #1: ' // Trim (varname) // & - ', ' // Nf_Strerror (ierr) + ', ' // NF90_Strerror(ierr) call Do_Err_Out (err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) - end if + end if - ierr = Nf_Get_Vara_Double (ncid, varid, strt5d, cnt5d, varrd_5d) + ierr = NF90_Get_Var(ncid, varid, varrd_5d, start=strt5d, count=cnt5d) - if (ierr /= NF_NOERR) then - err_msg = 'In Ncrd_5d_R8 #2: ' // Nf_Strerror (ierr) + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncrd_5d_R8 #2: ' // NF90_Strerror(ierr) call Do_Err_Out (err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) - end if + end if - end subroutine Ncrd_5d_R8 + end subroutine Ncrd_5d_R8 !EOC !------------------------------------------------------------------------- !BOP @@ -1152,30 +1095,27 @@ end subroutine Ncrd_5d_R8 ! ! !INTERFACE: ! - subroutine Ncrd_5d_R4 (varrd_5d, ncid, varname, strt5d, cnt5d) + subroutine Ncrd_5d_R4(varrd_5d, ncid, varname, strt5d, cnt5d) ! ! !USES: ! - use m_do_err_out -! - implicit none -! - include "netcdf.inc" + use netCDF + use m_do_err_out ! ! !INPUT PARAMETERS: -!! ncid : netCDF file id to read array input data from -!! varname : netCDF variable name for array -!! strt5d : vector specifying the index in varrd_5d where -!! the first of the data values will be read -!! cnt5d : varrd_5d dimensions - integer , intent(in) :: ncid - character (len=*), intent(in) :: varname - integer , intent(in) :: strt5d(5) - integer , intent(in) :: cnt5d (5) +!! ncid : netCDF file id to read array input data from +!! varname : netCDF variable name for array +!! strt5d : vector specifying the index in varrd_5d where +!! the first of the data values will be read +!! cnt5d : varrd_5d dimensions + integer , intent(in) :: ncid + character (len=*), intent(in) :: varname + integer , intent(in) :: strt5d(5) + integer , intent(in) :: cnt5d (5) ! ! !OUTPUT PARAMETERS: -!! varrd_5d : array to fill - real*4 , intent(out) :: varrd_5d(cnt5d(1), cnt5d(2), & +!! varrd_5d : array to fill + real*4 , intent(out) :: varrd_5d(cnt5d(1), cnt5d(2), & cnt5d(3), cnt5d(4), & cnt5d(5)) ! @@ -1186,32 +1126,32 @@ subroutine Ncrd_5d_R4 (varrd_5d, ncid, varname, strt5d, cnt5d) ! John Tannahill (LLNL) and Jules Kouatchou ! ! !REVISION HISTORY: -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------- !BOC ! ! !LOCAL VARIABLES: - character (len=512) :: err_msg - integer :: ierr - integer :: varid -! - ierr = Nf_Inq_Varid (ncid, varname, varid) - - if (ierr /= NF_NOERR) then - err_msg = 'In Ncrd_5d_R4 #1: ' // Trim (varname) // & - ', ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) - end if - - ierr = Nf_Get_Vara_Real (ncid, varid, strt5d, cnt5d, varrd_5d) - - if (ierr /= NF_NOERR) then - err_msg = 'In Ncrd_5d_R4 #2: ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) - end if - - end subroutine Ncrd_5d_R4 + character (len=512) :: err_msg + integer :: ierr + integer :: varid +! + ierr = NF90_Inq_VarId(ncid, varname, varid) + + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncrd_5d_R4 #1: ' // Trim (varname) // & + ', ' // NF90_Strerror(ierr) + call Do_Err_Out (err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) + end if + + ierr = NF90_Get_Var(ncid, varid, varrd_5d, start=strt5d, count=cnt5d) + + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncrd_5d_R4 #2: ' // NF90_Strerror(ierr) + call Do_Err_Out (err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) + end if + + end subroutine Ncrd_5d_R4 !EOC !------------------------------------------------------------------------- !BOP @@ -1220,32 +1160,29 @@ end subroutine Ncrd_5d_R4 ! ! !INTERFACE: ! - subroutine Ncrd_6d_R8 (varrd_6d, ncid, varname, strt6d, cnt6d) + subroutine Ncrd_6d_R8(varrd_6d, ncid, varname, strt6d, cnt6d) ! ! !USES: ! - use m_do_err_out -! - implicit none -! - include "netcdf.inc" + use netCDF + use m_do_err_out ! ! !INPUT PARAMETERS: -!! ncid : netCDF file id to read array input data from -!! varname : netCDF variable name for array -!! strt5d : vector specifying the index in varrd_5d where +!! ncid : netCDF file id to read array input data from +!! varname : netCDF variable name for array +!! strt5d : vector specifying the index in varrd_5d where !! the first of the data values will be read -!! cnt5d : varrd_5d dimensions - integer , intent(in) :: ncid - character (len=*), intent(in) :: varname - integer , intent(in) :: strt6d(6) - integer , intent(in) :: cnt6d (6) +!! cnt5d : varrd_5d dimensions + integer , intent(in) :: ncid + character (len=*), intent(in) :: varname + integer , intent(in) :: strt6d(6) + integer , intent(in) :: cnt6d (6) ! ! !OUTPUT PARAMETERS: -!! varrd_5d : array to fill - real*8 , intent(out) :: varrd_6d(cnt6d(1), cnt6d(2), & - cnt6d(3), cnt6d(4), & - cnt6d(5), cnt6d(6)) +!! varrd_5d : array to fill + real*8 , intent(out) :: varrd_6d(cnt6d(1), cnt6d(2), & + cnt6d(3), cnt6d(4), & + cnt6d(5), cnt6d(6)) ! ! !DESCRIPTION: Reads in a 5D netCDF real array and does some error checking. !\\ @@ -1255,32 +1192,32 @@ subroutine Ncrd_6d_R8 (varrd_6d, ncid, varname, strt6d, cnt6d) ! ! !REVISION HISTORY: ! 20 Dec 2011 - R. Yantosca - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------- !BOC ! ! !LOCAL VARIABLES: - character (len=512) :: err_msg - integer :: ierr - integer :: varid + character (len=512) :: err_msg + integer :: ierr + integer :: varid ! - ierr = Nf_Inq_Varid (ncid, varname, varid) + ierr = NF90_Inq_VarId(ncid, varname, varid) - if (ierr /= NF_NOERR) then - err_msg = 'In Ncrd_6d_R8 #1: ' // Trim (varname) // & - ', ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) - end if + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncrd_6d_R8 #1: ' // Trim (varname) // & + ', ' // NF90_Strerror(ierr) + call Do_Err_Out (err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) + end if - ierr = Nf_Get_Vara_Double (ncid, varid, strt6d, cnt6d, varrd_6d) + ierr = NF90_Get_Var(ncid, varid, varrd_6d, start=strt6d, count=cnt6d) - if (ierr /= NF_NOERR) then - err_msg = 'In Ncrd_6d_R8 #2: ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) - end if + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncrd_6d_R8 #2: ' // NF90_Strerror(ierr) + call Do_Err_Out (err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) + end if - end subroutine Ncrd_6d_R8 + end subroutine Ncrd_6d_R8 !EOC !------------------------------------------------------------------------- !BOP @@ -1289,32 +1226,29 @@ end subroutine Ncrd_6d_R8 ! ! !INTERFACE: ! - subroutine Ncrd_6d_R4 (varrd_6d, ncid, varname, strt6d, cnt6d) + subroutine Ncrd_6d_R4(varrd_6d, ncid, varname, strt6d, cnt6d) ! ! !USES: ! - use m_do_err_out -! - implicit none -! - include "netcdf.inc" + use netCDF + use m_do_err_out ! ! !INPUT PARAMETERS: -!! ncid : netCDF file id to read array input data from -!! varname : netCDF variable name for array -!! strt5d : vector specifying the index in varrd_5d where -!! the first of the data values will be read -!! cnt5d : varrd_5d dimensions - integer , intent(in) :: ncid - character (len=*), intent(in) :: varname - integer , intent(in) :: strt6d(6) - integer , intent(in) :: cnt6d (6) +!! ncid : netCDF file id to read array input data from +!! varname : netCDF variable name for array +!! strt5d : vector specifying the index in varrd_5d where +!! the first of the data values will be read +!! cnt5d : varrd_5d dimensions + integer , intent(in) :: ncid + character (len=*), intent(in) :: varname + integer , intent(in) :: strt6d(6) + integer , intent(in) :: cnt6d (6) ! ! !OUTPUT PARAMETERS: -!! varrd_5d : array to fill - real*4 , intent(out) :: varrd_6d(cnt6d(1), cnt6d(2), & - cnt6d(3), cnt6d(4), & - cnt6d(5), cnt6d(6)) +!! varrd_5d : array to fill + real*4 , intent(out) :: varrd_6d(cnt6d(1), cnt6d(2), & + cnt6d(3), cnt6d(4), & + cnt6d(5), cnt6d(6)) ! ! !DESCRIPTION: Reads in a 5D netCDF real array and does some error checking. !\\ @@ -1323,32 +1257,32 @@ subroutine Ncrd_6d_R4 (varrd_6d, ncid, varname, strt6d, cnt6d) ! John Tannahill (LLNL) and Jules Kouatchou ! ! !REVISION HISTORY: -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------- !BOC ! ! !LOCAL VARIABLES: - character (len=512) :: err_msg - integer :: ierr - integer :: varid + character (len=512) :: err_msg + integer :: ierr + integer :: varid ! - ierr = Nf_Inq_Varid (ncid, varname, varid) + ierr = NF90_Inq_VarId(ncid, varname, varid) - if (ierr /= NF_NOERR) then - err_msg = 'In Ncrd_6d_R4 #1: ' // Trim (varname) // & - ', ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) - end if + if ( ierr /= NF90_NOERR) then + err_msg = 'In Ncrd_6d_R4 #1: ' // Trim (varname) // & + ', ' // NF90_Strerror(ierr) + call Do_Err_Out (err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) + end if - ierr = Nf_Get_Vara_Real (ncid, varid, strt6d, cnt6d, varrd_6d) + ierr = NF90_Get_Var(ncid, varid, varrd_6d, start=strt6d, count=cnt6d) - if (ierr /= NF_NOERR) then - err_msg = 'In Ncrd_6d_R4 #2: ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) - end if + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncrd_6d_R4 #2: ' // NF90_Strerror(ierr) + call Do_Err_Out (err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) + end if - end subroutine Ncrd_6d_R4 + end subroutine Ncrd_6d_R4 !EOC !------------------------------------------------------------------------- !BOP @@ -1357,30 +1291,27 @@ end subroutine Ncrd_6d_R4 ! ! !INTERFACE: ! - subroutine Ncrd_7d_R8 (varrd_7d, ncid, varname, strt7d, cnt7d) + subroutine Ncrd_7d_R8(varrd_7d, ncid, varname, strt7d, cnt7d) ! ! !USES: ! - use m_do_err_out -! - implicit none -! - include "netcdf.inc" + use netCDF + use m_do_err_out ! ! !INPUT PARAMETERS: -!! ncid : netCDF file id to read array input data from -!! varname : netCDF variable name for array -!! strt7d : vector specifying the index in varrd_7d where -!! the first of the data values will be read -!! cnt7d : varrd_7d dimensions - integer , intent(in) :: ncid - character (len=*), intent(in) :: varname - integer , intent(in) :: strt7d(7) - integer , intent(in) :: cnt7d (7) +!! ncid : netCDF file id to read array input data from +!! varname : netCDF variable name for array +!! strt7d : vector specifying the index in varrd_7d where +!! the first of the data values will be read +!! cnt7d : varrd_7d dimensions + integer , intent(in) :: ncid + character (len=*), intent(in) :: varname + integer , intent(in) :: strt7d(7) + integer , intent(in) :: cnt7d (7) ! ! !OUTPUT PARAMETERS: -!! varrd_5d : array to fill - real*8 , intent(out) :: varrd_7d(cnt7d(1), cnt7d(2), & +!! varrd_5d : array to fill + real*8 , intent(out) :: varrd_7d(cnt7d(1), cnt7d(2), & cnt7d(3), cnt7d(4), & cnt7d(5), cnt7d(6), & cnt7d(7)) @@ -1393,32 +1324,32 @@ subroutine Ncrd_7d_R8 (varrd_7d, ncid, varname, strt7d, cnt7d) ! ! !REVISION HISTORY: ! 20 Dec 2011 - R. Yantosca - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------- !BOC ! ! !LOCAL VARIABLES: - character (len=512) :: err_msg - integer :: ierr - integer :: varid + character (len=512) :: err_msg + integer :: ierr + integer :: varid ! - ierr = Nf_Inq_Varid (ncid, varname, varid) + ierr = NF90_Inq_VarId(ncid, varname, varid) - if (ierr /= NF_NOERR) then - err_msg = 'In Ncrd_7d_R8 #1: ' // Trim (varname) // & - ', ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) - end if + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncrd_7d_R8 #1: ' // Trim (varname) // & + ', ' // NF90_Strerror(ierr) + call Do_Err_Out (err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) + end if - ierr = Nf_Get_Vara_Double (ncid, varid, strt7d, cnt7d, varrd_7d) + ierr = NF90_Get_Var(ncid, varid, varrd_7d, start=strt7d, count=cnt7d) - if (ierr /= NF_NOERR) then - err_msg = 'In Ncrd_7d_R8 #2: ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) - end if + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncrd_7d_R8 #2: ' // NF90_Strerror(ierr) + call Do_Err_Out (err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) + end if - end subroutine Ncrd_7d_R8 + end subroutine Ncrd_7d_R8 !EOC !------------------------------------------------------------------------- !BOP @@ -1427,33 +1358,30 @@ end subroutine Ncrd_7d_R8 ! ! !INTERFACE: ! - subroutine Ncrd_7d_R4 (varrd_7d, ncid, varname, strt7d, cnt7d) + subroutine Ncrd_7d_R4(varrd_7d, ncid, varname, strt7d, cnt7d) ! ! !USES: ! - use m_do_err_out -! - implicit none -! - include "netcdf.inc" + use netCDF + use m_do_err_out ! ! !INPUT PARAMETERS: -!! ncid : netCDF file id to read array input data from -!! varname : netCDF variable name for array -!! strt7d : vector specifying the index in varrd_7d where -!! the first of the data values will be read -!! cnt7d : varrd_7d dimensions - integer , intent(in) :: ncid - character (len=*), intent(in) :: varname - integer , intent(in) :: strt7d(7) - integer , intent(in) :: cnt7d (7) +!! ncid : netCDF file id to read array input data from +!! varname : netCDF variable name for array +!! strt7d : vector specifying the index in varrd_7d where +!! the first of the data values will be read +!! cnt7d : varrd_7d dimensions + integer , intent(in) :: ncid + character (len=*), intent(in) :: varname + integer , intent(in) :: strt7d(7) + integer , intent(in) :: cnt7d (7) ! ! !OUTPUT PARAMETERS: -!! varrd_7d : array to fill - real*4 , intent(out) :: varrd_7d(cnt7d(1), cnt7d(2), & - cnt7d(3), cnt7d(4), & - cnt7d(5), cnt7d(6), & - cnt7d(7)) +!! varrd_7d : array to fill + real*4 , intent(out) :: varrd_7d(cnt7d(1), cnt7d(2), & + cnt7d(3), cnt7d(4), & + cnt7d(5), cnt7d(6), & + cnt7d(7)) ! ! !DESCRIPTION: Reads in a 7D netCDF real array and does some error checking. !\\ @@ -1463,32 +1391,32 @@ subroutine Ncrd_7d_R4 (varrd_7d, ncid, varname, strt7d, cnt7d) ! ! !REVISION HISTORY: ! 20 Dec 2011 - R. Yantosca - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------- !BOC ! ! !LOCAL VARIABLES: - character (len=512) :: err_msg - integer :: ierr - integer :: varid + character (len=512) :: err_msg + integer :: ierr + integer :: varid ! - ierr = Nf_Inq_Varid (ncid, varname, varid) + ierr = NF90_Inq_VarId(ncid, varname, varid) - if (ierr /= NF_NOERR) then - err_msg = 'In Ncrd_7d_R4 #1: ' // Trim (varname) // & - ', ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) - end if + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncrd_7d_R4 #1: ' // Trim (varname) // & + ', ' // NF90_Strerror(ierr) + call Do_Err_Out (err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) + end if - ierr = Nf_Get_Vara_Real (ncid, varid, strt7d, cnt7d, varrd_7d) + ierr = NF90_Get_Var(ncid, varid, varrd_7d, start=strt7d, count=cnt7d) - if (ierr /= NF_NOERR) then - err_msg = 'In Ncrd_7d_R4 #2: ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) - end if + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncrd_7d_R4 #2: ' // NF90_Strerror(ierr) + call Do_Err_Out (err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) + end if - end subroutine Ncrd_7d_R4 + end subroutine Ncrd_7d_R4 !EOC !------------------------------------------------------------------------- !BOP @@ -1497,31 +1425,28 @@ end subroutine Ncrd_7d_R4 ! ! !INTERFACE: ! - subroutine Ncrd_1d_Char (varrd_1dc, ncid, varname, strt1d, cnt1d) + subroutine Ncrd_1d_Char(varrd_1dc, ncid, varname, strt1d, cnt1d) ! ! !USES: ! - use m_do_err_out -! - implicit none -! - include "netcdf.inc" + use netCDF + use m_do_err_out ! ! !INPUT PARAMETERS: ! -!! ncid : netCDF file id to read array input data from -!! varname : netCDF variable name for array -!! strt1d : vector specifying the index in varrd_1dc where -!! the first of the data values will be read -!! cnt1d : varrd_1dc dimension - integer , intent(in) :: ncid - character (len=*), intent(in) :: varname - integer , intent(in) :: strt1d(1) - integer , intent(in) :: cnt1d (1) +!! ncid : netCDF file id to read array input data from +!! varname : netCDF variable name for array +!! strt1d : vector specifying the index in varrd_1dc where +!! the first of the data values will be read +!! cnt1d : varrd_1dc dimension + integer , intent(in) :: ncid + character (len=*), intent(in) :: varname + integer , intent(in) :: strt1d(1) + integer , intent(in) :: cnt1d (1) ! ! !OUTPUT PARAMETERS: -!! varrd_1dc : intger array to fill - character (len=1), intent(out) :: varrd_1dc(cnt1d(1)) +!! varrd_1dc : intger array to fill + character (len=1), intent(out) :: varrd_1dc(cnt1d(1)) ! ! !DESCRIPTION: Reads in a 1D netCDF character array and does some error ! checking. @@ -1530,32 +1455,32 @@ subroutine Ncrd_1d_Char (varrd_1dc, ncid, varname, strt1d, cnt1d) ! Jules Kouatchou ! ! !REVISION HISTORY: -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------- !BOC ! ! !LOCAL VARIABLES: - character (len=512) :: err_msg - integer :: ierr - integer :: varid + character (len=512) :: err_msg + integer :: ierr + integer :: varid ! - ierr = Nf_Inq_Varid (ncid, varname, varid) + ierr = NF90_Inq_VarId(ncid, varname, varid) - if (ierr /= NF_NOERR) then - err_msg = 'In Ncrd_1d_Char #1: ' // Trim (varname) // & - ', ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) - end if + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncrd_1d_Char #1: ' // Trim (varname) // & + ', ' // NF90_Strerror(ierr) + call Do_Err_Out (err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) + end if - ierr = Nf_Get_Vara_Text (ncid, varid, strt1d, cnt1d, varrd_1dc) + ierr = NF90_Get_Var(ncid, varid, varrd_1dc, start=strt1d, count=cnt1d) - if (ierr /= NF_NOERR) then - err_msg = 'In Ncrd_1d_Char #2: ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) - end if + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncrd_1d_Char #2: ' // NF90_Strerror(ierr) + call Do_Err_Out (err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) + end if - end subroutine Ncrd_1d_Char + end subroutine Ncrd_1d_Char !EOC !------------------------------------------------------------------------- !BOP @@ -1564,30 +1489,27 @@ end subroutine Ncrd_1d_Char ! ! !INTERFACE: ! - subroutine Ncrd_2d_Char (varrd_2dc, ncid, varname, strt2d, cnt2d) + subroutine Ncrd_2d_Char(varrd_2dc, ncid, varname, strt2d, cnt2d) ! ! !USES: ! - use m_do_err_out -! - implicit none -! - include "netcdf.inc" + use netCDF + use m_do_err_out ! ! !INPUT PARAMETERS: -!! ncid : netCDF file id to read array input data from -!! varname : netCDF variable name for array -!! strt2d : vector specifying the index in varrd_2dc where -!! the first of the data values will be read -!! cnt2d : varrd_2dc dimensions - integer , intent(in) :: ncid - character (len=*), intent(in) :: varname - integer , intent(in) :: strt2d(2) - integer , intent(in) :: cnt2d (2) +!! ncid : netCDF file id to read array input data from +!! varname : netCDF variable name for array +!! strt2d : vector specifying the index in varrd_2dc where +!! the first of the data values will be read +!! cnt2d : varrd_2dc dimensions + integer , intent(in) :: ncid + character (len=*), intent(in) :: varname + integer , intent(in) :: strt2d(2) + integer , intent(in) :: cnt2d (2) ! ! !OUTPUT PARAMETERS: -!! varrd_2dc : charcter array to fill - character , intent(out) :: varrd_2dc(cnt2d(1), cnt2d(2)) +!! varrd_2dc : charcter array to fill + character , intent(out) :: varrd_2dc(cnt2d(1), cnt2d(2)) ! ! !DESCRIPTION: Reads in a 2D netCDF character array and does some error ! checking. @@ -1597,32 +1519,32 @@ subroutine Ncrd_2d_Char (varrd_2dc, ncid, varname, strt2d, cnt2d) ! Jules Kouatchou ! ! !REVISION HISTORY: -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------- !BOC ! ! !LOCAL VARIABLES: - character (len=512) :: err_msg - integer :: ierr - integer :: varid + character (len=512) :: err_msg + integer :: ierr + integer :: varid ! - ierr = Nf_Inq_Varid (ncid, varname, varid) + ierr = NF90_Inq_VarId(ncid, varname, varid) - if (ierr /= NF_NOERR) then - err_msg = 'In Ncrd_2d_Char #1: ' // Trim (varname) // & - ', ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) - end if + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncrd_2d_Char #1: ' // Trim (varname) // & + ', ' // NF90_Strerror(ierr) + call Do_Err_Out (err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) + end if - ierr = Nf_Get_Vara_Text (ncid, varid, strt2d, cnt2d, varrd_2dc) + ierr = NF90_Get_Var(ncid, varid, varrd_2dc, start=strt2d, count=cnt2d) - if (ierr /= NF_NOERR) then - err_msg = 'In Ncrd_2d_Char #2: ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) - end if + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncrd_2d_Char #2: ' // NF90_Strerror(ierr) + call Do_Err_Out (err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) + end if - end subroutine Ncrd_2d_Char + end subroutine Ncrd_2d_Char !EOC !------------------------------------------------------------------------ end module HCO_m_netcdf_io_read diff --git a/src/Shared/NcdfUtil/hco_m_netcdf_io_readattr.F90 b/src/Shared/NcdfUtil/hco_m_netcdf_io_readattr.F90 index d08bd7da..58ce4600 100644 --- a/src/Shared/NcdfUtil/hco_m_netcdf_io_readattr.F90 +++ b/src/Shared/NcdfUtil/hco_m_netcdf_io_readattr.F90 @@ -11,13 +11,9 @@ MODULE HCO_m_netcdf_io_readattr ! ! !USES: - - USE m_do_err_out - +! IMPLICIT NONE PRIVATE - - INCLUDE "netcdf.inc" ! ! !PUBLIC MEMBER FUNCTIONS: ! @@ -71,8 +67,7 @@ MODULE HCO_m_netcdf_io_readattr ! Bob Yantosca (based on code by Jules Kouatchou and Maharaj Bhat) ! ! !REVISION HISTORY: -! 25 Jan 2012 - R. Yantosca - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC @@ -93,6 +88,11 @@ MODULE HCO_m_netcdf_io_readattr ! SUBROUTINE NcGet_Var_Attr_C( fid, varName, attName, attValue ) ! +! USES: +! + USE netCDF + USE m_do_err_out +! ! !INPUT PARAMETERS: ! INTEGER, INTENT(IN) :: fId ! netCDF file ID @@ -110,8 +110,7 @@ SUBROUTINE NcGet_Var_Attr_C( fid, varName, attName, attValue ) ! Bob Yantosca (based on code by Jules Kouatchou and Maharaj Bhat) ! ! !REVISION HISTORY: -! 25 Jan 2012 - R. Yantosca - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC @@ -125,20 +124,20 @@ SUBROUTINE NcGet_Var_Attr_C( fid, varName, attName, attValue ) attValue = '' ! Check if VARNAME is a valid variable - status = Nf_Inq_Varid ( fId, varName, vId ) + status = NF90_Inq_VarId( fId, varName, vId ) ! Exit w/ error message if VARNAME is not valid - IF ( status /= NF_NOERR ) THEN + IF ( status /= NF90_NOERR ) THEN errMsg = 'In NcGet_Var_Attr_C: ' // TRIM( varName ) // & - ', ' // Nf_Strerror( status ) + ', ' // NF90_Strerror( status ) CALL Do_Err_Out( errMsg, .TRUE., 0, 0, 0, 0, 0.0d0, 0.0d0 ) ENDIF ! Get the attribute - status = Nf_Get_Att_Text( fId, vId, attName, attValue ) + status = NF90_Get_Att( fId, vId, attName, attValue ) ! Exit w/ error message if unsuccessful - IF ( status /= NF_NOERR ) THEN + IF ( status /= NF90_NOERR ) THEN errMsg = 'In NcGet_Var_Attr_C: cannot read attribute : ' // & TRIM( attName ) CALL Do_Err_Out( errMsg, .TRUE., 0, 0, 0, 0, 0.0d0, 0.0d0 ) @@ -161,6 +160,11 @@ END SUBROUTINE NcGet_Var_Attr_C ! SUBROUTINE NcGet_Var_Attr_I4( fid, varName, attName, attValue ) ! +! USES: +! + USE netCDF + USE m_do_err_out +! ! !INPUT PARAMETERS: ! INTEGER, INTENT(IN) :: fId ! netCDF file ID @@ -178,8 +182,7 @@ SUBROUTINE NcGet_Var_Attr_I4( fid, varName, attName, attValue ) ! Bob Yantosca (based on code by Jules Kouatchou and Maharaj Bhat) ! ! !REVISION HISTORY: -! 25 Jan 2012 - R. Yantosca - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC @@ -193,20 +196,20 @@ SUBROUTINE NcGet_Var_Attr_I4( fid, varName, attName, attValue ) attValue = 0 ! Check if VARNAME is a valid variable - status = Nf_Inq_Varid ( fId, varName, vId ) + status = NF90_Inq_VarId( fId, varName, vId ) ! Exit w/ error message if VARNAME is not valid - IF ( status /= NF_NOERR ) THEN + IF ( status /= NF90_NOERR ) THEN errMsg = 'In NcGet_Var_Attr_I4: ' // TRIM( varName ) // & - ', ' // Nf_Strerror( status ) + ', ' // NF90_Strerror( status ) CALL Do_Err_Out ( errMsg, .TRUE., 1, fId, 0, 0, 0.0d0, 0.0d0) ENDIF ! Get the attribute - status = Nf_Get_Att_Int( fId, vId, attName, attValue ) + status = NF90_Get_Att( fId, vId, attName, attValue ) ! Exit w/ error message if unsuccessful - IF ( status /= NF_NOERR ) THEN + IF ( status /= NF90_NOERR ) THEN errMsg = 'In NcGet_Var_Attr_I4: cannot read attribute : ' // & TRIM( attName ) CALL Do_Err_Out( errMsg, .TRUE., 0, 0, 0, 0, 0.0d0, 0.0d0 ) @@ -229,6 +232,11 @@ END SUBROUTINE NcGet_Var_Attr_I4 ! SUBROUTINE NcGet_Var_Attr_R4( fid, varName, attName, attValue ) ! +! USES: +! + USE netCDF + USE m_do_err_out +! ! !INPUT PARAMETERS: ! INTEGER, INTENT(IN) :: fId ! netCDF file ID @@ -246,8 +254,7 @@ SUBROUTINE NcGet_Var_Attr_R4( fid, varName, attName, attValue ) ! Bob Yantosca (based on code by Jules Kouatchou and Maharaj Bhat) ! ! !REVISION HISTORY: -! 25 Jan 2012 - R. Yantosca - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC @@ -261,20 +268,20 @@ SUBROUTINE NcGet_Var_Attr_R4( fid, varName, attName, attValue ) attValue = 0e0 ! Check if VARNAME is a valid variable - status = Nf_Inq_Varid ( fId, varName, vId ) + status = NF90_Inq_VarId( fId, varName, vId ) ! Exit w/ error message if VARNAME is not valid - IF ( status /= NF_NOERR ) THEN + IF ( status /= NF90_NOERR ) THEN errMsg = 'In NcGet_Var_Attr_R4: ' // TRIM( varName ) // & - ', ' // Nf_Strerror( status ) + ', ' // NF90_Strerror( status ) CALL Do_Err_Out ( errMsg, .TRUE., 1, fId, 0, 0, 0.0d0, 0.0d0) ENDIF ! Get the attribute - status = Nf_Get_Att_Real( fId, vId, attName, attValue ) + status = NF90_Get_Att( fId, vId, attName, attValue ) ! Exit w/ error message if unsuccessful - IF ( status /= NF_NOERR ) THEN + IF ( status /= NF90_NOERR ) THEN errMsg = 'In NcGet_Var_Attr_R4: cannot read attribute : ' // & TRIM( attName ) CALL Do_Err_Out( errMsg, .TRUE., 0, 0, 0, 0, 0.0d0, 0.0d0 ) @@ -297,6 +304,11 @@ END SUBROUTINE NcGet_Var_Attr_R4 ! SUBROUTINE NcGet_Var_Attr_R8( fid, varName, attName, attValue ) ! +! USES: +! + USE netCDF + USE m_do_err_out +! ! !INPUT PARAMETERS: ! INTEGER, INTENT(IN) :: fId ! netCDF file ID @@ -314,8 +326,7 @@ SUBROUTINE NcGet_Var_Attr_R8( fid, varName, attName, attValue ) ! Bob Yantosca (based on code by Jules Kouatchou and Maharaj Bhat) ! ! !REVISION HISTORY: -! 25 Jan 2012 - R. Yantosca - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC @@ -329,20 +340,20 @@ SUBROUTINE NcGet_Var_Attr_R8( fid, varName, attName, attValue ) attValue = 0d0 ! Check if VARNAME is a valid variable - status = Nf_Inq_Varid ( fId, varName, vId ) + status = NF90_Inq_VarId( fId, varName, vId ) ! Exit w/ error message if VARNAME is not valid - IF ( status /= NF_NOERR ) THEN + IF ( status /= NF90_NOERR ) THEN errMsg = 'In NcGet_Var_Attr_R8: ' // TRIM( varName ) // & - ', ' // Nf_Strerror( status ) + ', ' // NF90_Strerror( status ) CALL Do_Err_Out ( errMsg, .TRUE., 1, fId, 0, 0, 0.0d0, 0.0d0) ENDIF ! Get the attribute - status = Nf_Get_Att_Double( fId, vId, attName, attValue ) + status = NF90_Get_Att( fId, vId, attName, attValue ) ! Exit w/ error message if unsuccessful - IF ( status /= NF_NOERR ) THEN + IF ( status /= NF90_NOERR ) THEN errMsg = 'In NcGet_Var_Attr_R8: cannot read attribute : ' // & TRIM( attName ) CALL Do_Err_Out( errMsg, .TRUE., 0, 0, 0, 0, 0.0d0, 0.0d0 ) @@ -365,6 +376,11 @@ END SUBROUTINE NcGet_Var_Attr_R8 ! SUBROUTINE NcGet_Var_Attr_I4_arr( fid, varName, attName, attValue ) ! +! USES: +! + USE netCDF + USE m_do_err_out +! ! !INPUT PARAMETERS: ! INTEGER, INTENT(IN) :: fId ! netCDF file ID @@ -382,8 +398,7 @@ SUBROUTINE NcGet_Var_Attr_I4_arr( fid, varName, attName, attValue ) ! Bob Yantosca (based on code by Jules Kouatchou and Maharaj Bhat) ! ! !REVISION HISTORY: -! 25 Jan 2012 - R. Yantosca - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC @@ -397,20 +412,20 @@ SUBROUTINE NcGet_Var_Attr_I4_arr( fid, varName, attName, attValue ) attValue = 0 ! Check if VARNAME is a valid variable - status = Nf_Inq_Varid ( fId, varName, vId ) + status = NF90_Inq_VarId( fId, varName, vId ) ! Exit w/ error message if VARNAME is not valid - IF ( status /= NF_NOERR ) THEN + IF ( status /= NF90_NOERR ) THEN errMsg = 'In NcGet_Var_Attr_I4_arr: ' // TRIM( varName ) // & - ', ' // Nf_Strerror( status ) + ', ' // NF90_Strerror( status ) CALL Do_Err_Out ( errMsg, .TRUE., 1, fId, 0, 0, 0.0d0, 0.0d0) ENDIF ! Get the attribute - status = Nf_Get_Att_Int( fId, vId, attName, attValue ) + status = NF90_Get_Att( fId, vId, attName, attValue ) ! Exit w/ error message if unsuccessful - IF ( status /= NF_NOERR ) THEN + IF ( status /= NF90_NOERR ) THEN errMsg = 'In NcGet_Var_Attr_I4_arr: cannot read attribute : ' // & TRIM( attName ) CALL Do_Err_Out( errMsg, .TRUE., 0, 0, 0, 0, 0.0d0, 0.0d0 ) @@ -433,6 +448,11 @@ END SUBROUTINE NcGet_Var_Attr_I4_arr ! SUBROUTINE NcGet_Var_Attr_R4_arr( fid, varName, attName, attValue ) ! +! USES: +! + USE netCDF + USE m_do_err_out +! ! !INPUT PARAMETERS: ! INTEGER, INTENT(IN) :: fId ! netCDF file ID @@ -450,8 +470,7 @@ SUBROUTINE NcGet_Var_Attr_R4_arr( fid, varName, attName, attValue ) ! Bob Yantosca (based on code by Jules Kouatchou and Maharaj Bhat) ! ! !REVISION HISTORY: -! 25 Jan 2012 - R. Yantosca - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC @@ -465,20 +484,20 @@ SUBROUTINE NcGet_Var_Attr_R4_arr( fid, varName, attName, attValue ) attValue = 0e0 ! Check if VARNAME is a valid variable - status = Nf_Inq_Varid ( fId, varName, vId ) + status = NF90_Inq_VarId( fId, varName, vId ) ! Exit w/ error message if VARNAME is not valid - IF ( status /= NF_NOERR ) THEN + IF ( status /= NF90_NOERR ) THEN errMsg = 'In NcGet_Var_Attr_R4_arr: ' // TRIM( varName ) // & - ', ' // Nf_Strerror( status ) + ', ' // NF90_Strerror( status ) CALL Do_Err_Out ( errMsg, .TRUE., 1, fId, 0, 0, 0.0d0, 0.0d0) ENDIF ! Get the attribute - status = Nf_Get_Att_Real( fId, vId, attName, attValue ) + status = NF90_Get_Att( fId, vId, attName, attValue ) ! Exit w/ error message if unsuccessful - IF ( status /= NF_NOERR ) THEN + IF ( status /= NF90_NOERR ) THEN errMsg = 'In NcGet_Var_Attr_R4_arr: cannot read attribute : ' // & TRIM( attName ) CALL Do_Err_Out( errMsg, .TRUE., 0, 0, 0, 0, 0.0d0, 0.0d0 ) @@ -501,6 +520,11 @@ END SUBROUTINE NcGet_Var_Attr_R4_arr ! SUBROUTINE NcGet_Var_Attr_R8_arr( fid, varName, attName, attValue ) ! +! USES: +! + USE netCDF + USE m_do_err_out +! ! !INPUT PARAMETERS: ! INTEGER, INTENT(IN) :: fId ! netCDF file ID @@ -518,8 +542,7 @@ SUBROUTINE NcGet_Var_Attr_R8_arr( fid, varName, attName, attValue ) ! Bob Yantosca (based on code by Jules Kouatchou and Maharaj Bhat) ! ! !REVISION HISTORY: -! 25 Jan 2012 - R. Yantosca - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC @@ -533,20 +556,20 @@ SUBROUTINE NcGet_Var_Attr_R8_arr( fid, varName, attName, attValue ) attValue = 0d0 ! Check if VARNAME is a valid variable - status = Nf_Inq_Varid ( fId, varName, vId ) + status = NF90_Inq_VarId( fId, varName, vId ) ! Exit w/ error message if VARNAME is not valid - IF ( status /= NF_NOERR ) THEN + IF ( status /= NF90_NOERR ) THEN errMsg = 'In NcGet_Var_Attr_R8_arr: ' // TRIM( varName ) // & - ', ' // Nf_Strerror( status ) + ', ' // NF90_Strerror( status ) CALL Do_Err_Out ( errMsg, .TRUE., 1, fId, 0, 0, 0.0d0, 0.0d0) ENDIF ! Get the attribute - status = Nf_Get_Att_Double( fId, vId, attName, attValue ) + status = NF90_Get_Att( fId, vId, attName, attValue ) ! Exit w/ error message if unsuccessful - IF ( status /= NF_NOERR ) THEN + IF ( status /= NF90_NOERR ) THEN errMsg = 'In NcGet_Var_Attr_R8_arr: cannot read attribute : ' // & TRIM( attName ) CALL Do_Err_Out( errMsg, .TRUE., 0, 0, 0, 0, 0.0d0, 0.0d0 ) @@ -569,6 +592,11 @@ END SUBROUTINE NcGet_Var_Attr_R8_arr ! SUBROUTINE NcGet_Glob_Attr_C( fid, attName, attValue ) ! +! USES: +! + USE netCDF + USE m_do_err_out +! ! !INPUT PARAMETERS: ! INTEGER, INTENT(IN) :: fId ! netCDF file ID @@ -585,8 +613,7 @@ SUBROUTINE NcGet_Glob_Attr_C( fid, attName, attValue ) ! Bob Yantosca (based on code by Jules Kouatchou and Maharaj Bhat) ! ! !REVISION HISTORY: -! 25 Jan 2012 - R. Yantosca - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC @@ -600,10 +627,10 @@ SUBROUTINE NcGet_Glob_Attr_C( fid, attName, attValue ) attValue = '' ! Get the attribute - status = Nf_Get_Att_Text( fId, NF_GLOBAL, attName, attValue ) + status = NF90_Get_Att( fId, NF90_GLOBAL, attName, attValue ) ! Exit w/ error message if unsuccessful - IF ( status /= NF_NOERR ) THEN + IF ( status /= NF90_NOERR ) THEN errMsg = 'In NcGet_Glob_Attr_C: cannot read attribute : ' // & TRIM( attName ) CALL Do_Err_Out( errMsg, .TRUE., 0, 0, 0, 0, 0.0d0, 0.0d0 ) @@ -626,6 +653,11 @@ END SUBROUTINE NcGet_Glob_Attr_C ! SUBROUTINE NcGet_Glob_Attr_I4( fid, attName, attValue ) ! +! USES: +! + USE netCDF + USE m_do_err_out +! ! !INPUT PARAMETERS: ! INTEGER, INTENT(IN) :: fId ! netCDF file ID @@ -642,8 +674,7 @@ SUBROUTINE NcGet_Glob_Attr_I4( fid, attName, attValue ) ! Bob Yantosca (based on code by Jules Kouatchou and Maharaj Bhat) ! ! !REVISION HISTORY: -! 25 Jan 2012 - R. Yantosca - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC @@ -657,10 +688,10 @@ SUBROUTINE NcGet_Glob_Attr_I4( fid, attName, attValue ) attValue = 0 ! Get the attribute - status = Nf_Get_Att_Int( fId, NF_GLOBAL, attName, attValue ) + status = NF90_Get_Att( fId, NF90_GLOBAL, attName, attValue ) ! Exit w/ error message if unsuccessful - IF ( status /= NF_NOERR ) THEN + IF ( status /= NF90_NOERR ) THEN errMsg = 'In NcGet_Glob_Attr_I4: cannot read attribute : ' // & TRIM( attName ) CALL Do_Err_Out( errMsg, .TRUE., 0, 0, 0, 0, 0.0d0, 0.0d0 ) @@ -683,6 +714,11 @@ END SUBROUTINE NcGet_Glob_Attr_I4 ! SUBROUTINE NcGet_Glob_Attr_R4( fid, attName, attValue ) ! +! USES: +! + USE netCDF + USE m_do_err_out +! ! !INPUT PARAMETERS: ! INTEGER, INTENT(IN) :: fId ! netCDF file ID @@ -699,8 +735,7 @@ SUBROUTINE NcGet_Glob_Attr_R4( fid, attName, attValue ) ! Bob Yantosca (based on code by Jules Kouatchou and Maharaj Bhat) ! ! !REVISION HISTORY: -! 25 Jan 2012 - R. Yantosca - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC @@ -714,10 +749,10 @@ SUBROUTINE NcGet_Glob_Attr_R4( fid, attName, attValue ) attValue = 0e0 ! Get the attribute - status = Nf_Get_Att_Real( fId, NF_GLOBAL, attName, attValue ) + status = NF90_Get_Att( fId, NF90_GLOBAL, attName, attValue ) ! Exit w/ error message if unsuccessful - IF ( status /= NF_NOERR ) THEN + IF ( status /= NF90_NOERR ) THEN errMsg = 'In NcGet_Glob_Attr_R4: cannot read attribute : ' // & TRIM( attName ) CALL Do_Err_Out( errMsg, .TRUE., 0, 0, 0, 0, 0.0d0, 0.0d0 ) @@ -740,6 +775,11 @@ END SUBROUTINE NcGet_Glob_Attr_R4 ! SUBROUTINE NcGet_Glob_Attr_R8( fid, attName, attValue ) ! +! USES: +! + USE netCDF + USE m_do_err_out +! ! !INPUT PARAMETERS: ! INTEGER, INTENT(IN) :: fId ! netCDF file ID @@ -756,8 +796,7 @@ SUBROUTINE NcGet_Glob_Attr_R8( fid, attName, attValue ) ! Bob Yantosca (based on code by Jules Kouatchou and Maharaj Bhat) ! ! !REVISION HISTORY: -! 25 Jan 2012 - R. Yantosca - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC @@ -771,10 +810,10 @@ SUBROUTINE NcGet_Glob_Attr_R8( fid, attName, attValue ) attValue = 0d0 ! Get the attribute - status = Nf_Get_Att_Double( fId, NF_GLOBAL, attName, attValue ) + status = NF90_Get_Att( fId, NF90_GLOBAL, attName, attValue ) ! Exit w/ error message if unsuccessful - IF ( status /= NF_NOERR ) THEN + IF ( status /= NF90_NOERR ) THEN errMsg = 'In NcGet_Glob_Attr_R8: cannot read attribute : ' // & TRIM( attName ) CALL Do_Err_Out( errMsg, .TRUE., 0, 0, 0, 0, 0.0d0, 0.0d0 ) @@ -797,6 +836,11 @@ END SUBROUTINE NcGet_Glob_Attr_R8 ! SUBROUTINE NcGet_Glob_Attr_I4_arr( fid, attName, attValue ) ! +! USES: +! + USE netCDF + USE m_do_err_out +! ! !INPUT PARAMETERS: ! INTEGER, INTENT(IN) :: fId ! netCDF file ID @@ -813,8 +857,7 @@ SUBROUTINE NcGet_Glob_Attr_I4_arr( fid, attName, attValue ) ! Bob Yantosca (based on code by Jules Kouatchou and Maharaj Bhat) ! ! !REVISION HISTORY: -! 25 Jan 2012 - R. Yantosca - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC @@ -828,10 +871,10 @@ SUBROUTINE NcGet_Glob_Attr_I4_arr( fid, attName, attValue ) attValue = 0 ! Get the attribute - status = Nf_Get_Att_Int( fId, NF_GLOBAL, attName, attValue ) + status = NF90_Get_Att( fId, NF90_GLOBAL, attName, attValue ) ! Exit w/ error message if unsuccessful - IF ( status /= NF_NOERR ) THEN + IF ( status /= NF90_NOERR ) THEN errMsg = 'In NcGet_Glob_Attr_I4_arr: cannot read attribute : ' // & TRIM( attName ) CALL Do_Err_Out( errMsg, .TRUE., 0, 0, 0, 0, 0.0d0, 0.0d0 ) @@ -854,6 +897,11 @@ END SUBROUTINE NcGet_Glob_Attr_I4_arr ! SUBROUTINE NcGet_Glob_Attr_R4_arr( fid, attName, attValue ) ! +! USES: +! + USE netCDF + USE m_do_err_out +! ! !INPUT PARAMETERS: ! INTEGER, INTENT(IN) :: fId ! netCDF file ID @@ -870,8 +918,7 @@ SUBROUTINE NcGet_Glob_Attr_R4_arr( fid, attName, attValue ) ! Bob Yantosca (based on code by Jules Kouatchou and Maharaj Bhat) ! ! !REVISION HISTORY: -! 25 Jan 2012 - R. Yantosca - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC @@ -885,10 +932,10 @@ SUBROUTINE NcGet_Glob_Attr_R4_arr( fid, attName, attValue ) attValue = 0e0 ! Get the attribute - status = Nf_Get_Att_Real( fId, NF_GLOBAL, attName, attValue ) + status = NF90_Get_Att( fId, NF90_GLOBAL, attName, attValue ) ! Exit w/ error message if unsuccessful - IF ( status /= NF_NOERR ) THEN + IF ( status /= NF90_NOERR ) THEN errMsg = 'In NcGet_Glob_Attr_R4_arr: cannot read attribute : ' // & TRIM( attName ) CALL Do_Err_Out( errMsg, .TRUE., 0, 0, 0, 0, 0.0d0, 0.0d0 ) @@ -911,6 +958,11 @@ END SUBROUTINE NcGet_Glob_Attr_R4_arr ! SUBROUTINE NcGet_Glob_Attr_R8_arr( fid, attName, attValue ) ! +! USES: +! + USE netCDF + USE m_do_err_out +! ! !INPUT PARAMETERS: ! INTEGER, INTENT(IN) :: fId ! netCDF file ID @@ -927,8 +979,7 @@ SUBROUTINE NcGet_Glob_Attr_R8_arr( fid, attName, attValue ) ! Bob Yantosca (based on code by Jules Kouatchou and Maharaj Bhat) ! ! !REVISION HISTORY: -! 25 Jan 2012 - R. Yantosca - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC @@ -942,10 +993,10 @@ SUBROUTINE NcGet_Glob_Attr_R8_arr( fid, attName, attValue ) attValue = 0d0 ! Get the attribute - status = Nf_Get_Att_Double( fId, NF_GLOBAL, attName, attValue ) + status = NF90_Get_Att( fId, NF90_GLOBAL, attName, attValue ) ! Exit w/ error message if unsuccessful - IF ( status /= NF_NOERR ) THEN + IF ( status /= NF90_NOERR ) THEN errMsg = 'In NcGet_Glob_Attr_R8_arr: cannot read attribute : ' // & TRIM( attName ) CALL Do_Err_Out( errMsg, .TRUE., 0, 0, 0, 0, 0.0d0, 0.0d0 ) @@ -970,6 +1021,11 @@ END SUBROUTINE NcGet_Glob_Attr_R8_arr ! SUBROUTINE NcGet_Var_Attr_C_nostop( fId, varName, attName, attValue, RC ) ! +! USES: +! + USE netCDF + USE m_do_err_out +! ! !INPUT PARAMETERS: ! INTEGER, INTENT(IN) :: fId ! netCDF file ID @@ -988,8 +1044,7 @@ SUBROUTINE NcGet_Var_Attr_C_nostop( fId, varName, attName, attValue, RC ) ! Bob Yantosca (based on code by Jules Kouatchou and Maharaj Bhat) ! ! !REVISION HISTORY: -! 25 Jan 2012 - R. Yantosca - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC @@ -1003,19 +1058,19 @@ SUBROUTINE NcGet_Var_Attr_C_nostop( fId, varName, attName, attValue, RC ) attValue = '' ! Check if VARNAME is a valid variable - status = Nf_Inq_Varid ( fId, varName, vId ) + status = NF90_Inq_VarId( fId, varName, vId ) ! Exit w/ error message if VARNAME is not valid - IF ( status /= NF_NOERR ) THEN + IF ( status /= NF90_NOERR ) THEN RC = status RETURN ENDIF ! Get the attribute - status = Nf_Get_Att_Text( fId, vId, attName, attValue ) + status = NF90_Get_Att( fId, vId, attName, attValue ) ! Exit w/ error message if unsuccessful - IF ( status /= NF_NOERR ) THEN + IF ( status /= NF90_NOERR ) THEN RC = status RETURN ENDIF diff --git a/src/Shared/NcdfUtil/hco_m_netcdf_io_write.F90 b/src/Shared/NcdfUtil/hco_m_netcdf_io_write.F90 index 3dbd9c53..f13b431b 100644 --- a/src/Shared/NcdfUtil/hco_m_netcdf_io_write.F90 +++ b/src/Shared/NcdfUtil/hco_m_netcdf_io_write.F90 @@ -1,49 +1,47 @@ -! $Id: m_netcdf_io_write.F90,v 1.1 2009/08/04 14:52:05 bmy Exp $ !------------------------------------------------------------------------- ! NASA/GFSC, SIVO, Code 610.3 !------------------------------------------------------------------------- !BOP ! -! !MODULE: HCO_m_netcdf_io_write +! !MODULE: HCO_m_netcdf_io_write ! ! !INTERFACE: ! - module HCO_m_netcdf_io_write +MODULE HCO_m_netcdf_io_write ! - IMPLICIT NONE - PRIVATE + IMPLICIT NONE + PRIVATE ! ! !PUBLIC MEMBER FUNCTIONS: ! - ! Public interface - PUBLIC :: NcWr - - ! Private methods overloaded by public interface - ! (see below for info about these routines & the arguments they take) - INTERFACE NcWr - MODULE PROCEDURE Ncwr_Scal_R4 - MODULE PROCEDURE Ncwr_Scal_R8 - MODULE PROCEDURE Ncwr_Scal_Int - MODULE PROCEDURE Ncwr_1d_R8 - MODULE PROCEDURE Ncwr_1d_R4 - MODULE PROCEDURE Ncwr_1d_Int - MODULE PROCEDURE Ncwr_1d_Char - MODULE PROCEDURE Ncwr_2d_R8 - MODULE PROCEDURE Ncwr_2d_R4 - MODULE PROCEDURE Ncwr_2d_Int - MODULE PROCEDURE Ncwr_2d_Char - MODULE PROCEDURE Ncwr_3d_R8 - MODULE PROCEDURE Ncwr_3d_R4 - MODULE PROCEDURE Ncwr_3d_Int - MODULE PROCEDURE Ncwr_4d_R8 - MODULE PROCEDURE Ncwr_4d_R4 - MODULE PROCEDURE Ncwr_4d_Int - MODULE PROCEDURE Ncwr_5d_R8 - MODULE PROCEDURE Ncwr_5d_R4 - MODULE PROCEDURE Ncwr_6d_R8 - MODULE PROCEDURE Ncwr_6d_R4 - - END INTERFACE + ! Public interface + PUBLIC :: NcWr + + ! Private methods overloaded by public interface + ! (see below for info about these routines & the arguments they take) + INTERFACE NcWr + MODULE PROCEDURE Ncwr_Scal_R4 + MODULE PROCEDURE Ncwr_Scal_R8 + MODULE PROCEDURE Ncwr_Scal_Int + MODULE PROCEDURE Ncwr_1d_R8 + MODULE PROCEDURE Ncwr_1d_R4 + MODULE PROCEDURE Ncwr_1d_Int + MODULE PROCEDURE Ncwr_1d_Char + MODULE PROCEDURE Ncwr_2d_R8 + MODULE PROCEDURE Ncwr_2d_R4 + MODULE PROCEDURE Ncwr_2d_Int + MODULE PROCEDURE Ncwr_2d_Char + MODULE PROCEDURE Ncwr_3d_R8 + MODULE PROCEDURE Ncwr_3d_R4 + MODULE PROCEDURE Ncwr_3d_Int + MODULE PROCEDURE Ncwr_4d_R8 + MODULE PROCEDURE Ncwr_4d_R4 + MODULE PROCEDURE Ncwr_4d_Int + MODULE PROCEDURE Ncwr_5d_R8 + MODULE PROCEDURE Ncwr_5d_R4 + MODULE PROCEDURE Ncwr_6d_R8 + MODULE PROCEDURE Ncwr_6d_R4 + END INTERFACE NcWr ! ! !DESCRIPTION: Routines for writing variables in a netCDF file. !\\ @@ -51,14 +49,16 @@ module HCO_m_netcdf_io_write ! !AUTHOR: ! Jules Kouatchou ! +! !REMARKS: +! This file is based on code from NASA/GSFC, SIVO, Code 610.3 +! ! !REVISION HISTORY: ! See https://github.com/geoschem/ncdfutil for complete history !EOP !------------------------------------------------------------------------- - +!BOC CONTAINS - - +!EOC !------------------------------------------------------------------------- !BOP ! @@ -66,24 +66,20 @@ module HCO_m_netcdf_io_write ! ! !INTERFACE: ! - subroutine Ncwr_Scal_R4(varwr_scal, ncid, varname) + subroutine NcWr_Scal_R4(varwr_scal, ncid, varname) ! ! !USES: ! - use m_do_err_out -! - implicit none -! - include "netcdf.inc" + use netCDF + use m_do_err_out ! ! !INPUT PARAMETERS: -!! ncid : netCDF file id to write variable to -!! varname : netCDF variable name -!! varwr_scal : variable to write out - integer , intent(in) :: ncid - character (len=*), intent(in) :: varname - real*4 , intent(in) :: varwr_scal - +!! ncid : netCDF file id to write variable to +!! varname : netCDF variable name +!! varwr_scal : variable to write out + integer , intent(in) :: ncid + character(len=*), intent(in) :: varname + real*4 , intent(in) :: varwr_scal ! ! !DESCRIPTION: Writes out a netCDF real scalar variable. !\\ @@ -98,26 +94,27 @@ subroutine Ncwr_Scal_R4(varwr_scal, ncid, varname) !BOC ! ! !LOCAL VARIABLES: - character (len=512) :: err_msg - integer :: ierr - integer :: varid + character(len=512) :: err_msg + integer :: ierr + integer :: varid ! - ierr = Nf_Inq_Varid (ncid, varname, varid) + ierr = NF90_Inq_VarId(ncid, varname, varid) - if (ierr /= NF_NOERR) then - err_msg = 'In Ncwr_Scal_R4 #1: ' // Trim (varname) // & - ', ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) - end if + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncwr_Scal_R4 #1: ' // Trim(varname) // & + ', ' // NF90_strerror(ierr) + call Do_Err_Out(err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) + end if - ierr = Nf_Put_Var_Real (ncid, varid, varwr_scal) + ierr = Nf90_Put_Var(ncid, varid, varwr_scal) - if (ierr /= NF_NOERR) then - err_msg = 'In Ncwr_Scal+R4 #2: ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) - end if + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncwr_Scal+R4 #2: ' // NF90_strerror(ierr) + call Do_Err_Out(err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) + end if + + end subroutine Ncwr_Scal_R4 - end subroutine Ncwr_Scal_R4 !------------------------------------------------------------------------- !BOP ! @@ -125,23 +122,20 @@ end subroutine Ncwr_Scal_R4 ! ! !INTERFACE: ! - subroutine Ncwr_Scal_R8 (varwr_scal, ncid, varname) + subroutine Ncwr_Scal_R8(varwr_scal, ncid, varname) ! ! !USES: ! - use m_do_err_out -! - implicit none -! - include "netcdf.inc" + use netCDF + use m_do_err_out ! ! !INPUT PARAMETERS: -!! ncid : netCDF file id to write variable to -!! varname : netCDF variable name -!! varwr_scal : variable to write out - integer , intent(in) :: ncid - character (len=*), intent(in) :: varname - real*8 , intent(in) :: varwr_scal +!! ncid : netCDF file id to write variable to +!! varname : netCDF variable name +!! varwr_scal : variable to write out + integer , intent(in) :: ncid + character(len=*), intent(in) :: varname + real*8 , intent(in) :: varwr_scal ! ! !DESCRIPTION: Writes out a netCDF real scalar variable. !\\ @@ -156,26 +150,26 @@ subroutine Ncwr_Scal_R8 (varwr_scal, ncid, varname) !BOC ! ! !LOCAL VARIABLES: - character (len=512) :: err_msg - integer :: ierr - integer :: varid + character(len=512) :: err_msg + integer :: ierr + integer :: varid ! - ierr = Nf_Inq_Varid (ncid, varname, varid) + ierr = NF90_Inq_Varid(ncid, varname, varid) - if (ierr /= NF_NOERR) then - err_msg = 'In Ncwr_Scal_R8 #1: ' // Trim (varname) // & - ', ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) - end if + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncwr_Scal_R8 #1: ' // Trim(varname) // & + ', ' // NF90_strerror(ierr) + call Do_Err_Out(err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) + end if - ierr = Nf_Put_Var_Double(ncid, varid, varwr_scal) + ierr = NF90_Put_Var(ncid, varid, varwr_scal) - if (ierr /= NF_NOERR) then - err_msg = 'In Ncwr_Scal_R8 #2: ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) - end if + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncwr_Scal_R8 #2: ' // NF90_strerror(ierr) + call Do_Err_Out(err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) + end if - end subroutine Ncwr_Scal_R8 + end subroutine Ncwr_Scal_R8 !EOC !------------------------------------------------------------------------- !BOP @@ -184,23 +178,20 @@ end subroutine Ncwr_Scal_R8 ! ! !INTERFACE: ! - subroutine Ncwr_Scal_Int (varwr_scali, ncid, varname) + subroutine Ncwr_Scal_Int(varwr_scali, ncid, varname) ! ! !USES: ! - use m_do_err_out -! - implicit none -! - include "netcdf.inc" + use netCDF + use m_do_err_out ! ! !INPUT PARAMETERS: -!! ncid : netCDF file id to write variable to -!! varname : netCDF variable name -!! varwr_scali : integer variable to write out - integer , intent(in) :: ncid - character (len=*), intent(in) :: varname - integer , intent(in) :: varwr_scali +!! ncid : netCDF file id to write variable to +!! varname : netCDF variable name +!! varwr_scali : integer variable to write out + integer , intent(in) :: ncid + character(len=*), intent(in) :: varname + integer , intent(in) :: varwr_scali ! ! !DESCRIPTION: Writes out a netCDF integer scalar variable. !\\ @@ -215,26 +206,26 @@ subroutine Ncwr_Scal_Int (varwr_scali, ncid, varname) !BOC ! ! !LOCAL VARIABLES: - character (len=512) :: err_msg - integer :: ierr - integer :: varid + character(len=512) :: err_msg + integer :: ierr + integer :: varid ! - ierr = Nf_Inq_Varid (ncid, varname, varid) + ierr = NF90_Inq_Varid(ncid, varname, varid) - if (ierr /= NF_NOERR) then - err_msg = 'In Ncwr_Scal_Int #1: ' // Trim (varname) // & - ', ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) - end if + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncwr_Scal_Int #1: ' // Trim(varname) // & + ', ' // NF90_strerror(ierr) + call Do_Err_Out(err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) + end if - ierr = Nf_Put_Var_Int (ncid, varid, varwr_scali) + ierr = NF90_Put_Var(ncid, varid, varwr_scali) - if (ierr /= NF_NOERR) then - err_msg = 'In Ncwr_Scal_Int #2: ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) - end if + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncwr_Scal_Int #2: ' // NF90_strerror(ierr) + call Do_Err_Out(err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) + end if - end subroutine Ncwr_Scal_Int + end subroutine Ncwr_Scal_Int !EOC !------------------------------------------------------------------------- !BOP @@ -243,28 +234,25 @@ end subroutine Ncwr_Scal_Int ! ! !INTERFACE: ! - subroutine Ncwr_1d_R8 (varwr_1d, ncid, varname, strt1d, cnt1d) + subroutine Ncwr_1d_R8(varwr_1d, ncid, varname, strt1d, cnt1d) ! ! !USES: ! - use m_do_err_out -! - implicit none -! - include "netcdf.inc" + use netCDF + use m_do_err_out ! ! !INPUT PARAMETERS: -!! ncid : netCDF file id to write array output data to -!! varname : netCDF variable name for array -!! strt1d : vector specifying the index in varwr_1d where -!! the first of the data values will be written -!! cnt1d : varwr_1d dimension -!! varwr_1d : array to write out - integer , intent(in) :: ncid - character (len=*), intent(in) :: varname - integer , intent(in) :: strt1d(1) - integer , intent(in) :: cnt1d (1) - real*8 , intent(in) :: varwr_1d(cnt1d(1)) +!! ncid : netCDF file id to write array output data to +!! varname : netCDF variable name for array +!! strt1d : vector specifying the index in varwr_1d where +!! the first of the data values will be written +!! cnt1d : varwr_1d dimension +!! varwr_1d : array to write out + integer , intent(in) :: ncid + character(len=*), intent(in) :: varname + integer , intent(in) :: strt1d(1) + integer , intent(in) :: cnt1d (1) + real*8 , intent(in) :: varwr_1d(cnt1d(1)) ! ! !DESCRIPTION: Writes out a 1D netCDF real array and does some error ! checking. @@ -280,26 +268,26 @@ subroutine Ncwr_1d_R8 (varwr_1d, ncid, varname, strt1d, cnt1d) !BOC ! ! !LOCAL VARIABLES: - character (len=512) :: err_msg - integer :: ierr - integer :: varid -! - ierr = Nf_Inq_Varid (ncid, varname, varid) - - if (ierr /= NF_NOERR) then - err_msg = 'In Ncwr_1d_R8 #1: ' // Trim (varname) // & - ', ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) - end if - - ierr = Nf_Put_Vara_Double (ncid, varid, strt1d, cnt1d, varwr_1d) - - if (ierr /= NF_NOERR) then - err_msg = 'In Ncwr_1d_R8 #2: ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) - end if - - end subroutine Ncwr_1d_R8 + character(len=512) :: err_msg + integer :: ierr + integer :: varid +! + ierr = NF90_Inq_Varid(ncid, varname, varid) + + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncwr_1d_R8 #1: ' // Trim(varname) // & + ', ' // NF90_strerror(ierr) + call Do_Err_Out(err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) + end if + + ierr = NF90_Put_Var(ncid, varid, varwr_1d, start=strt1d, count=cnt1d) + + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncwr_1d_R8 #2: ' // NF90_strerror(ierr) + call Do_Err_Out(err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) + end if + + end subroutine Ncwr_1d_R8 !EOC !------------------------------------------------------------------------- !BOP @@ -308,28 +296,25 @@ end subroutine Ncwr_1d_R8 ! ! !INTERFACE: ! - subroutine Ncwr_1d_R4 (varwr_1d, ncid, varname, strt1d, cnt1d) + subroutine Ncwr_1d_R4(varwr_1d, ncid, varname, strt1d, cnt1d) ! ! !USES: ! - use m_do_err_out -! - implicit none -! - include "netcdf.inc" + use netCDF + use m_do_err_out ! ! !INPUT PARAMETERS: -!! ncid : netCDF file id to write array output data to -!! varname : netCDF variable name for array -!! strt1d : vector specifying the index in varwr_1d where -!! the first of the data values will be written -!! cnt1d : varwr_1d dimension -!! varwr_1d : array to write out - integer , intent(in) :: ncid - character (len=*), intent(in) :: varname - integer , intent(in) :: strt1d(1) - integer , intent(in) :: cnt1d (1) - real*4 , intent(in) :: varwr_1d(cnt1d(1)) +!! ncid : netCDF file id to write array output data to +!! varname : netCDF variable name for array +!! strt1d : vector specifying the index in varwr_1d where +!! the first of the data values will be written +!! cnt1d : varwr_1d dimension +!! varwr_1d : array to write out + integer , intent(in) :: ncid + character (len=*), intent(in) :: varname + integer , intent(in) :: strt1d(1) + integer , intent(in) :: cnt1d (1) + real*4 , intent(in) :: varwr_1d(cnt1d(1)) ! ! !DESCRIPTION: Writes out a 1D netCDF real array and does some error ! checking. @@ -345,26 +330,26 @@ subroutine Ncwr_1d_R4 (varwr_1d, ncid, varname, strt1d, cnt1d) !BOC ! ! !LOCAL VARIABLES: - character (len=512) :: err_msg - integer :: ierr - integer :: varid + character(len=512) :: err_msg + integer :: ierr + integer :: varid ! - ierr = Nf_Inq_Varid (ncid, varname, varid) + ierr = NF90_Inq_Varid(ncid, varname, varid) - if (ierr /= NF_NOERR) then - err_msg = 'In Ncwr_1d_R4 #1: ' // Trim (varname) // & - ', ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) - end if + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncwr_1d_R4 #1: ' // Trim(varname) // & + ', ' // NF90_strerror(ierr) + call Do_Err_Out(err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) + end if - ierr = Nf_Put_Vara_Real (ncid, varid, strt1d, cnt1d, varwr_1d) + ierr = NF90_Put_Var(ncid, varid, varwr_1d, start=strt1d, count=cnt1d) - if (ierr /= NF_NOERR) then - err_msg = 'In Ncwr_1d_R4 #2: ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) - end if + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncwr_1d_R4 #2: ' // NF90_strerror(ierr) + call Do_Err_Out(err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) + end if - end subroutine Ncwr_1d_R4 + end subroutine Ncwr_1d_R4 !EOC !------------------------------------------------------------------------- !BOP @@ -373,28 +358,25 @@ end subroutine Ncwr_1d_R4 ! ! !INTERFACE: ! - subroutine Ncwr_1d_Int (varwr_1di, ncid, varname, strt1d, cnt1d) + subroutine Ncwr_1d_Int(varwr_1di, ncid, varname, strt1d, cnt1d) ! ! !USES: ! - use m_do_err_out -! - implicit none -! - include "netcdf.inc" + use netCDF + use m_do_err_out ! ! !INPUT PARAMETERS: -!! ncid : netCDF file id to write array output data to -!! varname : netCDF variable name for array -!! strt1d : vector specifying the index in varwr_1di where -!! the first of the data values will be written -!! cnt1d : varwr_1di dimension -!! varwr_1di : intger array to write out - integer , intent(in) :: ncid - character (len=*), intent(in) :: varname - integer , intent(in) :: strt1d(1) - integer , intent(in) :: cnt1d (1) - integer , intent(in) :: varwr_1di(cnt1d(1)) +!! ncid : netCDF file id to write array output data to +!! varname : netCDF variable name for array +!! strt1d : vector specifying the index in varwr_1di where +!! the first of the data values will be written +!! cnt1d : varwr_1di dimension +!! varwr_1di : intger array to write out + integer , intent(in) :: ncid + character(len=*), intent(in) :: varname + integer , intent(in) :: strt1d(1) + integer , intent(in) :: cnt1d (1) + integer , intent(in) :: varwr_1di(cnt1d(1)) ! ! !DESCRIPTION: Writes out a 1D netCDF integer array and does some error ! checking. @@ -410,26 +392,26 @@ subroutine Ncwr_1d_Int (varwr_1di, ncid, varname, strt1d, cnt1d) !BOC ! ! !LOCAL VARIABLES: - character (len=512) :: err_msg - integer :: ierr - integer :: varid + character(len=512) :: err_msg + integer :: ierr + integer :: varid ! - ierr = Nf_Inq_Varid (ncid, varname, varid) + ierr = NF90_Inq_Varid(ncid, varname, varid) - if (ierr /= NF_NOERR) then - err_msg = 'In Ncwr_1d_Int #1: ' // Trim (varname) // & - ', ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) - end if + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncwr_1d_Int #1: ' // Trim(varname) // & + ', ' // NF90_strerror(ierr) + call Do_Err_Out(err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) + end if - ierr = Nf_Put_Vara_Int (ncid, varid, strt1d, cnt1d, varwr_1di) + ierr = NF90_Put_Var(ncid, varid, varwr_1di, start=strt1d, count=cnt1d) - if (ierr /= NF_NOERR) then - err_msg = 'In Ncwr_1d_Int #2: ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) - end if + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncwr_1d_Int #2: ' // NF90_strerror(ierr) + call Do_Err_Out(err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) + end if - end subroutine Ncwr_1d_Int + end subroutine Ncwr_1d_Int !EOC !------------------------------------------------------------------------- !BOP @@ -438,28 +420,25 @@ end subroutine Ncwr_1d_Int ! ! !INTERFACE: ! - subroutine Ncwr_2d_R8 (varwr_2d, ncid, varname, strt2d, cnt2d) + subroutine Ncwr_2d_R8(varwr_2d, ncid, varname, strt2d, cnt2d) ! ! !USES: ! - use m_do_err_out -! - implicit none -! - include "netcdf.inc" + use netCDF + use m_do_err_out ! ! !INPUT PARAMETERS: -!! ncid : netCDF file id to write array output data to -!! varname : netCDF variable name for array -!! strt2d : vector specifying the index in varwr_2d where -!! the first of the data values will be written -!! cnt2d : varwr_2d dimensions -!! varwr_2d : array to write out - integer , intent(in) :: ncid - character (len=*), intent(in) :: varname - integer , intent(in) :: strt2d(2) - integer , intent(in) :: cnt2d (2) - real*8 , intent(in) :: varwr_2d(cnt2d(1), cnt2d(2)) +!! ncid : netCDF file id to write array output data to +!! varname : netCDF variable name for array +!! strt2d : vector specifying the index in varwr_2d where +!! the first of the data values will be written +!! cnt2d : varwr_2d dimensions +!! varwr_2d : array to write out + integer , intent(in) :: ncid + character(len=*), intent(in) :: varname + integer , intent(in) :: strt2d(2) + integer , intent(in) :: cnt2d (2) + real*8 , intent(in) :: varwr_2d(cnt2d(1), cnt2d(2)) ! ! !DESCRIPTION: Writes out a 2D netCDF real array and does some error checking. !\\ @@ -474,26 +453,26 @@ subroutine Ncwr_2d_R8 (varwr_2d, ncid, varname, strt2d, cnt2d) !BOC ! ! !LOCAL VARIABLES: - character (len=512) :: err_msg - integer :: ierr - integer :: varid + character(len=512) :: err_msg + integer :: ierr + integer :: varid ! - ierr = Nf_Inq_Varid (ncid, varname, varid) + ierr = NF90_Inq_Varid (ncid, varname, varid) - if (ierr /= NF_NOERR) then - err_msg = 'In Ncwr_2d_R8 #1: ' // Trim (varname) // & - ', ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) - end if + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncwr_2d_R8 #1: ' // Trim(varname) // & + ', ' // NF90_strerror(ierr) + call Do_Err_Out(err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) + end if - ierr = Nf_Put_Vara_Double (ncid, varid, strt2d, cnt2d, varwr_2d) + ierr = NF90_Put_Var(ncid, varid, varwr_2d, start=strt2d, count=cnt2d) - if (ierr /= NF_NOERR) then - err_msg = 'In Ncwr_2d_R8 #2: ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) - end if + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncwr_2d_R8 #2: ' // NF90_strerror(ierr) + call Do_Err_Out(err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) + end if - end subroutine Ncwr_2d_R8 + end subroutine Ncwr_2d_R8 !EOC !------------------------------------------------------------------------- !BOP @@ -502,28 +481,25 @@ end subroutine Ncwr_2d_R8 ! ! !INTERFACE: ! - subroutine Ncwr_2d_R4 (varwr_2d, ncid, varname, strt2d, cnt2d) + subroutine Ncwr_2d_R4(varwr_2d, ncid, varname, strt2d, cnt2d) ! ! !USES: ! - use m_do_err_out -! - implicit none -! - include "netcdf.inc" + use netCDF + use m_do_err_out ! ! !INPUT PARAMETERS: -!! ncid : netCDF file id to write array output data to -!! varname : netCDF variable name for array -!! strt2d : vector specifying the index in varwr_2d where -!! the first of the data values will be written -!! cnt2d : varwr_2d dimensions -!! varwr_2d : array to write out - integer , intent(in) :: ncid - character (len=*), intent(in) :: varname - integer , intent(in) :: strt2d(2) - integer , intent(in) :: cnt2d (2) - real*4 , intent(in) :: varwr_2d(cnt2d(1), cnt2d(2)) +!! ncid : netCDF file id to write array output data to +!! varname : netCDF variable name for array +!! strt2d : vector specifying the index in varwr_2d where +!! the first of the data values will be written +!! cnt2d : varwr_2d dimensions +!! varwr_2d : array to write out + integer , intent(in) :: ncid + character (len=*), intent(in) :: varname + integer , intent(in) :: strt2d(2) + integer , intent(in) :: cnt2d (2) + real*4 , intent(in) :: varwr_2d(cnt2d(1), cnt2d(2)) ! ! !DESCRIPTION: Writes out a 2D netCDF real array and does some error checking. !\\ @@ -538,26 +514,26 @@ subroutine Ncwr_2d_R4 (varwr_2d, ncid, varname, strt2d, cnt2d) !BOC ! ! !LOCAL VARIABLES: - character (len=512) :: err_msg - integer :: ierr - integer :: varid + character(len=512) :: err_msg + integer :: ierr + integer :: varid ! - ierr = Nf_Inq_Varid (ncid, varname, varid) + ierr = NF90_Inq_Varid(ncid, varname, varid) - if (ierr /= NF_NOERR) then - err_msg = 'In Ncwr_2d_R4 #1: ' // Trim (varname) // & - ', ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) - end if + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncwr_2d_R4 #1: ' // Trim(varname) // & + ', ' // NF90_strerror(ierr) + call Do_Err_Out(err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) + end if - ierr = Nf_Put_Vara_Real (ncid, varid, strt2d, cnt2d, varwr_2d) + ierr = NF90_Put_Var(ncid, varid, varwr_2d, start=strt2d, count=cnt2d) - if (ierr /= NF_NOERR) then - err_msg = 'In Ncwr_2d_R4 #2: ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) - end if + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncwr_2d_R4 #2: ' // NF90_strerror(ierr) + call Do_Err_Out(err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) + end if - end subroutine Ncwr_2d_R4 + end subroutine Ncwr_2d_R4 !EOC !------------------------------------------------------------------------- !BOP @@ -566,28 +542,25 @@ end subroutine Ncwr_2d_R4 ! ! !INTERFACE: ! - subroutine Ncwr_2d_Int (varwr_2di, ncid, varname, strt2d, cnt2d) + subroutine Ncwr_2d_Int(varwr_2di, ncid, varname, strt2d, cnt2d) ! ! !USES: ! - use m_do_err_out -! - implicit none -! - include "netcdf.inc" + use netCDF + use m_do_err_out ! ! !INPUT PARAMETERS: -!! ncid : netCDF file id to write array output data to -!! varname : netCDF variable name for array -!! strt2d : vector specifying the index in varwr_2di where -!! the first of the data values will be written -!! cnt2d : varwr_2di dimensions -!! varwr_2di : intger array to write out - integer , intent(in) :: ncid - character (len=*), intent(in) :: varname - integer , intent(in) :: strt2d(2) - integer , intent(in) :: cnt2d (2) - integer , intent(in) :: varwr_2di(cnt2d(1), cnt2d(2)) +!! ncid : netCDF file id to write array output data to +!! varname : netCDF variable name for array +!! strt2d : vector specifying the index in varwr_2di where +!! the first of the data values will be written +!! cnt2d : varwr_2di dimensions +!! varwr_2di : intger array to write out + integer , intent(in) :: ncid + character(len=*), intent(in) :: varname + integer , intent(in) :: strt2d(2) + integer , intent(in) :: cnt2d (2) + integer , intent(in) :: varwr_2di(cnt2d(1), cnt2d(2)) ! ! !DESCRIPTION: Writes out a 2D netCDF integer array and does some error ! checking. @@ -603,26 +576,26 @@ subroutine Ncwr_2d_Int (varwr_2di, ncid, varname, strt2d, cnt2d) !BOC ! ! !LOCAL VARIABLES: - character (len=512) :: err_msg - integer :: ierr - integer :: varid + character(len=512) :: err_msg + integer :: ierr + integer :: varid ! - ierr = Nf_Inq_Varid (ncid, varname, varid) + ierr = NF90_Inq_Varid(ncid, varname, varid) - if (ierr /= NF_NOERR) then - err_msg = 'In Ncwr_2d_Int #1: ' // Trim (varname) // & - ', ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) - end if + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncwr_2d_Int #1: ' // Trim(varname) // & + ', ' // NF90_strerror(ierr) + call Do_Err_Out(err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) + end if - ierr = Nf_Put_Vara_Int (ncid, varid, strt2d, cnt2d, varwr_2di) + ierr = NF90_Put_Var(ncid, varid, varwr_2di, start=strt2d, count=cnt2d) - if (ierr /= NF_NOERR) then - err_msg = 'In Ncwr_2d_Int #2: ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) - end if + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncwr_2d_Int #2: ' // NF90_strerror(ierr) + call Do_Err_Out(err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) + end if - end subroutine Ncwr_2d_Int + end subroutine Ncwr_2d_Int !EOC !------------------------------------------------------------------------- !BOP @@ -631,28 +604,25 @@ end subroutine Ncwr_2d_Int ! ! !INTERFACE: ! - subroutine Ncwr_3d_R8 (varwr_3d, ncid, varname, strt3d, cnt3d) + subroutine Ncwr_3d_R8(varwr_3d, ncid, varname, strt3d, cnt3d) ! ! !USES: ! - use m_do_err_out -! - implicit none -! - include "netcdf.inc" + use netCDF + use m_do_err_out ! ! !INPUT PARAMETERS: -!! ncid : netCDF file id to write array output data to -!! varname : netCDF variable name for array -!! strt3d : vector specifying the index in varwr_3d where -!! the first of the data values will be written -!! cnt3d : varwr_3d dimensions -!! varwr_3d : array to write out - integer , intent(in) :: ncid - character (len=*), intent(in) :: varname - integer , intent(in) :: strt3d(3) - integer , intent(in) :: cnt3d (3) - real*8 , intent(in) :: varwr_3d(cnt3d(1), cnt3d(2), cnt3d(3)) +!! ncid : netCDF file id to write array output data to +!! varname : netCDF variable name for array +!! strt3d : vector specifying the index in varwr_3d where +!! the first of the data values will be written +!! cnt3d : varwr_3d dimensions +!! varwr_3d : array to write out + integer , intent(in) :: ncid + character(len=*), intent(in) :: varname + integer , intent(in) :: strt3d(3) + integer , intent(in) :: cnt3d (3) + real*8 , intent(in) :: varwr_3d(cnt3d(1), cnt3d(2), cnt3d(3)) ! ! !DESCRIPTION: Writes out a 3D netCDF real array and does some error checking. !\\ @@ -667,26 +637,26 @@ subroutine Ncwr_3d_R8 (varwr_3d, ncid, varname, strt3d, cnt3d) !BOC ! ! !LOCAL VARIABLES: - character (len=512) :: err_msg - integer :: ierr - integer :: varid + character(len=512) :: err_msg + integer :: ierr + integer :: varid ! - ierr = Nf_Inq_Varid (ncid, varname, varid) + ierr = NF90_Inq_Varid(ncid, varname, varid) - if (ierr /= NF_NOERR) then - err_msg = 'In Ncwr_3d_R8 #1: ' // Trim (varname) // & - ', ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) - end if + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncwr_3d_R8 #1: ' // Trim(varname) // & + ', ' // NF90_strerror(ierr) + call Do_Err_Out(err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) + end if - ierr = Nf_Put_Vara_Double (ncid, varid, strt3d, cnt3d, varwr_3d) + ierr = NF90_Put_Var(ncid, varid, varwr_3d, start=strt3d, count=cnt3d) - if (ierr /= NF_NOERR) then - err_msg = 'In Ncwr_3d_R8 #2: ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) - end if + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncwr_3d_R8 #2: ' // NF90_strerror(ierr) + call Do_Err_Out(err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) + end if - end subroutine Ncwr_3d_R8 + end subroutine Ncwr_3d_R8 !EOC !------------------------------------------------------------------------- !BOP @@ -695,28 +665,25 @@ end subroutine Ncwr_3d_R8 ! ! !INTERFACE: ! - subroutine Ncwr_3d_R4 (varwr_3d, ncid, varname, strt3d, cnt3d) + subroutine Ncwr_3d_R4(varwr_3d, ncid, varname, strt3d, cnt3d) ! ! !USES: ! - use m_do_err_out -! - implicit none -! - include "netcdf.inc" + use netCDF + use m_do_err_out ! ! !INPUT PARAMETERS: -!! ncid : netCDF file id to write array output data to -!! varname : netCDF variable name for array -!! strt3d : vector specifying the index in varwr_3d where -!! the first of the data values will be written -!! cnt3d : varwr_3d dimensions -!! varwr_3d : array to write out - integer , intent(in) :: ncid - character (len=*), intent(in) :: varname - integer , intent(in) :: strt3d(3) - integer , intent(in) :: cnt3d (3) - real*4 , intent(in) :: varwr_3d(cnt3d(1), cnt3d(2), cnt3d(3)) +!! ncid : netCDF file id to write array output data to +!! varname : netCDF variable name for array +!! strt3d : vector specifying the index in varwr_3d where +!! the first of the data values will be written +!! cnt3d : varwr_3d dimensions +!! varwr_3d : array to write out + integer , intent(in) :: ncid + character(len=*), intent(in) :: varname + integer , intent(in) :: strt3d(3) + integer , intent(in) :: cnt3d (3) + real*4 , intent(in) :: varwr_3d(cnt3d(1), cnt3d(2), cnt3d(3)) ! ! !DESCRIPTION: Writes out a 3D netCDF real array and does some error checking. !\\ @@ -731,28 +698,26 @@ subroutine Ncwr_3d_R4 (varwr_3d, ncid, varname, strt3d, cnt3d) !BOC ! ! !LOCAL VARIABLES: - character (len=512) :: err_msg - integer :: ierr - integer :: varid + character(len=512) :: err_msg + integer :: ierr + integer :: varid ! - ierr = Nf_Inq_Varid (ncid, varname, varid) - - if (ierr /= NF_NOERR) then - err_msg = 'In Ncwr_3d_R4 #1: ' // Trim (varname) // & - ', ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) - end if + ierr = NF90_Inq_Varid(ncid, varname, varid) - ierr = Nf_Put_Vara_Real (ncid, varid, strt3d, cnt3d, varwr_3d) + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncwr_3d_R4 #1: ' // Trim(varname) // & + ', ' // NF90_strerror(ierr) + call Do_Err_Out(err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) + end if - if (ierr /= NF_NOERR) then - err_msg = 'In Ncwr_3d_R4 #2: ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) - end if + ierr = NF90_Put_Var(ncid, varid, varwr_3d, start=strt3d, count=cnt3d) - return + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncwr_3d_R4 #2: ' // NF90_Strerror(ierr) + call Do_Err_Out(err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) + end if - end subroutine Ncwr_3d_R4 + end subroutine Ncwr_3d_R4 !EOC !------------------------------------------------------------------------- !BOP @@ -761,28 +726,25 @@ end subroutine Ncwr_3d_R4 ! ! !INTERFACE: ! - subroutine Ncwr_3d_Int (varwr_3di, ncid, varname, strt3d, cnt3d) + subroutine Ncwr_3d_Int(varwr_3di, ncid, varname, strt3d, cnt3d) ! ! !USES: ! - use m_do_err_out -! - implicit none -! - include "netcdf.inc" + use netCDF + use m_do_err_out ! ! !INPUT PARAMETERS: -!! ncid : netCDF file id to write array output data to -!! varname : netCDF variable name for array -!! strt3d : vector specifying the index in varwr_3di where -!! the first of the data values will be written -!! cnt3d : varwr_3di dimensions -!! varwr_3di : intger array to write out - integer , intent(in) :: ncid - character (len=*), intent(in) :: varname - integer , intent(in) :: strt3d(3) - integer , intent(in) :: cnt3d (3) - integer , intent(in) :: varwr_3di(cnt3d(1), cnt3d(2), cnt3d(3)) +!! ncid : netCDF file id to write array output data to +!! varname : netCDF variable name for array +!! strt3d : vector specifying the index in varwr_3di where +!! the first of the data values will be written +!! cnt3d : varwr_3di dimensions +!! varwr_3di : intger array to write out + integer , intent(in) :: ncid + character(len=*), intent(in) :: varname + integer , intent(in) :: strt3d(3) + integer , intent(in) :: cnt3d (3) + integer , intent(in) :: varwr_3di(cnt3d(1), cnt3d(2), cnt3d(3)) ! ! !DESCRIPTION: Writes out a 3D netCDF integer array and does some error ! checking. @@ -798,29 +760,26 @@ subroutine Ncwr_3d_Int (varwr_3di, ncid, varname, strt3d, cnt3d) !BOC ! ! !LOCAL VARIABLES: - character (len=512) :: err_msg - integer :: ierr - integer :: varid + character(len=512) :: err_msg + integer :: ierr + integer :: varid ! - ierr = Nf_Inq_Varid (ncid, varname, varid) - - if (ierr /= NF_NOERR) then - err_msg = 'In Ncwr_3d_Int #1: ' // Trim (varname) // & - ', ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) - end if + ierr = NF90_Inq_Varid(ncid, varname, varid) + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncwr_3d_Int #1: ' // Trim(varname) // & + ', ' // NF90_strerror(ierr) + call Do_Err_Out(err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) + end if - ierr = Nf_Put_Vara_Int (ncid, varid, strt3d, cnt3d, varwr_3di) + ierr = NF90_Put_Var(ncid, varid, varwr_3di, start=strt3d, count=cnt3d) - if (ierr /= NF_NOERR) then - err_msg = 'In Ncwr_3d_Int #2: ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) - end if + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncwr_3d_Int #2: ' // NF90_Strerror(ierr) + call Do_Err_Out(err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) + end if - return - - end subroutine Ncwr_3d_Int + end subroutine Ncwr_3d_Int !EOC !------------------------------------------------------------------------- !BOP @@ -829,29 +788,26 @@ end subroutine Ncwr_3d_Int ! ! !INTERFACE: ! - subroutine Ncwr_4d_R8 (varwr_4d, ncid, varname, strt4d, cnt4d) + subroutine Ncwr_4d_R8(varwr_4d, ncid, varname, strt4d, cnt4d) ! ! !USES: ! - use m_do_err_out -! - implicit none -! - include "netcdf.inc" + use netCDF + use m_do_err_out ! ! !INPUT PARAMETERS: -!! ncid : netCDF file id to write array output data to -!! varname : netCDF variable name for array -!! strt4d : vector specifying the index in varwr_4d where -!! the first of the data values will be written -!! cnt4d : varwr_4d dimensions -!! varwr_4d : array to write out - integer , intent(in) :: ncid - character (len=*), intent(in) :: varname - integer , intent(in) :: strt4d(4) - integer , intent(in) :: cnt4d (4) - real*8 , intent(in) :: varwr_4d(cnt4d(1), cnt4d(2), & - cnt4d(3), cnt4d(4)) +!! ncid : netCDF file id to write array output data to +!! varname : netCDF variable name for array +!! strt4d : vector specifying the index in varwr_4d where +!! the first of the data values will be written +!! cnt4d : varwr_4d dimensions +!! varwr_4d : array to write out + integer , intent(in) :: ncid + character(len=*), intent(in) :: varname + integer , intent(in) :: strt4d(4) + integer , intent(in) :: cnt4d (4) + real*8 , intent(in) :: varwr_4d(cnt4d(1), cnt4d(2), & + cnt4d(3), cnt4d(4)) ! ! !DESCRIPTION: Writes out a 4D netCDF real array and does some error checking. !\\ @@ -866,27 +822,26 @@ subroutine Ncwr_4d_R8 (varwr_4d, ncid, varname, strt4d, cnt4d) !BOC ! ! !LOCAL VARIABLES: - character (len=512) :: err_msg - integer :: ierr - integer :: varid + character(len=512) :: err_msg + integer :: ierr + integer :: varid ! - ierr = Nf_Inq_Varid (ncid, varname, varid) - - if (ierr /= NF_NOERR) then - err_msg = 'In Ncwr_4d_R8 #1: ' // Trim (varname) // & - ', ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) - end if + ierr = NF90_Inq_Varid(ncid, varname, varid) + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncwr_4d_R8 #1: ' // Trim(varname) // & + ', ' // NF90_strerror(ierr) + call Do_Err_Out(err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) + end if - ierr = Nf_Put_Vara_Double (ncid, varid, strt4d, cnt4d, varwr_4d) + ierr = NF90_Put_Var(ncid, varid, varwr_4d, start=strt4d, count=cnt4d) - if (ierr /= NF_NOERR) then - err_msg = 'In Ncwr_4d_R8 #2: ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) - end if + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncwr_4d_R8 #2: ' // NF90_strerror(ierr) + call Do_Err_Out(err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) + end if - end subroutine Ncwr_4d_R8 + end subroutine Ncwr_4d_R8 !EOC !------------------------------------------------------------------------- !BOP @@ -895,29 +850,26 @@ end subroutine Ncwr_4d_R8 ! ! !INTERFACE: ! - subroutine Ncwr_4d_R4 (varwr_4d, ncid, varname, strt4d, cnt4d) + subroutine Ncwr_4d_R4(varwr_4d, ncid, varname, strt4d, cnt4d) ! ! !USES: ! - use m_do_err_out -! - implicit none -! - include "netcdf.inc" + use netCDF + use m_do_err_out ! ! !INPUT PARAMETERS: -!! ncid : netCDF file id to write array output data to -!! varname : netCDF variable name for array -!! strt4d : vector specifying the index in varwr_4d where -!! the first of the data values will be written -!! cnt4d : varwr_4d dimensions -!! varwr_4d : array to write out - integer , intent(in) :: ncid - character (len=*), intent(in) :: varname - integer , intent(in) :: strt4d(4) - integer , intent(in) :: cnt4d (4) - real*4 , intent(in) :: varwr_4d(cnt4d(1), cnt4d(2), & - cnt4d(3), cnt4d(4)) +!! ncid : netCDF file id to write array output data to +!! varname : netCDF variable name for array +!! strt4d : vector specifying the index in varwr_4d where +!! the first of the data values will be written +!! cnt4d : varwr_4d dimensions +!! varwr_4d : array to write out + integer , intent(in) :: ncid + character(len=*), intent(in) :: varname + integer , intent(in) :: strt4d(4) + integer , intent(in) :: cnt4d (4) + real*4 , intent(in) :: varwr_4d(cnt4d(1), cnt4d(2), & + cnt4d(3), cnt4d(4)) ! ! !DESCRIPTION: Writes out a 4D netCDF real array and does some error checking. !\\ @@ -932,27 +884,26 @@ subroutine Ncwr_4d_R4 (varwr_4d, ncid, varname, strt4d, cnt4d) !BOC ! ! !LOCAL VARIABLES: - character (len=512) :: err_msg - integer :: ierr - integer :: varid + character(len=512) :: err_msg + integer :: ierr + integer :: varid ! - ierr = Nf_Inq_Varid (ncid, varname, varid) + ierr = NF90_Inq_Varid(ncid, varname, varid) - if (ierr /= NF_NOERR) then - err_msg = 'In Ncwr_4d_R4 #1: ' // Trim (varname) // & - ', ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) - end if + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncwr_4d_R4 #1: ' // Trim(varname) // & + ', ' // NF90_strerror(ierr) + call Do_Err_Out(err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) + end if + ierr = NF90_Put_Var(ncid, varid, varwr_4d, start=strt4d, count=cnt4d) - ierr = Nf_Put_Vara_Real (ncid, varid, strt4d, cnt4d, varwr_4d) + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncwr_4d_R4 #2: ' // NF90_strerror(ierr) + call Do_Err_Out(err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) + end if - if (ierr /= NF_NOERR) then - err_msg = 'In Ncwr_4d_R4 #2: ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) - end if - - end subroutine Ncwr_4d_R4 + end subroutine Ncwr_4d_R4 !EOC !------------------------------------------------------------------------- !BOP @@ -961,29 +912,26 @@ end subroutine Ncwr_4d_R4 ! ! !INTERFACE: ! - subroutine Ncwr_4d_Int (varwr_4di, ncid, varname, strt4d, cnt4d) + subroutine Ncwr_4d_Int(varwr_4di, ncid, varname, strt4d, cnt4d) ! ! !USES: ! - use m_do_err_out -! - implicit none -! - include "netcdf.inc" + use netCDF + use m_do_err_out ! ! !INPUT PARAMETERS: -!! ncid : netCDF file id to write array output data to -!! varname : netCDF variable name for array -!! strt3d : vector specifying the index in varwr_3di where -!! the first of the data values will be written -!! cnt3d : varwr_3di dimensions -!! varwr_3di : intger array to write out - integer , intent(in) :: ncid - character (len=*), intent(in) :: varname - integer , intent(in) :: strt4d(4) - integer , intent(in) :: cnt4d (4) - integer , intent(in) :: varwr_4di(cnt4d(1), cnt4d(2), & - cnt4d(3), cnt4d(4)) +!! ncid : netCDF file id to write array output data to +!! varname : netCDF variable name for array +!! strt3d : vector specifying the index in varwr_3di where +!! the first of the data values will be written +!! cnt3d : varwr_3di dimensions +!! varwr_3di : intger array to write out + integer , intent(in) :: ncid + character(len=*), intent(in) :: varname + integer , intent(in) :: strt4d(4) + integer , intent(in) :: cnt4d (4) + integer , intent(in) :: varwr_4di(cnt4d(1), cnt4d(2), & + cnt4d(3), cnt4d(4)) ! ! !DESCRIPTION: Writes out a 3D netCDF integer array and does some error ! checking. @@ -999,27 +947,26 @@ subroutine Ncwr_4d_Int (varwr_4di, ncid, varname, strt4d, cnt4d) !BOC ! ! !LOCAL VARIABLES: - character (len=512) :: err_msg - integer :: ierr - integer :: varid -! - ierr = Nf_Inq_Varid (ncid, varname, varid) - - if (ierr /= NF_NOERR) then - err_msg = 'In Ncwr_4d_Int #1: ' // Trim (varname) // & - ', ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) - end if - - - ierr = Nf_Put_Vara_Int (ncid, varid, strt4d, cnt4d, varwr_4di) - - if (ierr /= NF_NOERR) then - err_msg = 'In Ncwr_4d_Int #2: ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) - end if - - end subroutine Ncwr_4d_Int + character(len=512) :: err_msg + integer :: ierr + integer :: varid +! + ierr = NF90_Inq_Varid(ncid, varname, varid) + + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncwr_4d_Int #1: ' // Trim(varname) // & + ', ' // NF90_strerror(ierr) + call Do_Err_Out(err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) + end if + + ierr = NF90_Put_Var(ncid, varid, varwr_4di, start=strt4d, count=cnt4d) + + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncwr_4d_Int #2: ' // NF90_strerror(ierr) + call Do_Err_Out(err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) + end if + + end subroutine Ncwr_4d_Int !EOC !------------------------------------------------------------------------- !BOP @@ -1028,30 +975,27 @@ end subroutine Ncwr_4d_Int ! ! !INTERFACE: ! - subroutine Ncwr_5d_R8 (varwr_5d, ncid, varname, strt5d, cnt5d) + subroutine Ncwr_5d_R8(varwr_5d, ncid, varname, strt5d, cnt5d) ! ! !USES: ! - use m_do_err_out -! - implicit none -! - include "netcdf.inc" + use netCDF + use m_do_err_out ! ! !INPUT PARAMETERS: -!! ncid : netCDF file id to write array output data to -!! varname : netCDF variable name for array -!! strt5d : vector specifying the index in varwr_5d where -!! the first of the data values will be written -!! cnt5d : varwr_5d dimensions -!! varwr_5d : array to write out - integer , intent(in) :: ncid - character (len=*), intent(in) :: varname - integer , intent(in) :: strt5d(5) - integer , intent(in) :: cnt5d (5) - real*8 , intent(in) :: varwr_5d(cnt5d(1), cnt5d(2), & - cnt5d(3), cnt5d(4), & - cnt5d(5)) +!! ncid : netCDF file id to write array output data to +!! varname : netCDF variable name for array +!! strt5d : vector specifying the index in varwr_5d where +!! the first of the data values will be written +!! cnt5d : varwr_5d dimensions +!! varwr_5d : array to write out + integer , intent(in) :: ncid + character(len=*), intent(in) :: varname + integer , intent(in) :: strt5d(5) + integer , intent(in) :: cnt5d (5) + real*8 , intent(in) :: varwr_5d(cnt5d(1), cnt5d(2), & + cnt5d(3), cnt5d(4), & + cnt5d(5)) ! ! !DESCRIPTION: Writes out a 5D netCDF real array and does some error checking. !\\ @@ -1066,26 +1010,26 @@ subroutine Ncwr_5d_R8 (varwr_5d, ncid, varname, strt5d, cnt5d) !BOC ! ! !LOCAL VARIABLES: - character (len=512) :: err_msg - integer :: ierr - integer :: varid + character(len=512) :: err_msg + integer :: ierr + integer :: varid ! - ierr = Nf_Inq_Varid (ncid, varname, varid) + ierr = NF90_Inq_Varid(ncid, varname, varid) - if (ierr /= NF_NOERR) then - err_msg = 'In Ncwr_5d_R8 #1: ' // Trim (varname) // & - ', ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) - end if + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncwr_5d_R8 #1: ' // Trim(varname) // & + ', ' // NF90_strerror(ierr) + call Do_Err_Out(err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) + end if - ierr = Nf_Put_Vara_Double (ncid, varid, strt5d, cnt5d, varwr_5d) + ierr = NF90_Put_Var(ncid, varid, varwr_5d, start=strt5d, count=cnt5d) - if (ierr /= NF_NOERR) then - err_msg = 'In Ncwr_5d_R8 #2: ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) - end if + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncwr_5d_R8 #2: ' // NF90_Strerror(ierr) + call Do_Err_Out(err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) + end if - end subroutine Ncwr_5d_R8 + end subroutine Ncwr_5d_R8 !EOC !------------------------------------------------------------------------- !BOP @@ -1094,30 +1038,27 @@ end subroutine Ncwr_5d_R8 ! ! !INTERFACE: ! - subroutine Ncwr_5d_R4 (varwr_5d, ncid, varname, strt5d, cnt5d) + subroutine Ncwr_5d_R4(varwr_5d, ncid, varname, strt5d, cnt5d) ! ! !USES: ! - use m_do_err_out -! - implicit none -! - include "netcdf.inc" + use netCDF + use m_do_err_out ! ! !INPUT PARAMETERS: -!! ncid : netCDF file id to write array output data to -!! varname : netCDF variable name for array -!! strt5d : vector specifying the index in varwr_5d where -!! the first of the data values will be written -!! cnt5d : varwr_5d dimensions -!! varwr_5d : array to write out - integer , intent(in) :: ncid - character (len=*), intent(in) :: varname - integer , intent(in) :: strt5d(5) - integer , intent(in) :: cnt5d (5) - real*4 , intent(in) :: varwr_5d(cnt5d(1), cnt5d(2), & - cnt5d(3), cnt5d(4), & - cnt5d(5)) +!! ncid : netCDF file id to write array output data to +!! varname : netCDF variable name for array +!! strt5d : vector specifying the index in varwr_5d where +!! the first of the data values will be written +!! cnt5d : varwr_5d dimensions +!! varwr_5d : array to write out + integer , intent(in) :: ncid + character(len=*), intent(in) :: varname + integer , intent(in) :: strt5d(5) + integer , intent(in) :: cnt5d (5) + real*4 , intent(in) :: varwr_5d(cnt5d(1), cnt5d(2), & + cnt5d(3), cnt5d(4), & + cnt5d(5)) ! ! !DESCRIPTION: Writes out a 5D netCDF real array and does some error checking. !\\ @@ -1132,26 +1073,26 @@ subroutine Ncwr_5d_R4 (varwr_5d, ncid, varname, strt5d, cnt5d) !BOC ! ! !LOCAL VARIABLES: - character (len=512) :: err_msg - integer :: ierr - integer :: varid + character(len=512) :: err_msg + integer :: ierr + integer :: varid ! - ierr = Nf_Inq_Varid (ncid, varname, varid) + ierr = NF90_Inq_Varid (ncid, varname, varid) - if (ierr /= NF_NOERR) then - err_msg = 'In Ncwr_5d_R4 #1: ' // Trim (varname) // & - ', ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) - end if + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncwr_5d_R4 #1: ' // Trim(varname) // & + ', ' // NF90_Strerror(ierr) + call Do_Err_Out(err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) + end if - ierr = Nf_Put_Vara_Real (ncid, varid, strt5d, cnt5d, varwr_5d) + ierr = NF90_Put_Var(ncid, varid, varwr_5d, start=strt5d, count=cnt5d) - if (ierr /= NF_NOERR) then - err_msg = 'In Ncwr_5d_R4 #2: ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) - end if + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncwr_5d_R4 #2: ' // NF90_strerror(ierr) + call Do_Err_Out(err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) + end if - end subroutine Ncwr_5d_R4 + end subroutine Ncwr_5d_R4 !EOC !------------------------------------------------------------------------- !BOP @@ -1160,30 +1101,27 @@ end subroutine Ncwr_5d_R4 ! ! !INTERFACE: ! - subroutine Ncwr_6d_R8 (varwr_6d, ncid, varname, strt6d, cnt6d) + subroutine Ncwr_6d_R8(varwr_6d, ncid, varname, strt6d, cnt6d) ! ! !USES: ! - use m_do_err_out -! - implicit none -! - include "netcdf.inc" + use netCDF + use m_do_err_out ! ! !INPUT PARAMETERS: -!! ncid : netCDF file id to write array output data to -!! varname : netCDF variable name for array -!! strt6d : vector specifying the index in varwr_6d where -!! the first of the data values will be written -!! cnt6d : varwr_6d dimensions -!! varwr_6d : array to write out - integer , intent(in) :: ncid - character (len=*), intent(in) :: varname - integer , intent(in) :: strt6d(6) - integer , intent(in) :: cnt6d (6) - real*8 , intent(in) :: varwr_6d(cnt6d(1), cnt6d(2), & - cnt6d(3), cnt6d(4), & - cnt6d(5), cnt6d(6)) +!! ncid : netCDF file id to write array output data to +!! varname : netCDF variable name for array +!! strt6d : vector specifying the index in varwr_6d where +!! the first of the data values will be written +!! cnt6d : varwr_6d dimensions +!! varwr_6d : array to write out + integer , intent(in) :: ncid + character(len=*), intent(in) :: varname + integer , intent(in) :: strt6d(6) + integer , intent(in) :: cnt6d (6) + real*8 , intent(in) :: varwr_6d(cnt6d(1), cnt6d(2), & + cnt6d(3), cnt6d(4), & + cnt6d(5), cnt6d(6)) ! ! !DESCRIPTION: Writes out a 6D netCDF real array and does some error checking. !\\ @@ -1198,26 +1136,26 @@ subroutine Ncwr_6d_R8 (varwr_6d, ncid, varname, strt6d, cnt6d) !BOC ! ! !LOCAL VARIABLES: - character (len=512) :: err_msg - integer :: ierr - integer :: varid + character(len=512) :: err_msg + integer :: ierr + integer :: varid ! - ierr = Nf_Inq_Varid (ncid, varname, varid) + ierr = NF90_Inq_Varid(ncid, varname, varid) - if (ierr /= NF_NOERR) then - err_msg = 'In Ncwr_6d_R8 #1: ' // Trim (varname) // & - ', ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) - end if + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncwr_6d_R8 #1: ' // Trim(varname) // & + ', ' // NF90_Strerror(ierr) + call Do_Err_Out(err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) + end if - ierr = Nf_Put_Vara_Double (ncid, varid, strt6d, cnt6d, varwr_6d) + ierr = NF90_Put_Var(ncid, varid, varwr_6d, start=strt6d, count=cnt6d) - if (ierr /= NF_NOERR) then - err_msg = 'In Ncwr_6d_R8 #2: ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) - end if + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncwr_6d_R8 #2: ' // NF90_strerror(ierr) + call Do_Err_Out(err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) + end if - end subroutine Ncwr_6d_R8 + end subroutine Ncwr_6d_R8 !EOC !------------------------------------------------------------------------- !BOP @@ -1226,30 +1164,27 @@ end subroutine Ncwr_6d_R8 ! ! !INTERFACE: ! - subroutine Ncwr_6d_R4 (varwr_6d, ncid, varname, strt6d, cnt6d) + subroutine Ncwr_6d_R4(varwr_6d, ncid, varname, strt6d, cnt6d) ! ! !USES: ! - use m_do_err_out -! - implicit none -! - include "netcdf.inc" + use netCDF + use m_do_err_out ! ! !INPUT PARAMETERS: -!! ncid : netCDF file id to write array output data to -!! varname : netCDF variable name for array -!! strt6d : vector specifying the index in varwr_6d where -!! the first of the data values will be written -!! cnt6d : varwr_6d dimensions -!! varwr_6d : array to write out - integer , intent(in) :: ncid - character (len=*), intent(in) :: varname - integer , intent(in) :: strt6d(6) - integer , intent(in) :: cnt6d (6) - real*4 , intent(in) :: varwr_6d(cnt6d(1), cnt6d(2), & - cnt6d(3), cnt6d(4), & - cnt6d(5), cnt6d(6)) +!! ncid : netCDF file id to write array output data to +!! varname : netCDF variable name for array +!! strt6d : vector specifying the index in varwr_6d where +!! the first of the data values will be written +!! cnt6d : varwr_6d dimensions +!! varwr_6d : array to write out + integer , intent(in) :: ncid + character(len=*), intent(in) :: varname + integer , intent(in) :: strt6d(6) + integer , intent(in) :: cnt6d (6) + real*4 , intent(in) :: varwr_6d(cnt6d(1), cnt6d(2), & + cnt6d(3), cnt6d(4), & + cnt6d(5), cnt6d(6)) ! ! !DESCRIPTION: Writes out a 6D netCDF real array and does some error checking. !\\ @@ -1264,26 +1199,26 @@ subroutine Ncwr_6d_R4 (varwr_6d, ncid, varname, strt6d, cnt6d) !BOC ! ! !LOCAL VARIABLES: - character (len=512) :: err_msg - integer :: ierr - integer :: varid + character(len=512) :: err_msg + integer :: ierr + integer :: varid ! - ierr = Nf_Inq_Varid (ncid, varname, varid) + ierr = NF90_Inq_Varid(ncid, varname, varid) - if (ierr /= NF_NOERR) then - err_msg = 'In Ncwr_6d_R4 #1: ' // Trim (varname) // & - ', ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) - end if + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncwr_6d_R4 #1: ' // Trim(varname) // & + ', ' // NF90_Strerror(ierr) + call Do_Err_Out(err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) + end if - ierr = Nf_Put_Vara_Real (ncid, varid, strt6d, cnt6d, varwr_6d) + ierr = NF90_Put_Var(ncid, varid, varwr_6d, start=strt6d, count=cnt6d) - if (ierr /= NF_NOERR) then - err_msg = 'In Ncwr_6d_R4 #2: ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) - end if + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncwr_6d_R4 #2: ' // NF90_Strerror(ierr) + call Do_Err_Out(err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) + end if - end subroutine Ncwr_6d_R4 + end subroutine Ncwr_6d_R4 !EOC !------------------------------------------------------------------------- !BOP @@ -1292,28 +1227,25 @@ end subroutine Ncwr_6d_R4 ! ! !INTERFACE: ! - subroutine Ncwr_1d_Char (varwr_1dc, ncid, varname, strt1d, cnt1d) + subroutine Ncwr_1d_Char(varwr_1dc, ncid, varname, strt1d, cnt1d) ! ! !USES: ! - use m_do_err_out -! - implicit none -! - include "netcdf.inc" + use netCDF + use m_do_err_out ! ! !INPUT PARAMETERS: -!! ncid : netCDF file id to write array output data to -!! varname : netCDF variable name for array -!! strt1d : vector specifying the index in varwr_1dc where -!! the first of the data values will be written -!! cnt1d : varwr_1dc dimension -!! varwr_1dc : intger array to write out - integer , intent(in) :: ncid - character (len=*), intent(in) :: varname - integer , intent(in) :: strt1d(1) - integer , intent(in) :: cnt1d (1) - character (len=1), intent(in) :: varwr_1dc(cnt1d(1)) +!! ncid : netCDF file id to write array output data to +!! varname : netCDF variable name for array +!! strt1d : vector specifying the index in varwr_1dc where +!! the first of the data values will be written +!! cnt1d : varwr_1dc dimension +!! varwr_1dc : intger array to write out + integer , intent(in) :: ncid + character (len=*), intent(in) :: varname + integer , intent(in) :: strt1d(1) + integer , intent(in) :: cnt1d (1) + character (len=1), intent(in) :: varwr_1dc(cnt1d(1)) ! ! !DESCRIPTION: Writes out a 1D netCDF character array and does some error ! checking. @@ -1329,26 +1261,26 @@ subroutine Ncwr_1d_Char (varwr_1dc, ncid, varname, strt1d, cnt1d) !BOC ! ! !LOCAL VARIABLES: - character (len=512) :: err_msg - integer :: ierr - integer :: varid -! - ierr = Nf_Inq_Varid (ncid, varname, varid) - - if (ierr /= NF_NOERR) then - err_msg = 'In Ncwr_1d_Char #1: ' // Trim (varname) // & - ', ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) - end if - - ierr = Nf_Put_Vara_Text (ncid, varid, strt1d, cnt1d, varwr_1dc) - - if (ierr /= NF_NOERR) then - err_msg = 'In Ncwr_1d_Char #2: ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) - end if - - end subroutine Ncwr_1d_Char + character(len=512) :: err_msg + integer :: ierr + integer :: varid +! + ierr = NF90_Inq_Varid(ncid, varname, varid) + + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncwr_1d_Char #1: ' // Trim(varname) // & + ', ' // NF90_strerror(ierr) + call Do_Err_Out(err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) + end if + + ierr = NF90_Put_Var(ncid, varid, varwr_1dc, start=strt1d, count=cnt1d) + + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncwr_1d_Char #2: ' // NF90_strerror(ierr) + call Do_Err_Out(err_msg, .true., 2, ncid, varid, 0, 0.0d0, 0.0d0) + end if + + end subroutine Ncwr_1d_Char !EOC !------------------------------------------------------------------------- !BOP @@ -1357,28 +1289,25 @@ end subroutine Ncwr_1d_Char ! ! !INTERFACE: ! - subroutine Ncwr_2d_Char (char_2d, ncid, tvarname, strt2d, cnt2d) + subroutine Ncwr_2d_Char(char_2d, ncid, tvarname, strt2d, cnt2d) ! ! !USES: ! - use m_do_err_out -! - implicit none -! - include "netcdf.inc" + use netCDF + use m_do_err_out ! ! !INPUT PARAMETERS: -!! ncid : netCDF file id to write text to -!! tvarname : netCDF variable name for text -!! strt2d : vector specifying the index in char_2d where -!! the first of the data values will be written -!! cnt2d : char_2d dimensions -!! char_2d : text to write - integer , intent(in) :: ncid - character (len=*), intent(in) :: tvarname - integer , intent(in) :: strt2d(2) - integer , intent(in) :: cnt2d (2) - character (len=1), intent(in) :: char_2d(cnt2d(1), cnt2d(2)) +!! ncid : netCDF file id to write text to +!! tvarname : netCDF variable name for text +!! strt2d : vector specifying the index in char_2d where +!! the first of the data values will be written +!! cnt2d : char_2d dimensions +!! char_2d : text to write + integer , intent(in) :: ncid + character(len=*), intent(in) :: tvarname + integer , intent(in) :: strt2d(2) + integer , intent(in) :: cnt2d (2) + character(len=1), intent(in) :: char_2d(cnt2d(1), cnt2d(2)) ! ! !DESCRIPTION: Writes out a 2D netCDF character array and does some error ! checking. @@ -1394,27 +1323,26 @@ subroutine Ncwr_2d_Char (char_2d, ncid, tvarname, strt2d, cnt2d) !BOC ! ! !LOCAL VARIABLES: - character (len=512) :: err_msg - integer :: ierr - integer :: tvarid + character(len=512) :: err_msg + integer :: ierr + integer :: tvarid ! - ierr = Nf_Inq_Varid (ncid, tvarname, tvarid) - - if (ierr /= NF_NOERR) then - err_msg = 'In Ncwr_2d_Char #1: ' // Trim (tvarname) // & - ', ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) - end if + ierr = NF90_Inq_Varid(ncid, tvarname, tvarid) + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncwr_2d_Char #1: ' // Trim(tvarname) // & + ', ' // NF90_Strerror(ierr) + call Do_Err_Out(err_msg, .true., 1, ncid, 0, 0, 0.0d0, 0.0d0) + end if - ierr = Nf_Put_Vara_Text (ncid, tvarid, strt2d, cnt2d, char_2d) + ierr = NF90_Put_Var(ncid, tvarid, char_2d, start=strt2d, count=cnt2d) - if (ierr /= NF_NOERR) then - err_msg = 'In Ncwr_2d_Char #2: ' // Nf_Strerror (ierr) - call Do_Err_Out (err_msg, .true., 2, ncid, tvarid, 0, 0.0d0, 0.0d0) - end if + if (ierr /= NF90_NOERR) then + err_msg = 'In Ncwr_2d_Char #2: ' // NF90_Strerror(ierr) + call Do_Err_Out(err_msg, .true., 2, ncid, tvarid, 0, 0.0d0, 0.0d0) + end if - end subroutine Ncwr_2d_Char + end subroutine Ncwr_2d_Char !EOC !------------------------------------------------------------------------ end module HCO_m_netcdf_io_write diff --git a/src/Shared/NcdfUtil/hco_ncdf_mod.F90 b/src/Shared/NcdfUtil/hco_ncdf_mod.F90 index 5037b119..c8690fe7 100644 --- a/src/Shared/NcdfUtil/hco_ncdf_mod.F90 +++ b/src/Shared/NcdfUtil/hco_ncdf_mod.F90 @@ -17,6 +17,7 @@ MODULE HCO_NCDF_MOD ! !USES: ! ! Modules for netCDF read + USE netCDF USE HCO_m_netcdf_io_open USE HCO_m_netcdf_io_get_dimlen USE HCO_m_netcdf_io_read @@ -30,7 +31,6 @@ MODULE HCO_NCDF_MOD IMPLICIT NONE PRIVATE -# include "netcdf.inc" ! ! !PUBLIC MEMBER FUNCTIONS: ! @@ -50,8 +50,6 @@ MODULE HCO_NCDF_MOD PUBLIC :: NC_GET_GRID_EDGES PUBLIC :: NC_GET_SIGMA_LEVELS PUBLIC :: NC_WRITE - PUBLIC :: NC_ISMODELLEVEL - PUBLIC :: NC_ISSIGMALEVEL PUBLIC :: GET_TAU0 ! ! !PRIVATE MEMBER FUNCTIONS: @@ -85,8 +83,7 @@ MODULE HCO_NCDF_MOD PRIVATE :: NC_READ_VAR_CORE ! ! !REVISION HISTORY: -! 27 Jul 2012 - C. Keller - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC @@ -157,8 +154,7 @@ SUBROUTINE NC_OPEN( FileName, fID ) INTEGER, INTENT(OUT) :: fID ! ! !REVISION HISTORY: -! 04 Nov 2012 - C. Keller - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC @@ -197,8 +193,7 @@ SUBROUTINE NC_APPEND( FileName, fID, nTime ) INTEGER, OPTIONAL :: nTime ! ! !REVISION HISTORY: -! 04 Nov 2012 - C. Keller - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC @@ -217,11 +212,7 @@ SUBROUTINE NC_APPEND( FileName, fID, nTime ) ! Also return the number of time slices so that we can ! append to an existing file w/o clobbering any data IF ( PRESENT( nTime ) ) THEN - nTime = -1 - RC = Nf_Inq_DimId( fId, 'time', vId ) - IF ( RC == NF_NOERR ) THEN - RC = Nf_Inq_DimLen( fId, vId, nTime ) - ENDIF + CALL Ncget_Unlim_Dimlen( fId, nTime ) ENDIF END SUBROUTINE NC_APPEND @@ -246,8 +237,7 @@ SUBROUTINE NC_CLOSE( fID ) INTEGER, INTENT(IN ) :: fID ! ! !REVISION HISTORY: -! 04 Nov 2012 - C. Keller - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC @@ -285,8 +275,7 @@ SUBROUTINE Nc_Set_DefMode( fId, On, Off ) ! NcdfUtil module m_netcdf_define_mod.F90. ! ! !REVISION HISTORY: -! 06 Jan 2015 - R. Yantosca - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC @@ -349,8 +338,7 @@ SUBROUTINE NC_READ_TIME( fID, nTime, timeUnit, & INTEGER, INTENT(INOUT) :: RC ! ! !REVISION HISTORY: -! 04 Nov 2012 - C. Keller - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC @@ -436,11 +424,11 @@ SUBROUTINE NC_READ_TIME( fID, nTime, timeUnit, & ! Do nothing END SELECT ENDIF - + ! Reset RC so that we won't halt execution elsewhere RC = 0 ENDIF - + END SUBROUTINE NC_READ_TIME !EOC !------------------------------------------------------------------------------ @@ -475,8 +463,7 @@ SUBROUTINE NC_READ_VAR_SP( fID, Var, nVar, varUnit, varVec, RC ) INTEGER, INTENT(INOUT) :: RC ! ! !REVISION HISTORY: -! 04 Nov 2012 - C. Keller - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC @@ -517,8 +504,7 @@ SUBROUTINE NC_READ_VAR_DP( fID, Var, nVar, varUnit, varVec, RC ) INTEGER, INTENT(INOUT) :: RC ! ! !REVISION HISTORY: -! 04 Nov 2012 - C. Keller - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC @@ -560,8 +546,7 @@ SUBROUTINE NC_READ_VAR_CORE( fID, Var, nVar, varUnit, varVecDp, varVecSp, RC ) INTEGER, INTENT(INOUT) :: RC ! ! !REVISION HISTORY: -! 04 Nov 2012 - C. Keller - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC @@ -712,8 +697,7 @@ SUBROUTINE NC_READ_ARR( fID, ncVar, lon1, lon2, lat1, & INTEGER, INTENT(INOUT) :: RC ! ! !REVISION HISTORY: -! 27 Jul 2012 - C. Keller - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC @@ -1194,12 +1178,12 @@ SUBROUTINE NC_READ_ARR( fID, ncVar, lon1, lon2, lat1, & a_name = "missing_value" ReadAtt = Ncdoes_Attr_Exist ( fId, TRIM(v_name), TRIM(a_name), a_type ) IF ( ReadAtt ) THEN - IF ( a_type == NF_REAL ) THEN + IF ( a_type == NF90_REAL ) THEN CALL NcGet_Var_Attributes( fId, TRIM(v_name), TRIM(a_name), miss4 ) WHERE ( ncArr == miss4 ) ncArr = MissValue END WHERE - ELSE IF ( a_type == NF_DOUBLE ) THEN + ELSE IF ( a_type == NF90_DOUBLE ) THEN CALL NcGet_Var_Attributes( fId, TRIM(v_name), TRIM(a_name), miss8 ) miss4 = REAL( miss8 ) WHERE ( ncArr == miss4 ) @@ -1212,12 +1196,12 @@ SUBROUTINE NC_READ_ARR( fID, ncVar, lon1, lon2, lat1, & a_name = "_FillValue" ReadAtt = Ncdoes_Attr_Exist ( fId, TRIM(v_name), TRIM(a_name), a_type ) IF ( ReadAtt ) THEN - IF ( a_type == NF_REAL ) THEN + IF ( a_type == NF90_REAL ) THEN CALL NcGet_Var_Attributes( fId, TRIM(v_name), TRIM(a_name), miss4 ) WHERE ( ncArr == miss4 ) ncArr = MissValue END WHERE - ELSE IF ( a_type == NF_DOUBLE ) THEN + ELSE IF ( a_type == NF90_DOUBLE ) THEN CALL NcGet_Var_Attributes( fId, TRIM(v_name), TRIM(a_name), miss8 ) miss4 = REAL( miss8 ) WHERE ( ncArr == miss4 ) @@ -1302,8 +1286,7 @@ SUBROUTINE NC_READ_TIME_YYYYMMDDhhmm( fID, nTime, & INTEGER, INTENT(INOUT) :: RC ! ! !REVISION HISTORY: -! 27 Jul 2012 - C. Keller - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC @@ -1438,8 +1421,7 @@ SUBROUTINE NC_GET_REFDATETIME( tUnit, tYr, tMt, tDy, tHr, tMn, tSc, RC ) ! !REMARKS: ! ! !REVISION HISTORY: -! 18 Jan 2012 - C. Keller - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC @@ -1656,8 +1638,7 @@ SUBROUTINE GET_TIDX( TDIM, TIMEVEC, TTYPE, TOFFSET, & ! !REMARKS: ! ! !REVISION HISTORY: -! 04 Nov 2012 - C. Keller - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC @@ -1820,8 +1801,7 @@ SUBROUTINE TIMEUNIT_CHECK( TIMEUNIT, TIMETYPE, TOFFSET, FILENAME, RC ) ! !REMARKS: ! ! !REVISION HISTORY: -! 18 Jan 2012 - C. Keller - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC @@ -2007,8 +1987,7 @@ SUBROUTINE NC_GET_GRID_EDGES_SP( fID, AXIS, MID, NMID, EDGE, NEDGE, RC ) INTEGER, INTENT(INOUT) :: RC ! Return code ! ! !REVISION HISTORY: -! 16 Jul 2014 - C. Keller - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC @@ -2058,8 +2037,7 @@ SUBROUTINE NC_GET_GRID_EDGES_DP( fID, AXIS, MID, NMID, EDGE, NEDGE, RC ) INTEGER, INTENT(INOUT) :: RC ! Return code ! ! !REVISION HISTORY: -! 16 Jul 2014 - C. Keller - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC @@ -2108,8 +2086,7 @@ SUBROUTINE NC_GET_GRID_EDGES_C( fID, AXIS, NMID, NEDGE, RC, & INTEGER, INTENT(INOUT) :: RC ! Return code ! ! !REVISION HISTORY: -! 16 Jul 2014 - C. Keller - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC @@ -2312,8 +2289,7 @@ SUBROUTINE NC_GET_SIGMA_LEVELS_SP( fID, ncFile, levName, lon1, lon2, lat1, & INTEGER, INTENT(INOUT) :: RC ! Return code ! ! !REVISION HISTORY: -! 03 Oct 2014 - C. Keller - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC @@ -2360,8 +2336,7 @@ SUBROUTINE NC_GET_SIGMA_LEVELS_DP( fID, ncFile, levName, lon1, lon2, lat1, & INTEGER, INTENT(INOUT) :: RC ! Return code ! ! !REVISION HISTORY: -! 03 Oct 2014 - C. Keller - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC @@ -2419,8 +2394,7 @@ SUBROUTINE NC_GET_SIGMA_LEVELS_C( fID, ncFile, levName, lon1, lon2, lat1, & REAL*8, OPTIONAL, POINTER :: SigLev8(:,:,:) ! specified boundaries ! ! !REVISION HISTORY: -! 03 Oct 2014 - C. Keller - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC @@ -2601,8 +2575,7 @@ SUBROUTINE NC_GET_SIG_FROM_HYBRID ( fID, levName, lon1, lon2, lat1, & INTEGER, INTENT(INOUT) :: RC ! Return code ! ! !REVISION HISTORY: -! 03 Oct 2014 - C. Keller - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC @@ -2842,8 +2815,7 @@ SUBROUTINE GetVarFromFormula ( formula, inname, outname, RC ) INTEGER, INTENT(INOUT) :: RC ! Return code ! ! !REVISION HISTORY: -! 03 Oct 2014 - C. Keller - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC @@ -2923,8 +2895,7 @@ SUBROUTINE NC_WRITE_3D( ncFile, I, J, T, N, lon, lat, & ! with subsequent hand-editing. ! ! !REVISION HISTORY: -! 15 Jun 2012 - C. Keller - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC @@ -2997,8 +2968,7 @@ SUBROUTINE NC_WRITE_4D (ncFile, I, J, L, T, N, lon, lat, lev, & ! with subsequent hand-editing. ! ! !REVISION HISTORY: -! 15 Jun 2012 - C. Keller - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC @@ -3072,8 +3042,7 @@ SUBROUTINE NC_DEFINE ( ncFile, nLon, nLat, nLev, nTime,& ! hand-editing may be required. ! ! !REVISION HISTORY: -! 15 Jun 2012 - C. Keller - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC @@ -3115,7 +3084,7 @@ SUBROUTINE NC_DEFINE ( ncFile, nLon, nLat, nLev, nTime,& CALL NcCr_Wr( fId, TRIM(ncFile) ) ! Turn filling off - CALL NcSetFill( fId, NF_NOFILL, omode ) + CALL NcSetFill( fId, NF90_NOFILL, omode ) !-------------------------------- ! GLOBAL ATTRIBUTES @@ -3170,7 +3139,7 @@ SUBROUTINE NC_DEFINE ( ncFile, nLon, nLat, nLev, nTime,& ! Define the "lon" variable v_name = "lon" var1d = (/ id_lon /) - CALL NcDef_Variable( fId, TRIM(v_name), NF_FLOAT, 1, var1d, vId ) + CALL NcDef_Variable( fId, TRIM(v_name), NF90_FLOAT, 1, var1d, vId ) ! Define the "lon:long_name" attribute a_name = "long_name" @@ -3189,7 +3158,7 @@ SUBROUTINE NC_DEFINE ( ncFile, nLon, nLat, nLev, nTime,& ! Define the "lat" variable v_name = "lat" var1d = (/ id_lat /) - CALL NcDef_Variable( fId, TRIM(v_name), NF_FLOAT, 1, var1d, vId ) + CALL NcDef_Variable( fId, TRIM(v_name), NF90_FLOAT, 1, var1d, vId ) ! Define the "lat:long_name" attribute a_name = "long_name" @@ -3210,7 +3179,7 @@ SUBROUTINE NC_DEFINE ( ncFile, nLon, nLat, nLev, nTime,& ! Define the "levels" variable v_name = "lev" var1d = (/ id_lev /) - CALL NcDef_Variable( fId, TRIM(v_name), NF_INT, 1, var1d, vId ) + CALL NcDef_Variable( fId, TRIM(v_name), NF90_INT, 1, var1d, vId ) ! Define the "time:long_name" attribute a_name = "long_name" @@ -3230,7 +3199,7 @@ SUBROUTINE NC_DEFINE ( ncFile, nLon, nLat, nLev, nTime,& ! Define the "time" variable v_name = "time" var1d = (/ id_time /) - CALL NcDef_Variable( fId, TRIM(v_name), NF_INT, 1, var1d, vId ) + CALL NcDef_Variable( fId, TRIM(v_name), NF90_INT, 1, var1d, vId ) ! Define the "time:long_name" attribute a_name = "long_name" @@ -3251,10 +3220,10 @@ SUBROUTINE NC_DEFINE ( ncFile, nLon, nLat, nLev, nTime,& v_name = TRIM(ncVars(I)) IF ( PRESENT(nlev) ) THEN var4d = (/ id_lon, id_lat, id_lev, id_time /) - CALL NcDef_Variable(fId,TRIM(v_name),NF_DOUBLE,4,var4d,vId) + CALL NcDef_Variable(fId,TRIM(v_name),NF90_DOUBLE,4,var4d,vId) ELSE var3d = (/ id_lon, id_lat, id_time /) - CALL NcDef_Variable(fId,TRIM(v_name),NF_DOUBLE,3,var3d,vId) + CALL NcDef_Variable(fId,TRIM(v_name),NF90_DOUBLE,3,var3d,vId) ENDIF ! Define the long_name attribute @@ -3315,8 +3284,7 @@ SUBROUTINE NC_WRITE_DIMS( fID, lon, lat, time, lev ) ! hand-editing may be required. ! ! !REVISION HISTORY: -! 30 Jan 2012 - R. Yantosca - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC @@ -3399,8 +3367,7 @@ SUBROUTINE NC_WRITE_DATA_3D ( fID, ncVar, Array ) ! hand-editing may be required. ! ! !REVISION HISTORY: -! 30 Jan 2012 - R. Yantosca - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC @@ -3453,8 +3420,7 @@ SUBROUTINE NC_WRITE_DATA_4D ( fID, ncVar, Array ) ! hand-editing may be required. ! ! !REVISION HISTORY: -! 30 Jan 2012 - R. Yantosca - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC @@ -3541,8 +3507,7 @@ SUBROUTINE Nc_Create( NcFile, Title, nLon, & ! hand-editing may be required. ! ! !REVISION HISTORY: -! 15 Jun 2012 - C. Keller - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC @@ -3648,7 +3613,7 @@ SUBROUTINE Nc_Create( NcFile, Title, nLon, & CALL NcCr_Wr( fId, TRIM( ncFile ), Save_As_Nc4 ) ! Turn filling off - CALL NcSetFill( fId, NF_NOFILL, omode ) + CALL NcSetFill( fId, NF90_NOFILL, omode ) !======================================================================= ! Set global attributes @@ -3779,8 +3744,7 @@ SUBROUTINE NC_Var_Def( fId, lonId, latId, levId, & ! (2) The NcdfUtilities package (from Bob Yantosca) source code ! ! !REVISION HISTORY: -! 15 Jun 2012 - C. Keller - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC @@ -3792,7 +3756,7 @@ SUBROUTINE NC_Var_Def( fId, lonId, latId, levId, & ! Scalars INTEGER :: nDim, Pos - INTEGER :: NF_TYPE, tmpIlevId + INTEGER :: NF90_TYPE, tmpIlevId LOGICAL :: isDefMode ! Strings @@ -3859,20 +3823,20 @@ SUBROUTINE NC_Var_Def( fId, lonId, latId, levId, & ! Set data type IF ( DataType == 1 ) THEN - NF_TYPE = NF_INT + NF90_TYPE = NF90_INT ELSEIF ( DataType == 4 ) THEN - NF_TYPE = NF_FLOAT + NF90_TYPE = NF90_FLOAT ELSEIF ( DataType == 8 ) THEN - NF_TYPE = NF_DOUBLE + NF90_TYPE = NF90_DOUBLE ELSE - NF_TYPE = NF_FLOAT + NF90_TYPE = NF90_FLOAT ENDIF !----------------------------------------------------------------------- ! Define variable !----------------------------------------------------------------------- - CALL NcDef_Variable( fId, TRIM(VarName), NF_TYPE, & - nDim, VarDims, VarCt, Compress ) + CALL NcDef_Variable( fId, TRIM(VarName), NF90_TYPE, & + nDim, VarDims, VarCt, Compress ) DEALLOCATE( VarDims ) !----------------------------------------------------------------------- @@ -3881,11 +3845,11 @@ SUBROUTINE NC_Var_Def( fId, lonId, latId, levId, & ! long_name (reuired) Att = 'long_name' - CALL NcDef_Var_Attributes( fId, VarCt, TRIM(Att), TRIM(VarLongName) ) + CALL NcDef_Var_Attributes( fId, VarCt, TRIM(Att), TRIM(VarLongName) ) ! units (requited) Att = 'units' - CALL NcDef_Var_Attributes( fId, VarCt, TRIM(Att), TRIM(VarUnit) ) + CALL NcDef_Var_Attributes( fId, VarCt, TRIM(Att), TRIM(VarUnit) ) ! add_offset (optional) IF ( PRESENT( AddOffset ) ) THEN @@ -3997,8 +3961,7 @@ SUBROUTINE Nc_Var_Chunk( fId, vId, ChunkSizes, RC ) ! an error code of -111. ! ! !REVISION HISTORY: -! 28 Aug 2017 - R. Yantosca - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC @@ -4009,7 +3972,7 @@ SUBROUTINE Nc_Var_Chunk( fId, vId, ChunkSizes, RC ) ! Turn on chunking for this variable ! But only if the netCDF library supports it - RC = NF_Def_Var_Chunking( fId, vId, NF_CHUNKED, ChunkSizes ) + RC = NF90_Def_Var_Chunking( fId, vId, NF90_CHUNKED, ChunkSizes ) #else @@ -4050,8 +4013,7 @@ SUBROUTINE NC_VAR_WRITE_R8_0D( fId, VarName, Var ) ! hand-editing may be required. ! ! !REVISION HISTORY: -! 25 Aug 2017 - R. Yantosca - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC @@ -4097,8 +4059,7 @@ SUBROUTINE NC_VAR_WRITE_R8_1D( fId, VarName, Arr1D ) ! hand-editing may be required. ! ! !REVISION HISTORY: -! 15 Jun 2012 - C. Keller - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC @@ -4151,8 +4112,7 @@ SUBROUTINE NC_VAR_WRITE_R8_2D( fId, VarName, Arr2D ) ! hand-editing may be required. ! ! !REVISION HISTORY: -! 15 Jun 2012 - C. Keller - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC @@ -4211,8 +4171,7 @@ SUBROUTINE NC_VAR_WRITE_R8_3D( fId, VarName, Arr3D ) ! hand-editing may be required. ! ! !REVISION HISTORY: -! 15 Jun 2012 - C. Keller - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC @@ -4271,8 +4230,7 @@ SUBROUTINE NC_VAR_WRITE_R8_4D( fId, VarName, Arr4D ) ! hand-editing may be required. ! ! !REVISION HISTORY: -! 15 Jun 2012 - C. Keller - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC @@ -4331,8 +4289,7 @@ SUBROUTINE NC_VAR_WRITE_R4_0d( fId, VarName, Var ) ! hand-editing may be required. ! ! !REVISION HISTORY: -! 25 Aug 2017 - R. Yantosca - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC @@ -4378,8 +4335,7 @@ SUBROUTINE NC_VAR_WRITE_R4_1D( fId, VarName, Arr1D ) ! hand-editing may be required. ! ! !REVISION HISTORY: -! 15 Jun 2012 - C. Keller - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC @@ -4432,8 +4388,7 @@ SUBROUTINE NC_VAR_WRITE_R4_2D( fId, VarName, Arr2D ) ! hand-editing may be required. ! ! !REVISION HISTORY: -! 15 Jun 2012 - C. Keller - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC @@ -4492,8 +4447,7 @@ SUBROUTINE NC_VAR_WRITE_R4_3D( fId, VarName, Arr3D ) ! hand-editing may be required. ! ! !REVISION HISTORY: -! 15 Jun 2012 - C. Keller - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC @@ -4552,8 +4506,7 @@ SUBROUTINE NC_VAR_WRITE_R4_4D( fId, VarName, Arr4D ) ! hand-editing may be required. ! ! !REVISION HISTORY: -! 15 Jun 2012 - C. Keller - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC @@ -4611,8 +4564,7 @@ SUBROUTINE NC_VAR_WRITE_INT_0d( fId, VarName, Var ) ! hand-editing may be required. ! ! !REVISION HISTORY: -! 25 Aug 2017 - R. Yantosca - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC @@ -4658,8 +4610,7 @@ SUBROUTINE NC_VAR_WRITE_INT_1D( fId, VarName, Arr1D ) ! hand-editing may be required. ! ! !REVISION HISTORY: -! 15 Jun 2012 - C. Keller - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC @@ -4712,8 +4663,7 @@ SUBROUTINE NC_VAR_WRITE_INT_2D( fId, VarName, Arr2D ) ! hand-editing may be required. ! ! !REVISION HISTORY: -! 15 Jun 2012 - C. Keller - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC @@ -4772,8 +4722,7 @@ SUBROUTINE NC_VAR_WRITE_INT_3D( fId, VarName, Arr3D ) ! hand-editing may be required. ! ! !REVISION HISTORY: -! 15 Jun 2012 - C. Keller - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC @@ -4832,8 +4781,7 @@ SUBROUTINE NC_VAR_WRITE_INT_4D( fId, VarName, Arr4D ) ! hand-editing may be required. ! ! !REVISION HISTORY: -! 15 Jun 2012 - C. Keller - Initial version -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC @@ -4908,7 +4856,7 @@ FUNCTION GET_TAU0( MONTH, DAY, YEAR, HOUR, MIN, SEC ) RESULT( THIS_TAU0 ) ! TAU0 is hours elapsed since 00:00 GMT on 01 Jan 1985. ! ! !REVISION HISTORY: -! See https://github.com/geoschem/ncdfutil for complete history +! See https://github.com/geoschem/hemco for complete history !EOP !------------------------------------------------------------------------------ !BOC @@ -4966,155 +4914,4 @@ FUNCTION GET_TAU0( MONTH, DAY, YEAR, HOUR, MIN, SEC ) RESULT( THIS_TAU0 ) ( TMP_MIN / 60d0 ) + ( TMP_SEC / 3600d0 ) END FUNCTION GET_TAU0 -!------------------------------------------------------------------------------ -! NcdfUtilities: by Harvard Atmospheric Chemistry Modeling Group ! -! and NASA/GFSC, SIVO, Code 610.3 ! -!------------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: Nc_IsModelLevel -! -! !DESCRIPTION: Function NC\_IsModelLevel returns true if (and only if) the -! long name of the level variable name of the given file ID contains the -! character "GEOS-Chem level". -!\\ -!\\ -! !INTERFACE: -! - FUNCTION NC_IsModelLevel( fID, lev_name ) RESULT ( IsModelLevel ) -! -! !USES: -! -# include "netcdf.inc" -! -! !INPUT PARAMETERS: -! - INTEGER, INTENT(IN) :: fID ! file ID - CHARACTER(LEN=*), INTENT(IN) :: lev_name ! level variable name -! -! !RETURN VALUE: -! - LOGICAL :: IsModelLevel -! -! !REVISION HISTORY: -! 12 Dec 2014 - C. Keller - Initial version -! See https://github.com/geoschem/ncdfutil for complete history -!EOP -!------------------------------------------------------------------------------ -!BOC -! -! !LOCAL VARIABLES: -! - LOGICAL :: HasLngN - CHARACTER(LEN=255) :: a_name, LngName - INTEGER :: a_type - - !======================================================================= - ! NC_IsModelLevel begins here! - !======================================================================= - - ! Init - IsModelLevel = .FALSE. - - ! Check if there is a long_name attribute - a_name = "long_name" - HasLngN = Ncdoes_Attr_Exist ( fId, TRIM(lev_name), TRIM(a_name), a_type ) - - ! Only if attribute exists... - IF ( HasLngN ) THEN - ! Read attribute - CALL NcGet_Var_Attributes( fID, TRIM(lev_name), TRIM(a_name), LngName ) - - ! See if this is a GEOS-Chem model level - IF ( INDEX( TRIM(LngName), "GEOS-Chem level" ) > 0 ) THEN - IsModelLevel = .TRUE. - ENDIF - ENDIF - - END FUNCTION NC_IsModelLevel -!EOC -!------------------------------------------------------------------------------ -! NcdfUtilities: by Harvard Atmospheric Chemistry Modeling Group ! -! and NASA/GFSC, SIVO, Code 610.3 ! -!------------------------------------------------------------------------------ -!BOP -! -! !IROUTINE: Nc_IsSigmaLevel -! -! !DESCRIPTION: Function NC\_IsSigmaLevels returns true if (and only if) the -! long name of the level variable name of the given file ID contains the -! character "atmospheric_hybrid_sigma_pressure_coordinate". -!\\ -!\\ -! !INTERFACE: -! - FUNCTION NC_IsSigmaLevel( fID, lev_name ) RESULT ( IsSigmaLevel ) -! -! !USES: -! -# include "netcdf.inc" -! -! !INPUT PARAMETERS: -! - INTEGER, INTENT(IN) :: fID ! file ID - CHARACTER(LEN=*), INTENT(IN) :: lev_name ! level variable name -! -! !RETURN VALUE: -! - LOGICAL :: IsSigmaLevel -! -! !REVISION HISTORY: -! 12 Dec 2014 - C. Keller - Initial version -! See https://github.com/geoschem/ncdfutil for complete history -!EOP -!------------------------------------------------------------------------------ -!BOC -! -! !LOCAL VARIABLES: -! - ! Scalars - LOGICAL :: found - INTEGER :: a_type - - ! Strings - CHARACTER(LEN=255) :: a_name - CHARACTER(LEN=255) :: a_val - - !======================================================================= - ! NC_IsSigmaLevel begins here! - !======================================================================= - - ! Initialize - IsSigmaLevel = .FALSE. - - ! Check if there is a long_name attribute - a_name = "standard_name" - found = Ncdoes_Attr_Exist( fId, TRIM(lev_name), TRIM(a_name), a_type ) - - ! First check if the "standard_name" attribute exists - IF ( found ) THEN - - ! Read "standard_name" attribute - CALL NcGet_Var_Attributes( fID, TRIM(lev_name), TRIM(a_name), a_val ) - - ELSE - - ! If the "standard_name" attribute isn't found, try "long_name" - a_name = "long_name" - found = Ncdoes_Attr_Exist( fId, TRIM(lev_name), TRIM(a_name), a_type ) - - ! Read "long_name" attribute - IF ( found ) THEN - CALL NcGet_Var_Attributes( fID, TRIM(lev_name), TRIM(a_name), a_val ) - ENDIF - ENDIF - - ! Test if the attribute value indicates a hybrid sigma-pressure grid - IF ( INDEX( TRIM( a_val ), & - "atmospheric_hybrid_sigma_pressure_coordinate" ) > 0 ) THEN - IsSigmaLevel = .TRUE. - ENDIF - - END FUNCTION NC_IsSigmaLevel -!EOC END MODULE HCO_NCDF_MOD diff --git a/src/Shared/NcdfUtil/m_do_err_out.F90 b/src/Shared/NcdfUtil/m_do_err_out.F90 index b6df11e5..593fa835 100644 --- a/src/Shared/NcdfUtil/m_do_err_out.F90 +++ b/src/Shared/NcdfUtil/m_do_err_out.F90 @@ -127,7 +127,7 @@ subroutine Do_Err_Out & ! NOTE: Should not exit but pass error code up ! work on this for a future version - stop 999 + stop 999 ENDIF RETURN