diff --git a/.github/jobs/build_docker_image.sh b/.github/jobs/build_docker_image.sh
index 47dc46e20a..f216c0aa0e 100755
--- a/.github/jobs/build_docker_image.sh
+++ b/.github/jobs/build_docker_image.sh
@@ -15,7 +15,7 @@ time_command docker build -t ${DOCKERHUB_TAG} \
--build-arg MET_CONFIG_OPTS \
-f $DOCKERFILE_PATH ${GITHUB_WORKSPACE}
if [ $? != 0 ]; then
- cat ${GITHUB_WORKSPACE}/docker_build.log
+ cat ${CMD_LOGFILE}
exit 1
fi
diff --git a/.github/jobs/build_sonarqube_image.sh b/.github/jobs/build_sonarqube_image.sh
new file mode 100755
index 0000000000..55d558624b
--- /dev/null
+++ b/.github/jobs/build_sonarqube_image.sh
@@ -0,0 +1,45 @@
+#! /bin/bash
+
+source ${GITHUB_WORKSPACE}/.github/jobs/bash_functions.sh
+
+DOCKERHUB_TAG=met-sonarqube-gha
+
+DOCKERFILE_PATH=${GITHUB_WORKSPACE}/internal/scripts/docker/Dockerfile.sonarqube
+
+CMD_LOGFILE=${GITHUB_WORKSPACE}/sonarqube_build.log
+
+#
+# Define the $SONAR_REFERENCE_BRANCH as the
+# - Target of any requests
+# - Manual setting for workflow dispatch
+# - Source branch for any pushes (e.g. develop)
+#
+if [ "${GITHUB_EVENT_NAME}" == "pull_request" ]; then
+ export SONAR_REFERENCE_BRANCH=${GITHUB_BASE_REF}
+elif [ "${GITHUB_EVENT_NAME}" == "workflow_dispatch" ]; then
+ export SONAR_REFERENCE_BRANCH=${WD_REFERENCE_BRANCH}
+else
+ export SONAR_REFERENCE_BRANCH=${SOURCE_BRANCH}
+fi
+
+echo SONAR_REFERENCE_BRANCH=${SONAR_REFERENCE_BRANCH}
+
+time_command docker build -t ${DOCKERHUB_TAG} \
+ --build-arg MET_BASE_REPO \
+ --build-arg MET_BASE_TAG \
+ --build-arg SOURCE_BRANCH \
+ --build-arg SONAR_SCANNER_VERSION \
+ --build-arg SONAR_HOST_URL \
+ --build-arg SONAR_TOKEN \
+ --build-arg SONAR_REFERENCE_BRANCH \
+ -f $DOCKERFILE_PATH ${GITHUB_WORKSPACE}
+if [ $? != 0 ]; then
+ cat ${CMD_LOGFILE}
+ exit 1
+fi
+
+# Copy the .scannerwork directory from the image
+id=$(docker create ${DOCKERHUB_TAG})
+time_command mkdir -p /tmp/scannerwork
+time_command docker cp $id:/met/.scannerwork/report-task.txt /tmp/scannerwork/report-task.txt
+docker rm -v $id
diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md
index d3a97c7a05..0ed1004546 100644
--- a/.github/pull_request_template.md
+++ b/.github/pull_request_template.md
@@ -22,6 +22,9 @@ If **yes**, describe the new output and/or changes to the existing output:
- [ ] Will this PR result in changes to existing METplus Use Cases? **[Yes or No]**
If **yes**, create a new **Update Truth** [METplus issue](https://github.com/dtcenter/METplus/issues/new/choose) to describe them.
+- [ ] Do these changes introduce new SonarQube findings? **[Yes or No]**
+If **yes**, please describe:
+
- [ ] Please complete this pull request review by **[Fill in date]**.
## Pull Request Checklist ##
diff --git a/.github/workflows/sonarqube.yml b/.github/workflows/sonarqube.yml
new file mode 100644
index 0000000000..6a6627fb69
--- /dev/null
+++ b/.github/workflows/sonarqube.yml
@@ -0,0 +1,91 @@
+name: SonarQube Scan
+
+# Run SonarQube for Pull Requests and changes to the develop and main_vX.Y branches
+
+on:
+
+ # Trigger analysis for pushes to develop and main_vX.Y branches
+ push:
+ branches:
+ - develop
+ - 'main_v**'
+ paths-ignore:
+ - 'docs/**'
+ - '.github/pull_request_template.md'
+ - '.github/ISSUE_TEMPLATE/**'
+ - '.github/labels/**'
+ - '**/README.md'
+ - '**/LICENSE.md'
+
+ # Trigger analysis for pull requests to develop and main_vX.Y branches
+ pull_request:
+ types: [opened, synchronize, reopened]
+ branches:
+ - develop
+ - 'main_v**'
+ paths-ignore:
+ - 'docs/**'
+ - '.github/pull_request_template.md'
+ - '.github/ISSUE_TEMPLATE/**'
+ - '.github/labels/**'
+ - '**/README.md'
+ - '**/LICENSE.md'
+
+ workflow_dispatch:
+ inputs:
+ reference_branch:
+ description: 'Reference Branch'
+ default: develop
+ type: string
+
+jobs:
+ build:
+ name: SonarQube Scan
+ runs-on: ubuntu-latest
+
+ steps:
+
+ - uses: actions/checkout@v4
+ with:
+ # Disable shallow clones for better analysis
+ fetch-depth: 0
+
+ - name: Create output directories
+ run: mkdir -p ${RUNNER_WORKSPACE}/logs
+
+ - name: Get branch name
+ id: get_branch_name
+ run: echo branch_name=${GITHUB_REF#refs/heads/} >> $GITHUB_OUTPUT
+
+ - name: SonarQube Scan in Docker
+ run: .github/jobs/build_sonarqube_image.sh
+ env:
+ MET_BASE_REPO: met-base
+ MET_BASE_TAG: v3.2
+ SOURCE_BRANCH: ${{ steps.get_branch_name.outputs.branch_name }}
+ WD_REFERENCE_BRANCH: ${{ github.event.inputs.reference_branch }}
+ SONAR_SCANNER_VERSION: 5.0.1.3006
+ SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
+ SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
+
+ - name: SonarQube Quality Gate check
+ id: sonarqube-quality-gate-check
+ uses: sonarsource/sonarqube-quality-gate-action@master
+ with:
+ scanMetadataReportFile: /tmp/scannerwork/report-task.txt
+ timeout-minutes: 5
+ env:
+ SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
+ SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
+
+ - name: Copy log files into logs directory
+ if: always()
+ run: cp ${GITHUB_WORKSPACE}/*.log ${RUNNER_WORKSPACE}/logs/
+
+ - name: Upload logs as artifact
+ if: always()
+ uses: actions/upload-artifact@v4
+ with:
+ name: logs_sonarqube
+ path: ${{ runner.workspace }}/logs
+ if-no-files-found: ignore
diff --git a/data/config/TCRMWConfig_default b/data/config/TCRMWConfig_default
index dfb18721ac..e27a4b2741 100644
--- a/data/config/TCRMWConfig_default
+++ b/data/config/TCRMWConfig_default
@@ -98,9 +98,8 @@ regrid = {
//
n_range = 100;
n_azimuth = 180;
-max_range_km = 1000.0;
delta_range_km = 10.0;
-rmw_scale = 0.2;
+rmw_scale = NA;
//
// Optionally convert u/v winds to tangential/radial winds
diff --git a/docs/Users_Guide/reformat_point.rst b/docs/Users_Guide/reformat_point.rst
index 32695f36b0..ec09fa3f83 100644
--- a/docs/Users_Guide/reformat_point.rst
+++ b/docs/Users_Guide/reformat_point.rst
@@ -458,6 +458,8 @@ While initial versions of the ASCII2NC tool only supported a simple 11 column AS
• `International Soil Moisture Network (ISMN) Data format `_.
+• `International Arctic Buoy Programme (IABP) Data format `_.
+
• `AErosol RObotic NEtwork (AERONET) versions 2 and 3 format `_
• Python embedding of point observations, as described in :numref:`pyembed-point-obs-data`. See example below in :numref:`ascii2nc-pyembed`.
@@ -522,6 +524,8 @@ Once the ASCII point observations have been formatted as expected, the ASCII fil
netcdf_file
[-format ASCII_format]
[-config file]
+ [-valid_beg time]
+ [-valid_end time]
[-mask_grid string]
[-mask_poly file]
[-mask_sid file|list]
@@ -541,21 +545,25 @@ Required Arguments for ascii2nc
Optional Arguments for ascii2nc
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-3. The **-format ASCII_format** option may be set to "met_point", "little_r", "surfrad", "wwsis", "airnowhourlyaqobs", "airnowhourly", "airnowdaily_v2", "ndbc_standard", "ismn", "aeronet", "aeronetv2", "aeronetv3", or "python". If passing in ISIS data, use the "surfrad" format flag.
+3. The **-format ASCII_format** option may be set to "met_point", "little_r", "surfrad", "wwsis", "airnowhourlyaqobs", "airnowhourly", "airnowdaily_v2", "ndbc_standard", "ismn", "iabp", "aeronet", "aeronetv2", "aeronetv3", or "python". If passing in ISIS data, use the "surfrad" format flag.
4. The **-config file** option is the configuration file for generating time summaries.
-5. The **-mask_grid** string option is a named grid or a gridded data file to filter the point observations spatially.
+5. The **-valid_beg** time option in YYYYMMDD[_HH[MMSS]] format sets the beginning of the retention time window.
-6. The **-mask_poly** file option is a polyline masking file to filter the point observations spatially.
+6. The **-valid_end** time option in YYYYMMDD[_HH[MMSS]] format sets the end of the retention time window.
-7. The **-mask_sid** file|list option is a station ID masking file or a comma-separated list of station ID's to filter the point observations spatially. See the description of the "sid" entry in :numref:`config_options`.
+7. The **-mask_grid** string option is a named grid or a gridded data file to filter the point observations spatially.
-8. The **-log file** option directs output and errors to the specified log file. All messages will be written to that file as well as standard out and error. Thus, users can save the messages without having to redirect the output on the command line. The default behavior is no log file.
+8. The **-mask_poly** file option is a polyline masking file to filter the point observations spatially.
-9. The **-v level** option indicates the desired level of verbosity. The value of "level" will override the default setting of 2. Setting the verbosity to 0 will make the tool run with no log messages, while increasing the verbosity above 1 will increase the amount of logging.
+9. The **-mask_sid** file|list option is a station ID masking file or a comma-separated list of station ID's to filter the point observations spatially. See the description of the "sid" entry in :numref:`config_options`.
-10. The **-compress level** option indicates the desired level of compression (deflate level) for NetCDF variables. The valid level is between 0 and 9. The value of "level" will override the default setting of 0 from the configuration file or the environment variable MET_NC_COMPRESS. Setting the compression level to 0 will make no compression for the NetCDF output. Lower number is for fast compression and higher number is for better compression.
+10. The **-log file** option directs output and errors to the specified log file. All messages will be written to that file as well as standard out and error. Thus, users can save the messages without having to redirect the output on the command line. The default behavior is no log file.
+
+11. The **-v level** option indicates the desired level of verbosity. The value of "level" will override the default setting of 2. Setting the verbosity to 0 will make the tool run with no log messages, while increasing the verbosity above 1 will increase the amount of logging.
+
+12. The **-compress level** option indicates the desired level of compression (deflate level) for NetCDF variables. The valid level is between 0 and 9. The value of "level" will override the default setting of 0 from the configuration file or the environment variable MET_NC_COMPRESS. Setting the compression level to 0 will make no compression for the NetCDF output. Lower number is for fast compression and higher number is for better compression.
An example of the ascii2nc calling sequence is shown below:
@@ -1203,3 +1211,34 @@ For how to use the script, issue the command:
.. code-block:: none
python3 MET_BASE/python/utility/print_pointnc2ascii.py -h
+
+IABP retrieval Python Utilities
+====================================
+
+`International Arctic Buoy Programme (IABP) Data `_ is one of the data types supported by ascii2nc. A utility script that pulls all this data from the web and stores it locally, called get_iabp_from_web.py is included. This script accesses the appropriate webpage and downloads the ascii files for all buoys. It is straightforward, but can be time intensive as the archive of this data is extensive and files are downloaded one at a time.
+
+The script can be found at:
+
+.. code-block:: none
+
+ MET_BASE/python/utility/get_iabp_from_web.py
+
+For how to use the script, issue the command:
+
+.. code-block:: none
+
+ python3 MET_BASE/python/utility/get_iabp_from_web.py -h
+
+Another IABP utility script is included for users, to be run after all files have been downloaded using get_iabp_from_web.py. This script examines all the files and lists those files that contain entries that fall within a user specified range of days. It is called find_iabp_in_timerange.py.
+
+The script can be found at:
+
+.. code-block:: none
+
+ MET_BASE/python/utility/find_iabp_in_timerange.py
+
+For how to use the script, issue the command:
+
+.. code-block:: none
+
+ python3 MET_BASE/python/utility/find_iabp_in_timerange.py -h
diff --git a/docs/Users_Guide/tc-rmw.rst b/docs/Users_Guide/tc-rmw.rst
index a9e67ffbc1..82628c087c 100644
--- a/docs/Users_Guide/tc-rmw.rst
+++ b/docs/Users_Guide/tc-rmw.rst
@@ -101,27 +101,19 @@ The **n_azimuth** parameter is the number of equally spaced azimuth intervals in
_______________________
-.. code-block:: none
-
- max_range_km = 100.0;
-
-The **max_range_km** parameter specifies the maximum range of the range-azimuth grid, in kilometers. If this parameter is specified and not **rmw_scale**, the radial grid spacing will be **max_range_km / n_range**.
-
-_______________________
-
.. code-block:: none
delta_range_km = 10.0;
-The **delta_range_km** parameter specifies the spacing of the range rings, in kilometers.
+The **delta_range_km** parameter specifies the spacing of the range rings, in kilometers. The range values start with 0 km and extend out to **n_range - 1** times this delta spacing.
_______________________
.. code-block:: none
- rmw_scale = 0.2;
+ rmw_scale = NA;
-The **rmw_scale** parameter overrides the **max_range_km** parameter. When this is set the radial grid spacing will be **rmw_scale** in units of the RMW, which varies along the storm track.
+If changed from its default value of **NA**, the **rmw_scale** parameter overrides the **delta_range_km** parameter. The radial grid spacing is defined using **rmw_scale** in units of the RMW, which varies along the storm track. For example, setting **rmw_scale** to 0.2 would define the delta range spacing as 20% of the radius of maximum winds around each point. Note that RMW is defined in nautical miles but is converted to kilometers for this computation.
_______________________
diff --git a/internal/scripts/docker/Dockerfile.sonarqube b/internal/scripts/docker/Dockerfile.sonarqube
new file mode 100644
index 0000000000..75dc3c952c
--- /dev/null
+++ b/internal/scripts/docker/Dockerfile.sonarqube
@@ -0,0 +1,94 @@
+ARG MET_BASE_REPO=met-base
+ARG MET_BASE_TAG=v3.2
+
+FROM dtcenter/${MET_BASE_REPO}:${MET_BASE_TAG}
+MAINTAINER John Halley Gotway
+
+#
+# This Dockerfile checks out MET from GitHub and runs the
+# SonarQube static code analysis on the specified branch or tag.
+# https://docs.sonarqube.org/latest/analysis/scan/sonarscanner/
+#
+ARG SONAR_SCANNER_VERSION=5.0.1.3006
+ARG SONAR_HOST_URL
+ARG SONAR_TOKEN
+ARG SOURCE_BRANCH
+ARG SONAR_REFERENCE_BRANCH
+
+#
+# SONAR_HOST_URL is required.
+#
+RUN if [ "x${SONAR_HOST_URL}" = "x" ]; then \
+ echo "ERROR: SONAR_HOST_URL undefined! Rebuild with \"--build-arg SONAR_HOST_URL={url}\""; \
+ exit 1; \
+ fi
+
+#
+# SONAR_TOKEN is required.
+#
+RUN if [ "x${SONAR_TOKEN}" = "x" ]; then \
+ echo "ERROR: SONAR_TOKEN undefined! Rebuild with \"--build-arg SONAR_TOKEN={token}\""; \
+ exit 1; \
+ fi
+
+#
+# SOURCE_BRANCH is the branch name of the MET source code.
+#
+RUN if [ "x${SOURCE_BRANCH}" = "x" ]; then \
+ echo "ERROR: SOURCE_BRANCH undefined! Rebuild with \"--build-arg SOURCE_BRANCH={branch name}\""; \
+ exit 1; \
+ else \
+ echo "Build Argument SOURCE_BRANCH=${SOURCE_BRANCH}"; \
+ fi
+
+#
+# SONAR_REFERENCE_BRANCH defines to the version against which this scan should be compared.
+#
+RUN if [ "x${SONAR_REFERENCE_BRANCH}" = "x" ]; then \
+ echo "ERROR: SONAR_REFERENCE_BRANCH undefined! Rebuild with \"--build-arg SONAR_REFERENCE_BRANCH={branch name}\""; \
+ exit 1; \
+ else \
+ echo "Build Argument SONAR_REFERENCE_BRANCH=${SONAR_REFERENCE_BRANCH}"; \
+ fi
+
+ENV MET_GIT_NAME ${SOURCE_BRANCH}
+ENV MET_REPO_DIR /met/MET-${MET_GIT_NAME}
+ENV MET_GIT_URL https://github.com/dtcenter/MET
+
+#
+# Download and install the Sonar software.
+#
+RUN echo "Installing SonarQube into $HOME/.sonar" \
+ && mkdir -p $HOME/.sonar \
+ && curl -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${SONAR_SCANNER_VERSION}-linux.zip \
+ && unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/ \
+ && echo export PATH="$HOME/.sonar/sonar-scanner-${SONAR_SCANNER_VERSION}-linux/bin:\$PATH" >> $HOME/.bashrc \
+ && curl -sSLo $HOME/.sonar/build-wrapper-linux-x86.zip ${SONAR_HOST_URL}/static/cpp/build-wrapper-linux-x86.zip \
+ && unzip -o $HOME/.sonar/build-wrapper-linux-x86.zip -d $HOME/.sonar/ \
+ && echo export PATH="$HOME/.sonar/build-wrapper-linux-x86:\$PATH" >> $HOME/.bashrc
+
+#
+# Update the OS, as needed.
+#
+RUN apt update
+
+#
+# Set the working directory.
+#
+WORKDIR /met
+
+#
+# Copy MET Download and install MET.
+#
+RUN echo "Copying MET into ${MET_REPO_DIR}" \
+ && mkdir -p ${MET_REPO_DIR}
+
+COPY . ${MET_REPO_DIR}
+
+RUN if [ ! -e "${MET_REPO_DIR}/configure.ac" ]; then \
+ echo "ERROR: docker build must be run from the MET directory: `ls`"; \
+ exit 1; \
+ fi
+
+RUN cd ${MET_REPO_DIR} \
+ && internal/scripts/docker/build_met_sonarqube.sh
diff --git a/internal/scripts/docker/build_met_sonarqube.sh b/internal/scripts/docker/build_met_sonarqube.sh
new file mode 100755
index 0000000000..45e1d10fc5
--- /dev/null
+++ b/internal/scripts/docker/build_met_sonarqube.sh
@@ -0,0 +1,128 @@
+#!/bin/bash
+#
+# Run SonarQube Source Code Analyzer within a Docker container
+#=======================================================================
+#
+# This build_met_sonarqube.sh script must be run from the top-level
+# directory of the MET repository to be analyzed. It runs SonarQube to
+# scan the MET source code.
+#
+# Usage: internal/scripts/docker/build_met_sonarqube.sh
+#
+# Required Enviornment Variables:
+# SONAR_HOST_URL
+# SONAR_TOKEN
+# MET_GIT_NAME
+# SONAR_REFERENCE_BRANCH
+#
+#=======================================================================
+
+# Check that this is being run from the top-level MET directory
+if [ ! -e internal/scripts/docker/build_met_sonarqube.sh ]; then
+ echo "ERROR: ${0} -> must be run from the top-level MET directory"
+ exit 1
+fi
+
+echo "Running script to scan MET with SonarQube in Docker"
+
+# Source the docker build environment
+source ~/.bashrc
+source internal/scripts/environment/development.docker
+source .github/jobs/bash_functions.sh
+
+# Check required environment variables
+if [ -z ${SONAR_HOST_URL+x} ]; then
+ echo "ERROR: ${0} -> \$SONAR_HOST_URL not defined!"
+ exit 1
+fi
+if [ -z ${SONAR_TOKEN+x} ]; then
+ echo "ERROR: ${0} -> \$SONAR_TOKEN not defined!"
+ exit 1
+fi
+if [ -z ${MET_GIT_NAME+x} ]; then
+ echo "ERROR: ${0} -> \$MET_GIT_NAME not defined!"
+ exit 1
+fi
+if [ -z ${SONAR_REFERENCE_BRANCH+x} ]; then
+ echo "ERROR: ${0} -> \$SONAR_REFERENCE_BRANCH not defined!"
+ exit 1
+fi
+
+# Locate the wrapper
+WRAPPER_NAME=build-wrapper-linux-x86-64
+SONAR_WRAPPER=$(which $WRAPPER_NAME 2> /dev/null)
+
+if [ ! -e $SONAR_WRAPPER ]; then
+ echo "ERROR: ${0} -> $WRAPPER_NAME not found in the path"
+ exit 1
+else
+ echo "SONAR_WRAPPER=$SONAR_WRAPPER"
+fi
+
+# Locate the scanner
+SCANNER_NAME=sonar-scanner
+SONAR_SCANNER=$(which $SCANNER_NAME 2> /dev/null)
+
+if [ ! -e $SONAR_SCANNER ]; then
+ echo "ERROR: ${0} -> $SCANNER_NAME not found in the path"
+ exit 1
+else
+ echo "SONAR_SCANNER=$SONAR_SCANNER"
+fi
+
+# Set output directory name
+if [ -z ${SONARQUBE_OUT_DIR} ]; then
+ export SONARQUBE_OUT_DIR=bw-outputs
+fi
+
+# Define the version string
+SONAR_PROJECT_VERSION=$(cat docs/version | cut -d'=' -f2 | tr -d '" ')
+
+# Store the full path to the scripts directory
+SONAR_PROPERTIES_DIR=internal/scripts/sonarqube
+SONAR_PROPERTIES=sonar-project.properties
+
+# Configure the sonar-project.properties
+[ -e $SONAR_PROPERTIES ] && rm $SONAR_PROPERTIES
+sed -e "s|SONAR_PROJECT_KEY|MET-GHA|" \
+ -e "s|SONAR_PROJECT_NAME|MET GHA|" \
+ -e "s|SONAR_PROJECT_VERSION|$SONAR_PROJECT_VERSION|" \
+ -e "s|SONAR_HOST_URL|$SONAR_HOST_URL|" \
+ -e "s|SONAR_TOKEN|$SONAR_TOKEN|" \
+ -e "s|SONAR_BRANCH_NAME|$MET_GIT_NAME|" \
+ $SONAR_PROPERTIES_DIR/$SONAR_PROPERTIES > $SONAR_PROPERTIES
+
+# The source and reference branches must differ to define new code
+if [ "$MET_GIT_NAME" != "$SONAR_REFERENCE_BRANCH" ]; then
+ echo "sonar.newCode.referenceBranch=${SONAR_REFERENCE_BRANCH}" >> $SONAR_PROPERTIES
+fi
+
+# Run the MET configure script
+time_command ./configure \
+ BUFRLIB_NAME=${BUFRLIB_NAME} \
+ GRIB2CLIB_NAME=${GRIB2CLIB_NAME} \
+ --enable-all \
+ CPPFLAGS="-I/usr/local/include -I/usr/local/include/freetype2 -I/usr/local/include/cairo" \
+ LIBS="-ltirpc"
+
+# Run make clean
+time_command make clean
+
+# Run SonarQube make
+time_command $SONAR_WRAPPER --out-dir $SONARQUBE_OUT_DIR make
+
+# Run SonarQube scan
+time_command $SONAR_SCANNER
+status=$?
+
+# Check return status
+if [[ $status -ne 0 ]]; then
+ echo "ERROR: ${0} -> the SonarQube scan returned with non-zero status (${status})!"
+ exit ${status}
+fi
+
+# Copy the scan report-task.txt file
+mkdir -p /met/.scannerwork
+cp .scannerwork/report-task.txt /met/.scannerwork/report-task.txt
+
+[ -e $SONAR_PROPERTIES ] && rm $SONAR_PROPERTIES
diff --git a/internal/scripts/sonarqube/python.sonar-project.properties b/internal/scripts/sonarqube/python.sonar-project.properties
deleted file mode 100644
index f304a07204..0000000000
--- a/internal/scripts/sonarqube/python.sonar-project.properties
+++ /dev/null
@@ -1,18 +0,0 @@
-sonar.projectKey=MET_python_NB
-sonar.projectName=MET python Nightly Build
-sonar.projectVersion=1.0
-
-sonar.sources=scripts/python,data/wrappers
-sonar.python.version=3.6.3
-
-# The build-wrapper output dir
-
-# Encoding of the source files
-sonar.sourceEncoding=UTF-8
-
-#----- Default SonarQube server
-#sonar.host.url=http://localhost:9000
-sonar.host.url=SONAR_SERVER_URL
-
-sonar.token=SONAR_TOKEN_VALUE
-sonar.branch.name=develop
diff --git a/internal/scripts/sonarqube/run_sonarqube.sh b/internal/scripts/sonarqube/run_sonarqube.sh
index 31264f2f9b..1a57b0b726 100755
--- a/internal/scripts/sonarqube/run_sonarqube.sh
+++ b/internal/scripts/sonarqube/run_sonarqube.sh
@@ -24,10 +24,10 @@
GIT_REPO="https://github.com/dtcenter/${GIT_REPO_NAME}"
function usage {
- echo
- echo "USAGE: $(basename $0) name"
- echo " where \"name\" specifies a branch, tag, or hash."
- echo
+ echo
+ echo "USAGE: $(basename $0) name"
+ echo " where \"name\" specifies a branch, tag, or hash."
+ echo
}
# Check for arguments
@@ -90,7 +90,6 @@ function run_command() {
return ${STATUS}
}
-
# Store the full path to the scripts directory
SCRIPT_DIR=`dirname $0`
if [[ ${0:0:1} != "/" ]]; then SCRIPT_DIR=$(pwd)/${SCRIPT_DIR}; fi
@@ -111,46 +110,37 @@ run_command "git checkout ${1}"
export MET_DEVELOPMENT=true
# Run the configure script
-run_command "./configure --prefix=`pwd` \
- --enable-grib2 \
- --enable-modis \
- --enable-mode_graphics \
- --enable-lidar2nc \
- --enable-python \
- --enable-ugrid"
+run_command "./configure --prefix=`pwd` --enable-all"
-# Set the build id
-#BUILD_ID="MET-${1}"
+# Define the version string
+SONAR_PROJECT_VERSION=$(grep "^version" docs/conf.py | cut -d'=' -f2 | tr -d "\'\" ")
SONAR_PROPERTIES=sonar-project.properties
-# Copy sonar-project.properties for Python code
+# Configure sonar-project.properties
[ -e $SONAR_PROPERTIES ] && rm $SONAR_PROPERTIES
-[ -z "$SONAR_SERVER_URL" ] && SONAR_SERVER_URL="http://localhost:9000"
-if [ -z "$SONAR_TOKEN_VALUE" ]; then
- echo " == ERROR == SONAR_TOKEN_VALUE is not defined"
+[ -z "$SONAR_HOST_URL" ] && SONAR_HOST_URL="http://localhost:9000"
+if [ -z "$SONAR_TOKEN" ]; then
+ echo " == ERROR == SONAR_TOKEN is not defined"
exit 1
else
- sed -e "s|SONAR_TOKEN_VALUE|$SONAR_TOKEN_VALUE|" -e "s|SONAR_SERVER_URL|$SONAR_SERVER_URL|" $SCRIPT_DIR/python.sonar-project.properties > $SONAR_PROPERTIES
-
- # Run SonarQube scan for Python code
- run_command "$SONAR_SCANNER"
-
- # Copy sonar-project.properties for C/C++ code
[ -e $SONAR_PROPERTIES ] && rm $SONAR_PROPERTIES
- sed -e "s|SONAR_TOKEN_VALUE|$SONAR_TOKEN_VALUE|" -e "s|SONAR_SERVER_URL|$SONAR_SERVER_URL|" $SCRIPT_DIR/sonar-project.properties > $SONAR_PROPERTIES
+ sed -e "s|SONAR_PROJECT_KEY|MET_NB|" \
+ -e "s|SONAR_PROJECT_NAME|MET Nightly Build|" \
+ -e "s|SONAR_PROJECT_VERSION|$SONAR_PROJECT_VERSION|" \
+ -e "s|SONAR_HOST_URL|$SONAR_HOST_URL|" \
+ -e "s|SONAR_TOKEN|$SONAR_TOKEN|" \
+ -e "s|SONAR_BRANCH_NAME|${1}|" \
+ $SCRIPT_DIR/$SONAR_PROPERTIES > $SONAR_PROPERTIES
# Run SonarQube clean
run_command "make clean"
- # Run SonarQube make
+ # Run SonarQube build wrapper
run_command "$SONAR_WRAPPER --out-dir $SONARQUBE_OUT_DIR make"
- # Run SonarQube scan for C/C++ code
+ # Run SonarQube scan
run_command "$SONAR_SCANNER"
[ -e $SONAR_PROPERTIES ] && rm $SONAR_PROPERTIES
fi
-
-# Run SonarQube report generator to make a PDF file
-#TODAY=`date +%Y%m%d`
diff --git a/internal/scripts/sonarqube/sonar-project.properties b/internal/scripts/sonarqube/sonar-project.properties
index ec39576c4f..215749e75b 100644
--- a/internal/scripts/sonarqube/sonar-project.properties
+++ b/internal/scripts/sonarqube/sonar-project.properties
@@ -1,18 +1,15 @@
-sonar.projectKey=MET_develop_NB
-sonar.projectName=MET Nightly Build
-sonar.projectVersion=1.0
-
-sonar.sources=src
+# Project and source code settings
+sonar.projectKey=SONAR_PROJECT_KEY
+sonar.projectName=SONAR_PROJECT_NAME
+sonar.projectVersion=SONAR_PROJECT_VERSION
+sonar.branch.name=SONAR_BRANCH_NAME
+sonar.sources=src,scripts/python,data/wrappers
+sonar.python.version=3.6.3
+sonar.sourceEncoding=UTF-8
# The build-wrapper output dir
sonar.cfamily.build-wrapper-output=bw-outputs
-# Encoding of the source files
-sonar.sourceEncoding=UTF-8
-
-#----- Default SonarQube server
-#sonar.host.url=http://localhost:9000
-sonar.host.url=SONAR_SERVER_URL
-
-sonar.token=SONAR_TOKEN_VALUE
-sonar.branch.name=develop
+# SonarQube server
+sonar.host.url=SONAR_HOST_URL
+sonar.token=SONAR_TOKEN
diff --git a/internal/test_unit/config/TCRMWConfig_gonzalo b/internal/test_unit/config/TCRMWConfig_gonzalo
index 32a6beb118..d2ff3a1c00 100644
--- a/internal/test_unit/config/TCRMWConfig_gonzalo
+++ b/internal/test_unit/config/TCRMWConfig_gonzalo
@@ -99,9 +99,8 @@ regrid = {
//
n_range = 50;
n_azimuth = 90;
-max_range_km = 1000.0;
delta_range_km = 10.0;
-rmw_scale = 0.2;
+rmw_scale = NA;
//
// Optionally convert u/v winds to tangential/radial winds
diff --git a/internal/test_unit/config/TCRMWConfig_pressure_lev_out b/internal/test_unit/config/TCRMWConfig_pressure_lev_out
index 747d9fa9b5..aa8c7a2287 100644
--- a/internal/test_unit/config/TCRMWConfig_pressure_lev_out
+++ b/internal/test_unit/config/TCRMWConfig_pressure_lev_out
@@ -99,8 +99,7 @@ regrid = {
//
n_range = 100;
n_azimuth = 180;
-max_range_km = 1000.0;
-delta_range_km = 10.0;
+delta_range_km = NA;
rmw_scale = 0.2;
//
diff --git a/internal/test_unit/xml/unit_ascii2nc.xml b/internal/test_unit/xml/unit_ascii2nc.xml
index 2dd9df07e7..4424fd0e33 100644
--- a/internal/test_unit/xml/unit_ascii2nc.xml
+++ b/internal/test_unit/xml/unit_ascii2nc.xml
@@ -211,4 +211,19 @@
+
+ &MET_BIN;/ascii2nc
+ \
+ -format iabp \
+ -valid_beg 20140101 -valid_end 20140201 \
+ &DATA_DIR_OBS;/iabp/090629.dat \
+ &DATA_DIR_OBS;/iabp/109320.dat \
+ &DATA_DIR_OBS;/iabp/109499.dat \
+ &OUTPUT_DIR;/ascii2nc/iabp_20140101_20140201.nc
+
+
+
+
diff --git a/scripts/python/utility/Makefile.am b/scripts/python/utility/Makefile.am
index 5efd02b01e..2509cff62b 100644
--- a/scripts/python/utility/Makefile.am
+++ b/scripts/python/utility/Makefile.am
@@ -26,8 +26,11 @@
pythonutilitydir = $(pkgdatadir)/python/utility
pythonutility_DATA = \
+ build_ndbc_stations_from_web.py \
+ find_iabp_in_timerange.py \
+ get_iabp_from_web.py \
print_pointnc2ascii.py \
- build_ndbc_stations_from_web.py
+ rgb2ctable.py
EXTRA_DIST = ${pythonutility_DATA}
diff --git a/scripts/python/utility/Makefile.in b/scripts/python/utility/Makefile.in
index 4c379b52a6..0b977854db 100644
--- a/scripts/python/utility/Makefile.in
+++ b/scripts/python/utility/Makefile.in
@@ -311,8 +311,11 @@ top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
pythonutilitydir = $(pkgdatadir)/python/utility
pythonutility_DATA = \
+ build_ndbc_stations_from_web.py \
+ find_iabp_in_timerange.py \
+ get_iabp_from_web.py \
print_pointnc2ascii.py \
- build_ndbc_stations_from_web.py
+ rgb2ctable.py
EXTRA_DIST = ${pythonutility_DATA}
MAINTAINERCLEANFILES = Makefile.in
diff --git a/scripts/python/utility/find_iabp_in_timerange.py b/scripts/python/utility/find_iabp_in_timerange.py
new file mode 100755
index 0000000000..3aa76d1eff
--- /dev/null
+++ b/scripts/python/utility/find_iabp_in_timerange.py
@@ -0,0 +1,241 @@
+ #!/usr/bin/env python3
+
+from optparse import OptionParser
+import urllib.request
+import datetime
+from datetime import date
+import os
+import shutil
+import shlex
+import errno
+from subprocess import Popen, PIPE
+
+
+
+#----------------------------------------------
+def usage():
+ print("Usage: find_iabp_in_timerange.py -s yyyymmdd -e yyyymmdd [-d PATH]")
+
+#----------------------------------------------
+def is_date_in_range(input_date, start_date, end_date):
+ return start_date <= input_date <= end_date
+
+#----------------------------------------------
+def lookFor(name, inlist, filename, printWarning=False):
+ rval = -1
+ try:
+ rval = inlist.index(name)
+ except:
+ if printWarning:
+ print(name, " not in header line, file=", filename)
+
+ return rval
+
+#----------------------------------------------
+def pointToInt(index, tokens, filename):
+ if index < 0 or index >= len(tokens):
+ print("ERROR index out of range ", index)
+ return -1
+ return int(tokens[index])
+
+#----------------------------------------------
+def pointToFloat(index, tokens, filename):
+ if index < 0 or index >= len(tokens):
+ print("ERROR index out of range ", index)
+ return -99.99
+ return float(tokens[index])
+
+#----------------------------------------------
+class StationHeader:
+ def __init__(self, headerLine, filename):
+ tokens = headerLine.split()
+ self._ok = True
+ self._idIndex = lookFor('BuoyID', tokens, filename, True)
+ self._yearIndex = lookFor('Year', tokens, filename, True)
+ self._hourIndex = lookFor('Hour', tokens, filename, True)
+ self._minuteIndex = lookFor('Min', tokens, filename, True)
+ self._doyIndex = lookFor('DOY', tokens, filename, True)
+ self._posdoyIndex = lookFor('POS_DOY', tokens, filename, True)
+ self._latIndex = lookFor('Lat', tokens, filename, True)
+ self._lonIndex = lookFor('Lon', tokens, filename, True)
+ self._bpIndex = lookFor('BP', tokens, filename, False)
+ self._tsIndex = lookFor('Ts', tokens, filename, False)
+ self._taIndex = lookFor('Ta', tokens, filename, False)
+ self._ok = self._idIndex != -1 and self._yearIndex != -1 and self._hourIndex != -1 \
+ and self._minuteIndex != -1 and self._doyIndex != -1 and self._posdoyIndex != -1 \
+ and self._latIndex != -1 and self._lonIndex != -1
+ if not self._ok:
+ print("ERROR badly formed header line")
+
+#----------------------------------------------
+class Station:
+ def __init__(self, line, filename, stationHeader):
+ self._ok = True
+ tokens = line.split()
+ self._id = pointToInt(stationHeader._idIndex, tokens, filename)
+ if self._id < 0:
+ self._ok = False
+ self._year = pointToInt(stationHeader._yearIndex, tokens, filename)
+ if self._year < 0:
+ self._ok = False
+ self._hour = pointToInt(stationHeader._hourIndex, tokens, filename)
+ if self._hour < 0:
+ self._ok = False
+ self._minute = pointToInt(stationHeader._minuteIndex, tokens, filename)
+ if self._minute < 0:
+ self._ok = False
+ self._doy = pointToFloat(stationHeader._doyIndex, tokens, filename)
+ if self._doy < 0:
+ self._ok = False
+ if self._doy > 365:
+ self._ok = False
+ self._posdoy = pointToFloat(stationHeader._posdoyIndex, tokens, filename)
+ if self._posdoy < 0:
+ self._ok = False
+ if self._posdoy > 365:
+ self._ok = False
+ self._lat = pointToFloat(stationHeader._latIndex, tokens, filename)
+ if self._lat == -99.99:
+ self._ok = False
+ self._lon = pointToFloat(stationHeader._lonIndex, tokens, filename)
+ if self._lon == -99.99:
+ self._ok = False
+ if stationHeader._bpIndex >= 0:
+ self._pressure = pointToFloat(stationHeader._bpIndex, tokens, filename)
+ else:
+ self._pressure = -99.99
+ if stationHeader._tsIndex >= 0:
+ self._tempsurface = pointToFloat(stationHeader._tsIndex, tokens, filename)
+ else:
+ self._tempsurface = -99.99
+ if stationHeader._taIndex >= 0:
+ self._tempair = pointToFloat(stationHeader._taIndex, tokens, filename)
+ else:
+ self._tempair = -99.99
+
+ if self._ok:
+ d = datetime.datetime(self._year, 1, 1) + datetime.timedelta(self._doy - 1)
+ self._month = d.month
+ self._day = d.day
+ else:
+ self._month = -1
+ self._day = -1
+ def timeInRange(self, start_date, end_date):
+ if self._ok:
+ input_date = date(self._year, self._month, self._day)
+ return is_date_in_range(input_date, start_date, end_date)
+ else:
+ return False
+
+#----------------------------------------------
+class StationTimeSeries:
+ def __init__(self, stationHeader):
+ self._stationHeader = stationHeader
+ self._data = []
+ def add(self, line, filename):
+ s = Station(line, filename, self._stationHeader)
+ if s._ok:
+ self._data.append(s)
+ def print(self):
+ print("Nothing")
+ def hasTimesInRange(self, start_date, end_date):
+ for s in self._data:
+ if (s.timeInRange(start_date, end_date)):
+ return True
+ return False
+
+#----------------------------------------------
+def doCmd(cmd, debug=False):
+ #print(cmd)
+ my_env = os.environ.copy()
+ args = shlex.split(cmd)
+ proc = Popen(args, stdout=PIPE, stderr=PIPE, env=my_env)
+ out, err = proc.communicate()
+ exitcode = proc.returncode
+ if exitcode == 0:
+ return str(out)
+ else:
+ if debug:
+ print("Command failed ", cmd)
+ return ""
+
+#----------------------------------------------
+def getdatafilenames(aDir):
+ if (os.path.exists(aDir)):
+ allFiles = [name for name in os.listdir(aDir) \
+ if not os.path.isdir(os.path.join(aDir, name))]
+ return [s for s in allFiles if '.dat' in s]
+ else:
+ return []
+
+#----------------------------------------------
+def run2(data_path, start, end):
+
+ if (data_path[0:2] != "./" and data_path[0] != '/'):
+ inpath = "./" + data_path
+ else:
+ inpath = data_path
+
+ print("data_path = ", inpath)
+
+ # could put testing here to make sure strings will convert
+ print("start = ", start)
+ print("end = ", end)
+
+ y0 = int(start[0:4])
+ m0 = int(start[4:6])
+ d0 = int(start[6:8])
+
+ y1 = int(end[0:4])
+ m1 = int(end[4:6])
+ d1 = int(end[6:8])
+
+ print("Looking for file with data in range ", y0, m0, d0, " to ", y1, m1, d1)
+
+ # read each file that ends in .dat
+ stationfiles = getdatafilenames(inpath)
+ stationfiles.sort()
+
+ print("We have ", len(stationfiles), " data files to look at")
+ start_date = date(y0, m0, d0)
+ end_date = date(y1, m1, d1)
+
+ for i in range(len(stationfiles)):
+
+ #print("Looking at ", stationfiles[i])
+ with open(inpath + "/" + stationfiles[i], 'r') as file:
+ data_all = file.read()
+ file.close()
+ lines = data_all.splitlines()
+
+ # first line is a header, remaining lines are a time series
+ sh = StationHeader(lines[0], stationfiles[i])
+ if sh._ok:
+ lines = lines[1:]
+ st = StationTimeSeries(sh)
+ for l in lines:
+ st.add(l, stationfiles[i])
+
+ if (st.hasTimesInRange(start_date, end_date)):
+ print(stationfiles[i])
+
+#----------------------------------------------
+def create_parser_options(parser):
+ parser.add_option("-d", "--data_path", dest="data_path",
+ default="./iabp_files", help=" path to the station files (.dat) (default: ./iabp_files)")
+ parser.add_option("-s", "--start", dest="start",
+ default="notset", help=" starting yyyymmdd. Must be set")
+ parser.add_option("-e", "--end", dest="end",
+ default="notset", help=" ending yyyymmdd. Must be set")
+ return parser.parse_args()
+
+#----------------------------------------------
+if __name__ == "__main__":
+ usage_str = "%prog [options]"
+ parser = OptionParser(usage = usage_str)
+ options, args = create_parser_options(parser)
+ if (options.start == "notset" or options.end == "notset"):
+ usage()
+ exit(0)
+ run2(options.data_path, options.start, options.end)
+ exit(0)
diff --git a/scripts/python/utility/get_iabp_from_web.py b/scripts/python/utility/get_iabp_from_web.py
new file mode 100755
index 0000000000..b2a931c8fe
--- /dev/null
+++ b/scripts/python/utility/get_iabp_from_web.py
@@ -0,0 +1,235 @@
+ #!/usr/bin/env python3
+
+from optparse import OptionParser
+import urllib.request
+import os
+import shutil
+import shlex
+import errno
+from subprocess import Popen, PIPE
+
+#----------------------------------------------------------------------------
+def makeOrScrub(path, debug=False):
+ if (debug):
+ print("Recreating path " + path)
+ if (os.path.exists(path)):
+ try:
+ shutil.rmtree(path)
+ os.makedirs(path)
+ except:
+ print('WARNING: ' + path + ' not completely cleaned out.')
+ else:
+ os.makedirs(path)
+
+
+#----------------------------------------------
+def lookFor(name, inlist, filename, printWarning=False):
+ rval = -1
+ try:
+ rval = inlist.index(name)
+ except:
+ if printWarning:
+ print(name, " not in header line, file=", filename)
+
+ return rval
+
+#----------------------------------------------
+def pointToInt(index, tokens, filename):
+ if index < 0 or index >= len(tokens):
+ print("ERROR index out of range ", index)
+ return -1
+ return int(tokens[index])
+
+#----------------------------------------------
+def pointToFloat(index, tokens, filename):
+ if index < 0 or index >= len(tokens):
+ print("ERROR index out of range ", index)
+ return -99.99
+ return float(tokens[index])
+
+#----------------------------------------------
+class StationHeader:
+ def __init__(self, headerLine, filename):
+ tokens = headerLine.split()
+ self._ok = True
+ self._idIndex = lookFor('BuoyID', tokens, filename, True)
+ self._yearIndex = lookFor('Year', tokens, filename, True)
+ self._hourIndex = lookFor('Hour', tokens, filename, True)
+ self._minuteIndex = lookFor('Min', tokens, filename, True)
+ self._doyIndex = lookFor('DOY', tokens, filename, True)
+ self._posdoyIndex = lookFor('POS_DOY', tokens, filename, True)
+ self._latIndex = lookFor('Lat', tokens, filename, True)
+ self._lonIndex = lookFor('Lon', tokens, filename, True)
+ self._bpIndex = lookFor('Lon', tokens, filename, False)
+ self._tsIndex = lookFor('Lon', tokens, filename, False)
+ self._taIndex = lookFor('Lon', tokens, filename, False)
+ self._ok = self._idIndex != -1 and self._yearIndex != -1 and self._hourIndex != -1 \
+ and self._minuteIndex != -1 and self._doyIndex != -1 and self._posdoyIndex != -1 \
+ and self._latIndex != -1 and self._lonIndex != -1
+ if not self._ok:
+ print("ERROR badly formed header line")
+
+#----------------------------------------------
+class Station:
+ def __init__(self, line, filename, stationHeader):
+ self._ok = True
+ tokens = line.split()
+ self._id = pointToInt(stationHeader._idIndex, tokens, filename)
+ if self._id < 0:
+ self._ok = False
+ self._hour = pointToInt(stationHeader._hourIndex, tokens, filename)
+ if self._hour < 0:
+ self._ok = False
+ self._minute = pointToInt(stationHeader._minuteIndex, tokens, filename)
+ if self._minute < 0:
+ self._ok = False
+ self._doy = pointToFloat(stationHeader._doyIndex, tokens, filename)
+ if self._doy < 0:
+ self._ok = False
+ self._posdoy = pointToFloat(stationHeader._posdoyIndex, tokens, filename)
+ if self._posdoy < 0:
+ self._ok = False
+ self._lat = pointToFloat(stationHeader._latIndex, tokens, filename)
+ if self._lat == -99.99:
+ self._ok = False
+ self._lon = pointToFloat(stationHeader._lonIndex, tokens, filename)
+ if self._lon == -99.99:
+ self._ok = False
+ if stationHeader._bpIndex >= 0:
+ self._pressure = pointToFloat(stationHeader._bpIndex, tokens, filename)
+ else:
+ self._pressure = -99.99
+ if stationHeader._tsIndex >= 0:
+ self._tempsurface = pointToFloat(stationHeader._tsIndex, tokens, filename)
+ else:
+ self._tempsurface = -99.99
+ if stationHeader._taIndex >= 0:
+ self._tempair = pointToFloat(stationHeader._taIndex, tokens, filename)
+ else:
+ self._tempair = -99.99
+
+#----------------------------------------------
+class StationTimeSeries:
+ def __init__(self, stationHeader):
+ self._stationHeader = stationHeader
+ self._data = []
+ def add(self, line, filename):
+ s = Station(line, filename, self._stationHeader)
+ if s._ok:
+ self._data.append(s)
+ def print(self):
+ print("Nothing")
+
+#----------------------------------------------
+def doCmd(cmd, debug=False):
+ #print(cmd)
+ my_env = os.environ.copy()
+ args = shlex.split(cmd)
+ proc = Popen(args, stdout=PIPE, stderr=PIPE, env=my_env)
+ out, err = proc.communicate()
+ exitcode = proc.returncode
+ if exitcode == 0:
+ return str(out)
+ else:
+ if debug:
+ print("Command failed ", cmd)
+ return ""
+
+#----------------------------------------------
+def nextStation(data_all, index_all):
+
+ index_all = data_all.find('.dat', index_all)
+ data = ""
+ if index_all == -1:
+ return -1, data
+
+ #is this the weird (bad) .dat.dat situtation?
+ teststr = data_all[index_all:index_all+8]
+ if teststr == ".dat.dat":
+ indexend = data_all.find('.dat.dat<', index_all+1)
+ if indexend == -1:
+ print("Unexpected lack of .dat.dat<")
+ return -1, data
+ data = data_all[index_all+10:indexend+8]
+ else:
+ indexend = data_all.find('.dat<', index_all+1)
+ if indexend == -1:
+ print("UNexpected lack of .dat<")
+ return -1, data
+ data = data_all[index_all+6:indexend+4]
+ return indexend+10, data
+
+#----------------------------------------------
+def getStation(sfile):
+ cmd = "wget https://iabp.apl.uw.edu/WebData/" + sfile
+ print(cmd)
+ doCmd(cmd, True)
+
+ # parse contents (not used for anything just yet)
+ with open(sfile, 'r') as file:
+ data_all = file.read()
+ file.close()
+ lines = data_all.splitlines()
+
+ # first line is a header, remaining lines are a time series
+ sh = StationHeader(lines[0], sfile)
+ if sh._ok:
+ lines = lines[1:]
+ st = StationTimeSeries(sh)
+ for l in lines:
+ st.add(l, sfile)
+
+
+#----------------------------------------------
+def run(output_path):
+
+ cwd = os.getcwd()
+
+ if (output_path[0:2] != "./" and output_path[0] != '/'):
+ outpath = "./" + output_path
+ else:
+ outpath = output_path
+ makeOrScrub(outpath, True)
+ os.chdir(outpath)
+
+ cmd = "wget https://iabp.apl.uw.edu/WebData"
+ print(cmd)
+ s = doCmd(cmd, True)
+ if not s:
+ status = False
+
+ stationfiles = []
+ with open("WebData", 'r') as file:
+ data_all = file.read().replace('\n', '')
+ file.close()
+ index_all = 0
+ while index_all < len(data_all):
+ index_all, data = nextStation(data_all, index_all)
+ if (index_all == -1):
+ break;
+ stationfiles.append(data)
+
+ print("Parsed out ", len(stationfiles), " individual station files")
+
+ # pull down all the station files
+ for i in range(len(stationfiles)):
+ getStation(stationfiles[i])
+
+ print("created ", len(stationfiles), " station files in ", outpath)
+ os.chdir(cwd)
+
+#----------------------------------------------
+def create_parser_options(parser):
+ parser.add_option("-o", "--output_path", dest="output_path",
+ default="./iabp_files", help=" create an output path or clear out what is there and put output files to that path (default: ./iabp_files)")
+ #parser.add_option("-H", "--Help", dest="options", action="store_true", default=False, help = " show usage information (optional, default = False)")
+ return parser.parse_args()
+
+#----------------------------------------------
+if __name__ == "__main__":
+
+ usage_str = "%prog [options]"
+ parser = OptionParser(usage = usage_str)
+ options, args = create_parser_options(parser)
+ run(options.output_path)
+ exit(0)
diff --git a/data/colortables/NCL_colortables/rgb2ctable.py b/scripts/python/utility/rgb2ctable.py
old mode 100644
new mode 100755
similarity index 100%
rename from data/colortables/NCL_colortables/rgb2ctable.py
rename to scripts/python/utility/rgb2ctable.py
diff --git a/src/basic/vx_config/builtin.cc b/src/basic/vx_config/builtin.cc
index ed54d132b0..966db34858 100644
--- a/src/basic/vx_config/builtin.cc
+++ b/src/basic/vx_config/builtin.cc
@@ -75,54 +75,54 @@ static double my_C_to_F (double);
const BuiltinInfo binfo[] = {
- { "sin", 1, builtin_sin, nullptr, nullptr, sin, nullptr },
- { "cos", 1, builtin_cos, nullptr, nullptr, cos, nullptr },
- { "tan", 1, builtin_tan, nullptr, nullptr, tan, nullptr },
+ { "sin", 1, Builtin::sin, nullptr, nullptr, sin, nullptr },
+ { "cos", 1, Builtin::cos, nullptr, nullptr, cos, nullptr },
+ { "tan", 1, Builtin::tan, nullptr, nullptr, tan, nullptr },
- { "sind", 1, builtin_sind, nullptr, nullptr, sin_deg, nullptr },
- { "cosd", 1, builtin_cosd, nullptr, nullptr, cos_deg, nullptr },
- { "tand", 1, builtin_tand, nullptr, nullptr, tan_deg, nullptr },
+ { "sind", 1, Builtin::sind, nullptr, nullptr, sin_deg, nullptr },
+ { "cosd", 1, Builtin::cosd, nullptr, nullptr, cos_deg, nullptr },
+ { "tand", 1, Builtin::tand, nullptr, nullptr, tan_deg, nullptr },
- { "asin", 1, builtin_asin, nullptr, nullptr, asin, nullptr },
- { "acos", 1, builtin_acos, nullptr, nullptr, acos, nullptr },
- { "atan", 1, builtin_atan, nullptr, nullptr, atan, nullptr },
+ { "asin", 1, Builtin::asin, nullptr, nullptr, asin, nullptr },
+ { "acos", 1, Builtin::acos, nullptr, nullptr, acos, nullptr },
+ { "atan", 1, Builtin::atan, nullptr, nullptr, atan, nullptr },
- { "asind", 1, builtin_sind, nullptr, nullptr, arc_sin_deg, nullptr },
- { "acosd", 1, builtin_cosd, nullptr, nullptr, arc_cos_deg, nullptr },
- { "atand", 1, builtin_tand, nullptr, nullptr, arc_tan_deg, nullptr },
+ { "asind", 1, Builtin::sind, nullptr, nullptr, arc_sin_deg, nullptr },
+ { "acosd", 1, Builtin::cosd, nullptr, nullptr, arc_cos_deg, nullptr },
+ { "atand", 1, Builtin::tand, nullptr, nullptr, arc_tan_deg, nullptr },
- { "atan2", 2, builtin_atan2, nullptr, nullptr, nullptr, atan2 },
- { "atan2d", 2, builtin_atan2d, nullptr, nullptr, nullptr, atan2_deg },
+ { "atan2", 2, Builtin::atan2, nullptr, nullptr, nullptr, atan2 },
+ { "atan2d", 2, Builtin::atan2d, nullptr, nullptr, nullptr, atan2_deg },
- { "arg", 2, builtin_arg, nullptr, nullptr, nullptr, my_arg },
- { "argd", 2, builtin_argd, nullptr, nullptr, nullptr, my_arg_deg },
+ { "arg", 2, Builtin::arg, nullptr, nullptr, nullptr, my_arg },
+ { "argd", 2, Builtin::argd, nullptr, nullptr, nullptr, my_arg_deg },
- { "log", 1, builtin_log, nullptr, nullptr, log, nullptr },
- { "exp", 1, builtin_exp, nullptr, nullptr, exp, nullptr },
+ { "log", 1, Builtin::log, nullptr, nullptr, log, nullptr },
+ { "exp", 1, Builtin::exp, nullptr, nullptr, exp, nullptr },
- { "log10", 1, builtin_log10, nullptr, nullptr, log10, nullptr },
- { "exp10", 1, builtin_exp10, nullptr, nullptr, my_exp10, nullptr },
+ { "log10", 1, Builtin::log10, nullptr, nullptr, log10, nullptr },
+ { "exp10", 1, Builtin::exp10, nullptr, nullptr, my_exp10, nullptr },
- { "sqrt", 1, builtin_sqrt, nullptr, nullptr, sqrt, nullptr },
+ { "sqrt", 1, Builtin::sqrt, nullptr, nullptr, sqrt, nullptr },
- { "abs", 1, builtin_abs, abs, nullptr, fabs, nullptr },
+ { "abs", 1, Builtin::abs, abs, nullptr, fabs, nullptr },
- { "min", 2, builtin_min, nullptr, my_imin, nullptr, my_dmin },
- { "max", 2, builtin_max, nullptr, my_imax, nullptr, my_dmax },
+ { "min", 2, Builtin::min, nullptr, my_imin, nullptr, my_dmin },
+ { "max", 2, Builtin::max, nullptr, my_imax, nullptr, my_dmax },
- { "mod", 2, builtin_mod, nullptr, my_imod, nullptr, my_dmod },
+ { "mod", 2, Builtin::mod, nullptr, my_imod, nullptr, my_dmod },
- { "floor", 1, builtin_floor, nullptr, nullptr, floor, nullptr },
- { "ceil", 1, builtin_ceil, nullptr, nullptr, ceil, nullptr },
+ { "floor", 1, Builtin::floor, nullptr, nullptr, floor, nullptr },
+ { "ceil", 1, Builtin::ceil, nullptr, nullptr, ceil, nullptr },
- { "step", 1, builtin_step, my_istep, nullptr, my_dstep, nullptr },
+ { "step", 1, Builtin::step, my_istep, nullptr, my_dstep, nullptr },
// Functions defined in ConfigConstants
- // { "F_to_C", 1, builtin_F_to_C, nullptr, nullptr, my_F_to_C, nullptr },
- // { "C_to_F", 1, builtin_C_to_F, nullptr, nullptr, my_C_to_F, nullptr },
+ // { "F_to_C", 1, Builtin::F_to_C, nullptr, nullptr, my_F_to_C, nullptr },
+ // { "C_to_F", 1, Builtin::C_to_F, nullptr, nullptr, my_C_to_F, nullptr },
- { "nint", 1, builtin_nint, nullptr, nullptr, nullptr, nullptr },
- { "sign", 1, builtin_sign, nullptr, nullptr, nullptr, nullptr },
+ { "nint", 1, Builtin::nint, nullptr, nullptr, nullptr, nullptr },
+ { "sign", 1, Builtin::sign, nullptr, nullptr, nullptr, nullptr },
//
diff --git a/src/basic/vx_config/builtin.h b/src/basic/vx_config/builtin.h
index d729e8a2a6..369ede5d09 100644
--- a/src/basic/vx_config/builtin.h
+++ b/src/basic/vx_config/builtin.h
@@ -30,69 +30,69 @@ static const int max_builtin_args = 2;
////////////////////////////////////////////////////////////////////////
-enum Builtin {
+enum class Builtin {
//
// built-in functions of one variable
//
- builtin_sin,
- builtin_cos,
- builtin_tan,
+ sin,
+ cos,
+ tan,
- builtin_sind,
- builtin_cosd,
- builtin_tand,
+ sind,
+ cosd,
+ tand,
- builtin_asin,
- builtin_acos,
- builtin_atan,
+ asin,
+ acos,
+ atan,
- builtin_asind,
- builtin_acosd,
- builtin_atand,
+ asind,
+ acosd,
+ atand,
- builtin_log,
- builtin_exp,
+ log,
+ exp,
- builtin_log10,
- builtin_exp10,
+ log10,
+ exp10,
- builtin_sqrt,
- builtin_abs,
- builtin_floor,
- builtin_ceil,
- builtin_nint,
- builtin_sign,
+ sqrt,
+ abs,
+ floor,
+ ceil,
+ nint,
+ sign,
- builtin_step,
+ step,
// Functions defined in ConfigConstants
- // builtin_F_to_C,
- // builtin_C_to_F,
+ // F_to_C,
+ // C_to_F,
//
// built-in functions of two variables
//
- builtin_atan2,
- builtin_atan2d,
+ atan2,
+ atan2d,
- builtin_arg,
- builtin_argd,
+ arg,
+ argd,
- builtin_min,
- builtin_max,
+ min,
+ max,
- builtin_mod,
+ mod,
//
// built-in functions of three variables
//
- // builtin_ifte
+ // ifte
//
// flag value
diff --git a/src/basic/vx_config/calculator.cc b/src/basic/vx_config/calculator.cc
index 9b87fbbb74..1dbc427f4e 100644
--- a/src/basic/vx_config/calculator.cc
+++ b/src/basic/vx_config/calculator.cc
@@ -391,9 +391,9 @@ const BuiltinInfo & info = binfo[which];
// nint and sign are treated differently
//
-if ( info.id == builtin_nint ) { do_nint(); return; }
+if ( info.id == Builtin::nint ) { do_nint(); return; }
-if ( info.id == builtin_sign ) { do_sign(); return; }
+if ( info.id == Builtin::sign ) { do_sign(); return; }
//
//
diff --git a/src/basic/vx_config/config_constants.h b/src/basic/vx_config/config_constants.h
index 56908edd31..deb9a425fe 100644
--- a/src/basic/vx_config/config_constants.h
+++ b/src/basic/vx_config/config_constants.h
@@ -25,10 +25,10 @@
// Enumeration for output_flag configuration parameter
//
-enum STATOutputType {
- STATOutputType_None, // Do not output this line type
- STATOutputType_Stat, // Write output to the .stat file
- STATOutputType_Both // Write output to .stat and .txt files
+enum class STATOutputType {
+ None, // Do not output this line type
+ Stat, // Write output to the .stat file
+ Both // Write output to .stat and .txt files
};
////////////////////////////////////////////////////////////////////////
@@ -37,11 +37,11 @@ enum STATOutputType {
// Enumeration for field type configuration parameters
//
-enum FieldType {
- FieldType_None, // Default
- FieldType_Fcst, // Apply to forecast field
- FieldType_Obs, // Apply to observation field
- FieldType_Both // Apply to both forecast and observation field
+enum class FieldType {
+ None, // Default
+ Fcst, // Apply to forecast field
+ Obs, // Apply to observation field
+ Both // Apply to both forecast and observation field
};
////////////////////////////////////////////////////////////////////////
@@ -50,11 +50,11 @@ enum FieldType {
// Enumeration for set logic
//
-enum SetLogic {
- SetLogic_None, // Default
- SetLogic_Union, // Union
- SetLogic_Intersection, // Intersection
- SetLogic_SymDiff // Symmetric Difference
+enum class SetLogic {
+ None, // Default
+ Union, // Union
+ Intersection, // Intersection
+ SymDiff // Symmetric Difference
};
////////////////////////////////////////////////////////////////////////
@@ -77,11 +77,11 @@ static const char setlogic_symbol_symdiff[] = "*";
// Enumeration for track type configuration parameters
//
-enum TrackType {
- TrackType_None, // Default
- TrackType_ADeck, // Apply to ADeck tracks
- TrackType_BDeck, // Apply to BDeck tracks
- TrackType_Both // Apply to both ADeck and BDeck tracks
+enum class TrackType {
+ None, // Default
+ ADeck, // Apply to ADeck tracks
+ BDeck, // Apply to BDeck tracks
+ Both // Apply to both ADeck and BDeck tracks
};
////////////////////////////////////////////////////////////////////////
@@ -90,12 +90,12 @@ enum TrackType {
// Enumeration for tropical cyclone diagnostic types
//
-enum DiagType {
- DiagType_None, // Default
- DiagType_CIRA_RT, // Realtime CIRA Tropical Cyclone Diagnostics
- DiagType_CIRA_Dev, // Developmental CIRA Tropical Cyclone Diagnostics
- DiagType_SHIPS_RT, // Realtime SHIPS Large Scale Diagnostics
- DiagType_SHIPS_Dev // Developmental SHIPS Large Scale Diagnostics
+enum class DiagType {
+ None, // Default
+ CIRA_RT, // Realtime CIRA Tropical Cyclone Diagnostics
+ CIRA_Dev, // Developmental CIRA Tropical Cyclone Diagnostics
+ SHIPS_RT, // Realtime SHIPS Large Scale Diagnostics
+ SHIPS_Dev // Developmental SHIPS Large Scale Diagnostics
};
////////////////////////////////////////////////////////////////////////
@@ -117,10 +117,10 @@ static const char ships_diag_dev_str[] = "SHIPS_DIAG_DEV";
// Enumeration for 12-hour interpolation logic
//
-enum Interp12Type {
- Interp12Type_None, // Do not apply 12-hour interpolation logic
- Interp12Type_Fill, // Fill in missing 'I' tracks with '2' tracks
- Interp12Type_Replace // Replace all 'I' tracks with '2' tracks
+enum class Interp12Type {
+ None, // Do not apply 12-hour interpolation logic
+ Fill, // Fill in missing 'I' tracks with '2' tracks
+ Replace // Replace all 'I' tracks with '2' tracks
};
////////////////////////////////////////////////////////////////////////
@@ -129,48 +129,48 @@ enum Interp12Type {
// Enumeration for all the possible STAT line types
//
-enum STATLineType {
-
- stat_sl1l2,
- stat_sal1l2,
- stat_vl1l2,
- stat_val1l2,
-
- stat_vcnt,
-
- stat_fho,
- stat_ctc,
- stat_cts,
- stat_mctc,
- stat_mcts,
- stat_cnt,
- stat_pct,
- stat_pstd,
- stat_pjc,
- stat_prc,
- stat_mpr,
- stat_seeps,
- stat_seeps_mpr,
- stat_nbrctc,
- stat_nbrcts,
- stat_nbrcnt,
- stat_isc,
- stat_wdir,
- stat_ecnt,
- stat_rps,
- stat_rhist,
- stat_phist,
- stat_orank,
- stat_ssvar,
- stat_relp,
- stat_eclv,
- stat_grad,
- stat_dmap,
- stat_genmpr,
- stat_ssidx,
- stat_header,
-
- no_stat_line_type
+enum class STATLineType {
+
+ sl1l2,
+ sal1l2,
+ vl1l2,
+ val1l2,
+
+ vcnt,
+
+ fho,
+ ctc,
+ cts,
+ mctc,
+ mcts,
+ cnt,
+ pct,
+ pstd,
+ pjc,
+ prc,
+ mpr,
+ seeps,
+ seeps_mpr,
+ nbrctc,
+ nbrcts,
+ nbrcnt,
+ isc,
+ wdir,
+ ecnt,
+ rps,
+ rhist,
+ phist,
+ orank,
+ ssvar,
+ relp,
+ eclv,
+ grad,
+ dmap,
+ genmpr,
+ ssidx,
+ header,
+
+ none
};
@@ -256,12 +256,14 @@ struct TimeSummaryInfo {
// Enumeration for bootstrapping interval configuration parameter
//
-enum BootIntervalType {
- BootIntervalType_None, // Default
- BootIntervalType_BCA, // Bias-Corrected and adjusted method
- BootIntervalType_Percentile // Percentile method
+enum class BootIntervalType {
+ None, // Default
+ BCA, // Bias-Corrected and adjusted method
+ PCTile // Percentile method
};
+////////////////////////////////////////////////////////////////////////
+
//
// Struct to store bootstrapping information
//
@@ -423,9 +425,9 @@ struct MaskLatLon {
// Enumeration for duplicate_flag configuration parameter
//
-enum DuplicateType {
- DuplicateType_None, // Apply no logic for duplicate point obs
- DuplicateType_Unique // Filter out duplicate observation values
+enum class DuplicateType {
+ None, // Apply no logic for duplicate point obs
+ Unique // Filter out duplicate observation values
};
////////////////////////////////////////////////////////////////////////
@@ -434,15 +436,15 @@ enum DuplicateType {
// Enumeration for obs_summary configuration parameter
//
-enum ObsSummary {
- ObsSummary_None, // Keep all observations, no statistics
- ObsSummary_Nearest, // Keep only the observation closest in time
- ObsSummary_Min, // Keep only smallest value
- ObsSummary_Max, // Keep only largest value
- ObsSummary_UW_Mean, // Calculate un-weighted mean
- ObsSummary_DW_Mean, // Calculate time weighted mean
- ObsSummary_Median, // Calculate median
- ObsSummary_Perc // Calculate precentile
+enum class ObsSummary {
+ None, // Keep all observations, no statistics
+ Nearest, // Keep only the observation closest in time
+ Min, // Keep only smallest value
+ Max, // Keep only largest value
+ UW_Mean, // Calculate un-weighted mean
+ DW_Mean, // Calculate time weighted mean
+ Median, // Calculate median
+ Perc // Calculate precentile
};
////////////////////////////////////////////////////////////////////////
@@ -451,10 +453,10 @@ enum ObsSummary {
// Enumeration for grid_weight_flag configuration parameter
//
-enum GridWeightType {
- GridWeightType_None, // Apply no grid box weighting
- GridWeightType_Cos_Lat, // Apply cosine latitude weighting
- GridWeightType_Area // Apply true grid box area weighting
+enum class GridWeightType {
+ None, // Apply no grid box weighting
+ Cos_Lat, // Apply cosine latitude weighting
+ Area // Apply true grid box area weighting
};
////////////////////////////////////////////////////////////////////////
@@ -463,11 +465,11 @@ enum GridWeightType {
// Enumeration for grid_decomp_flag configuration parameter
//
-enum GridDecompType {
- GridDecompType_None, // Default
- GridDecompType_Auto, // Automatic tiling
- GridDecompType_Tile, // User-specified tile definitions
- GridDecompType_Pad // Pad out to next largest tile
+enum class GridDecompType {
+ None, // Default
+ Auto, // Automatic tiling
+ Tile, // User-specified tile definitions
+ Pad // Pad out to next largest tile
};
////////////////////////////////////////////////////////////////////////
@@ -476,14 +478,14 @@ enum GridDecompType {
// Enumeration for wavelet.type configuration parameter
//
-enum WaveletType {
- WaveletType_None, // Default
- WaveletType_Haar, // Haar wavelet
- WaveletType_Haar_Cntr, // Centered Haar wavelet
- WaveletType_Daub, // Daubechies wavelet
- WaveletType_Daub_Cntr, // Centered Daubechies wavelet
- WaveletType_BSpline, // BSpline wavelet
- WaveletType_BSpline_Cntr // Centered BSpline wavelet
+enum class WaveletType {
+ None, // Default
+ Haar, // Haar wavelet
+ Haar_Cntr, // Centered Haar wavelet
+ Daub, // Daubechies wavelet
+ Daub_Cntr, // Centered Daubechies wavelet
+ BSpline, // BSpline wavelet
+ BSpline_Cntr // Centered BSpline wavelet
};
////////////////////////////////////////////////////////////////////////
@@ -492,11 +494,11 @@ enum WaveletType {
// Enumeration for MODE merging options
//
-enum MergeType {
- MergeType_None, // No additional merging
- MergeType_Both, // Double-threshold and fuzzy engine
- MergeType_Thresh, // Double-threshold only
- MergeType_Engine // Fuzzy engine only
+enum class MergeType {
+ None, // No additional merging
+ Both, // Double-threshold and fuzzy engine
+ Thresh, // Double-threshold only
+ Engine // Fuzzy engine only
};
////////////////////////////////////////////////////////////////////////
@@ -505,11 +507,11 @@ enum MergeType {
// Enumeration for MODE matching options
//
-enum MatchType {
- MatchType_None, // No matching
- MatchType_MergeBoth, // Match with merging in both fcst and obs
- MatchType_MergeFcst, // Match with merging in fcst only
- MatchType_NoMerge // Match with no additional merging
+enum class MatchType {
+ None, // No matching
+ MergeBoth, // Match with merging in both fcst and obs
+ MergeFcst, // Match with merging in fcst only
+ NoMerge // Match with no additional merging
};
////////////////////////////////////////////////////////////////////////
@@ -1213,7 +1215,6 @@ static const char conf_key_nc_pairs_grid[] = "nc_pairs_grid";
static const char conf_key_n_range[] = "n_range";
static const char conf_key_n_azimuth[] = "n_azimuth";
-static const char conf_key_max_range[] = "max_range_km";
static const char conf_key_delta_range[] = "delta_range_km";
static const char conf_key_rmw_scale[] = "rmw_scale";
static const char conf_key_compute_tangential_and_radial_winds[] = "compute_tangential_and_radial_winds";
diff --git a/src/basic/vx_config/config_util.cc b/src/basic/vx_config/config_util.cc
index a39bff6c39..344f997bea 100644
--- a/src/basic/vx_config/config_util.cc
+++ b/src/basic/vx_config/config_util.cc
@@ -13,6 +13,7 @@
#include
#include "config_util.h"
+#include "enum_as_int.hpp"
#include "vx_math.h"
#include "vx_util.h"
@@ -121,13 +122,13 @@ void GaussianInfo::validate() {
void RegridInfo::clear() {
enable = false;
- field = FieldType_None;
+ field = FieldType::None;
vld_thresh = bad_data_double;
name.clear();
- method = InterpMthd_None;
+ method = InterpMthd::None;
width = bad_data_int;
gaussian.clear();
- shape = GridTemplateFactory::GridTemplate_None;
+ shape = GridTemplateFactory::GridTemplates::None;
convert_fx.clear();
censor_thresh.clear();
censor_val.clear();
@@ -144,10 +145,10 @@ RegridInfo::RegridInfo() {
void RegridInfo::validate() {
// Check for unsupported regridding options
- if(method == InterpMthd_Best ||
- method == InterpMthd_Geog_Match ||
- method == InterpMthd_Gaussian ||
- method == InterpMthd_HiRA) {
+ if(method == InterpMthd::Best ||
+ method == InterpMthd::Geog_Match ||
+ method == InterpMthd::Gaussian ||
+ method == InterpMthd::HiRA) {
mlog << Error << "\nRegridInfo::validate() -> "
<< "\"" << interpmthd_to_string(method)
<< "\" not valid for regridding, only interpolating.\n\n";
@@ -156,31 +157,31 @@ void RegridInfo::validate() {
// Check the nearest neighbor special case
if(width == 1 &&
- method != InterpMthd_None &&
- method != InterpMthd_Nearest &&
- method != InterpMthd_Force &&
- method != InterpMthd_Upper_Left &&
- method != InterpMthd_Upper_Right &&
- method != InterpMthd_Lower_Right &&
- method != InterpMthd_Lower_Left &&
- method != InterpMthd_AW_Mean &&
- method != InterpMthd_MaxGauss) {
+ method != InterpMthd::None &&
+ method != InterpMthd::Nearest &&
+ method != InterpMthd::Force &&
+ method != InterpMthd::Upper_Left &&
+ method != InterpMthd::Upper_Right &&
+ method != InterpMthd::Lower_Right &&
+ method != InterpMthd::Lower_Left &&
+ method != InterpMthd::AW_Mean &&
+ method != InterpMthd::MaxGauss) {
mlog << Warning << "\nRegridInfo::validate() -> "
<< "Resetting the regridding method from \""
<< interpmthd_to_string(method) << "\" to \""
<< interpmthd_nearest_str
<< "\" since the regridding width is 1.\n\n";
- method = InterpMthd_Nearest;
+ method = InterpMthd::Nearest;
}
// Check for some methods, that width is 1
- if((method == InterpMthd_Nearest ||
- method == InterpMthd_Force ||
- method == InterpMthd_Upper_Left ||
- method == InterpMthd_Upper_Right ||
- method == InterpMthd_Lower_Right ||
- method == InterpMthd_Lower_Left ||
- method == InterpMthd_AW_Mean) &&
+ if((method == InterpMthd::Nearest ||
+ method == InterpMthd::Force ||
+ method == InterpMthd::Upper_Left ||
+ method == InterpMthd::Upper_Right ||
+ method == InterpMthd::Lower_Right ||
+ method == InterpMthd::Lower_Left ||
+ method == InterpMthd::AW_Mean) &&
width != 1) {
mlog << Warning << "\nRegridInfo::validate() -> "
<< "Resetting regridding width from "
@@ -190,8 +191,8 @@ void RegridInfo::validate() {
}
// Check the bilinear and budget special cases
- if((method == InterpMthd_Bilin ||
- method == InterpMthd_Budget) &&
+ if((method == InterpMthd::Bilin ||
+ method == InterpMthd::Budget) &&
width != 2) {
mlog << Warning << "\nRegridInfo::validate() -> "
<< "Resetting the regridding width from "
@@ -201,7 +202,7 @@ void RegridInfo::validate() {
}
// Check the Gaussian filter
- if(method == InterpMthd_MaxGauss && gaussian.radius < gaussian.dx) {
+ if(method == InterpMthd::MaxGauss && gaussian.radius < gaussian.dx) {
mlog << Error << "\nRegridInfo::validate() -> "
<< "The radius of influence (" << gaussian.radius
<< ") is less than the delta distance (" << gaussian.dx
@@ -226,20 +227,20 @@ void RegridInfo::validate() {
void RegridInfo::validate_point() {
// Check for unsupported regridding options
- if(method != InterpMthd_Max &&
- method != InterpMthd_Min &&
- method != InterpMthd_Median &&
- method != InterpMthd_UW_Mean) {
+ if(method != InterpMthd::Max &&
+ method != InterpMthd::Min &&
+ method != InterpMthd::Median &&
+ method != InterpMthd::UW_Mean) {
mlog << Warning << "\nRegridInfo::validate_point() -> "
<< "Resetting the regridding method from \""
<< interpmthd_to_string(method) << "\" to \""
<< interpmthd_uw_mean_str << ".\n"
<< "\tAvailable methods: "
- << interpmthd_to_string(InterpMthd_UW_Mean) << ", "
- << interpmthd_to_string(InterpMthd_Max) << ", "
- << interpmthd_to_string(InterpMthd_Min) << ", "
- << interpmthd_to_string(InterpMthd_Median) << ".\n\n";
- method = InterpMthd_UW_Mean;
+ << interpmthd_to_string(InterpMthd::UW_Mean) << ", "
+ << interpmthd_to_string(InterpMthd::Max) << ", "
+ << interpmthd_to_string(InterpMthd::Min) << ", "
+ << interpmthd_to_string(InterpMthd::Median) << ".\n\n";
+ method = InterpMthd::UW_Mean;
}
}
@@ -264,6 +265,7 @@ RegridInfo &RegridInfo::operator=(const RegridInfo &a) noexcept {
return *this;
}
+
///////////////////////////////////////////////////////////////////////////////
ConcatString parse_conf_version(Dictionary *dict) {
@@ -375,7 +377,7 @@ GrdFileType parse_conf_file_type(Dictionary *dict) {
map parse_conf_output_flag(Dictionary *dict,
const STATLineType *line_type, int n_lty) {
map output_map;
- STATOutputType t = STATOutputType_None;
+ STATOutputType t = STATOutputType::None;
ConcatString cs;
int v;
@@ -397,9 +399,9 @@ map parse_conf_output_flag(Dictionary *dict,
v = dict->lookup_int(cs.c_str());
// Convert integer to enumerated STATOutputType
- if(v == conf_const.lookup_int(conf_val_none)) t = STATOutputType_None;
- else if(v == conf_const.lookup_int(conf_val_stat)) t = STATOutputType_Stat;
- else if(v == conf_const.lookup_int(conf_val_both)) t = STATOutputType_Both;
+ if(v == conf_const.lookup_int(conf_val_none)) t = STATOutputType::None;
+ else if(v == conf_const.lookup_int(conf_val_stat)) t = STATOutputType::Stat;
+ else if(v == conf_const.lookup_int(conf_val_both)) t = STATOutputType::Both;
else {
mlog << Error << "\nparse_conf_output_flag() -> "
<< "Unexpected config file value of " << v << " for \""
@@ -1259,7 +1261,7 @@ BootInfo & BootInfo::operator=(const BootInfo &a) noexcept {
///////////////////////////////////////////////////////////////////////////////
void BootInfo::clear() {
- interval = BootIntervalType_None;
+ interval = BootIntervalType::None;
rep_prop = bad_data_double;
n_rep = 0;
rng.clear();
@@ -1283,8 +1285,12 @@ BootInfo parse_conf_boot(Dictionary *dict) {
v = dict->lookup_int(conf_key_boot_interval);
// Convert integer to enumerated BootIntervalType
- if(v == conf_const.lookup_int(conf_val_bca)) info.interval = BootIntervalType_BCA;
- else if(v == conf_const.lookup_int(conf_val_pctile)) info.interval = BootIntervalType_Percentile;
+ if(v == conf_const.lookup_int(conf_val_bca)) {
+ info.interval = BootIntervalType::BCA;
+ }
+ else if(v == conf_const.lookup_int(conf_val_pctile)) {
+ info.interval = BootIntervalType::PCTile;
+ }
else {
mlog << Error << "\nparse_conf_boot() -> "
<< "Unexpected config file value of " << v << " for \""
@@ -1360,8 +1366,8 @@ RegridInfo parse_conf_regrid(Dictionary *dict, bool error_out) {
// If integer lookup successful, convert to FieldType.
if(regrid_dict->last_lookup_status()) {
info.field = int_to_fieldtype(v);
- info.enable = (info.field == FieldType_Fcst ||
- info.field == FieldType_Obs);
+ info.enable = (info.field == FieldType::Fcst ||
+ info.field == FieldType::Obs);
}
// If integer lookup unsuccessful, parse vx_grid as a string.
// Do not error out since to_grid isn't specified for climo.regrid.
@@ -1385,7 +1391,7 @@ RegridInfo parse_conf_regrid(Dictionary *dict, bool error_out) {
}
else {
// If not specified, use the default square shape
- info.shape = GridTemplateFactory::GridTemplate_Square;
+ info.shape = GridTemplateFactory::GridTemplates::Square;
}
// Conf: gaussian dx and radius
@@ -1395,7 +1401,7 @@ RegridInfo parse_conf_regrid(Dictionary *dict, bool error_out) {
info.gaussian.radius = (is_bad_data(conf_value) ? default_gaussian_radius : conf_value);
conf_value = regrid_dict->lookup_double(conf_key_trunc_factor, false);
info.gaussian.trunc_factor = (is_bad_data(conf_value) ? default_trunc_factor : conf_value);
- if (info.method == InterpMthd_Gaussian || info.method == InterpMthd_MaxGauss) info.gaussian.compute();
+ if (info.method == InterpMthd::Gaussian || info.method == InterpMthd::MaxGauss) info.gaussian.compute();
// MET#2437 Do not search the higher levels of config file context for convert,
// censor_thresh, and censor_val. They must be specified within the
@@ -1419,13 +1425,13 @@ RegridInfo parse_conf_regrid(Dictionary *dict, bool error_out) {
///////////////////////////////////////////////////////////////////////////////
void InterpInfo::clear() {
- field = FieldType_None;
+ field = FieldType::None;
vld_thresh = bad_data_double;
n_interp = 0;
method.clear();
width.clear();
gaussian.clear();
- shape = GridTemplateFactory::GridTemplate_None;
+ shape = GridTemplateFactory::GridTemplates::None;
}
///////////////////////////////////////////////////////////////////////////////
@@ -1438,15 +1444,15 @@ void InterpInfo::validate() {
// Check the nearest neighbor special case
if(width[i] == 1 &&
- methodi != InterpMthd_None &&
- methodi != InterpMthd_Nearest &&
- methodi != InterpMthd_Force &&
- methodi != InterpMthd_Upper_Left &&
- methodi != InterpMthd_Upper_Right &&
- methodi != InterpMthd_Lower_Right &&
- methodi != InterpMthd_Lower_Left &&
- methodi != InterpMthd_Gaussian &&
- methodi != InterpMthd_MaxGauss) {
+ methodi != InterpMthd::None &&
+ methodi != InterpMthd::Nearest &&
+ methodi != InterpMthd::Force &&
+ methodi != InterpMthd::Upper_Left &&
+ methodi != InterpMthd::Upper_Right &&
+ methodi != InterpMthd::Lower_Right &&
+ methodi != InterpMthd::Lower_Left &&
+ methodi != InterpMthd::Gaussian &&
+ methodi != InterpMthd::MaxGauss) {
mlog << Warning << "\nInterpInfo::validate() -> "
<< "Resetting interpolation method " << (int) i << " from \""
<< method[i] << "\" to \""
@@ -1456,11 +1462,11 @@ void InterpInfo::validate() {
}
// Check for some methods, that width is 1
- if((methodi == InterpMthd_Nearest ||
- methodi == InterpMthd_Upper_Left ||
- methodi == InterpMthd_Upper_Right ||
- methodi == InterpMthd_Lower_Right ||
- methodi == InterpMthd_Lower_Left) &&
+ if((methodi == InterpMthd::Nearest ||
+ methodi == InterpMthd::Upper_Left ||
+ methodi == InterpMthd::Upper_Right ||
+ methodi == InterpMthd::Lower_Right ||
+ methodi == InterpMthd::Lower_Left) &&
width[i] != 1) {
mlog << Warning << "\nInterpInfo::validate() -> "
<< "Resetting interpolation width " << (int) i << " from "
@@ -1470,8 +1476,8 @@ void InterpInfo::validate() {
}
// Check the bilinear and budget special cases
- if((methodi == InterpMthd_Bilin ||
- methodi == InterpMthd_Budget) &&
+ if((methodi == InterpMthd::Bilin ||
+ methodi == InterpMthd::Budget) &&
width[i] != 2) {
mlog << Warning << "\nInterpInfo::validate() -> "
<< "Resetting interpolation width " << (int) i << " from "
@@ -1481,8 +1487,8 @@ void InterpInfo::validate() {
}
// Check the Gaussian filter
- if(methodi == InterpMthd_Gaussian ||
- methodi == InterpMthd_MaxGauss) {
+ if(methodi == InterpMthd::Gaussian ||
+ methodi == InterpMthd::MaxGauss) {
if (gaussian.radius < gaussian.dx) {
mlog << Error << "\n"
<< "The radius of influence (" << gaussian.radius
@@ -1556,7 +1562,7 @@ InterpInfo parse_conf_interp(Dictionary *dict, const char *conf_key) {
// If found, interpret value. Otherwise, set to a default value.
if(interp_dict->last_lookup_status()) info.field = int_to_fieldtype(v);
- else info.field = FieldType_None;
+ else info.field = FieldType::None;
// Conf: vld_thresh
double thr = interp_dict->lookup_double(conf_key_vld_thresh, false);
@@ -1578,7 +1584,7 @@ InterpInfo parse_conf_interp(Dictionary *dict, const char *conf_key) {
}
else {
// If not specified, use the default square shape
- info.shape = GridTemplateFactory::GridTemplate_Square;
+ info.shape = GridTemplateFactory::GridTemplates::Square;
}
// Conf: gaussian dx and radius
@@ -1632,8 +1638,8 @@ InterpInfo parse_conf_interp(Dictionary *dict, const char *conf_key) {
method = int_to_interpmthd(mthd_na[j]);
// Check for unsupported interpolation options
- if(method == InterpMthd_Budget ||
- method == InterpMthd_Force) {
+ if(method == InterpMthd::Budget ||
+ method == InterpMthd::Force) {
mlog << Error << "\nparse_conf_interp() -> "
<< "\"" << interpmthd_to_string(method)
<< "\" not valid for interpolating, only regridding.\n\n";
@@ -1653,7 +1659,7 @@ InterpInfo parse_conf_interp(Dictionary *dict, const char *conf_key) {
} // end for k
- if(method == InterpMthd_Gaussian || method == InterpMthd_MaxGauss) {
+ if(method == InterpMthd::Gaussian || method == InterpMthd::MaxGauss) {
info.gaussian.compute();
}
} // end for j
@@ -1844,11 +1850,11 @@ ClimoCDFInfo parse_conf_climo_cdf(Dictionary *dict) {
void NbrhdInfo::clear() {
- field = FieldType_None;
+ field = FieldType::None;
vld_thresh = bad_data_double;
width.clear();
cov_ta.clear();
- shape = GridTemplateFactory::GridTemplate_None;
+ shape = GridTemplateFactory::GridTemplates::None;
}
///////////////////////////////////////////////////////////////////////////////
@@ -1885,7 +1891,7 @@ NbrhdInfo parse_conf_nbrhd(Dictionary *dict, const char *conf_key) {
// Conf: field - may be missing
// Default info.field to BOTH
- info.field = FieldType_Both;
+ info.field = FieldType::Both;
// Skip lookup for conf_key_nbrhd_prob
if(strncmp(conf_key, conf_key_nbrhd_prob, strlen(conf_key_nbrhd_prob)) != 0) {
@@ -1936,7 +1942,7 @@ NbrhdInfo parse_conf_nbrhd(Dictionary *dict, const char *conf_key) {
}
else {
// If not specified, use the default square shape
- info.shape = GridTemplateFactory::GridTemplate_Square;
+ info.shape = GridTemplateFactory::GridTemplates::Square;
}
// Conf: cov_thresh
@@ -1966,7 +1972,7 @@ void HiRAInfo::clear() {
vld_thresh = bad_data_double;
cov_ta.clear();
prob_cat_ta.clear();
- shape = GridTemplateFactory::GridTemplate_None;
+ shape = GridTemplateFactory::GridTemplates::None;
}
///////////////////////////////////////////////////////////////////////////////
@@ -2052,7 +2058,7 @@ HiRAInfo parse_conf_hira(Dictionary *dict) {
}
else {
// If not specified, use the default square shape
- info.shape = GridTemplateFactory::GridTemplate_Square;
+ info.shape = GridTemplateFactory::GridTemplates::Square;
}
// Conf: cov_thresh
@@ -2073,7 +2079,7 @@ HiRAInfo parse_conf_hira(Dictionary *dict) {
///////////////////////////////////////////////////////////////////////////////
GridWeightType parse_conf_grid_weight_flag(Dictionary *dict) {
- GridWeightType t = GridWeightType_None;
+ GridWeightType t = GridWeightType::None;
int v;
if(!dict) {
@@ -2086,9 +2092,9 @@ GridWeightType parse_conf_grid_weight_flag(Dictionary *dict) {
v = dict->lookup_int(conf_key_grid_weight_flag);
// Convert integer to enumerated GridWeightType
- if(v == conf_const.lookup_int(conf_val_none)) t = GridWeightType_None;
- else if(v == conf_const.lookup_int(conf_val_cos_lat)) t = GridWeightType_Cos_Lat;
- else if(v == conf_const.lookup_int(conf_val_area)) t = GridWeightType_Area;
+ if(v == conf_const.lookup_int(conf_val_none)) t = GridWeightType::None;
+ else if(v == conf_const.lookup_int(conf_val_cos_lat)) t = GridWeightType::Cos_Lat;
+ else if(v == conf_const.lookup_int(conf_val_area)) t = GridWeightType::Area;
else {
mlog << Error << "\nparse_conf_grid_weight_flag() -> "
<< "Unexpected config file value of " << v << " for \""
@@ -2102,7 +2108,7 @@ GridWeightType parse_conf_grid_weight_flag(Dictionary *dict) {
///////////////////////////////////////////////////////////////////////////////
DuplicateType parse_conf_duplicate_flag(Dictionary *dict) {
- DuplicateType t = DuplicateType_None;
+ DuplicateType t = DuplicateType::None;
int v;
if(!dict) {
@@ -2115,8 +2121,8 @@ DuplicateType parse_conf_duplicate_flag(Dictionary *dict) {
v = dict->lookup_int(conf_key_duplicate_flag);
// Convert integer to enumerated DuplicateType
- if(v == conf_const.lookup_int(conf_val_none)) t = DuplicateType_None;
- else if(v == conf_const.lookup_int(conf_val_unique)) t = DuplicateType_Unique;
+ if(v == conf_const.lookup_int(conf_val_none)) t = DuplicateType::None;
+ else if(v == conf_const.lookup_int(conf_val_unique)) t = DuplicateType::Unique;
else if(v == conf_const.lookup_int(conf_val_single)) {
mlog << Error << "\nparse_conf_duplicate_flag() -> "
<< "duplicate_flag = SINGLE has been deprecated\n"
@@ -2136,7 +2142,7 @@ DuplicateType parse_conf_duplicate_flag(Dictionary *dict) {
///////////////////////////////////////////////////////////////////////////////
ObsSummary parse_conf_obs_summary(Dictionary *dict) {
- ObsSummary t = ObsSummary_None;
+ ObsSummary t = ObsSummary::None;
int v;
if(!dict) {
@@ -2149,14 +2155,14 @@ ObsSummary parse_conf_obs_summary(Dictionary *dict) {
v = dict->lookup_int(conf_key_obs_summary);
// Convert integer to enumerated ObsSummary
- if(v == conf_const.lookup_int(conf_val_none)) t = ObsSummary_None;
- else if(v == conf_const.lookup_int(conf_val_nearest)) t = ObsSummary_Nearest;
- else if(v == conf_const.lookup_int(conf_val_min)) t = ObsSummary_Min;
- else if(v == conf_const.lookup_int(conf_val_max)) t = ObsSummary_Max;
- else if(v == conf_const.lookup_int(conf_val_uw_mean)) t = ObsSummary_UW_Mean;
- else if(v == conf_const.lookup_int(conf_val_dw_mean)) t = ObsSummary_DW_Mean;
- else if(v == conf_const.lookup_int(conf_val_median)) t = ObsSummary_Median;
- else if(v == conf_const.lookup_int(conf_val_perc)) t = ObsSummary_Perc;
+ if(v == conf_const.lookup_int(conf_val_none)) t = ObsSummary::None;
+ else if(v == conf_const.lookup_int(conf_val_nearest)) t = ObsSummary::Nearest;
+ else if(v == conf_const.lookup_int(conf_val_min)) t = ObsSummary::Min;
+ else if(v == conf_const.lookup_int(conf_val_max)) t = ObsSummary::Max;
+ else if(v == conf_const.lookup_int(conf_val_uw_mean)) t = ObsSummary::UW_Mean;
+ else if(v == conf_const.lookup_int(conf_val_dw_mean)) t = ObsSummary::DW_Mean;
+ else if(v == conf_const.lookup_int(conf_val_median)) t = ObsSummary::Median;
+ else if(v == conf_const.lookup_int(conf_val_perc)) t = ObsSummary::Perc;
else {
mlog << Error << "\nparse_conf_obs_summary() -> "
<< "Unexpected config file value of " << v << " for \""
@@ -2225,7 +2231,7 @@ ConcatString parse_conf_tmp_dir(Dictionary *dict) {
///////////////////////////////////////////////////////////////////////////////
GridDecompType parse_conf_grid_decomp_flag(Dictionary *dict) {
- GridDecompType t = GridDecompType_None;
+ GridDecompType t = GridDecompType::None;
int v;
if(!dict) {
@@ -2238,10 +2244,10 @@ GridDecompType parse_conf_grid_decomp_flag(Dictionary *dict) {
v = dict->lookup_int(conf_key_grid_decomp_flag);
// Convert integer to enumerated GridDecompType
- if(v == conf_const.lookup_int(conf_val_none)) t = GridDecompType_None;
- else if(v == conf_const.lookup_int(conf_val_auto)) t = GridDecompType_Auto;
- else if(v == conf_const.lookup_int(conf_val_tile)) t = GridDecompType_Tile;
- else if(v == conf_const.lookup_int(conf_val_pad)) t = GridDecompType_Pad;
+ if(v == conf_const.lookup_int(conf_val_none)) t = GridDecompType::None;
+ else if(v == conf_const.lookup_int(conf_val_auto)) t = GridDecompType::Auto;
+ else if(v == conf_const.lookup_int(conf_val_tile)) t = GridDecompType::Tile;
+ else if(v == conf_const.lookup_int(conf_val_pad)) t = GridDecompType::Pad;
else {
mlog << Error << "\nparse_conf_grid_decomp_flag() -> "
<< "Unexpected config file value of " << v << " for \""
@@ -2255,7 +2261,7 @@ GridDecompType parse_conf_grid_decomp_flag(Dictionary *dict) {
///////////////////////////////////////////////////////////////////////////////
WaveletType parse_conf_wavelet_type(Dictionary *dict) {
- WaveletType t = WaveletType_None;
+ WaveletType t = WaveletType::None;
int v;
if(!dict) {
@@ -2268,13 +2274,13 @@ WaveletType parse_conf_wavelet_type(Dictionary *dict) {
v = dict->lookup_int(conf_key_wavelet_type);
// Convert integer to enumerated WaveletType
- if(v == conf_const.lookup_int(conf_val_none)) t = WaveletType_None;
- else if(v == conf_const.lookup_int(conf_val_haar)) t = WaveletType_Haar;
- else if(v == conf_const.lookup_int(conf_val_haar_cntr)) t = WaveletType_Haar_Cntr;
- else if(v == conf_const.lookup_int(conf_val_daub)) t = WaveletType_Daub;
- else if(v == conf_const.lookup_int(conf_val_daub_cntr)) t = WaveletType_Daub_Cntr;
- else if(v == conf_const.lookup_int(conf_val_bspline)) t = WaveletType_BSpline;
- else if(v == conf_const.lookup_int(conf_val_bspline_cntr)) t = WaveletType_BSpline_Cntr;
+ if(v == conf_const.lookup_int(conf_val_none)) t = WaveletType::None;
+ else if(v == conf_const.lookup_int(conf_val_haar)) t = WaveletType::Haar;
+ else if(v == conf_const.lookup_int(conf_val_haar_cntr)) t = WaveletType::Haar_Cntr;
+ else if(v == conf_const.lookup_int(conf_val_daub)) t = WaveletType::Daub;
+ else if(v == conf_const.lookup_int(conf_val_daub_cntr)) t = WaveletType::Daub_Cntr;
+ else if(v == conf_const.lookup_int(conf_val_bspline)) t = WaveletType::BSpline;
+ else if(v == conf_const.lookup_int(conf_val_bspline_cntr)) t = WaveletType::BSpline_Cntr;
else {
mlog << Error << "\nparse_conf_wavelet_type() -> "
<< "Unexpected config file value of " << v << " for \""
@@ -2539,30 +2545,30 @@ void check_climo_n_vx(Dictionary *dict, const int n_vx) {
///////////////////////////////////////////////////////////////////////////////
InterpMthd int_to_interpmthd(int i) {
- InterpMthd m = InterpMthd_None;
-
- if(i == conf_const.lookup_int(interpmthd_none_str)) m = InterpMthd_None;
- else if(i == conf_const.lookup_int(interpmthd_min_str)) m = InterpMthd_Min;
- else if(i == conf_const.lookup_int(interpmthd_max_str)) m = InterpMthd_Max;
- else if(i == conf_const.lookup_int(interpmthd_median_str)) m = InterpMthd_Median;
- else if(i == conf_const.lookup_int(interpmthd_uw_mean_str)) m = InterpMthd_UW_Mean;
- else if(i == conf_const.lookup_int(interpmthd_dw_mean_str)) m = InterpMthd_DW_Mean;
- else if(i == conf_const.lookup_int(interpmthd_aw_mean_str)) m = InterpMthd_AW_Mean;
- else if(i == conf_const.lookup_int(interpmthd_ls_fit_str)) m = InterpMthd_LS_Fit;
- else if(i == conf_const.lookup_int(interpmthd_bilin_str)) m = InterpMthd_Bilin;
- else if(i == conf_const.lookup_int(interpmthd_nbrhd_str)) m = InterpMthd_Nbrhd;
- else if(i == conf_const.lookup_int(interpmthd_nearest_str)) m = InterpMthd_Nearest;
- else if(i == conf_const.lookup_int(interpmthd_budget_str)) m = InterpMthd_Budget;
- else if(i == conf_const.lookup_int(interpmthd_force_str)) m = InterpMthd_Force;
- else if(i == conf_const.lookup_int(interpmthd_best_str)) m = InterpMthd_Best;
- else if(i == conf_const.lookup_int(interpmthd_upper_left_str)) m = InterpMthd_Upper_Left;
- else if(i == conf_const.lookup_int(interpmthd_upper_right_str)) m = InterpMthd_Upper_Right;
- else if(i == conf_const.lookup_int(interpmthd_lower_right_str)) m = InterpMthd_Lower_Right;
- else if(i == conf_const.lookup_int(interpmthd_lower_left_str)) m = InterpMthd_Lower_Left;
- else if(i == conf_const.lookup_int(interpmthd_gaussian_str)) m = InterpMthd_Gaussian;
- else if(i == conf_const.lookup_int(interpmthd_maxgauss_str)) m = InterpMthd_MaxGauss;
- else if(i == conf_const.lookup_int(interpmthd_geog_match_str)) m = InterpMthd_Geog_Match;
- else if(i == conf_const.lookup_int(interpmthd_hira_str)) m = InterpMthd_HiRA;
+ InterpMthd m = InterpMthd::None;
+
+ if(i == conf_const.lookup_int(interpmthd_none_str)) m = InterpMthd::None;
+ else if(i == conf_const.lookup_int(interpmthd_min_str)) m = InterpMthd::Min;
+ else if(i == conf_const.lookup_int(interpmthd_max_str)) m = InterpMthd::Max;
+ else if(i == conf_const.lookup_int(interpmthd_median_str)) m = InterpMthd::Median;
+ else if(i == conf_const.lookup_int(interpmthd_uw_mean_str)) m = InterpMthd::UW_Mean;
+ else if(i == conf_const.lookup_int(interpmthd_dw_mean_str)) m = InterpMthd::DW_Mean;
+ else if(i == conf_const.lookup_int(interpmthd_aw_mean_str)) m = InterpMthd::AW_Mean;
+ else if(i == conf_const.lookup_int(interpmthd_ls_fit_str)) m = InterpMthd::LS_Fit;
+ else if(i == conf_const.lookup_int(interpmthd_bilin_str)) m = InterpMthd::Bilin;
+ else if(i == conf_const.lookup_int(interpmthd_nbrhd_str)) m = InterpMthd::Nbrhd;
+ else if(i == conf_const.lookup_int(interpmthd_nearest_str)) m = InterpMthd::Nearest;
+ else if(i == conf_const.lookup_int(interpmthd_budget_str)) m = InterpMthd::Budget;
+ else if(i == conf_const.lookup_int(interpmthd_force_str)) m = InterpMthd::Force;
+ else if(i == conf_const.lookup_int(interpmthd_best_str)) m = InterpMthd::Best;
+ else if(i == conf_const.lookup_int(interpmthd_upper_left_str)) m = InterpMthd::Upper_Left;
+ else if(i == conf_const.lookup_int(interpmthd_upper_right_str)) m = InterpMthd::Upper_Right;
+ else if(i == conf_const.lookup_int(interpmthd_lower_right_str)) m = InterpMthd::Lower_Right;
+ else if(i == conf_const.lookup_int(interpmthd_lower_left_str)) m = InterpMthd::Lower_Left;
+ else if(i == conf_const.lookup_int(interpmthd_gaussian_str)) m = InterpMthd::Gaussian;
+ else if(i == conf_const.lookup_int(interpmthd_maxgauss_str)) m = InterpMthd::MaxGauss;
+ else if(i == conf_const.lookup_int(interpmthd_geog_match_str)) m = InterpMthd::Geog_Match;
+ else if(i == conf_const.lookup_int(interpmthd_hira_str)) m = InterpMthd::HiRA;
else {
mlog << Error << "\nconf_int_to_interpmthd() -> "
<< "Unexpected value of " << i
@@ -2605,52 +2611,52 @@ const char * statlinetype_to_string(const STATLineType t) {
const char *s = (const char *) nullptr;
switch(t) {
- case(stat_sl1l2): s = stat_sl1l2_str; break;
- case(stat_sal1l2): s = stat_sal1l2_str; break;
- case(stat_vl1l2): s = stat_vl1l2_str; break;
- case(stat_val1l2): s = stat_val1l2_str; break;
- case(stat_vcnt): s = stat_vcnt_str; break;
-
- case(stat_fho): s = stat_fho_str; break;
- case(stat_ctc): s = stat_ctc_str; break;
- case(stat_cts): s = stat_cts_str; break;
- case(stat_mctc): s = stat_mctc_str; break;
- case(stat_mcts): s = stat_mcts_str; break;
-
- case(stat_cnt): s = stat_cnt_str; break;
- case(stat_pct): s = stat_pct_str; break;
- case(stat_pstd): s = stat_pstd_str; break;
- case(stat_pjc): s = stat_pjc_str; break;
- case(stat_prc): s = stat_prc_str; break;
-
- case(stat_eclv): s = stat_eclv_str; break;
- case(stat_mpr): s = stat_mpr_str; break;
- case(stat_seeps): s = stat_seeps_str; break;
- case(stat_seeps_mpr): s = stat_seeps_mpr_str; break;
- case(stat_nbrctc): s = stat_nbrctc_str; break;
-
- case(stat_nbrcts): s = stat_nbrcts_str; break;
- case(stat_nbrcnt): s = stat_nbrcnt_str; break;
- case(stat_grad): s = stat_grad_str; break;
- case(stat_dmap): s = stat_dmap_str; break;
- case(stat_isc): s = stat_isc_str; break;
-
- case(stat_wdir): s = stat_wdir_str; break;
- case(stat_ecnt): s = stat_ecnt_str; break;
- case(stat_rps): s = stat_rps_str; break;
- case(stat_rhist): s = stat_rhist_str; break;
- case(stat_phist): s = stat_phist_str; break;
-
- case(stat_orank): s = stat_orank_str; break;
- case(stat_ssvar): s = stat_ssvar_str; break;
- case(stat_relp): s = stat_relp_str; break;
- case(stat_genmpr): s = stat_genmpr_str; break;
- case(stat_ssidx): s = stat_ssidx_str; break;
+ case STATLineType::sl1l2: s = stat_sl1l2_str; break;
+ case STATLineType::sal1l2: s = stat_sal1l2_str; break;
+ case STATLineType::vl1l2: s = stat_vl1l2_str; break;
+ case STATLineType::val1l2: s = stat_val1l2_str; break;
+ case STATLineType::vcnt: s = stat_vcnt_str; break;
+
+ case STATLineType::fho: s = stat_fho_str; break;
+ case STATLineType::ctc: s = stat_ctc_str; break;
+ case STATLineType::cts: s = stat_cts_str; break;
+ case STATLineType::mctc: s = stat_mctc_str; break;
+ case STATLineType::mcts: s = stat_mcts_str; break;
+
+ case STATLineType::cnt: s = stat_cnt_str; break;
+ case STATLineType::pct: s = stat_pct_str; break;
+ case STATLineType::pstd: s = stat_pstd_str; break;
+ case STATLineType::pjc: s = stat_pjc_str; break;
+ case STATLineType::prc: s = stat_prc_str; break;
+
+ case STATLineType::eclv: s = stat_eclv_str; break;
+ case STATLineType::mpr: s = stat_mpr_str; break;
+ case STATLineType::seeps: s = stat_seeps_str; break;
+ case STATLineType::seeps_mpr: s = stat_seeps_mpr_str; break;
+ case STATLineType::nbrctc: s = stat_nbrctc_str; break;
+
+ case STATLineType::nbrcts: s = stat_nbrcts_str; break;
+ case STATLineType::nbrcnt: s = stat_nbrcnt_str; break;
+ case STATLineType::grad: s = stat_grad_str; break;
+ case STATLineType::dmap: s = stat_dmap_str; break;
+ case STATLineType::isc: s = stat_isc_str; break;
+
+ case STATLineType::wdir: s = stat_wdir_str; break;
+ case STATLineType::ecnt: s = stat_ecnt_str; break;
+ case STATLineType::rps: s = stat_rps_str; break;
+ case STATLineType::rhist: s = stat_rhist_str; break;
+ case STATLineType::phist: s = stat_phist_str; break;
+
+ case STATLineType::orank: s = stat_orank_str; break;
+ case STATLineType::ssvar: s = stat_ssvar_str; break;
+ case STATLineType::relp: s = stat_relp_str; break;
+ case STATLineType::genmpr: s = stat_genmpr_str; break;
+ case STATLineType::ssidx: s = stat_ssidx_str; break;
- case(stat_header): s = stat_header_str; break;
+ case STATLineType::header: s = stat_header_str; break;
- case(no_stat_line_type):
- default: s = stat_na_str; break;
+ /*case STATLineType::none:*/
+ default: s = stat_na_str; break;
}
return s;
@@ -2671,51 +2677,77 @@ void statlinetype_to_string(const STATLineType t, char *out) {
STATLineType string_to_statlinetype(const char *s) {
STATLineType t;
- if(strcasecmp(s, stat_sl1l2_str) == 0) t = stat_sl1l2;
- else if(strcasecmp(s, stat_sal1l2_str) == 0) t = stat_sal1l2;
- else if(strcasecmp(s, stat_vl1l2_str) == 0) t = stat_vl1l2;
- else if(strcasecmp(s, stat_val1l2_str) == 0) t = stat_val1l2;
- else if(strcasecmp(s, stat_vcnt_str) == 0) t = stat_vcnt;
-
- else if(strcasecmp(s, stat_fho_str) == 0) t = stat_fho;
- else if(strcasecmp(s, stat_ctc_str) == 0) t = stat_ctc;
- else if(strcasecmp(s, stat_cts_str) == 0) t = stat_cts;
- else if(strcasecmp(s, stat_mctc_str) == 0) t = stat_mctc;
- else if(strcasecmp(s, stat_mcts_str) == 0) t = stat_mcts;
-
- else if(strcasecmp(s, stat_cnt_str) == 0) t = stat_cnt;
- else if(strcasecmp(s, stat_pct_str) == 0) t = stat_pct;
- else if(strcasecmp(s, stat_pstd_str) == 0) t = stat_pstd;
- else if(strcasecmp(s, stat_pjc_str) == 0) t = stat_pjc;
- else if(strcasecmp(s, stat_prc_str) == 0) t = stat_prc;
-
- else if(strcasecmp(s, stat_eclv_str) == 0) t = stat_eclv;
- else if(strcasecmp(s, stat_mpr_str) == 0) t = stat_mpr;
- else if(strcasecmp(s, stat_seeps_str) == 0) t = stat_seeps;
- else if(strcasecmp(s, stat_seeps_mpr_str) == 0) t = stat_seeps_mpr;
- else if(strcasecmp(s, stat_nbrctc_str) == 0) t = stat_nbrctc;
-
- else if(strcasecmp(s, stat_nbrcts_str) == 0) t = stat_nbrcts;
- else if(strcasecmp(s, stat_nbrcnt_str) == 0) t = stat_nbrcnt;
- else if(strcasecmp(s, stat_grad_str) == 0) t = stat_grad;
- else if(strcasecmp(s, stat_dmap_str) == 0) t = stat_dmap;
- else if(strcasecmp(s, stat_isc_str) == 0) t = stat_isc;
-
- else if(strcasecmp(s, stat_wdir_str) == 0) t = stat_wdir;
- else if(strcasecmp(s, stat_ecnt_str) == 0) t = stat_ecnt;
- else if(strcasecmp(s, stat_rps_str) == 0) t = stat_rps;
- else if(strcasecmp(s, stat_rhist_str) == 0) t = stat_rhist;
- else if(strcasecmp(s, stat_phist_str) == 0) t = stat_phist;
-
- else if(strcasecmp(s, stat_orank_str) == 0) t = stat_orank;
- else if(strcasecmp(s, stat_ssvar_str) == 0) t = stat_ssvar;
- else if(strcasecmp(s, stat_relp_str) == 0) t = stat_relp;
- else if(strcasecmp(s, stat_genmpr_str) == 0) t = stat_genmpr;
- else if(strcasecmp(s, stat_ssidx_str) == 0) t = stat_ssidx;
-
- else if(strcasecmp(s, stat_header_str) == 0) t = stat_header;
-
- else t = no_stat_line_type;
+ if(strcasecmp(s, stat_sl1l2_str) == 0) t = STATLineType::sl1l2;
+ else if(strcasecmp(s, stat_sal1l2_str) == 0) t = STATLineType::sal1l2;
+ else if(strcasecmp(s, stat_vl1l2_str) == 0) t = STATLineType::vl1l2;
+ else if(strcasecmp(s, stat_val1l2_str) == 0) t = STATLineType::val1l2;
+ else if(strcasecmp(s, stat_vcnt_str) == 0) t = STATLineType::vcnt;
+
+ else if(strcasecmp(s, stat_fho_str) == 0) t = STATLineType::fho;
+ else if(strcasecmp(s, stat_ctc_str) == 0) t = STATLineType::ctc;
+ else if(strcasecmp(s, stat_cts_str) == 0) t = STATLineType::cts;
+ else if(strcasecmp(s, stat_mctc_str) == 0) t = STATLineType::mctc;
+ else if(strcasecmp(s, stat_mcts_str) == 0) t = STATLineType::mcts;
+
+ else if(strcasecmp(s, stat_cnt_str) == 0) t = STATLineType::cnt;
+ else if(strcasecmp(s, stat_pct_str) == 0) t = STATLineType::pct;
+ else if(strcasecmp(s, stat_pstd_str) == 0) t = STATLineType::pstd;
+ else if(strcasecmp(s, stat_pjc_str) == 0) t = STATLineType::pjc;
+ else if(strcasecmp(s, stat_prc_str) == 0) t = STATLineType::prc;
+
+ else if(strcasecmp(s, stat_eclv_str) == 0) t = STATLineType::eclv;
+ else if(strcasecmp(s, stat_mpr_str) == 0) t = STATLineType::mpr;
+ else if(strcasecmp(s, stat_seeps_str) == 0) t = STATLineType::seeps;
+ else if(strcasecmp(s, stat_seeps_mpr_str) == 0) t = STATLineType::seeps_mpr;
+ else if(strcasecmp(s, stat_nbrctc_str) == 0) t = STATLineType::nbrctc;
+
+ else if(strcasecmp(s, stat_nbrcts_str) == 0) t = STATLineType::nbrcts;
+ else if(strcasecmp(s, stat_nbrcnt_str) == 0) t = STATLineType::nbrcnt;
+ else if(strcasecmp(s, stat_grad_str) == 0) t = STATLineType::grad;
+ else if(strcasecmp(s, stat_dmap_str) == 0) t = STATLineType::dmap;
+ else if(strcasecmp(s, stat_isc_str) == 0) t = STATLineType::isc;
+
+ else if(strcasecmp(s, stat_wdir_str) == 0) t = STATLineType::wdir;
+ else if(strcasecmp(s, stat_ecnt_str) == 0) t = STATLineType::ecnt;
+ else if(strcasecmp(s, stat_rps_str) == 0) t = STATLineType::rps;
+ else if(strcasecmp(s, stat_rhist_str) == 0) t = STATLineType::rhist;
+ else if(strcasecmp(s, stat_phist_str) == 0) t = STATLineType::phist;
+
+ else if(strcasecmp(s, stat_orank_str) == 0) t = STATLineType::orank;
+ else if(strcasecmp(s, stat_ssvar_str) == 0) t = STATLineType::ssvar;
+ else if(strcasecmp(s, stat_relp_str) == 0) t = STATLineType::relp;
+ else if(strcasecmp(s, stat_genmpr_str) == 0) t = STATLineType::genmpr;
+ else if(strcasecmp(s, stat_ssidx_str) == 0) t = STATLineType::ssidx;
+
+ else if(strcasecmp(s, stat_header_str) == 0) t = STATLineType::header;
+
+ else t = STATLineType::none;
+
+ return t;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+const char * bootintervaltype_to_string(const BootIntervalType t) {
+ auto s = (const char *) nullptr;
+
+ switch(t) {
+ case BootIntervalType::BCA: s = conf_val_bca; break;
+ case BootIntervalType::PCTile: s = conf_val_pctile; break;
+ default: s = conf_val_none; break;
+ }
+
+ return s;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+BootIntervalType string_to_bootintervaltype(const char *s) {
+ BootIntervalType t;
+
+ if(strcasecmp(s, conf_val_bca) == 0) t = BootIntervalType::BCA;
+ else if(strcasecmp(s, conf_val_pctile) == 0) t = BootIntervalType::PCTile;
+ else t = BootIntervalType::None;
return t;
}
@@ -2723,13 +2755,13 @@ STATLineType string_to_statlinetype(const char *s) {
///////////////////////////////////////////////////////////////////////////////
FieldType int_to_fieldtype(int v) {
- FieldType t = FieldType_None;
+ FieldType t = FieldType::None;
// Convert integer to enumerated FieldType
- if(v == conf_const.lookup_int(conf_val_none)) t = FieldType_None;
- else if(v == conf_const.lookup_int(conf_val_both)) t = FieldType_Both;
- else if(v == conf_const.lookup_int(conf_val_fcst)) t = FieldType_Fcst;
- else if(v == conf_const.lookup_int(conf_val_obs)) t = FieldType_Obs;
+ if(v == conf_const.lookup_int(conf_val_none)) t = FieldType::None;
+ else if(v == conf_const.lookup_int(conf_val_both)) t = FieldType::Both;
+ else if(v == conf_const.lookup_int(conf_val_fcst)) t = FieldType::Fcst;
+ else if(v == conf_const.lookup_int(conf_val_obs)) t = FieldType::Obs;
else {
mlog << Error << "\nint_to_fieldtype() -> "
<< "Unexpected value of " << v << ".\n\n";
@@ -2742,14 +2774,14 @@ FieldType int_to_fieldtype(int v) {
///////////////////////////////////////////////////////////////////////////////
GridTemplateFactory::GridTemplates int_to_gridtemplate(int v) {
- GridTemplateFactory::GridTemplates t = GridTemplateFactory::GridTemplate_Square;
+ GridTemplateFactory::GridTemplates t = GridTemplateFactory::GridTemplates::Square;
// Convert integer to enumerated FieldType
if(v == conf_const.lookup_int(conf_val_square)) {
- t = GridTemplateFactory::GridTemplate_Square;
+ t = GridTemplateFactory::GridTemplates::Square;
}
else if(v == conf_const.lookup_int(conf_val_circle)) {
- t = GridTemplateFactory::GridTemplate_Circle;
+ t = GridTemplateFactory::GridTemplates::Circle;
}
else {
mlog << Error << "\nint_to_gridtemplate() -> "
@@ -2767,13 +2799,13 @@ ConcatString fieldtype_to_string(FieldType type) {
// Convert enumerated FieldType to string
switch(type) {
- case(FieldType_None): s = conf_val_none; break;
- case(FieldType_Both): s = conf_val_both; break;
- case(FieldType_Fcst): s = conf_val_fcst; break;
- case(FieldType_Obs): s = conf_val_obs; break;
+ case FieldType::None: s = conf_val_none; break;
+ case FieldType::Both: s = conf_val_both; break;
+ case FieldType::Fcst: s = conf_val_fcst; break;
+ case FieldType::Obs: s = conf_val_obs; break;
default:
mlog << Error << "\nfieldtype_to_string() -> "
- << "Unexpected FieldType value of " << type << ".\n\n";
+ << "Unexpected FieldType value of " << enum_class_as_int(type) << ".\n\n";
exit(1);
}
@@ -2783,13 +2815,13 @@ ConcatString fieldtype_to_string(FieldType type) {
///////////////////////////////////////////////////////////////////////////////
SetLogic int_to_setlogic(int v) {
- SetLogic t = SetLogic_None;
+ SetLogic t = SetLogic::None;
// Convert integer to enumerated SetLogic
- if(v == conf_const.lookup_int(conf_val_none)) t = SetLogic_None;
- else if(v == conf_const.lookup_int(conf_val_union)) t = SetLogic_Union;
- else if(v == conf_const.lookup_int(conf_val_intersection)) t = SetLogic_Intersection;
- else if(v == conf_const.lookup_int(conf_val_symdiff)) t = SetLogic_SymDiff;
+ if(v == conf_const.lookup_int(conf_val_none)) t = SetLogic::None;
+ else if(v == conf_const.lookup_int(conf_val_union)) t = SetLogic::Union;
+ else if(v == conf_const.lookup_int(conf_val_intersection)) t = SetLogic::Intersection;
+ else if(v == conf_const.lookup_int(conf_val_symdiff)) t = SetLogic::SymDiff;
else {
mlog << Error << "\nint_to_setlogic() -> "
<< "Unexpected value of " << v << ".\n\n";
@@ -2802,22 +2834,22 @@ SetLogic int_to_setlogic(int v) {
///////////////////////////////////////////////////////////////////////////////
SetLogic string_to_setlogic(const char *s) {
- SetLogic t = SetLogic_None;
+ SetLogic t = SetLogic::None;
// Convert string to enumerated SetLogic
- if(strcasecmp(s, conf_val_none) == 0) t = SetLogic_None;
+ if(strcasecmp(s, conf_val_none) == 0) t = SetLogic::None;
else if(strcasecmp(s, conf_val_union) == 0 ||
strcasecmp(s, setlogic_abbr_union) == 0 ||
- strcasecmp(s, setlogic_symbol_union) == 0) t = SetLogic_Union;
+ strcasecmp(s, setlogic_symbol_union) == 0) t = SetLogic::Union;
else if(strcasecmp(s, conf_val_intersection) == 0 ||
strcasecmp(s, setlogic_abbr_intersection) == 0 ||
- strcasecmp(s, setlogic_symbol_intersection) == 0) t = SetLogic_Intersection;
+ strcasecmp(s, setlogic_symbol_intersection) == 0) t = SetLogic::Intersection;
else if(strcasecmp(s, conf_val_symdiff) == 0 ||
strcasecmp(s, setlogic_abbr_symdiff) == 0 ||
- strcasecmp(s, setlogic_symbol_symdiff) == 0) t = SetLogic_SymDiff;
+ strcasecmp(s, setlogic_symbol_symdiff) == 0) t = SetLogic::SymDiff;
else {
mlog << Error << "\nstring_to_setlogic() -> "
@@ -2836,13 +2868,13 @@ ConcatString setlogic_to_string(SetLogic type) {
// Convert enumerated SetLogic to string
switch(type) {
- case(SetLogic_None): s = conf_val_none; break;
- case(SetLogic_Union): s = conf_val_union; break;
- case(SetLogic_Intersection): s = conf_val_intersection; break;
- case(SetLogic_SymDiff): s = conf_val_symdiff; break;
+ case SetLogic::None: s = conf_val_none; break;
+ case SetLogic::Union: s = conf_val_union; break;
+ case SetLogic::Intersection: s = conf_val_intersection; break;
+ case SetLogic::SymDiff: s = conf_val_symdiff; break;
default:
mlog << Error << "\nsetlogic_to_string() -> "
- << "Unexpected SetLogic value of " << type << ".\n\n";
+ << "Unexpected SetLogic value of " << enum_class_as_int(type) << ".\n\n";
exit(1);
}
@@ -2856,13 +2888,13 @@ ConcatString setlogic_to_abbr(SetLogic type) {
// Convert enumerated SetLogic to an abbreviation
switch(type) {
- case(SetLogic_None): s = na_str; break;
- case(SetLogic_Union): s = setlogic_abbr_union; break;
- case(SetLogic_Intersection): s = setlogic_abbr_intersection; break;
- case(SetLogic_SymDiff): s = setlogic_abbr_symdiff; break;
+ case SetLogic::None: s = na_str; break;
+ case SetLogic::Union: s = setlogic_abbr_union; break;
+ case SetLogic::Intersection: s = setlogic_abbr_intersection; break;
+ case SetLogic::SymDiff: s = setlogic_abbr_symdiff; break;
default:
mlog << Error << "\nsetlogic_to_abbr() -> "
- << "Unexpected SetLogic value of " << type << ".\n\n";
+ << "Unexpected SetLogic value of " << enum_class_as_int(type) << ".\n\n";
exit(1);
}
@@ -2876,13 +2908,13 @@ ConcatString setlogic_to_symbol(SetLogic type) {
// Convert enumerated SetLogic to a symbol
switch(type) {
- case(SetLogic_None): s = na_str; break;
- case(SetLogic_Union): s = setlogic_symbol_union; break;
- case(SetLogic_Intersection): s = setlogic_symbol_intersection; break;
- case(SetLogic_SymDiff): s = setlogic_symbol_symdiff; break;
+ case SetLogic::None: s = na_str; break;
+ case SetLogic::Union: s = setlogic_symbol_union; break;
+ case SetLogic::Intersection: s = setlogic_symbol_intersection; break;
+ case SetLogic::SymDiff: s = setlogic_symbol_symdiff; break;
default:
mlog << Error << "\nsetlogic_to_symbol() -> "
- << "Unexpected SetLogic value of " << type << ".\n\n";
+ << "Unexpected SetLogic value of " << enum_class_as_int(type) << ".\n\n";
exit(1);
}
@@ -2892,12 +2924,12 @@ ConcatString setlogic_to_symbol(SetLogic type) {
///////////////////////////////////////////////////////////////////////////////
SetLogic check_setlogic(SetLogic t1, SetLogic t2) {
- SetLogic t = SetLogic_None;
+ SetLogic t = SetLogic::None;
// If not equal, select the non-default logic type
if(t1 == t2) t = t1;
- else if(t1 == SetLogic_None) t = t2;
- else if(t2 == SetLogic_None) t = t1;
+ else if(t1 == SetLogic::None) t = t2;
+ else if(t2 == SetLogic::None) t = t1;
// If not equal and both non-default, error out
else {
mlog << Error << "\ncheck_setlogic() -> "
@@ -2913,13 +2945,13 @@ SetLogic check_setlogic(SetLogic t1, SetLogic t2) {
///////////////////////////////////////////////////////////////////////////////
TrackType int_to_tracktype(int v) {
- TrackType t = TrackType_None;
+ TrackType t = TrackType::None;
// Convert integer to enumerated TrackType
- if(v == conf_const.lookup_int(conf_val_none)) t = TrackType_None;
- else if(v == conf_const.lookup_int(conf_val_both)) t = TrackType_Both;
- else if(v == conf_const.lookup_int(conf_val_adeck)) t = TrackType_ADeck;
- else if(v == conf_const.lookup_int(conf_val_bdeck)) t = TrackType_BDeck;
+ if(v == conf_const.lookup_int(conf_val_none)) t = TrackType::None;
+ else if(v == conf_const.lookup_int(conf_val_both)) t = TrackType::Both;
+ else if(v == conf_const.lookup_int(conf_val_adeck)) t = TrackType::ADeck;
+ else if(v == conf_const.lookup_int(conf_val_bdeck)) t = TrackType::BDeck;
else {
mlog << Error << "\nint_to_tracktype() -> "
<< "Unexpected value of " << v << ".\n\n";
@@ -2932,13 +2964,13 @@ TrackType int_to_tracktype(int v) {
///////////////////////////////////////////////////////////////////////////////
TrackType string_to_tracktype(const char *s) {
- TrackType t = TrackType_None;
+ TrackType t = TrackType::None;
// Convert string to enumerated TrackType
- if(strcasecmp(s, conf_val_none) == 0) t = TrackType_None;
- else if(strcasecmp(s, conf_val_both) == 0) t = TrackType_Both;
- else if(strcasecmp(s, conf_val_adeck) == 0) t = TrackType_ADeck;
- else if(strcasecmp(s, conf_val_bdeck) == 0) t = TrackType_BDeck;
+ if(strcasecmp(s, conf_val_none) == 0) t = TrackType::None;
+ else if(strcasecmp(s, conf_val_both) == 0) t = TrackType::Both;
+ else if(strcasecmp(s, conf_val_adeck) == 0) t = TrackType::ADeck;
+ else if(strcasecmp(s, conf_val_bdeck) == 0) t = TrackType::BDeck;
else {
mlog << Error << "\nstring_to_tracktype() -> "
<< "Unexpected TrackType string \"" << s << "\".\n\n";
@@ -2955,13 +2987,13 @@ ConcatString tracktype_to_string(TrackType type) {
// Convert enumerated TrackType to string
switch(type) {
- case(TrackType_None): s = conf_val_none; break;
- case(TrackType_Both): s = conf_val_both; break;
- case(TrackType_ADeck): s = conf_val_adeck; break;
- case(TrackType_BDeck): s = conf_val_bdeck; break;
+ case TrackType::None: s = conf_val_none; break;
+ case TrackType::Both: s = conf_val_both; break;
+ case TrackType::ADeck: s = conf_val_adeck; break;
+ case TrackType::BDeck: s = conf_val_bdeck; break;
default:
mlog << Error << "\ntracktype_to_string() -> "
- << "Unexpected TrackType value of " << type << ".\n\n";
+ << "Unexpected TrackType value of " << enum_class_as_int(type) << ".\n\n";
exit(1);
}
@@ -2971,15 +3003,15 @@ ConcatString tracktype_to_string(TrackType type) {
///////////////////////////////////////////////////////////////////////////////
DiagType string_to_diagtype(const char *s) {
- DiagType t = DiagType_None;
+ DiagType t = DiagType::None;
// Convert string to enumerated DiagType, storing unknown strings
// as the default type
- if(strcasecmp(s, cira_diag_rt_str) == 0) t = DiagType_CIRA_RT;
- else if(strcasecmp(s, cira_diag_dev_str) == 0) t = DiagType_CIRA_Dev;
- else if(strcasecmp(s, ships_diag_rt_str) == 0) t = DiagType_SHIPS_RT;
- else if(strcasecmp(s, ships_diag_dev_str) == 0) t = DiagType_SHIPS_Dev;
- else t = DiagType_None;
+ if(strcasecmp(s, cira_diag_rt_str) == 0) t = DiagType::CIRA_RT;
+ else if(strcasecmp(s, cira_diag_dev_str) == 0) t = DiagType::CIRA_Dev;
+ else if(strcasecmp(s, ships_diag_rt_str) == 0) t = DiagType::SHIPS_RT;
+ else if(strcasecmp(s, ships_diag_dev_str) == 0) t = DiagType::SHIPS_Dev;
+ else t = DiagType::None;
return t;
}
@@ -2991,14 +3023,14 @@ ConcatString diagtype_to_string(DiagType type) {
// Convert enumerated DiagType to string
switch(type) {
- case(DiagType_None): s = conf_val_none; break;
- case(DiagType_CIRA_RT): s = cira_diag_rt_str; break;
- case(DiagType_CIRA_Dev): s = cira_diag_dev_str; break;
- case(DiagType_SHIPS_RT): s = ships_diag_rt_str; break;
- case(DiagType_SHIPS_Dev): s = ships_diag_dev_str; break;
+ case DiagType::None: s = conf_val_none; break;
+ case DiagType::CIRA_RT: s = cira_diag_rt_str; break;
+ case DiagType::CIRA_Dev: s = cira_diag_dev_str; break;
+ case DiagType::SHIPS_RT: s = ships_diag_rt_str; break;
+ case DiagType::SHIPS_Dev: s = ships_diag_dev_str; break;
default:
mlog << Error << "\ndiagtype_to_string() -> "
- << "Unexpected DiagType value of " << type << ".\n\n";
+ << "Unexpected DiagType value of " << enum_class_as_int(type) << ".\n\n";
exit(1);
}
@@ -3008,12 +3040,12 @@ ConcatString diagtype_to_string(DiagType type) {
///////////////////////////////////////////////////////////////////////////////
Interp12Type int_to_interp12type(int v) {
- Interp12Type t = Interp12Type_None;
+ Interp12Type t = Interp12Type::None;
// Convert integer to enumerated Interp12Type
- if(v == conf_const.lookup_int(conf_val_none)) t = Interp12Type_None;
- else if(v == conf_const.lookup_int(conf_val_fill)) t = Interp12Type_Fill;
- else if(v == conf_const.lookup_int(conf_val_replace)) t = Interp12Type_Replace;
+ if(v == conf_const.lookup_int(conf_val_none)) t = Interp12Type::None;
+ else if(v == conf_const.lookup_int(conf_val_fill)) t = Interp12Type::Fill;
+ else if(v == conf_const.lookup_int(conf_val_replace)) t = Interp12Type::Replace;
else {
mlog << Error << "\nint_to_interp12type() -> "
<< "Unexpected value of " << v << ".\n\n";
@@ -3026,12 +3058,12 @@ Interp12Type int_to_interp12type(int v) {
///////////////////////////////////////////////////////////////////////////////
Interp12Type string_to_interp12type(const char *s) {
- Interp12Type t = Interp12Type_None;
+ Interp12Type t = Interp12Type::None;
// Convert string to enumerated Interp12Type
- if(strcasecmp(s, conf_val_none) == 0) t = Interp12Type_None;
- else if(strcasecmp(s, conf_val_fill) == 0) t = Interp12Type_Fill;
- else if(strcasecmp(s, conf_val_replace) == 0) t = Interp12Type_Replace;
+ if(strcasecmp(s, conf_val_none) == 0) t = Interp12Type::None;
+ else if(strcasecmp(s, conf_val_fill) == 0) t = Interp12Type::Fill;
+ else if(strcasecmp(s, conf_val_replace) == 0) t = Interp12Type::Replace;
else {
mlog << Error << "\nstring_to_interp12type() -> "
<< "Unexpected Interp12Type string \"" << s << "\".\n\n";
@@ -3048,12 +3080,12 @@ ConcatString interp12type_to_string(Interp12Type type) {
// Convert enumerated Interp12Type to string
switch(type) {
- case(Interp12Type_None): s = conf_val_none; break;
- case(Interp12Type_Fill): s = conf_val_fill; break;
- case(Interp12Type_Replace): s = conf_val_replace; break;
+ case Interp12Type::None: s = conf_val_none; break;
+ case Interp12Type::Fill: s = conf_val_fill; break;
+ case Interp12Type::Replace: s = conf_val_replace; break;
default:
mlog << Error << "\ninterp12type_to_string() -> "
- << "Unexpected Interp12Type value of " << type << ".\n\n";
+ << "Unexpected Interp12Type value of " << enum_class_as_int(type) << ".\n\n";
exit(1);
}
@@ -3063,13 +3095,13 @@ ConcatString interp12type_to_string(Interp12Type type) {
///////////////////////////////////////////////////////////////////////////////
MergeType int_to_mergetype(int v) {
- MergeType t = MergeType_None;
+ MergeType t = MergeType::None;
// Convert integer to enumerated MergeType
- if(v == conf_const.lookup_int(conf_val_none)) t = MergeType_None;
- else if(v == conf_const.lookup_int(conf_val_both)) t = MergeType_Both;
- else if(v == conf_const.lookup_int(conf_val_thresh)) t = MergeType_Thresh;
- else if(v == conf_const.lookup_int(conf_val_engine)) t = MergeType_Engine;
+ if(v == conf_const.lookup_int(conf_val_none)) t = MergeType::None;
+ else if(v == conf_const.lookup_int(conf_val_both)) t = MergeType::Both;
+ else if(v == conf_const.lookup_int(conf_val_thresh)) t = MergeType::Thresh;
+ else if(v == conf_const.lookup_int(conf_val_engine)) t = MergeType::Engine;
else {
mlog << Error << "\nint_to_mergetype() -> "
<< "Unexpected value of " << v << ".\n\n";
@@ -3086,13 +3118,13 @@ ConcatString mergetype_to_string(MergeType type) {
// Convert enumerated MergeType to string
switch(type) {
- case(MergeType_None): s = conf_val_none; break;
- case(MergeType_Both): s = conf_val_both; break;
- case(MergeType_Thresh): s = conf_val_thresh; break;
- case(MergeType_Engine): s = conf_val_engine; break;
+ case MergeType::None: s = conf_val_none; break;
+ case MergeType::Both: s = conf_val_both; break;
+ case MergeType::Thresh: s = conf_val_thresh; break;
+ case MergeType::Engine: s = conf_val_engine; break;
default:
mlog << Error << "\nmergetype_to_string() -> "
- << "Unexpected MergeType value of " << type << ".\n\n";
+ << "Unexpected MergeType value of " << enum_class_as_int(type) << ".\n\n";
exit(1);
}
@@ -3106,19 +3138,19 @@ ConcatString obssummary_to_string(ObsSummary type, int perc_val) {
// Convert enumerated ObsSummary to string
switch(type) {
- case(ObsSummary_None): s = conf_val_none; break;
- case(ObsSummary_Nearest): s = conf_val_nearest; break;
- case(ObsSummary_Min): s = conf_val_min; break;
- case(ObsSummary_Max): s = conf_val_max; break;
- case(ObsSummary_UW_Mean): s = conf_val_uw_mean; break;
- case(ObsSummary_DW_Mean): s = conf_val_dw_mean; break;
- case(ObsSummary_Median): s = conf_val_median; break;
- case(ObsSummary_Perc):
+ case ObsSummary::None: s = conf_val_none; break;
+ case ObsSummary::Nearest: s = conf_val_nearest; break;
+ case ObsSummary::Min: s = conf_val_min; break;
+ case ObsSummary::Max: s = conf_val_max; break;
+ case ObsSummary::UW_Mean: s = conf_val_uw_mean; break;
+ case ObsSummary::DW_Mean: s = conf_val_dw_mean; break;
+ case ObsSummary::Median: s = conf_val_median; break;
+ case ObsSummary::Perc:
s << conf_val_perc << "(" << perc_val << ")";
break;
default:
mlog << Error << "\nobssummary_to_string() -> "
- << "Unexpected ObsSummary value of " << type << ".\n\n";
+ << "Unexpected ObsSummary value of " << enum_class_as_int(type) << ".\n\n";
exit(1);
}
@@ -3128,13 +3160,13 @@ ConcatString obssummary_to_string(ObsSummary type, int perc_val) {
///////////////////////////////////////////////////////////////////////////////
MatchType int_to_matchtype(int v) {
- MatchType t = MatchType_None;
+ MatchType t = MatchType::None;
// Convert integer to enumerated MatchType
- if(v == conf_const.lookup_int(conf_val_none)) t = MatchType_None;
- else if(v == conf_const.lookup_int(conf_val_merge_both)) t = MatchType_MergeBoth;
- else if(v == conf_const.lookup_int(conf_val_merge_fcst)) t = MatchType_MergeFcst;
- else if(v == conf_const.lookup_int(conf_val_no_merge)) t = MatchType_NoMerge;
+ if(v == conf_const.lookup_int(conf_val_none)) t = MatchType::None;
+ else if(v == conf_const.lookup_int(conf_val_merge_both)) t = MatchType::MergeBoth;
+ else if(v == conf_const.lookup_int(conf_val_merge_fcst)) t = MatchType::MergeFcst;
+ else if(v == conf_const.lookup_int(conf_val_no_merge)) t = MatchType::NoMerge;
else {
mlog << Error << "\nint_to_matchtype() -> "
<< "Unexpected value of " << v << ".\n\n";
@@ -3151,13 +3183,13 @@ ConcatString matchtype_to_string(MatchType type) {
// Convert enumerated MatchType to string
switch(type) {
- case(MatchType_None): s = conf_val_none; break;
- case(MatchType_MergeBoth): s = conf_val_merge_both; break;
- case(MatchType_MergeFcst): s = conf_val_merge_fcst; break;
- case(MatchType_NoMerge): s = conf_val_no_merge; break;
+ case MatchType::None: s = conf_val_none; break;
+ case MatchType::MergeBoth: s = conf_val_merge_both; break;
+ case MatchType::MergeFcst: s = conf_val_merge_fcst; break;
+ case MatchType::NoMerge: s = conf_val_no_merge; break;
default:
mlog << Error << "\nmatchtype_to_string() -> "
- << "Unexpected MatchType value of " << type << ".\n\n";
+ << "Unexpected MatchType value of " << enum_class_as_int(type) << ".\n\n";
exit(1);
}
@@ -3167,16 +3199,16 @@ ConcatString matchtype_to_string(MatchType type) {
///////////////////////////////////////////////////////////////////////////////
DistType int_to_disttype(int v) {
- DistType t = DistType_None;
+ DistType t = DistType::None;
// Convert integer to enumerated DistType
- if(v == conf_const.lookup_int(conf_val_none)) t = DistType_None;
- else if(v == conf_const.lookup_int(conf_val_normal)) t = DistType_Normal;
- else if(v == conf_const.lookup_int(conf_val_exponential)) t = DistType_Exponential;
- else if(v == conf_const.lookup_int(conf_val_chisquared)) t = DistType_ChiSquared;
- else if(v == conf_const.lookup_int(conf_val_gamma)) t = DistType_Gamma;
- else if(v == conf_const.lookup_int(conf_val_uniform)) t = DistType_Uniform;
- else if(v == conf_const.lookup_int(conf_val_beta)) t = DistType_Beta;
+ if(v == conf_const.lookup_int(conf_val_none)) t = DistType::None;
+ else if(v == conf_const.lookup_int(conf_val_normal)) t = DistType::Normal;
+ else if(v == conf_const.lookup_int(conf_val_exponential)) t = DistType::Exponential;
+ else if(v == conf_const.lookup_int(conf_val_chisquared)) t = DistType::ChiSquared;
+ else if(v == conf_const.lookup_int(conf_val_gamma)) t = DistType::Gamma;
+ else if(v == conf_const.lookup_int(conf_val_uniform)) t = DistType::Uniform;
+ else if(v == conf_const.lookup_int(conf_val_beta)) t = DistType::Beta;
else {
mlog << Error << "\nint_to_disttype() -> "
<< "Unexpected value of " << v << ".\n\n";
@@ -3189,16 +3221,16 @@ DistType int_to_disttype(int v) {
///////////////////////////////////////////////////////////////////////////////
DistType string_to_disttype(const char *s) {
- DistType t = DistType_None;
+ DistType t = DistType::None;
// Convert string to enumerated DistType
- if(strcasecmp(s, conf_val_none) == 0) t = DistType_None;
- else if(strcasecmp(s, conf_val_normal) == 0) t = DistType_Normal;
- else if(strcasecmp(s, conf_val_exponential) == 0) t = DistType_Exponential;
- else if(strcasecmp(s, conf_val_chisquared) == 0) t = DistType_ChiSquared;
- else if(strcasecmp(s, conf_val_gamma) == 0) t = DistType_Gamma;
- else if(strcasecmp(s, conf_val_uniform) == 0) t = DistType_Uniform;
- else if(strcasecmp(s, conf_val_beta) == 0) t = DistType_Beta;
+ if(strcasecmp(s, conf_val_none) == 0) t = DistType::None;
+ else if(strcasecmp(s, conf_val_normal) == 0) t = DistType::Normal;
+ else if(strcasecmp(s, conf_val_exponential) == 0) t = DistType::Exponential;
+ else if(strcasecmp(s, conf_val_chisquared) == 0) t = DistType::ChiSquared;
+ else if(strcasecmp(s, conf_val_gamma) == 0) t = DistType::Gamma;
+ else if(strcasecmp(s, conf_val_uniform) == 0) t = DistType::Uniform;
+ else if(strcasecmp(s, conf_val_beta) == 0) t = DistType::Beta;
else {
mlog << Error << "\nstring_to_disttype() -> "
<< "Unexpected DistType string \"" << s << "\".\n\n";
@@ -3215,16 +3247,16 @@ ConcatString disttype_to_string(DistType type) {
// Convert enumerated DistType to string
switch(type) {
- case(DistType_None): s = conf_val_none; break;
- case(DistType_Normal): s = conf_val_normal; break;
- case(DistType_Exponential): s = conf_val_exponential; break;
- case(DistType_ChiSquared): s = conf_val_chisquared; break;
- case(DistType_Gamma): s = conf_val_gamma; break;
- case(DistType_Uniform): s = conf_val_uniform; break;
- case(DistType_Beta): s = conf_val_beta; break;
+ case DistType::None: s = conf_val_none; break;
+ case DistType::Normal: s = conf_val_normal; break;
+ case DistType::Exponential: s = conf_val_exponential; break;
+ case DistType::ChiSquared: s = conf_val_chisquared; break;
+ case DistType::Gamma: s = conf_val_gamma; break;
+ case DistType::Uniform: s = conf_val_uniform; break;
+ case DistType::Beta: s = conf_val_beta; break;
default:
mlog << Error << "\ndisttype_to_string() -> "
- << "Unexpected DistType value of " << type << ".\n\n";
+ << "Unexpected DistType value of " << enum_class_as_int(type) << ".\n\n";
exit(1);
}
@@ -3239,11 +3271,11 @@ ConcatString dist_to_string(DistType type, const NumArray &parm) {
s = disttype_to_string(type);
// Append distribution parameters
- if(type != DistType_None && parm.n() == 2) {
+ if(type != DistType::None && parm.n() == 2) {
s << "(" << parm[0];
- if(type == DistType_Gamma ||
- type == DistType_Uniform ||
- type == DistType_Beta) {
+ if(type == DistType::Gamma ||
+ type == DistType::Uniform ||
+ type == DistType::Beta) {
s << ", " << parm[1];
}
s << ")";
@@ -3259,13 +3291,13 @@ ConcatString griddecomptype_to_string(GridDecompType type) {
// Convert enumerated GridDecompType to string
switch(type) {
- case(GridDecompType_None): s = conf_val_none; break;
- case(GridDecompType_Auto): s = conf_val_auto; break;
- case(GridDecompType_Tile): s = conf_val_tile; break;
- case(GridDecompType_Pad): s = conf_val_pad; break;
+ case GridDecompType::None: s = conf_val_none; break;
+ case GridDecompType::Auto: s = conf_val_auto; break;
+ case GridDecompType::Tile: s = conf_val_tile; break;
+ case GridDecompType::Pad: s = conf_val_pad; break;
default:
mlog << Error << "\ngriddecomptype_to_string() -> "
- << "Unexpected GridDecompType value of " << type << ".\n\n";
+ << "Unexpected GridDecompType value of " << enum_class_as_int(type) << ".\n\n";
exit(1);
}
@@ -3279,16 +3311,16 @@ ConcatString wavelettype_to_string(WaveletType type) {
// Convert enumerated WaveletType to string
switch(type) {
- case(WaveletType_None): s = conf_val_none; break;
- case(WaveletType_Haar): s = conf_val_haar; break;
- case(WaveletType_Haar_Cntr): s = conf_val_haar_cntr; break;
- case(WaveletType_Daub): s = conf_val_daub; break;
- case(WaveletType_Daub_Cntr): s = conf_val_daub_cntr; break;
- case(WaveletType_BSpline): s = conf_val_bspline; break;
- case(WaveletType_BSpline_Cntr): s = conf_val_bspline_cntr; break;
+ case WaveletType::None: s = conf_val_none; break;
+ case WaveletType::Haar: s = conf_val_haar; break;
+ case WaveletType::Haar_Cntr: s = conf_val_haar_cntr; break;
+ case WaveletType::Daub: s = conf_val_daub; break;
+ case WaveletType::Daub_Cntr: s = conf_val_daub_cntr; break;
+ case WaveletType::BSpline: s = conf_val_bspline; break;
+ case WaveletType::BSpline_Cntr: s = conf_val_bspline_cntr; break;
default:
mlog << Error << "\nwavlettype_to_string() -> "
- << "Unexpected WaveletType value of " << type << ".\n\n";
+ << "Unexpected WaveletType value of " << enum_class_as_int(type) << ".\n\n";
exit(1);
}
@@ -3314,7 +3346,7 @@ StringArray parse_conf_ens_member_ids(Dictionary *dict) {
///////////////////////////////////////////////////////////////////////////////
NormalizeType parse_conf_normalize(Dictionary *dict) {
- NormalizeType t = NormalizeType_None;
+ NormalizeType t = NormalizeType::None;
int v;
if(!dict) {
@@ -3327,11 +3359,11 @@ NormalizeType parse_conf_normalize(Dictionary *dict) {
v = dict->lookup_int(conf_key_normalize);
// Convert integer to enumerated NormalizeType
- if(v == conf_const.lookup_int(normalizetype_none_str)) t = NormalizeType_None;
- else if(v == conf_const.lookup_int(normalizetype_climo_anom_str)) t = NormalizeType_ClimoAnom;
- else if(v == conf_const.lookup_int(normalizetype_climo_std_anom_str)) t = NormalizeType_ClimoStdAnom;
- else if(v == conf_const.lookup_int(normalizetype_fcst_anom_str)) t = NormalizeType_FcstAnom;
- else if(v == conf_const.lookup_int(normalizetype_fcst_std_anom_str)) t = NormalizeType_FcstStdAnom;
+ if(v == conf_const.lookup_int(normalizetype_none_str)) t = NormalizeType::None;
+ else if(v == conf_const.lookup_int(normalizetype_climo_anom_str)) t = NormalizeType::ClimoAnom;
+ else if(v == conf_const.lookup_int(normalizetype_climo_std_anom_str)) t = NormalizeType::ClimoStdAnom;
+ else if(v == conf_const.lookup_int(normalizetype_fcst_anom_str)) t = NormalizeType::FcstAnom;
+ else if(v == conf_const.lookup_int(normalizetype_fcst_std_anom_str)) t = NormalizeType::FcstStdAnom;
else {
mlog << Error << "\nparse_conf_normalize() -> "
<< "Unexpected value of " << v << ".\n\n";
diff --git a/src/basic/vx_config/config_util.h b/src/basic/vx_config/config_util.h
index d8137919cb..3dae869b2b 100644
--- a/src/basic/vx_config/config_util.h
+++ b/src/basic/vx_config/config_util.h
@@ -105,6 +105,9 @@ extern const char * statlinetype_to_string(const STATLineType);
extern void statlinetype_to_string(const STATLineType, char *);
extern STATLineType string_to_statlinetype(const char *);
+extern const char * bootintervaltype_to_string(const BootIntervalType);
+extern BootIntervalType string_to_bootintervaltype(const char *);
+
extern FieldType int_to_fieldtype(int);
extern ConcatString fieldtype_to_string(FieldType);
@@ -150,7 +153,7 @@ extern int parse_conf_percentile(Dictionary *dict);
extern void python_compile_error(const char *caller=nullptr);
extern void ugrid_compile_error(const char *caller=nullptr);
-////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
#endif /* __CONFIG_UTIL_H__ */
diff --git a/src/basic/vx_config/configobjecttype_to_string.cc b/src/basic/vx_config/configobjecttype_to_string.cc
index d8088d406c..8bb9f296b8 100644
--- a/src/basic/vx_config/configobjecttype_to_string.cc
+++ b/src/basic/vx_config/configobjecttype_to_string.cc
@@ -62,7 +62,7 @@ switch ( t ) {
} // switch
-return ConcatString (s);
+return ConcatString(s);
}
diff --git a/src/basic/vx_config/grdfiletype_to_string.cc b/src/basic/vx_config/grdfiletype_to_string.cc
index b5d2d4b6be..c9e89451c3 100644
--- a/src/basic/vx_config/grdfiletype_to_string.cc
+++ b/src/basic/vx_config/grdfiletype_to_string.cc
@@ -28,7 +28,6 @@
#include "grdfiletype_to_string.h"
-
using namespace std;
diff --git a/src/basic/vx_log/Makefile.am b/src/basic/vx_log/Makefile.am
index 9e4ba32cf2..49f7f988ff 100644
--- a/src/basic/vx_log/Makefile.am
+++ b/src/basic/vx_log/Makefile.am
@@ -17,7 +17,7 @@ libvx_log_a_SOURCES = concat_string.cc concat_string.h \
logger.cc logger.h \
string_array.cc string_array.h \
str_wrappers.cc str_wrappers.h \
- vx_log.h
+ enum_as_int.hpp vx_log.h
# Build the library when making a distribution so that
# we can make enum_to_string and chk4copyright.
diff --git a/src/basic/vx_log/Makefile.in b/src/basic/vx_log/Makefile.in
index bfbfb1c4b6..272dddb3ca 100644
--- a/src/basic/vx_log/Makefile.in
+++ b/src/basic/vx_log/Makefile.in
@@ -350,7 +350,7 @@ libvx_log_a_SOURCES = concat_string.cc concat_string.h \
logger.cc logger.h \
string_array.cc string_array.h \
str_wrappers.cc str_wrappers.h \
- vx_log.h
+ enum_as_int.hpp vx_log.h
all: all-am
diff --git a/src/basic/vx_log/enum_as_int.hpp b/src/basic/vx_log/enum_as_int.hpp
new file mode 100644
index 0000000000..ded32a2a09
--- /dev/null
+++ b/src/basic/vx_log/enum_as_int.hpp
@@ -0,0 +1,34 @@
+// *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
+// ** Copyright UCAR (c) 1992 - 2024
+// ** University Corporation for Atmospheric Research (UCAR)
+// ** National Center for Atmospheric Research (NCAR)
+// ** Research Applications Lab (RAL)
+// ** P.O.Box 3000, Boulder, Colorado, 80307-3000, USA
+// *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
+
+
+//////////////////////////////////////////////////////////////////
+
+
+#ifndef __ENUM_CLASS_AS_INT_HPP__
+#define __ENUM_CLASS_AS_INT_HPP__
+
+
+//////////////////////////////////////////////////////////////////
+
+template
+auto enum_class_as_int(Enumeration const value)
+ -> typename std::underlying_type::type
+{
+ return static_cast::type>(value);
+}
+
+//////////////////////////////////////////////////////////////////
+
+
+#endif // __ENUM_CLASS_AS_INT_HPP__
+
+
+//////////////////////////////////////////////////////////////////
+
+
diff --git a/src/basic/vx_log/logger.h b/src/basic/vx_log/logger.h
index 7f0e2ca95a..d88333e98b 100644
--- a/src/basic/vx_log/logger.h
+++ b/src/basic/vx_log/logger.h
@@ -79,9 +79,9 @@ class MsgLevel
//////////////////////////////////////////////////////////////////
-inline int MsgLevel::value() const { return (Value); }
+inline int MsgLevel::value() const { return Value; }
-inline MsgLevel::operator const int & () const { return (Value); }
+inline MsgLevel::operator const int & () const { return Value; }
//////////////////////////////////////////////////////////////////
diff --git a/src/basic/vx_math/viewgravity_to_string.cc b/src/basic/vx_math/viewgravity_to_string.cc
index 63e499533b..78e4e5aad4 100644
--- a/src/basic/vx_math/viewgravity_to_string.cc
+++ b/src/basic/vx_math/viewgravity_to_string.cc
@@ -28,7 +28,6 @@
#include "viewgravity_to_string.h"
-
using namespace std;
diff --git a/src/basic/vx_util/GridTemplate.cc b/src/basic/vx_util/GridTemplate.cc
index 9534c81015..c2c21bf038 100644
--- a/src/basic/vx_util/GridTemplate.cc
+++ b/src/basic/vx_util/GridTemplate.cc
@@ -29,6 +29,7 @@
#include "vx_log.h"
#include "nint.h"
+#include "enum_as_int.hpp"
#include "GridTemplate.h"
#include "GridOffset.h"
@@ -591,11 +592,11 @@ void GridTemplate::_setEdgeOffsets() {
///////////////////////////////////////////////////////////////////////////////
GridTemplateFactory::GridTemplateFactory() {
- enum_to_string.resize(GridTemplate_NUM_TEMPLATES);
+ enum_to_string.resize(enum_class_as_int(GridTemplates::NUM_TEMPLATES));
- enum_to_string[GridTemplate_None] = "";
- enum_to_string[GridTemplate_Square] = "SQUARE";
- enum_to_string[GridTemplate_Circle] = "CIRCLE";
+ enum_to_string[enum_class_as_int(GridTemplates::None)] = "";
+ enum_to_string[enum_class_as_int(GridTemplates::Square)] = "SQUARE";
+ enum_to_string[enum_class_as_int(GridTemplates::Circle)] = "CIRCLE";
}
///////////////////////////////////////////////////////////////////////////////
@@ -612,7 +613,7 @@ GridTemplateFactory::~GridTemplateFactory() {
GridTemplateFactory::GridTemplates GridTemplateFactory::string2Enum(string target) {
- for(unsigned int ix = 0; ix < GridTemplate_NUM_TEMPLATES; ix++) {
+ for(unsigned int ix = 0; ix < enum_class_as_int(GridTemplates::NUM_TEMPLATES); ix++) {
if(enum_to_string[ix] == target) {
return static_cast(ix);
}
@@ -632,7 +633,7 @@ string GridTemplateFactory::enum2String(GridTemplates target) {
if(static_cast(target) > enum_to_string.size() - 1) {
mlog << Error << "\nGridTemplateFactory::enum2String() -> "
- << "target out of range " << target << " > "
+ << "target out of range " << enum_class_as_int(target) << " > "
<< (static_cast(enum_to_string.size()) - 1)
<< ".\n\n";
exit(1);
@@ -659,15 +660,15 @@ GridTemplate* GridTemplateFactory::buildGT(string gt, int width, bool wrap_lon)
GridTemplate* GridTemplateFactory::buildGT(GridTemplates gt, int width, bool wrap_lon) {
switch (gt) {
- case(GridTemplate_Square):
+ case GridTemplates::Square:
return new RectangularTemplate(width, width, wrap_lon);
- case(GridTemplate_Circle):
+ case GridTemplates::Circle:
return new CircularTemplate(width, wrap_lon);
default:
mlog << Error << "\nbuildGT() -> "
- << "Unexpected GridTemplates value (" << gt << ").\n\n";
+ << "Unexpected GridTemplates value (" << enum_class_as_int(gt) << ").\n\n";
exit(1);
}
}
diff --git a/src/basic/vx_util/GridTemplate.h b/src/basic/vx_util/GridTemplate.h
index 6682cc10af..ed58165f4d 100644
--- a/src/basic/vx_util/GridTemplate.h
+++ b/src/basic/vx_util/GridTemplate.h
@@ -158,12 +158,12 @@ class GridTemplateFactory {
// do not assign specific values to these enumes.
// other code requires them to start at zero and increase by 1
- // make sure GridTemplate_NUM_TEMPLATES is always last.
- enum GridTemplates {
- GridTemplate_None,
- GridTemplate_Square,
- GridTemplate_Circle,
- GridTemplate_NUM_TEMPLATES
+ // make sure GridTemplate::NUM_TEMPLATES is always last.
+ enum class GridTemplates {
+ None,
+ Square,
+ Circle,
+ NUM_TEMPLATES
};
// String corresponding to the enumerated values above
diff --git a/src/basic/vx_util/asciitablejust_to_string.cc b/src/basic/vx_util/asciitablejust_to_string.cc
index fa89d3958e..6bdf630114 100644
--- a/src/basic/vx_util/asciitablejust_to_string.cc
+++ b/src/basic/vx_util/asciitablejust_to_string.cc
@@ -6,6 +6,7 @@
// ** P.O.Box 3000, Boulder, Colorado, 80307-3000, USA
// *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
+
////////////////////////////////////////////////////////////////////////
@@ -27,7 +28,6 @@
#include "asciitablejust_to_string.h"
-
using namespace std;
diff --git a/src/basic/vx_util/data_plane_util.cc b/src/basic/vx_util/data_plane_util.cc
index 233b3b6293..f07da09913 100644
--- a/src/basic/vx_util/data_plane_util.cc
+++ b/src/basic/vx_util/data_plane_util.cc
@@ -18,6 +18,7 @@
#include "omp.h"
#endif
+#include "config_util.h"
#include "data_plane_util.h"
#include "interp_util.h"
#include "two_to_one.h"
@@ -25,6 +26,7 @@
#include "vx_gsl_prob.h"
#include "vx_math.h"
#include "vx_log.h"
+#include "enum_as_int.hpp"
#include "GridTemplate.h"
@@ -36,6 +38,7 @@ using namespace std;
//
////////////////////////////////////////////////////////////////////////
+
////////////////////////////////////////////////////////////////////////
//
// Check the range of probability values and make sure it's either
@@ -106,7 +109,7 @@ void smooth_field(const DataPlane &dp, DataPlane &smooth_dp,
smooth_dp = dp;
// For nearest neighbor, no work to do.
- if(width == 1 && mthd == InterpMthd_Nearest) return;
+ if(width == 1 && mthd == InterpMthd::Nearest) return;
// build the grid template
GridTemplateFactory gtf;
@@ -125,27 +128,27 @@ void smooth_field(const DataPlane &dp, DataPlane &smooth_dp,
// Compute the smoothed value based on the interpolation method
switch(mthd) {
- case(InterpMthd_Min): // Minimum
+ case InterpMthd::Min: // Minimum
v = interp_min(dp, *gt, x, y, t);
break;
- case(InterpMthd_Max): // Maximum
+ case InterpMthd::Max: // Maximum
v = interp_max(dp, *gt, x, y, t);
break;
- case(InterpMthd_Median): // Median
+ case InterpMthd::Median: // Median
v = interp_median(dp, *gt, x, y, t);
break;
- case(InterpMthd_UW_Mean): // Unweighted Mean
+ case InterpMthd::UW_Mean: // Unweighted Mean
v = interp_uw_mean(dp, *gt, x, y, t);
break;
- case(InterpMthd_Gaussian): // For Gaussian, pass the data through
+ case InterpMthd::Gaussian: // For Gaussian, pass the data through
v = dp.get(x, y);
break;
- case(InterpMthd_MaxGauss): // For Max Gaussian, compute the max
+ case InterpMthd::MaxGauss: // For Max Gaussian, compute the max
v = interp_max(dp, *gt, x, y, 0);
break;
@@ -156,7 +159,7 @@ void smooth_field(const DataPlane &dp, DataPlane &smooth_dp,
default:
mlog << Error << "\nsmooth_field() -> "
<< "unsupported interpolation method encountered: "
- << interpmthd_to_string(mthd) << "(" << mthd
+ << interpmthd_to_string(mthd) << "(" << enum_class_as_int(mthd)
<< ")\n\n";
exit(1);
}
@@ -168,8 +171,8 @@ void smooth_field(const DataPlane &dp, DataPlane &smooth_dp,
} // end for x
// Apply the Gaussian smoother
- if(mthd == InterpMthd_Gaussian ||
- mthd == InterpMthd_MaxGauss) {
+ if(mthd == InterpMthd::Gaussian ||
+ mthd == InterpMthd::MaxGauss) {
interp_gaussian_dp(smooth_dp, gaussian, t);
}
@@ -265,7 +268,7 @@ void fractional_coverage(const DataPlane &dp, DataPlane &frac_dp,
mlog << Debug(3)
<< "Computing fractional coverage field using the "
<< t.get_str() << " threshold and the "
- << interpmthd_to_string(InterpMthd_Nbrhd) << "(" << gt->size()
+ << interpmthd_to_string(InterpMthd::Nbrhd) << "(" << gt->size()
<< ") " << gt->getClassName() << " interpolation method.\n";
// Initialize the fractional coverage field
diff --git a/src/basic/vx_util/interp_mthd.cc b/src/basic/vx_util/interp_mthd.cc
index ba55b07da3..afb04be803 100644
--- a/src/basic/vx_util/interp_mthd.cc
+++ b/src/basic/vx_util/interp_mthd.cc
@@ -24,29 +24,29 @@ ConcatString interpmthd_to_string(const InterpMthd m) {
ConcatString out;
switch(m) {
- case(InterpMthd_Min): out = interpmthd_min_str; break;
- case(InterpMthd_Max): out = interpmthd_max_str; break;
- case(InterpMthd_Median): out = interpmthd_median_str; break;
- case(InterpMthd_UW_Mean): out = interpmthd_uw_mean_str; break;
- case(InterpMthd_DW_Mean): out = interpmthd_dw_mean_str; break;
- case(InterpMthd_AW_Mean): out = interpmthd_aw_mean_str; break;
- case(InterpMthd_LS_Fit): out = interpmthd_ls_fit_str; break;
- case(InterpMthd_Nbrhd): out = interpmthd_nbrhd_str; break;
- case(InterpMthd_Bilin): out = interpmthd_bilin_str; break;
- case(InterpMthd_Nearest): out = interpmthd_nearest_str; break;
- case(InterpMthd_Budget): out = interpmthd_budget_str; break;
- case(InterpMthd_Force): out = interpmthd_force_str; break;
- case(InterpMthd_Best): out = interpmthd_best_str; break;
- case(InterpMthd_Upper_Left): out = interpmthd_upper_left_str; break;
- case(InterpMthd_Upper_Right): out = interpmthd_upper_right_str; break;
- case(InterpMthd_Lower_Right): out = interpmthd_lower_right_str; break;
- case(InterpMthd_Lower_Left): out = interpmthd_lower_left_str; break;
- case(InterpMthd_Gaussian): out = interpmthd_gaussian_str; break;
- case(InterpMthd_MaxGauss): out = interpmthd_maxgauss_str; break;
- case(InterpMthd_Geog_Match): out = interpmthd_geog_match_str; break;
- case(InterpMthd_HiRA): out = interpmthd_hira_str; break;
+ case InterpMthd::Min: out = interpmthd_min_str; break;
+ case InterpMthd::Max: out = interpmthd_max_str; break;
+ case InterpMthd::Median: out = interpmthd_median_str; break;
+ case InterpMthd::UW_Mean: out = interpmthd_uw_mean_str; break;
+ case InterpMthd::DW_Mean: out = interpmthd_dw_mean_str; break;
+ case InterpMthd::AW_Mean: out = interpmthd_aw_mean_str; break;
+ case InterpMthd::LS_Fit: out = interpmthd_ls_fit_str; break;
+ case InterpMthd::Nbrhd: out = interpmthd_nbrhd_str; break;
+ case InterpMthd::Bilin: out = interpmthd_bilin_str; break;
+ case InterpMthd::Nearest: out = interpmthd_nearest_str; break;
+ case InterpMthd::Budget: out = interpmthd_budget_str; break;
+ case InterpMthd::Force: out = interpmthd_force_str; break;
+ case InterpMthd::Best: out = interpmthd_best_str; break;
+ case InterpMthd::Upper_Left: out = interpmthd_upper_left_str; break;
+ case InterpMthd::Upper_Right: out = interpmthd_upper_right_str; break;
+ case InterpMthd::Lower_Right: out = interpmthd_lower_right_str; break;
+ case InterpMthd::Lower_Left: out = interpmthd_lower_left_str; break;
+ case InterpMthd::Gaussian: out = interpmthd_gaussian_str; break;
+ case InterpMthd::MaxGauss: out = interpmthd_maxgauss_str; break;
+ case InterpMthd::Geog_Match: out = interpmthd_geog_match_str; break;
+ case InterpMthd::HiRA: out = interpmthd_hira_str; break;
- case(InterpMthd_None):
+ case InterpMthd::None:
default: out = interpmthd_none_str; break;
} // switch
@@ -58,28 +58,28 @@ ConcatString interpmthd_to_string(const InterpMthd m) {
InterpMthd string_to_interpmthd(const char *mthd_str) {
InterpMthd m;
- if(strcmp(mthd_str, interpmthd_min_str) == 0) m = InterpMthd_Min;
- else if(strcmp(mthd_str, interpmthd_max_str) == 0) m = InterpMthd_Max;
- else if(strcmp(mthd_str, interpmthd_median_str) == 0) m = InterpMthd_Median;
- else if(strcmp(mthd_str, interpmthd_uw_mean_str) == 0) m = InterpMthd_UW_Mean;
- else if(strcmp(mthd_str, interpmthd_dw_mean_str) == 0) m = InterpMthd_DW_Mean;
- else if(strcmp(mthd_str, interpmthd_aw_mean_str) == 0) m = InterpMthd_AW_Mean;
- else if(strcmp(mthd_str, interpmthd_ls_fit_str) == 0) m = InterpMthd_LS_Fit;
- else if(strcmp(mthd_str, interpmthd_nbrhd_str) == 0) m = InterpMthd_Nbrhd;
- else if(strcmp(mthd_str, interpmthd_bilin_str) == 0) m = InterpMthd_Bilin;
- else if(strcmp(mthd_str, interpmthd_nearest_str) == 0) m = InterpMthd_Nearest;
- else if(strcmp(mthd_str, interpmthd_budget_str) == 0) m = InterpMthd_Budget;
- else if(strcmp(mthd_str, interpmthd_force_str) == 0) m = InterpMthd_Force;
- else if(strcmp(mthd_str, interpmthd_best_str) == 0) m = InterpMthd_Best;
- else if(strcmp(mthd_str, interpmthd_upper_left_str) == 0) m = InterpMthd_Upper_Left;
- else if(strcmp(mthd_str, interpmthd_upper_right_str) == 0) m = InterpMthd_Upper_Right;
- else if(strcmp(mthd_str, interpmthd_lower_right_str) == 0) m = InterpMthd_Lower_Right;
- else if(strcmp(mthd_str, interpmthd_lower_left_str) == 0) m = InterpMthd_Lower_Left;
- else if(strcmp(mthd_str, interpmthd_gaussian_str ) == 0) m = InterpMthd_Gaussian;
- else if(strcmp(mthd_str, interpmthd_maxgauss_str ) == 0) m = InterpMthd_MaxGauss;
- else if(strcmp(mthd_str, interpmthd_geog_match_str) == 0) m = InterpMthd_Geog_Match;
- else if(strcmp(mthd_str, interpmthd_hira_str) == 0) m = InterpMthd_HiRA;
- else m = InterpMthd_None;
+ if(strcmp(mthd_str, interpmthd_min_str) == 0) m = InterpMthd::Min;
+ else if(strcmp(mthd_str, interpmthd_max_str) == 0) m = InterpMthd::Max;
+ else if(strcmp(mthd_str, interpmthd_median_str) == 0) m = InterpMthd::Median;
+ else if(strcmp(mthd_str, interpmthd_uw_mean_str) == 0) m = InterpMthd::UW_Mean;
+ else if(strcmp(mthd_str, interpmthd_dw_mean_str) == 0) m = InterpMthd::DW_Mean;
+ else if(strcmp(mthd_str, interpmthd_aw_mean_str) == 0) m = InterpMthd::AW_Mean;
+ else if(strcmp(mthd_str, interpmthd_ls_fit_str) == 0) m = InterpMthd::LS_Fit;
+ else if(strcmp(mthd_str, interpmthd_nbrhd_str) == 0) m = InterpMthd::Nbrhd;
+ else if(strcmp(mthd_str, interpmthd_bilin_str) == 0) m = InterpMthd::Bilin;
+ else if(strcmp(mthd_str, interpmthd_nearest_str) == 0) m = InterpMthd::Nearest;
+ else if(strcmp(mthd_str, interpmthd_budget_str) == 0) m = InterpMthd::Budget;
+ else if(strcmp(mthd_str, interpmthd_force_str) == 0) m = InterpMthd::Force;
+ else if(strcmp(mthd_str, interpmthd_best_str) == 0) m = InterpMthd::Best;
+ else if(strcmp(mthd_str, interpmthd_upper_left_str) == 0) m = InterpMthd::Upper_Left;
+ else if(strcmp(mthd_str, interpmthd_upper_right_str) == 0) m = InterpMthd::Upper_Right;
+ else if(strcmp(mthd_str, interpmthd_lower_right_str) == 0) m = InterpMthd::Lower_Right;
+ else if(strcmp(mthd_str, interpmthd_lower_left_str) == 0) m = InterpMthd::Lower_Left;
+ else if(strcmp(mthd_str, interpmthd_gaussian_str ) == 0) m = InterpMthd::Gaussian;
+ else if(strcmp(mthd_str, interpmthd_maxgauss_str ) == 0) m = InterpMthd::MaxGauss;
+ else if(strcmp(mthd_str, interpmthd_geog_match_str) == 0) m = InterpMthd::Geog_Match;
+ else if(strcmp(mthd_str, interpmthd_hira_str) == 0) m = InterpMthd::HiRA;
+ else m = InterpMthd::None;
return m;
}
diff --git a/src/basic/vx_util/interp_mthd.h b/src/basic/vx_util/interp_mthd.h
index 0f061241e1..b5468168ed 100644
--- a/src/basic/vx_util/interp_mthd.h
+++ b/src/basic/vx_util/interp_mthd.h
@@ -21,29 +21,29 @@
//
// Enumeration for interpolation methods
//
-enum InterpMthd {
- InterpMthd_None,
- InterpMthd_Min,
- InterpMthd_Max,
- InterpMthd_Median,
- InterpMthd_UW_Mean,
- InterpMthd_DW_Mean,
- InterpMthd_AW_Mean,
- InterpMthd_LS_Fit,
- InterpMthd_Nbrhd,
- InterpMthd_Bilin,
- InterpMthd_Nearest,
- InterpMthd_Budget,
- InterpMthd_Force,
- InterpMthd_Best,
- InterpMthd_Upper_Left,
- InterpMthd_Upper_Right,
- InterpMthd_Lower_Right,
- InterpMthd_Lower_Left,
- InterpMthd_Gaussian,
- InterpMthd_MaxGauss,
- InterpMthd_Geog_Match,
- InterpMthd_HiRA
+enum class InterpMthd {
+ None,
+ Min,
+ Max,
+ Median,
+ UW_Mean,
+ DW_Mean,
+ AW_Mean,
+ LS_Fit,
+ Nbrhd,
+ Bilin,
+ Nearest,
+ Budget,
+ Force,
+ Best,
+ Upper_Left,
+ Upper_Right,
+ Lower_Right,
+ Lower_Left,
+ Gaussian,
+ MaxGauss,
+ Geog_Match,
+ HiRA
};
//
diff --git a/src/basic/vx_util/interp_util.cc b/src/basic/vx_util/interp_util.cc
index 826c396e1e..b5cb88c412 100644
--- a/src/basic/vx_util/interp_util.cc
+++ b/src/basic/vx_util/interp_util.cc
@@ -16,12 +16,14 @@
#include
#include
+#include "config_util.h"
#include "interp_util.h"
#include "GridTemplate.h"
#include "RectangularTemplate.h"
#include "vx_math.h"
#include "vx_log.h"
+#include "enum_as_int.hpp"
using namespace std;
@@ -958,68 +960,68 @@ double compute_sfc_interp(const DataPlane &dp,
// Compute the interpolated value for the fields above and below
switch(mthd) {
- case(InterpMthd_Min): // Minimum
+ case InterpMthd::Min: // Minimum
v = interp_min(dp, *gt, x, y, interp_thresh, &sfc_mask);
break;
- case(InterpMthd_Max): // Maximum
+ case InterpMthd::Max: // Maximum
v = interp_max(dp, *gt, x, y, interp_thresh, &sfc_mask);
break;
- case(InterpMthd_Median): // Median
+ case InterpMthd::Median: // Median
v = interp_median(dp, *gt, x, y, interp_thresh, &sfc_mask);
break;
- case(InterpMthd_UW_Mean): // Unweighted Mean
+ case InterpMthd::UW_Mean: // Unweighted Mean
v = interp_uw_mean(dp, *gt, x, y, interp_thresh, &sfc_mask);
break;
- case(InterpMthd_DW_Mean): // Distance-Weighted Mean
+ case InterpMthd::DW_Mean: // Distance-Weighted Mean
v = interp_dw_mean(dp, *gt, obs_x, obs_y,
dw_mean_pow, interp_thresh, &sfc_mask);
break;
- case(InterpMthd_LS_Fit): // Least-squares fit
+ case InterpMthd::LS_Fit: // Least-squares fit
v = interp_ls_fit(dp, *gt, obs_x, obs_y,
interp_thresh, &sfc_mask);
break;
- case(InterpMthd_Bilin): // Bilinear interpolation
+ case InterpMthd::Bilin: // Bilinear interpolation
v = interp_bilin(dp, wrap_lon, obs_x, obs_y, &sfc_mask);
break;
- case(InterpMthd_Nearest): // Nearest Neighbor
+ case InterpMthd::Nearest: // Nearest Neighbor
v = interp_xy(dp, wrap_lon, x, y, &sfc_mask);
break;
- case(InterpMthd_Best): // Best Match
+ case InterpMthd::Best: // Best Match
v = interp_best(dp, *gt, x, y, obs_v, interp_thresh, &sfc_mask);
break;
- case(InterpMthd_Upper_Left): // Upper Left corner of the grid box
+ case InterpMthd::Upper_Left: // Upper Left corner of the grid box
v = interp_xy(dp, wrap_lon, floor(obs_x), ceil(obs_y), &sfc_mask);
break;
- case(InterpMthd_Upper_Right): // Upper Right corner of the grid box
+ case InterpMthd::Upper_Right: // Upper Right corner of the grid box
v = interp_xy(dp, wrap_lon, ceil(obs_x), ceil(obs_y), &sfc_mask);
break;
- case(InterpMthd_Lower_Right): // Lower Right corner of the grid box
+ case InterpMthd::Lower_Right: // Lower Right corner of the grid box
v = interp_xy(dp, wrap_lon, ceil(obs_x), floor(obs_y), &sfc_mask);
break;
- case(InterpMthd_Lower_Left): // Lower Left corner of the grid box
+ case InterpMthd::Lower_Left: // Lower Left corner of the grid box
v = interp_xy(dp, wrap_lon, floor(obs_x), floor(obs_y), &sfc_mask);
break;
- case(InterpMthd_Geog_Match): // Geography Match for surface point verification
+ case InterpMthd::Geog_Match: // Geography Match for surface point verification
v = interp_geog_match(dp, *gt, obs_x, obs_y, obs_v, &sfc_mask);
break;
default:
mlog << Error << "\ncompute_sfc_interp() -> "
<< "unsupported interpolation method encountered: "
- << interpmthd_to_string(mthd) << "(" << mthd << ")\n\n";
+ << interpmthd_to_string(mthd) << "(" << enum_class_as_int(mthd) << ")\n\n";
exit(1);
}
@@ -1127,73 +1129,73 @@ double compute_horz_interp(const DataPlane &dp,
// Compute the interpolated value for the fields above and below
switch(mthd) {
- case(InterpMthd_Min): // Minimum
+ case InterpMthd::Min: // Minimum
v = interp_min(dp, *gt, x, y, interp_thresh);
break;
- case(InterpMthd_Max): // Maximum
+ case InterpMthd::Max: // Maximum
v = interp_max(dp, *gt, x, y, interp_thresh);
break;
- case(InterpMthd_Median): // Median
+ case InterpMthd::Median: // Median
v = interp_median(dp, *gt, x, y, interp_thresh);
break;
- case(InterpMthd_UW_Mean): // Unweighted Mean
+ case InterpMthd::UW_Mean: // Unweighted Mean
v = interp_uw_mean(dp, *gt, x, y, interp_thresh);
break;
- case(InterpMthd_DW_Mean): // Distance-Weighted Mean
+ case InterpMthd::DW_Mean: // Distance-Weighted Mean
v = interp_dw_mean(dp, *gt, obs_x, obs_y,
dw_mean_pow, interp_thresh);
break;
- case(InterpMthd_LS_Fit): // Least-squares fit
+ case InterpMthd::LS_Fit: // Least-squares fit
v = interp_ls_fit(dp, *gt, obs_x, obs_y,
interp_thresh);
break;
- case(InterpMthd_Nbrhd): // Neighborhood fractional coverage
+ case InterpMthd::Nbrhd: // Neighborhood fractional coverage
v = interp_nbrhd(dp, *gt, x, y,
interp_thresh, cat_thresh, cmn, csd);
break;
- case(InterpMthd_Bilin): // Bilinear interpolation
+ case InterpMthd::Bilin: // Bilinear interpolation
v = interp_bilin(dp, wrap_lon, obs_x, obs_y);
break;
- case(InterpMthd_Nearest): // Nearest Neighbor
+ case InterpMthd::Nearest: // Nearest Neighbor
v = interp_xy(dp, wrap_lon, x, y);
break;
- case(InterpMthd_Best): // Best Match
+ case InterpMthd::Best: // Best Match
v = interp_best(dp, *gt, x, y, obs_v, interp_thresh);
break;
- case(InterpMthd_Upper_Left): // Upper Left corner of the grid box
+ case InterpMthd::Upper_Left: // Upper Left corner of the grid box
v = interp_xy(dp, wrap_lon, floor(obs_x), ceil(obs_y));
break;
- case(InterpMthd_Upper_Right): // Upper Right corner of the grid box
+ case InterpMthd::Upper_Right: // Upper Right corner of the grid box
v = interp_xy(dp, wrap_lon, ceil(obs_x), ceil(obs_y));
break;
- case(InterpMthd_Lower_Right): // Lower Right corner of the grid box
+ case InterpMthd::Lower_Right: // Lower Right corner of the grid box
v = interp_xy(dp, wrap_lon, ceil(obs_x), floor(obs_y));
break;
- case(InterpMthd_Lower_Left): // Lower Left corner of the grid box
+ case InterpMthd::Lower_Left: // Lower Left corner of the grid box
v = interp_xy(dp, wrap_lon, floor(obs_x), floor(obs_y));
break;
- case(InterpMthd_Geog_Match): // Geography Match for surface point verification
+ case InterpMthd::Geog_Match: // Geography Match for surface point verification
v = interp_geog_match(dp, *gt, obs_x, obs_y, obs_v);
break;
default:
mlog << Error << "\ncompute_horz_interp() -> "
<< "unsupported interpolation method encountered: "
- << interpmthd_to_string(mthd) << "(" << mthd << ")\n\n";
+ << interpmthd_to_string(mthd) << "(" << enum_class_as_int(mthd) << ")\n\n";
exit(1);
}
@@ -1308,37 +1310,37 @@ DataPlane valid_time_interp(const DataPlane &in1, const DataPlane &in2,
// Compute interpolation weights
switch(mthd) {
- case(InterpMthd_Min): // Minimum
- case(InterpMthd_Max): // Maximum
+ case InterpMthd::Min: // Minimum
+ case InterpMthd::Max: // Maximum
w1 = w2 = bad_data_double;
break;
- case(InterpMthd_UW_Mean): // Unweighted Mean
+ case InterpMthd::UW_Mean: // Unweighted Mean
w1 = w2 = 0.5;
break;
- case(InterpMthd_DW_Mean): // Distance-Weighted Mean
+ case InterpMthd::DW_Mean: // Distance-Weighted Mean
w1 = (double) (dp2.valid() - to_ut) /
(dp2.valid() - dp1.valid());
w2 = (double) (to_ut - dp1.valid()) /
(dp2.valid() - dp1.valid());
break;
- case(InterpMthd_Nearest): // Nearest Neighbor
+ case InterpMthd::Nearest: // Nearest Neighbor
use_min = ((to_ut - dp1.valid()) <=
(dp2.valid() - to_ut));
w1 = (use_min ? 1.0 : 0.0);
w2 = (use_min ? 0.0 : 1.0);
break;
- case(InterpMthd_AW_Mean): // Area-Weighted Mean
- case(InterpMthd_Median): // Median
- case(InterpMthd_LS_Fit): // Least-squares fit
- case(InterpMthd_Bilin): // Bilinear interpolation
+ case InterpMthd::AW_Mean: // Area-Weighted Mean
+ case InterpMthd::Median: // Median
+ case InterpMthd::LS_Fit: // Least-squares fit
+ case InterpMthd::Bilin: // Bilinear interpolation
default:
mlog << Error << "\nvalid_time_interp() -> "
<< "unsupported interpolation method encountered: "
- << interpmthd_to_string(mthd) << "(" << mthd << ")\n\n";
+ << interpmthd_to_string(mthd) << "(" << enum_class_as_int(mthd) << ")\n\n";
exit(1);
}
@@ -1360,11 +1362,11 @@ DataPlane valid_time_interp(const DataPlane &in1, const DataPlane &in2,
if(!is_bad_data(v1) && !is_bad_data(v2)) {
// Minimum
- if(mthd == InterpMthd_Min) v = min(v1, v2);
+ if(mthd == InterpMthd::Min) v = min(v1, v2);
// Maximum
- else if(mthd == InterpMthd_Max) v = max(v1, v2);
+ else if(mthd == InterpMthd::Max) v = max(v1, v2);
// Apply weights
- else v = w1*v1 + w2*v2;
+ else v = w1*v1 + w2*v2;
}
// Store interpolated value
diff --git a/src/basic/vx_util/normalize.cc b/src/basic/vx_util/normalize.cc
index 11e8e9a7d2..ab9669e0b8 100644
--- a/src/basic/vx_util/normalize.cc
+++ b/src/basic/vx_util/normalize.cc
@@ -14,7 +14,9 @@
#include
#include
+#include "config_util.h"
#include "normalize.h"
+#include "enum_as_int.hpp"
using namespace std;
@@ -26,29 +28,29 @@ ConcatString normalizetype_to_string(const NormalizeType type) {
// Convert enumerated NormalizeType to string
switch(type) {
- case NormalizeType_None:
+ case NormalizeType::None:
s = normalizetype_none_str;
break;
- case NormalizeType_ClimoAnom:
+ case NormalizeType::ClimoAnom:
s = normalizetype_climo_anom_str;
break;
- case NormalizeType_ClimoStdAnom:
+ case NormalizeType::ClimoStdAnom:
s = normalizetype_climo_std_anom_str;
break;
- case NormalizeType_FcstAnom:
+ case NormalizeType::FcstAnom:
s = normalizetype_fcst_anom_str;
break;
- case NormalizeType_FcstStdAnom:
+ case NormalizeType::FcstStdAnom:
s = normalizetype_fcst_std_anom_str;
break;
default:
mlog << Error << "\nnormalizetype_to_string() -> "
- << "Unexpected NormalizeType value of " << type << ".\n\n";
+ << "Unexpected NormalizeType value of " << enum_class_as_int(type) << ".\n\n";
exit(1);
}
@@ -67,10 +69,10 @@ void normalize_data(DataPlane &dp, const NormalizeType type,
// Supported types
switch(type) {
- case NormalizeType_None:
+ case NormalizeType::None:
break;
- case NormalizeType_ClimoAnom:
+ case NormalizeType::ClimoAnom:
if(!cmn_ptr || dp.nxy() != cmn_ptr->nxy()) {
mlog << Error << "\nnormalize_data() -> "
<< "the climatology mean is required for "
@@ -80,7 +82,7 @@ void normalize_data(DataPlane &dp, const NormalizeType type,
dp.anomaly(*cmn_ptr);
break;
- case NormalizeType_ClimoStdAnom:
+ case NormalizeType::ClimoStdAnom:
if(!cmn_ptr || dp.nxy() != cmn_ptr->nxy() ||
!csd_ptr || dp.nxy() != csd_ptr->nxy()) {
mlog << Error << "\nnormalize_data() -> "
@@ -91,7 +93,7 @@ void normalize_data(DataPlane &dp, const NormalizeType type,
dp.standard_anomaly(*cmn_ptr, *csd_ptr);
break;
- case NormalizeType_FcstAnom:
+ case NormalizeType::FcstAnom:
if(!fmn_ptr || dp.nxy() != fmn_ptr->nxy()) {
mlog << Error << "\nnormalize_data() -> "
<< "the forecast mean is required for "
@@ -101,7 +103,7 @@ void normalize_data(DataPlane &dp, const NormalizeType type,
dp.anomaly(*fmn_ptr);
break;
- case NormalizeType_FcstStdAnom:
+ case NormalizeType::FcstStdAnom:
if(!fmn_ptr || dp.nxy() != fmn_ptr->nxy() ||
!fsd_ptr || dp.nxy() != fsd_ptr->nxy()) {
mlog << Error << "\nnormalize_data() -> "
@@ -115,7 +117,7 @@ void normalize_data(DataPlane &dp, const NormalizeType type,
default:
mlog << Error << "\nnormalize_data() -> "
<< "unexpected NormalizeType value ("
- << type << ")\n\n";
+ << enum_class_as_int(type) << ")\n\n";
exit(1);
} // end switch
diff --git a/src/basic/vx_util/normalize.h b/src/basic/vx_util/normalize.h
index b91fa45476..96fc32bc03 100644
--- a/src/basic/vx_util/normalize.h
+++ b/src/basic/vx_util/normalize.h
@@ -22,12 +22,12 @@
// Enumeration for normalization types
//
-enum NormalizeType {
- NormalizeType_None, // No normalization
- NormalizeType_ClimoAnom, // Subtract climo mean
- NormalizeType_ClimoStdAnom, // Subtract climo mean and divide stdev
- NormalizeType_FcstAnom, // Subtract fcst mean
- NormalizeType_FcstStdAnom // Subtract fcst mean and divide stdev
+enum class NormalizeType {
+ None, // No normalization
+ ClimoAnom, // Subtract climo mean
+ ClimoStdAnom, // Subtract climo mean and divide stdev
+ FcstAnom, // Subtract fcst mean
+ FcstStdAnom // Subtract fcst mean and divide stdev
};
///////////////////////////////////////////////////////////////////////////////
diff --git a/src/basic/vx_util/util_constants.h b/src/basic/vx_util/util_constants.h
index f80be6f21c..e2520efd18 100644
--- a/src/basic/vx_util/util_constants.h
+++ b/src/basic/vx_util/util_constants.h
@@ -95,10 +95,6 @@ static const char ws_reg_exp[] = "[ \t\r\n]";
static const char ws_line_reg_exp[] = "^[ \t\r\n]*$";
static const char sep_str[] = "--------------------------------------------------------------------------------";
-// Bootstrap methods
-static const int boot_bca_flag = 0;
-static const int boot_perc_flag = 1;
-
////////////////////////////////////////////////////////////////////////
static const int max_line_len = 2048;
diff --git a/src/libcode/vx_afm/afmtokentype_to_string.cc b/src/libcode/vx_afm/afmtokentype_to_string.cc
index 03ee5c72d4..5d04baffd9 100644
--- a/src/libcode/vx_afm/afmtokentype_to_string.cc
+++ b/src/libcode/vx_afm/afmtokentype_to_string.cc
@@ -28,7 +28,6 @@
#include "afmtokentype_to_string.h"
-
using namespace std;
diff --git a/src/libcode/vx_analysis_util/stat_job.cc b/src/libcode/vx_analysis_util/stat_job.cc
index f5ead39e40..573c0f43d6 100644
--- a/src/libcode/vx_analysis_util/stat_job.cc
+++ b/src/libcode/vx_analysis_util/stat_job.cc
@@ -22,6 +22,7 @@
#include "vx_statistics.h"
#include "vx_math.h"
#include "vx_log.h"
+#include "enum_as_int.hpp"
using namespace std;
@@ -110,7 +111,7 @@ void STATAnalysisJob::clear() {
precision = default_precision;
- job_type = no_stat_job_type;
+ job_type = STATJobType::None;
model.clear();
desc.clear();
@@ -158,7 +159,7 @@ void STATAnalysisJob::clear() {
obs_thresh.clear();
cov_thresh.clear();
- thresh_logic = SetLogic_None;
+ thresh_logic = SetLogic::None;
alpha.clear();
@@ -192,14 +193,14 @@ void STATAnalysisJob::clear() {
out_fcst_thresh.clear();
out_obs_thresh.clear();
- out_cnt_logic = SetLogic_Union;
+ out_cnt_logic = SetLogic::Union;
out_fcst_wind_thresh.clear();
out_obs_wind_thresh.clear();
- out_wind_logic = SetLogic_Union;
+ out_wind_logic = SetLogic::Union;
out_alpha = bad_data_double;
- boot_interval = bad_data_int;
+ boot_interval = BootIntervalType::None;
boot_rep_prop = bad_data_double;
n_boot_rep = bad_data_int;
@@ -621,7 +622,7 @@ void STATAnalysisJob::dump(ostream & out, int depth) const {
<< swing_width << "\n";
out << prefix << "boot_interval = "
- << boot_interval << "\n";
+ << bootintervaltype_to_string(boot_interval) << "\n";
out << prefix << "boot_rep_prop = "
<< boot_rep_prop << "\n";
@@ -942,7 +943,7 @@ int STATAnalysisJob::is_keeper(const STATLine & L) const {
//
// thresh_logic
//
- if(thresh_logic != SetLogic_None &&
+ if(thresh_logic != SetLogic::None &&
thresh_logic != L.thresh_logic()) return 0;
//
@@ -1003,7 +1004,7 @@ int STATAnalysisJob::is_keeper(const STATLine & L) const {
//
// For MPR lines, check mask_grid, mask_poly, and mask_sid
//
- if(string_to_statlinetype(L.line_type()) == stat_mpr) {
+ if(string_to_statlinetype(L.line_type()) == STATLineType::mpr) {
double lat = atof(L.get_item("OBS_LAT"));
double lon = atof(L.get_item("OBS_LON"));
@@ -1592,7 +1593,7 @@ void STATAnalysisJob::parse_job_command(const char *jobstring) {
i++;
}
else if(jc_array[i] == "-boot_interval") {
- boot_interval = atoi(jc_array[i+1].c_str());
+ boot_interval = string_to_bootintervaltype(jc_array[i+1].c_str());
i++;
}
else if(jc_array[i] == "-boot_rep_prop") {
@@ -1704,8 +1705,8 @@ int STATAnalysisJob::set_job_type(const char *c) {
job_type = string_to_statjobtype(c);
- if(job_type == no_stat_job_type) return 1;
- else return 0;
+ if(job_type == STATJobType::None) return 1;
+ else return 0;
}
////////////////////////////////////////////////////////////////////////
@@ -1964,7 +1965,7 @@ void STATAnalysisJob::setup_stat_file(int n_row, int n) {
out_sa = (out_line_type.n() > 0 ?
out_line_type : line_type);
out_lt = (out_sa.n() == 1 ?
- string_to_statlinetype(out_sa[0].c_str()) : no_stat_line_type);
+ string_to_statlinetype(out_sa[0].c_str()) : STATLineType::none);
//
// Loop through the output line types and determine the number of
@@ -1973,38 +1974,38 @@ void STATAnalysisJob::setup_stat_file(int n_row, int n) {
for(i=0, c=0, n_col=0; i "
<< "unexpected stat line type \"" << statlinetype_to_string(cur_lt)
@@ -2044,44 +2045,44 @@ void STATAnalysisJob::setup_stat_file(int n_row, int n) {
// Write the STAT header row
//
switch(out_lt) {
- case stat_sl1l2: write_header_row (sl1l2_columns, n_sl1l2_columns, 1, stat_at, 0, 0); break;
- case stat_sal1l2: write_header_row (sal1l2_columns, n_sal1l2_columns, 1, stat_at, 0, 0); break;
- case stat_vl1l2: write_header_row (vl1l2_columns, n_vl1l2_columns, 1, stat_at, 0, 0); break;
- case stat_val1l2: write_header_row (val1l2_columns, n_val1l2_columns, 1, stat_at, 0, 0); break;
- case stat_fho: write_header_row (fho_columns, n_fho_columns, 1, stat_at, 0, 0); break;
- case stat_ctc: write_header_row (ctc_columns, n_ctc_columns, 1, stat_at, 0, 0); break;
- case stat_cts: write_header_row (cts_columns, n_cts_columns, 1, stat_at, 0, 0); break;
- case stat_mctc: write_mctc_header_row (1, n, stat_at, 0, 0); break;
- case stat_mcts: write_header_row (mcts_columns, n_mcts_columns, 1, stat_at, 0, 0); break;
- case stat_cnt: write_header_row (cnt_columns, n_cnt_columns, 1, stat_at, 0, 0); break;
- case stat_vcnt: write_header_row (vcnt_columns, n_vcnt_columns, 1, stat_at, 0, 0); break;
- case stat_pct: write_pct_header_row (1, n, stat_at, 0, 0); break;
- case stat_pstd: write_pstd_header_row (1, n, stat_at, 0, 0); break;
- case stat_pjc: write_pjc_header_row (1, n, stat_at, 0, 0); break;
- case stat_prc: write_prc_header_row (1, n, stat_at, 0, 0); break;
- case stat_eclv: write_eclv_header_row (1, n, stat_at, 0, 0); break;
- case stat_mpr: write_header_row (mpr_columns, n_mpr_columns, 1, stat_at, 0, 0); break;
- case stat_nbrctc: write_header_row (nbrctc_columns, n_nbrctc_columns, 1, stat_at, 0, 0); break;
- case stat_nbrcts: write_header_row (nbrcts_columns, n_nbrcts_columns, 1, stat_at, 0, 0); break;
- case stat_nbrcnt: write_header_row (nbrcnt_columns, n_nbrcnt_columns, 1, stat_at, 0, 0); break;
- case stat_grad: write_header_row (grad_columns, n_grad_columns, 1, stat_at, 0, 0); break;
- case stat_isc: write_header_row (isc_columns, n_isc_columns, 1, stat_at, 0, 0); break;
- case stat_wdir: write_header_row (job_wdir_columns, n_job_wdir_columns, 1, stat_at, 0, 0); break;
- case stat_ecnt: write_header_row (ecnt_columns, n_ecnt_columns, 1, stat_at, 0, 0); break;
- case stat_rps: write_header_row (rps_columns, n_rps_columns, 1, stat_at, 0, 0); break;
- case stat_rhist: write_rhist_header_row (1, n, stat_at, 0, 0); break;
- case stat_phist: write_phist_header_row (1, n, stat_at, 0, 0); break;
- case stat_relp: write_relp_header_row (1, n, stat_at, 0, 0); break;
- case stat_orank: write_header_row (orank_columns, n_orank_columns, 1, stat_at, 0, 0); break;
- case stat_ssvar: write_header_row (ssvar_columns, n_ssvar_columns, 1, stat_at, 0, 0); break;
- case stat_genmpr: write_header_row (genmpr_columns, n_genmpr_columns, 1, stat_at, 0, 0); break;
- case stat_ssidx: write_header_row (ssidx_columns, n_ssidx_columns, 1, stat_at, 0, 0); break;
+ case STATLineType::sl1l2: write_header_row (sl1l2_columns, n_sl1l2_columns, 1, stat_at, 0, 0); break;
+ case STATLineType::sal1l2: write_header_row (sal1l2_columns, n_sal1l2_columns, 1, stat_at, 0, 0); break;
+ case STATLineType::vl1l2: write_header_row (vl1l2_columns, n_vl1l2_columns, 1, stat_at, 0, 0); break;
+ case STATLineType::val1l2: write_header_row (val1l2_columns, n_val1l2_columns, 1, stat_at, 0, 0); break;
+ case STATLineType::fho: write_header_row (fho_columns, n_fho_columns, 1, stat_at, 0, 0); break;
+ case STATLineType::ctc: write_header_row (ctc_columns, n_ctc_columns, 1, stat_at, 0, 0); break;
+ case STATLineType::cts: write_header_row (cts_columns, n_cts_columns, 1, stat_at, 0, 0); break;
+ case STATLineType::mctc: write_mctc_header_row (1, n, stat_at, 0, 0); break;
+ case STATLineType::mcts: write_header_row (mcts_columns, n_mcts_columns, 1, stat_at, 0, 0); break;
+ case STATLineType::cnt: write_header_row (cnt_columns, n_cnt_columns, 1, stat_at, 0, 0); break;
+ case STATLineType::vcnt: write_header_row (vcnt_columns, n_vcnt_columns, 1, stat_at, 0, 0); break;
+ case STATLineType::pct: write_pct_header_row (1, n, stat_at, 0, 0); break;
+ case STATLineType::pstd: write_pstd_header_row (1, n, stat_at, 0, 0); break;
+ case STATLineType::pjc: write_pjc_header_row (1, n, stat_at, 0, 0); break;
+ case STATLineType::prc: write_prc_header_row (1, n, stat_at, 0, 0); break;
+ case STATLineType::eclv: write_eclv_header_row (1, n, stat_at, 0, 0); break;
+ case STATLineType::mpr: write_header_row (mpr_columns, n_mpr_columns, 1, stat_at, 0, 0); break;
+ case STATLineType::nbrctc: write_header_row (nbrctc_columns, n_nbrctc_columns, 1, stat_at, 0, 0); break;
+ case STATLineType::nbrcts: write_header_row (nbrcts_columns, n_nbrcts_columns, 1, stat_at, 0, 0); break;
+ case STATLineType::nbrcnt: write_header_row (nbrcnt_columns, n_nbrcnt_columns, 1, stat_at, 0, 0); break;
+ case STATLineType::grad: write_header_row (grad_columns, n_grad_columns, 1, stat_at, 0, 0); break;
+ case STATLineType::isc: write_header_row (isc_columns, n_isc_columns, 1, stat_at, 0, 0); break;
+ case STATLineType::wdir: write_header_row (job_wdir_columns, n_job_wdir_columns, 1, stat_at, 0, 0); break;
+ case STATLineType::ecnt: write_header_row (ecnt_columns, n_ecnt_columns, 1, stat_at, 0, 0); break;
+ case STATLineType::rps: write_header_row (rps_columns, n_rps_columns, 1, stat_at, 0, 0); break;
+ case STATLineType::rhist: write_rhist_header_row (1, n, stat_at, 0, 0); break;
+ case STATLineType::phist: write_phist_header_row (1, n, stat_at, 0, 0); break;
+ case STATLineType::relp: write_relp_header_row (1, n, stat_at, 0, 0); break;
+ case STATLineType::orank: write_header_row (orank_columns, n_orank_columns, 1, stat_at, 0, 0); break;
+ case STATLineType::ssvar: write_header_row (ssvar_columns, n_ssvar_columns, 1, stat_at, 0, 0); break;
+ case STATLineType::genmpr: write_header_row (genmpr_columns, n_genmpr_columns, 1, stat_at, 0, 0); break;
+ case STATLineType::ssidx: write_header_row (ssidx_columns, n_ssidx_columns, 1, stat_at, 0, 0); break;
//
// Write only header columns for unspecified line type
//
- case no_stat_line_type:
- write_header_row ((const char **) 0, 0, 1, stat_at, 0, 0); break;
+ case STATLineType::none:
+ write_header_row ((const char **) 0, 0, 1, stat_at, 0, 0); break;
default:
mlog << Error << "\nSTATAnalysisJob::setup_stat_file() -> "
@@ -2175,91 +2176,91 @@ void STATAnalysisJob::dump_stat_line(const STATLine &line,
if(line_type.n() == 1) {
switch(string_to_statlinetype(line_type[0].c_str())) {
- case(stat_fho):
+ case STATLineType::fho:
write_header_row(fho_columns, n_fho_columns, 1, dump_at, 0, 0);
break;
- case(stat_ctc):
+ case STATLineType::ctc:
write_header_row(ctc_columns, n_ctc_columns, 1, dump_at, 0, 0);
break;
- case(stat_cts):
+ case STATLineType::cts:
write_header_row(cts_columns, n_cts_columns, 1, dump_at, 0, 0);
break;
- case(stat_cnt):
+ case STATLineType::cnt:
write_header_row(cnt_columns, n_cnt_columns, 1, dump_at, 0, 0);
break;
- case(stat_sl1l2):
+ case STATLineType::sl1l2:
write_header_row(sl1l2_columns, n_sl1l2_columns, 1, dump_at, 0, 0);
break;
- case(stat_sal1l2):
+ case STATLineType::sal1l2:
write_header_row(sal1l2_columns, n_sal1l2_columns, 1, dump_at, 0, 0);
break;
- case(stat_vl1l2):
+ case STATLineType::vl1l2:
write_header_row(vl1l2_columns, n_vl1l2_columns, 1, dump_at, 0, 0);
break;
- case(stat_val1l2):
+ case STATLineType::val1l2:
write_header_row(val1l2_columns, n_val1l2_columns, 1, dump_at, 0, 0);
break;
- case(stat_mpr):
+ case STATLineType::mpr:
write_header_row(mpr_columns, n_mpr_columns, 1, dump_at, 0, 0);
break;
- case(stat_nbrctc):
+ case STATLineType::nbrctc:
write_header_row(nbrctc_columns, n_nbrctc_columns, 1, dump_at, 0, 0);
break;
- case(stat_nbrcts):
+ case STATLineType::nbrcts:
write_header_row(nbrcts_columns, n_nbrcts_columns, 1, dump_at, 0, 0);
break;
- case(stat_nbrcnt):
+ case STATLineType::nbrcnt:
write_header_row(nbrcnt_columns, n_nbrcnt_columns, 1, dump_at, 0, 0);
break;
- case(stat_grad):
+ case STATLineType::grad:
write_header_row(grad_columns, n_grad_columns, 1, dump_at, 0, 0);
break;
- case(stat_ecnt):
+ case STATLineType::ecnt:
write_header_row(ecnt_columns, n_ecnt_columns, 1, dump_at, 0, 0);
break;
- case(stat_isc):
+ case STATLineType::isc:
write_header_row(isc_columns, n_isc_columns, 1, dump_at, 0, 0);
break;
- case(stat_ssvar):
+ case STATLineType::ssvar:
write_header_row(ssvar_columns, n_ssvar_columns, 1, dump_at, 0, 0);
break;
- case(stat_seeps):
+ case STATLineType::seeps:
write_header_row(seeps_columns, n_seeps_columns, 1, dump_at, 0, 0);
break;
- case(stat_seeps_mpr):
+ case STATLineType::seeps_mpr:
write_header_row(seeps_mpr_columns, n_seeps_mpr_columns, 1, dump_at, 0, 0);
break;
// Just write a STAT header line for indeterminant line types
- case(stat_mctc):
- case(stat_mcts):
- case(stat_pct):
- case(stat_pstd):
- case(stat_pjc):
- case(stat_prc):
- case(stat_eclv):
- case(stat_rhist):
- case(stat_phist):
- case(stat_relp):
- case(stat_orank):
- case(stat_genmpr):
+ case STATLineType::mctc:
+ case STATLineType::mcts:
+ case STATLineType::pct:
+ case STATLineType::pstd:
+ case STATLineType::pjc:
+ case STATLineType::prc:
+ case STATLineType::eclv:
+ case STATLineType::rhist:
+ case STATLineType::phist:
+ case STATLineType::relp:
+ case STATLineType::orank:
+ case STATLineType::genmpr:
write_header_row((const char **) 0, 0, 1, dump_at, 0, 0);
break;
@@ -2347,7 +2348,7 @@ ConcatString STATAnalysisJob::get_jobstring() const {
js.clear();
// job type
- if(job_type != no_stat_job_type) {
+ if(job_type != STATJobType::None) {
js << "-job " << statjobtype_to_string(job_type) << " ";
}
@@ -2567,7 +2568,7 @@ ConcatString STATAnalysisJob::get_jobstring() const {
}
// thresh_logic
- if(thresh_logic != SetLogic_None) {
+ if(thresh_logic != SetLogic::None) {
js << "-thresh_logic " << setlogic_to_string(thresh_logic) << " ";
}
@@ -2690,7 +2691,7 @@ ConcatString STATAnalysisJob::get_jobstring() const {
}
// out_cnt_logic
- if(job_type == stat_job_aggr_stat &&
+ if(job_type == STATJobType::aggr_stat &&
line_type.has(stat_mpr_str) &&
(out_line_type.has(stat_cnt_str) || out_line_type.has(stat_sl1l2_str)) &&
(out_fcst_thresh.n() > 0 || out_obs_thresh.n() > 0)) {
@@ -2716,7 +2717,7 @@ ConcatString STATAnalysisJob::get_jobstring() const {
}
// out_wind_logic
- if(job_type == stat_job_aggr_stat &&
+ if(job_type == STATJobType::aggr_stat &&
line_type.has(stat_mpr_str) &&
out_line_type.has(stat_wdir_str) &&
(out_fcst_wind_thresh.get_type() != thresh_na ||
@@ -2725,7 +2726,7 @@ ConcatString STATAnalysisJob::get_jobstring() const {
}
// Jobs which use out_alpha
- if(job_type == stat_job_summary ||
+ if(job_type == STATJobType::summary ||
out_line_type.has(stat_cts_str) ||
out_line_type.has(stat_mcts_str) ||
out_line_type.has(stat_cnt_str) ||
@@ -2738,12 +2739,12 @@ ConcatString STATAnalysisJob::get_jobstring() const {
}
// Ramp jobs
- if(job_type == stat_job_ramp) {
+ if(job_type == STATJobType::ramp) {
// ramp_type
js << "-ramp_type " << timeseriestype_to_string(ramp_type) << " ";
- if(ramp_type == TimeSeriesType_DyDt) {
+ if(ramp_type == TimeSeriesType::DyDt) {
// ramp_time
if(ramp_time_fcst == ramp_time_obs) {
@@ -2767,7 +2768,7 @@ ConcatString STATAnalysisJob::get_jobstring() const {
}
}
- if(ramp_type == TimeSeriesType_Swing) {
+ if(ramp_type == TimeSeriesType::Swing) {
// swing_width
js << "-swing_width " << swing_width << " ";
@@ -2789,7 +2790,7 @@ ConcatString STATAnalysisJob::get_jobstring() const {
// Jobs which use out_bin_size
if(line_type.n() > 0) {
- if(string_to_statlinetype(line_type[0].c_str()) == stat_orank &&
+ if(string_to_statlinetype(line_type[0].c_str()) == STATLineType::orank &&
(out_line_type.has(stat_phist_str) ||
out_line_type.has(stat_ecnt_str))) {
@@ -2798,9 +2799,9 @@ ConcatString STATAnalysisJob::get_jobstring() const {
}
}
- // Jobs which use out_eclv_points
if(line_type.n() > 0) {
- if(string_to_statlinetype(line_type[0].c_str()) == stat_mpr &&
+ // Jobs which use out_eclv_points
+ if(string_to_statlinetype(line_type[0].c_str()) == STATLineType::mpr &&
out_line_type.has(stat_eclv_str)) {
// out_eclv_points
@@ -2808,12 +2809,10 @@ ConcatString STATAnalysisJob::get_jobstring() const {
js << "-out_eclv_points " << out_eclv_points[i] << " ";
}
}
- }
- // Jobs which perform bootstrapping
- if(line_type.n() > 0) {
+ // Jobs which perform bootstrapping
type = string_to_statlinetype(line_type[0].c_str());
- if(type == stat_mpr &&
+ if(type == STATLineType::mpr &&
(out_line_type.has(stat_cts_str) ||
out_line_type.has(stat_mcts_str) ||
out_line_type.has(stat_cnt_str) ||
@@ -2821,7 +2820,7 @@ ConcatString STATAnalysisJob::get_jobstring() const {
out_line_type.has(stat_nbrcnt_str))) {
// Bootstrap Information
- js << "-boot_interval " << boot_interval << " ";
+ js << "-boot_interval " << bootintervaltype_to_string(boot_interval) << " ";
js << "-boot_rep_prop " << boot_rep_prop << " ";
js << "-n_boot_rep " << n_boot_rep << " ";
js << "-boot_rng " << boot_rng << " ";
@@ -2837,9 +2836,9 @@ ConcatString STATAnalysisJob::get_jobstring() const {
}
// Jobs which compute the skill score index
- if(job_type == stat_job_go_index ||
- job_type == stat_job_cbs_index ||
- job_type == stat_job_ss_index) {
+ if(job_type == STATJobType::go_index ||
+ job_type == STATJobType::cbs_index ||
+ job_type == STATJobType::ss_index) {
// ss_index_name
js << "-ss_index_name " << ss_index_name << " ";
@@ -2937,7 +2936,7 @@ int STATAnalysisJob::is_in_mask_sid(const char *sid) const {
////////////////////////////////////////////////////////////////////////
const char * statjobtype_to_string(const STATJobType t) {
- return statjobtype_str[t];
+ return statjobtype_str[enum_class_as_int(t)];
}
////////////////////////////////////////////////////////////////////////
@@ -2956,23 +2955,23 @@ STATJobType string_to_statjobtype(const char *str) {
STATJobType t;
if( strcasecmp(str, statjobtype_str[0]) == 0)
- t = stat_job_filter;
+ t = STATJobType::filter;
else if(strcasecmp(str, statjobtype_str[1]) == 0)
- t = stat_job_summary;
+ t = STATJobType::summary;
else if(strcasecmp(str, statjobtype_str[2]) == 0)
- t = stat_job_aggr;
+ t = STATJobType::aggr;
else if(strcasecmp(str, statjobtype_str[3]) == 0)
- t = stat_job_aggr_stat;
+ t = STATJobType::aggr_stat;
else if(strcasecmp(str, statjobtype_str[4]) == 0)
- t = stat_job_go_index;
+ t = STATJobType::go_index;
else if(strcasecmp(str, statjobtype_str[5]) == 0)
- t = stat_job_cbs_index;
+ t = STATJobType::cbs_index;
else if(strcasecmp(str, statjobtype_str[6]) == 0)
- t = stat_job_ss_index;
+ t = STATJobType::ss_index;
else if(strcasecmp(str, statjobtype_str[7]) == 0)
- t = stat_job_ramp;
+ t = STATJobType::ramp;
else
- t = no_stat_job_type;
+ t = STATJobType::None;
return t;
}
diff --git a/src/libcode/vx_analysis_util/stat_job.h b/src/libcode/vx_analysis_util/stat_job.h
index 96ee2fc103..208c6d4894 100644
--- a/src/libcode/vx_analysis_util/stat_job.h
+++ b/src/libcode/vx_analysis_util/stat_job.h
@@ -37,7 +37,7 @@ static const bool default_column_union = false;
//
// Ramp job type defaults
//
-static const TimeSeriesType default_ramp_type = TimeSeriesType_DyDt;
+static const TimeSeriesType default_ramp_type = TimeSeriesType::DyDt;
static const char default_ramp_line_type[] = "MPR";
static const char default_ramp_out_line_type[] = "CTC,CTS";
static const char default_ramp_fcst_col[] = "FCST";
@@ -57,30 +57,30 @@ static const int dump_stat_buffer_cols = 512;
//
// Enumerate all the possible STAT Analysis Job Types
//
-enum STATJobType {
+enum class STATJobType {
- stat_job_filter = 0, // Filter out the STAT data and write the
- // lines to the filename specified.
+ filter = 0, /* Filter out the STAT data and write the
+ lines to the filename specified. */
- stat_job_summary = 1, // Compute min, max, mean, stdev and
- // percentiles for a column of data.
+ summary = 1, /* Compute min, max, mean, stdev and
+ percentiles for a column of data. */
- stat_job_aggr = 2, // Aggregate the input counts/scores and
- // generate the same output line type
- // containing the aggregated counts/scores.
+ aggr = 2, /* Aggregate the input counts/scores and
+ generate the same output line type
+ containing the aggregated counts/scores. */
- stat_job_aggr_stat = 3, // Aggregate the input counts/scores and
- // generate the requested output line type.
+ aggr_stat = 3, /* Aggregate the input counts/scores and
+ generate the requested output line type. */
- stat_job_go_index = 4, // Compute the GO Index.
+ go_index = 4, /* Compute the GO Index. */
- stat_job_cbs_index = 5, // Compute the CBS Index.
+ cbs_index = 5, /* Compute the CBS Index. */
- stat_job_ss_index = 6, // Compute the Skill Score Index.
+ ss_index = 6, /* Compute the Skill Score Index. */
- stat_job_ramp = 7, // Time-series ramp evaluation.
+ ramp = 7, /* Time-series ramp evaluation. */
- no_stat_job_type = 8 // Default value
+ None = 8 /* Default value */
};
static const int n_statjobtypes = 9;
@@ -267,14 +267,14 @@ class STATAnalysisJob {
NumArray out_eclv_points; // output ECLV points
//
- // Variables used for the stat_job_summary job type
+ // Variables used for the STATJobType::summary job type
//
bool do_derive;
StringArray wmo_sqrt_stats;
StringArray wmo_fisher_stats;
//
- // Variables used for the stat_job_aggr_mpr job type
+ // Variables used for the STATJobType::aggr_mpr job type
//
ConcatString mask_grid_str;
ConcatString mask_poly_str;
@@ -286,7 +286,7 @@ class STATAnalysisJob {
StringArray mask_sid;
//
- // Variables used for the stat_job_ramp job type
+ // Variables used for the STATJobType::ramp job type
//
TimeSeriesType ramp_type;
int ramp_time_fcst; // stored in seconds
@@ -305,9 +305,8 @@ class STATAnalysisJob {
//
// Type of bootstrap confidence interval method:
- // 0 = BCa, 1 = Percentile (Default = 1)
//
- int boot_interval;
+ BootIntervalType boot_interval;
//
// When using the percentile method, this is the proportion
diff --git a/src/libcode/vx_analysis_util/stat_line.cc b/src/libcode/vx_analysis_util/stat_line.cc
index a8f869fa74..c3006b5189 100644
--- a/src/libcode/vx_analysis_util/stat_line.cc
+++ b/src/libcode/vx_analysis_util/stat_line.cc
@@ -140,7 +140,7 @@ void STATLine::clear()
DataLine::clear();
-Type = no_stat_line_type;
+Type = STATLineType::none;
HdrLine = (AsciiHeaderLine *) nullptr;
return;
@@ -265,7 +265,7 @@ if ( !status || n_items() == 0 ) {
if ( strcmp(get_item(0), "VERSION") == 0 ) {
- Type = stat_header;
+ Type = STATLineType::header;
return 1;
}
@@ -278,7 +278,7 @@ offset = METHdrTable.col_offset(get_item(0), "STAT", na_str, "LINE_TYPE");
if( is_bad_data(offset) || n_items() < (offset + 1) ) {
- Type = no_stat_line_type;
+ Type = STATLineType::none;
return 0;
}
@@ -315,7 +315,7 @@ bool STATLine::is_header() const
{
-return ( Type == stat_header );
+return ( Type == STATLineType::header );
}
@@ -829,14 +829,14 @@ SetLogic STATLine::thresh_logic() const
{
-SetLogic t = SetLogic_None;
+SetLogic t = SetLogic::None;
ConcatString cs = (string)get_item("FCST_THRESH", false);
- if(cs.endswith(setlogic_symbol_union)) t = SetLogic_Union;
-else if(cs.endswith(setlogic_symbol_intersection)) t = SetLogic_Intersection;
-else if(cs.endswith(setlogic_symbol_symdiff)) t = SetLogic_SymDiff;
-else t = SetLogic_None;
+ if(cs.endswith(setlogic_symbol_union)) t = SetLogic::Union;
+else if(cs.endswith(setlogic_symbol_intersection)) t = SetLogic::Intersection;
+else if(cs.endswith(setlogic_symbol_symdiff)) t = SetLogic::SymDiff;
+else t = SetLogic::None;
return t;
diff --git a/src/libcode/vx_grid/tcrmw_grid.cc b/src/libcode/vx_grid/tcrmw_grid.cc
index 507c1874b8..a2e1738e1b 100644
--- a/src/libcode/vx_grid/tcrmw_grid.cc
+++ b/src/libcode/vx_grid/tcrmw_grid.cc
@@ -213,8 +213,9 @@ RLLD.rot_lat_ll = 90.0 - range_max_deg;
RLLD.rot_lon_ll = 0.0;
RLLD.delta_rot_lat = range_max_deg/(Range_n - 1);
-// RLLD.delta_rot_lon = 360.0/Azimuth_n;
-RLLD.delta_rot_lon = 360.0/(Azimuth_n - 1);
+
+// MET #2833 divide by n rather than n-1 for the azimuth increment
+RLLD.delta_rot_lon = 360.0/Azimuth_n;
RLLD.Nlat = Range_n;
RLLD.Nlon = Azimuth_n;
diff --git a/src/libcode/vx_grid/tcrmw_grid.h b/src/libcode/vx_grid/tcrmw_grid.h
index 010748bff9..8af34d9261 100644
--- a/src/libcode/vx_grid/tcrmw_grid.h
+++ b/src/libcode/vx_grid/tcrmw_grid.h
@@ -69,7 +69,7 @@ class TcrmwGrid : public RotatedLatLonGrid {
int azimuth_n () const;
double range_max_km () const;
- double range_delta_km () const; // Range_Max_km/Range_n
+ double range_delta_km () const; // Range_max_km/(Range_n - 1)
double azimuth_delta_deg () const; // 360.0/Azimuth_n
@@ -117,7 +117,7 @@ inline int TcrmwGrid::azimuth_n () const { return ( Azimuth_n ); }
inline double TcrmwGrid::range_max_km () const { return ( Range_max_km ); }
-inline double TcrmwGrid::range_delta_km () const { return ( Range_max_km/Range_n ); }
+inline double TcrmwGrid::range_delta_km () const { return ( Range_max_km/(Range_n - 1) ); }
inline double TcrmwGrid::azimuth_delta_deg () const { return ( 360.0/Azimuth_n ); }
diff --git a/src/libcode/vx_gsl_prob/gsl_randist.cc b/src/libcode/vx_gsl_prob/gsl_randist.cc
index 3a9d87442d..956e912727 100644
--- a/src/libcode/vx_gsl_prob/gsl_randist.cc
+++ b/src/libcode/vx_gsl_prob/gsl_randist.cc
@@ -219,31 +219,31 @@ double ran_draw(const gsl_rng *r, DistType t, double p1, double p2) {
// Switch on the distribution type
switch(t) {
- case(DistType_Normal):
+ case(DistType::Normal):
v = gsl_ran_gaussian(r, p1);
break;
- case(DistType_Exponential):
+ case(DistType::Exponential):
v = gsl_ran_exponential(r, p1);
break;
- case(DistType_ChiSquared):
+ case(DistType::ChiSquared):
v = gsl_ran_chisq(r, p1);
break;
- case(DistType_Gamma):
+ case(DistType::Gamma):
v = gsl_ran_gamma(r, p1, p2);
break;
- case(DistType_Uniform):
+ case(DistType::Uniform):
v = gsl_ran_flat(r, p1, p2);
break;
- case(DistType_Beta):
+ case(DistType::Beta):
v = gsl_ran_beta(r, p1, p2);
break;
- case(DistType_None):
+ case(DistType::None):
default:
v = 0.0;
break;
@@ -269,31 +269,31 @@ double dist_var(DistType t, double p1, double p2) {
// Switch on the distribution type
switch(t) {
- case(DistType_Normal):
+ case(DistType::Normal):
v = p1*p1;
break;
- case(DistType_Exponential):
+ case(DistType::Exponential):
v = 1.0 / (p1*p1);
break;
- case(DistType_ChiSquared):
+ case(DistType::ChiSquared):
v = 2*p1;
break;
- case(DistType_Gamma):
+ case(DistType::Gamma):
v = p1 / (p2*p2);
break;
- case(DistType_Uniform):
+ case(DistType::Uniform):
v = ((p2-p1)*(p2-p1)) / 12.0;
break;
- case(DistType_Beta):
+ case(DistType::Beta):
v = (p1*p2) / ((p1+p2)*(p1+p2)*(p1+p2+1.0));
break;
- case(DistType_None):
+ case(DistType::None):
default:
v = 0.0;
break;
diff --git a/src/libcode/vx_gsl_prob/gsl_randist.h b/src/libcode/vx_gsl_prob/gsl_randist.h
index e66c312230..1e8555e0d4 100644
--- a/src/libcode/vx_gsl_prob/gsl_randist.h
+++ b/src/libcode/vx_gsl_prob/gsl_randist.h
@@ -23,14 +23,14 @@
// Enumeration for distribution types
//
-enum DistType {
- DistType_None, // No distribution
- DistType_Normal, // Normal distribution
- DistType_Exponential, // Exponential distribution
- DistType_ChiSquared, // Chi-Squared distribution
- DistType_Gamma, // Gamma distribution
- DistType_Uniform, // Uniform distribution
- DistType_Beta // Beta distribution
+enum class DistType {
+ None, // No distribution
+ Normal, // Normal distribution
+ Exponential, // Exponential distribution
+ ChiSquared, // Chi-Squared distribution
+ Gamma, // Gamma distribution
+ Uniform, // Uniform distribution
+ Beta // Beta distribution
};
////////////////////////////////////////////////////////////////////////
diff --git a/src/libcode/vx_nc_util/write_netcdf.cc b/src/libcode/vx_nc_util/write_netcdf.cc
index 0f141ac50e..6a747cf7df 100644
--- a/src/libcode/vx_nc_util/write_netcdf.cc
+++ b/src/libcode/vx_nc_util/write_netcdf.cc
@@ -228,12 +228,12 @@ void write_netcdf_grid_weight(NcFile *f_out, NcDim *lat_dim, NcDim *lon_dim,
switch(t) {
- case GridWeightType_Cos_Lat:
+ case GridWeightType::Cos_Lat:
add_att(&wgt_var, long_name_att_name, "cosine latitude grid weight");
add_att(&wgt_var, units_att_name, "NA");
break;
- case GridWeightType_Area:
+ case GridWeightType::Area:
add_att(&wgt_var, long_name_att_name, "true area grid weight");
add_att(&wgt_var, units_att_name, "km^2");
break;
diff --git a/src/libcode/vx_pb_util/do_blocking.cc b/src/libcode/vx_pb_util/do_blocking.cc
index 0a62342983..0e6df01b22 100644
--- a/src/libcode/vx_pb_util/do_blocking.cc
+++ b/src/libcode/vx_pb_util/do_blocking.cc
@@ -115,13 +115,13 @@ unsigned char * b = (unsigned char *) nullptr;
switch ( padsize ) {
- case padsize_4:
+ case PadSize::size_4:
bytes = 4;
b = (unsigned char *) (&I);
I = (unsigned int) value;
break;
- case padsize_8:
+ case PadSize::size_8:
bytes = 8;
b = (unsigned char *) (&L);
L = (unsigned long long) value;
diff --git a/src/libcode/vx_pb_util/do_unblocking.cc b/src/libcode/vx_pb_util/do_unblocking.cc
index e0fa2ef90d..0a159c31e6 100644
--- a/src/libcode/vx_pb_util/do_unblocking.cc
+++ b/src/libcode/vx_pb_util/do_unblocking.cc
@@ -85,12 +85,12 @@ unsigned char * b = (unsigned char *) nullptr;
switch ( padsize ) {
- case padsize_4:
+ case PadSize::size_4:
bytes = 4;
b = (unsigned char *) (&I);
break;
- case padsize_8:
+ case PadSize::size_8:
bytes = 8;
b = (unsigned char *) (&L);
break;
@@ -119,11 +119,11 @@ if ( (n_read < 0) || ((n_read > 0) && (n_read != bytes)) ) {
switch ( padsize ) {
- case padsize_4:
+ case PadSize::size_4:
value = I;
break;
- case padsize_8:
+ case PadSize::size_8:
value = (int) L;
break;
diff --git a/src/libcode/vx_pb_util/pblock.cc b/src/libcode/vx_pb_util/pblock.cc
index 0626c0ac39..f8b2f3cecc 100644
--- a/src/libcode/vx_pb_util/pblock.cc
+++ b/src/libcode/vx_pb_util/pblock.cc
@@ -57,9 +57,9 @@ void pblock(const char *infile, const char *outfile, Action action) {
// Set the block size for this compiler
//
#ifdef BLOCK4
- padsize = padsize_4;
+ padsize = PadSize::size_4;
#else
- padsize = padsize_8;
+ padsize = PadSize::size_8;
#endif
//
@@ -67,11 +67,11 @@ void pblock(const char *infile, const char *outfile, Action action) {
//
switch(action) {
- case block:
+ case Action::block:
do_blocking(in, out, padsize);
break;
- case unblock:
+ case Action::unblock:
do_unblocking(in, out, padsize);
break;
diff --git a/src/libcode/vx_pb_util/pblock.h b/src/libcode/vx_pb_util/pblock.h
index cab711e358..43a4b32fe5 100644
--- a/src/libcode/vx_pb_util/pblock.h
+++ b/src/libcode/vx_pb_util/pblock.h
@@ -18,12 +18,12 @@
////////////////////////////////////////////////////////////////////////
-enum PadSize {
+enum class PadSize {
- padsize_4,
- padsize_8,
+ size_4,
+ size_8,
- no_padsize
+ no_pad
};
@@ -31,7 +31,7 @@ enum PadSize {
////////////////////////////////////////////////////////////////////////
-enum Action {
+enum class Action {
block,
unblock,
diff --git a/src/libcode/vx_plot_util/vx_plot_util.h b/src/libcode/vx_plot_util/vx_plot_util.h
index 5ba9a597bb..4d8aedfe7d 100644
--- a/src/libcode/vx_plot_util/vx_plot_util.h
+++ b/src/libcode/vx_plot_util/vx_plot_util.h
@@ -37,7 +37,7 @@
////////////////////////////////////////////////////////////////////////////////
-typedef enum {satellite, lambert, mercator} Projection;
+/* enum Projection {satellite, lambert, mercator} Projection; */
////////////////////////////////////////////////////////////////////////////////
diff --git a/src/libcode/vx_python3_utils/point.py b/src/libcode/vx_python3_utils/point.py
deleted file mode 100644
index 699aa46e51..0000000000
--- a/src/libcode/vx_python3_utils/point.py
+++ /dev/null
@@ -1,39 +0,0 @@
-
-
-###############################################################
-
-
-import sys
-
-
-###############################################################
-
-print ('============= start point.py ===========')
-
-print (sys.argv)
-
-
-###############################################################
-
-
-point_data = [[ 'ADPUPA', '72365', '20070331_120000', 35.03, -106.62, 1618.0, 7, 837.0, 1618, 'NA', 1618 ],
- [ 'ADPUPA', '72365', '20070331_120000', 35.03, -106.62, 1618.0, 11, 837.0, 1618, 'NA', 273.05 ],
- [ 'ADPUPA', '72365', '20070331_120000', 35.03, -106.62, 1618.0, 17, 837.0, 1618, 'NA', 271.85 ],
- [ 'ADPUPA', '72365', '20070331_120000', 35.03, -106.62, 1618.0, 52, 837.0, 1618, 'NA', 92 ],
- [ 'ADPUPA', '72365', '20070331_120000', 35.03, -106.62, 1618.0, 53, 837.0, 1618, 'NA', 0.00417 ],
- [ 'ADPUPA', '72365', '20070331_120000', 35.03, -106.62, 1618.0, 7, 826.0, 1724, 'NA', 1724 ],
- [ 'ADPUPA', '72365', '20070331_120000', 35.03, -106.62, 1618.0, 11, 826.0, 1724, 'NA', 274.55 ]]
-
-
-###############################################################
-
-
-print (point_data)
-
-
-print ('============= end point.py ===========')
-
-
-###############################################################
-
-
diff --git a/src/libcode/vx_regrid/vx_regrid.cc b/src/libcode/vx_regrid/vx_regrid.cc
index 418cceb5c3..7abfee78b4 100644
--- a/src/libcode/vx_regrid/vx_regrid.cc
+++ b/src/libcode/vx_regrid/vx_regrid.cc
@@ -32,30 +32,30 @@ DataPlane out;
switch ( info.method ) {
- case InterpMthd_Min:
- case InterpMthd_Max:
- case InterpMthd_Median:
- case InterpMthd_UW_Mean:
- case InterpMthd_DW_Mean:
- case InterpMthd_LS_Fit:
- case InterpMthd_Bilin:
- case InterpMthd_Nearest:
+ case InterpMthd::Min:
+ case InterpMthd::Max:
+ case InterpMthd::Median:
+ case InterpMthd::UW_Mean:
+ case InterpMthd::DW_Mean:
+ case InterpMthd::LS_Fit:
+ case InterpMthd::Bilin:
+ case InterpMthd::Nearest:
out = met_regrid_generic (in, from_grid, to_grid, info);
break;
- case InterpMthd_Budget:
+ case InterpMthd::Budget:
out = met_regrid_budget (in, from_grid, to_grid, info);
break;
- case InterpMthd_AW_Mean:
+ case InterpMthd::AW_Mean:
out = met_regrid_area_weighted (in, from_grid, to_grid, info);
break;
- case InterpMthd_Force:
+ case InterpMthd::Force:
out = met_regrid_force (in, from_grid, to_grid, info);
break;
- case InterpMthd_MaxGauss:
+ case InterpMthd::MaxGauss:
out = met_regrid_maxgauss (in, from_grid, to_grid, info);
break;
@@ -97,9 +97,9 @@ DataPlane met_regrid_nearest (const DataPlane & from_data, const Grid & from_gri
RegridInfo ri;
ri.enable = true;
-ri.method = InterpMthd_Nearest;
+ri.method = InterpMthd::Nearest;
ri.width = 1;
-ri.shape = GridTemplateFactory::GridTemplate_Square;
+ri.shape = GridTemplateFactory::GridTemplates::Square;
return met_regrid_generic(from_data, from_grid, to_grid, ri);
@@ -346,7 +346,7 @@ for (xt=0; xt<(to_grid.nx()); ++xt) {
} else {
value = compute_horz_interp(from_data, x_from, y_from,
- bad_data_double, InterpMthd_Max, info.width,
+ bad_data_double, InterpMthd::Max, info.width,
info.shape, from_grid.wrap_lon(), info.vld_thresh);
}
diff --git a/src/libcode/vx_shapedata/engine.cc b/src/libcode/vx_shapedata/engine.cc
index e0fc008464..dcc5840a47 100644
--- a/src/libcode/vx_shapedata/engine.cc
+++ b/src/libcode/vx_shapedata/engine.cc
@@ -17,6 +17,7 @@
#include
#include