diff --git a/.github/jobs/build_documentation.sh b/.github/jobs/build_documentation.sh index c6b73500a2..2c630f5caa 100755 --- a/.github/jobs/build_documentation.sh +++ b/.github/jobs/build_documentation.sh @@ -3,7 +3,12 @@ # path to docs directory relative to top level of repository # $GITHUB_WORKSPACE is set if the actions/checkout@v2 action is run first -DOCS_DIR=${GITHUB_WORKSPACE}/met/docs +DOCS_DIR=${GITHUB_WORKSPACE}/docs + +if [ ! -e ${DOCS_DIR} ]; then + echo "Documentation directory does not exist: ${DOCS_DIR}" + exit 1 +fi # run Make to build the documentation and return to previous directory cd ${DOCS_DIR} diff --git a/.github/jobs/get_branch_name.sh b/.github/jobs/get_branch_name.sh index ec42a94e38..82a1ee9a84 100755 --- a/.github/jobs/get_branch_name.sh +++ b/.github/jobs/get_branch_name.sh @@ -11,5 +11,5 @@ fi branch_name=${branch_name#"refs/heads/"} -echo ::set-output name=branch_name::$branch_name +echo "branch_name=${branch_name}" >> $GITHUB_OUTPUT echo branch_name: $branch_name diff --git a/.github/jobs/set_job_controls.sh b/.github/jobs/set_job_controls.sh index 69c69b93f1..b26f6d577d 100755 --- a/.github/jobs/set_job_controls.sh +++ b/.github/jobs/set_job_controls.sh @@ -108,15 +108,15 @@ if [ "$run_unit_tests" == "true" ]; then fi -echo ::set-output name=run_compile::$run_compile -echo ::set-output name=run_push::$run_push -echo ::set-output name=run_unit_tests::$run_unit_tests -echo ::set-output name=run_diff::$run_diff -echo ::set-output name=run_update_truth::$run_update_truth -echo ::set-output name=met_base_repo::$met_base_repo -echo ::set-output name=met_base_tag::$met_base_tag -echo ::set-output name=input_data_version::$input_data_version -echo ::set-output name=truth_data_version::$truth_data_version +echo "run_compile=${run_compile}" >> $GITHUB_OUTPUT +echo "run_push=${run_push}" >> $GITHUB_OUTPUT +echo "run_unit_tests=${run_unit_tests}" >> $GITHUB_OUTPUT +echo "run_diff=${run_diff}" >> $GITHUB_OUTPUT +echo "run_update_truth=${run_update_truth}" >> $GITHUB_OUTPUT +echo "met_base_repo=${met_base_repo}" >> $GITHUB_OUTPUT +echo "met_base_tag=${met_base_tag}" >> $GITHUB_OUTPUT +echo "input_data_version=${input_data_version}" >> $GITHUB_OUTPUT +echo "truth_data_version=${truth_data_version}" >> $GITHUB_OUTPUT echo run_compile: $run_compile echo run_push: $run_push diff --git a/.github/workflows/build_docker_and_trigger_metplus.yml b/.github/workflows/build_docker_and_trigger_metplus.yml index 0c35e8a674..e6c8c86a3f 100644 --- a/.github/workflows/build_docker_and_trigger_metplus.yml +++ b/.github/workflows/build_docker_and_trigger_metplus.yml @@ -18,11 +18,11 @@ jobs: name: Handle Docker Image runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Get branch name id: get_branch_name - run: echo ::set-output name=branch_name::${GITHUB_REF#"refs/heads/"} + run: echo branch_name=${GITHUB_REF#refs/heads/} >> $GITHUB_OUTPUT - name: Build Docker Image run: .github/jobs/build_docker_image.sh @@ -47,7 +47,7 @@ jobs: env: GITHUB_CONTEXT: ${{ toJson(github) }} run: echo "$GITHUB_CONTEXT" - - uses: actions/github-script@v5 + - uses: actions/github-script@v6 with: github-token: ${{ secrets.METPLUS_BOT_TOKEN }} script: | diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 4c09b72413..c43c5a6525 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -11,14 +11,15 @@ on: - met/docs/** pull_request: types: [opened, reopened, synchronize] + workflow_dispatch: jobs: documentation: name: Build Documentation runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 with: python-version: '3.6' - name: Install dependencies @@ -27,12 +28,12 @@ jobs: sphinx-gallery Pillow sphinx_rtd_theme sphinx-panels - name: Build docs run: ./.github/jobs/build_documentation.sh - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 if: always() with: name: documentation path: artifact/documentation - - uses: actions/upload-artifact@v2 + - uses: actions/upload-artifact@v3 if: failure() with: name: documentation_warnings.log diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 4380e0f5d6..170e97d14c 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -40,7 +40,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Set job controls id: job_status run: .github/jobs/set_job_controls.sh @@ -66,7 +66,7 @@ jobs: needs: job_control if: ${{ needs.job_control.outputs.run_compile == 'true' }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Create directories to store output run: mkdir -p ${RUNNER_WORKSPACE}/logs @@ -92,7 +92,7 @@ jobs: - name: Upload logs as artifact if: always() - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: logs path: ${{ runner.workspace }}/logs @@ -126,7 +126,7 @@ jobs: - 'pb2nc madis2nc pcp_combine' fail-fast: false steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Run Unit Tests in Docker run: .github/jobs/run_unit_docker.sh @@ -136,14 +136,14 @@ jobs: INPUT_DATA_VERSION: ${{ needs.job_control.outputs.input_data_version }}-all - name: Upload output as artifact - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: unit_1a path: ${{ runner.workspace }}/output - name: Upload logs as artifact if: always() - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: logs path: ${{ runner.workspace }}/logs @@ -161,7 +161,7 @@ jobs: - 'met_test_scripts mode_multivar mode_graphics mtd regrid airnow gsi_tools netcdf modis series_analysis gen_ens_prod wwmca_regrid gen_vx_mask grid_weight interp_shape grid_diag grib_tables lidar2nc shift_data_plane trmm2nc aeronet wwmca_plot ioda2nc gaussian' fail-fast: false steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Run Unit Tests in Docker run: .github/jobs/run_unit_docker.sh @@ -171,14 +171,14 @@ jobs: INPUT_DATA_VERSION: ${{ needs.job_control.outputs.input_data_version }}-all - name: Upload output as artifact - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: unit_1b path: ${{ runner.workspace }}/output - name: Upload logs as artifact if: always() - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: logs path: ${{ runner.workspace }}/logs @@ -197,7 +197,7 @@ jobs: - 'ref_config_lead_36' fail-fast: false steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Run Unit Tests in Docker run: .github/jobs/run_unit_docker.sh @@ -207,14 +207,14 @@ jobs: INPUT_DATA_VERSION: ${{ needs.job_control.outputs.input_data_version }}-all - name: Upload output as artifact - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: unit_rc_leads path: ${{ runner.workspace }}/output - name: Upload logs as artifact if: always() - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: logs path: ${{ runner.workspace }}/logs @@ -231,10 +231,10 @@ jobs: - 'ref_config' fail-fast: false steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Download ref_config_leads output from artifact - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v3 with: name: unit_rc_leads path: ${{ runner.workspace }}/output @@ -247,14 +247,14 @@ jobs: INPUT_DATA_VERSION: 'none' - name: Upload output as artifact - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: unit_rc path: ${{ runner.workspace }}/output - name: Upload logs as artifact if: always() - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: logs path: ${{ runner.workspace }}/logs @@ -274,10 +274,10 @@ jobs: - 'ensemble_stat stat_analysis_es' fail-fast: false steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Download 1a output from artifact - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v3 with: name: unit_1a path: ${{ runner.workspace }}/output @@ -290,14 +290,14 @@ jobs: INPUT_DATA_VERSION: ${{ needs.job_control.outputs.input_data_version }}-all - name: Upload output as artifact - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: unit_2a path: ${{ runner.workspace }}/output - name: Upload logs as artifact if: always() - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: logs path: ${{ runner.workspace }}/logs @@ -317,10 +317,10 @@ jobs: - 'python point2grid plot_data_plane mode mode_analysis perc_thresh hira plot_point_obs quality_filter obs_summary duplicate_flag' fail-fast: false steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Download 1a output from artifact - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v3 with: name: unit_1a path: ${{ runner.workspace }}/output @@ -333,14 +333,14 @@ jobs: INPUT_DATA_VERSION: ${{ needs.job_control.outputs.input_data_version }}-all - name: Upload output as artifact - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: unit_2b path: ${{ runner.workspace }}/output - name: Upload logs as artifact if: always() - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: logs path: ${{ runner.workspace }}/logs @@ -353,14 +353,14 @@ jobs: if: ${{ needs.job_control.outputs.run_diff == 'true' }} steps: - name: Download data from previous jobs - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v3 - name: Copy test output into single directory run: | mkdir ${RUNNER_WORKSPACE}/output cp -r unit_*/* ${RUNNER_WORKSPACE}/output/ - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Run Diff Tests in Docker run: .github/jobs/run_diff_docker.sh @@ -371,7 +371,7 @@ jobs: - name: Upload diff files as artifact if: always() - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: diff path: ${{ runner.workspace }}/diff @@ -379,7 +379,7 @@ jobs: - name: Upload logs as artifact if: always() - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: logs path: ${{ runner.workspace }}/logs @@ -391,10 +391,10 @@ jobs: needs: [job_control, unit_1b, unit_2a, unit_2b, unit_rc] if: ${{ needs.job_control.outputs.run_update_truth == 'true' }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Download data from previous jobs - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v3 - name: Copy test output into single directory run: | diff --git a/data/table_files/Makefile.am b/data/table_files/Makefile.am index fac2031790..1001e52387 100644 --- a/data/table_files/Makefile.am +++ b/data/table_files/Makefile.am @@ -40,6 +40,7 @@ tablefiles_DATA = \ met_header_columns_V3.0.txt \ met_header_columns_V2.0.txt \ airnow_monitoring_site_locations_v2.txt \ + ndbc_stations.xml \ stat_column_description.txt \ obs_error_table.txt \ grib1_af_131_57.txt \ diff --git a/data/table_files/Makefile.in b/data/table_files/Makefile.in index db4e0d9834..ed5514f48f 100644 --- a/data/table_files/Makefile.in +++ b/data/table_files/Makefile.in @@ -316,6 +316,7 @@ tablefiles_DATA = \ met_header_columns_V3.0.txt \ met_header_columns_V2.0.txt \ airnow_monitoring_site_locations_v2.txt \ + ndbc_stations.xml \ stat_column_description.txt \ obs_error_table.txt \ grib1_af_131_57.txt \ diff --git a/data/table_files/met_header_columns_V11.0.txt b/data/table_files/met_header_columns_V11.0.txt index 7a448d8d17..59a97d40a6 100644 --- a/data/table_files/met_header_columns_V11.0.txt +++ b/data/table_files/met_header_columns_V11.0.txt @@ -36,5 +36,5 @@ V11.0 : STAT : SSIDX : VERSION MODEL DESC FCST_LEAD FCST_VALID_BEG FCST_VALID V11.0 : MODE : OBJ : VERSION MODEL N_VALID GRID_RES DESC FCST_LEAD FCST_VALID FCST_ACCUM OBS_LEAD OBS_VALID OBS_ACCUM FCST_RAD FCST_THR OBS_RAD OBS_THR FCST_VAR FCST_UNITS FCST_LEV OBS_VAR OBS_UNITS OBS_LEV OBTYPE OBJECT_ID OBJECT_CAT CENTROID_X CENTROID_Y CENTROID_LAT CENTROID_LON AXIS_ANG LENGTH WIDTH AREA AREA_THRESH CURVATURE CURVATURE_X CURVATURE_Y COMPLEXITY INTENSITY_10 INTENSITY_25 INTENSITY_50 INTENSITY_75 INTENSITY_90 INTENSITY_USER INTENSITY_SUM CENTROID_DIST BOUNDARY_DIST CONVEX_HULL_DIST ANGLE_DIFF ASPECT_DIFF AREA_RATIO INTERSECTION_AREA UNION_AREA SYMMETRIC_DIFF INTERSECTION_OVER_AREA CURVATURE_RATIO COMPLEXITY_RATIO PERCENTILE_INTENSITY_RATIO INTEREST V11.0 : MODE : CTS : VERSION MODEL N_VALID GRID_RES DESC FCST_LEAD FCST_VALID FCST_ACCUM OBS_LEAD OBS_VALID OBS_ACCUM FCST_RAD FCST_THR OBS_RAD OBS_THR FCST_VAR FCST_UNITS FCST_LEV OBS_VAR OBS_UNITS OBS_LEV OBTYPE FIELD TOTAL FY_OY FY_ON FN_OY FN_ON BASER FMEAN ACC FBIAS PODY PODN POFD FAR CSI GSS HK HSS ODDS -V11.0 : TCST : TCMPR : VERSION AMODEL BMODEL DESC STORM_ID BASIN CYCLONE STORM_NAME INIT LEAD VALID INIT_MASK VALID_MASK LINE_TYPE TOTAL INDEX LEVEL WATCH_WARN INITIALS ALAT ALON BLAT BLON TK_ERR X_ERR Y_ERR ALTK_ERR CRTK_ERR ADLAND BDLAND AMSLP BMSLP AMAX_WIND BMAX_WIND AAL_WIND_34 BAL_WIND_34 ANE_WIND_34 BNE_WIND_34 ASE_WIND_34 BSE_WIND_34 ASW_WIND_34 BSW_WIND_34 ANW_WIND_34 BNW_WIND_34 AAL_WIND_50 BAL_WIND_50 ANE_WIND_50 BNE_WIND_50 ASE_WIND_50 BSE_WIND_50 ASW_WIND_50 BSW_WIND_50 ANW_WIND_50 BNW_WIND_50 AAL_WIND_64 BAL_WIND_64 ANE_WIND_64 BNE_WIND_64 ASE_WIND_64 BSE_WIND_64 ASW_WIND_64 BSW_WIND_64 ANW_WIND_64 BNW_WIND_64 ARADP BRADP ARRP BRRP AMRD BMRD AGUSTS BGUSTS AEYE BEYE ADIR BDIR ASPEED BSPEED ADEPTH BDEPTH +V11.0 : TCST : TCMPR : VERSION AMODEL BMODEL DESC STORM_ID BASIN CYCLONE STORM_NAME INIT LEAD VALID INIT_MASK VALID_MASK LINE_TYPE TOTAL INDEX LEVEL WATCH_WARN INITIALS ALAT ALON BLAT BLON TK_ERR X_ERR Y_ERR ALTK_ERR CRTK_ERR ADLAND BDLAND AMSLP BMSLP AMAX_WIND BMAX_WIND AAL_WIND_34 BAL_WIND_34 ANE_WIND_34 BNE_WIND_34 ASE_WIND_34 BSE_WIND_34 ASW_WIND_34 BSW_WIND_34 ANW_WIND_34 BNW_WIND_34 AAL_WIND_50 BAL_WIND_50 ANE_WIND_50 BNE_WIND_50 ASE_WIND_50 BSE_WIND_50 ASW_WIND_50 BSW_WIND_50 ANW_WIND_50 BNW_WIND_50 AAL_WIND_64 BAL_WIND_64 ANE_WIND_64 BNE_WIND_64 ASE_WIND_64 BSE_WIND_64 ASW_WIND_64 BSW_WIND_64 ANW_WIND_64 BNW_WIND_64 ARADP BRADP ARRP BRRP AMRD BMRD AGUSTS BGUSTS AEYE BEYE ADIR BDIR ASPEED BSPEED ADEPTH BDEPTH NUM_MEMBERS TRACK_SPREAD DIST_MEAN MSLP_SPREAD MAX_WIND_SPREAD V11.0 : TCST : PROBRIRW : VERSION AMODEL BMODEL DESC STORM_ID BASIN CYCLONE STORM_NAME INIT LEAD VALID INIT_MASK VALID_MASK LINE_TYPE ALAT ALON BLAT BLON INITIALS TK_ERR X_ERR Y_ERR ADLAND BDLAND RIRW_BEG RIRW_END RIRW_WINDOW AWIND_END BWIND_BEG BWIND_END BDELTA BDELTA_MAX BLEVEL_BEG BLEVEL_END (N_THRESH) THRESH_[0-9]* PROB_[0-9]* diff --git a/data/table_files/ndbc_stations.xml b/data/table_files/ndbc_stations.xml new file mode 100644 index 0000000000..7e73ef73a3 --- /dev/null +++ b/data/table_files/ndbc_stations.xml @@ -0,0 +1,1368 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/Users_Guide/config_options.rst b/docs/Users_Guide/config_options.rst index b8e50a2152..d7e5075f4e 100644 --- a/docs/Users_Guide/config_options.rst +++ b/docs/Users_Guide/config_options.rst @@ -212,15 +212,54 @@ MET tool stating the location of the parsing error. Runtime Environment Variables ----------------------------- +.. _config_env_vars: + +User-Specified Environment Variables +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +When editing configuration files, environment variables may be used for setting +the configurable parameters if convenient. The configuration file parser expands +environment variables to their full value before proceeding. Within the configuration +file, environment variables must be specified in the form **${VAR_NAME}**. + +For example, using an environment variable to set the message_type (see below) +parameter to use ADPUPA and ADPSFC message types might consist of the following. + +Setting the environment variable in a Bash Shell: + +.. code :: bash + + export MSG_TYP='"ADPUPA", "ADPSFC"' + +Referencing that environment variable inside a MET configuration file: + +.. code :: + + message_type = [ ${MSG_TYP} ]; + +In addition to supporting user-specified environment variables within configuration +files, the environment variables listed below have special meaning if set at runtime. + + MET_AIRNOW_STATIONS -^^^^^^^^ +^^^^^^^^^^^^^^^^^^^ The MET_AIRNOW_STATIONS environment variable can be used to specify a file that +will override the default file. If set, it should be the full path to the file. +The default table can be found in the installed +*share/met/table_files/airnow_monitoring_site_locations_v2.dat*. This file contains +ascii column data that allows lookups of latitude, longitude, and elevation for all +airnow stations based on stationId and/or AqSid. + +MET_NDBC_STATIONS +^^^^^^^^^^^^^^^^^ + +The MET_NDBC_STATIONS environment variable can be used to specify a file that will override the default file. If set it should be a full path to the file. -The default is: - "MET_BASE/table_files/airnow_monitoring_site_locations_v2.dat" -This file contains ascii column data that allows lookups of latitude,longitude, -and elevation for all airnow stations based on stationId and/or AqSid. +The default table can be found in the installed +*share/met/table_files/ndbc_stations.xml*. This file contains +XML content for all stations that allows lookups of latitude, longitude, +and, in some cases, elevation for all stations based on stationId. MET_BASE ^^^^^^^^ diff --git a/docs/Users_Guide/data_io.rst b/docs/Users_Guide/data_io.rst index 6c05461f43..395b66a96d 100644 --- a/docs/Users_Guide/data_io.rst +++ b/docs/Users_Guide/data_io.rst @@ -109,6 +109,8 @@ MET gets the valid time from the time variable and the "forecast_reference_time" "minutes since YYYY-MM-DD HH:MM:SS", "hours since YYYY-MM-DD HH:MM:SS", "days since YYYY-MM-DD HH:MM:SS", + "months since YYYY-MM-DD HH:MM:SS", + "years since YYYY-MM-DD HH:MM:SS", Accepts "Y", "YY", "YYY", "M", "D", "HH", and "HH:MM". "HH:MM:SS" is optional - "degrees_north", diff --git a/docs/Users_Guide/ensemble-stat.rst b/docs/Users_Guide/ensemble-stat.rst index 2036ab4457..32c1fbd677 100644 --- a/docs/Users_Guide/ensemble-stat.rst +++ b/docs/Users_Guide/ensemble-stat.rst @@ -14,6 +14,31 @@ The Ensemble-Stat tool verifies deterministic ensemble members against gridded a Scientific and statistical aspects ================================== +.. _ES_HiRA_framework: + +HiRA framework +-------------- + +The HiRA framework described in :numref:`PS_HiRA_framework` is also supported in the Ensemble-Stat tool. That support is provided as an interpolation option via the **interp** dictionary. The interpolation dictionary defines how gridded model data is matched to each observation value. Most interpolation methods, such as **UW_MEAN** for the unweighted mean or **BILIN** for bilinear, compute a single value for each ensemble member. When the High Resolution Assessment (HiRA) interpolation method is chosen, as shown below, all of the nearby neighborhood points surrounding each observation from each member are used. Therefore, processing an N-member ensemble using a HiRA neighborhood of size M produces ensemble output with size N*M. This approach fully leverages information from all nearby grid points to evaluate the ensemble quality. + +.. code :: + + interp = { + field = BOTH; + vld_thresh = 1.0; + shape = SQUARE; + + type = [ + { + method = HIRA; + width = 2; + shape = SQUARE; + } + ]; + } + +In this example, all four grid points of the 2x2 square surrounding each observation point are used to define the ensemble. Therefore, an N-member ensemble is evaluated as an ensemble of size Nx4. + Ensemble statistics ------------------- @@ -125,7 +150,7 @@ ensemble_stat configuration file The default configuration file for the Ensemble-Stat tool named **EnsembleStatConfig_default** can be found in the installed *share/met/config* directory. Another version is located in *scripts/config*. We encourage users to make a copy of these files prior to modifying their contents. Each configuration file (both the default and sample) contains many comments describing its contents. The contents of the configuration file are also described in the subsections below. -Note that environment variables may be used when editing configuration files, as described in the :numref:`pb2nc configuration file` for the PB2NC tool. +Note that environment variables may be used when editing configuration files, as described in the :numref:`config_env_vars`. ____________________ diff --git a/docs/Users_Guide/gen-ens-prod.rst b/docs/Users_Guide/gen-ens-prod.rst index 4d697d5691..babb8e0ed4 100644 --- a/docs/Users_Guide/gen-ens-prod.rst +++ b/docs/Users_Guide/gen-ens-prod.rst @@ -90,7 +90,7 @@ gen_ens_prod configuration file The default configuration file for the Gen-Ens-Prod tool named **GenEnsProdConfig_default** can be found in the installed *share/met/config* directory. Another version is located in *scripts/config*. We encourage users to make a copy of these files prior to modifying their contents. The contents of the configuration file are described in the subsections below. -Note that environment variables may be used when editing configuration files, as described in :numref:`pb2nc configuration file` for the PB2NC tool. +Note that environment variables may be used when editing configuration files, as described in the :numref:`config_env_vars`. ____________________ diff --git a/docs/Users_Guide/grid-stat.rst b/docs/Users_Guide/grid-stat.rst index 6c4ade2c63..7b550ae0b7 100644 --- a/docs/Users_Guide/grid-stat.rst +++ b/docs/Users_Guide/grid-stat.rst @@ -14,7 +14,6 @@ Scientific and statistical aspects of the Grid-Stat tool are briefly described i Scientific and statistical aspects ================================== - Statistical measures -------------------- @@ -222,7 +221,7 @@ grid_stat configuration file The default configuration file for the Grid-Stat tool, named **GridStatConfig_default**, can be found in the installed *share/met/config* directory. Other versions of the configuration file are included in *scripts/config*. We recommend that users make a copy of the default (or other) configuration file prior to modifying it. The contents are described in more detail below. -Note that environment variables may be used when editing configuration files, as described in :numref:`pb2nc configuration file` for the PB2NC tool. +Note that environment variables may be used when editing configuration files, as described in the :numref:`config_env_vars`. __________________________ diff --git a/docs/Users_Guide/mode.rst b/docs/Users_Guide/mode.rst index 5413546077..f5e4caf33f 100644 --- a/docs/Users_Guide/mode.rst +++ b/docs/Users_Guide/mode.rst @@ -193,7 +193,7 @@ mode configuration file The default configuration file for the MODE tool, **MODEConfig_default**, can be found in the installed *share/met/config* directory. Another version of the configuration file is provided in *scripts/config*. We encourage users to make a copy of the configuration files prior to modifying their contents. Descriptions of **MODEConfig_default** and the required variables for any MODE configuration file are also provided below. While the configuration file contains many entries, most users will only need to change a few for their use. Specific options are described in the following subsections. -Note that environment variables may be used when editing configuration files, as described in :numref:`pb2nc configuration file` for the PB2NC tool. +Note that environment variables may be used when editing configuration files, as described in the :numref:`config_env_vars`. _____________________ diff --git a/docs/Users_Guide/plotting.rst b/docs/Users_Guide/plotting.rst index fcdd436cc4..1db3b4be91 100644 --- a/docs/Users_Guide/plotting.rst +++ b/docs/Users_Guide/plotting.rst @@ -80,7 +80,8 @@ plot_point_obs configuration file The default configuration file for the Plot-Point-Obs tool named **PlotPointObsConfig_default** can be found in the installed *share/met/config* directory. The contents of the configuration file are described in the subsections below. -Note that environment variables may be used when editing configuration files, as described in :numref:`pb2nc configuration file` for the PB2NC tool. +Note that environment variables may be used when editing configuration files, as described in the :numref:`config_env_vars`. + ________________________ .. code-block:: none diff --git a/docs/Users_Guide/point-stat.rst b/docs/Users_Guide/point-stat.rst index 4d240515b9..9b9b9806cb 100644 --- a/docs/Users_Guide/point-stat.rst +++ b/docs/Users_Guide/point-stat.rst @@ -314,7 +314,7 @@ point_stat configuration file The default configuration file for the Point-Stat tool named **PointStatConfig_default** can be found in the installed *share/met/config* directory. Another version is located in *scripts/config*. We encourage users to make a copy of these files prior to modifying their contents. The contents of the configuration file are described in the subsections below. -Note that environment variables may be used when editing configuration files, as described in :numref:`pb2nc configuration file` for the PB2NC tool. +Note that environment variables may be used when editing configuration files, as described in the :numref:`config_env_vars`. ________________________ @@ -1545,7 +1545,6 @@ The first set of header columns are common to all of the output files generated * - 31 - S32 - Counts multiplied by the weights for FCST_CAT 3 and OBS_CAT 2 -LINE_TYPE TOTAL S12 S13 S21 S23 S31 S32 PV1 PV2 PV3 PF1 PF2 PF3 MEAN_FCST MEAN_OBS SEEPS * - 32 - PF1 - marginal probabilities of the forecast values (FCST_CAT 1) diff --git a/docs/Users_Guide/reformat_grid.rst b/docs/Users_Guide/reformat_grid.rst index cf2a84cb1b..aadb73eb6f 100644 --- a/docs/Users_Guide/reformat_grid.rst +++ b/docs/Users_Guide/reformat_grid.rst @@ -523,7 +523,7 @@ wwmca_regrid configuration file The default configuration file for the WWMCA-Regrid tool named **WWMCARegridConfig_default** can be found in the installed *share/met/config* directory. We encourage users to make a copy of this file prior to modifying its contents. The contents of the configuration file are described in the subsections below. -Note that environment variables may be used when editing configuration files, as described in :numref:`pb2nc configuration file` for the PB2NC tool. +Note that environment variables may be used when editing configuration files, as described in the :numref:`config_env_vars`. ____________________________ diff --git a/docs/Users_Guide/reformat_point.rst b/docs/Users_Guide/reformat_point.rst index c430bbdcb5..f4430cd8e1 100644 --- a/docs/Users_Guide/reformat_point.rst +++ b/docs/Users_Guide/reformat_point.rst @@ -96,15 +96,7 @@ pb2nc configuration file The default configuration file for the PB2NC tool named **PB2NCConfig_default** can be found in the installed *share/met/config* directory. The version used for the example run in :numref:`Sample test cases` is available in *scripts/config*. It is recommended that users make a copy of configuration files prior to modifying their contents. -When editing configuration files, environment variables may be used for setting the configurable parameters if convenient. The configuration file parser expands any environment variables to their full value before proceeding. Within the configuration file, environment variables must be specified in the form: **${VAR_NAME}**. - -For example, using an environment variable to set the **message_type** (see below) parameter to use ADPUPA and ADPSFC message types might consist of the following: - -\* In a C-Shell: **setenv MSG_TYP ' "ADPUPA", "ADPSFC" '** - -\* In the configuration file: **message_type = [ ${MSG_TYP} ];** - -The contents of the default pb2nc configuration file are described below. +Note that environment variables may be used when editing configuration files, as described in the :numref:`config_env_vars`. ____________________ @@ -190,12 +182,12 @@ _____________________ The **beg** and **end** variables are used to stratify the model level of observations to be retained. The range shown above is 1 to 255. -The **level_category** variable is used to specify a comma-separated list of PrepBUFR data level categories to retain. An empty string indicates that all level categories should be retained. Accepted values and their meanings are described in :numref:`table_reform-point_pb2nc_level_category`. See the following for more details: +The **level_category** variable is used to specify a comma-separated list of PrepBUFR data level categories to retain. An empty string indicates that all level categories should be retained. Accepted values and their meanings are described in :numref:`table_reformat-point_pb2nc_level_category`. See the following for more details: `PrepBUFR mnemonic table. `_ -.. _table_reform-point_pb2nc_level_category: +.. _table_reformat-point_pb2nc_level_category: .. list-table:: Values for the level_category option. :widths: auto @@ -315,9 +307,9 @@ The **vld_freq** and **vld_thresh** entries specify the required ratio of valid pb2nc output ------------ -Each NetCDF file generated by the PB2NC tool contains the dimensions and variables shown in :numref:`table_reform-point_pb2nc_output_dim` and :numref:`table_reform-point_pb2nc_output_vars`. +Each NetCDF file generated by the PB2NC tool contains the dimensions and variables shown in :numref:`table_reformat-point_pb2nc_output_dim` and :numref:`table_reformat-point_pb2nc_output_vars`. -.. _table_reform-point_pb2nc_output_dim: +.. _table_reformat-point_pb2nc_output_dim: .. list-table:: NetCDF file dimensions for pb2n output :widths: auto @@ -340,7 +332,7 @@ Each NetCDF file generated by the PB2NC tool contains the dimensions and variabl * - obs_var_num - Number of unique observation variable types (variable) -.. _table_reform-point_pb2nc_output_vars: +.. _table_reformat-point_pb2nc_output_vars: .. list-table:: NetCDF variables in pb2nc output :widths: auto @@ -422,13 +414,27 @@ ASCII2NC tool This section describes how to run the ASCII2NC tool. The ASCII2NC tool is used to reformat ASCII point observations into the NetCDF format expected by the Point-Stat tool. For those users wishing to verify against point observations that are not available in PrepBUFR format, the ASCII2NC tool provides a way of incorporating those observations into MET. If the ASCII2NC tool is used to perform a reformatting step, no configuration file is needed. However, for more complex processing, such as summarizing time series observations, a configuration file may be specified. For details on the configuration file options, see :numref:`config_options` and example configuration files distributed with the MET code. -Initial versions of the ASCII2NC tool supported only a simple 11 column ASCII point observation format. It currently supports point observation data in the following formats: the default 11 column format, little_r format, `SURFace RADiation (SURFRAD) `_ and Integrated Surface Irradiance Study (ISIS) formats, the Western Wind and Solar Integration Study (WWSIS) format, the `AirNow DailyData_v2, AirNow HourlyData, and AirNow HourlyAQObs formats. `_, and the `AErosol RObotic NEtwork (AERONET) versions 2 and 3 format. `_ WWSIS data are available by request from National Renewable Energy Laboratory (NREL) in Boulder, CO. +While initial versions of the ASCII2NC tool only supported a simple 11 column ASCII point observation format, support for several additional formats has been added. It currently supports point observation data in the following formats: + +• Default 11 column MET point observation format, as described in :numref:`table_reformat-point_ascii2nc_format` + +• `little_r format `_ + +• `SURFace RADiation (SURFRAD) `_ and Integrated Surface Irradiance Study (ISIS) formats + +• Western Wind and Solar Integration Study (WWSIS) format. WWSIS data are available by request from National Renewable Energy Laboratory (NREL) in Boulder, CO. + +• `AirNow DailyData_v2, AirNow HourlyData, and AirNow HourlyAQObs formats `_ + +• `National Data Buoy (NDBC) Standard Meteorlogical Data format `_ + +• `AErosol RObotic NEtwork (AERONET) versions 2 and 3 format `_ -MET version 9.0 adds support for the passing observations to ascii2nc using a Python script with the "-format python" option. An example of running ASCII2NC with Python embedding is included below. +• Python embedding of point observations, as described in :numref:`pyembed-point-obs-data`. See example below in :numref:`ascii2nc-pyembed`. -The default ASCII point observation format consists of one row of data per observation value. Each row of data consists of 11 columns as shown in :numref:`table_reform-point_ascii2nc_format`. +The default ASCII point observation format consists of one row of data per observation value. Each row of data consists of 11 columns as shown in :numref:`table_reformat-point_ascii2nc_format`. -.. _table_reform-point_ascii2nc_format: +.. _table_reformat-point_ascii2nc_format: .. list-table:: Input MET ascii2nc point observation format :widths: auto @@ -505,7 +511,7 @@ 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", "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", "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. diff --git a/docs/Users_Guide/release-notes.rst b/docs/Users_Guide/release-notes.rst index c0b49b5e17..35022c5d48 100644 --- a/docs/Users_Guide/release-notes.rst +++ b/docs/Users_Guide/release-notes.rst @@ -5,6 +5,36 @@ When applicable, release notes are followed by the GitHub issue number which des enhancement, or new feature (`MET GitHub issues `_). Important issues are listed **in bold** for emphasis. +MET Version 11.0.0-beta3 release notes (20220921) +------------------------------------------------- + +.. warning:: **Ensemble post-processing was added to Gen-Ens-Prod in version 10.1.0 and will be removed from Ensemble-Stat in version 11.0.0!** + +* Repository and build: + + * Add initial files to create the MET compilation environment in the dtcenter/met-base Docker image (`dtcenter/METbaseimage#1 `_). + * Update the METbaseimage to install Python 3.8.6 from source (`dtcenter/METbaseimage#3 `_). + * Restructure the MET Dockerfiles to create images based on the new METbaseimage (`#2196 `_). + * Add .zenodo.json file to add metadata about releases (`#2198 `_). + +* Bugfixes: + + * Fix the truncated station_id name in the output from IODA2NC (`#2216 `_). + * Fix oom() compile time linker error (`#2238 `_). + * Store unspecified accumulation interval as 0 rather than bad data (`#2250 `_). + +* Enhancements: + + * **Remove ensemble post-processing from the Ensemble-Stat tool** (`#1908 `_). + * **Enhance Point-Stat to compute SEEPS for point observations and write new SEEPS and SEEPS_MPR STAT line types** (`#1942 `_). + * **Add the fair CRPS statistic to the ECNT line type in a new CRPS_EMP_FAIR column** (`#2206 `_). + * Update map data with more recent NaturalEarth definitions (`#2207 `_). + * Define new grid class to store semi-structured grid information (e.g. lat or lon vs level or time) (`#1954 `_). + * Add support for EPA AirNow ASCII data in ASCII2NC (`#2142 `_). + * Add tmp_dir configuration option to the Plot-Point-Obs tool (`#2237 `_). + * Refine NetCDF level string handling logic to always interpret @ strings as values (`#2225 `_). + * Add support for reading National Blend Model GRIB2 data (`#2055 `_). + MET Version 11.0.0-beta2 release notes (20220809) ------------------------------------------------- @@ -22,6 +52,7 @@ MET Version 11.0.0-beta2 release notes (20220809) * Add a sum option to the time summaries computed by the point pre-processing tools (`#2204 `_). * Refine warning/error messages when parsing thresholds (`#2211 `_). * Add "station_ob" to metadata_map as a message_type metadata variable for ioda2nc (`#2215 `_). + * MET: Add a timestamp to the log output at the beginning and end of each MET tool run (`dtcenter/METplus-Internal#18 `_). * MET: Add the user ID and the command line being executed to the log output at beginning and end of each MET tool run (`dtcenter/METplus-Internal#19 `_). * MET: Enhance MET to have better signal handling for shutdown events (`dtcenter/METplus-Internal#21 `_). diff --git a/docs/Users_Guide/series-analysis.rst b/docs/Users_Guide/series-analysis.rst index 95766ae35b..2b0b391d24 100644 --- a/docs/Users_Guide/series-analysis.rst +++ b/docs/Users_Guide/series-analysis.rst @@ -93,7 +93,7 @@ series_analysis configuration file ---------------------------------- The default configuration file for the Series-Analysis tool named **SeriesAnalysisConfig_default** can be found in the installed *share/met/config* directory. The contents of the configuration file are described in the subsections below. -Note that environment variables may be used when editing configuration files, as described in the :numref:`pb2nc configuration file` for the PB2NC tool. +Note that environment variables may be used when editing configuration files, as described in the :numref:`config_env_vars`. ____________________ diff --git a/docs/Users_Guide/tc-pairs.rst b/docs/Users_Guide/tc-pairs.rst index 3de6d0b470..77ee2af4c7 100644 --- a/docs/Users_Guide/tc-pairs.rst +++ b/docs/Users_Guide/tc-pairs.rst @@ -156,7 +156,7 @@ ____________________ } ]; -The **consensus** field allows the user to generate a user-defined consensus forecasts from any number of models. All models used in the consensus forecast need to be included in the **model** field (first entry in **TCPairsConfig_default**). The name field is the desired consensus model name. The **members** field is a comma-separated list of model IDs that make up the members of the consensus. The **required** field is a comma-separated list of true/false values associated with each consensus member. If a member is designated as true, the member is required to be present in order for the consensus to be generated. If a member is false, the consensus will be generated regardless of whether the member is present. The length of the required array must be the same length as the members array. The **min_req** field is the number of members required in order for the consensus to be computed. The required and min_req field options are applied at each forecast lead time. If any member of the consensus has a non-valid position or intensity value, the consensus for that valid time will not be generated. +The **consensus** field allows the user to generate a user-defined consensus forecasts from any number of models. All models used in the consensus forecast need to be included in the **model** field (first entry in **TCPairsConfig_default**). The name field is the desired consensus model name. The **members** field is a comma-separated list of model IDs that make up the members of the consensus. The **required** field is a comma-separated list of true/false values associated with each consensus member. If a member is designated as true, the member is required to be present in order for the consensus to be generated. If a member is false, the consensus will be generated regardless of whether the member is present. The length of the required array must be the same length as the members array. The **min_req** field is the number of members required in order for the consensus to be computed. The required and min_req field options are applied at each forecast lead time. If any member of the consensus has a non-valid position or intensity value, the consensus for that valid time will not be generated. If a consensus model is indicated in the configuration file there will be non-missing output for the consensus track variables in the output file (NUM_MEMBERS, TRACK_SPREAD, DIST_MEAN, MSLP_SPREAD, MAX_WIND_SPREAD). See the TCMPR line type definitions below. ____________________ @@ -472,7 +472,22 @@ TC-Pairs produces output in TCST format. The default output file name can be ove * - 78, 79 - A/BDEPTH - system depth, D-deep, M-medium, S-shallow, X-unknown - + * - 80 + - NUM_MEMBERS + - consensus variable: number of models (or ensemble members) that were used to build the consensus track + * - 81 + - TRACK_SPREAD + - consensus variable: the standard deviation of the distances from the member locations to the consensus track location (nm) + * - 82 + - DIST_MEAN + - consensus variable: the mean of the distances from the member location to the consensus track location (nm) + * - 83 + - MSLP_SPREAD + - consensus variable: the standard deviation of the member's mean sea level pressure values + * - 84 + - MAX_WIND_SPREAD + - consensus variable: the standard deviation of the member's maximum wind speed values + .. _PROBRIRW Line Type: .. list-table:: Format information for PROBRIRW (Probability of Rapid Intensification/Weakening) output line type. diff --git a/docs/Users_Guide/wavelet-stat.rst b/docs/Users_Guide/wavelet-stat.rst index 15d68616e5..3622a4ff7a 100644 --- a/docs/Users_Guide/wavelet-stat.rst +++ b/docs/Users_Guide/wavelet-stat.rst @@ -203,7 +203,9 @@ In the example, the Wavelet-Stat tool will verify the model data in the **sample wavelet_stat configuration file ------------------------------- -The default configuration file for the Wavelet-Stat tool, **WaveletStatConfig_default**, can be found in the installed *share/met/config* directory. Another version of the configuration file is provided in *scripts/config*. We recommend that users make a copy of the default (or other) configuration file prior to modifying it. The contents are described in more detail below. Note that environment variables may be used when editing configuration files, as described in the :numref:`pb2nc configuration file` for the PB2NC tool. +The default configuration file for the Wavelet-Stat tool, **WaveletStatConfig_default**, can be found in the installed *share/met/config* directory. Another version of the configuration file is provided in *scripts/config*. We recommend that users make a copy of the default (or other) configuration file prior to modifying it. The contents are described in more detail below. + +Note that environment variables may be used when editing configuration files, as described in the :numref:`config_env_vars`. _______________________ diff --git a/docs/conf.py b/docs/conf.py index 9f66d4970b..d7086ba2fb 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -20,11 +20,11 @@ project = 'MET' author = 'UCAR/NCAR, NOAA, CSU/CIRA, and CU/CIRES' author_list = 'Opatz, J., T. Jensen, J. Prestopnik, H. Soh, L. Goodrich, B. Brown, R. Bullock, J. Halley Gotway, K. Newman' -version = '11.0.0-beta2' +version = '11.0.0-beta3' verinfo = version release = f'{version}' release_year = '2022' -release_date = f'{release_year}-08-09' +release_date = f'{release_year}-09-21' copyright = f'{release_year}, {author}' # -- General configuration --------------------------------------------------- diff --git a/internal/scripts/environment/development.seneca b/internal/scripts/environment/development.seneca index ccbf506dbf..f4b37c5aa1 100644 --- a/internal/scripts/environment/development.seneca +++ b/internal/scripts/environment/development.seneca @@ -53,4 +53,4 @@ export PATH="/usr/local/nco/bin:/usr/local/netcdf/bin:\ # SonarQube export SONARQUBE_DIR=/d1/projects/SonarQube/ export SONARQUBE_WRAPPER_BIN=$SONARQUBE_DIR/build-wrapper-linux-x86 -export SONARQUBE_SCANNER_BIN=$SONARQUBE_DIR/sonar-scanner-4.6.2.2472-linux/bin +export SONARQUBE_SCANNER_BIN=$SONARQUBE_DIR/sonar-scanner-linux/bin diff --git a/internal/test_unit/config/STATAnalysisConfig_grid_stat b/internal/test_unit/config/STATAnalysisConfig_grid_stat index b6c222b123..d499c911e1 100644 --- a/internal/test_unit/config/STATAnalysisConfig_grid_stat +++ b/internal/test_unit/config/STATAnalysisConfig_grid_stat @@ -49,9 +49,9 @@ obtype = []; vx_mask = [ "DTC165", "DTC166" ]; -interp_mthd = [ "UW_MEAN_SQUARE" ]; +interp_mthd = []; -interp_pnts = [ 9 ]; +interp_pnts = []; fcst_thresh = []; obs_thresh = []; @@ -71,10 +71,11 @@ weight = []; // Array of STAT-Analysis jobs to be performed on the filtered data // jobs = [ - "-job filter -line_type CNT -fcst_thresh NA -alpha 0.05 -dump_row ${OUTPUT_DIR}/CONFIG_GRID_STAT_filter.stat", - "-job aggregate_stat -line_type SL1L2 -fcst_thresh NA -out_line_type CNT -dump_row ${OUTPUT_DIR}/CONFIG_GRID_STAT_agg_stat_sl1l2_dump.stat -out_stat ${OUTPUT_DIR}/CONFIG_GRID_STAT_agg_stat_sl1l2_out.stat -set_hdr VX_MASK CONUS", - "-job aggregate -line_type CTC -fcst_thresh \<273 -dump_row ${OUTPUT_DIR}/CONFIG_GRID_STAT_agg_ctc_dump.stat -out_stat ${OUTPUT_DIR}/CONFIG_GRID_STAT_agg_ctc_out.stat -set_hdr VX_MASK CONUS", - "-job aggregate_stat -line_type CTC -out_line_type ECLV -fcst_thresh \<273 -dump_row ${OUTPUT_DIR}/CONFIG_GRID_STAT_agg_stat_ctc_to_eclv_dump.stat -out_stat ${OUTPUT_DIR}/CONFIG_GRID_STAT_agg_stat_ctc_to_eclv_out.stat -set_hdr VX_MASK CONUS" + "-job filter -line_type CNT -fcst_thresh NA -alpha 0.05 -interp_mthd UW_MEAN_SQUARE -interp_pnts 9 -dump_row ${OUTPUT_DIR}/CONFIG_GRID_STAT_filter.stat", + "-job aggregate_stat -line_type SL1L2 -fcst_thresh NA -out_line_type CNT -by INTERP_MTHD,INTERP_PNTS -dump_row ${OUTPUT_DIR}/CONFIG_GRID_STAT_agg_stat_sl1l2_dump.stat -out_stat ${OUTPUT_DIR}/CONFIG_GRID_STAT_agg_stat_sl1l2_out.stat -set_hdr VX_MASK CONUS", + "-job aggregate -line_type CTC -by INTERP_MTHD,INTERP_PNTS,FCST_THRESH -dump_row ${OUTPUT_DIR}/CONFIG_GRID_STAT_agg_ctc_dump.stat -out_stat ${OUTPUT_DIR}/CONFIG_GRID_STAT_agg_ctc_out.stat -set_hdr VX_MASK CONUS", + "-job aggregate_stat -line_type CTC -out_line_type ECLV -by INTERP_MTHD,INTERP_PNTS,FCST_THRESH -dump_row ${OUTPUT_DIR}/CONFIG_GRID_STAT_agg_stat_ctc_to_eclv_dump.stat -out_stat ${OUTPUT_DIR}/CONFIG_GRID_STAT_agg_stat_ctc_to_eclv_out.stat -set_hdr VX_MASK CONUS", + "-job aggregate -line_type NBRCTC -by INTERP_MTHD,INTERP_PNTS,FCST_THRESH -dump_row ${OUTPUT_DIR}/CONFIG_GRID_STAT_agg_nbrctc_dump.stat -out_stat ${OUTPUT_DIR}/CONFIG_GRID_STAT_agg_nbrctc_out.stat -set_hdr VX_MASK CONUS" ]; //////////////////////////////////////////////////////////////////////////////// diff --git a/internal/test_unit/config/TCPairsConfig_CONSENSUS b/internal/test_unit/config/TCPairsConfig_CONSENSUS new file mode 100644 index 0000000000..16b2106a2a --- /dev/null +++ b/internal/test_unit/config/TCPairsConfig_CONSENSUS @@ -0,0 +1,198 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// TC-Pairs configuration file. +// +// For additional information, please see the MET User's Guide. +// +//////////////////////////////////////////////////////////////////////////////// + +// +// ATCF file format reference: +// http://www.nrlmry.navy.mil/atcf_web/docs/database/new/abrdeck.html +// + +// +// Models +// +model = []; + +// +// Description +// +desc = "NA"; + +// +// Storm identifiers +// +storm_id = [ "AL132020" ]; + +// +// Basins +// +basin = []; + +// +// Cyclone numbers +// +cyclone = []; + +// +// Storm names +// +storm_name = []; + +// +// Model initialization time windows to include or exclude +// +init_beg = ${INIT_BEG}; +init_end = ${INIT_END}; +init_inc = []; +init_exc = []; + +// +// Valid model time windows to include or exclude +// +valid_beg = ""; +valid_end = ""; +valid_inc = []; +valid_exc = []; + +// +// Valid times for which output should be written +// +write_valid = []; + +// +// Model initialization hours +// +init_hour = []; + +// +// Required lead time in hours +// +lead_req = []; + +// +// lat/lon polylines defining masking regions +// +init_mask = ""; +valid_mask = ""; + +// +// Specify if the code should check for duplicate ATCF lines +// +check_dup = TRUE; + +// +// Specify special processing to be performed for interpolated models. +// Set to NONE, FILL, or REPLACE. +// +interp12 = NONE; + +// +// Specify how consensus forecasts should be defined +// See NHC Consensus Definitions in Table 2: +// https://www.nhc.noaa.gov/modelsummary.shtml +// +consensus = [ + { + name = "UEMN_CONS"; + members = [ "UE00", "UE01", "UE02", "UE03", "UE04", + "UE05", "UE06", "UE07", "UE08", "UE09", + "UE10", "UE11", "UE12", "UE13", "UE14", + "UE15", "UE16", "UE17", "UE18", "UE19", + "UE20", "UE21", "UE22", "UE23", "UE24", + "UE25", "UE26", "UE27", "UE28", "UE29", + "UE30", "UE31", "UE32", "UE33", "UE34", + "UE35" ]; + required = []; + min_req = 36; + }, + { + name = "HCCA_CONS"; + members = [ "AEMI", "GFSI", "CTCI", "DSHP", "EGRI", "EMN2", "EMXI", "HWFI", "LGEM" ]; + required = []; + min_req = 8; + }, + { + name = "GFEX_CONS"; + members = [ "GFSI", "EMXI" ]; + required = []; + min_req = 2; + }, + { + name = "TVCA_CONS"; + members = [ "GFSI", "EGRI", "HWFI", "EMHI", "CTCI", "EMNI" ]; + required = []; + min_req = 2; + }, + { + name = "TVCX_CONS"; + members = [ "GFSI", "EMXI", "EMXI", "HWFI", "CTCI", "EGRI" ]; + required = [ TRUE, TRUE, FALSE, FALSE, FALSE, FALSE ]; + min_req = 2; + }, + { + name = "ICON_CONS"; + members = [ "DSHP", "LGEM", "HWFI", "HMNI" ]; + required = [ TRUE, TRUE, TRUE, TRUE ]; + min_req = 4; + }, + { + name = "IVCN_CONS"; + members = [ "DSHP", "LGEM", "HWFI", "HMNI", "CTCI" ]; + required = []; + min_req = 2; + } +]; + +// +// Forecast lag times +// +lag_time = []; + +// +// CLIPER/SHIFOR baseline forecasts to be derived from the BEST +// and operational (CARQ) tracks. +// +best_baseline = [ "BCLP" ]; +oper_baseline = [ "OCLP" ]; + +// +// Specify if only those track points common to both the ADECK and BDECK +// tracks be written out. +// +match_points = TRUE; + +// +// Specify the NetCDF output of the gen_dland tool containing a gridded +// representation of the minimum distance to land. +// +dland_file = "${MET_TEST_OUTPUT}/tc_dland/tc_dland_half_deg.nc"; + +// +// Specify watch/warning information: +// - Input watch/warning filename +// - Watch/warning time offset in seconds +// +watch_warn = { + file_name = "MET_BASE/tc_data/wwpts_us.txt"; + time_offset = -14400; +} + +// +// Modify basin names to make them consistent across ATCF input files. +// +basin_map = [ + { key = "SI"; val = "SH"; }, + { key = "SP"; val = "SH"; }, + { key = "AU"; val = "SH"; }, + { key = "AB"; val = "IO"; }, + { key = "BB"; val = "IO"; } +]; + +// +// Indicate a version number for the contents of this configuration file. +// The value should generally not be modified. +// +version = "V11.0.0"; diff --git a/internal/test_unit/hdr/met_11_0.hdr b/internal/test_unit/hdr/met_11_0.hdr index 99e888ee32..c1d7e318f0 100644 --- a/internal/test_unit/hdr/met_11_0.hdr +++ b/internal/test_unit/hdr/met_11_0.hdr @@ -33,5 +33,5 @@ SSIDX : VERSION MODEL DESC FCST_LEAD FCST_VALID_BEG FCST_VALID_END OBS_L MODE_SOA : VERSION MODEL DESC FCST_LEAD FCST_VALID_BEG FCST_VALID_END OBS_LEAD OBS_VALID_BEG OBS_VALID_END FCST_VAR FCST_UNITS FCST_LEV OBS_VAR OBS_UNITS OBS_LEV OBTYPE VX_MASK INTERP_MTHD INTERP_PNTS FCST_THRESH OBS_THRESH COV_THRESH ALPHA LINE_TYPE N_VALID GRID_RES OBJECT_ID OBJECT_CAT CENTROID_X CENTROID_Y CENTROID_LAT CENTROID_LON AXIS_ANG LENGTH WIDTH AREA AREA_THRESH CURVATURE CURVATURE_X CURVATURE_Y COMPLEXITY INTENSITY_10 INTENSITY_25 INTENSITY_50 INTENSITY_75 INTENSITY_90 INTENSITY_50 INTENSITY_SUM MODE_POA : VERSION MODEL DESC FCST_LEAD FCST_VALID_BEG FCST_VALID_END OBS_LEAD OBS_VALID_BEG OBS_VALID_END FCST_VAR FCST_UNITS FCST_LEV OBS_VAR OBS_UNITS OBS_LEV OBTYPE VX_MASK INTERP_MTHD INTERP_PNTS FCST_THRESH OBS_THRESH COV_THRESH ALPHA LINE_TYPE N_VALID GRID_RES OBJECT_ID OBJECT_CAT CENTROID_DIST BOUNDARY_DIST CONVEX_HULL_DIST ANGLE_DIFF ASPECT_DIFF AREA_RATIO INTERSECTION_AREA UNION_AREA SYMMETRIC_DIFF INTERSECTION_OVER_AREA CURVATURE_RATIO COMPLEXITY_RATIO PERCENTILE_INTENSITY_RATIO INTEREST MODE_CTS : VERSION MODEL DESC FCST_LEAD FCST_VALID_BEG FCST_VALID_END OBS_LEAD OBS_VALID_BEG OBS_VALID_END FCST_VAR FCST_UNITS FCST_LEV OBS_VAR OBS_UNITS OBS_LEV OBTYPE VX_MASK INTERP_MTHD INTERP_PNTS FCST_THRESH OBS_THRESH COV_THRESH ALPHA LINE_TYPE N_VALID GRID_RES FIELD TOTAL FY_OY FY_ON FN_OY FN_ON BASER FMEAN ACC FBIAS PODY PODN POFD FAR CSI GSS HK HSS ODDS -TCST_TCMPR : VERSION MODEL DESC FCST_LEAD FCST_VALID_BEG FCST_VALID_END OBS_LEAD OBS_VALID_BEG OBS_VALID_END FCST_VAR FCST_UNITS FCST_LEV OBS_VAR OBS_UNITS OBS_LEV OBTYPE VX_MASK INTERP_MTHD INTERP_PNTS FCST_THRESH OBS_THRESH COV_THRESH ALPHA LINE_TYPE AMODEL BMODEL STORM_ID BASIN CYCLONE STORM_NAME INIT_MASK VALID_MASK TOTAL INDEX LEVEL WATCH_WARN INITIALS ALAT ALON BLAT BLON TK_ERR X_ERR Y_ERR ALTK_ERR CRTK_ERR ADLAND BDLAND AMSLP BMSLP AMAX_WIND BMAX_WIND AAL_WIND_34 BAL_WIND_34 ANE_WIND_34 BNE_WIND_34 ASE_WIND_34 BSE_WIND_34 ASW_WIND_34 BSW_WIND_34 ANW_WIND_34 BNW_WIND_34 AAL_WIND_50 BAL_WIND_50 ANE_WIND_50 BNE_WIND_50 ASE_WIND_50 BSE_WIND_50 ASW_WIND_50 BSW_WIND_50 ANW_WIND_50 BNW_WIND_50 AAL_WIND_64 BAL_WIND_64 ANE_WIND_64 BNE_WIND_64 ASE_WIND_64 BSE_WIND_64 ASW_WIND_64 BSW_WIND_64 ANW_WIND_64 BNW_WIND_64 ARADP BRADP ARRP BRRP AMRD BMRD AGUSTS BGUSTS AEYE BEYE ADIR BDIR ASPEED BSPEED ADEPTH BDEPTH +TCST_TCMPR : VERSION MODEL DESC FCST_LEAD FCST_VALID_BEG FCST_VALID_END OBS_LEAD OBS_VALID_BEG OBS_VALID_END FCST_VAR FCST_UNITS FCST_LEV OBS_VAR OBS_UNITS OBS_LEV OBTYPE VX_MASK INTERP_MTHD INTERP_PNTS FCST_THRESH OBS_THRESH COV_THRESH ALPHA LINE_TYPE AMODEL BMODEL STORM_ID BASIN CYCLONE STORM_NAME INIT_MASK VALID_MASK TOTAL INDEX LEVEL WATCH_WARN INITIALS ALAT ALON BLAT BLON TK_ERR X_ERR Y_ERR ALTK_ERR CRTK_ERR ADLAND BDLAND AMSLP BMSLP AMAX_WIND BMAX_WIND AAL_WIND_34 BAL_WIND_34 ANE_WIND_34 BNE_WIND_34 ASE_WIND_34 BSE_WIND_34 ASW_WIND_34 BSW_WIND_34 ANW_WIND_34 BNW_WIND_34 AAL_WIND_50 BAL_WIND_50 ANE_WIND_50 BNE_WIND_50 ASE_WIND_50 BSE_WIND_50 ASW_WIND_50 BSW_WIND_50 ANW_WIND_50 BNW_WIND_50 AAL_WIND_64 BAL_WIND_64 ANE_WIND_64 BNE_WIND_64 ASE_WIND_64 BSE_WIND_64 ASW_WIND_64 BSW_WIND_64 ANW_WIND_64 BNW_WIND_64 ARADP BRADP ARRP BRRP AMRD BMRD AGUSTS BGUSTS AEYE BEYE ADIR BDIR ASPEED BSPEED ADEPTH BDEPTH NUM_MEMBERS TRACK_SPREAD DIST_MEAN MSLP_SPREAD MAX_WIND_SPREAD TCST_PROBRIRW : VERSION MODEL DESC FCST_LEAD FCST_VALID_BEG FCST_VALID_END OBS_LEAD OBS_VALID_BEG OBS_VALID_END FCST_VAR FCST_UNITS FCST_LEV OBS_VAR OBS_UNITS OBS_LEV OBTYPE VX_MASK INTERP_MTHD INTERP_PNTS FCST_THRESH OBS_THRESH COV_THRESH ALPHA LINE_TYPE ALAT ALON BLAT BLON INITIALS TK_ERR X_ERR Y_ERR ADLAND BDLAND RI_BEG RI_END RI_WINDOW AWIND_END BWIND_BEG BWIND_END BDELTA BDELTA_MAX BLEVEL_BEG BLEVEL_END N_THRESH _VAR_ diff --git a/internal/test_unit/xml/unit_ascii2nc.xml b/internal/test_unit/xml/unit_ascii2nc.xml index ac2341f270..77f445e1c0 100644 --- a/internal/test_unit/xml/unit_ascii2nc.xml +++ b/internal/test_unit/xml/unit_ascii2nc.xml @@ -150,4 +150,56 @@ + + &MET_BIN;/ascii2nc + \ + -format ndbc_standard \ + &DATA_DIR_OBS;/ndbc/13001.txt \ + &DATA_DIR_OBS;/ndbc/13002.txt \ + &DATA_DIR_OBS;/ndbc/13008.txt \ + &DATA_DIR_OBS;/ndbc/13009.txt \ + &DATA_DIR_OBS;/ndbc/14040.txt \ + &DATA_DIR_OBS;/ndbc/14043.txt \ + &DATA_DIR_OBS;/ndbc/15001.txt \ + &DATA_DIR_OBS;/ndbc/15002.txt \ + &DATA_DIR_OBS;/ndbc/15006.txt \ + &DATA_DIR_OBS;/ndbc/28401.txt \ + &DATA_DIR_OBS;/ndbc/31001.txt \ + &DATA_DIR_OBS;/ndbc/31003.txt \ + &DATA_DIR_OBS;/ndbc/31004.txt \ + &DATA_DIR_OBS;/ndbc/31005.txt \ + &DATA_DIR_OBS;/ndbc/31006.txt \ + &DATA_DIR_OBS;/ndbc/31007.txt \ + &DATA_DIR_OBS;/ndbc/32ST0.txt\ + &DATA_DIR_OBS;/ndbc/51000.txt \ + &DATA_DIR_OBS;/ndbc/51001.txt \ + &DATA_DIR_OBS;/ndbc/51002.txt \ + &DATA_DIR_OBS;/ndbc/51003.txt \ + &DATA_DIR_OBS;/ndbc/51004.txt \ + &DATA_DIR_OBS;/ndbc/51101.txt \ + &DATA_DIR_OBS;/ndbc/51201.txt \ + &DATA_DIR_OBS;/ndbc/51202.txt \ + &DATA_DIR_OBS;/ndbc/51205.txt \ + &DATA_DIR_OBS;/ndbc/51206.txt \ + &DATA_DIR_OBS;/ndbc/51207.txt \ + &DATA_DIR_OBS;/ndbc/51208.txt \ + &DATA_DIR_OBS;/ndbc/51209.txt \ + &DATA_DIR_OBS;/ndbc/51211.txt \ + &DATA_DIR_OBS;/ndbc/51212.txt \ + &DATA_DIR_OBS;/ndbc/51213.txt \ + &DATA_DIR_OBS;/ndbc/51WH0.txt \ + &DATA_DIR_OBS;/ndbc/52200.txt \ + &DATA_DIR_OBS;/ndbc/52202.txt\ + &DATA_DIR_OBS;/ndbc/52211.txt \ + &DATA_DIR_OBS;/ndbc/52212.txt \ + &OUTPUT_DIR;/ascii2nc/ndbc.nc + + + &OUTPUT_DIR;/ascii2nc/ndbc.nc + + + + + + diff --git a/internal/test_unit/xml/unit_netcdf.xml b/internal/test_unit/xml/unit_netcdf.xml index 5c0b255240..a6e98311a9 100644 --- a/internal/test_unit/xml/unit_netcdf.xml +++ b/internal/test_unit/xml/unit_netcdf.xml @@ -111,4 +111,60 @@ + + &MET_BIN;/regrid_data_plane + \ + &DATA_DIR_MODEL;/nccf/woa18_decav_t05_04_small_month_376p5.nc \ + &DATA_DIR_MODEL;/nccf/woa18_decav_t05_04_small_month_376p5.nc \ + &OUTPUT_DIR;/netcdf/regrid_data_plane_months_units.nc \ + -field 'name="t_an"; level="(0,0,*,*)";' \ + -v 1 + + + &OUTPUT_DIR;/netcdf/regrid_data_plane_months_units.nc + + + + + &MET_BIN;/regrid_data_plane + \ + &DATA_DIR_MODEL;/nccf/woa18_decav_t05_04_small_month_376p5_day2.nc \ + &DATA_DIR_MODEL;/nccf/woa18_decav_t05_04_small_month_376p5_day2.nc \ + &OUTPUT_DIR;/netcdf/regrid_data_plane_months_units_day2.nc \ + -field 'name="t_an"; level="(0,0,*,*)";' \ + -v 1 + + + &OUTPUT_DIR;/netcdf/regrid_data_plane_months_units_day2.nc + + + + + &MET_BIN;/regrid_data_plane + \ + &DATA_DIR_MODEL;/nccf/woa18_decav_t05_04_small_month_d25_3p66.nc \ + &DATA_DIR_MODEL;/nccf/woa18_decav_t05_04_small_month_d25_3p66.nc\ + &OUTPUT_DIR;/netcdf/regrid_data_plane_months_units_to_next_month.nc \ + -field 'name="t_an"; level="(0,0,*,*)";' \ + -v 1 + + + &OUTPUT_DIR;/netcdf/regrid_data_plane_months_units_to_next_month.nc + + + + + &MET_BIN;/regrid_data_plane + \ + &DATA_DIR_MODEL;/nccf/woa18_decav_t05_04_small_year_3p66.nc \ + &DATA_DIR_MODEL;/nccf/woa18_decav_t05_04_small_year_3p66.nc \ + &OUTPUT_DIR;/netcdf/regrid_data_plane_years_units.nc \ + -field 'name="t_an"; level="(0,0,*,*)";' \ + -v 1 + + + &OUTPUT_DIR;/netcdf/regrid_data_plane_years_units.nc + + + diff --git a/internal/test_unit/xml/unit_stat_analysis_gs.xml b/internal/test_unit/xml/unit_stat_analysis_gs.xml index 6309f57aef..a70be2d076 100644 --- a/internal/test_unit/xml/unit_stat_analysis_gs.xml +++ b/internal/test_unit/xml/unit_stat_analysis_gs.xml @@ -39,6 +39,8 @@ &OUTPUT_DIR;/stat_analysis_gs/CONFIG_GRID_STAT_agg_ctc_out.stat &OUTPUT_DIR;/stat_analysis_gs/CONFIG_GRID_STAT_agg_stat_ctc_to_eclv_dump.stat &OUTPUT_DIR;/stat_analysis_gs/CONFIG_GRID_STAT_agg_stat_ctc_to_eclv_out.stat + &OUTPUT_DIR;/stat_analysis_gs/CONFIG_GRID_STAT_agg_nbrctc_dump.stat + &OUTPUT_DIR;/stat_analysis_gs/CONFIG_GRID_STAT_agg_nbrctc_out.stat diff --git a/internal/test_unit/xml/unit_stat_analysis_ps.xml b/internal/test_unit/xml/unit_stat_analysis_ps.xml index d32fe963f7..dba20346c8 100644 --- a/internal/test_unit/xml/unit_stat_analysis_ps.xml +++ b/internal/test_unit/xml/unit_stat_analysis_ps.xml @@ -68,9 +68,11 @@ - &MET_BIN;/stat_analysis + touch &OUTPUT_DIR;/stat_analysis_ps/EmptyConfigFile; \ + &MET_BIN;/stat_analysis \ -lookin &OUTPUT_DIR;/point_stat/point_stat_GRIB1_NAM_GDAS_120000L_20120409_120000V.stat \ + -config &OUTPUT_DIR;/stat_analysis_ps/EmptyConfigFile \ -job filter -line_type MPR -fcst_var TMP -fcst_lev Z2 -vx_mask DTC165 \ -column_str OBS_SID KDLN,KDHT,KDEN,KDLS,KDMA,KDMN,KDVT,KDEW \ -column_str_exc OBS_SID KDLN,KDHT \ diff --git a/internal/test_unit/xml/unit_tc_pairs.xml b/internal/test_unit/xml/unit_tc_pairs.xml index d35465237a..44f986fd10 100644 --- a/internal/test_unit/xml/unit_tc_pairs.xml +++ b/internal/test_unit/xml/unit_tc_pairs.xml @@ -36,6 +36,25 @@ + + &MET_BIN;/tc_pairs + + INIT_BEG "20200823_00" + INIT_END "20200823_18" + + \ + -adeck &DATA_DIR;/adeck/aal132020.dat \ + -bdeck &DATA_DIR;/bdeck/bal132020.dat \ + -config &CONFIG_DIR;/TCPairsConfig_CONSENSUS \ + -out &OUTPUT_DIR;/tc_pairs/al132020_CONSENSUS \ + -log &OUTPUT_DIR;/tc_pairs/tc_pairs_CONSENSUS.log \ + -v 2 + + + &OUTPUT_DIR;/tc_pairs/al132020_CONSENSUS.tcst + + + &MET_BIN;/tc_pairs diff --git a/internal/test_util/libcode/vx_nc_util/Makefile.am b/internal/test_util/libcode/vx_nc_util/Makefile.am index b374eba00f..39d0cd9867 100644 --- a/internal/test_util/libcode/vx_nc_util/Makefile.am +++ b/internal/test_util/libcode/vx_nc_util/Makefile.am @@ -42,6 +42,7 @@ test_pressure_levels_LDADD = -lvx_stat_out \ -lvx_config \ -lvx_gsl_prob \ -lvx_cal \ + -lvx_nav \ -lvx_util_math \ -lvx_util \ -lvx_math \ diff --git a/internal/test_util/libcode/vx_nc_util/Makefile.in b/internal/test_util/libcode/vx_nc_util/Makefile.in index 57f091eed3..bc6cf1d1db 100644 --- a/internal/test_util/libcode/vx_nc_util/Makefile.in +++ b/internal/test_util/libcode/vx_nc_util/Makefile.in @@ -343,6 +343,7 @@ test_pressure_levels_LDADD = -lvx_stat_out \ -lvx_config \ -lvx_gsl_prob \ -lvx_cal \ + -lvx_nav \ -lvx_util_math \ -lvx_util \ -lvx_math \ diff --git a/internal/test_util/libcode/vx_series_data/test_series_data.cc b/internal/test_util/libcode/vx_series_data/test_series_data.cc index d9cd9f0cb3..c717ec8f7f 100644 --- a/internal/test_util/libcode/vx_series_data/test_series_data.cc +++ b/internal/test_util/libcode/vx_series_data/test_series_data.cc @@ -7,6 +7,8 @@ // *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* //////////////////////////////////////////////////////////////////////// +using namespace std; + #include #include #include diff --git a/scripts/python/derive_WRF_semilatlon.py b/scripts/python/derive_WRF_semilatlon.py index 4a9bc74f31..d42cfc66c3 100644 --- a/scripts/python/derive_WRF_semilatlon.py +++ b/scripts/python/derive_WRF_semilatlon.py @@ -1,5 +1,3 @@ -from __future__ import print_function - import os import sys import numpy as np @@ -13,44 +11,44 @@ ## load the data into the numpy array ## -if len(sys.argv) == 4: - # Read the input file as the first argument - input_file = os.path.expandvars(sys.argv[1]) - var_name = sys.argv[2] - axis = sys.argv[3] - - try: - # Print some output to verify that this script ran - print("Input File: " + repr(input_file)) - print("Variable: " + repr(var_name)) - print("Axis: " + repr(axis)) - - # Read input file - f = Dataset(input_file, 'r') - - data = np.float64(f.variables[var_name][0,:,:,:]) - data[data > 1.0e30] = np.nan - - pvals = list(np.float64(f.variables["pressure"][:])) - - if axis == "lon": - met_data = np.nanmean(data[::-1], axis=1).copy() - elif axis == "lat": - met_data = np.nanmean(data[::-1], axis=2).transpose().copy() - elif axis == "latlon": - met_data = np.nanmean(data[::-1], axis=1).copy() - else: - print("ERROR: Unsupported axis type: " + axis) - sys.exit(1) - - print("Data Shape: " + repr(met_data.shape)) - print("Data Type: " + repr(met_data.dtype)) - except NameError: - print("Trouble reading data from input file") -else: +if len(sys.argv) != 4: print("Must specify exactly one input file, variable name, and summary axis (lat, lon, latlon).") sys.exit(1) +# Read the input file as the first argument +input_file = os.path.expandvars(sys.argv[1]) +var_name = sys.argv[2] +axis = sys.argv[3] + +try: + # Print some output to verify that this script ran + print("Input File: " + repr(input_file)) + print("Variable: " + repr(var_name)) + print("Axis: " + repr(axis)) + + # Read input file + f = Dataset(input_file, 'r') + + data = np.float64(f.variables[var_name][0,:,:,:]) + data[data > 1.0e30] = np.nan + + pvals = list(np.float64(f.variables["pressure"][:])) + + if axis == "lon": + met_data = np.nanmean(data[::-1], axis=1).copy() + elif axis == "lat": + met_data = np.nanmean(data[::-1], axis=2).transpose().copy() + elif axis == "latlon": + met_data = np.nanmean(data[::-1], axis=1).copy() + else: + print("ERROR: Unsupported axis type: " + axis) + sys.exit(1) + + print("Data Shape: " + repr(met_data.shape)) + print("Data Type: " + repr(met_data.dtype)) +except NameError: + print("Trouble reading data from input file") + ########################################### ## diff --git a/scripts/python/read_ascii_mpr.py b/scripts/python/read_ascii_mpr.py index 4a8c988405..fa71b8e6d2 100755 --- a/scripts/python/read_ascii_mpr.py +++ b/scripts/python/read_ascii_mpr.py @@ -1,5 +1,3 @@ -from __future__ import print_function - import pandas as pd import os import sys @@ -13,24 +11,23 @@ ## load the data into the numpy array ## -if len(sys.argv) == 2: - # Read the input file as the first argument - input_file = os.path.expandvars(sys.argv[1]) - try: - print("Input File:\t" + repr(input_file)) - - # Read MPR lines, skipping the header row and first column. - mpr_data = pd.read_csv(input_file, header=None, - delim_whitespace=True, keep_default_na=False, - skiprows=1, usecols=range(1,37), - dtype=str).values.tolist() - print("Data Length:\t" + repr(len(mpr_data))) - print("Data Type:\t" + repr(type(mpr_data))) - except NameError: - print("Can't find the input file") -else: +if len(sys.argv) != 2: print("ERROR: read_ascii_point.py -> Must specify exactly one input file.") sys.exit(1) -######################################################################## +# Read the input file as the first argument +input_file = os.path.expandvars(sys.argv[1]) +try: + print("Input File:\t" + repr(input_file)) + + # Read MPR lines, skipping the header row and first column. + mpr_data = pd.read_csv(input_file, header=None, + delim_whitespace=True, keep_default_na=False, + skiprows=1, usecols=range(1,37), + dtype=str).values.tolist() + print("Data Length:\t" + repr(len(mpr_data))) + print("Data Type:\t" + repr(type(mpr_data))) +except NameError: + print("Can't find the input file") +######################################################################## diff --git a/scripts/python/read_ascii_numpy.py b/scripts/python/read_ascii_numpy.py index b7a1e081b4..6d129afc1c 100755 --- a/scripts/python/read_ascii_numpy.py +++ b/scripts/python/read_ascii_numpy.py @@ -1,5 +1,3 @@ -from __future__ import print_function - import numpy as np import os import sys @@ -13,23 +11,23 @@ ## load the data into the numpy array ## -if len(sys.argv) == 3: - # Read the input file as the first argument - input_file = os.path.expandvars(sys.argv[1]) - data_name = sys.argv[2] - try: - # Print some output to verify that this script ran - print("Input File:\t" + repr(input_file)) - print("Data Name:\t" + repr(data_name)) - met_data = np.loadtxt(input_file) - print("Data Shape:\t" + repr(met_data.shape)) - print("Data Type:\t" + repr(met_data.dtype)) - except NameError: - print("Can't find the input file") -else: +if len(sys.argv) != 3: print("ERROR: read_ascii_numpy.py -> Must specify exactly one input file and a name for the data.") sys.exit(1) +# Read the input file as the first argument +input_file = os.path.expandvars(sys.argv[1]) +data_name = sys.argv[2] +try: + # Print some output to verify that this script ran + print("Input File:\t" + repr(input_file)) + print("Data Name:\t" + repr(data_name)) + met_data = np.loadtxt(input_file) + print("Data Shape:\t" + repr(met_data.shape)) + print("Data Type:\t" + repr(met_data.dtype)) +except NameError: + print("Can't find the input file") + ########################################### ## diff --git a/scripts/python/read_ascii_numpy_grid.py b/scripts/python/read_ascii_numpy_grid.py index fa72cbff6b..3e4cc25f69 100755 --- a/scripts/python/read_ascii_numpy_grid.py +++ b/scripts/python/read_ascii_numpy_grid.py @@ -1,5 +1,3 @@ -from __future__ import print_function - import numpy as np import os import sys @@ -13,23 +11,23 @@ ## load the data into the numpy array ## -if len(sys.argv) == 3: - # Read the input file as the first argument - input_file = os.path.expandvars(sys.argv[1]) - data_name = sys.argv[2] - try: - # Print some output to verify that this script ran - print("Input File:\t" + repr(input_file)) - print("Data Name:\t" + repr(data_name)) - met_data = np.loadtxt(input_file) - print("Data Shape:\t" + repr(met_data.shape)) - print("Data Type:\t" + repr(met_data.dtype)) - except NameError: - print("Can't find the input file") -else: +if len(sys.argv) != 3: print("ERROR: read_ascii_numpy.py -> Must specify exactly one input file and a name for the data.") sys.exit(1) +# Read the input file as the first argument +input_file = os.path.expandvars(sys.argv[1]) +data_name = sys.argv[2] +try: + # Print some output to verify that this script ran + print("Input File:\t" + repr(input_file)) + print("Data Name:\t" + repr(data_name)) + met_data = np.loadtxt(input_file) + print("Data Shape:\t" + repr(met_data.shape)) + print("Data Type:\t" + repr(met_data.dtype)) +except NameError: + print("Can't find the input file") + ########################################### ## diff --git a/scripts/python/read_ascii_point.py b/scripts/python/read_ascii_point.py index cfd37d272a..ee7d2b7b9f 100755 --- a/scripts/python/read_ascii_point.py +++ b/scripts/python/read_ascii_point.py @@ -1,5 +1,3 @@ -from __future__ import print_function - import pandas as pd import os import sys @@ -8,40 +6,40 @@ print("Python Script:\t" + repr(sys.argv[0])) - ## - ## input file specified on the command line - ## load the data into the numpy array - ## - -if len(sys.argv) == 2: - # Read the input file as the first argument - input_file = os.path.expandvars(sys.argv[1]) - try: - print("Input File:\t" + repr(input_file)) - - # Read and format the input 11-column observations: - # (1) string: Message_Type - # (2) string: Station_ID - # (3) string: Valid_Time(YYYYMMDD_HHMMSS) - # (4) numeric: Lat(Deg North) - # (5) numeric: Lon(Deg East) - # (6) numeric: Elevation(msl) - # (7) string: Var_Name(or GRIB_Code) - # (8) numeric: Level - # (9) numeric: Height(msl or agl) - # (10) string: QC_String - # (11) numeric: Observation_Value - - point_data = pd.read_csv(input_file, header=None, delim_whitespace=True, keep_default_na=False, - names=['typ', 'sid', 'vld', 'lat', 'lon', 'elv', 'var', 'lvl', 'hgt', 'qc', 'obs'], - dtype={'typ':'str', 'sid':'str', 'vld':'str', 'var':'str', 'qc':'str'}).values.tolist() - print("Data Length:\t" + repr(len(point_data))) - print("Data Type:\t" + repr(type(point_data))) - except NameError: - print("Can't find the input file") -else: +## +## input file specified on the command line +## load the data into the numpy array +## + +if len(sys.argv) != 2: print("ERROR: read_ascii_point.py -> Must specify exactly one input file.") sys.exit(1) -######################################################################## +# Read the input file as the first argument +input_file = os.path.expandvars(sys.argv[1]) +try: + print("Input File:\t" + repr(input_file)) + + # Read and format the input 11-column observations: + # (1) string: Message_Type + # (2) string: Station_ID + # (3) string: Valid_Time(YYYYMMDD_HHMMSS) + # (4) numeric: Lat(Deg North) + # (5) numeric: Lon(Deg East) + # (6) numeric: Elevation(msl) + # (7) string: Var_Name(or GRIB_Code) + # (8) numeric: Level + # (9) numeric: Height(msl or agl) + # (10) string: QC_String + # (11) numeric: Observation_Value + + point_data = pd.read_csv(input_file, header=None, delim_whitespace=True, keep_default_na=False, + names=['typ', 'sid', 'vld', 'lat', 'lon', 'elv', 'var', 'lvl', 'hgt', 'qc', 'obs'], + dtype={'typ':'str', 'sid':'str', 'vld':'str', 'var':'str', 'qc':'str'}).values.tolist() + print("Data Length:\t" + repr(len(point_data))) + print("Data Type:\t" + repr(type(point_data))) +except NameError: + print("Can't find the input file") + sys.exit(1) +######################################################################## diff --git a/scripts/python/read_ascii_xarray.py b/scripts/python/read_ascii_xarray.py index 53f8574d48..6e906863a7 100755 --- a/scripts/python/read_ascii_xarray.py +++ b/scripts/python/read_ascii_xarray.py @@ -1,5 +1,3 @@ -from __future__ import print_function - import numpy as np import os import sys @@ -14,23 +12,23 @@ ## load the data into the numpy array ## -if len(sys.argv) == 3: - # Read the input file as the first argument - input_file = os.path.expandvars(sys.argv[1]) - data_name = sys.argv[2] - try: - # Print some output to verify that this script ran - print("Input File:\t" + repr(input_file)) - print("Data Name:\t" + repr(data_name)) - met_data = np.loadtxt(input_file) - print("Data Shape:\t" + repr(met_data.shape)) - print("Data Type:\t" + repr(met_data.dtype)) - except NameError: - print("Can't find the input file") -else: +if len(sys.argv) != 3: print("ERROR: read_ascii_xarray.py -> Must specify exactly one input file and a name for the data.") sys.exit(1) +# Read the input file as the first argument +input_file = os.path.expandvars(sys.argv[1]) +data_name = sys.argv[2] +try: + # Print some output to verify that this script ran + print("Input File:\t" + repr(input_file)) + print("Data Name:\t" + repr(data_name)) + met_data = np.loadtxt(input_file) + print("Data Shape:\t" + repr(met_data.shape)) + print("Data Type:\t" + repr(met_data.dtype)) +except NameError: + print("Can't find the input file") + ########################################### ## diff --git a/src/basic/vx_cal/is_leap_year.cc b/src/basic/vx_cal/is_leap_year.cc index 42cc100a76..efc5f66f05 100644 --- a/src/basic/vx_cal/is_leap_year.cc +++ b/src/basic/vx_cal/is_leap_year.cc @@ -90,24 +90,91 @@ void increase_one_month(int &year, int &month) { //////////////////////////////////////////////////////////////////////// -unixtime add_to_unixtime(unixtime base_unixtime, - int sec_per_unit, double time_value, bool no_leap) { +#define SEC_MONTH (86400*30) +#define SEC_YEAR (86400*30*12) +#define DAY_EPSILON 0.00002 + +unixtime add_to_unixtime(unixtime base_unixtime, int sec_per_unit, + double time_value, bool no_leap) { unixtime ut; + int month, day, year, hour, minute, second; unixtime time_value_ut = (unixtime)time_value; double time_fraction = time_value - time_value_ut; - if (!no_leap || sec_per_unit != 86400) { + const char *method_name = "add_to_unixtime() -->"; + + if (sec_per_unit == SEC_MONTH || sec_per_unit == SEC_YEAR) { + if (time_value < 0) { + mlog << Error << "\n" << method_name + << " the negative offset (" << time_value + << ") is not supported for unit months and years\n\n"; + exit(-1); + } + + unix_to_mdyhms(base_unixtime, month, day, year, hour, minute, second); + + int month_offset; + double day_offset; + if (sec_per_unit == SEC_YEAR) { + year += time_value_ut; + time_fraction *= 12; // 12 months/year + month_offset = (unixtime)time_fraction; + time_fraction -= month_offset; + } + else month_offset = time_value_ut; + + for (int idx=0; idx 0.5) day++; + } + } + else { + day_offset = time_fraction * 30; + time_value_ut = (int)day_offset; + day += time_value_ut; + if (day_offset - time_value_ut > 0.5) day++; + if (day > 30) { + day -= 30; + increase_one_month(year, month); + } + } + + int day_org = day; + bool day_adjusted = false; + int max_day = monthly_days[month-1]; + if (day > max_day) { + day = max_day; + day_adjusted = true; + if (month == 2 && is_leap_year(year)) { + if (day_org == 29) day_adjusted = false; + day = 29; + } + } + ut = mdyhms_to_unix(month, day, year, hour, minute, second); + if (day_adjusted) { + mlog << Debug(2) << method_name << "adjusted day " << day_org + << " to " << day << " for " << year << "-" << month << "\n"; + } + } + else if (!no_leap || sec_per_unit != 86400) { + // seconds, minute, hours, and day unit with leap year bool use_ut = true; + // For the precision: case 1: 1.9999 to 2 + // case 2: 2.0001 to 2 + // Other cases are as floating number if ((1.0 - time_fraction) < TIME_EPSILON) time_value_ut += 1; else if (time_fraction > TIME_EPSILON) use_ut = false; if (use_ut) ut = (unixtime)(base_unixtime + sec_per_unit * time_value_ut); else ut = (unixtime)(base_unixtime + sec_per_unit * time_value); } - else { - int day_offset; - int month, day, year, hour, minute, second; - + else { // no_leap year && unit = day unix_to_mdyhms(base_unixtime, month, day, year, hour, minute, second); - day_offset = day + (int)time_value; + int day_offset = day + (int)time_value; if (day_offset < 0) { while (day_offset < 0) { decrease_one_month(year, month); @@ -125,11 +192,11 @@ unixtime add_to_unixtime(unixtime base_unixtime, ut = mdyhms_to_unix(month, day, year, hour, minute, second); if (time_fraction > (1-TIME_EPSILON) ) ut += sec_per_unit; else if (time_fraction > TIME_EPSILON) ut += (time_fraction * sec_per_unit); - mlog << Debug(5) << "add_to_unixtime() -> " - << unix_to_yyyymmdd_hhmmss(base_unixtime) - << " plus " << time_value << " days = " - << unix_to_yyyymmdd_hhmmss(ut) << "\n"; } + mlog << Debug(5) << method_name + << unix_to_yyyymmdd_hhmmss(base_unixtime) + << " plus " << time_value << " days = " + << unix_to_yyyymmdd_hhmmss(ut) << "\n"; return ut; } diff --git a/src/basic/vx_cal/time_array.h b/src/basic/vx_cal/time_array.h index ecfa15e1aa..1eabd0b081 100644 --- a/src/basic/vx_cal/time_array.h +++ b/src/basic/vx_cal/time_array.h @@ -60,7 +60,7 @@ class TimeArray { void extend(int, bool exact = true); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; unixtime operator[](int) const; diff --git a/src/basic/vx_cal/vx_cal.h b/src/basic/vx_cal/vx_cal.h index 74885b50a1..272ee17d75 100644 --- a/src/basic/vx_cal/vx_cal.h +++ b/src/basic/vx_cal/vx_cal.h @@ -180,14 +180,14 @@ static const double TIME_EPSILON = 0.001; // Bad Data Values // -static const int bad_data_int = -9999; -static const long long bad_data_ll = -9999LL; -static const float bad_data_float = -9999.f; -static const double bad_data_double = -9999.0; -static const char bad_data_str[] = "-9999"; -static const char bad_data_char = '\0'; -static const char na_str[] = "NA"; -static const string na_string = "NA"; +static const int bad_data_int = -9999; +static const long long bad_data_ll = -9999LL; +static const float bad_data_float = -9999.f; +static const double bad_data_double = -9999.0; +static const char bad_data_str[] = "-9999"; +static const char bad_data_char = '\0'; +static const char na_str[] = "NA"; +static const std::string na_string = "NA"; //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_config/config_file.h b/src/basic/vx_config/config_file.h index e5a2953692..d079daffba 100644 --- a/src/basic/vx_config/config_file.h +++ b/src/basic/vx_config/config_file.h @@ -48,7 +48,7 @@ class MetConfig : public Dictionary { void clear(); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; // // set stuff diff --git a/src/basic/vx_config/config_util.h b/src/basic/vx_config/config_util.h index d39d08b615..45de85dd0f 100644 --- a/src/basic/vx_config/config_util.h +++ b/src/basic/vx_config/config_util.h @@ -33,9 +33,9 @@ static const char conf_key_old_prepbufr_map[] = "obs_prefbufr_map"; // for ba extern ConcatString parse_conf_version(Dictionary *dict); extern ConcatString parse_conf_string(Dictionary *dict, const char *, bool check_empty = true); extern GrdFileType parse_conf_file_type(Dictionary *dict); -extern map +extern std::map parse_conf_output_flag(Dictionary *dict, const STATLineType *, int); -extern map +extern std::map parse_conf_output_stats(Dictionary *dict); extern int parse_conf_n_vx(Dictionary *dict); extern Dictionary parse_conf_i_vx_dict(Dictionary *dict, int index); @@ -43,7 +43,7 @@ extern StringArray parse_conf_tc_model(Dictionary *dict, bool error_out = de extern StringArray parse_conf_message_type(Dictionary *dict, bool error_out = default_dictionary_error_out); extern StringArray parse_conf_sid_list(Dictionary *dict, const char *); extern void parse_sid_mask(const ConcatString &, StringArray &, ConcatString &); -extern vector +extern std::vector parse_conf_llpnt_mask(Dictionary *dict); extern StringArray parse_conf_obs_qty_inc(Dictionary *dict); extern StringArray parse_conf_obs_qty_exc(Dictionary *dict); @@ -51,16 +51,16 @@ extern NumArray parse_conf_ci_alpha(Dictionary *dict); extern NumArray parse_conf_eclv_points(Dictionary *dict); extern ClimoCDFInfo parse_conf_climo_cdf(Dictionary *dict); extern TimeSummaryInfo parse_conf_time_summary(Dictionary *dict); -extern map parse_conf_key_value_map( +extern std::map parse_conf_key_value_map( Dictionary *dict, const char *conf_key_map_name, const char *caller=0); extern void parse_add_conf_key_value_map( - Dictionary *dict, const char *conf_key_map_name, map *m); -extern map + Dictionary *dict, const char *conf_key_map_name, std::map *m); +extern std::map parse_conf_message_type_map(Dictionary *dict); -extern map +extern std::map parse_conf_message_type_group_map(Dictionary *dict); -extern map parse_conf_metadata_map(Dictionary *dict); -extern map +extern std::map parse_conf_metadata_map(Dictionary *dict); +extern std::map parse_conf_obs_name_map(Dictionary *dict); extern BootInfo parse_conf_boot(Dictionary *dict); extern RegridInfo parse_conf_regrid(Dictionary *dict, bool error_out = default_dictionary_error_out); @@ -74,7 +74,7 @@ extern ConcatString parse_conf_tmp_dir(Dictionary *dict); extern GridDecompType parse_conf_grid_decomp_flag(Dictionary *dict); extern WaveletType parse_conf_wavelet_type(Dictionary *dict); extern PlotInfo parse_conf_plot_info(Dictionary *dict); -extern map +extern std::map parse_conf_filter_attr_map(Dictionary *dict); extern void parse_conf_range_int(Dictionary *dict, int &beg, int &end); extern void parse_conf_range_double(Dictionary *dict, double &beg, double &end); diff --git a/src/basic/vx_config/dictionary.h b/src/basic/vx_config/dictionary.h index 6319e8d78c..4265b7c3d1 100644 --- a/src/basic/vx_config/dictionary.h +++ b/src/basic/vx_config/dictionary.h @@ -85,9 +85,9 @@ class DictionaryEntry { void clear(); - void dump(ostream & out, int = 0) const; + void dump(std::ostream & out, int = 0) const; - void dump_config_format(ostream & out, int = 0) const; + void dump_config_format(std::ostream & out, int = 0) const; // // set stuff @@ -219,9 +219,9 @@ class Dictionary { void clear(); - virtual void dump(ostream &, int = 0) const; + virtual void dump(std::ostream &, int = 0) const; - virtual void dump_config_format(ostream & out, int = 0) const; + virtual void dump_config_format(std::ostream & out, int = 0) const; // // set stuff @@ -365,9 +365,9 @@ class DictionaryStack { void clear(); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; - void dump_config_format(ostream & out, int = 0) const; + void dump_config_format(std::ostream & out, int = 0) const; // // set stuff diff --git a/src/basic/vx_config/icode.h b/src/basic/vx_config/icode.h index 816beaf969..37ba172584 100644 --- a/src/basic/vx_config/icode.h +++ b/src/basic/vx_config/icode.h @@ -153,7 +153,7 @@ class IcodeCell { double as_double() const; - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; }; @@ -203,7 +203,7 @@ class IcodeVector { void add (const IcodeVector &); void add_front (const IcodeVector &); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; bool is_mark() const; bool is_mark(int) const; @@ -257,9 +257,9 @@ class CellStack { int depth() const; - void dump_cell(ostream &, int n, int depth = 0) const; + void dump_cell(std::ostream &, int n, int depth = 0) const; - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; }; @@ -311,7 +311,7 @@ class ICVStack { void clear(); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; }; diff --git a/src/basic/vx_config/idstack.h b/src/basic/vx_config/idstack.h index f2f36fe909..5fc487f6c0 100644 --- a/src/basic/vx_config/idstack.h +++ b/src/basic/vx_config/idstack.h @@ -24,8 +24,6 @@ #include "indent.h" -using namespace std; - //////////////////////////////////////////////////////////////////////// @@ -50,13 +48,13 @@ class Identifier { Identifier(const Identifier &); Identifier & operator=(const Identifier &); - string name; + std::string name; void clear(); void set(const char *); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; }; @@ -143,7 +141,7 @@ class IdentifierArray { void add(const Identifier &); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; bool has(const char *) const; diff --git a/src/basic/vx_config/threshold.h b/src/basic/vx_config/threshold.h index e35c894618..eccbee8ac3 100644 --- a/src/basic/vx_config/threshold.h +++ b/src/basic/vx_config/threshold.h @@ -168,7 +168,7 @@ class ThreshNode { virtual void multiply_by(const double) = 0; - virtual void get_simple_nodes(vector &) const = 0; + virtual void get_simple_nodes(std::vector &) const = 0; ConcatString s; ConcatString abbr_s; @@ -210,7 +210,7 @@ class Or_Node : public ThreshNode { void multiply_by(const double); - void get_simple_nodes(vector &) const; + void get_simple_nodes(std::vector &) const; ThreshNode * left_child; ThreshNode * right_child; @@ -259,7 +259,7 @@ class And_Node : public ThreshNode { void multiply_by(const double); - void get_simple_nodes(vector &) const; + void get_simple_nodes(std::vector &) const; ThreshNode * copy() const; @@ -310,7 +310,7 @@ class Not_Node : public ThreshNode { void multiply_by(const double); - void get_simple_nodes(vector &) const; + void get_simple_nodes(std::vector &) const; ThreshNode * copy() const; @@ -375,7 +375,7 @@ class Simple_Node : public ThreshNode { bool need_perc() const; - void get_simple_nodes(vector &) const; + void get_simple_nodes(std::vector &) const; // // do stuff @@ -421,7 +421,7 @@ class SingleThresh { SingleThresh(const char *); SingleThresh & operator=(const SingleThresh &); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; bool operator==(const SingleThresh &) const; @@ -446,7 +446,7 @@ class SingleThresh { PercThreshType get_ptype() const; double get_pvalue() const; double get_climo_prob() const; - void get_simple_nodes(vector &) const; + void get_simple_nodes(std::vector &) const; void multiply_by(const double); diff --git a/src/basic/vx_log/file_fxns.h b/src/basic/vx_log/file_fxns.h index 5ffaa463fe..84dd361302 100644 --- a/src/basic/vx_log/file_fxns.h +++ b/src/basic/vx_log/file_fxns.h @@ -37,9 +37,9 @@ extern ConcatString replace_path(const char * path); extern int met_open(const char *path, int oflag); -extern void met_open(ifstream &in, const char *path); +extern void met_open(std::ifstream &in, const char *path); -extern void met_open(ofstream &out, const char *path); +extern void met_open(std::ofstream &out, const char *path); extern FILE * met_fopen(const char *path, const char *mode); diff --git a/src/basic/vx_log/vx_log.h b/src/basic/vx_log/vx_log.h index b8f26c758c..6aa7e5a2d7 100644 --- a/src/basic/vx_log/vx_log.h +++ b/src/basic/vx_log/vx_log.h @@ -17,8 +17,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include "concat_string.h" #include "indent.h" #include "string_array.h" diff --git a/src/basic/vx_math/hist.h b/src/basic/vx_math/hist.h index 00e282dd9a..f1f26292ed 100644 --- a/src/basic/vx_math/hist.h +++ b/src/basic/vx_math/hist.h @@ -115,7 +115,7 @@ inline int Histogram::too_small_count () const { return ( TooSmallCount ); } //////////////////////////////////////////////////////////////////////// -extern ostream & operator<<(ostream &, const Histogram &); +extern std::ostream & operator<<(std::ostream &, const Histogram &); //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_math/is_bad_data.h b/src/basic/vx_math/is_bad_data.h index d8bc9b92a1..601949a0c9 100644 --- a/src/basic/vx_math/is_bad_data.h +++ b/src/basic/vx_math/is_bad_data.h @@ -28,22 +28,22 @@ inline int is_bad_data(int a) { - if(a == bad_data_int || isnan(a)) return(1); + if(a == bad_data_int || std::isnan(a)) return(1); else return(0); } inline int is_bad_data(long long a) { - if(a == bad_data_ll || isnan(a)) return(1); + if(a == bad_data_ll || std::isnan(a)) return(1); else return(0); } inline int is_bad_data(double a) { - if(fabs(a - bad_data_double) < default_tol || isnan(a)) return(1); + if(fabs(a - bad_data_double) < default_tol || std::isnan(a)) return(1); else return(0); } inline int is_bad_data(float a) { - if(fabs(a - bad_data_float) < default_tol || isnan(a)) return(1); + if(fabs(a - bad_data_float) < default_tol || std::isnan(a)) return(1); else return(0); } diff --git a/src/basic/vx_math/pwl.h b/src/basic/vx_math/pwl.h index 2290e33c19..410fe66993 100644 --- a/src/basic/vx_math/pwl.h +++ b/src/basic/vx_math/pwl.h @@ -62,7 +62,7 @@ class PiecewiseLinear { void clear(); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; // // set stuff diff --git a/src/basic/vx_math/vx_vector.h b/src/basic/vx_math/vx_vector.h index 59dc87daf1..53ad9daac1 100644 --- a/src/basic/vx_math/vx_vector.h +++ b/src/basic/vx_math/vx_vector.h @@ -53,7 +53,7 @@ class Vector { void clear(); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; // // set stuff @@ -166,7 +166,7 @@ extern void latlon_to_vector(double lat, double lon, double & x, double & y, d //////////////////////////////////////////////////////////////////////// -extern ostream & operator<<(ostream &, const Vector &); +extern std::ostream & operator<<(std::ostream &, const Vector &); //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_util/GridOffset.h b/src/basic/vx_util/GridOffset.h index dc3b9ec147..4af50d0328 100644 --- a/src/basic/vx_util/GridOffset.h +++ b/src/basic/vx_util/GridOffset.h @@ -17,6 +17,7 @@ // Mod# Date Name Description // ---- ---- ---- ----------- // 000 01-01-99 Rehak Initial version. +// 001 09-06-22 Prestopnik MET #2227 Remove namesapce std from header files // /////////////////////////////////////////////////////////////////////////////// @@ -29,8 +30,6 @@ /////////////////////////////////////////////////////////////////////////////// -using namespace std; - class GridOffset { public: diff --git a/src/basic/vx_util/GridTemplate.h b/src/basic/vx_util/GridTemplate.h index be191ebecf..552dcff295 100644 --- a/src/basic/vx_util/GridTemplate.h +++ b/src/basic/vx_util/GridTemplate.h @@ -18,6 +18,7 @@ // ---- ---- ---- ----------- // 000 01-01-99 Rehak Initial version. // 001 09-07-21 Halley Gotway Add wrap_lon. +// 002 09-07-22 Prestopnik MET #2227 Remove namespace std from header files // /////////////////////////////////////////////////////////////////////////////// @@ -34,8 +35,6 @@ /////////////////////////////////////////////////////////////////////////////// -using namespace std; - class GridTemplate { public: @@ -118,20 +117,20 @@ class GridTemplate { bool _wrapLon; // The offsets that make up the circle - vector _offsetList; + std::vector _offsetList; // The offsets that define the first and last rows and columns - vector _offsetLftEdge; // not allocated - vector _offsetRgtEdge; // not allocated - vector _offsetTopEdge; // not allocated - vector _offsetBotEdge; // not allocated + std::vector _offsetLftEdge; // not allocated + std::vector _offsetRgtEdge; // not allocated + std::vector _offsetTopEdge; // not allocated + std::vector _offsetBotEdge; // not allocated // Iterator for finding points within a grid - mutable vector::const_iterator _pointInGridIterator; - mutable vector::const_iterator _pointInLftEdgeIterator; - mutable vector::const_iterator _pointInRgtEdgeIterator; - mutable vector::const_iterator _pointInTopEdgeIterator; - mutable vector::const_iterator _pointInBotEdgeIterator; + mutable std::vector::const_iterator _pointInGridIterator; + mutable std::vector::const_iterator _pointInLftEdgeIterator; + mutable std::vector::const_iterator _pointInRgtEdgeIterator; + mutable std::vector::const_iterator _pointInTopEdgeIterator; + mutable std::vector::const_iterator _pointInBotEdgeIterator; mutable GridPoint _pointInGridBase; mutable int _pointInGridNumX; @@ -168,12 +167,12 @@ class GridTemplateFactory { }; // String corresponding to the enumerated values above - vector enum_to_string; + std::vector enum_to_string; - GridTemplates string2Enum(string target); - string enum2String(GridTemplates gt); + GridTemplates string2Enum(std::string target); + std::string enum2String(GridTemplates gt); - GridTemplate* buildGT(string gt, int width, bool wrap_lon); + GridTemplate* buildGT(std::string gt, int width, bool wrap_lon); GridTemplate* buildGT(GridTemplates gt, int width, bool wrap_lon); }; diff --git a/src/basic/vx_util/ascii_header.h b/src/basic/vx_util/ascii_header.h index 5c0a498c77..24181e3d2a 100644 --- a/src/basic/vx_util/ascii_header.h +++ b/src/basic/vx_util/ascii_header.h @@ -13,8 +13,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include @@ -105,8 +103,8 @@ class AsciiHeader { void assign(const AsciiHeader &); - StringArray Versions; - vector Headers; + StringArray Versions; + std::vector Headers; public: diff --git a/src/basic/vx_util/ascii_table.h b/src/basic/vx_util/ascii_table.h index c13c67c904..6e6ee96290 100644 --- a/src/basic/vx_util/ascii_table.h +++ b/src/basic/vx_util/ascii_table.h @@ -357,7 +357,7 @@ inline bool AsciiTable::decimal_points_aligned() const { return ( DecimalPointsA // externs // -extern ostream & operator<<(ostream &, AsciiTable &); +extern std::ostream & operator<<(std::ostream &, AsciiTable &); extern void justified_item(const char * text, const int field_width, const char pad, const AsciiTableJust just, char * out); diff --git a/src/basic/vx_util/command_line.h b/src/basic/vx_util/command_line.h index 9acbc3fa9b..7c02bf589a 100644 --- a/src/basic/vx_util/command_line.h +++ b/src/basic/vx_util/command_line.h @@ -57,7 +57,7 @@ class CLOptionInfo { // command-line option info void clear(); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; ConcatString option_text; @@ -101,7 +101,7 @@ class CLOptionInfoArray { void clear(); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; void set_alloc_inc(int = 0); // 0 means default value (16) @@ -112,7 +112,7 @@ class CLOptionInfoArray { CLOptionInfo & operator[](int) const; - int lookup(const string &) const; + int lookup(const std::string &) const; }; @@ -143,7 +143,7 @@ class CommandLine { void do_log(); void get_n_args(StringArray &, const int Nargs, - const string & switch_name, const int pos); + const std::string & switch_name, const int pos); int get_unlimited_args(StringArray &, const int pos); @@ -159,7 +159,7 @@ class CommandLine { bool AllowUnrecognizedSwitches; // default: false - bool is_switch(const string &) const; + bool is_switch(const std::string &) const; public: @@ -170,7 +170,7 @@ class CommandLine { void clear(); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; // // set stuff @@ -197,7 +197,7 @@ class CommandLine { int length(int) const; // length of jth arg - bool has_option(const string &) const; + bool has_option(const std::string &) const; int next_option(int & index) const; // -1 if no option found @@ -207,11 +207,11 @@ class CommandLine { void shift_down(int pos, int k); - const string operator[](int) const; + const std::string operator[](int) const; void parse(); - void add(CLSetFunction, const string & text, int n_args); // n_args not including switch + void add(CLSetFunction, const std::string & text, int n_args); // n_args not including switch }; diff --git a/src/basic/vx_util/crc_array.h b/src/basic/vx_util/crc_array.h index 7d86fe97e9..2b7dcb52e3 100644 --- a/src/basic/vx_util/crc_array.h +++ b/src/basic/vx_util/crc_array.h @@ -101,9 +101,9 @@ class CRC_Array { void extend(int, bool exact = true); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; - void dump_one_line(ostream & out, int depth) const; + void dump_one_line(std::ostream & out, int depth) const; // // set stuff @@ -330,7 +330,7 @@ return; template -void CRC_Array::dump(ostream & out, int depth) const +void CRC_Array::dump(std::ostream & out, int depth) const { @@ -364,7 +364,7 @@ return; template -void CRC_Array::dump_one_line(ostream & out, int depth) const +void CRC_Array::dump_one_line(std::ostream & out, int depth) const { @@ -385,7 +385,7 @@ for (j=0; j -void CRR_Array::dump(ostream & out, int depth) const +void CRR_Array::dump(std::ostream & out, int depth) const { diff --git a/src/basic/vx_util/data_line.cc b/src/basic/vx_util/data_line.cc index ca1e8db145..f7692fdeb0 100644 --- a/src/basic/vx_util/data_line.cc +++ b/src/basic/vx_util/data_line.cc @@ -334,7 +334,7 @@ if ( ! read_single_text_line(ldf) ) { clear(); return ( 0 ); } size_t len, tpos = std::string::npos; -if (!Line.find_first_not_of(Delimiter)) { // no leading delimiter +if (0 == Line.find_first_not_of(Delimiter)) { // no leading delimiter ++count; Offset.push_back(pos); Items.push_back(Line.substr(pos, Line.find_first_of(Delimiter, pos) - pos)); diff --git a/src/basic/vx_util/data_line.h b/src/basic/vx_util/data_line.h index c64b6fc4b4..4608e8a2bd 100644 --- a/src/basic/vx_util/data_line.h +++ b/src/basic/vx_util/data_line.h @@ -48,7 +48,7 @@ class PyLineDataFile; // forward reference class DataLine { friend class LineDataFile; - friend ostream & operator<<(ostream &, const DataLine &); + friend std::ostream & operator<<(std::ostream &, const DataLine &); friend Logger & operator<<(Logger &, const DataLine &); protected: @@ -96,7 +96,7 @@ class DataLine { void clear(); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; // // retrieve stuff @@ -178,7 +178,7 @@ class LineDataFile { LineDataFile(); virtual ~LineDataFile(); - ifstream * in; + std::ifstream * in; int open(const char *); @@ -217,7 +217,7 @@ inline const StringArray & LineDataFile::header() const { return ( Header ); } //////////////////////////////////////////////////////////////////////// -extern ostream & operator<<(ostream &, const DataLine &); +extern std::ostream & operator<<(std::ostream &, const DataLine &); //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_util/data_plane.cc b/src/basic/vx_util/data_plane.cc index bde7f982bc..0fd0c00efa 100644 --- a/src/basic/vx_util/data_plane.cc +++ b/src/basic/vx_util/data_plane.cc @@ -16,6 +16,7 @@ // Mod# Date Name Description // ---- ---- ---- ----------- // 000 11-01-11 Halley Gotway +// 001 22-09-29 Prestopnik MET #2227 Remove namespace std from header files // /////////////////////////////////////////////////////////////////////////////// @@ -663,7 +664,7 @@ if ( N == 0 ) return; // no shift, so do nothing int x, y, x_new; int index_old, index_new; -std::vector new_data(Nxy); +vector new_data(Nxy); for (x=0; x #include @@ -43,7 +46,7 @@ //////////////////////////////////////////////////////////////////////// -static std::string met_cmdline = ""; +static string met_cmdline = ""; static int met_start_time; static int met_end_time; @@ -146,7 +149,7 @@ void segv_handler(int signum) { void set_handlers() { - set_new_handler(oom); + set_new_handler(oom); } //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_util/main.h b/src/basic/vx_util/main.h index a008a26c7c..7cbedef200 100644 --- a/src/basic/vx_util/main.h +++ b/src/basic/vx_util/main.h @@ -20,8 +20,6 @@ #include #include -using namespace std; - //////////////////////////////////////////////////////////////////////// #define MET_BUF_SIZE 4096 @@ -29,7 +27,7 @@ using namespace std; //////////////////////////////////////////////////////////////////////// //extern void log_event(int event_id, string event_msg); -extern string get_current_time(); +extern std::string get_current_time(); //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_util/mask_poly.h b/src/basic/vx_util/mask_poly.h index a568318ae0..640124b260 100644 --- a/src/basic/vx_util/mask_poly.h +++ b/src/basic/vx_util/mask_poly.h @@ -61,7 +61,7 @@ class MaskPoly { void clear(); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; // // set stuff diff --git a/src/basic/vx_util/ncrr_array.h b/src/basic/vx_util/ncrr_array.h index 68fbd40592..dc508ca380 100644 --- a/src/basic/vx_util/ncrr_array.h +++ b/src/basic/vx_util/ncrr_array.h @@ -77,7 +77,7 @@ class NCRR_Array { void clear(); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; // // set stuff @@ -254,7 +254,7 @@ return; template -void NCRR_Array::dump(ostream & out, int depth) const +void NCRR_Array::dump(std::ostream & out, int depth) const { diff --git a/src/basic/vx_util/num_array.h b/src/basic/vx_util/num_array.h index 72d7ec00e8..be43623ff8 100644 --- a/src/basic/vx_util/num_array.h +++ b/src/basic/vx_util/num_array.h @@ -35,7 +35,7 @@ class NumArray { void assign(const NumArray &); - vector e; + std::vector e; bool Sorted; @@ -53,7 +53,7 @@ class NumArray { void extend(int); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; double operator[](int) const; diff --git a/src/basic/vx_util/observation.h b/src/basic/vx_util/observation.h index 58d9e29285..62dd3fe688 100644 --- a/src/basic/vx_util/observation.h +++ b/src/basic/vx_util/observation.h @@ -37,23 +37,23 @@ class Observation public: - Observation(const string &header_type, const string &station_id, + Observation(const std::string &header_type, const std::string &station_id, const time_t valid_time, const double latitude, const double longitude, const double elevation, - const string &quality_flag, + const std::string &quality_flag, const int grib_code, const double pressure_level_hpa, const double height_m, const double value, - const string &var_name = ""); + const std::string &var_name = ""); - Observation(const string &header_type, const string &station_id, + Observation(const std::string &header_type, const std::string &station_id, const time_t start_time, const time_t end_time, const double latitude, const double longitude, const double elevation, - const string &quality_flag, + const std::string &quality_flag, const int grib_code, const double pressure_level_hpa, const double height_m, const double value, - const string &var_name = ""); + const std::string &var_name = ""); //////////////////////// #ifdef ENABLE_PYTHON @@ -85,12 +85,12 @@ class Observation hdrIndex = headerIndex; } - string getHeaderType() const + std::string getHeaderType() const { return _headerType; } - string getStationId() const + std::string getStationId() const { return _stationId; } @@ -100,7 +100,7 @@ class Observation return _validTime; } - string getValidTimeString() const + std::string getValidTimeString() const { return _getTimeString(_validTime); } @@ -120,7 +120,7 @@ class Observation return _elevation; } - string getQualityFlag() const + std::string getQualityFlag() const { return _qualityFlag; } @@ -155,7 +155,7 @@ class Observation return _value; } - string getVarName() const + std::string getVarName() const { return _varName; } @@ -201,26 +201,26 @@ class Observation // Protected members // /////////////////////// - string _headerType; - string _stationId; - time_t _validTime; - double _latitude; - double _longitude; - double _elevation; - string _qualityFlag; - string _varName; - int varCode; - long hdrIndex; - double _pressureLevel; - double _height; - double _value; + std::string _headerType; + std::string _stationId; + time_t _validTime; + double _latitude; + double _longitude; + double _elevation; + std::string _qualityFlag; + std::string _varName; + int varCode; + long hdrIndex; + double _pressureLevel; + double _height; + double _value; /////////////////////// // Protected methods // /////////////////////// - static string _getTimeString(const time_t &unix_time) + static std::string _getTimeString(const time_t &unix_time) { struct tm *time_struct = gmtime(&unix_time); @@ -232,14 +232,14 @@ class Observation time_struct->tm_mday, time_struct->tm_hour, time_struct->tm_min, time_struct->tm_sec); - return string(time_string); + return std::string(time_string); } - static string _getTimeString(const time_t &start_time, + static std::string _getTimeString(const time_t &start_time, const time_t &end_time) { - string start_time_string = _getTimeString(start_time); - string end_time_string = _getTimeString(end_time); + std::string start_time_string = _getTimeString(start_time); + std::string end_time_string = _getTimeString(end_time); char time_string[tmp_buf_size]; @@ -247,7 +247,7 @@ class Observation "%s-%s", start_time_string.c_str(), end_time_string.c_str()); - return string(time_string); + return std::string(time_string); } }; diff --git a/src/basic/vx_util/polyline.h b/src/basic/vx_util/polyline.h index 1278a71508..c3a31455d8 100644 --- a/src/basic/vx_util/polyline.h +++ b/src/basic/vx_util/polyline.h @@ -51,7 +51,7 @@ class Polyline { void clear(); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; ///////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_util/stat_column_defs.h b/src/basic/vx_util/stat_column_defs.h index 111829c07a..9fca87257c 100644 --- a/src/basic/vx_util/stat_column_defs.h +++ b/src/basic/vx_util/stat_column_defs.h @@ -437,16 +437,16 @@ static const int n_genmpr_columns = sizeof(genmpr_columns)/sizeof(*genmpr_ //////////////////////////////////////////////////////////////////////// -inline int get_n_mctc_columns (int n) { return(3 + n*n); } // n = N_CAT -inline int get_n_pct_columns (int n) { return(3 + 3*(max(1, n)-1)); } // n = N_THRESH -inline int get_n_pstd_columns (int n) { return(17 + max(1, n) ); } // n = N_THRESH -inline int get_n_pjc_columns (int n) { return(3 + 7*(max(1, n)-1)); } // n = N_THRESH -inline int get_n_prc_columns (int n) { return(3 + 3*(max(1, n)-1)); } // n = N_THRESH -inline int get_n_eclv_columns (int n) { return(4 + 2*n); } // n = N_PNT -inline int get_n_rhist_columns (int n) { return(2 + n); } // n = N_RANK -inline int get_n_phist_columns (int n) { return(3 + n); } // n = N_BINS -inline int get_n_relp_columns (int n) { return(2 + n); } // n = N_ENS -inline int get_n_orank_columns (int n) { return(20 + n); } // n = N_ENS +inline int get_n_mctc_columns (int n) { return(3 + n*n); } // n = N_CAT +inline int get_n_pct_columns (int n) { return(3 + 3*(std::max(1, n)-1)); } // n = N_THRESH +inline int get_n_pstd_columns (int n) { return(17 + std::max(1, n) ); } // n = N_THRESH +inline int get_n_pjc_columns (int n) { return(3 + 7*(std::max(1, n)-1)); } // n = N_THRESH +inline int get_n_prc_columns (int n) { return(3 + 3*(std::max(1, n)-1)); } // n = N_THRESH +inline int get_n_eclv_columns (int n) { return(4 + 2*n); } // n = N_PNT +inline int get_n_rhist_columns (int n) { return(2 + n); } // n = N_RANK +inline int get_n_phist_columns (int n) { return(3 + n); } // n = N_BINS +inline int get_n_relp_columns (int n) { return(2 + n); } // n = N_ENS +inline int get_n_orank_columns (int n) { return(20 + n); } // n = N_ENS //////////////////////////////////////////////////////////////////////// diff --git a/src/basic/vx_util/thresh_array.h b/src/basic/vx_util/thresh_array.h index c3f6cafb2d..7a74dee69c 100644 --- a/src/basic/vx_util/thresh_array.h +++ b/src/basic/vx_util/thresh_array.h @@ -43,7 +43,7 @@ class ThreshArray { void extend(int, bool exact = true); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; bool operator==(const ThreshArray &) const; SingleThresh operator[](int) const; @@ -74,7 +74,7 @@ class ThreshArray { void multiply_by(const double); - void get_simple_nodes(vector &); + void get_simple_nodes(std::vector &); ConcatString get_str(const char * = thresh_default_sep, int precision = thresh_default_precision) const; diff --git a/src/basic/vx_util_math/so3.h b/src/basic/vx_util_math/so3.h index ecbfdbd952..dc4f1ad0c9 100644 --- a/src/basic/vx_util_math/so3.h +++ b/src/basic/vx_util_math/so3.h @@ -60,7 +60,7 @@ class SO3 { void clear(); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; // diff --git a/src/libcode/vx_afm/afm.h b/src/libcode/vx_afm/afm.h index 2d00ad58ff..cbe3c34d27 100644 --- a/src/libcode/vx_afm/afm.h +++ b/src/libcode/vx_afm/afm.h @@ -51,7 +51,7 @@ class AfmBBox { void clear(); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; int L; int B; @@ -82,7 +82,7 @@ class LigatureInfo { void clear(); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; char * successor_name; @@ -116,7 +116,7 @@ class AfmCharMetrics { void clear(); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; int ascii_code; @@ -154,7 +154,7 @@ class PCC { void clear(); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; char * name; @@ -184,7 +184,7 @@ class AfmCompositeInfo { void clear(); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; char * name; @@ -215,7 +215,7 @@ class KPX { void clear(); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; char * name1; @@ -249,7 +249,7 @@ class Afm { void do_fontbbox(AfmLine &); - ifstream * in; // used for reading + std::ifstream * in; // used for reading int line_number; // void patch_ligatures(LigatureInfo &); @@ -263,7 +263,7 @@ class Afm { void clear(); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; int read(const ConcatString&); diff --git a/src/libcode/vx_afm/afm_line.h b/src/libcode/vx_afm/afm_line.h index 3ccc32b241..07f3b5af8b 100644 --- a/src/libcode/vx_afm/afm_line.h +++ b/src/libcode/vx_afm/afm_line.h @@ -28,7 +28,7 @@ class AfmLine { - friend istream & operator>>(istream &, AfmLine &); + friend std::istream & operator>>(std::istream &, AfmLine &); private: @@ -70,7 +70,7 @@ class AfmLine { //////////////////////////////////////////////////////////////////////// -extern istream & operator>>(istream &, AfmLine &); +extern std::istream & operator>>(std::istream &, AfmLine &); //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_afm/afm_token.h b/src/libcode/vx_afm/afm_token.h index 158afed618..0153481327 100644 --- a/src/libcode/vx_afm/afm_token.h +++ b/src/libcode/vx_afm/afm_token.h @@ -44,7 +44,7 @@ class AfmToken { void clear(); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; // void set_string(const char *); void set_string(const ConcatString); diff --git a/src/libcode/vx_analysis_util/by_case_info.h b/src/libcode/vx_analysis_util/by_case_info.h index e95bd49846..1084c5331b 100644 --- a/src/libcode/vx_analysis_util/by_case_info.h +++ b/src/libcode/vx_analysis_util/by_case_info.h @@ -45,7 +45,7 @@ class ByCaseInfo { void clear(); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; void add(const ModeLine &); diff --git a/src/libcode/vx_analysis_util/mode_atts.h b/src/libcode/vx_analysis_util/mode_atts.h index a20570ddc7..851a7eb653 100644 --- a/src/libcode/vx_analysis_util/mode_atts.h +++ b/src/libcode/vx_analysis_util/mode_atts.h @@ -65,7 +65,7 @@ class ModeAttributes { void clear(); - void dump(ostream & out, int depth = 0) const; + void dump(std::ostream & out, int depth = 0) const; int is_keeper(const ModeLine &) const; @@ -587,7 +587,7 @@ class ModeAttributes { //////////////////////////////////////////////////////////////////////// -extern void mode_atts_usage(ostream &); +extern void mode_atts_usage(std::ostream &); //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_analysis_util/mode_job.h b/src/libcode/vx_analysis_util/mode_job.h index 7e9c2668cc..e7d2958c44 100644 --- a/src/libcode/vx_analysis_util/mode_job.h +++ b/src/libcode/vx_analysis_util/mode_job.h @@ -62,13 +62,13 @@ class BasicModeAnalysisJob { virtual void clear(); - virtual void dump(ostream &, int depth = 0) const; + virtual void dump(std::ostream &, int depth = 0) const; virtual void add_column_by_name (const char *); virtual void add_column_by_number (int); // numbers start at zero - virtual void do_output(ostream &) const = 0; + virtual void do_output(std::ostream &) const = 0; virtual void setup() = 0; @@ -84,8 +84,8 @@ class BasicModeAnalysisJob { int n_lines_read; int n_lines_kept; - ostream * dumpfile; // NOT allocated, so don't delete - ostream * outfile; // NOT allocated, so don't delete + std::ostream * dumpfile; // NOT allocated, so don't delete + std::ostream * outfile; // NOT allocated, so don't delete int n_dump; // number of lines written to dump file AsciiTable dump_at; // AsciiTable object to buffer dump data @@ -123,7 +123,7 @@ class SummaryJob : public BasicModeAnalysisJob { void clear(); - void do_output(ostream &) const; + void do_output(std::ostream &) const; void setup(); @@ -154,7 +154,7 @@ class ByCaseJob : public BasicModeAnalysisJob { void clear(); - void do_output(ostream &) const; + void do_output(std::ostream &) const; void setup(); diff --git a/src/libcode/vx_analysis_util/mode_line.h b/src/libcode/vx_analysis_util/mode_line.h index d02d261449..9f111a4c47 100644 --- a/src/libcode/vx_analysis_util/mode_line.h +++ b/src/libcode/vx_analysis_util/mode_line.h @@ -48,7 +48,7 @@ class ModeLine : public DataLine { void clear(); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; int read_line(LineDataFile *); // virtual from base class diff --git a/src/libcode/vx_analysis_util/stat_job.cc b/src/libcode/vx_analysis_util/stat_job.cc index af3c450c74..f82b0f6151 100644 --- a/src/libcode/vx_analysis_util/stat_job.cc +++ b/src/libcode/vx_analysis_util/stat_job.cc @@ -2046,9 +2046,9 @@ void STATAnalysisJob::setup_stat_file(int n_row, int n) { 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_sl1l2_columns, 1, stat_at, 0, 0); break; - case stat_nbrcts: write_header_row (nbrcts_columns, n_sl1l2_columns, 1, stat_at, 0, 0); break; - case stat_nbrcnt: write_header_row (nbrcnt_columns, n_sl1l2_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; diff --git a/src/libcode/vx_analysis_util/stat_job.h b/src/libcode/vx_analysis_util/stat_job.h index 50cf4a91af..2645e884e2 100644 --- a/src/libcode/vx_analysis_util/stat_job.h +++ b/src/libcode/vx_analysis_util/stat_job.h @@ -117,7 +117,7 @@ class STATAnalysisJob { void clear(); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; ////////////////////////////////////////////////////////////////// @@ -225,11 +225,11 @@ class STATAnalysisJob { NumArray weight; // Numeric column thresholds - map column_thresh_map; + std::map column_thresh_map; // ASCII column string matching - map column_str_inc_map; - map column_str_exc_map; + std::map column_str_inc_map; + std::map column_str_exc_map; StringArray hdr_name; StringArray hdr_value; @@ -243,12 +243,12 @@ class STATAnalysisJob { // Variables used to the store the analysis job specification // char *dump_row; // dump rows used to a file - ofstream *dr_out; // output file stream for dump row + std::ofstream *dr_out; // output file stream for dump row int n_dump; // number of lines written to dump row AsciiTable dump_at; // AsciiTable for buffering dump row data char *stat_file; // dump output statistics to a STAT file - ofstream *stat_out; // output file stream for -out_stat + std::ofstream *stat_out; // output file stream for -out_stat AsciiTable stat_at; // AsciiTable for buffering output STAT data int stat_row; // Counter for the current stat row diff --git a/src/libcode/vx_analysis_util/stat_line.h b/src/libcode/vx_analysis_util/stat_line.h index e7b63ee9d5..6c2a4282d0 100644 --- a/src/libcode/vx_analysis_util/stat_line.h +++ b/src/libcode/vx_analysis_util/stat_line.h @@ -49,7 +49,7 @@ class STATLine : public DataLine { void clear(); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; int read_line(LineDataFile *); // virtual from base class diff --git a/src/libcode/vx_analysis_util/time_series.h b/src/libcode/vx_analysis_util/time_series.h index 0474bc6503..10aab9b890 100644 --- a/src/libcode/vx_analysis_util/time_series.h +++ b/src/libcode/vx_analysis_util/time_series.h @@ -52,7 +52,7 @@ class TimeSeries { void clear(); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; void set(unixtime _start, int _delta, int _n); diff --git a/src/libcode/vx_color/color.h b/src/libcode/vx_color/color.h index 986287aa6c..5c0126d2e5 100644 --- a/src/libcode/vx_color/color.h +++ b/src/libcode/vx_color/color.h @@ -67,7 +67,7 @@ class Color { void reverse_video(); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; bool is_gray () const; @@ -172,7 +172,7 @@ class CtableEntry { double value_low () const; double value_high () const; - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; }; @@ -191,9 +191,9 @@ inline double CtableEntry::value_high() const { return ( ValueHi ); } //////////////////////////////////////////////////////////////////////// -extern istream & operator>>(istream &, CtableEntry &); +extern std::istream & operator>>(std::istream &, CtableEntry &); -extern ostream & operator<<(ostream &, const CtableEntry &); +extern std::ostream & operator<<(std::ostream &, const CtableEntry &); //////////////////////////////////////////////////////////////////////// @@ -264,7 +264,7 @@ class ColorTable { double gamma() const; - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; CtableEntry operator[](int) const; diff --git a/src/libcode/vx_color/color_list.h b/src/libcode/vx_color/color_list.h index 8bcee60348..aebf35b641 100644 --- a/src/libcode/vx_color/color_list.h +++ b/src/libcode/vx_color/color_list.h @@ -47,7 +47,7 @@ class ClistEntry { void clear(); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; void set_name(const std::string); @@ -102,7 +102,7 @@ class ColorList { void clear(); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; int n_elements() const; diff --git a/src/libcode/vx_data2d/data_class.h b/src/libcode/vx_data2d/data_class.h index 401cd4e0c7..06aecd0739 100644 --- a/src/libcode/vx_data2d/data_class.h +++ b/src/libcode/vx_data2d/data_class.h @@ -50,7 +50,7 @@ class Met2dData { void mtdd_clear(); - virtual void dump(ostream &, int depth = 0) const = 0; // dump grid and filename, etc., not data + virtual void dump(std::ostream &, int depth = 0) const = 0; // dump grid and filename, etc., not data // // set stuff @@ -105,7 +105,7 @@ class Met2dDataFile : public Met2dData { void mtddf_clear(); - virtual void dump(ostream &, int depth = 0) const = 0; // dump grid and filename, etc., not data + virtual void dump(std::ostream &, int depth = 0) const = 0; // dump grid and filename, etc., not data // // set stuff diff --git a/src/libcode/vx_data2d/level_info.h b/src/libcode/vx_data2d/level_info.h index 445528017a..377550de62 100644 --- a/src/libcode/vx_data2d/level_info.h +++ b/src/libcode/vx_data2d/level_info.h @@ -63,7 +63,7 @@ class LevelInfo void clear(); - void dump(ostream &) const; + void dump(std::ostream &) const; // // get stuff diff --git a/src/libcode/vx_data2d/table_lookup.h b/src/libcode/vx_data2d/table_lookup.h index d6ae3fa6f7..a234bf72bb 100644 --- a/src/libcode/vx_data2d/table_lookup.h +++ b/src/libcode/vx_data2d/table_lookup.h @@ -43,7 +43,7 @@ class Grib1TableEntry { void clear(); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; int code; int table_number; @@ -94,7 +94,7 @@ class Grib2TableEntry { void clear(); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; int index_a; // Section 0 Discipline int mtab_set; // Section 1 Master Tables Version Number used by set_var @@ -139,8 +139,8 @@ class TableFlatFile { void assign(const TableFlatFile &); - bool read_grib1(istream &, const char * filename, const int n); - bool read_grib2(istream &, const char * filename, const int n); + bool read_grib1(std::istream &, const char * filename, const int n); + bool read_grib2(std::istream &, const char * filename, const int n); void extend_grib1(int); void extend_grib2(int); @@ -164,7 +164,7 @@ class TableFlatFile { void clear(); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; // // set stuff diff --git a/src/libcode/vx_data2d/var_info.h b/src/libcode/vx_data2d/var_info.h index d32715d130..7ac6399f6b 100644 --- a/src/libcode/vx_data2d/var_info.h +++ b/src/libcode/vx_data2d/var_info.h @@ -96,7 +96,7 @@ class VarInfo void clear(); - virtual void dump(ostream &) const; + virtual void dump(std::ostream &) const; // // get stuff @@ -158,7 +158,7 @@ class VarInfo void set_req_name(const char *); void set_name(const char *); - void set_name(const string); + void set_name(const std::string); void set_units(const char *); void set_level_info(const LevelInfo &); void set_req_level_name(const char *); @@ -272,7 +272,7 @@ struct InputInfo { class EnsVarInfo { private: - vector inputs; // Vector of InputInfo + std::vector inputs; // Vector of InputInfo VarInfo * ctrl_info; // Field info for control member public: diff --git a/src/libcode/vx_data2d_factory/is_netcdf_file.cc b/src/libcode/vx_data2d_factory/is_netcdf_file.cc index 805ce8ee81..3e72029514 100644 --- a/src/libcode/vx_data2d_factory/is_netcdf_file.cc +++ b/src/libcode/vx_data2d_factory/is_netcdf_file.cc @@ -25,6 +25,9 @@ using namespace std; #include #include +#include +using namespace netCDF; + #include "is_netcdf_file.h" #include "vx_nc_util.h" diff --git a/src/libcode/vx_data2d_grib/data2d_grib.h b/src/libcode/vx_data2d_grib/data2d_grib.h index 6c72eaca1c..275d77b36e 100644 --- a/src/libcode/vx_data2d_grib/data2d_grib.h +++ b/src/libcode/vx_data2d_grib/data2d_grib.h @@ -78,7 +78,7 @@ class MetGrib1DataFile : public Met2dDataFile { void close(); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; bool read_record(const int, const bool read_plane = true); diff --git a/src/libcode/vx_data2d_grib/grib_classes.h b/src/libcode/vx_data2d_grib/grib_classes.h index 3b0295cf45..eab0f7b3ac 100644 --- a/src/libcode/vx_data2d_grib/grib_classes.h +++ b/src/libcode/vx_data2d_grib/grib_classes.h @@ -18,8 +18,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -366,9 +364,9 @@ class GribRecord { public: - vector data; // allocated + std::vector data; // allocated - vector bitmap; // allocated + std::vector bitmap; // allocated Section0_Header * is; // allocated unsigned char * pds; // allocated @@ -579,13 +577,13 @@ extern double char4_to_dbl(const unsigned char *); extern unsigned int char3_to_int(const unsigned char *); extern unsigned int char2_to_int(const unsigned char *); -extern ostream & operator<<(ostream &, const GribRecord &); +extern std::ostream & operator<<(std::ostream &, const GribRecord &); -extern ostream & operator<<(ostream &, const Section0_Header &); -extern ostream & operator<<(ostream &, const Section1_Header &); -extern ostream & operator<<(ostream &, const Section2_Header &); -extern ostream & operator<<(ostream &, const Section3_Header &); -extern ostream & operator<<(ostream &, const Section4_Header &); +extern std::ostream & operator<<(std::ostream &, const Section0_Header &); +extern std::ostream & operator<<(std::ostream &, const Section1_Header &); +extern std::ostream & operator<<(std::ostream &, const Section2_Header &); +extern std::ostream & operator<<(std::ostream &, const Section3_Header &); +extern std::ostream & operator<<(std::ostream &, const Section4_Header &); //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_data2d_grib/grib_strings.h b/src/libcode/vx_data2d_grib/grib_strings.h index 2fddd2dcef..0b51dd9121 100644 --- a/src/libcode/vx_data2d_grib/grib_strings.h +++ b/src/libcode/vx_data2d_grib/grib_strings.h @@ -13,20 +13,16 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - -//////////////////////////////////////////////////////////////////////// - #include "vx_util.h" //////////////////////////////////////////////////////////////////////// -static const string missing_str = "MISSING"; -static const char ugrd_abbr_str[] = "UGRD"; -static const char vgrd_abbr_str[] = "VGRD"; -static const string ugrd_vgrd_abbr_str = "UGRD_VGRD"; -static const string wind_abbr_str = "WIND"; -static const string wdir_abbr_str = "WDIR"; +static const std::string missing_str = "MISSING"; +static const char ugrd_abbr_str[] = "UGRD"; +static const char vgrd_abbr_str[] = "VGRD"; +static const std::string ugrd_vgrd_abbr_str = "UGRD_VGRD"; +static const std::string wind_abbr_str = "WIND"; +static const std::string wdir_abbr_str = "WDIR"; //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_data2d_grib/var_info_grib.h b/src/libcode/vx_data2d_grib/var_info_grib.h index 9a0b9bf4ce..ef5acef9dc 100644 --- a/src/libcode/vx_data2d_grib/var_info_grib.h +++ b/src/libcode/vx_data2d_grib/var_info_grib.h @@ -68,7 +68,7 @@ class VarInfoGrib : public VarInfo VarInfoGrib(const VarInfoGrib &); VarInfoGrib & operator=(const VarInfoGrib &); - void dump(ostream &) const; + void dump(std::ostream &) const; void clear(); // diff --git a/src/libcode/vx_data2d_grib2/var_info_grib2.h b/src/libcode/vx_data2d_grib2/var_info_grib2.h index a6bf0fcd5e..8f5bb6a7c5 100644 --- a/src/libcode/vx_data2d_grib2/var_info_grib2.h +++ b/src/libcode/vx_data2d_grib2/var_info_grib2.h @@ -19,8 +19,6 @@ #include #include -using namespace std; - #include "vx_config.h" #include "vx_util.h" #include "var_info.h" diff --git a/src/libcode/vx_data2d_nc_met/data2d_nc_met.h b/src/libcode/vx_data2d_nc_met/data2d_nc_met.h index eb72f67605..3cd2d02bb3 100644 --- a/src/libcode/vx_data2d_nc_met/data2d_nc_met.h +++ b/src/libcode/vx_data2d_nc_met/data2d_nc_met.h @@ -17,9 +17,6 @@ //////////////////////////////////////////////////////////////////////// -#include -using namespace netCDF; - #include "data_plane.h" #include "data_class.h" #include "var_info_nc_met.h" @@ -80,7 +77,7 @@ class MetNcMetDataFile : public Met2dDataFile { void close (); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; }; diff --git a/src/libcode/vx_data2d_nc_met/get_met_grid.cc b/src/libcode/vx_data2d_nc_met/get_met_grid.cc index c6882057e3..6016ab4dd2 100644 --- a/src/libcode/vx_data2d_nc_met/get_met_grid.cc +++ b/src/libcode/vx_data2d_nc_met/get_met_grid.cc @@ -18,6 +18,9 @@ using namespace std; #include #include +#include +using namespace netCDF; + #include "get_met_grid.h" #include "nc_utils.h" @@ -783,7 +786,7 @@ long count = get_data_size(&nc_var); double * data_values = new double[ count ]; get_nc_data(&nc_var, data_values); for(int i=0; i -using namespace netCDF; #include "vx_grid.h" //////////////////////////////////////////////////////////////////////// -extern void read_netcdf_grid(NcFile *, Grid &); +extern void read_netcdf_grid(netCDF::NcFile *, Grid &); -extern int has_variable(NcFile *, const char *); +extern int has_variable(netCDF::NcFile *, const char *); //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_data2d_nc_met/met_file.cc b/src/libcode/vx_data2d_nc_met/met_file.cc index 306abee1c2..decf37371c 100644 --- a/src/libcode/vx_data2d_nc_met/met_file.cc +++ b/src/libcode/vx_data2d_nc_met/met_file.cc @@ -20,6 +20,9 @@ using namespace std; #include #include +#include +using namespace netCDF; + #include "vx_math.h" #include "vx_cal.h" #include "vx_log.h" diff --git a/src/libcode/vx_data2d_nc_met/met_file.h b/src/libcode/vx_data2d_nc_met/met_file.h index d2321f97c7..e3a9070a43 100644 --- a/src/libcode/vx_data2d_nc_met/met_file.h +++ b/src/libcode/vx_data2d_nc_met/met_file.h @@ -57,9 +57,9 @@ class MetNcFile { void close(); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; - NcFile * Nc; // allocated + netCDF::NcFile * Nc; // allocated // // dimensions @@ -67,12 +67,12 @@ class MetNcFile { int Ndims; - NcDim ** Dim; // allocated + netCDF::NcDim ** Dim; // allocated StringArray DimNames; - NcDim * Xdim; // not allocated - NcDim * Ydim; // not allocated + netCDF::NcDim * Xdim; // not allocated + netCDF::NcDim * Ydim; // not allocated // // variables @@ -92,9 +92,9 @@ class MetNcFile { // data // - double data(NcVar *, const LongArray &) const; + double data(netCDF::NcVar *, const LongArray &) const; - bool data(NcVar *, const LongArray &, DataPlane &) const; + bool data(netCDF::NcVar *, const LongArray &, DataPlane &) const; bool data(const char *, const LongArray &, DataPlane &, NcVarInfo *&) const; diff --git a/src/libcode/vx_data2d_nc_met/var_info_nc_met.h b/src/libcode/vx_data2d_nc_met/var_info_nc_met.h index bc2e0d0673..fb39471352 100644 --- a/src/libcode/vx_data2d_nc_met/var_info_nc_met.h +++ b/src/libcode/vx_data2d_nc_met/var_info_nc_met.h @@ -42,7 +42,7 @@ class VarInfoNcMet : public VarInfo VarInfoNcMet(const VarInfoNcMet &); VarInfoNcMet & operator=(const VarInfoNcMet &); - void dump(ostream &) const; + void dump(std::ostream &) const; void clear(); // diff --git a/src/libcode/vx_data2d_nc_pinterp/data2d_nc_pinterp.h b/src/libcode/vx_data2d_nc_pinterp/data2d_nc_pinterp.h index d9538dfa09..9356cd5128 100644 --- a/src/libcode/vx_data2d_nc_pinterp/data2d_nc_pinterp.h +++ b/src/libcode/vx_data2d_nc_pinterp/data2d_nc_pinterp.h @@ -18,7 +18,6 @@ #include -using namespace netCDF; #include "data_plane.h" #include "data_class.h" @@ -80,7 +79,7 @@ class MetNcPinterpDataFile : public Met2dDataFile { void close (); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; }; diff --git a/src/libcode/vx_data2d_nc_pinterp/get_pinterp_grid.h b/src/libcode/vx_data2d_nc_pinterp/get_pinterp_grid.h index 6294ed82cf..190de35fa0 100644 --- a/src/libcode/vx_data2d_nc_pinterp/get_pinterp_grid.h +++ b/src/libcode/vx_data2d_nc_pinterp/get_pinterp_grid.h @@ -22,7 +22,6 @@ #include -using namespace netCDF; #include "vx_grid.h" @@ -32,7 +31,7 @@ using namespace netCDF; extern bool get_pinterp_grid(const char * pinterp_filename, Grid &); -extern bool get_pinterp_grid(NcFile &, Grid &); +extern bool get_pinterp_grid(netCDF::NcFile &, Grid &); //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_data2d_nc_pinterp/pinterp_file.cc b/src/libcode/vx_data2d_nc_pinterp/pinterp_file.cc index 964d32cad6..c718944ad3 100644 --- a/src/libcode/vx_data2d_nc_pinterp/pinterp_file.cc +++ b/src/libcode/vx_data2d_nc_pinterp/pinterp_file.cc @@ -19,6 +19,9 @@ using namespace std; #include #include +#include +using namespace netCDF; + #include "vx_math.h" #include "vx_cal.h" #include "vx_log.h" diff --git a/src/libcode/vx_data2d_nc_pinterp/pinterp_file.h b/src/libcode/vx_data2d_nc_pinterp/pinterp_file.h index 631b7b4a02..2947562bd1 100644 --- a/src/libcode/vx_data2d_nc_pinterp/pinterp_file.h +++ b/src/libcode/vx_data2d_nc_pinterp/pinterp_file.h @@ -24,7 +24,6 @@ #include #include -using namespace netCDF; #include "vx_grid.h" #include "data_plane.h" @@ -53,10 +52,10 @@ class PinterpFile { void close(); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; - NcFile * Nc; // allocated + netCDF::NcFile * Nc; // allocated // // time @@ -77,14 +76,14 @@ class PinterpFile { int Ndims; - NcDim ** Dim; // allocated + netCDF::NcDim ** Dim; // allocated StringArray DimNames; - NcDim * Xdim; // not allocated - NcDim * Ydim; // not allocated - NcDim * Zdim; // not allocated - NcDim * Tdim; // not allocated + netCDF::NcDim * Xdim; // not allocated + netCDF::NcDim * Ydim; // not allocated + netCDF::NcDim * Zdim; // not allocated + netCDF::NcDim * Tdim; // not allocated // // variables @@ -108,9 +107,9 @@ class PinterpFile { // data // - double data(NcVar *, const LongArray &) const; + double data(netCDF::NcVar *, const LongArray &) const; - bool data(NcVar *, const LongArray &, DataPlane &, double & pressure) const; + bool data(netCDF::NcVar *, const LongArray &, DataPlane &, double & pressure) const; bool data(const char *, const LongArray &, DataPlane &, double & pressure, NcVarInfo *&) const; diff --git a/src/libcode/vx_data2d_nc_pinterp/var_info_nc_pinterp.h b/src/libcode/vx_data2d_nc_pinterp/var_info_nc_pinterp.h index bff8f90389..921d477b42 100644 --- a/src/libcode/vx_data2d_nc_pinterp/var_info_nc_pinterp.h +++ b/src/libcode/vx_data2d_nc_pinterp/var_info_nc_pinterp.h @@ -201,7 +201,7 @@ class VarInfoNcPinterp : public VarInfo VarInfoNcPinterp(const VarInfoNcPinterp &); VarInfoNcPinterp & operator=(const VarInfoNcPinterp &); - void dump(ostream &) const; + void dump(std::ostream &) const; void clear(); // diff --git a/src/libcode/vx_data2d_nccf/data2d_nccf.cc b/src/libcode/vx_data2d_nccf/data2d_nccf.cc index c36f55fef6..61a87cf472 100644 --- a/src/libcode/vx_data2d_nccf/data2d_nccf.cc +++ b/src/libcode/vx_data2d_nccf/data2d_nccf.cc @@ -17,6 +17,9 @@ using namespace std; #include #include +#include +using namespace netCDF; + #include "data2d_nccf.h" #include "vx_math.h" #include "vx_log.h" diff --git a/src/libcode/vx_data2d_nccf/data2d_nccf.h b/src/libcode/vx_data2d_nccf/data2d_nccf.h index 4abc64d934..1340b62e2b 100644 --- a/src/libcode/vx_data2d_nccf/data2d_nccf.h +++ b/src/libcode/vx_data2d_nccf/data2d_nccf.h @@ -17,9 +17,6 @@ //////////////////////////////////////////////////////////////////////// -#include -using namespace netCDF; - #include "data_plane.h" #include "data_class.h" #include "var_info_nccf.h" diff --git a/src/libcode/vx_data2d_nccf/nccf_file.cc b/src/libcode/vx_data2d_nccf/nccf_file.cc index 0f45544ae3..3e3cfcdbad 100644 --- a/src/libcode/vx_data2d_nccf/nccf_file.cc +++ b/src/libcode/vx_data2d_nccf/nccf_file.cc @@ -22,6 +22,9 @@ using namespace std; #include #include +#include +using namespace netCDF; + #include "vx_math.h" #include "vx_cal.h" #include "vx_log.h" diff --git a/src/libcode/vx_data2d_nccf/nccf_file.h b/src/libcode/vx_data2d_nccf/nccf_file.h index 9aa9308f16..8d7f0e7abf 100644 --- a/src/libcode/vx_data2d_nccf/nccf_file.h +++ b/src/libcode/vx_data2d_nccf/nccf_file.h @@ -23,9 +23,6 @@ #include -#include -using namespace netCDF; - #include "vx_grid.h" #include "nc_utils.h" #include "data_plane.h" @@ -107,9 +104,9 @@ class NcCfFile { // data // - double getData(NcVar *, const LongArray &) const; + double getData(netCDF::NcVar *, const LongArray &) const; - bool getData(NcVar *, const LongArray &, DataPlane &) const; + bool getData(netCDF::NcVar *, const LongArray &, DataPlane &) const; bool getData(const char *, const LongArray &, DataPlane &, NcVarInfo *&) const; @@ -120,7 +117,7 @@ class NcCfFile { static const double DELTA_TOLERANCE; - NcFile * _ncFile; // allocated + netCDF::NcFile * _ncFile; // allocated // // dimensions @@ -128,7 +125,7 @@ class NcCfFile { int _numDims; - NcDim ** _dims; // allocated + netCDF::NcDim ** _dims; // allocated StringArray _dimNames; @@ -136,14 +133,14 @@ class NcCfFile { // variables. Note that these are pointers into the _dims and Var // arrays so should not be deleted. - NcDim *_xDim; - NcDim *_yDim; - NcDim *_tDim; + netCDF::NcDim *_xDim; + netCDF::NcDim *_yDim; + netCDF::NcDim *_tDim; - NcVar *_latVar; - NcVar *_lonVar; - NcVar *_xCoordVar; - NcVar *_yCoordVar; + netCDF::NcVar *_latVar; + netCDF::NcVar *_lonVar; + netCDF::NcVar *_xCoordVar; + netCDF::NcVar *_yCoordVar; NcVarInfo *_time_var_info; void init_from_scratch(); @@ -163,29 +160,29 @@ class NcCfFile { // grid member with that information. void read_netcdf_grid(); - void get_grid_from_grid_mapping(const NcVarAtt *grid_mapping_att); + void get_grid_from_grid_mapping(const netCDF::NcVarAtt *grid_mapping_att); - void get_grid_mapping_albers_conical_equal_area(const NcVar *grid_mapping_var); - void get_grid_mapping_azimuthal_equidistant(const NcVar *grid_mapping_var); - void get_grid_mapping_lambert_azimuthal_equal_area(const NcVar *grid_mapping_var); - void get_grid_mapping_lambert_conformal_conic(const NcVar *grid_mapping_var); - void get_grid_mapping_lambert_cylindrical_equal_area(const NcVar *grid_mapping_var); - void get_grid_mapping_latitude_longitude(const NcVar *grid_mapping_var); - void get_grid_mapping_mercator(const NcVar *grid_mapping_var); - void get_grid_mapping_orthographic(const NcVar *grid_mapping_var); - void get_grid_mapping_polar_stereographic(const NcVar *grid_mapping_var); - void get_grid_mapping_rotated_latitude_longitude(const NcVar *grid_mapping_var); - void get_grid_mapping_stereographic(const NcVar *grid_mapping_var); - void get_grid_mapping_transverse_mercator(const NcVar *grid_mapping_var); - void get_grid_mapping_vertical_perspective(const NcVar *grid_mapping_var); - void get_grid_mapping_geostationary(const NcVar *grid_mapping_var); + void get_grid_mapping_albers_conical_equal_area(const netCDF::NcVar *grid_mapping_var); + void get_grid_mapping_azimuthal_equidistant(const netCDF::NcVar *grid_mapping_var); + void get_grid_mapping_lambert_azimuthal_equal_area(const netCDF::NcVar *grid_mapping_var); + void get_grid_mapping_lambert_conformal_conic(const netCDF::NcVar *grid_mapping_var); + void get_grid_mapping_lambert_cylindrical_equal_area(const netCDF::NcVar *grid_mapping_var); + void get_grid_mapping_latitude_longitude(const netCDF::NcVar *grid_mapping_var); + void get_grid_mapping_mercator(const netCDF::NcVar *grid_mapping_var); + void get_grid_mapping_orthographic(const netCDF::NcVar *grid_mapping_var); + void get_grid_mapping_polar_stereographic(const netCDF::NcVar *grid_mapping_var); + void get_grid_mapping_rotated_latitude_longitude(const netCDF::NcVar *grid_mapping_var); + void get_grid_mapping_stereographic(const netCDF::NcVar *grid_mapping_var); + void get_grid_mapping_transverse_mercator(const netCDF::NcVar *grid_mapping_var); + void get_grid_mapping_vertical_perspective(const netCDF::NcVar *grid_mapping_var); + void get_grid_mapping_geostationary(const netCDF::NcVar *grid_mapping_var); - bool get_grid_from_coordinates(const NcVar *data_var); + bool get_grid_from_coordinates(const netCDF::NcVar *data_var); bool get_grid_from_dimensions(); - void get_grid_from_lat_lon_vars(NcVar *lat_var, NcVar *lon_var, + void get_grid_from_lat_lon_vars(netCDF::NcVar *lat_var, netCDF::NcVar *lon_var, const long lat_counts, const long lon_counts); - LatLonData get_data_from_lat_lon_vars(NcVar *lat_var, NcVar *lon_var, + LatLonData get_data_from_lat_lon_vars(netCDF::NcVar *lat_var, netCDF::NcVar *lon_var, const long lat_counts, const long lon_counts, bool &swap_to_north); }; diff --git a/src/libcode/vx_data2d_python/data2d_python.h b/src/libcode/vx_data2d_python/data2d_python.h index 161b0a83fb..bb837ef5a4 100644 --- a/src/libcode/vx_data2d_python/data2d_python.h +++ b/src/libcode/vx_data2d_python/data2d_python.h @@ -84,7 +84,7 @@ class MetPythonDataFile : public Met2dDataFile { void close(); - void dump (ostream &, int depth = 0) const; + void dump (std::ostream &, int depth = 0) const; bool data_plane(VarInfo &, DataPlane &); diff --git a/src/libcode/vx_data2d_python/var_info_python.h b/src/libcode/vx_data2d_python/var_info_python.h index a9d9f781fa..776f0f4087 100644 --- a/src/libcode/vx_data2d_python/var_info_python.h +++ b/src/libcode/vx_data2d_python/var_info_python.h @@ -42,7 +42,7 @@ class VarInfoPython : public VarInfo VarInfoPython(const VarInfoPython &); VarInfoPython & operator=(const VarInfoPython &); - void dump(ostream &) const; + void dump(std::ostream &) const; void clear(); // diff --git a/src/libcode/vx_gis/dbf_file.h b/src/libcode/vx_gis/dbf_file.h index 78fc40e73f..03928046bc 100644 --- a/src/libcode/vx_gis/dbf_file.h +++ b/src/libcode/vx_gis/dbf_file.h @@ -71,7 +71,7 @@ class DbfHeader { void set_subrecords(int fd); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; DbfSubRecord * lookup_subrec(const char * text) const; // matches field_name @@ -119,13 +119,13 @@ class DbfSubRecord { void set(unsigned char * buf); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; }; //////////////////////////////////////////////////////////////////////// -void dump_record(ostream &, const int depth, const unsigned char * buf, const DbfHeader &); +void dump_record(std::ostream &, const int depth, const unsigned char * buf, const DbfHeader &); //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_gis/shp_array.h b/src/libcode/vx_gis/shp_array.h index 06f6aaeb4a..f0df12982d 100644 --- a/src/libcode/vx_gis/shp_array.h +++ b/src/libcode/vx_gis/shp_array.h @@ -78,7 +78,7 @@ class Shp_Array { void clear(); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; void extend(int, bool exact = true); @@ -232,7 +232,7 @@ return; template -void Shp_Array::dump(ostream & out, int depth) const +void Shp_Array::dump(std::ostream & out, int depth) const { diff --git a/src/libcode/vx_gis/shp_file.h b/src/libcode/vx_gis/shp_file.h index 821f0145ce..87e9f65031 100644 --- a/src/libcode/vx_gis/shp_file.h +++ b/src/libcode/vx_gis/shp_file.h @@ -61,7 +61,7 @@ struct ShpFileHeader { void set(unsigned char * buf); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; }; @@ -84,7 +84,7 @@ struct ShpRecordHeader { void set(unsigned char * buf); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; }; diff --git a/src/libcode/vx_gis/shp_point_record.h b/src/libcode/vx_gis/shp_point_record.h index 62e529f8d3..006223c6f7 100644 --- a/src/libcode/vx_gis/shp_point_record.h +++ b/src/libcode/vx_gis/shp_point_record.h @@ -61,7 +61,7 @@ struct ShpPointRecord { // this should really be a class, not a struct void set(unsigned char * buf); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; }; diff --git a/src/libcode/vx_gis/shp_poly_record.h b/src/libcode/vx_gis/shp_poly_record.h index bccc220387..5bd6e23777 100644 --- a/src/libcode/vx_gis/shp_poly_record.h +++ b/src/libcode/vx_gis/shp_poly_record.h @@ -69,7 +69,7 @@ struct ShpPolyRecord { // this should really be a class, not a struct void set(unsigned char * buf); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; int start_index(int partno) const; int stop_index(int partno) const; diff --git a/src/libcode/vx_gis/shx_file.h b/src/libcode/vx_gis/shx_file.h index b4d788183f..c57809865f 100644 --- a/src/libcode/vx_gis/shx_file.h +++ b/src/libcode/vx_gis/shx_file.h @@ -43,7 +43,7 @@ struct ShxRecord { void set(unsigned char * buf); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; }; diff --git a/src/libcode/vx_gnomon/gnomon.h b/src/libcode/vx_gnomon/gnomon.h index 81e280526a..2be3503707 100644 --- a/src/libcode/vx_gnomon/gnomon.h +++ b/src/libcode/vx_gnomon/gnomon.h @@ -16,11 +16,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - -//////////////////////////////////////////////////////////////////////// - - class GnomonicProjection { private: diff --git a/src/libcode/vx_grid/Makefile.in b/src/libcode/vx_grid/Makefile.in index 7151c4fbca..7e60a24082 100644 --- a/src/libcode/vx_grid/Makefile.in +++ b/src/libcode/vx_grid/Makefile.in @@ -146,9 +146,9 @@ am__depfiles_remade = ./$(DEPDIR)/libvx_grid_a-earth_rotation.Po \ ./$(DEPDIR)/libvx_grid_a-lc_grid.Po \ ./$(DEPDIR)/libvx_grid_a-merc_grid.Po \ ./$(DEPDIR)/libvx_grid_a-rot_latlon_grid.Po \ + ./$(DEPDIR)/libvx_grid_a-semilatlon_grid.Po \ ./$(DEPDIR)/libvx_grid_a-st_grid.Po \ - ./$(DEPDIR)/libvx_grid_a-tcrmw_grid.Po \ - ./$(DEPDIR)/libvx_grid_a-semilatlon_grid.Po + ./$(DEPDIR)/libvx_grid_a-tcrmw_grid.Po am__mv = mv -f AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) @@ -437,9 +437,9 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvx_grid_a-lc_grid.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvx_grid_a-merc_grid.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvx_grid_a-rot_latlon_grid.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvx_grid_a-semilatlon_grid.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvx_grid_a-st_grid.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvx_grid_a-tcrmw_grid.Po@am__quote@ # am--include-marker -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvx_grid_a-semilatlon_grid.Po@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @@ -778,9 +778,9 @@ distclean: distclean-am -rm -f ./$(DEPDIR)/libvx_grid_a-lc_grid.Po -rm -f ./$(DEPDIR)/libvx_grid_a-merc_grid.Po -rm -f ./$(DEPDIR)/libvx_grid_a-rot_latlon_grid.Po + -rm -f ./$(DEPDIR)/libvx_grid_a-semilatlon_grid.Po -rm -f ./$(DEPDIR)/libvx_grid_a-st_grid.Po -rm -f ./$(DEPDIR)/libvx_grid_a-tcrmw_grid.Po - -rm -f ./$(DEPDIR)/libvx_grid_a-semilatlon_grid.Po -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags @@ -836,9 +836,9 @@ maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/libvx_grid_a-lc_grid.Po -rm -f ./$(DEPDIR)/libvx_grid_a-merc_grid.Po -rm -f ./$(DEPDIR)/libvx_grid_a-rot_latlon_grid.Po + -rm -f ./$(DEPDIR)/libvx_grid_a-semilatlon_grid.Po -rm -f ./$(DEPDIR)/libvx_grid_a-st_grid.Po -rm -f ./$(DEPDIR)/libvx_grid_a-tcrmw_grid.Po - -rm -f ./$(DEPDIR)/libvx_grid_a-semilatlon_grid.Po -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic diff --git a/src/libcode/vx_grid/gaussian_grid.h b/src/libcode/vx_grid/gaussian_grid.h index d8d28d16f1..056a2699cb 100644 --- a/src/libcode/vx_grid/gaussian_grid.h +++ b/src/libcode/vx_grid/gaussian_grid.h @@ -73,7 +73,7 @@ class GaussianGrid : public GridRep { virtual ConcatString name() const; - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; ConcatString serialize(const char *sep=" ") const; diff --git a/src/libcode/vx_grid/grid_base.h b/src/libcode/vx_grid/grid_base.h index 9da7246b72..20fe27ae31 100644 --- a/src/libcode/vx_grid/grid_base.h +++ b/src/libcode/vx_grid/grid_base.h @@ -133,7 +133,7 @@ class GridInterface { // pure abstract class for grid public interface virtual ConcatString name() const = 0; - virtual void dump(ostream &, int = 0) const = 0; + virtual void dump(std::ostream &, int = 0) const = 0; virtual GridInfo info() const = 0; @@ -163,7 +163,7 @@ class GridRep : public GridInterface { GridRep(); virtual ~GridRep(); - virtual void dump(ostream &, int = 0) const = 0; + virtual void dump(std::ostream &, int = 0) const = 0; virtual ConcatString serialize(const char *sep=" ") const = 0; @@ -215,7 +215,7 @@ class Grid : public GridInterface { void clear(); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; bool is_set() const; diff --git a/src/libcode/vx_grid/latlon_grid.h b/src/libcode/vx_grid/latlon_grid.h index 646e6df0c4..d419802c65 100644 --- a/src/libcode/vx_grid/latlon_grid.h +++ b/src/libcode/vx_grid/latlon_grid.h @@ -69,7 +69,7 @@ class LatLonGrid : public GridRep { virtual ConcatString name() const; - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; ConcatString serialize(const char *sep=" ") const; diff --git a/src/libcode/vx_grid/latlon_grid_defs.h b/src/libcode/vx_grid/latlon_grid_defs.h index adb3d521ef..9a88bd5a3f 100644 --- a/src/libcode/vx_grid/latlon_grid_defs.h +++ b/src/libcode/vx_grid/latlon_grid_defs.h @@ -70,7 +70,7 @@ struct RotatedLatLonData { void dump() const; // doesn't work if verbosity level < 4 - void dump(ostream &, int depth) const; + void dump(std::ostream &, int depth) const; }; diff --git a/src/libcode/vx_grid/lc_grid.h b/src/libcode/vx_grid/lc_grid.h index 3d9ffc4f27..cd105c5f49 100644 --- a/src/libcode/vx_grid/lc_grid.h +++ b/src/libcode/vx_grid/lc_grid.h @@ -110,7 +110,7 @@ class LambertGrid : public GridRep { ConcatString name() const; - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; ConcatString serialize(const char *sep=" ") const; diff --git a/src/libcode/vx_grid/merc_grid.h b/src/libcode/vx_grid/merc_grid.h index c262cd9ebe..37c17fc5cc 100644 --- a/src/libcode/vx_grid/merc_grid.h +++ b/src/libcode/vx_grid/merc_grid.h @@ -93,7 +93,7 @@ class MercatorGrid : public GridRep { ConcatString name() const; - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; ConcatString serialize(const char *sep=" ") const; diff --git a/src/libcode/vx_grid/rot_latlon_grid.h b/src/libcode/vx_grid/rot_latlon_grid.h index b6eb9e8442..c381fc99c1 100644 --- a/src/libcode/vx_grid/rot_latlon_grid.h +++ b/src/libcode/vx_grid/rot_latlon_grid.h @@ -62,7 +62,7 @@ class RotatedLatLonGrid : public LatLonGrid { virtual ConcatString name() const; - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; ConcatString serialize(const char *sep=" ") const; diff --git a/src/libcode/vx_grid/semilatlon_grid.h b/src/libcode/vx_grid/semilatlon_grid.h index a6a07d6c66..9ca66cf9f8 100644 --- a/src/libcode/vx_grid/semilatlon_grid.h +++ b/src/libcode/vx_grid/semilatlon_grid.h @@ -77,7 +77,7 @@ class SemiLatLonGrid : public GridRep { ConcatString name() const; - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; ConcatString serialize(const char *sep=" ") const; diff --git a/src/libcode/vx_grid/st_grid.h b/src/libcode/vx_grid/st_grid.h index 5ee9747f5b..53d5150b9b 100644 --- a/src/libcode/vx_grid/st_grid.h +++ b/src/libcode/vx_grid/st_grid.h @@ -91,7 +91,7 @@ class StereographicGrid : public GridRep { ConcatString name() const; - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; ConcatString serialize(const char *sep=" ") const; diff --git a/src/libcode/vx_nc_obs/met_point_data.h b/src/libcode/vx_nc_obs/met_point_data.h index 8da98fe501..ad214d1347 100644 --- a/src/libcode/vx_nc_obs/met_point_data.h +++ b/src/libcode/vx_nc_obs/met_point_data.h @@ -122,7 +122,7 @@ class MetPointData { StringArray get_var_names(); bool is_same_obs_values(const float obs_arr1[OBS_ARRAY_LEN], const float obs_arr2[OBS_ARRAY_LEN]); - bool is_using_var_id(); + bool is_using_var_id() const; void set_grib_code_or_var_index(float obs_arr[OBS_ARRAY_LEN], int grib_code); void set_hdr_cnt(int hdr_cnt); @@ -165,7 +165,7 @@ inline int MetPointData::get_obs_cnt() { return nobs; } inline MetPointObsData *MetPointData::get_point_obs_data() { return obs_data; } inline StringArray MetPointData::get_qty_data() { return obs_data->qty_names; } inline StringArray MetPointData::get_var_names() { return obs_data->var_names; } -inline bool MetPointData::is_using_var_id() { return use_var_id; } +inline bool MetPointData::is_using_var_id() const { return use_var_id; } inline void MetPointData::set_grib_code_or_var_index(float obs_arr[OBS_ARRAY_LEN], int grib_code) { obs_arr[1] = grib_code; } inline void MetPointDataPython::set_use_var_id(bool new_use_var_id) { use_var_id = new_use_var_id; } diff --git a/src/libcode/vx_nc_obs/nc_obs_util.cc b/src/libcode/vx_nc_obs/nc_obs_util.cc index 036122b8a3..73db28167a 100644 --- a/src/libcode/vx_nc_obs/nc_obs_util.cc +++ b/src/libcode/vx_nc_obs/nc_obs_util.cc @@ -18,6 +18,9 @@ using namespace std; #include +#include +using namespace netCDF; + #include "vx_nc_util.h" #include "nc_obs_util.h" @@ -1249,7 +1252,7 @@ bool is_using_var_id(const char * nc_name) { return use_var_id; } -//////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// bool is_using_var_id(NcFile *nc_file) { bool use_var_id = false; diff --git a/src/libcode/vx_nc_obs/nc_obs_util.h b/src/libcode/vx_nc_obs/nc_obs_util.h index 2d8a06ca2c..30586f6a4c 100644 --- a/src/libcode/vx_nc_obs/nc_obs_util.h +++ b/src/libcode/vx_nc_obs/nc_obs_util.h @@ -14,7 +14,6 @@ #define __NC_OBS_UTIL_H__ #include -using namespace netCDF; #include "nc_summary.h" #include "met_point_data.h" @@ -88,61 +87,61 @@ struct NetcdfObsVars { int raw_hdr_cnt ; // raw data (PrepBufr) header array count int deflate_level; - NcDim strl_dim ; // header string dimension (16 bytes) - NcDim strl2_dim ; // header string dimension (40 bytes) - NcDim strl3_dim ; // header string dimension (80 bytes) - NcDim hdr_typ_dim ; // header message type dimension - NcDim hdr_sid_dim ; // header station id dimension - NcDim hdr_vld_dim ; // header valid time dimension - NcDim hdr_arr_dim ; // Header array width (V1.0, not used from V1.2) - NcDim obs_arr_dim ; // Observation array width (V1.0, not used from V1.2) - NcDim obs_dim ; // Observation array length (V1.0) - NcDim hdr_dim ; // Header array length (V1.0) - NcDim pb_hdr_dim ; // PrepfBufr Header array length (V1.2) - - NcVar hdr_typ_tbl_var ; // Message type (string) (V1.1) - NcVar hdr_sid_tbl_var ; // Station ID (string) (V1.1) - NcVar hdr_vld_tbl_var ; // Valid time (string) (V1.1) - NcVar obs_qty_tbl_var ; // Quality flag (V1.0) - NcVar hdr_typ_var ; // Message type (string to index with V1.2) - NcVar hdr_sid_var ; // Station ID (string to index with V1.2) - NcVar hdr_vld_var ; // Valid time (string to index with V1.2) - NcVar hdr_arr_var ; // Header array (V1.0, Removed from V1.2) - NcVar hdr_lat_var ; // Header array (latitude) (V1.2) - NcVar hdr_lon_var ; // Header array (longitude) (V1.2) - NcVar hdr_elv_var ; // Header array (elevation) (V1.2) - NcVar hdr_prpt_typ_var ; // Header array (PB report type) (V1.2) - NcVar hdr_irpt_typ_var ; // Header array (In report type) (V1.2) - NcVar hdr_inst_typ_var ; // Header array (instrument type) (V1.2) - NcVar obs_qty_var ; // Quality flag (unlimited dimension) (V1.2: Changed data type to int - was string) - NcVar obs_arr_var ; // Observation array (unlimited dimension) (V1.0, Removed from V1.2) - NcVar obs_hid_var ; // Observation header index array (unlimited dimension) (V1.2) - NcVar obs_gc_var ; // Observation GRIB code array (unlimited dimension) (V1.2) - NcVar obs_vid_var ; // Observation variable index array (unlimited dimension) (V1.2) - NcVar obs_lvl_var ; // Observation level array (unlimited dimension) (V1.2) - NcVar obs_hgt_var ; // Observation hight array (unlimited dimension) (V1.2) - NcVar obs_val_var ; // Observation value array (unlimited dimension) (V1.2) + netCDF::NcDim strl_dim ; // header string dimension (16 bytes) + netCDF::NcDim strl2_dim ; // header string dimension (40 bytes) + netCDF::NcDim strl3_dim ; // header string dimension (80 bytes) + netCDF::NcDim hdr_typ_dim ; // header message type dimension + netCDF::NcDim hdr_sid_dim ; // header station id dimension + netCDF::NcDim hdr_vld_dim ; // header valid time dimension + netCDF::NcDim hdr_arr_dim ; // Header array width (V1.0, not used from V1.2) + netCDF::NcDim obs_arr_dim ; // Observation array width (V1.0, not used from V1.2) + netCDF::NcDim obs_dim ; // Observation array length (V1.0) + netCDF::NcDim hdr_dim ; // Header array length (V1.0) + netCDF::NcDim pb_hdr_dim ; // PrepfBufr Header array length (V1.2) + + netCDF::NcVar hdr_typ_tbl_var ; // Message type (string) (V1.1) + netCDF::NcVar hdr_sid_tbl_var ; // Station ID (string) (V1.1) + netCDF::NcVar hdr_vld_tbl_var ; // Valid time (string) (V1.1) + netCDF::NcVar obs_qty_tbl_var ; // Quality flag (V1.0) + netCDF::NcVar hdr_typ_var ; // Message type (string to index with V1.2) + netCDF::NcVar hdr_sid_var ; // Station ID (string to index with V1.2) + netCDF::NcVar hdr_vld_var ; // Valid time (string to index with V1.2) + netCDF::NcVar hdr_arr_var ; // Header array (V1.0, Removed from V1.2) + netCDF::NcVar hdr_lat_var ; // Header array (latitude) (V1.2) + netCDF::NcVar hdr_lon_var ; // Header array (longitude) (V1.2) + netCDF::NcVar hdr_elv_var ; // Header array (elevation) (V1.2) + netCDF::NcVar hdr_prpt_typ_var ; // Header array (PB report type) (V1.2) + netCDF::NcVar hdr_irpt_typ_var ; // Header array (In report type) (V1.2) + netCDF::NcVar hdr_inst_typ_var ; // Header array (instrument type) (V1.2) + netCDF::NcVar obs_qty_var ; // Quality flag (unlimited dimension) (V1.2: Changed data type to int - was string) + netCDF::NcVar obs_arr_var ; // Observation array (unlimited dimension) (V1.0, Removed from V1.2) + netCDF::NcVar obs_hid_var ; // Observation header index array (unlimited dimension) (V1.2) + netCDF::NcVar obs_gc_var ; // Observation GRIB code array (unlimited dimension) (V1.2) + netCDF::NcVar obs_vid_var ; // Observation variable index array (unlimited dimension) (V1.2) + netCDF::NcVar obs_lvl_var ; // Observation level array (unlimited dimension) (V1.2) + netCDF::NcVar obs_hgt_var ; // Observation hight array (unlimited dimension) (V1.2) + netCDF::NcVar obs_val_var ; // Observation value array (unlimited dimension) (V1.2) // Optional variables - NcVar obs_var ; // Observation variable name (V1.1) - NcVar unit_var ; // The unit of the observation variable (V1.1) - NcVar desc_var ; // The description of the observation variable (V1.1) + netCDF::NcVar obs_var ; // Observation variable name (V1.1) + netCDF::NcVar unit_var ; // The unit of the observation variable (V1.1) + netCDF::NcVar desc_var ; // The description of the observation variable (V1.1) NetcdfObsVars(); bool is_valid(bool exit_on_error=false); void reset(bool _use_var_id = true); - void create_dimensions(NcFile *f_out); - void create_hdr_vars (NcFile *f_out, const int hdr_count); - void create_obs_vars (NcFile *f_out); - void create_obs_name_vars (NcFile *f_out, const int var_count, const int unit_count); - void create_table_vars (NcFile *f_out, MetPointHeader &hdr_data, NcDataBuffer &data_buffer); - void create_pb_hdrs (NcFile *f_out, const int hdr_count); - NcDim create_var_obs_var (NcFile *f_out, int var_count); + void create_dimensions(netCDF::NcFile *f_out); + void create_hdr_vars (netCDF::NcFile *f_out, const int hdr_count); + void create_obs_vars (netCDF::NcFile *f_out); + void create_obs_name_vars (netCDF::NcFile *f_out, const int var_count, const int unit_count); + void create_table_vars (netCDF::NcFile *f_out, MetPointHeader &hdr_data, NcDataBuffer &data_buffer); + void create_pb_hdrs (netCDF::NcFile *f_out, const int hdr_count); + netCDF::NcDim create_var_obs_var (netCDF::NcFile *f_out, int var_count); int get_hdr_index(); int get_obs_index(); - void read_dims_vars(NcFile *f_in); + void read_dims_vars(netCDF::NcFile *f_in); void read_header_data(MetPointHeader &hdr_data); bool read_obs_data(int buf_size, int offset, int qty_len, float *obs_arr, int *qty_idx_arr, char *obs_qty_buf); @@ -175,21 +174,21 @@ struct NcPointObsData : public MetPointObsData { extern bool add_nc_header_prepbufr (const int pb_report_type, const int in_report_type, const int instrument_type); -extern long count_nc_headers (vector< Observation > &observations); +extern long count_nc_headers (std::vector< Observation > &observations); extern int get_nc_hdr_cur_index(); extern int get_nc_obs_buf_index(); extern bool is_using_var_id (const char * nc_name); -extern bool is_using_var_id (NcFile * nc_file); +extern bool is_using_var_id (netCDF::NcFile * nc_file); extern void reset_header_buffer(int buf_size, bool reset_all=false); extern void set_header_buffer (int buf_size, bool reset_all=false); -extern string seconds_to_time_string(const int secs); +extern std::string seconds_to_time_string(const int secs); extern void write_nc_obs_buffer (const int buf_size); -extern int write_nc_string_array (NcVar *ncVar, StringArray &strArray, +extern int write_nc_string_array (netCDF::NcVar *ncVar, StringArray &strArray, const int str_len); #endif /* __NC_OBS_UTIL_H__ */ diff --git a/src/libcode/vx_nc_obs/nc_point_obs.cc b/src/libcode/vx_nc_obs/nc_point_obs.cc index 559693e462..fa0f49c2fb 100644 --- a/src/libcode/vx_nc_obs/nc_point_obs.cc +++ b/src/libcode/vx_nc_obs/nc_point_obs.cc @@ -20,6 +20,9 @@ using namespace std; #include #include +#include +using namespace netCDF; + #include "vx_log.h" #include "is_bad_data.h" diff --git a/src/libcode/vx_nc_obs/nc_point_obs.h b/src/libcode/vx_nc_obs/nc_point_obs.h index 4b957638f4..a678dc16c3 100644 --- a/src/libcode/vx_nc_obs/nc_point_obs.h +++ b/src/libcode/vx_nc_obs/nc_point_obs.h @@ -35,7 +35,7 @@ class MetNcPointObs : public MetPointData { protected: bool keep_nc; - NcFile *obs_nc; // allocated + netCDF::NcFile *obs_nc; // allocated NetcdfObsVars obs_vars; void init_from_scratch(); @@ -47,7 +47,7 @@ class MetNcPointObs : public MetPointData { bool open(const char * filename); void close(); - bool set_netcdf(NcFile *nc_file, bool _keep_nc=false); + bool set_netcdf(netCDF::NcFile *nc_file, bool _keep_nc=false); bool is_using_obs_arr(); diff --git a/src/libcode/vx_nc_obs/nc_point_obs_out.h b/src/libcode/vx_nc_obs/nc_point_obs_out.h index 34ce1c5ebf..42f1381b3f 100644 --- a/src/libcode/vx_nc_obs/nc_point_obs_out.h +++ b/src/libcode/vx_nc_obs/nc_point_obs_out.h @@ -60,10 +60,10 @@ class MetNcPointObsOut : public MetNcPointObs { void init_buffer(); void init_obs_vars(bool using_var_id, int deflate_level, bool attr_agl=false); - bool init_netcdf(int obs_count, int hdr_count, string program_name); + bool init_netcdf(int obs_count, int hdr_count, std::string program_name); void reset_header_buffer(int buf_size, bool reset_all); - void set_nc_out_data(vector observations, + void set_nc_out_data(std::vector observations, SummaryObs *summary_obs, TimeSummaryInfo summary_info, int processed_hdr_cnt=0); void set_using_var_id(bool using_var_id); @@ -75,7 +75,7 @@ class MetNcPointObsOut : public MetNcPointObs { void write_observation(); void write_observation(const float obs_arr[OBS_ARRAY_LEN], const char *obs_qty); void write_obs_data(); - int write_obs_data(const vector< Observation > observations, + int write_obs_data(const std::vector< Observation > observations, const bool do_header = true); bool write_to_netcdf(StringArray obs_names, StringArray obs_units, StringArray obs_descs); diff --git a/src/libcode/vx_nc_obs/nc_summary.cc b/src/libcode/vx_nc_obs/nc_summary.cc index 2dba528bb0..8a8cdb57b9 100644 --- a/src/libcode/vx_nc_obs/nc_summary.cc +++ b/src/libcode/vx_nc_obs/nc_summary.cc @@ -18,6 +18,9 @@ using namespace std; #include +#include +using namespace netCDF; + #include "write_netcdf.h" #include "nc_obs_util.h" diff --git a/src/libcode/vx_nc_obs/nc_summary.h b/src/libcode/vx_nc_obs/nc_summary.h index 7cebff8932..b1b7614a4c 100644 --- a/src/libcode/vx_nc_obs/nc_summary.h +++ b/src/libcode/vx_nc_obs/nc_summary.h @@ -14,7 +14,6 @@ #define __NC_SUMMARY_H__ #include -using namespace netCDF; #include "nc_utils.h" #include "nc_obs_util.h" #include "vx_summary.h" @@ -25,18 +24,18 @@ using namespace netCDF; struct NcObsOutputData { int processed_hdr_cnt; int deflate_level; - vector observations; + std::vector observations; SummaryObs *summary_obs; TimeSummaryInfo summary_info; }; //////////////////////////////////////////////////////////////////////// -extern string _secsToTimeString(const int secs); +extern std::string _secsToTimeString(const int secs); // Not moved to nc_obs_util to reduce the dependency (library) -extern void write_summary_attributes(NcFile *, TimeSummaryInfo); +extern void write_summary_attributes(netCDF::NcFile *, TimeSummaryInfo); //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_nc_util/grid_output.cc b/src/libcode/vx_nc_util/grid_output.cc index 1b9a0b1ccd..befa529b22 100644 --- a/src/libcode/vx_nc_util/grid_output.cc +++ b/src/libcode/vx_nc_util/grid_output.cc @@ -19,6 +19,9 @@ using namespace std; #include #include +#include +using namespace netCDF; + #include "grid_output.h" #include "vx_log.h" #include "nc_utils.h" @@ -749,7 +752,7 @@ if ( standard_name_str ) add_att(&nc_var, standard_name_att_name, standard_name put_nc_data(&nc_var, &var_data[0], nc_dim->getSize(), 0); -if ( var_data ) { delete var_data; var_data = (float *) 0; } +if ( var_data ) { delete [] var_data; var_data = (float *) 0; } // // done diff --git a/src/libcode/vx_nc_util/grid_output.h b/src/libcode/vx_nc_util/grid_output.h index 671ebaa43a..a06fbaa183 100644 --- a/src/libcode/vx_nc_util/grid_output.h +++ b/src/libcode/vx_nc_util/grid_output.h @@ -18,7 +18,6 @@ #include -using namespace netCDF; #include "vx_grid.h" @@ -26,7 +25,7 @@ using namespace netCDF; //////////////////////////////////////////////////////////////////////// -extern void grid_output(const GridInfo &, NcFile *, NcDim &, NcDim &); +extern void grid_output(const GridInfo &, netCDF::NcFile *, netCDF::NcDim &, netCDF::NcDim &); //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_nc_util/nc_utils.cc b/src/libcode/vx_nc_util/nc_utils.cc index dcfa3a2ea3..676fa75508 100644 --- a/src/libcode/vx_nc_util/nc_utils.cc +++ b/src/libcode/vx_nc_util/nc_utils.cc @@ -975,8 +975,8 @@ char get_char_val(NcFile * nc, const char * var_name, const int index) { char get_char_val(NcVar *var, const int index) { char k; - std::vector start; - std::vector count; + vector start; + vector count; // // Retrieve the character array value from the NetCDF variable. @@ -1002,8 +1002,8 @@ ConcatString* get_string_val(NcFile * nc, const char * var_name, const int index ConcatString* get_string_val(NcVar *var, const int index, const int len, ConcatString &tmp_cs) { char tmp_str[len]; - std::vector start; - std::vector count; + vector start; + vector count; const char *method_name = "get_string_val() "; if (2 != get_dim_count(var)) { @@ -1052,8 +1052,8 @@ int get_int_var(NcFile * nc, const char * var_name, const int index) { int get_int_var(NcVar * var, const int index) { int k; - std::vector start; - std::vector count; + vector start; + vector count; const char *method_name = "get_int_var() "; k = bad_data_int; @@ -1089,8 +1089,8 @@ int get_int_var(NcVar * var, const int index) { double get_nc_time(NcVar * var, const int index) { double k; - std::vector start; - std::vector count; + vector start; + vector count; const char *method_name = "get_nc_time() -> "; k = bad_data_double; @@ -1177,8 +1177,8 @@ float get_float_var(NcFile * nc, const char * var_name, const int index) { float get_float_var(NcVar * var, const int index) { float k; - std::vector start; - std::vector count; + vector start; + vector count; const char *method_name = "get_float_var() -> "; k = bad_data_float; @@ -2541,8 +2541,8 @@ void copy_nc_atts(NcFile *nc_from, NcFile *nc_to, const bool all_attrs) { //////////////////////////////////////////////////////////////////////// void copy_nc_atts(NcVar *var_from, NcVar *var_to, const bool all_attrs) { - std::map ncAttMap = var_from->getAtts(); - for (std::map::iterator itr = ncAttMap.begin(); + map ncAttMap = var_from->getAtts(); + for (map::iterator itr = ncAttMap.begin(); itr != ncAttMap.end(); ++itr) { if (all_attrs || ( (itr->first != "scale_factor") @@ -2706,7 +2706,7 @@ bool has_var(NcFile *nc, const char * var_name) { //////////////////////////////////////////////////////////////////////// NcVar add_var(NcFile *nc, const string &var_name, const NcType ncType, const int deflate_level) { - std::vector ncDimVector; + vector ncDimVector; string new_var_name = var_name; patch_nc_name(&new_var_name); NcVar var = nc->addVar(new_var_name, ncType, ncDimVector); @@ -3226,7 +3226,7 @@ unixtime get_reference_unixtime(NcVar *time_var, int &sec_per_unit, if (get_var_units(time_var, time_unit_str)) { parse_cf_time_string(time_unit_str.c_str(), ref_ut, sec_per_unit); - no_leap_year = (86400 == sec_per_unit) ? get_att_no_leap_year(time_var) : false; + no_leap_year = (sec_per_day == sec_per_unit) ? get_att_no_leap_year(time_var) : false; } else { sec_per_unit = 1; @@ -3304,7 +3304,13 @@ void parse_cf_time_string(const char *str, unixtime &ref_ut, tok.has("h")) sec_per_unit = 3600; else if(tok.has("day") || tok.has("days") || - tok.has("d")) sec_per_unit = 86400; + tok.has("d")) sec_per_unit = sec_per_day; + else if(tok.has("month") || + tok.has("months") || + tok.has("m")) sec_per_unit = sec_per_day * 30; + else if(tok.has("year") || + tok.has("years") || + tok.has("y")) sec_per_unit = sec_per_day * 30 * 12; else { mlog << Warning << "\n" << method_name << "Unsupported time step in the CF convention time unit \"" diff --git a/src/libcode/vx_nc_util/nc_utils.h b/src/libcode/vx_nc_util/nc_utils.h index 58fed1d8c3..199173e263 100644 --- a/src/libcode/vx_nc_util/nc_utils.h +++ b/src/libcode/vx_nc_util/nc_utils.h @@ -13,13 +13,11 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include -using namespace netCDF; + #ifndef ncbyte typedef signed char ncbyte; // from ncvalues.h #endif /* ncbyte */ @@ -35,7 +33,7 @@ typedef unsigned char uchar; //////////////////////////////////////////////////////////////////////// -static const string C_unknown_str = string("unknown"); +static const std::string C_unknown_str = std::string("unknown"); #define IS_VALID_NC(ncObj) (!ncObj.isNull()) #define IS_VALID_NC_P(ncObjPtr) ((ncObjPtr != 0 && !ncObjPtr->isNull())) @@ -86,65 +84,65 @@ static const string C_unknown_str = string("unknown"); #define OBS_BUFFER_SIZE (128 * 1024) -static const char nc_dim_nhdr[] = "nhdr"; -static const char nc_dim_nhdr_typ[] = "nhdr_typ"; -static const char nc_dim_nhdr_sid[] = "nhdr_sid"; -static const char nc_dim_nhdr_vld[] = "nhdr_vld"; -static const char nc_dim_npbhdr[] = "npbhdr"; -static const char nc_dim_nobs[] = "nobs"; -static const char nc_dim_nqty[] = "nobs_qty"; -static const char nc_dim_hdr_arr[] = "hdr_arr_len"; -static const char nc_dim_obs_arr[] = "obs_arr_len"; -static const char nc_dim_mxstr[] = "mxstr"; -static const char nc_dim_mxstr2[] = "mxstr2"; -static const char nc_dim_mxstr3[] = "mxstr3"; -static const char nc_dim_nvar[] = "obs_var_num"; -static const char nc_dim_unit[] = "unit_len"; -static const char nc_dim_desc[] = "desc_len"; -static const char nc_var_desc[] = "obs_desc"; -static const char nc_var_hdr_arr[] = "hdr_arr"; -static const char nc_var_hdr_lat[] = "hdr_lat"; -static const char nc_var_hdr_lon[] = "hdr_lon"; -static const char nc_var_hdr_elv[] = "hdr_elv"; -static const char nc_var_hdr_typ[] = "hdr_typ"; -static const char nc_var_hdr_sid[] = "hdr_sid"; -static const char nc_var_hdr_vld[] = "hdr_vld"; -static const char nc_var_hdr_prpt_typ[] = "hdr_prpt_typ"; -static const char nc_var_hdr_irpt_typ[] = "hdr_irpt_typ"; -static const char nc_var_hdr_inst_typ[] = "hdr_inst_typ"; -static const char nc_var_hdr_typ_tbl[] = "hdr_typ_table"; -static const char nc_var_hdr_sid_tbl[] = "hdr_sid_table"; -static const char nc_var_hdr_vld_tbl[] = "hdr_vld_table"; -static const char nc_var_obs_arr[] = "obs_arr"; -static const char nc_var_obs_hid[] = "obs_hid"; -static const char nc_var_obs_gc[] = "obs_gc"; -static const char nc_var_obs_vid[] = "obs_vid"; -static const char nc_var_obs_lvl[] = "obs_lvl"; -static const char nc_var_obs_hgt[] = "obs_hgt"; -static const char nc_var_obs_val[] = "obs_val"; -static const char nc_var_obs_qty[] = "obs_qty"; -static const char nc_var_obs_qty_tbl[] = "obs_qty_table"; -static const char nc_var_obs_var[] = "obs_var"; -static const char nc_var_unit[] = "obs_unit"; -static const string nc_att_use_var_id = "use_var_id"; -static const char nc_att_obs_version[] = "MET_Obs_version"; -static const char nc_att_met_point_nccf[] = "MET_point_NCCF"; - -static const string add_offset_att_name = "add_offset"; -static const string axis_att_name = "axis"; -static const string bounds_att_name = "bounds"; -static const string coordinates_att_name = "coordinates"; -static const string coordinate_axis_type_att_name = "_CoordinateAxisType"; -static const string description_att_name = "description"; -static const string fill_value_att_name = "_FillValue"; -static const string grid_mapping_att_name = "grid_mapping"; -static const string grid_mapping_name_att_name = "grid_mapping_name"; -static const string long_name_att_name = "long_name"; -static const string missing_value_att_name = "missing_value"; -static const string projection_att_name = "Projection"; -static const string scale_factor_att_name = "scale_factor"; -static const string standard_name_att_name = "standard_name"; -static const string units_att_name = "units"; +static const char nc_dim_nhdr[] = "nhdr"; +static const char nc_dim_nhdr_typ[] = "nhdr_typ"; +static const char nc_dim_nhdr_sid[] = "nhdr_sid"; +static const char nc_dim_nhdr_vld[] = "nhdr_vld"; +static const char nc_dim_npbhdr[] = "npbhdr"; +static const char nc_dim_nobs[] = "nobs"; +static const char nc_dim_nqty[] = "nobs_qty"; +static const char nc_dim_hdr_arr[] = "hdr_arr_len"; +static const char nc_dim_obs_arr[] = "obs_arr_len"; +static const char nc_dim_mxstr[] = "mxstr"; +static const char nc_dim_mxstr2[] = "mxstr2"; +static const char nc_dim_mxstr3[] = "mxstr3"; +static const char nc_dim_nvar[] = "obs_var_num"; +static const char nc_dim_unit[] = "unit_len"; +static const char nc_dim_desc[] = "desc_len"; +static const char nc_var_desc[] = "obs_desc"; +static const char nc_var_hdr_arr[] = "hdr_arr"; +static const char nc_var_hdr_lat[] = "hdr_lat"; +static const char nc_var_hdr_lon[] = "hdr_lon"; +static const char nc_var_hdr_elv[] = "hdr_elv"; +static const char nc_var_hdr_typ[] = "hdr_typ"; +static const char nc_var_hdr_sid[] = "hdr_sid"; +static const char nc_var_hdr_vld[] = "hdr_vld"; +static const char nc_var_hdr_prpt_typ[] = "hdr_prpt_typ"; +static const char nc_var_hdr_irpt_typ[] = "hdr_irpt_typ"; +static const char nc_var_hdr_inst_typ[] = "hdr_inst_typ"; +static const char nc_var_hdr_typ_tbl[] = "hdr_typ_table"; +static const char nc_var_hdr_sid_tbl[] = "hdr_sid_table"; +static const char nc_var_hdr_vld_tbl[] = "hdr_vld_table"; +static const char nc_var_obs_arr[] = "obs_arr"; +static const char nc_var_obs_hid[] = "obs_hid"; +static const char nc_var_obs_gc[] = "obs_gc"; +static const char nc_var_obs_vid[] = "obs_vid"; +static const char nc_var_obs_lvl[] = "obs_lvl"; +static const char nc_var_obs_hgt[] = "obs_hgt"; +static const char nc_var_obs_val[] = "obs_val"; +static const char nc_var_obs_qty[] = "obs_qty"; +static const char nc_var_obs_qty_tbl[] = "obs_qty_table"; +static const char nc_var_obs_var[] = "obs_var"; +static const char nc_var_unit[] = "obs_unit"; +static const std::string nc_att_use_var_id = "use_var_id"; +static const char nc_att_obs_version[] = "MET_Obs_version"; +static const char nc_att_met_point_nccf[] = "MET_point_NCCF"; + +static const std::string add_offset_att_name = "add_offset"; +static const std::string axis_att_name = "axis"; +static const std::string bounds_att_name = "bounds"; +static const std::string coordinates_att_name = "coordinates"; +static const std::string coordinate_axis_type_att_name = "_CoordinateAxisType"; +static const std::string description_att_name = "description"; +static const std::string fill_value_att_name = "_FillValue"; +static const std::string grid_mapping_att_name = "grid_mapping"; +static const std::string grid_mapping_name_att_name = "grid_mapping_name"; +static const std::string long_name_att_name = "long_name"; +static const std::string missing_value_att_name = "missing_value"; +static const std::string projection_att_name = "Projection"; +static const std::string scale_factor_att_name = "scale_factor"; +static const std::string standard_name_att_name = "standard_name"; +static const std::string units_att_name = "units"; static const char nc_time_unit_exp[] = "^[a-z|A-Z]* since [0-9]\\{1,4\\}-[0-9]\\{1,2\\}-[0-9]\\{1,2\\}"; @@ -159,206 +157,206 @@ static const int exit_code_no_obs_vars = 4; //////////////////////////////////////////////////////////////////////// -extern bool get_att_value(const NcAtt *, int &value); -extern bool get_att_value(const NcAtt *, float &value); -extern bool get_att_value(const NcAtt *, double &value); - -extern bool get_att_value_chars (const NcAtt *, ConcatString &); -extern int get_att_value_int (const NcAtt *); -extern long long get_att_value_llong (const NcAtt *); -extern double get_att_value_double (const NcAtt *); -extern void get_att_value_doubles(const NcAtt *, NumArray &); -extern float get_att_value_float (const NcAtt *); - -extern bool get_att_value_string(const NcVar *, const ConcatString &, ConcatString &); -extern int get_att_value_int (const NcVar *, const ConcatString &); -extern long long get_att_value_llong (const NcVar *, const ConcatString &); -extern double get_att_value_double(const NcVar *, const ConcatString &); - -extern bool get_att_value_string(const NcFile *, const ConcatString& , ConcatString &); -extern int get_att_value_int (const NcFile *, const ConcatString& ); -extern long long get_att_value_llong (const NcFile *, const ConcatString& ); -extern double get_att_value_double(const NcFile *, const ConcatString& ); -extern bool get_att_no_leap_year(const NcVar *); - -extern NcVarAtt *get_nc_att(const NcVar *, const ConcatString &, bool exit_on_error = false); -extern NcGroupAtt *get_nc_att(const NcFile *, const ConcatString &, bool exit_on_error = false); - -extern bool get_nc_att_value(const NcVarAtt *, string &); -extern bool get_nc_att_value(const NcVarAtt *, int &, bool exit_on_error = true); -extern bool get_nc_att_value(const NcVarAtt *, float &, bool exit_on_error = true); -extern bool get_nc_att_value(const NcVarAtt *, double &, bool exit_on_error = true); -extern bool get_nc_att_value(const NcVar *, const ConcatString &, ConcatString &, bool exit_on_error = false); -extern bool get_nc_att_value(const NcVar *, const ConcatString &, int &, bool exit_on_error = false); -extern bool get_nc_att_value(const NcVar *, const ConcatString &, float &, bool exit_on_error = false); -extern bool get_nc_att_value(const NcVar *, const ConcatString &, double &, bool exit_on_error = false); - -extern bool has_att(NcFile *, const ConcatString name, bool exit_on_error=false); -extern bool has_att(NcVar *, const ConcatString name, bool do_log=false); -extern bool has_unsigned_attribute(NcVar *); - -extern bool get_global_att(const NcGroupAtt *, ConcatString &); +extern bool get_att_value(const netCDF::NcAtt *, int &value); +extern bool get_att_value(const netCDF::NcAtt *, float &value); +extern bool get_att_value(const netCDF::NcAtt *, double &value); + +extern bool get_att_value_chars (const netCDF::NcAtt *, ConcatString &); +extern int get_att_value_int (const netCDF::NcAtt *); +extern long long get_att_value_llong (const netCDF::NcAtt *); +extern double get_att_value_double (const netCDF::NcAtt *); +extern void get_att_value_doubles(const netCDF::NcAtt *, NumArray &); +extern float get_att_value_float (const netCDF::NcAtt *); + +extern bool get_att_value_string(const netCDF::NcVar *, const ConcatString &, ConcatString &); +extern int get_att_value_int (const netCDF::NcVar *, const ConcatString &); +extern long long get_att_value_llong (const netCDF::NcVar *, const ConcatString &); +extern double get_att_value_double(const netCDF::NcVar *, const ConcatString &); + +extern bool get_att_value_string(const netCDF::NcFile *, const ConcatString& , ConcatString &); +extern int get_att_value_int (const netCDF::NcFile *, const ConcatString& ); +extern long long get_att_value_llong (const netCDF::NcFile *, const ConcatString& ); +extern double get_att_value_double(const netCDF::NcFile *, const ConcatString& ); +extern bool get_att_no_leap_year(const netCDF::NcVar *); + +extern netCDF::NcVarAtt *get_nc_att(const netCDF::NcVar *, const ConcatString &, bool exit_on_error = false); +extern netCDF::NcGroupAtt *get_nc_att(const netCDF::NcFile *, const ConcatString &, bool exit_on_error = false); + +extern bool get_nc_att_value(const netCDF::NcVarAtt *, std::string &); +extern bool get_nc_att_value(const netCDF::NcVarAtt *, int &, bool exit_on_error = true); +extern bool get_nc_att_value(const netCDF::NcVarAtt *, float &, bool exit_on_error = true); +extern bool get_nc_att_value(const netCDF::NcVarAtt *, double &, bool exit_on_error = true); +extern bool get_nc_att_value(const netCDF::NcVar *, const ConcatString &, ConcatString &, bool exit_on_error = false); +extern bool get_nc_att_value(const netCDF::NcVar *, const ConcatString &, int &, bool exit_on_error = false); +extern bool get_nc_att_value(const netCDF::NcVar *, const ConcatString &, float &, bool exit_on_error = false); +extern bool get_nc_att_value(const netCDF::NcVar *, const ConcatString &, double &, bool exit_on_error = false); + +extern bool has_att(netCDF::NcFile *, const ConcatString name, bool exit_on_error=false); +extern bool has_att(netCDF::NcVar *, const ConcatString name, bool do_log=false); +extern bool has_unsigned_attribute(netCDF::NcVar *); + +extern bool get_global_att(const netCDF::NcGroupAtt *, ConcatString &); extern bool get_global_att(const char *, const ConcatString &, bool &); extern bool get_global_att(const char *, const ConcatString &, ConcatString &); -extern bool get_global_att(const NcFile *, const ConcatString &, ConcatString &, bool error_out = false); -extern bool get_global_att(const NcFile *, const ConcatString &, int &, bool error_out = false); -extern bool get_global_att(const NcFile *, const ConcatString &, bool &, bool error_out = false); -extern bool get_global_att(const NcFile *, const ConcatString &, float &, bool error_out = false); -extern bool get_global_att(const NcFile *, const ConcatString &, double &, bool error_out = false); +extern bool get_global_att(const netCDF::NcFile *, const ConcatString &, ConcatString &, bool error_out = false); +extern bool get_global_att(const netCDF::NcFile *, const ConcatString &, int &, bool error_out = false); +extern bool get_global_att(const netCDF::NcFile *, const ConcatString &, bool &, bool error_out = false); +extern bool get_global_att(const netCDF::NcFile *, const ConcatString &, float &, bool error_out = false); +extern bool get_global_att(const netCDF::NcFile *, const ConcatString &, double &, bool error_out = false); -extern int get_version_no(const NcFile *); -extern bool is_version_less_than_1_02(const NcFile *nc); +extern int get_version_no(const netCDF::NcFile *); +extern bool is_version_less_than_1_02(const netCDF::NcFile *nc); -extern void add_att(NcFile *, const string &, const int ); -extern void add_att(NcFile *, const string &, const string); -extern void add_att(NcFile *, const string &, const char *); -extern void add_att(NcFile *, const string &, const ConcatString); -extern void add_att(NcVar *, const string &, const string); -extern void add_att(NcVar *, const string &, const int ); -extern void add_att(NcVar *, const string &, const float ); -extern void add_att(NcVar *, const string &, const double); +extern void add_att(netCDF::NcFile *, const std::string &, const int ); +extern void add_att(netCDF::NcFile *, const std::string &, const std::string); +extern void add_att(netCDF::NcFile *, const std::string &, const char *); +extern void add_att(netCDF::NcFile *, const std::string &, const ConcatString); +extern void add_att(netCDF::NcVar *, const std::string &, const std::string); +extern void add_att(netCDF::NcVar *, const std::string &, const int ); +extern void add_att(netCDF::NcVar *, const std::string &, const float ); +extern void add_att(netCDF::NcVar *, const std::string &, const double); -extern int get_var_names(NcFile *, StringArray *varNames); +extern int get_var_names(netCDF::NcFile *, StringArray *varNames); -extern bool get_var_att_float (const NcVar *, const ConcatString &, float &); -extern bool get_var_att_double(const NcVar *, const ConcatString &, double &); +extern bool get_var_att_float (const netCDF::NcVar *, const ConcatString &, float &); +extern bool get_var_att_double(const netCDF::NcVar *, const ConcatString &, double &); template -extern bool get_var_fill_value(const NcVar *var, T &att_val); -extern bool get_var_axis(const NcVar *var, ConcatString &att_val); -extern bool get_var_grid_mapping(const NcVar *var, ConcatString &att_val); -extern bool get_var_grid_mapping_name(const NcVar *var, ConcatString &att_val); -extern bool get_var_long_name(const NcVar *, ConcatString &); -extern double get_var_missing_value(const NcVar *); -extern bool get_var_standard_name(const NcVar *, ConcatString &); -extern bool get_var_units(const NcVar *, ConcatString &); +extern bool get_var_fill_value(const netCDF::NcVar *var, T &att_val); +extern bool get_var_axis(const netCDF::NcVar *var, ConcatString &att_val); +extern bool get_var_grid_mapping(const netCDF::NcVar *var, ConcatString &att_val); +extern bool get_var_grid_mapping_name(const netCDF::NcVar *var, ConcatString &att_val); +extern bool get_var_long_name(const netCDF::NcVar *, ConcatString &); +extern double get_var_missing_value(const netCDF::NcVar *); +extern bool get_var_standard_name(const netCDF::NcVar *, ConcatString &); +extern bool get_var_units(const netCDF::NcVar *, ConcatString &); extern bool args_ok(const LongArray &); -extern char get_char_val(NcFile *, const char * var_name, const int index); -extern char get_char_val(NcVar *var, const int index); +extern char get_char_val(netCDF::NcFile *, const char * var_name, const int index); +extern char get_char_val(netCDF::NcVar *var, const int index); -extern int get_int_var(NcFile *, const char * var_name, const int index); -extern int get_int_var(NcVar *, const int index); +extern int get_int_var(netCDF::NcFile *, const char * var_name, const int index); +extern int get_int_var(netCDF::NcVar *, const int index); -extern double get_nc_time(NcVar *, int index = 0); +extern double get_nc_time(netCDF::NcVar *, int index = 0); -extern float get_float_var(NcFile *, const char * var_name, const int index = 0); -extern float get_float_var(NcVar *, int const index = 0); +extern float get_float_var(netCDF::NcFile *, const char * var_name, const int index = 0); +extern float get_float_var(netCDF::NcVar *, int const index = 0); -extern ConcatString* get_string_val(NcFile *, const char * var_name, const int index, +extern ConcatString* get_string_val(netCDF::NcFile *, const char * var_name, const int index, const int len, ConcatString &tmp_cs); -extern ConcatString* get_string_val(NcVar *var, const int index, const int len, ConcatString &tmp_cs); - -extern bool get_nc_data(NcVar *, int *data); -extern bool get_nc_data(NcVar *, char *data); -extern bool get_nc_data(NcVar *, uchar *data); -extern bool get_nc_data(NcVar *, float *data); -extern bool get_nc_data(NcVar *, double *data); -extern bool get_nc_data(NcVar *, time_t *data); -extern bool get_nc_data(NcVar *, ncbyte *data); -extern bool get_nc_data(NcVar *, unsigned short *data); - -extern bool get_nc_data(NcVar *, int *data, const long *curs); -extern bool get_nc_data(NcVar *, char *data, const long *curs); -extern bool get_nc_data(NcVar *, short *data, const long *curs); -extern bool get_nc_data(NcVar *, float *data, const long *curs); -extern bool get_nc_data(NcVar *, double *data, const long *curs); - -extern bool get_nc_data(NcVar *, int *data, const long dim, const long cur=0); -extern bool get_nc_data(NcVar *, char *data, const long dim, const long cur=0); -extern bool get_nc_data(NcVar *, float *data, const long dim, const long cur=0); -extern bool get_nc_data(NcVar *, double *data, const long dim, const long cur=0); -extern bool get_nc_data(NcVar *, ncbyte *data, const long dim, const long cur=0); - -extern bool get_nc_data(NcVar *, int *data, const long *dims, const long *curs); -extern bool get_nc_data(NcVar *, char *data, const long *dims, const long *curs); -extern bool get_nc_data(NcVar *, short *data, const long *dims, const long *curs); -extern bool get_nc_data(NcVar *, float *data, const long *dims, const long *curs); -extern bool get_nc_data(NcVar *, double *data, const long *dims, const long *curs); -extern bool get_nc_data(NcVar *, ncbyte *data, const long *dims, const long *curs); - -extern bool get_nc_data_to_array(NcVar *, StringArray *); -extern bool get_nc_data_to_array(NcFile *, const char *, StringArray *); -extern int get_nc_string_length(NcVar *); -extern int get_nc_string_length(NcFile *, NcVar, const char *var_name); - -extern bool put_nc_data(NcVar *, const int *data ); -extern bool put_nc_data(NcVar *, const char *data ); -extern bool put_nc_data(NcVar *, const float *data ); -extern bool put_nc_data(NcVar *, const double *data ); -extern bool put_nc_data(NcVar *, const ncbyte *data ); - -extern bool put_nc_data(NcVar *, const int data, const long offset0=0, const long offset1=-1, const long c2=-1); -extern bool put_nc_data(NcVar *, const char data, const long offset0=0, const long offset1=-1, const long c2=-1); -extern bool put_nc_data(NcVar *, const float data, const long offset0=0, const long offset1=-1, const long c2=-1); -extern bool put_nc_data(NcVar *, const double data, const long offset0=0, const long offset1=-1, const long c2=-1); -extern bool put_nc_data(NcVar *, const ncbyte data, const long offset0=0, const long offset1=-1, const long c2=-1); - -extern bool put_nc_data(NcVar *, const int *data, const long length, const long offset); -extern bool put_nc_data(NcVar *, const char *data, const long length, const long offset); -extern bool put_nc_data(NcVar *, const float *data, const long length, const long offset); -extern bool put_nc_data(NcVar *, const double *data, const long length, const long offset); -extern bool put_nc_data(NcVar *, const ncbyte *data, const long length, const long offset); -extern bool put_nc_data(NcVar *, const int *data, const long *lengths, const long *offsets); -extern bool put_nc_data(NcVar *, const char *data, const long *lengths, const long *offsets); -extern bool put_nc_data(NcVar *, const float *data, const long *lengths, const long *offsets); - -extern bool put_nc_data_with_dims(NcVar *, const int *data, const int len0, +extern ConcatString* get_string_val(netCDF::NcVar *var, const int index, const int len, ConcatString &tmp_cs); + +extern bool get_nc_data(netCDF::NcVar *, int *data); +extern bool get_nc_data(netCDF::NcVar *, char *data); +extern bool get_nc_data(netCDF::NcVar *, uchar *data); +extern bool get_nc_data(netCDF::NcVar *, float *data); +extern bool get_nc_data(netCDF::NcVar *, double *data); +extern bool get_nc_data(netCDF::NcVar *, time_t *data); +extern bool get_nc_data(netCDF::NcVar *, ncbyte *data); +extern bool get_nc_data(netCDF::NcVar *, unsigned short *data); + +extern bool get_nc_data(netCDF::NcVar *, int *data, const long *curs); +extern bool get_nc_data(netCDF::NcVar *, char *data, const long *curs); +extern bool get_nc_data(netCDF::NcVar *, short *data, const long *curs); +extern bool get_nc_data(netCDF::NcVar *, float *data, const long *curs); +extern bool get_nc_data(netCDF::NcVar *, double *data, const long *curs); + +extern bool get_nc_data(netCDF::NcVar *, int *data, const long dim, const long cur=0); +extern bool get_nc_data(netCDF::NcVar *, char *data, const long dim, const long cur=0); +extern bool get_nc_data(netCDF::NcVar *, float *data, const long dim, const long cur=0); +extern bool get_nc_data(netCDF::NcVar *, double *data, const long dim, const long cur=0); +extern bool get_nc_data(netCDF::NcVar *, ncbyte *data, const long dim, const long cur=0); + +extern bool get_nc_data(netCDF::NcVar *, int *data, const long *dims, const long *curs); +extern bool get_nc_data(netCDF::NcVar *, char *data, const long *dims, const long *curs); +extern bool get_nc_data(netCDF::NcVar *, short *data, const long *dims, const long *curs); +extern bool get_nc_data(netCDF::NcVar *, float *data, const long *dims, const long *curs); +extern bool get_nc_data(netCDF::NcVar *, double *data, const long *dims, const long *curs); +extern bool get_nc_data(netCDF::NcVar *, ncbyte *data, const long *dims, const long *curs); + +extern bool get_nc_data_to_array(netCDF::NcVar *, StringArray *); +extern bool get_nc_data_to_array(netCDF::NcFile *, const char *, StringArray *); +extern int get_nc_string_length(netCDF::NcVar *); +extern int get_nc_string_length(netCDF::NcFile *, netCDF::NcVar, const char *var_name); + +extern bool put_nc_data(netCDF::NcVar *, const int *data ); +extern bool put_nc_data(netCDF::NcVar *, const char *data ); +extern bool put_nc_data(netCDF::NcVar *, const float *data ); +extern bool put_nc_data(netCDF::NcVar *, const double *data ); +extern bool put_nc_data(netCDF::NcVar *, const ncbyte *data ); + +extern bool put_nc_data(netCDF::NcVar *, const int data, const long offset0=0, const long offset1=-1, const long c2=-1); +extern bool put_nc_data(netCDF::NcVar *, const char data, const long offset0=0, const long offset1=-1, const long c2=-1); +extern bool put_nc_data(netCDF::NcVar *, const float data, const long offset0=0, const long offset1=-1, const long c2=-1); +extern bool put_nc_data(netCDF::NcVar *, const double data, const long offset0=0, const long offset1=-1, const long c2=-1); +extern bool put_nc_data(netCDF::NcVar *, const ncbyte data, const long offset0=0, const long offset1=-1, const long c2=-1); + +extern bool put_nc_data(netCDF::NcVar *, const int *data, const long length, const long offset); +extern bool put_nc_data(netCDF::NcVar *, const char *data, const long length, const long offset); +extern bool put_nc_data(netCDF::NcVar *, const float *data, const long length, const long offset); +extern bool put_nc_data(netCDF::NcVar *, const double *data, const long length, const long offset); +extern bool put_nc_data(netCDF::NcVar *, const ncbyte *data, const long length, const long offset); +extern bool put_nc_data(netCDF::NcVar *, const int *data, const long *lengths, const long *offsets); +extern bool put_nc_data(netCDF::NcVar *, const char *data, const long *lengths, const long *offsets); +extern bool put_nc_data(netCDF::NcVar *, const float *data, const long *lengths, const long *offsets); + +extern bool put_nc_data_with_dims(netCDF::NcVar *, const int *data, const int len0, const int len1=0, const int len2=0); -extern bool put_nc_data_with_dims(NcVar *, const int *data, const long len0, +extern bool put_nc_data_with_dims(netCDF::NcVar *, const int *data, const long len0, const long len1=0, const long len2=0); -extern bool put_nc_data_with_dims(NcVar *, const float *data, const int len0, +extern bool put_nc_data_with_dims(netCDF::NcVar *, const float *data, const int len0, const int len1=0, const int len2=0); -extern bool put_nc_data_with_dims(NcVar *, const float *data, const long len0, +extern bool put_nc_data_with_dims(netCDF::NcVar *, const float *data, const long len0, const long len1=0, const long len2=0); -extern bool put_nc_data_with_dims(NcVar *, const double *data, const int len0, +extern bool put_nc_data_with_dims(netCDF::NcVar *, const double *data, const int len0, const int len1=0, const int len2=0); -extern bool put_nc_data_with_dims(NcVar *, const double *data, const long len0, +extern bool put_nc_data_with_dims(netCDF::NcVar *, const double *data, const long len0, const long len1=0, const long len2=0); -extern NcVar get_var(NcFile *, const char * var_name); // exit if not exists -extern NcVar get_nc_var(NcFile *, const char * var_name, bool log_as_error=false); // continue even though not exists - -extern NcVar *copy_nc_var(NcFile *, NcVar *, const int deflate_level=DEF_DEFLATE_LEVEL, const bool all_attrs=true); -extern void copy_nc_att(NcFile *, NcVar *, const ConcatString attr_name); -extern void copy_nc_att( NcVar *, NcVar *, const ConcatString attr_name); -extern void copy_nc_atts(NcFile *, NcFile *, const bool all_attrs=true); -extern void copy_nc_atts( NcVar *, NcVar *, const bool all_attrs=true); -extern void copy_nc_var_data(NcVar *, NcVar *); - -extern bool has_var(NcFile *, const char * var_name); - -extern NcVar add_var(NcFile *, const string &, const NcType, const int deflate_level=DEF_DEFLATE_LEVEL); -extern NcVar add_var(NcFile *, const string &, const NcType, const NcDim, const int deflate_level=DEF_DEFLATE_LEVEL); -extern NcVar add_var(NcFile *, const string &, const NcType, const NcDim, const NcDim, const int deflate_level=DEF_DEFLATE_LEVEL); -extern NcVar add_var(NcFile *, const string &, const NcType, const NcDim, const NcDim, const NcDim, const int deflate_level=DEF_DEFLATE_LEVEL); -extern NcVar add_var(NcFile *, const string &, const NcType, const NcDim, const NcDim, const NcDim, const NcDim, const int deflate_level=DEF_DEFLATE_LEVEL); -extern NcVar add_var(NcFile *, const string &, const NcType, const vector, const int deflate_level=DEF_DEFLATE_LEVEL); - -extern NcDim add_dim(NcFile *, const string &); -extern NcDim add_dim(NcFile *, const string &, const size_t); -extern bool has_dim(NcFile *, const char *dim_name); -extern bool get_dim(const NcFile *, const ConcatString &, int &, bool error_out = false); -extern int get_dim_count(const NcVar *); -extern int get_dim_count(const NcFile *); -extern int get_dim_size(const NcDim *); -extern int get_dim_size(const NcVar *, const int dim_offset); -extern int get_dim_value(const NcFile *, const string &, const bool error_out = false); -extern NcDim get_nc_dim(const NcFile *, const string &dim_name); -extern NcDim get_nc_dim(const NcVar *, const string &dim_name); -extern NcDim get_nc_dim(const NcVar *, const int dim_offset); -extern bool get_dim_names(const NcVar *var, StringArray *dimNames); -extern bool get_dim_names(const NcFile *nc, StringArray *dimNames); - -extern NcVar get_nc_var_lat(const NcFile *nc); -extern NcVar get_nc_var_lon(const NcFile *nc); -extern NcVar get_nc_var_time(const NcFile *nc); -extern int get_index_at_nc_data(NcVar *var, double value, const string dim_name, bool is_time=false); -extern NcFile* open_ncfile(const char * nc_name, bool write = false); - -extern int get_data_size(NcVar *); -extern unixtime get_reference_unixtime(NcVar *time_var, int &sec_per_unit, +extern netCDF::NcVar get_var(netCDF::NcFile *, const char * var_name); // exit if not exists +extern netCDF::NcVar get_nc_var(netCDF::NcFile *, const char * var_name, bool log_as_error=false); // continue even though not exists + +extern netCDF::NcVar *copy_nc_var(netCDF::NcFile *, netCDF::NcVar *, const int deflate_level=DEF_DEFLATE_LEVEL, const bool all_attrs=true); +extern void copy_nc_att(netCDF::NcFile *, netCDF::NcVar *, const ConcatString attr_name); +extern void copy_nc_att( netCDF::NcVar *, netCDF::NcVar *, const ConcatString attr_name); +extern void copy_nc_atts(netCDF::NcFile *, netCDF::NcFile *, const bool all_attrs=true); +extern void copy_nc_atts( netCDF::NcVar *, netCDF::NcVar *, const bool all_attrs=true); +extern void copy_nc_var_data(netCDF::NcVar *, netCDF::NcVar *); + +extern bool has_var(netCDF::NcFile *, const char * var_name); + +extern netCDF::NcVar add_var(netCDF::NcFile *, const std::string &, const netCDF::NcType, const int deflate_level=DEF_DEFLATE_LEVEL); +extern netCDF::NcVar add_var(netCDF::NcFile *, const std::string &, const netCDF::NcType, const netCDF::NcDim, const int deflate_level=DEF_DEFLATE_LEVEL); +extern netCDF::NcVar add_var(netCDF::NcFile *, const std::string &, const netCDF::NcType, const netCDF::NcDim, const netCDF::NcDim, const int deflate_level=DEF_DEFLATE_LEVEL); +extern netCDF::NcVar add_var(netCDF::NcFile *, const std::string &, const netCDF::NcType, const netCDF::NcDim, const netCDF::NcDim, const netCDF::NcDim, const int deflate_level=DEF_DEFLATE_LEVEL); +extern netCDF::NcVar add_var(netCDF::NcFile *, const std::string &, const netCDF::NcType, const netCDF::NcDim, const netCDF::NcDim, const netCDF::NcDim, const netCDF::NcDim, const int deflate_level=DEF_DEFLATE_LEVEL); +extern netCDF::NcVar add_var(netCDF::NcFile *, const std::string &, const netCDF::NcType, const std::vector, const int deflate_level=DEF_DEFLATE_LEVEL); + +extern netCDF::NcDim add_dim(netCDF::NcFile *, const std::string &); +extern netCDF::NcDim add_dim(netCDF::NcFile *, const std::string &, const size_t); +extern bool has_dim(netCDF::NcFile *, const char *dim_name); +extern bool get_dim(const netCDF::NcFile *, const ConcatString &, int &, bool error_out = false); +extern int get_dim_count(const netCDF::NcVar *); +extern int get_dim_count(const netCDF::NcFile *); +extern int get_dim_size(const netCDF::NcDim *); +extern int get_dim_size(const netCDF::NcVar *, const int dim_offset); +extern int get_dim_value(const netCDF::NcFile *, const std::string &, const bool error_out = false); +extern netCDF::NcDim get_nc_dim(const netCDF::NcFile *, const std::string &dim_name); +extern netCDF::NcDim get_nc_dim(const netCDF::NcVar *, const std::string &dim_name); +extern netCDF::NcDim get_nc_dim(const netCDF::NcVar *, const int dim_offset); +extern bool get_dim_names(const netCDF::NcVar *var, StringArray *dimNames); +extern bool get_dim_names(const netCDF::NcFile *nc, StringArray *dimNames); + +extern netCDF::NcVar get_nc_var_lat(const netCDF::NcFile *nc); +extern netCDF::NcVar get_nc_var_lon(const netCDF::NcFile *nc); +extern netCDF::NcVar get_nc_var_time(const netCDF::NcFile *nc); +extern int get_index_at_nc_data(netCDF::NcVar *var, double value, const std::string dim_name, bool is_time=false); +extern netCDF::NcFile* open_ncfile(const char * nc_name, bool write = false); + +extern int get_data_size(netCDF::NcVar *); +extern unixtime get_reference_unixtime(netCDF::NcVar *time_var, int &sec_per_unit, bool &no_leap_year); extern bool is_nc_unit_time(const char *units); diff --git a/src/libcode/vx_nc_util/nc_utils.hpp b/src/libcode/vx_nc_util/nc_utils.hpp index f66b665a29..ceb5bd2807 100644 --- a/src/libcode/vx_nc_util/nc_utils.hpp +++ b/src/libcode/vx_nc_util/nc_utils.hpp @@ -13,21 +13,21 @@ //////////////////////////////////////////////////////////////////////// -extern bool get_att_value(const NcAtt *att, int &att_val); -extern bool get_att_value(const NcAtt *att, ConcatString &value); -extern bool get_att_value(const NcAtt *att, ncbyte &att_val); -extern bool get_att_value(const NcAtt *att, short &att_val); -extern bool get_att_value(const NcAtt *att, int &att_val); -extern bool get_att_value(const NcAtt *att, unsigned int &att_val); -extern bool get_att_value(const NcAtt *att, float &att_val); -extern bool get_att_value(const NcAtt *att, double &att_val); -extern ConcatString get_log_msg_for_att(const NcVarAtt *att); -extern ConcatString get_log_msg_for_att(const NcVarAtt *att, string var_name, +extern bool get_att_value(const netCDF::NcAtt *att, int &att_val); +extern bool get_att_value(const netCDF::NcAtt *att, ConcatString &value); +extern bool get_att_value(const netCDF::NcAtt *att, ncbyte &att_val); +extern bool get_att_value(const netCDF::NcAtt *att, short &att_val); +extern bool get_att_value(const netCDF::NcAtt *att, int &att_val); +extern bool get_att_value(const netCDF::NcAtt *att, unsigned int &att_val); +extern bool get_att_value(const netCDF::NcAtt *att, float &att_val); +extern bool get_att_value(const netCDF::NcAtt *att, double &att_val); +extern ConcatString get_log_msg_for_att(const netCDF::NcVarAtt *att); +extern ConcatString get_log_msg_for_att(const netCDF::NcVarAtt *att, std::string var_name, const ConcatString att_name); -extern double get_var_add_offset(const NcVar *var); -extern double get_var_scale_factor(const NcVar *var); -extern bool has_add_offset_attr(NcVar *var); -extern bool has_scale_factor_attr(NcVar *var); +extern double get_var_add_offset(const netCDF::NcVar *var); +extern double get_var_scale_factor(const netCDF::NcVar *var); +extern bool has_add_offset_attr(netCDF::NcVar *var); +extern bool has_scale_factor_attr(netCDF::NcVar *var); extern void set_def_fill_value(ncbyte *val); extern void set_def_fill_value(char *val); extern void set_def_fill_value(double *val); @@ -45,7 +45,7 @@ extern void set_def_fill_value(unsigned short *val); //////////////////////////////////////////////////////////////////////// template -bool get_att_num_value_(const NcAtt *att, T &att_val, int matching_type) { +bool get_att_num_value_(const netCDF::NcAtt *att, T &att_val, int matching_type) { bool status = false; if (IS_VALID_NC_P(att)) { int nc_type_id = GET_NC_TYPE_ID_P(att); @@ -54,7 +54,7 @@ bool get_att_num_value_(const NcAtt *att, T &att_val, int matching_type) { status = true; } else if (NC_CHAR == nc_type_id) { - string att_value; + std::string att_value; att->getValues(att_value); if (matching_type == NC_FLOAT) att_val = atof(att_value.c_str()); @@ -71,7 +71,7 @@ bool get_att_num_value_(const NcAtt *att, T &att_val, int matching_type) { //////////////////////////////////////////////////////////////////////// template -bool get_nc_att_value_(const NcVar *var, const ConcatString &att_name, +bool get_nc_att_value_(const netCDF::NcVar *var, const ConcatString &att_name, T &att_val, bool exit_on_error, T bad_data, const char *caller_name) { bool status = false; @@ -82,8 +82,8 @@ bool get_nc_att_value_(const NcVar *var, const ConcatString &att_name, // // Retrieve the NetCDF variable attribute. // - NcVarAtt *att = get_nc_att(var, att_name); - status = get_att_value((NcAtt *)att, att_val); + netCDF::NcVarAtt *att = get_nc_att(var, att_name); + status = get_att_value((netCDF::NcAtt *)att, att_val); if (!status) { mlog << Error << "\n" << caller_name << get_log_msg_for_att(att, GET_SAFE_NC_NAME_P(var), att_name); @@ -100,7 +100,7 @@ bool get_nc_att_value_(const NcVar *var, const ConcatString &att_name, //////////////////////////////////////////////////////////////////////// template -bool get_nc_att_value_(const NcVarAtt *att, T &att_val, bool exit_on_error, +bool get_nc_att_value_(const netCDF::NcVarAtt *att, T &att_val, bool exit_on_error, T bad_data, const char *caller_name) { bool status = true; @@ -110,7 +110,7 @@ bool get_nc_att_value_(const NcVarAtt *att, T &att_val, bool exit_on_error, // // Retrieve the NetCDF variable attribute. // - status = get_att_value((NcAtt *)att, att_val); + status = get_att_value((netCDF::NcAtt *)att, att_val); if (!status) { mlog << Error << "\n" << caller_name << get_log_msg_for_att(att); @@ -123,16 +123,16 @@ bool get_nc_att_value_(const NcVarAtt *att, T &att_val, bool exit_on_error, //////////////////////////////////////////////////////////////////////// template -bool get_global_att_value_(const NcFile *nc, const ConcatString& att_name, +bool get_global_att_value_(const netCDF::NcFile *nc, const ConcatString& att_name, T &att_val, T bad_data, bool error_out, const char *caller_name) { bool status = false; // Initialize att_val = bad_data; - NcGroupAtt *nc_att = get_nc_att(nc, att_name); + netCDF::NcGroupAtt *nc_att = get_nc_att(nc, att_name); if (IS_VALID_NC_P(nc_att)) { - status = get_att_value((NcAtt *)nc_att, att_val); - string data_type = GET_NC_TYPE_NAME_P(nc_att); + status = get_att_value((netCDF::NcAtt *)nc_att, att_val); + std::string data_type = GET_NC_TYPE_NAME_P(nc_att); if (error_out && !status) { mlog << Error << caller_name << "The data type \"" << data_type @@ -154,14 +154,14 @@ bool get_global_att_value_(const NcFile *nc, const ConcatString& att_name, //////////////////////////////////////////////////////////////////////// template -bool get_var_att_num_(const NcVar *var, const ConcatString &att_name, +bool get_var_att_num_(const netCDF::NcVar *var, const ConcatString &att_name, T &att_val, T bad_data) { bool status = false; // Initialize att_val = bad_data; - NcVarAtt *att = get_nc_att(var, att_name); + netCDF::NcVarAtt *att = get_nc_att(var, att_name); // Look for a match if (IS_VALID_NC_P(att)) { att->getValues(&att_val); @@ -175,10 +175,10 @@ bool get_var_att_num_(const NcVar *var, const ConcatString &att_name, //////////////////////////////////////////////////////////////////////// template -bool get_var_fill_value(const NcVar *var, T &att_val) { +bool get_var_fill_value(const netCDF::NcVar *var, T &att_val) { bool found = false; - NcVarAtt *att = get_nc_att(var, fill_value_att_name); + netCDF::NcVarAtt *att = get_nc_att(var, fill_value_att_name); if (IS_INVALID_NC_P(att)) { if (att) delete att; att = get_nc_att(var, missing_value_att_name); @@ -258,7 +258,7 @@ void apply_scale_factor_(T *data, const int cell_count, // - template _ reads data and applies scale_factor and add_offset. template -bool get_nc_data_t(NcVar *var, T *data) { +bool get_nc_data_t(netCDF::NcVar *var, T *data) { bool return_status = false; if (IS_VALID_NC_P(var)) { @@ -272,7 +272,7 @@ bool get_nc_data_t(NcVar *var, T *data) { //////////////////////////////////////////////////////////////////////// template -bool get_nc_data_(NcVar *var, T *data, const T met_missing) { +bool get_nc_data_(netCDF::NcVar *var, T *data, const T met_missing) { //const char *method_name = "get_nc_data_() "; int data_size = get_data_size(var); @@ -302,7 +302,7 @@ bool get_nc_data_(NcVar *var, T *data, const T met_missing) { //////////////////////////////////////////////////////////////////////// template -bool get_nc_data_(NcVar *var, T *data, T bad_data, const long *dims, const long *curs) { +bool get_nc_data_(netCDF::NcVar *var, T *data, T bad_data, const long *dims, const long *curs) { bool return_status = false; const char *method_name = "get_nc_data_(T, *dims, *curs) "; @@ -315,7 +315,7 @@ bool get_nc_data_(NcVar *var, T *data, T bad_data, const long *dims, const long for (int idx = 0 ; idx < dimC; idx++) { int dim_size = get_dim_size(var, idx); if ((curs[idx]+dims[idx]) > dim_size) { - NcDim nc_dim = get_nc_dim(var, idx); + netCDF::NcDim nc_dim = get_nc_dim(var, idx); mlog << Error << "\n" << method_name << "The start offset and count (" << curs[idx] << ", " << dims[idx] << ") exceeds the dimension[" << idx << "] " << dim_size << " " @@ -358,7 +358,7 @@ bool get_nc_data_(NcVar *var, T *data, T bad_data, const long *dims, const long //////////////////////////////////////////////////////////////////////// template -bool get_nc_data_(NcVar *var, T *data, T met_missing, const long dim, const long cur) { +bool get_nc_data_(netCDF::NcVar *var, T *data, T met_missing, const long dim, const long cur) { bool return_status = false; const char *method_name = "get_nc_data_(T, dim, cur) "; for (int idx=0; idx dim_size) && (0 < dim_size)) { - NcDim nc_dim = get_nc_dim(var, dim_idx); + netCDF::NcDim nc_dim = get_nc_dim(var, dim_idx); mlog << Error << "\n" << method_name << "The start offset and count (" << cur << " + " << dim << ") exceeds the dimension " << dim_size << " " << (IS_VALID_NC(nc_dim) ? GET_NC_NAME(nc_dim) : " ") @@ -415,7 +415,7 @@ bool get_nc_data_(NcVar *var, T *data, T met_missing, const long dim, const long // read a single data template -bool get_nc_data_(NcVar *var, T *data, T bad_data, const long *curs) { +bool get_nc_data_(netCDF::NcVar *var, T *data, T bad_data, const long *curs) { bool return_status = false; const char *method_name = "get_nc_data_(*curs) "; @@ -436,7 +436,7 @@ bool get_nc_data_(NcVar *var, T *data, T bad_data, const long *curs) { //////////////////////////////////////////////////////////////////////// template -void copy_nc_data_t(NcVar *var, float *data, const T *packed_data, +void copy_nc_data_t(netCDF::NcVar *var, float *data, const T *packed_data, const int cell_count, const char *data_type, double add_offset, double scale_factor, bool has_missing, T missing_value) { @@ -525,7 +525,7 @@ void copy_nc_data_t(NcVar *var, float *data, const T *packed_data, //////////////////////////////////////////////////////////////////////// template -void copy_nc_data_(NcVar *var, float *data, const T *packed_data, +void copy_nc_data_(netCDF::NcVar *var, float *data, const T *packed_data, const int cell_count, const char *data_type, double add_offset, double scale_factor) { T missing_value; @@ -538,7 +538,7 @@ void copy_nc_data_(NcVar *var, float *data, const T *packed_data, //////////////////////////////////////////////////////////////////////// template -void copy_nc_data_t(NcVar *var, double *data, const T *packed_data, +void copy_nc_data_t(netCDF::NcVar *var, double *data, const T *packed_data, const int cell_count, const char *data_type, double add_offset, double scale_factor, bool has_missing, T missing_value) { @@ -622,7 +622,7 @@ void copy_nc_data_t(NcVar *var, double *data, const T *packed_data, //////////////////////////////////////////////////////////////////////// template -void copy_nc_data_(NcVar *var, double *data, const T *packed_data, +void copy_nc_data_(netCDF::NcVar *var, double *data, const T *packed_data, const int cell_count, const char *data_type, double add_offset, double scale_factor) { T missing_value; @@ -635,8 +635,8 @@ void copy_nc_data_(NcVar *var, double *data, const T *packed_data, //////////////////////////////////////////////////////////////////////// template -bool put_nc_data_T(NcVar *var, const T data, long offset0, long offset1, long offset2) { - vector offsets; +bool put_nc_data_T(netCDF::NcVar *var, const T data, long offset0, long offset1, long offset2) { + std::vector offsets; offsets.push_back((size_t)offset0); if (0 <= offset1) { offsets.push_back((size_t)offset1); @@ -651,8 +651,8 @@ bool put_nc_data_T(NcVar *var, const T data, long offset0, long offset1, long of //////////////////////////////////////////////////////////////////////// template -bool put_nc_data_T(NcVar *var, const T *data, const long length, const long offset) { - vector offsets, counts; +bool put_nc_data_T(netCDF::NcVar *var, const T *data, const long length, const long offset) { + std::vector offsets, counts; int dim_count = get_dim_count(var); offsets.push_back(offset); if (dim_count >= 2) { @@ -667,9 +667,9 @@ bool put_nc_data_T(NcVar *var, const T *data, const long length, const long o //////////////////////////////////////////////////////////////////////// template -bool put_nc_data_T(NcVar *var, const T *data , const long *lengths, const long *offsets) { +bool put_nc_data_T(netCDF::NcVar *var, const T *data , const long *lengths, const long *offsets) { int dim = get_dim_count(var); - vector nc_offsets, counts; + std::vector nc_offsets, counts; for (int idx = 0 ; idx < dim; idx++) { nc_offsets.push_back(offsets[idx]); } @@ -683,9 +683,9 @@ bool put_nc_data_T(NcVar *var, const T *data , const long *lengths, const long * //////////////////////////////////////////////////////////////////////// template -bool put_nc_data_T_with_dims(NcVar *var, const T *data, +bool put_nc_data_T_with_dims(netCDF::NcVar *var, const T *data, const long len0, const long len1, const long len2) { - vector offsets, counts; + std::vector offsets, counts; if (0 < len0) { offsets.push_back(0); counts.push_back(len0); diff --git a/src/libcode/vx_nc_util/nc_var_info.cc b/src/libcode/vx_nc_util/nc_var_info.cc index 4c3e9173cd..1764eb9bce 100644 --- a/src/libcode/vx_nc_util/nc_var_info.cc +++ b/src/libcode/vx_nc_util/nc_var_info.cc @@ -12,6 +12,9 @@ using namespace std; +#include +using namespace netCDF; + #include #include #include diff --git a/src/libcode/vx_nc_util/nc_var_info.h b/src/libcode/vx_nc_util/nc_var_info.h index 3a8e6b3681..ab01c5869b 100644 --- a/src/libcode/vx_nc_util/nc_var_info.h +++ b/src/libcode/vx_nc_util/nc_var_info.h @@ -22,20 +22,19 @@ #include -using namespace netCDF; #include "vx_util.h" //////////////////////////////////////////////////////////////////////// -static const string accum_time_att_name = "accum_time"; -static const string accum_time_sec_att_name = "accum_time_sec"; -static const string init_time_att_name = "init_time"; -static const string init_time_ut_att_name = "init_time_ut"; -static const string level_att_name = "level"; -static const string name_att_name = "name"; -static const string valid_time_att_name = "valid_time"; -static const string valid_time_ut_att_name = "valid_time_ut"; +static const std::string accum_time_att_name = "accum_time"; +static const std::string accum_time_sec_att_name = "accum_time_sec"; +static const std::string init_time_att_name = "init_time"; +static const std::string init_time_ut_att_name = "init_time_ut"; +static const std::string level_att_name = "level"; +static const std::string name_att_name = "name"; +static const std::string valid_time_att_name = "valid_time"; +static const std::string valid_time_ut_att_name = "valid_time_ut"; //////////////////////////////////////////////////////////////////////// @@ -57,10 +56,10 @@ class NcVarInfo { void clear(); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; - NcVar * var; // not allocated + netCDF::NcVar * var; // not allocated ConcatString name; @@ -82,7 +81,7 @@ class NcVarInfo { int Ndims; - NcDim ** Dims; // allocated + netCDF::NcDim ** Dims; // allocated int x_slot; // starting from zero int y_slot; // @@ -102,14 +101,14 @@ extern bool get_att_level(const NcVarInfo &, ConcatString &); extern bool get_att_name(const NcVarInfo &, ConcatString &); // unixtimes could be ints or strings -extern bool get_att_unixtime(const NcVar *, const ConcatString, unixtime &); +extern bool get_att_unixtime(const netCDF::NcVar *, const ConcatString, unixtime &); extern bool get_att_unixtime(const NcVarInfo &, const ConcatString, unixtime &); -extern unixtime get_att_value_unixtime(const NcAtt *); +extern unixtime get_att_value_unixtime(const netCDF::NcAtt *); -extern unixtime get_att_value_unixtime(const NcAtt *); +extern unixtime get_att_value_unixtime(const netCDF::NcAtt *); -extern NcVarInfo* find_var_info_by_dim_name(NcVarInfo *vars, const string dim_name, +extern NcVarInfo* find_var_info_by_dim_name(NcVarInfo *vars, const std::string dim_name, const int nvars); //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_nc_util/write_netcdf.cc b/src/libcode/vx_nc_util/write_netcdf.cc index 798c155032..7d5e037007 100644 --- a/src/libcode/vx_nc_util/write_netcdf.cc +++ b/src/libcode/vx_nc_util/write_netcdf.cc @@ -20,6 +20,9 @@ using namespace std; #include #include +#include +using namespace netCDF; + #include "vx_log.h" #include "vx_cal.h" #include "vx_util.h" @@ -160,7 +163,7 @@ void write_netcdf_latlon_2d(NcFile *f_out, NcDim *lat_dim, NcDim *lon_dim, NcVar lat_var, lon_var; float *lat_data = (float *) 0; float *lon_data = (float *) 0; - std::vector dims; + vector dims; long counts[2] = {grid.ny(), grid.nx()}; long offsets[2] = {0 , 0}; @@ -216,8 +219,8 @@ void write_netcdf_grid_weight(NcFile *f_out, NcDim *lat_dim, NcDim *lon_dim, //NcVar *wgt_var = (NcVar *) 0; NcVar wgt_var ; float *wgt_data = (float *) 0; - std::vector dims; - std::vector count; + vector dims; + vector count; // Define Variables dims.push_back(*lat_dim); diff --git a/src/libcode/vx_nc_util/write_netcdf.h b/src/libcode/vx_nc_util/write_netcdf.h index 79f76e044c..3b5e1339e9 100644 --- a/src/libcode/vx_nc_util/write_netcdf.h +++ b/src/libcode/vx_nc_util/write_netcdf.h @@ -14,7 +14,6 @@ //////////////////////////////////////////////////////////////////////// #include -using namespace netCDF; #include "vx_grid.h" #include "vx_config.h" @@ -27,15 +26,15 @@ static const float FILL_VALUE = -9999.f; //////////////////////////////////////////////////////////////////////// -extern void write_netcdf_global (NcFile *, const char *, const char *, +extern void write_netcdf_global (netCDF::NcFile *, const char *, const char *, const char *model_name = (const char *) 0, const char *obtype = (const char *) 0, const char *desc = (const char *) 0); -extern void write_netcdf_proj (NcFile *, const Grid &, NcDim &, NcDim &); -extern void write_netcdf_latlon (NcFile *, NcDim *, NcDim *, const Grid &); -extern void write_netcdf_grid_weight(NcFile *, NcDim *, NcDim *, const GridWeightType, const DataPlane &); -extern void write_netcdf_var_times (NcVar *, const DataPlane &); -extern void write_netcdf_var_times (NcVar *, const unixtime, const unixtime, const int); +extern void write_netcdf_proj (netCDF::NcFile *, const Grid &, netCDF::NcDim &, netCDF::NcDim &); +extern void write_netcdf_latlon (netCDF::NcFile *, netCDF::NcDim *, netCDF::NcDim *, const Grid &); +extern void write_netcdf_grid_weight(netCDF::NcFile *, netCDF::NcDim *, netCDF::NcDim *, const GridWeightType, const DataPlane &); +extern void write_netcdf_var_times (netCDF::NcVar *, const DataPlane &); +extern void write_netcdf_var_times (netCDF::NcVar *, const unixtime, const unixtime, const int); diff --git a/src/libcode/vx_plot_util/map_region.h b/src/libcode/vx_plot_util/map_region.h index b228642231..94b6d36b6a 100644 --- a/src/libcode/vx_plot_util/map_region.h +++ b/src/libcode/vx_plot_util/map_region.h @@ -64,7 +64,7 @@ class MapRegion { //////////////////////////////////////////////////////////////////////// -extern bool operator>>(istream &, MapRegion &); +extern bool operator>>(std::istream &, MapRegion &); //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_pointdata_python/pointdata_python.cc b/src/libcode/vx_pointdata_python/pointdata_python.cc index a94ba3b714..ea44962a1c 100644 --- a/src/libcode/vx_pointdata_python/pointdata_python.cc +++ b/src/libcode/vx_pointdata_python/pointdata_python.cc @@ -95,7 +95,6 @@ void MetPythonPointDataFile::python_init_from_scratch() { PythonCommand.clear(); -//met_data.clear(); close(); @@ -123,20 +122,6 @@ return; } -//////////////////////////////////////////////////////////////////////// - -/* -void MetPythonPointDataFile::set_type(const GrdFileType t) - -{ - -Type = t; - -return; - -} -*/ - //////////////////////////////////////////////////////////////////////// @@ -216,23 +201,7 @@ void MetPythonPointDataFile::dump(ostream & out, int depth) const Indent prefix(depth); out << prefix << "File = "; -/* -if ( Filename.empty() ) out << "(nul)\n"; -else out << '\"' << Filename << "\"\n"; -if ( Raw_Grid ) { - - out << prefix << "Grid:\n"; - -// Raw_Grid->dump(out, depth + 1); - -} else { - - out << prefix << "No Grid!\n"; - -} -*/ - // // done // @@ -243,35 +212,6 @@ return; } -//////////////////////////////////////////////////////////////////////// -/* - -bool MetPythonPointDataFile::data_ok(int x, int y) const - -{ - -//const double value = get(x, y); - -//return ( !is_bad_data(value) ); -return true; - -} - - -//////////////////////////////////////////////////////////////////////// - - -void MetPythonPointDataFile::data_minmax(double & data_min, double & data_max) const - -{ - -//Plane.data_range(data_min, data_max); - -return; - -} -*/ - //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_pointdata_python/pointdata_python.h b/src/libcode/vx_pointdata_python/pointdata_python.h index b6d752ea3f..1a3c65f9b2 100644 --- a/src/libcode/vx_pointdata_python/pointdata_python.h +++ b/src/libcode/vx_pointdata_python/pointdata_python.h @@ -30,7 +30,6 @@ //////////////////////////////////////////////////////////////////////// -//class MetPythonPointDataFile : public Met2dDataFile { class MetPythonPointDataFile { private: @@ -44,10 +43,6 @@ class MetPythonPointDataFile { MetPointDataPython met_data; - //VarInfoPython VInfo; - - //GrdFileType Type; // FileType_Python_Xarray or FileType_Python_Numpy - public: MetPythonPointDataFile(); @@ -58,21 +53,11 @@ class MetPythonPointDataFile { // set stuff // - //void set_type(const GrdFileType); - // // get stuff // -// GrdFileType file_type() const; - -// double operator () (int x, int y) const; - - //double get (int x, int y) const; - -// bool data_ok (int x, int y) const; - -// void data_minmax (double & data_min, double & data_max) const; + bool is_using_var_id() const; // // do stuff @@ -85,21 +70,15 @@ class MetPythonPointDataFile { void dump (ostream &, int depth = 0) const; - //MetPointData get_met_point_data(); MetPointDataPython *get_met_point_data(); - //int data_plane_array(VarInfo &, DataPlaneArray &); - - //bool met_point_data(MetPointData &); - }; //////////////////////////////////////////////////////////////////////// -//inline double MetPythonPointDataFile::operator () (int x, int y) const { return ( get(x, y) ); } -//inline GrdFileType MetPythonPointDataFile::file_type () const { return ( Type ); } +inline bool MetPythonPointDataFile::is_using_var_id() const { return(met_data.is_using_var_id()); } //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_pointdata_python/python_pointdata.hpp b/src/libcode/vx_pointdata_python/python_pointdata.hpp index c4ade37053..c3b1db9d72 100644 --- a/src/libcode/vx_pointdata_python/python_pointdata.hpp +++ b/src/libcode/vx_pointdata_python/python_pointdata.hpp @@ -63,8 +63,8 @@ static void set_array_from_python(PyObject *python_data, const char *python_key, << "error getting the point data by the key (" << python_key << ") from python object\n\n"; exit (1); } - else mlog << Debug(3) << method_name - << "not exists the point data (" << python_key << ") from python object\n"; + else mlog << Debug(7) << method_name + << "point data for " << python_key << " does not exist from python object\n"; } } diff --git a/src/libcode/vx_ps/ps_text.h b/src/libcode/vx_ps/ps_text.h index 905fb11046..cf92607792 100644 --- a/src/libcode/vx_ps/ps_text.h +++ b/src/libcode/vx_ps/ps_text.h @@ -73,7 +73,7 @@ class VxpsTextNode { void clear(); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; void set_font_number(int); diff --git a/src/libcode/vx_ps/vx_ps.h b/src/libcode/vx_ps/vx_ps.h index 3cfeec731e..26ed654a26 100644 --- a/src/libcode/vx_ps/vx_ps.h +++ b/src/libcode/vx_ps/vx_ps.h @@ -126,7 +126,7 @@ class PSfile { DocumentOrientation Orientation; DocumentMedia Media; - ofstream * File; // the output file ... allocated + std::ofstream * File; // the output file ... allocated ConcatString OutputFilename; @@ -163,7 +163,7 @@ class PSfile { // get stuff // - // ofstream & file() const; + // std::ofstream & file() const; PSFilter & file() const; DocumentOrientation orientation () const; diff --git a/src/libcode/vx_pxm/pbm.h b/src/libcode/vx_pxm/pbm.h index e9bac50a97..330ed9afb1 100644 --- a/src/libcode/vx_pxm/pbm.h +++ b/src/libcode/vx_pxm/pbm.h @@ -81,7 +81,7 @@ class Pbm : public PxmBase { void all_white(); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; }; diff --git a/src/libcode/vx_pxm/pcm.h b/src/libcode/vx_pxm/pcm.h index ecddb54d57..960856a235 100644 --- a/src/libcode/vx_pxm/pcm.h +++ b/src/libcode/vx_pxm/pcm.h @@ -77,7 +77,7 @@ class Pcm : public PxmBase { void reverse_video(); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; void all_black(); // does nothing void all_white(); // does nothing diff --git a/src/libcode/vx_pxm/pgm.h b/src/libcode/vx_pxm/pgm.h index ece18d1f6e..c8bfdea763 100644 --- a/src/libcode/vx_pxm/pgm.h +++ b/src/libcode/vx_pxm/pgm.h @@ -76,7 +76,7 @@ class Pgm : public PxmBase { void all_white(); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; }; diff --git a/src/libcode/vx_pxm/ppm.h b/src/libcode/vx_pxm/ppm.h index 00eb09aa37..e5e3aa2334 100644 --- a/src/libcode/vx_pxm/ppm.h +++ b/src/libcode/vx_pxm/ppm.h @@ -75,7 +75,7 @@ class Ppm : public PxmBase { void all_white(); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; // // not from base class diff --git a/src/libcode/vx_pxm/pxm_base.h b/src/libcode/vx_pxm/pxm_base.h index 33abeb3726..b0d1b06189 100644 --- a/src/libcode/vx_pxm/pxm_base.h +++ b/src/libcode/vx_pxm/pxm_base.h @@ -101,7 +101,7 @@ class PxmBase { virtual void all_white() = 0; - virtual void dump (ostream &, int depth = 0) const = 0; + virtual void dump (std::ostream &, int depth = 0) const = 0; // // non-abstract member functions diff --git a/src/libcode/vx_render/psout_filter.h b/src/libcode/vx_render/psout_filter.h index 00032e430f..6753182dfc 100644 --- a/src/libcode/vx_render/psout_filter.h +++ b/src/libcode/vx_render/psout_filter.h @@ -31,9 +31,9 @@ class PSOutputFilter : public PSFilter { PSOutputFilter(); ~PSOutputFilter(); - PSOutputFilter(ofstream &); + PSOutputFilter(std::ofstream &); - ofstream *file; + std::ofstream *file; bool ignore_columns; // default: false @@ -44,7 +44,7 @@ class PSOutputFilter : public PSFilter { virtual void eod(); - void attach(ofstream *); + void attach(std::ofstream *); void detach(); }; diff --git a/src/libcode/vx_seeps/seeps.cc b/src/libcode/vx_seeps/seeps.cc index fa8ce18715..b0367af7b2 100644 --- a/src/libcode/vx_seeps/seeps.cc +++ b/src/libcode/vx_seeps/seeps.cc @@ -13,6 +13,9 @@ using namespace std; #include #include +#include +using namespace netCDF; + #include "file_exists.h" #include "string_fxns.h" @@ -121,11 +124,11 @@ SeepsClimoRecord *SeepsClimo::create_climo_record( //////////////////////////////////////////////////////////////////////// SeepsRecord *SeepsClimo::get_record(int sid, int month, int hour) { - SeepsRecord *record = 0; + SeepsRecord *record = NULL; const char *method_name = "SeepsClimo::get_record() -> "; if (seeps_ready) { - SeepsClimoRecord *climo_record = 0; + SeepsClimoRecord *climo_record = NULL; map::iterator it; if (hour < 6 || hour >= 18) { it = seeps_score_00_map.find(sid); @@ -199,12 +202,13 @@ float SeepsClimo::get_score(int sid, float p_fcst, float p_obs, float score = (float)bad_data_double; SeepsRecord *record = get_record(sid, month, hour); - if (record) { + if (NULL != record) { // Determine location in contingency table int ic = (p_obs>record->t1)+(p_obs>record->t2); int jc = (p_fcst>record->t1)+(p_fcst>record->t2); score = record->scores[(jc*3)+ic]; + delete record; } return score; @@ -214,10 +218,10 @@ float SeepsClimo::get_score(int sid, float p_fcst, float p_obs, SeepsScore *SeepsClimo::get_seeps_score(int sid, float p_fcst, float p_obs, int month, int hour) { - SeepsScore *score = 0; + SeepsScore *score = NULL; SeepsRecord *record = get_record(sid, month, hour); - if (record) { + if (NULL != record) { score = new SeepsScore(); score->p1 = record->p1; score->p2 = record->p1; @@ -227,6 +231,7 @@ SeepsScore *SeepsClimo::get_seeps_score(int sid, float p_fcst, score->obs_cat = (p_obs>record->t1)+(p_obs>record->t2); score->model_cat = (p_fcst>record->t1)+(p_fcst>record->t2); score->score = record->scores[(score->model_cat*3)+score->obs_cat]; + delete record; } return score; diff --git a/src/libcode/vx_seeps/seeps.h b/src/libcode/vx_seeps/seeps.h index ad6d52691a..6fd08ca12e 100644 --- a/src/libcode/vx_seeps/seeps.h +++ b/src/libcode/vx_seeps/seeps.h @@ -118,8 +118,8 @@ class SeepsClimo { bool seeps_ready; int nstn; - map seeps_score_00_map; - map seeps_score_12_map; + std::map seeps_score_00_map; + std::map seeps_score_12_map; SeepsClimoRecord *create_climo_record(int sid, float lat, float lon, float elv, float *p1, float *p2, float *t1, float *t2, diff --git a/src/libcode/vx_series_data/series_pdf.cc b/src/libcode/vx_series_data/series_pdf.cc index 446466ae22..95e0c598a2 100644 --- a/src/libcode/vx_series_data/series_pdf.cc +++ b/src/libcode/vx_series_data/series_pdf.cc @@ -8,6 +8,8 @@ //////////////////////////////////////////////////////////////////////// +using namespace std; + #include #include #include @@ -16,6 +18,9 @@ #include #include +#include +using namespace netCDF; + #include "series_pdf.h" //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_series_data/series_pdf.h b/src/libcode/vx_series_data/series_pdf.h index 3d178ad7b1..96c629c8d4 100644 --- a/src/libcode/vx_series_data/series_pdf.h +++ b/src/libcode/vx_series_data/series_pdf.h @@ -15,10 +15,8 @@ #include #include -using namespace std; #include -using namespace netCDF; #include "vx_util.h" #include "vx_log.h" @@ -30,7 +28,7 @@ using namespace netCDF; void init_pdf( int n, - vector& pdf); + std::vector& pdf); //////////////////////////////////////////////////////////////////////// @@ -38,21 +36,21 @@ void init_pdf( double min, double max, double delta, - vector& pdf); + std::vector& pdf); //////////////////////////////////////////////////////////////////////// void init_joint_pdf( int n_A, int n_B, - vector& pdf); + std::vector& pdf); //////////////////////////////////////////////////////////////////////// void update_pdf( double min, double delta, - vector& pdf, + std::vector& pdf, const DataPlane&, const MaskPlane&); @@ -65,7 +63,7 @@ void update_joint_pdf( double min_B, double delta_A, double delta_B, - vector& pdf, + std::vector& pdf, const DataPlane&, const DataPlane&, const MaskPlane&); @@ -75,16 +73,16 @@ void update_joint_pdf( void print_pdf( double min, double delta, - const vector& pdf); + const std::vector& pdf); //////////////////////////////////////////////////////////////////////// void write_nc_pdf( - NcFile* nc_out, + netCDF::NcFile* nc_out, const VarInfo& info, double min, double delta, - const vector& pdf); + const std::vector& pdf); //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_shapedata/interest.h b/src/libcode/vx_shapedata/interest.h index 3bed46f2b5..2afe66661b 100644 --- a/src/libcode/vx_shapedata/interest.h +++ b/src/libcode/vx_shapedata/interest.h @@ -85,7 +85,7 @@ class SingleFeature { //////////////////////////////////////////////////////////////////////// -extern ostream & operator<<(ostream &, const SingleFeature &); +extern std::ostream & operator<<(std::ostream &, const SingleFeature &); //////////////////////////////////////////////////////////////////////// @@ -134,7 +134,7 @@ class PairFeature { //////////////////////////////////////////////////////////////////////// -extern ostream & operator<<(ostream &, const PairFeature &); +extern std::ostream & operator<<(std::ostream &, const PairFeature &); //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_shapedata/mode_columns.h b/src/libcode/vx_shapedata/mode_columns.h index b37a057b5e..d8528bc361 100644 --- a/src/libcode/vx_shapedata/mode_columns.h +++ b/src/libcode/vx_shapedata/mode_columns.h @@ -13,7 +13,7 @@ //////////////////////////////////////////////////////////////////////// -static const string mode_hdr_columns [] = { +static const std::string mode_hdr_columns [] = { "VERSION", // 1 "MODEL", // 2 @@ -43,7 +43,7 @@ static const string mode_hdr_columns [] = { }; -static const string mode_obj_columns [] = { +static const std::string mode_obj_columns [] = { "OBJECT_ID", // 23 "OBJECT_CAT", // 24 diff --git a/src/libcode/vx_shapedata/mode_field_info.h b/src/libcode/vx_shapedata/mode_field_info.h index 2a4f298fbe..08ef22e072 100644 --- a/src/libcode/vx_shapedata/mode_field_info.h +++ b/src/libcode/vx_shapedata/mode_field_info.h @@ -28,7 +28,7 @@ //////////////////////////////////////////////////////////////////////// -typedef map AttrFilterMap; +typedef std::map AttrFilterMap; //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_shapedata/set.h b/src/libcode/vx_shapedata/set.h index 5aa0fecb12..c110e77dc1 100644 --- a/src/libcode/vx_shapedata/set.h +++ b/src/libcode/vx_shapedata/set.h @@ -16,6 +16,7 @@ // Mod# Date Name Description // ---- ---- ---- ----------- // 000 04-15-05 Halley Gotway +// 001 10-03-22 Prestopnik MET #2227 Remove using namespace std from header files // /////////////////////////////////////////////////////////////////////////////// @@ -89,7 +90,7 @@ extern FcstObsSet union_fcst_obs_sets(const FcstObsSet &, const FcstObsSet &); extern int fcst_obs_sets_overlap(const FcstObsSet &, const FcstObsSet &); -extern ostream & operator<<(ostream &, const FcstObsSet &); +extern std::ostream & operator<<(std::ostream &, const FcstObsSet &); /////////////////////////////////////////////////////////////////////////////// @@ -159,7 +160,7 @@ class SetCollection { /////////////////////////////////////////////////////////////////////////////// -extern ostream & operator<<(ostream &, const SetCollection &); +extern std::ostream & operator<<(std::ostream &, const SetCollection &); inline void SetCollection::make_room(const int __n) { if ( __n > 0 ) extend(n_sets + __n); return; } diff --git a/src/libcode/vx_shapedata/shape.h b/src/libcode/vx_shapedata/shape.h index 7e6813c350..288106d197 100644 --- a/src/libcode/vx_shapedata/shape.h +++ b/src/libcode/vx_shapedata/shape.h @@ -17,6 +17,7 @@ // Mod# Date Name Description // ---- ---- ---- ----------- // 000 11-03-06 Halley Gotway New +// 001 22-09-28 Prestopnik MET #2227 Remove namespace std from header files // //////////////////////////////////////////////////////////////////////// @@ -25,8 +26,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include "moments.h" //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_shapedata/shapedata.h b/src/libcode/vx_shapedata/shapedata.h index f4bd1e0332..1ba59f5fa3 100644 --- a/src/libcode/vx_shapedata/shapedata.h +++ b/src/libcode/vx_shapedata/shapedata.h @@ -16,6 +16,7 @@ // Mod# Date Name Description // ---- ---- ---- ----------- // 000 11-05-31 Halley Gotway Adapated from wrfdata.h. +// 001 22-09-28 Prestopnik MET #2227 Remove namespace std from header files // /////////////////////////////////////////////////////////////////////////////// @@ -24,10 +25,6 @@ /////////////////////////////////////////////////////////////////////////////// -using namespace std; - -/////////////////////////////////////////////////////////////////////////////// - #include #include "moments.h" @@ -166,7 +163,7 @@ class ShapeData { void threshold(double t); void threshold(SingleThresh); - void threshold_attr(const map&, + void threshold_attr(const std::map&, const ShapeData *, const SingleThresh &, const Grid *, @@ -253,7 +250,7 @@ class Cell { /////////////////////////////////////////////////////////////////////////////// -extern ostream & operator<<(ostream &, const Cell &); +extern std::ostream & operator<<(std::ostream &, const Cell &); /////////////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_statistics/contable.h b/src/libcode/vx_statistics/contable.h index 28689fa58a..ded7cf3d84 100644 --- a/src/libcode/vx_statistics/contable.h +++ b/src/libcode/vx_statistics/contable.h @@ -48,7 +48,7 @@ class ContingencyTable { int rc_to_n(int r, int c) const; - vector *E; // this is really a two-dimensional array + std::vector *E; // this is really a two-dimensional array int Nrows; int Ncols; @@ -69,7 +69,7 @@ class ContingencyTable { void zero_out(); - virtual void dump(ostream & out, int depth = 0) const; + virtual void dump(std::ostream & out, int depth = 0) const; // // condition on an event diff --git a/src/libcode/vx_statistics/obs_error.h b/src/libcode/vx_statistics/obs_error.h index 27bb488ffb..3abeb3fd5f 100644 --- a/src/libcode/vx_statistics/obs_error.h +++ b/src/libcode/vx_statistics/obs_error.h @@ -34,7 +34,7 @@ class ObsErrorEntry { void clear(); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; // Line number of the table int line_number; @@ -111,7 +111,7 @@ class ObsErrorTable { void clear(); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; // // set stuff diff --git a/src/libcode/vx_statistics/pair_base.h b/src/libcode/vx_statistics/pair_base.h index 984bfa690d..9acee06bcc 100644 --- a/src/libcode/vx_statistics/pair_base.h +++ b/src/libcode/vx_statistics/pair_base.h @@ -22,11 +22,11 @@ struct ob_val_t { unixtime ut; double val; - string qc; + std::string qc; }; struct station_values_t { - string sid; + std::string sid; double lat; double lon; double x; @@ -38,7 +38,7 @@ struct station_values_t { double cmn; double csd; double summary_val; - vector obs; + std::vector obs; }; //////////////////////////////////////////////////////////////////////// @@ -112,7 +112,7 @@ class PairBase { int obs_perc_value; // Percentile value for ObsSummary_Perc StringArray map_key; - map map_val; // Storage for single obs values + std::map map_val; // Storage for single obs values ////////////////////////////////////////////////////////////////// @@ -146,13 +146,13 @@ class PairBase { int has_obs_rec(const char *, double, double, double, double, double, double, int &); - ob_val_t compute_nearest(string sng_key); - ob_val_t compute_min(string sng_key); - ob_val_t compute_max(string sng_key); - ob_val_t compute_uw_mean(string sng_key); - ob_val_t compute_dw_mean(string sng_key); - ob_val_t compute_median(string sng_key); - ob_val_t compute_percentile(string sng_key, int perc); + ob_val_t compute_nearest(std::string sng_key); + ob_val_t compute_min(std::string sng_key); + ob_val_t compute_max(std::string sng_key); + ob_val_t compute_uw_mean(std::string sng_key); + ob_val_t compute_dw_mean(std::string sng_key); + ob_val_t compute_median(std::string sng_key); + ob_val_t compute_percentile(std::string sng_key, int perc); bool add_point_obs(const char *, double, double, double, double, unixtime, double, double, double, const char *, diff --git a/src/libcode/vx_statistics/pair_data_ensemble.h b/src/libcode/vx_statistics/pair_data_ensemble.h index ce4210c0a6..17501d867a 100644 --- a/src/libcode/vx_statistics/pair_data_ensemble.h +++ b/src/libcode/vx_statistics/pair_data_ensemble.h @@ -24,7 +24,6 @@ #include "vx_data2d_grib.h" #include "vx_gsl_prob.h" -using namespace std; //////////////////////////////////////////////////////////////////////// @@ -40,10 +39,10 @@ struct ens_ssvar_pt { double w; }; -typedef deque ssvar_pt_list; -typedef map ssvar_bin_map; // Indexed by bin min -typedef CRC_Array BoolArray; -typedef CRC_Array ObsErrorEntryPtrArray; +typedef std::deque ssvar_pt_list; +typedef std::map ssvar_bin_map; // Indexed by bin min +typedef CRC_Array BoolArray; +typedef CRC_Array ObsErrorEntryPtrArray; // Number of SSVAR bins to produce a warning static const int n_warn_ssvar_bins = 1000; diff --git a/src/libcode/vx_summary/summary_calc.h b/src/libcode/vx_summary/summary_calc.h index ce40206295..6948e5e87e 100644 --- a/src/libcode/vx_summary/summary_calc.h +++ b/src/libcode/vx_summary/summary_calc.h @@ -31,7 +31,7 @@ class SummaryCalc SummaryCalc(); virtual ~SummaryCalc(); - virtual string getType() const = 0; + virtual std::string getType() const = 0; virtual double calcSummary(const NumArray &num_array) const = 0; }; diff --git a/src/libcode/vx_summary/summary_obs.h b/src/libcode/vx_summary/summary_obs.h index 284b67b388..3cba669b41 100644 --- a/src/libcode/vx_summary/summary_obs.h +++ b/src/libcode/vx_summary/summary_obs.h @@ -34,21 +34,21 @@ class SummaryObs bool summarizeObs(const TimeSummaryInfo &summary_info); bool addObservationObj(const Observation &obs); - bool addObservation(const string &header_type, const string &station_id, + bool addObservation(const std::string &header_type, const std::string &station_id, const time_t valid_time, const double latitude, const double longitude, const double elevation, - const string &quality_flag, + const std::string &quality_flag, const int var_code, const double pressure_level_hpa, const double height_m, const double value, - const string &var_name = ""); - vector< Observation > getObservations(); - vector< Observation > getSummaries(); + const std::string &var_name = ""); + std::vector< Observation > getObservations(); + std::vector< Observation > getSummaries(); long countHeaders(); - long countHeaders(vector< Observation > *obs_vector); - long countHeaders(vector< Observation > &obs_vector); + long countHeaders(std::vector< Observation > *obs_vector); + long countHeaders(std::vector< Observation > &obs_vector); long countSummaryHeaders(); - time_t getValidTime(const string &time_string) const; + time_t getValidTime(const std::string &time_string) const; TimeSummaryInfo getSummaryInfo(); void setSummaryInfo(const TimeSummaryInfo &summary_info); StringArray getObsNames(); @@ -67,8 +67,8 @@ class SummaryObs TimeSummaryInfo summaryInfo; // List of observations read - vector< Observation > observations; - vector< Observation > summaries; + std::vector< Observation > observations; + std::vector< Observation > summaries; StringArray obs_names; /////////////////////// @@ -84,12 +84,12 @@ class SummaryObs // Use the configuration information to generate the list of summary // calculators needed. - vector< SummaryCalc* > getSummaryCalculators(const TimeSummaryInfo &info) const; + std::vector< SummaryCalc* > getSummaryCalculators(const TimeSummaryInfo &info) const; // Use the configuration file time summary information to figure out the // time intervals for our summaries - vector< TimeSummaryInterval > getTimeIntervals(const time_t first_data_time, + std::vector< TimeSummaryInterval > getTimeIntervals(const time_t first_data_time, const time_t last_data_time, const TimeSummaryInfo &info) const; @@ -104,8 +104,8 @@ class SummaryObs // Generate the summary header type string for the netCDF file - string getSummaryHeaderType(const string &header_type, - const string &summary_type, + std::string getSummaryHeaderType(const std::string &header_type, + const std::string &summary_type, const int summary_width_secs) const; public: @@ -123,7 +123,7 @@ class SummaryObs // Convert the number of seconds from the beginning of the day to a string - static string secsToTimeString(const int secs) + static std::string secsToTimeString(const int secs) { // Get the different fields from the number of seconds @@ -140,7 +140,7 @@ class SummaryObs snprintf(string_buffer, sizeof(string_buffer), "%02d%02d%02d", hour, minute, second); - return string(string_buffer); + return std::string(string_buffer); } // Get the first possible interval time after 0:00Z @@ -219,7 +219,7 @@ class SummaryObs return timegm(time_struct); } - static string _timeToString(const time_t unix_time) + static std::string _timeToString(const time_t unix_time) { struct tm *time_struct = gmtime(&unix_time); @@ -234,7 +234,7 @@ class SummaryObs return time_string; } - static time_t _stringToTime(const string &time_string) + static time_t _stringToTime(const std::string &time_string) { struct tm time_struct; memset(&time_struct, 0, sizeof(time_struct)); @@ -251,8 +251,8 @@ class SummaryObs }; -inline vector< Observation > SummaryObs::getObservations() { return observations; } -inline vector< Observation > SummaryObs::getSummaries() { return summaries; } +inline std::vector< Observation > SummaryObs::getObservations() { return observations; } +inline std::vector< Observation > SummaryObs::getSummaries() { return summaries; } inline StringArray SummaryObs::getObsNames() { return obs_names; } inline void SummaryObs::setSummaryInfo(const TimeSummaryInfo &summary_info) { summaryInfo = summary_info;}; inline TimeSummaryInfo SummaryObs::getSummaryInfo() { return summaryInfo;}; diff --git a/src/libcode/vx_tc_util/atcf_line_base.h b/src/libcode/vx_tc_util/atcf_line_base.h index 000b267d04..45b93e8529 100644 --- a/src/libcode/vx_tc_util/atcf_line_base.h +++ b/src/libcode/vx_tc_util/atcf_line_base.h @@ -62,10 +62,10 @@ class ATCFLineBase : public DataLine { void assign(const ATCFLineBase &); - const map * BasinMap; // not allocated - const StringArray * BestTechnique; // not allocated - const StringArray * OperTechnique; // not allocated - const ConcatString * TechSuffix; // not allocated + const std::map * BasinMap; // not allocated + const StringArray * BestTechnique; // not allocated + const StringArray * OperTechnique; // not allocated + const ConcatString * TechSuffix; // not allocated ATCFLineType Type; ConcatString Basin; @@ -81,7 +81,7 @@ class ATCFLineBase : public DataLine { ATCFLineBase & operator= (const ATCFLineBase &); bool operator==(const ATCFLineBase &); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; void clear(); @@ -93,7 +93,7 @@ class ATCFLineBase : public DataLine { // set values // - void set_basin_map (const map *); + void set_basin_map (const std::map *); void set_best_technique(const StringArray *); void set_oper_technique(const StringArray *); void set_tech_suffix (const ConcatString *); @@ -130,7 +130,7 @@ class ATCFLineBase : public DataLine { //////////////////////////////////////////////////////////////////////// -inline void ATCFLineBase::set_basin_map (const map *m) +inline void ATCFLineBase::set_basin_map (const std::map *m) { BasinMap = m; } inline void ATCFLineBase::set_best_technique(const StringArray *s) { BestTechnique = s; } inline void ATCFLineBase::set_oper_technique(const StringArray *s) { OperTechnique = s; } diff --git a/src/libcode/vx_tc_util/atcf_prob_line.h b/src/libcode/vx_tc_util/atcf_prob_line.h index 9dcb426b5b..40f869ef4d 100644 --- a/src/libcode/vx_tc_util/atcf_prob_line.h +++ b/src/libcode/vx_tc_util/atcf_prob_line.h @@ -45,7 +45,7 @@ class ATCFProbLine : public ATCFLineBase { ATCFProbLine(const ATCFProbLine &); ATCFProbLine & operator= (const ATCFProbLine &); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; void clear(); diff --git a/src/libcode/vx_tc_util/atcf_track_line.h b/src/libcode/vx_tc_util/atcf_track_line.h index 1e93f4e6c6..8f46f73b3c 100644 --- a/src/libcode/vx_tc_util/atcf_track_line.h +++ b/src/libcode/vx_tc_util/atcf_track_line.h @@ -146,7 +146,7 @@ class ATCFTrackLine : public ATCFLineBase { ATCFTrackLine(const ATCFTrackLine &); ATCFTrackLine & operator= (const ATCFTrackLine &); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; int read_line(LineDataFile *); diff --git a/src/libcode/vx_tc_util/gen_shape_info.h b/src/libcode/vx_tc_util/gen_shape_info.h index 98a49e1973..f783e22019 100644 --- a/src/libcode/vx_tc_util/gen_shape_info.h +++ b/src/libcode/vx_tc_util/gen_shape_info.h @@ -110,7 +110,7 @@ class GenShapeInfoArray { void init_from_scratch(); void assign(const GenShapeInfoArray &); - vector GenShape; + std::vector GenShape; public: diff --git a/src/libcode/vx_tc_util/genesis_info.h b/src/libcode/vx_tc_util/genesis_info.h index 36e36b0d18..1a22a9ec1a 100644 --- a/src/libcode/vx_tc_util/genesis_info.h +++ b/src/libcode/vx_tc_util/genesis_info.h @@ -31,7 +31,7 @@ struct GenesisEventInfo { ConcatString Technique; - vector Category; + std::vector Category; SingleThresh VMaxThresh; SingleThresh MSLPThresh; @@ -72,7 +72,7 @@ class GenesisInfo : public TrackInfo { bool is_storm(const GenesisInfo &) const; void clear(); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; ConcatString serialize() const; ConcatString serialize_r(int, int = 0) const; @@ -130,7 +130,7 @@ class GenesisInfoArray { void init_from_scratch(); void assign(const GenesisInfoArray &); - vector Genesis; + std::vector Genesis; public: @@ -140,7 +140,7 @@ class GenesisInfoArray { GenesisInfoArray & operator=(const GenesisInfoArray &); void clear(); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; ConcatString serialize() const; ConcatString serialize_r(int = 0) const; diff --git a/src/libcode/vx_tc_util/pair_data_genesis.h b/src/libcode/vx_tc_util/pair_data_genesis.h index 1725273751..2d0e0e1d1b 100644 --- a/src/libcode/vx_tc_util/pair_data_genesis.h +++ b/src/libcode/vx_tc_util/pair_data_genesis.h @@ -81,13 +81,13 @@ class PairDataGenesis { TimeArray InitTime; IntArray LeadTime; - vector FcstGen; - vector BestGen; - vector GenDiff; + std::vector FcstGen; + std::vector BestGen; + std::vector GenDiff; ////////////////////////////////////////////////////////////////// - bool has_gen (const vector&, + bool has_gen (const std::vector&, const GenesisInfo *, int &) const; bool has_case(const ConcatString &, const unixtime, int &) const; diff --git a/src/libcode/vx_tc_util/prob_gen_info.h b/src/libcode/vx_tc_util/prob_gen_info.h index 0fa15defc8..af86991a91 100644 --- a/src/libcode/vx_tc_util/prob_gen_info.h +++ b/src/libcode/vx_tc_util/prob_gen_info.h @@ -48,7 +48,7 @@ class ProbGenInfo : public ProbInfoBase { void clear(); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; ConcatString serialize() const; ConcatString serialize_r(int, int = 0) const; diff --git a/src/libcode/vx_tc_util/prob_info_array.h b/src/libcode/vx_tc_util/prob_info_array.h index e0ea6230e9..cd2e8125f7 100644 --- a/src/libcode/vx_tc_util/prob_info_array.h +++ b/src/libcode/vx_tc_util/prob_info_array.h @@ -36,8 +36,8 @@ class ProbInfoArray { void init_from_scratch(); void assign(const ProbInfoArray &); - vector ProbRIRW; - vector ProbGen; + std::vector ProbRIRW; + std::vector ProbGen; public: @@ -48,7 +48,7 @@ class ProbInfoArray { void clear(); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; ConcatString serialize() const; ConcatString serialize_r(int = 0) const; diff --git a/src/libcode/vx_tc_util/prob_info_base.h b/src/libcode/vx_tc_util/prob_info_base.h index 015563e9e5..4622ad922a 100644 --- a/src/libcode/vx_tc_util/prob_info_base.h +++ b/src/libcode/vx_tc_util/prob_info_base.h @@ -69,7 +69,7 @@ class ProbInfoBase { void clear(); - virtual void dump(ostream &, int = 0) const; + virtual void dump(std::ostream &, int = 0) const; virtual ConcatString serialize() const; virtual ConcatString serialize_r(int, int = 0) const; diff --git a/src/libcode/vx_tc_util/prob_rirw_info.h b/src/libcode/vx_tc_util/prob_rirw_info.h index b1034eb00a..ba18fd5b9f 100644 --- a/src/libcode/vx_tc_util/prob_rirw_info.h +++ b/src/libcode/vx_tc_util/prob_rirw_info.h @@ -47,7 +47,7 @@ class ProbRIRWInfo : public ProbInfoBase { void clear(); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; ConcatString serialize() const; ConcatString serialize_r(int, int = 0) const; diff --git a/src/libcode/vx_tc_util/prob_rirw_pair_info.h b/src/libcode/vx_tc_util/prob_rirw_pair_info.h index 977c07c67c..b76a14a756 100644 --- a/src/libcode/vx_tc_util/prob_rirw_pair_info.h +++ b/src/libcode/vx_tc_util/prob_rirw_pair_info.h @@ -69,7 +69,7 @@ class ProbRIRWPairInfo { void clear(); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; ConcatString case_info() const; ConcatString serialize() const; ConcatString serialize_r(int, int = 0) const; @@ -146,7 +146,7 @@ class ProbRIRWPairInfoArray { void init_from_scratch(); void assign(const ProbRIRWPairInfoArray &); - vector Pairs; + std::vector Pairs; public: @@ -157,7 +157,7 @@ class ProbRIRWPairInfoArray { void clear(); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; ConcatString serialize() const; ConcatString serialize_r(int = 0) const; diff --git a/src/libcode/vx_tc_util/tc_columns.cc b/src/libcode/vx_tc_util/tc_columns.cc index 1c71d754ff..ec73a544d9 100644 --- a/src/libcode/vx_tc_util/tc_columns.cc +++ b/src/libcode/vx_tc_util/tc_columns.cc @@ -298,6 +298,12 @@ void write_tc_mpr_cols(const TrackPairInfo &p, int i, at.set_entry(r, c++, systemsdepth_to_string(p.adeck()[i].depth())); at.set_entry(r, c++, systemsdepth_to_string(p.bdeck()[i].depth())); + at.set_entry(r, c++, p.adeck()[i].num_members()); + at.set_entry(r, c++, p.adeck()[i].spread()); + at.set_entry(r, c++, p.adeck()[i].dist_mean()); + at.set_entry(r, c++, p.adeck()[i].mslp_stdev()); + at.set_entry(r, c++, p.adeck()[i].v_max_stdev()); + return; } diff --git a/src/libcode/vx_tc_util/tc_columns.h b/src/libcode/vx_tc_util/tc_columns.h index 5241d92997..e8064e4a24 100644 --- a/src/libcode/vx_tc_util/tc_columns.h +++ b/src/libcode/vx_tc_util/tc_columns.h @@ -68,7 +68,12 @@ static const char * tc_mpr_cols [] = { "AEYE", "BEYE", "ADIR", "BDIR", "ASPEED", "BSPEED", - "ADEPTH", "BDEPTH" + "ADEPTH", "BDEPTH", + "NUM_MEMBERS", + "TRACK_SPREAD", + "DIST_MEAN", + "MSLP_SPREAD", + "MAX_WIND_SPREAD" }; static const int n_tc_mpr_cols = sizeof(tc_mpr_cols)/sizeof(*tc_mpr_cols); @@ -136,8 +141,8 @@ inline int get_n_prob_rirw_cols (int n) { return(n_prob_rirw_cols + (2*n)); } // //////////////////////////////////////////////////////////////////////// -extern void open_tc_txt_file (ofstream *&, const char *); -extern void close_tc_txt_file(ofstream *&, const char *); +extern void open_tc_txt_file (std::ofstream *&, const char *); +extern void close_tc_txt_file(std::ofstream *&, const char *); //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_tc_util/track_info.cc b/src/libcode/vx_tc_util/track_info.cc index 4a4c34900c..479d0ae6f1 100644 --- a/src/libcode/vx_tc_util/track_info.cc +++ b/src/libcode/vx_tc_util/track_info.cc @@ -18,7 +18,6 @@ using namespace std; #include #include "math_constants.h" - #include "track_info.h" //////////////////////////////////////////////////////////////////////// @@ -862,9 +861,10 @@ TrackInfo consensus(const TrackInfoArray &tracks, int pcnt; TrackPoint pavg, psum; QuadInfo wavg; - NumArray plon; + NumArray plon, plat, pvmax, pmslp; double lon_range, lon_shift, lon_avg; - + double track_spread, vmax_stdev, mslp_stdev; + // Check for at least one track if(tracks.n() == 0) { mlog << Error @@ -926,6 +926,9 @@ TrackInfo consensus(const TrackInfoArray &tracks, pavg.clear(); psum.clear(); plon.clear(); + plat.clear(); + pvmax.clear(); + pmslp.clear(); pcnt = 0; // Loop through the tracks and get an average TrackPoint @@ -948,8 +951,11 @@ TrackInfo consensus(const TrackInfoArray &tracks, if(pcnt == 1) psum = tracks.Track[j][i_pnt]; else psum += tracks.Track[j][i_pnt]; - // Store the longitude values + // Store the track point latitude, longitude v_max and mslp values plon.add(tracks.Track[j][i_pnt].lon()); + plat.add(tracks.Track[j][i_pnt].lat()); + pvmax.add(tracks.Track[j][i_pnt].v_max()); + pmslp.add(tracks.Track[j][i_pnt].mslp()); } // Check for missing required member and the minimum number of points @@ -981,6 +987,29 @@ TrackInfo consensus(const TrackInfoArray &tracks, if(!is_bad_data(pavg.lat())) pavg.set_lat(psum.lat()/pcnt); if(!is_bad_data(pavg.lon())) pavg.set_lon(rescale_deg(lon_avg, -180.0, 180.0)); + // Save the number of members that went into the consensus + if(pcnt > 0) pavg.set_num_members(pcnt); + + // Compute track spread and distance mean, convert to nautical-miles + double track_spread, dist_mean; + compute_gc_dist_stdev(pavg.lat(), pavg.lon(), plat, plon, track_spread, dist_mean); + + if(!is_bad_data(track_spread)) { + track_spread *= tc_nautical_miles_per_km; + pavg.set_spread(track_spread); + } + + if(!is_bad_data(dist_mean)) { + dist_mean *= tc_nautical_miles_per_km; + pavg.set_dist_mean(dist_mean); + } + + // Compute wind-speed (v_max) and pressure (mslp) standard deviation + vmax_stdev = pvmax.stdev(); + mslp_stdev = pmslp.stdev(); + if(!is_bad_data(vmax_stdev)) pavg.set_v_max_stdev(vmax_stdev); + if(!is_bad_data(mslp_stdev)) pavg.set_mslp_stdev(mslp_stdev); + // Compute the average winds for(j=0; j Track; + std::vector Track; public: @@ -217,7 +218,7 @@ class TrackInfoArray { void clear(); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; ConcatString serialize() const; ConcatString serialize_r(int = 0) const; @@ -247,6 +248,9 @@ inline int TrackInfoArray::n() const { return(Track.size()); } //////////////////////////////////////////////////////////////////////// extern TrackInfo consensus(const TrackInfoArray &, const ConcatString &, int, const StringArray &); +extern void compute_gc_dist_stdev(const double lat, const double lon, + const NumArray &lats, const NumArray &lons, + double &spread, double &mean); extern bool has_storm_id(const StringArray &, const ConcatString &basin, const ConcatString &cyclone, unixtime init); extern void latlon_to_xytk_err(double alat, double alon, diff --git a/src/libcode/vx_tc_util/track_pair_info.cc b/src/libcode/vx_tc_util/track_pair_info.cc index bc013b6821..01a792818a 100644 --- a/src/libcode/vx_tc_util/track_pair_info.cc +++ b/src/libcode/vx_tc_util/track_pair_info.cc @@ -433,6 +433,13 @@ void TrackPairInfo::add(const TCStatLine &l) { } // end for j } // end for i + // Set the consensus track variables + apoint.set_num_members(atoi(l.get_item("NUM_MEMBERS"))); + apoint.set_spread(atof(l.get_item("TRACK_SPREAD"))); + apoint.set_dist_mean(atof(l.get_item("DIST_MEAN"))); + apoint.set_v_max_stdev(atof(l.get_item("MAX_WIND_SPREAD"))); + apoint.set_mslp_stdev(atof(l.get_item("MSLP_SPREAD"))); + // Add the TrackPoints to the ADECK/BDECK tracks ADeck.add(apoint); BDeck.add(bpoint); diff --git a/src/libcode/vx_tc_util/track_pair_info.h b/src/libcode/vx_tc_util/track_pair_info.h index 6afa9b6437..b4e92739ab 100644 --- a/src/libcode/vx_tc_util/track_pair_info.h +++ b/src/libcode/vx_tc_util/track_pair_info.h @@ -87,7 +87,7 @@ class TrackPairInfo { void clear(); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; ConcatString case_info() const; ConcatString serialize() const; ConcatString serialize_r(int, int = 0) const; @@ -193,7 +193,7 @@ class TrackPairInfoArray { void clear(); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; ConcatString serialize() const; ConcatString serialize_r(int = 0) const; diff --git a/src/libcode/vx_tc_util/track_point.cc b/src/libcode/vx_tc_util/track_point.cc index 1d0004a5b4..9937034156 100644 --- a/src/libcode/vx_tc_util/track_point.cc +++ b/src/libcode/vx_tc_util/track_point.cc @@ -383,7 +383,15 @@ TrackPoint & TrackPoint::operator+=(const TrackPoint &p) { else Eye += p.eye(); if(is_bad_data(Speed) || is_bad_data(p.speed())) Speed = bad_data_double; else Speed += p.speed(); - + + // Set consensus (spread) variables to missing + NumMembers = bad_data_int; + Spread = bad_data_double; + DistMean = bad_data_double; + VmaxStdev = bad_data_double; + MSLPStdev = bad_data_double; + + // Increment wind quadrants for(i=0; i get_pressure_level_indices( map pressure_level_indices; map indices_from_levels - = get_pressure_level_indices(pressure_levels); + = get_pressure_level_indices(pressure_levels); for (set::iterator i = pressure_level_strings.begin(); i != pressure_level_strings.end(); ++i) { diff --git a/src/libcode/vx_tc_util/vx_tc_nc_util.h b/src/libcode/vx_tc_util/vx_tc_nc_util.h index 8f4bae8387..e90a34fb5c 100644 --- a/src/libcode/vx_tc_util/vx_tc_nc_util.h +++ b/src/libcode/vx_tc_util/vx_tc_nc_util.h @@ -14,7 +14,6 @@ //////////////////////////////////////////////////////////////////////// #include -using namespace netCDF; #include "vx_log.h" #include "vx_data2d.h" @@ -24,67 +23,67 @@ using namespace netCDF; //////////////////////////////////////////////////////////////////////// -extern void write_tc_tracks(NcFile*, - const NcDim&, const TrackInfoArray&); +extern void write_tc_tracks(netCDF::NcFile*, + const netCDF::NcDim&, const TrackInfoArray&); -extern set get_pressure_level_strings( - map >); +extern std::set get_pressure_level_strings( + std::map >); -extern set get_pressure_levels( - map >); +extern std::set get_pressure_levels( + std::map >); -extern set get_pressure_levels( - set); +extern std::set get_pressure_levels( + std::set); -extern map get_pressure_level_indices( - set); +extern std::map get_pressure_level_indices( + std::set); -extern map get_pressure_level_indices( - set, set); +extern std::map get_pressure_level_indices( + std::set, std::set); -extern void def_tc_pressure(NcFile*, - const NcDim&, set); +extern void def_tc_pressure(netCDF::NcFile*, + const netCDF::NcDim&, std::set); -extern void def_tc_range_azimuth(NcFile*, - const NcDim&, const NcDim&, const TcrmwGrid&, double); +extern void def_tc_range_azimuth(netCDF::NcFile*, + const netCDF::NcDim&, const netCDF::NcDim&, const TcrmwGrid&, double); -extern void def_tc_lat_lon_time(NcFile*, - const NcDim&, const NcDim&, const NcDim&, - NcVar&, NcVar&, NcVar&); +extern void def_tc_lat_lon_time(netCDF::NcFile*, + const netCDF::NcDim&, const netCDF::NcDim&, const netCDF::NcDim&, + netCDF::NcVar&, netCDF::NcVar&, netCDF::NcVar&); -extern void def_tc_variables(NcFile*, - map >, - map, map, - const NcDim&, const NcDim&, const NcDim&, const NcDim&, - map&); +extern void def_tc_variables(netCDF::NcFile*, + std::map >, + std::map, std::map, + const netCDF::NcDim&, const netCDF::NcDim&, const netCDF::NcDim&, const netCDF::NcDim&, + std::map&); -extern void def_tc_data(NcFile*, - const NcDim&, const NcDim&, const NcDim&, - NcVar&, VarInfo*); +extern void def_tc_data(netCDF::NcFile*, + const netCDF::NcDim&, const netCDF::NcDim&, const netCDF::NcDim&, + netCDF::NcVar&, VarInfo*); -extern void def_tc_data_3d(NcFile*, - const NcDim&, const NcDim&, const NcDim&, const NcDim&, - NcVar&, VarInfo*); +extern void def_tc_data_3d(netCDF::NcFile*, + const netCDF::NcDim&, const netCDF::NcDim&, const netCDF::NcDim&, const netCDF::NcDim&, + netCDF::NcVar&, VarInfo*); -extern void def_tc_azi_mean_data(NcFile*, - const NcDim&, const NcDim&, - NcVar&, VarInfo*); +extern void def_tc_azi_mean_data(netCDF::NcFile*, + const netCDF::NcDim&, const netCDF::NcDim&, + netCDF::NcVar&, VarInfo*); -extern void write_tc_valid_time(NcFile*, - const int&, const NcVar&, const long&); +extern void write_tc_valid_time(netCDF::NcFile*, + const int&, const netCDF::NcVar&, const long&); -extern void write_tc_data(NcFile*, const TcrmwGrid&, - const int&, const NcVar&, const double*); +extern void write_tc_data(netCDF::NcFile*, const TcrmwGrid&, + const int&, const netCDF::NcVar&, const double*); -extern void write_tc_data_rev(NcFile*, const TcrmwGrid&, - const int&, const NcVar&, const double*); +extern void write_tc_data_rev(netCDF::NcFile*, const TcrmwGrid&, + const int&, const netCDF::NcVar&, const double*); -extern void write_tc_azi_mean_data(NcFile*, const TcrmwGrid&, - const int&, const NcVar&, const double*); +extern void write_tc_azi_mean_data(netCDF::NcFile*, const TcrmwGrid&, + const int&, const netCDF::NcVar&, const double*); -extern void write_tc_pressure_level_data(NcFile*, const TcrmwGrid&, - map, const string&, - const int&, const NcVar&, const double*); +extern void write_tc_pressure_level_data(netCDF::NcFile*, const TcrmwGrid&, + std::map, const std::string&, + const int&, const netCDF::NcVar&, const double*); //////////////////////////////////////////////////////////////////////// diff --git a/src/libcode/vx_time_series/compute_swinging_door.h b/src/libcode/vx_time_series/compute_swinging_door.h index 052ce0a789..d4c9ac5283 100644 --- a/src/libcode/vx_time_series/compute_swinging_door.h +++ b/src/libcode/vx_time_series/compute_swinging_door.h @@ -37,7 +37,7 @@ class SDObservation _validTime(valid_time), _value(value) {} - SDObservation(const string &valid_time_string, + SDObservation(const std::string &valid_time_string, const double value) : _validTime(_getTime(valid_time_string)), _value(value) {} @@ -55,7 +55,7 @@ class SDObservation return _validTime; } - string getValidTimeString() const + std::string getValidTimeString() const { return _getTimeString(_validTime); } @@ -99,7 +99,7 @@ class SDObservation // Protected methods // /////////////////////// - static time_t _getTime(const string &time_string) + static time_t _getTime(const std::string &time_string) { struct tm time_struct; memset(&time_struct, 0, sizeof(time_struct)); @@ -114,7 +114,7 @@ class SDObservation return timegm(&time_struct); } - static string _getTimeString(const time_t &unix_time) + static std::string _getTimeString(const time_t &unix_time) { struct tm *time_struct = gmtime(&unix_time); @@ -126,7 +126,7 @@ class SDObservation time_struct->tm_mday, time_struct->tm_hour, time_struct->tm_min, time_struct->tm_sec); - return string(time_string); + return std::string(time_string); } }; @@ -163,9 +163,9 @@ extern bool compute_swinging_door_slopes(const TimeArray &valid_times, // Return: // Returns true if successful, false otherwise. -extern bool compute_swinging_door_ramps(const vector< SDObservation > &observations, +extern bool compute_swinging_door_ramps(const std::vector< SDObservation > &observations, const double error, - vector< pair< SDObservation, SDObservation > > &ramps); + std::vector< std::pair< SDObservation, SDObservation > > &ramps); //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/core/ensemble_stat/Makefile.am b/src/tools/core/ensemble_stat/Makefile.am index 96d06158e7..b3c54e1fd0 100644 --- a/src/tools/core/ensemble_stat/Makefile.am +++ b/src/tools/core/ensemble_stat/Makefile.am @@ -28,10 +28,10 @@ ensemble_stat_LDADD = -lvx_stat_out \ $(PYTHON_LIBS) \ -lvx_data2d \ -lvx_nc_obs \ + -lvx_seeps \ -lvx_nc_util \ -lvx_regrid \ -lvx_grid \ - -lvx_seeps \ -lvx_config \ -lvx_color \ -lvx_util_math \ diff --git a/src/tools/core/ensemble_stat/Makefile.in b/src/tools/core/ensemble_stat/Makefile.in index 9d532022da..d65846ec4b 100644 --- a/src/tools/core/ensemble_stat/Makefile.in +++ b/src/tools/core/ensemble_stat/Makefile.in @@ -335,10 +335,10 @@ ensemble_stat_LDADD = -lvx_stat_out \ $(PYTHON_LIBS) \ -lvx_data2d \ -lvx_nc_obs \ + -lvx_seeps \ -lvx_nc_util \ -lvx_regrid \ -lvx_grid \ - -lvx_seeps \ -lvx_config \ -lvx_color \ -lvx_util_math \ diff --git a/src/tools/core/ensemble_stat/ensemble_stat.cc b/src/tools/core/ensemble_stat/ensemble_stat.cc index 6d3309289e..6123c005fe 100644 --- a/src/tools/core/ensemble_stat/ensemble_stat.cc +++ b/src/tools/core/ensemble_stat/ensemble_stat.cc @@ -68,6 +68,8 @@ // 036 02/20/22 Halley Gotway MET #1259 Write probabilistic statistics. // 037 07/06/22 Howard Soh METplus-Internal #19 Rename main to met_main. // 038 09/06/22 Halley Gotway MET #1908 Remove ensemble processing logic. +// 039 09/29/22 Halley Gotway MET #2286 Refine GRIB1 table lookup logic. +// 040 10/03/22 Prestopnik MET #2227 Remove using namespace netCDF from header files // //////////////////////////////////////////////////////////////////////// @@ -83,6 +85,9 @@ using namespace std; #include #include +#include +using namespace netCDF; + #include "main.h" #include "ensemble_stat.h" @@ -369,9 +374,6 @@ void process_command_line(int argc, char **argv) { // Store the input ensemble file type etype = ens_mtddf->file_type(); - // Use a variable index from var_name instead of GRIB code - bool use_var_id = false; - // Observation files are required if(!grid_obs_flag && !point_obs_flag) { mlog << Error << "\nprocess_command_line() -> " @@ -383,9 +385,6 @@ void process_command_line(int argc, char **argv) { // Determine the input observation file type if(point_obs_flag) { otype = FileType_Gb1; - if(point_obs_file_list.n() > 0) { - use_var_id = is_using_var_id(point_obs_file_list[0].c_str()); - } } else if(!grid_obs_flag) { otype = FileType_None; @@ -409,7 +408,7 @@ void process_command_line(int argc, char **argv) { // Process the configuration conf_info.process_config(etype, otype, grid_obs_flag, point_obs_flag, - use_var_id, &ens_file_list, ctrl_file.nonempty()); + &ens_file_list, ctrl_file.nonempty()); // Set output_nc_flag out_nc_flag = (grid_obs_flag && !conf_info.nc_info.all_false()); @@ -930,6 +929,7 @@ void process_point_obs(int i_nc) { } met_point_obs = met_point_file.get_met_point_data(); + use_var_id = met_point_file.is_using_var_id(); } else { #endif @@ -953,6 +953,9 @@ void process_point_obs(int i_nc) { } #endif + // Perform GRIB table lookups, if needed + if(!use_var_id) conf_info.process_grib_codes(); + int hdr_count = met_point_obs->get_hdr_cnt(); int obs_count = met_point_obs->get_obs_cnt(); diff --git a/src/tools/core/ensemble_stat/ensemble_stat.h b/src/tools/core/ensemble_stat/ensemble_stat.h index db1041b22e..7559c71525 100644 --- a/src/tools/core/ensemble_stat/ensemble_stat.h +++ b/src/tools/core/ensemble_stat/ensemble_stat.h @@ -13,8 +13,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -29,7 +27,6 @@ using namespace std; #include #include -using namespace netCDF; #include "ensemble_stat_conf_info.h" @@ -126,25 +123,25 @@ static int compress_level = -1; // Output NetCDF file static bool out_nc_flag = false; static ConcatString out_nc_file; -static NcFile *nc_out = (NcFile *) 0; -static NcDim lat_dim; -static NcDim lon_dim; +static netCDF::NcFile *nc_out = (netCDF::NcFile *) 0; +static netCDF::NcDim lat_dim; +static netCDF::NcDim lon_dim; // List of output NetCDF variable names static StringArray nc_ens_var_sa; static StringArray nc_orank_var_sa; // Output STAT file -static ConcatString stat_file; -static ofstream *stat_out = (ofstream *) 0; -static AsciiTable stat_at; -static int i_stat_row; +static ConcatString stat_file; +static std::ofstream *stat_out = (std::ofstream *) 0; +static AsciiTable stat_at; +static int i_stat_row; // Optional ASCII output files -static ConcatString txt_file[n_txt]; -static ofstream *txt_out[n_txt]; -static AsciiTable txt_at[n_txt]; -static int i_txt_row[n_txt]; +static ConcatString txt_file[n_txt]; +static std::ofstream *txt_out[n_txt]; +static AsciiTable txt_at[n_txt]; +static int i_txt_row[n_txt]; //////////////////////////////////////////////////////////////////////// // diff --git a/src/tools/core/ensemble_stat/ensemble_stat_conf_info.cc b/src/tools/core/ensemble_stat/ensemble_stat_conf_info.cc index 29e32e881e..714906c100 100644 --- a/src/tools/core/ensemble_stat/ensemble_stat_conf_info.cc +++ b/src/tools/core/ensemble_stat/ensemble_stat_conf_info.cc @@ -65,6 +65,7 @@ void EnsembleStatConfInfo::clear() { // Initialize values model.clear(); + grib_codes_set = false; obtype.clear(); vld_ens_thresh = bad_data_double; vld_data_thresh = bad_data_double; @@ -116,7 +117,6 @@ void EnsembleStatConfInfo::read_config(const ConcatString default_file_name, void EnsembleStatConfInfo::process_config(GrdFileType etype, GrdFileType otype, bool grid_vx, bool point_vx, - bool use_var_id, StringArray * ens_files, bool use_ctrl) { int i, j, n_ens_files; @@ -276,8 +276,7 @@ void EnsembleStatConfInfo::process_config(GrdFileType etype, // Process the options for this verification task vx_opt[i].process_config(etype, i_fdict, otype, i_odict, - rng_ptr, grid_vx, point_vx, - use_var_id, ens_member_ids, + rng_ptr, grid_vx, point_vx, ens_member_ids, ens_files, use_ctrl, control_id); // For no point verification, store obtype as the message type @@ -306,6 +305,32 @@ void EnsembleStatConfInfo::process_config(GrdFileType etype, //////////////////////////////////////////////////////////////////////// +void EnsembleStatConfInfo::process_grib_codes() { + + // Only needs to be set once + if(grib_codes_set) return; + + mlog << Debug(3) << "Processing each \"" << conf_key_obs_field + << "\" name as a GRIB code abbreviation since the point " + << "observations are specified as GRIB codes.\n"; + + Dictionary *odict = conf.lookup_array(conf_key_obs_field); + Dictionary i_odict; + + // Add the GRIB code by parsing each observation dictionary + for(int i=0; iadd_grib_code(i_odict); + } + + // Flag to prevent processing more than once + grib_codes_set = true; + + return; +} + +//////////////////////////////////////////////////////////////////////// + void EnsembleStatConfInfo::process_flags() { int i, j; bool output_ascii_flag = false; @@ -609,8 +634,7 @@ void EnsembleStatVxOpt::clear() { void EnsembleStatVxOpt::process_config(GrdFileType ftype, Dictionary &fdict, GrdFileType otype, Dictionary &odict, - gsl_rng *rng_ptr, bool grid_vx, - bool point_vx, bool use_var_id, + gsl_rng *rng_ptr, bool grid_vx, bool point_vx, StringArray ens_member_ids, StringArray * ens_files, bool use_ctrl, ConcatString control_id) { @@ -679,9 +703,6 @@ void EnsembleStatVxOpt::process_config(GrdFileType ftype, Dictionary &fdict, // Set the VarInfo objects vx_pd.obs_info->set_dict(odict); - // Set the GRIB code for point observations - if(point_vx && !use_var_id) vx_pd.obs_info->add_grib_code(odict); - // Dump the contents of the current VarInfo if(mlog.verbosity_level() >= 5) { mlog << Debug(5) diff --git a/src/tools/core/ensemble_stat/ensemble_stat_conf_info.h b/src/tools/core/ensemble_stat/ensemble_stat_conf_info.h index a011b89fe4..7a14e4b761 100644 --- a/src/tools/core/ensemble_stat/ensemble_stat_conf_info.h +++ b/src/tools/core/ensemble_stat/ensemble_stat_conf_info.h @@ -144,7 +144,7 @@ class EnsembleStatVxOpt { void process_config(GrdFileType, Dictionary &, GrdFileType, Dictionary &, - gsl_rng *, bool, bool, bool, + gsl_rng *, bool, bool, StringArray, StringArray *, bool, ConcatString); void parse_nc_info(Dictionary &); @@ -213,6 +213,7 @@ class EnsembleStatConfInfo { ConcatString control_id; // Control ID EnsembleStatVxOpt * vx_opt; // Array of vx task options [n_vx] (allocated) + bool grib_codes_set; double vld_ens_thresh; // Required ratio of valid input files double vld_data_thresh; // Required ratio of valid data for each point @@ -242,8 +243,9 @@ class EnsembleStatConfInfo { void clear(); void read_config (const ConcatString , const ConcatString); - void process_config(GrdFileType, GrdFileType, bool, bool, bool, + void process_config(GrdFileType, GrdFileType, bool, bool, StringArray *, bool); + void process_grib_codes(); void process_flags (); void process_masks (const Grid &); void set_vx_pd (const IntArray &, int); diff --git a/src/tools/core/grid_stat/Makefile.am b/src/tools/core/grid_stat/Makefile.am index 4569f0ff7e..a117c965d2 100644 --- a/src/tools/core/grid_stat/Makefile.am +++ b/src/tools/core/grid_stat/Makefile.am @@ -28,10 +28,10 @@ grid_stat_LDADD = -lvx_stat_out \ -lvx_data2d_nccf \ -lvx_statistics \ -lvx_data2d \ + -lvx_seeps \ -lvx_nc_util \ -lvx_regrid \ -lvx_grid \ - -lvx_seeps \ -lvx_config \ -lvx_cal \ -lvx_util_math \ diff --git a/src/tools/core/grid_stat/Makefile.in b/src/tools/core/grid_stat/Makefile.in index f167bb520d..9cf9df8068 100644 --- a/src/tools/core/grid_stat/Makefile.in +++ b/src/tools/core/grid_stat/Makefile.in @@ -334,10 +334,10 @@ grid_stat_LDADD = -lvx_stat_out \ -lvx_data2d_nccf \ -lvx_statistics \ -lvx_data2d \ + -lvx_seeps \ -lvx_nc_util \ -lvx_regrid \ -lvx_grid \ - -lvx_seeps \ -lvx_config \ -lvx_cal \ -lvx_util_math \ diff --git a/src/tools/core/grid_stat/grid_stat.cc b/src/tools/core/grid_stat/grid_stat.cc index a7ed788b3c..3912a3866a 100644 --- a/src/tools/core/grid_stat/grid_stat.cc +++ b/src/tools/core/grid_stat/grid_stat.cc @@ -110,6 +110,7 @@ // 052 05/28/21 Halley Gotway Add MCTS HSS_EC output. // 053 12/11/21 Halley Gotway MET #1991 Fix VCNT output. // 054 07/06/22 Howard Soh METplus-Internal #19 Rename main to met_main +// 055 10/03/22 Prestopnik MET #2227 Remove using namespace netCDF from header files // //////////////////////////////////////////////////////////////////////// @@ -125,6 +126,9 @@ using namespace std; #include #include +#include +using namespace netCDF; + #include "main.h" #include "handle_openmp.h" diff --git a/src/tools/core/grid_stat/grid_stat.h b/src/tools/core/grid_stat/grid_stat.h index 04f694fa96..555941e10c 100644 --- a/src/tools/core/grid_stat/grid_stat.h +++ b/src/tools/core/grid_stat/grid_stat.h @@ -16,8 +16,9 @@ // ---- ---- ---- ----------- // 000 11/11/08 Halley Gotway New // 001 05/03/10 Halley Gotway Add fcst/obs/diff variable name -// arrays to keep track of NetCDF variables. +// arrays to keep track of NetCDF variables. // 002 05/10/16 Halley Gotway Add grid weighting. +// 003 09/28/22 Prestopnik MET #2227 Remove namespace std and netCDF from header files // //////////////////////////////////////////////////////////////////////// @@ -26,8 +27,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -42,7 +41,6 @@ using namespace std; #include #include -using namespace netCDF; #include "grid_stat_conf_info.h" @@ -123,26 +121,26 @@ static ConcatString out_dir; // //////////////////////////////////////////////////////////////////////// -// Output NetCDF file -static ConcatString out_nc_file; -static NcFile *nc_out = (NcFile *) 0; -static NcDim lat_dim; -static NcDim lon_dim; +// Output Netcdf file +static ConcatString out_nc_file; +static netCDF::NcFile *nc_out = (netCDF::NcFile *) 0; +static netCDF::NcDim lat_dim; +static netCDF::NcDim lon_dim; // List of output NetCDF variable names static StringArray nc_var_sa; // Output STAT file -static ConcatString stat_file; -static ofstream *stat_out = (ofstream *) 0; -static AsciiTable stat_at; -static int i_stat_row; +static ConcatString stat_file; +static std::ofstream *stat_out = (std::ofstream *) 0; +static AsciiTable stat_at; +static int i_stat_row; // Optional ASCII output files -static ConcatString txt_file[n_txt]; -static ofstream *txt_out[n_txt]; -static AsciiTable txt_at[n_txt]; -static int i_txt_row[n_txt]; +static ConcatString txt_file[n_txt]; +static std::ofstream *txt_out[n_txt]; +static AsciiTable txt_at[n_txt]; +static int i_txt_row[n_txt]; static int compress_level = -1; diff --git a/src/tools/core/mode/Makefile.am b/src/tools/core/mode/Makefile.am index 4e1692b1c1..f89b8c9afa 100644 --- a/src/tools/core/mode/Makefile.am +++ b/src/tools/core/mode/Makefile.am @@ -48,9 +48,9 @@ mode_LDADD = -lvx_pxm \ -lvx_data2d_nccf \ -lvx_statistics \ -lvx_data2d \ + -lvx_seeps \ -lvx_nc_util \ -lvx_regrid \ - -lvx_seeps \ -lvx_grid \ -lvx_config \ -lvx_bool_calc \ @@ -67,4 +67,4 @@ EXTRA_DIST = mode_exec.h \ mode_ps_table_defs.h \ mode_usage.h \ combine_boolplanes.h \ - objects_from_netcdf.h \ No newline at end of file + objects_from_netcdf.h diff --git a/src/tools/core/mode/Makefile.in b/src/tools/core/mode/Makefile.in index 9bc47116ec..34488bdbc9 100644 --- a/src/tools/core/mode/Makefile.in +++ b/src/tools/core/mode/Makefile.in @@ -373,9 +373,9 @@ mode_LDADD = -lvx_pxm \ -lvx_data2d_nccf \ -lvx_statistics \ -lvx_data2d \ + -lvx_seeps \ -lvx_nc_util \ -lvx_regrid \ - -lvx_seeps \ -lvx_grid \ -lvx_config \ -lvx_bool_calc \ diff --git a/src/tools/core/mode/mode_exec.cc b/src/tools/core/mode/mode_exec.cc index 8c93b2530a..984fc0aee9 100644 --- a/src/tools/core/mode/mode_exec.cc +++ b/src/tools/core/mode/mode_exec.cc @@ -17,6 +17,9 @@ using namespace std; #include #include +#include +using namespace netCDF; + #include "mode_exec.h" #include "nc_utils.h" #include "vx_regrid.h" diff --git a/src/tools/core/mode/mode_exec.h b/src/tools/core/mode/mode_exec.h index 934f674a30..718841b093 100644 --- a/src/tools/core/mode/mode_exec.h +++ b/src/tools/core/mode/mode_exec.h @@ -19,7 +19,6 @@ #include #include -using namespace netCDF; #include "vx_data2d.h" #include "vx_data2d_factory.h" @@ -132,8 +131,8 @@ class ModeExecutive { void write_obj_stats(); void write_obj_netcdf(const ModeNcOutInfo &); - void write_poly_netcdf(NcFile *); - void write_poly_netcdf(NcFile *, const ObjPolyType); + void write_poly_netcdf(netCDF::NcFile *); + void write_poly_netcdf(netCDF::NcFile *, const ObjPolyType); void write_ct_stats(); }; diff --git a/src/tools/core/pcp_combine/pcp_combine.cc b/src/tools/core/pcp_combine/pcp_combine.cc index d70047ebbb..7ba1f7d803 100644 --- a/src/tools/core/pcp_combine/pcp_combine.cc +++ b/src/tools/core/pcp_combine/pcp_combine.cc @@ -76,6 +76,7 @@ // 023 08/29/19 Halley Gotway Support multiple arguments for the // the -pcpdir option. // 024 07/06/22 Howard Soh METplus-Internal #19 Rename main to met_main +// 025 09/29/22 Prestopnik MET #2227 Remove namespace netCDF from header files // //////////////////////////////////////////////////////////////////////// @@ -92,6 +93,9 @@ using namespace std; #include #include +#include +using namespace netCDF; + #include "main.h" #include "vx_log.h" #include "vx_data2d_factory.h" diff --git a/src/tools/core/point_stat/Makefile.am b/src/tools/core/point_stat/Makefile.am index 53e5719408..53b973ed93 100644 --- a/src/tools/core/point_stat/Makefile.am +++ b/src/tools/core/point_stat/Makefile.am @@ -27,10 +27,10 @@ point_stat_LDADD = -lvx_stat_out \ $(PYTHON_LIBS) \ -lvx_data2d \ -lvx_nc_obs \ + -lvx_seeps \ -lvx_nc_util \ -lvx_regrid \ -lvx_grid \ - -lvx_seeps \ -lvx_config \ -lvx_gsl_prob \ -lvx_color \ diff --git a/src/tools/core/point_stat/Makefile.in b/src/tools/core/point_stat/Makefile.in index 7c1d1f2f9d..58f5811a41 100644 --- a/src/tools/core/point_stat/Makefile.in +++ b/src/tools/core/point_stat/Makefile.in @@ -334,10 +334,10 @@ point_stat_LDADD = -lvx_stat_out \ $(PYTHON_LIBS) \ -lvx_data2d \ -lvx_nc_obs \ + -lvx_seeps \ -lvx_nc_util \ -lvx_regrid \ -lvx_grid \ - -lvx_seeps \ -lvx_config \ -lvx_gsl_prob \ -lvx_color \ diff --git a/src/tools/core/point_stat/point_stat.cc b/src/tools/core/point_stat/point_stat.cc index d14c149cd8..94fd159536 100644 --- a/src/tools/core/point_stat/point_stat.cc +++ b/src/tools/core/point_stat/point_stat.cc @@ -101,6 +101,8 @@ // 049 12/11/21 Halley Gotway MET #1991 Fix VCNT output. // 050 02/11/22 Halley Gotway MET #2045 Fix HiRA output. // 051 07/06/22 Howard Soh METplus-Internal #19 Rename main to met_main +// 052 09/29/22 Halley Gotway MET #2286 Refine GRIB1 table lookup logic. +// 053 10/03/22 Prestopnik MET #2227 Remove using namespace netCDF from header files // //////////////////////////////////////////////////////////////////////// @@ -116,6 +118,9 @@ using namespace std; #include #include +#include +using namespace netCDF; + #include "main.h" #include "point_stat.h" @@ -284,14 +289,11 @@ void process_command_line(int argc, char **argv) { exit(1); } - // Use a variable index from var_name instead of GRIB code - bool use_var_id = is_using_var_id(obs_file[0].c_str()); - // Store the forecast file type ftype = fcst_mtddf->file_type(); // Process the configuration - conf_info.process_config(ftype, use_var_id); + conf_info.process_config(ftype); // Set the model name shc.set_model(conf_info.model.c_str()); @@ -713,6 +715,7 @@ void process_obs_file(int i_nc) { } met_point_obs = met_point_file.get_met_point_data(); + use_var_id = met_point_file.is_using_var_id(); } else { #endif @@ -735,6 +738,10 @@ void process_obs_file(int i_nc) { } #endif + // Perform GRIB table lookups, if needed + if(!use_var_id) conf_info.process_grib_codes(); + is_vgrd = is_ugrd = false; + int hdr_count = met_point_obs->get_hdr_cnt(); int obs_count = met_point_obs->get_obs_cnt(); mlog << Debug(2) @@ -745,7 +752,7 @@ void process_obs_file(int i_nc) { ConcatString var_name(""); StringArray var_names; StringArray obs_qty_array = met_point_obs->get_qty_data(); - if( use_var_id ) var_names = met_point_obs->get_var_names(); + if(use_var_id) var_names = met_point_obs->get_var_names(); const int buf_size = ((obs_count > BUFFER_SIZE) ? BUFFER_SIZE : (obs_count)); int obs_qty_idx_block[buf_size]; diff --git a/src/tools/core/point_stat/point_stat.h b/src/tools/core/point_stat/point_stat.h index 0a24e9209a..1c75d7e8ea 100644 --- a/src/tools/core/point_stat/point_stat.h +++ b/src/tools/core/point_stat/point_stat.h @@ -15,6 +15,8 @@ // Mod# Date Name Description // ---- ---- ---- ----------- // 000 11/11/08 Halley Gotway New +// 001 09/28/22 Prestopnik MET #2227 Remove namespace std and netCDF from header files +// // //////////////////////////////////////////////////////////////////////// @@ -25,8 +27,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -40,9 +40,6 @@ using namespace std; #include #include -#include -using namespace netCDF; - #include "point_stat_conf_info.h" #include "vx_data2d_factory.h" @@ -129,16 +126,16 @@ static unixtime fcst_valid_ut = (unixtime) 0; static int fcst_lead_sec = bad_data_int; // Output STAT file -static ConcatString stat_file; -static ofstream *stat_out = (ofstream *) 0; -static AsciiTable stat_at; -static int i_stat_row; +static ConcatString stat_file; +static std::ofstream *stat_out = (std::ofstream *) 0; +static AsciiTable stat_at; +static int i_stat_row; // Optional ASCII output files -static ConcatString txt_file[n_txt]; -static ofstream *txt_out[n_txt]; -static AsciiTable txt_at[n_txt]; -static int i_txt_row[n_txt]; +static ConcatString txt_file[n_txt]; +static std::ofstream *txt_out[n_txt]; +static AsciiTable txt_at[n_txt]; +static int i_txt_row[n_txt]; //////////////////////////////////////////////////////////////////////// // diff --git a/src/tools/core/point_stat/point_stat_conf_info.cc b/src/tools/core/point_stat/point_stat_conf_info.cc index 4067714758..e16bc6bad4 100644 --- a/src/tools/core/point_stat/point_stat_conf_info.cc +++ b/src/tools/core/point_stat/point_stat_conf_info.cc @@ -23,8 +23,6 @@ using namespace std; #include "vx_data2d.h" #include "vx_log.h" -extern bool use_var_id; - //////////////////////////////////////////////////////////////////////// // // Code for class PointStatConfInfo @@ -61,6 +59,7 @@ void PointStatConfInfo::clear() { // Initialize values model.clear(); + grib_codes_set = false; land_mask.clear(); topo_dp.clear(); topo_use_obs_thresh.clear(); @@ -100,8 +99,7 @@ void PointStatConfInfo::read_config(const char *default_file_name, //////////////////////////////////////////////////////////////////////// -void PointStatConfInfo::process_config(GrdFileType ftype, - bool cur_use_var_id) { +void PointStatConfInfo::process_config(GrdFileType ftype) { int i, j, n_fvx, n_ovx; Dictionary *fdict = (Dictionary *) 0; Dictionary *odict = (Dictionary *) 0; @@ -170,7 +168,7 @@ void PointStatConfInfo::process_config(GrdFileType ftype, i_odict = parse_conf_i_vx_dict(odict, i); // Process the options for this verification task - vx_opt[i].process_config(ftype, i_fdict, i_odict, cur_use_var_id); + vx_opt[i].process_config(ftype, i_fdict, i_odict); } // Summarize output flags across all verification tasks @@ -230,6 +228,32 @@ void PointStatConfInfo::process_config(GrdFileType ftype, //////////////////////////////////////////////////////////////////////// +void PointStatConfInfo::process_grib_codes() { + + // Only needs to be set once + if(grib_codes_set) return; + + mlog << Debug(3) << "Processing each \"" << conf_key_obs_field + << "\" name as a GRIB code abbreviation since the point " + << "observations are specified as GRIB codes.\n"; + + Dictionary *odict = conf.lookup_array(conf_key_obs_field); + Dictionary i_odict; + + // Add the GRIB code by parsing each observation dictionary + for(int i=0; iadd_grib_code(i_odict); + } + + // Flag to prevent processing more than once + grib_codes_set = true; + + return; +} + +//////////////////////////////////////////////////////////////////////// + void PointStatConfInfo::process_flags() { int i, j; bool output_ascii_flag = false; @@ -698,7 +722,7 @@ bool PointStatVxOpt::is_uv_match(const PointStatVxOpt &v) const { //////////////////////////////////////////////////////////////////////// void PointStatVxOpt::process_config(GrdFileType ftype, - Dictionary &fdict, Dictionary &odict, bool cur_use_var_id) { + Dictionary &fdict, Dictionary &odict) { int i, n; VarInfoFactory info_factory; mapoutput_map; @@ -715,9 +739,6 @@ void PointStatVxOpt::process_config(GrdFileType ftype, vx_pd.fcst_info->set_dict(fdict); vx_pd.obs_info->set_dict(odict); - // Set the GRIB code for point observations - if(!cur_use_var_id) vx_pd.obs_info->add_grib_code(odict); - // Dump the contents of the current VarInfo if(mlog.verbosity_level() >= 5) { mlog << Debug(5) @@ -1112,8 +1133,8 @@ int PointStatVxOpt::n_txt_row(int i_txt_row) const { if(output_flag[i_txt_row] == STATOutputType_None) return(0); bool prob_flag = vx_pd.fcst_info->is_prob(); - bool vect_flag = (vx_pd.fcst_info->is_u_wind() && - vx_pd.obs_info->is_u_wind()); + bool vect_flag = vx_pd.fcst_info->is_v_wind() && + vx_pd.fcst_info->uv_index() >= 0; int n_pd = get_n_msg_typ() * get_n_mask() * get_n_interp(); diff --git a/src/tools/core/point_stat/point_stat_conf_info.h b/src/tools/core/point_stat/point_stat_conf_info.h index 2b47ce1188..ec27d61cc1 100644 --- a/src/tools/core/point_stat/point_stat_conf_info.h +++ b/src/tools/core/point_stat/point_stat_conf_info.h @@ -163,7 +163,7 @@ class PointStatVxOpt { void clear(); - void process_config(GrdFileType, Dictionary &, Dictionary &, bool); + void process_config(GrdFileType, Dictionary &, Dictionary &); void set_vx_pd(PointStatConfInfo *); bool is_uv_match(const PointStatVxOpt &) const; @@ -225,6 +225,7 @@ class PointStatConfInfo { ConcatString model; // Model name PointStatVxOpt * vx_opt; // Array of vx task options [n_vx] (allocated) + bool grib_codes_set; // Land/sea mask and topography info for data filtering MaskPlane land_mask; @@ -253,7 +254,8 @@ class PointStatConfInfo { void clear(); void read_config(const char *, const char *); - void process_config(GrdFileType, bool); + void process_config(GrdFileType); + void process_grib_codes(); void process_flags(); void process_masks(const Grid &); void process_geog(const Grid &, const char *); diff --git a/src/tools/core/series_analysis/Makefile.am b/src/tools/core/series_analysis/Makefile.am index 6681bf63de..4dbab78623 100644 --- a/src/tools/core/series_analysis/Makefile.am +++ b/src/tools/core/series_analysis/Makefile.am @@ -28,10 +28,10 @@ series_analysis_LDADD = -lvx_stat_out \ -lvx_data2d_nccf \ -lvx_statistics \ -lvx_data2d \ + -lvx_seeps \ -lvx_nc_util \ -lvx_regrid \ -lvx_grid \ - -lvx_seeps \ -lvx_config \ -lvx_cal \ -lvx_util_math \ diff --git a/src/tools/core/series_analysis/Makefile.in b/src/tools/core/series_analysis/Makefile.in index 0b8493b157..d1e066eae0 100644 --- a/src/tools/core/series_analysis/Makefile.in +++ b/src/tools/core/series_analysis/Makefile.in @@ -336,10 +336,10 @@ series_analysis_LDADD = -lvx_stat_out \ -lvx_data2d_nccf \ -lvx_statistics \ -lvx_data2d \ + -lvx_seeps \ -lvx_nc_util \ -lvx_regrid \ -lvx_grid \ - -lvx_seeps \ -lvx_config \ -lvx_cal \ -lvx_util_math \ diff --git a/src/tools/core/series_analysis/series_analysis.cc b/src/tools/core/series_analysis/series_analysis.cc index c0533c16bf..d62e401109 100644 --- a/src/tools/core/series_analysis/series_analysis.cc +++ b/src/tools/core/series_analysis/series_analysis.cc @@ -33,6 +33,7 @@ // 012 01/20/22 Halley Gotway MET #2003 Add PSTD BRIERCL output. // 013 05/25/22 Halley Gotway MET #2147 Add CTS HSS_EC output. // 014 07/06/22 Howard Soh METplus-Internal #19 Rename main to met_main +// 015 10/03/22 Presotpnik MET #2227 Remove namespace netCDF from header files // //////////////////////////////////////////////////////////////////////// @@ -49,6 +50,9 @@ using namespace std; #include #include +#include +using namespace netCDF; + #include "main.h" #include "series_analysis.h" diff --git a/src/tools/core/series_analysis/series_analysis.h b/src/tools/core/series_analysis/series_analysis.h index fe8e48a948..d591837294 100644 --- a/src/tools/core/series_analysis/series_analysis.h +++ b/src/tools/core/series_analysis/series_analysis.h @@ -15,6 +15,8 @@ // Mod# Date Name Description // ---- ---- ---- ----------- // 000 12/10/12 Halley Gotway New +// 001 09/28/22 Prestopnik MET #2227 Remove namespace std and netCDF from header files +// // //////////////////////////////////////////////////////////////////////// @@ -23,8 +25,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -39,7 +39,6 @@ using namespace std; #include #include -using namespace netCDF; #include "series_analysis_conf_info.h" @@ -89,17 +88,17 @@ static SeriesAnalysisConfInfo conf_info; //////////////////////////////////////////////////////////////////////// // Output NetCDF file -static NcFile *nc_out = (NcFile *) 0; -static NcDim lat_dim; -static NcDim lon_dim ; +static netCDF::NcFile *nc_out = (netCDF::NcFile *) 0; +static netCDF::NcDim lat_dim; +static netCDF::NcDim lon_dim ; // Structure to store computed statistics and corresponding metadata struct NcVarData { - NcVar * var; // Pointer to NetCDF variable + netCDF::NcVar * var; // Pointer to NetCDF variable }; // Mapping of NetCDF variable name to computed statistic -map stat_data; +std::map stat_data; //////////////////////////////////////////////////////////////////////// // @@ -149,7 +148,7 @@ static int obs_lead_beg = bad_data_int; static int obs_lead_end = bad_data_int; // Mapping of statistic names to descriptions -map stat_long_name; +std::map stat_long_name; static const char stat_long_name_file[] = "MET_BASE/table_files/stat_column_description.txt"; diff --git a/src/tools/core/stat_analysis/Makefile.am b/src/tools/core/stat_analysis/Makefile.am index 0949473aab..7d2198fc5e 100644 --- a/src/tools/core/stat_analysis/Makefile.am +++ b/src/tools/core/stat_analysis/Makefile.am @@ -31,10 +31,10 @@ stat_analysis_LDADD = -lvx_stat_out \ -lvx_data2d_nccf \ -lvx_statistics \ -lvx_data2d \ + -lvx_seeps \ -lvx_nc_util \ -lvx_regrid \ -lvx_grid \ - -lvx_seeps \ -lvx_config \ -lvx_time_series \ -lvx_pb_util \ diff --git a/src/tools/core/stat_analysis/Makefile.in b/src/tools/core/stat_analysis/Makefile.in index fb6bd3781a..cf531b2d07 100644 --- a/src/tools/core/stat_analysis/Makefile.in +++ b/src/tools/core/stat_analysis/Makefile.in @@ -344,10 +344,10 @@ stat_analysis_LDADD = -lvx_stat_out \ -lvx_data2d_nccf \ -lvx_statistics \ -lvx_data2d \ + -lvx_seeps \ -lvx_nc_util \ -lvx_regrid \ -lvx_grid \ - -lvx_seeps \ -lvx_config \ -lvx_time_series \ -lvx_pb_util \ diff --git a/src/tools/core/stat_analysis/aggr_stat_line.h b/src/tools/core/stat_analysis/aggr_stat_line.h index 86a1e771d5..43c5a437ee 100644 --- a/src/tools/core/stat_analysis/aggr_stat_line.h +++ b/src/tools/core/stat_analysis/aggr_stat_line.h @@ -29,6 +29,7 @@ // 010 04/25/18 Halley Gotway Add ECNT line type. // 011 04/01/19 Fillmore Add FCST and OBS units. // 012 01/24/20 Halley Gotway Add aggregate RPS lines. +// 013 09/28/22 Prestopnik MET #2227 Remove namespace std // //////////////////////////////////////////////////////////////////////// @@ -37,8 +38,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -93,8 +92,8 @@ struct StatHdrInfo { struct AggrSummaryInfo { StatHdrInfo hdr; - map val; - map wgt; + std::map val; + std::map wgt; }; struct AggrCTCInfo { @@ -189,7 +188,7 @@ struct ssvar_bin_cmp { struct AggrSSVARInfo { StatHdrInfo hdr; - map ssvar_bins; + std::map ssvar_bins; }; struct AggrTimeSeriesInfo { @@ -207,97 +206,97 @@ struct AggrTimeSeriesInfo { extern void aggr_summary_lines( LineDataFile &, STATAnalysisJob &, - map &, + std::map &, int &, int &); extern void aggr_ctc_lines( LineDataFile &, STATAnalysisJob &, - map &, + std::map &, int &, int &); extern void aggr_mctc_lines( LineDataFile &, STATAnalysisJob &, - map &, + std::map &, int &, int &); extern void aggr_pct_lines( LineDataFile &, STATAnalysisJob &, - map &, + std::map &, int &, int &); extern void aggr_psum_lines( LineDataFile &, STATAnalysisJob &, - map &, + std::map &, int &, int &); extern void aggr_grad_lines( LineDataFile &, STATAnalysisJob &, - map &, + std::map &, int &, int &); extern void aggr_wind_lines( LineDataFile &, STATAnalysisJob &, - map &, + std::map &, int &, int &); extern void aggr_mpr_wind_lines( LineDataFile &, STATAnalysisJob &, - map &, + std::map &, int &, int &); extern void aggr_mpr_lines( LineDataFile &, STATAnalysisJob &, - map &, + std::map &, int &, int &); extern void aggr_isc_lines( LineDataFile &, STATAnalysisJob &, - map &, + std::map &, int &, int &); extern void aggr_ecnt_lines( LineDataFile &, STATAnalysisJob &, - map &, + std::map &, int &, int &); extern void aggr_rps_lines( LineDataFile &, STATAnalysisJob &, - map &, + std::map &, int &, int &); extern void aggr_rhist_lines( LineDataFile &, STATAnalysisJob &, - map &, + std::map &, int &, int &); extern void aggr_phist_lines( LineDataFile &, STATAnalysisJob &, - map &, + std::map &, int &, int &); extern void aggr_relp_lines( LineDataFile &, STATAnalysisJob &, - map &, + std::map &, int &, int &); extern void aggr_orank_lines( LineDataFile &, STATAnalysisJob &, - map &, + std::map &, int &, int &); extern void aggr_ssvar_lines( LineDataFile &, STATAnalysisJob &, - map &, + std::map &, int &, int &); extern void aggr_time_series_lines( LineDataFile &, STATAnalysisJob &, - map &, + std::map &, int &, int &); extern void aggr_ss_index( LineDataFile &, STATAnalysisJob &, - map &, + std::map &, int &, int &); //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/core/stat_analysis/parse_stat_line.h b/src/tools/core/stat_analysis/parse_stat_line.h index ed9a6be48a..0ad26c65e9 100644 --- a/src/tools/core/stat_analysis/parse_stat_line.h +++ b/src/tools/core/stat_analysis/parse_stat_line.h @@ -25,6 +25,7 @@ // 008 10/09/17 Halley Gotway Add GRAD line type. // 009 04/25/18 Halley Gotway Add ECNT line type. // 010 01/24/20 Halley Gotway Add RPS line type. +// 011 09/28/22 Prestopnik MET #2227 Remove namespace std // //////////////////////////////////////////////////////////////////////// @@ -33,8 +34,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include diff --git a/src/tools/core/stat_analysis/skill_score_index_job.h b/src/tools/core/stat_analysis/skill_score_index_job.h index 74f2a33e0e..b00c4e93db 100644 --- a/src/tools/core/stat_analysis/skill_score_index_job.h +++ b/src/tools/core/stat_analysis/skill_score_index_job.h @@ -15,6 +15,8 @@ // Mod# Date Name Description // ---- ---- ---- ----------- // 000 07/28/21 Halley Gotway New +// 001 09/28/22 Prestopnik MET #2227 Remove namespace std +// // //////////////////////////////////////////////////////////////////////// @@ -23,8 +25,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -78,17 +78,17 @@ class SSIndexJobInfo { NumArray n_fcst_lines, n_ref_lines; // Input line type for each term - vector job_lt; + std::vector job_lt; // Vectors of jobs for each term - vector fcst_job; - vector ref_job; + std::vector fcst_job; + std::vector ref_job; // Vectors of partial sums and contingency tables for each term - vector fcst_sl1l2; - vector ref_sl1l2; - vector fcst_cts; - vector ref_cts; + std::vector fcst_sl1l2; + std::vector ref_sl1l2; + std::vector fcst_cts; + std::vector ref_cts; // Add jobs for each term void add_term(const STATAnalysisJob &, diff --git a/src/tools/core/stat_analysis/stat_analysis.h b/src/tools/core/stat_analysis/stat_analysis.h index 4c9f461139..ad8bd15c6f 100644 --- a/src/tools/core/stat_analysis/stat_analysis.h +++ b/src/tools/core/stat_analysis/stat_analysis.h @@ -16,6 +16,7 @@ // ---- ---- ---- ----------- // 000 11/11/08 Halley Gotway New // 001 05/03/12 Halley Gotway Switch to using vx_config library. +// 002 09/28/22 Prestopnik MET #2227 Remove namespace std // //////////////////////////////////////////////////////////////////////// @@ -26,8 +27,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -70,8 +69,8 @@ static StringArray search_dirs; static StringArray files; // Output file set with -out -static ConcatString out_file; -static ofstream *sa_out = (ofstream *) 0; +static ConcatString out_file; +static std::ofstream *sa_out = (std::ofstream *) 0; // Config file set with -config static ConcatString config_file; @@ -91,7 +90,7 @@ static ConcatString tmp_file; static ConcatString tmp_path; // Output file stream for the temporary file -static ofstream tmp_out; +static std::ofstream tmp_out; // STAT-Analysis configuration object static MetConfig conf; diff --git a/src/tools/core/stat_analysis/stat_analysis_job.h b/src/tools/core/stat_analysis/stat_analysis_job.h index 9235af7da3..a963fd1944 100644 --- a/src/tools/core/stat_analysis/stat_analysis_job.h +++ b/src/tools/core/stat_analysis/stat_analysis_job.h @@ -24,6 +24,7 @@ // 006 10/09/17 Halley Gotway Add aggregate GRAD lines. // 007 03/01/18 Halley Gotway Update summary job type. // 008 01/24/20 Halley Gotway Add aggregate RPS lines. +// 009 09/28/22 Prestopnik MET #2227 Remove namespace std // //////////////////////////////////////////////////////////////////////// @@ -32,8 +33,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -53,26 +52,26 @@ extern void set_job_from_config(MetConfig &, STATAnalysisJob &); extern void do_job(const ConcatString &, STATAnalysisJob &, int, const ConcatString &, const ConcatString &, - ofstream *); + std::ofstream *); extern void do_job_filter(const ConcatString &, LineDataFile &, - STATAnalysisJob &, int &, int &, ofstream *); + STATAnalysisJob &, int &, int &, std::ofstream *); extern void do_job_summary(const ConcatString &, LineDataFile &, - STATAnalysisJob &, int &, int &, ofstream *, gsl_rng *); + STATAnalysisJob &, int &, int &, std::ofstream *, gsl_rng *); extern void do_job_aggr(const ConcatString &, LineDataFile &, - STATAnalysisJob &, int &, int &, ofstream *); + STATAnalysisJob &, int &, int &, std::ofstream *); extern void do_job_aggr_stat(const ConcatString &, LineDataFile &, - STATAnalysisJob &, int &, int &, ofstream *, + STATAnalysisJob &, int &, int &, std::ofstream *, const ConcatString &, gsl_rng *); extern void do_job_ss_index(const ConcatString &, LineDataFile &, - STATAnalysisJob &, int &, int &, ofstream *); + STATAnalysisJob &, int &, int &, std::ofstream *); extern void do_job_ramp(const ConcatString &, LineDataFile &, - STATAnalysisJob &, int &, int &, ofstream *); + STATAnalysisJob &, int &, int &, std::ofstream *); //////////////////////////////////////////////////////////////////////// @@ -80,61 +79,61 @@ extern void write_job_aggr_hdr(STATAnalysisJob &, int, int, AsciiTable &); extern void write_job_summary(STATAnalysisJob &, - map &, AsciiTable &, + std::map &, AsciiTable &, gsl_rng *); extern void write_job_aggr_ctc(STATAnalysisJob &, STATLineType, - map &, AsciiTable &); + std::map &, AsciiTable &); extern void write_job_aggr_mctc(STATAnalysisJob &, STATLineType, - map &, AsciiTable &); + std::map &, AsciiTable &); extern void write_job_aggr_pct(STATAnalysisJob &, STATLineType, - map &, AsciiTable &); + std::map &, AsciiTable &); extern void write_job_aggr_psum(STATAnalysisJob &, STATLineType, - map &, AsciiTable &); + std::map &, AsciiTable &); extern void write_job_aggr_grad(STATAnalysisJob &, STATLineType, - map &, AsciiTable &); + std::map &, AsciiTable &); extern void write_job_aggr_wind(STATAnalysisJob &, STATLineType, - map &, AsciiTable &); + std::map &, AsciiTable &); extern void write_job_aggr_ecnt(STATAnalysisJob &, STATLineType, - map &, AsciiTable &); + std::map &, AsciiTable &); extern void write_job_aggr_rps(STATAnalysisJob &, STATLineType, - map &, AsciiTable &); + std::map &, AsciiTable &); extern void write_job_aggr_rhist(STATAnalysisJob &, STATLineType, - map &, AsciiTable &); + std::map &, AsciiTable &); extern void write_job_aggr_phist(STATAnalysisJob &, STATLineType, - map &, AsciiTable &); + std::map &, AsciiTable &); extern void write_job_aggr_relp(STATAnalysisJob &, STATLineType, - map &, AsciiTable &); + std::map &, AsciiTable &); extern void write_job_aggr_ssvar(STATAnalysisJob &, STATLineType, - map &, AsciiTable &); + std::map &, AsciiTable &); extern void write_job_aggr_orank(STATAnalysisJob &, STATLineType, - map &, AsciiTable &, + std::map &, AsciiTable &, gsl_rng *); extern void write_job_aggr_isc(STATAnalysisJob &, STATLineType, - map &, AsciiTable &); + std::map &, AsciiTable &); extern void write_job_aggr_mpr(STATAnalysisJob &, STATLineType, - map &, AsciiTable &, + std::map &, AsciiTable &, const char *, gsl_rng *); extern void write_job_aggr_mpr_wind(STATAnalysisJob &, STATLineType, - map &, AsciiTable &); + std::map &, AsciiTable &); extern void write_job_ramp(STATAnalysisJob &, - map &, + std::map &, AsciiTable &, AsciiTable &, AsciiTable &); extern void write_job_ramp_cols(const STATAnalysisJob &, AsciiTable &, @@ -146,9 +145,9 @@ extern void write_job_ss_index(STATAnalysisJob &, //////////////////////////////////////////////////////////////////////// extern void setup_table (AsciiTable &, int, int); -extern void write_table (AsciiTable &, ofstream *); -extern void write_jobstring(const ConcatString &, ofstream *); -extern void write_line (const ConcatString &, ofstream *); +extern void write_table (AsciiTable &, std::ofstream *); +extern void write_jobstring(const ConcatString &, std::ofstream *); +extern void write_line (const ConcatString &, std::ofstream *); //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/core/wavelet_stat/Makefile.am b/src/tools/core/wavelet_stat/Makefile.am index f5c836affd..1f9caafbe3 100644 --- a/src/tools/core/wavelet_stat/Makefile.am +++ b/src/tools/core/wavelet_stat/Makefile.am @@ -34,10 +34,10 @@ wavelet_stat_LDADD = -lvx_pxm \ -lvx_data2d_nccf \ -lvx_statistics \ -lvx_data2d \ + -lvx_seeps \ -lvx_nc_util \ -lvx_regrid \ -lvx_grid \ - -lvx_seeps \ -lvx_config \ -lvx_cal \ -lvx_util_math \ diff --git a/src/tools/core/wavelet_stat/Makefile.in b/src/tools/core/wavelet_stat/Makefile.in index 757c040f8f..86f163f0b8 100644 --- a/src/tools/core/wavelet_stat/Makefile.in +++ b/src/tools/core/wavelet_stat/Makefile.in @@ -341,10 +341,10 @@ wavelet_stat_LDADD = -lvx_pxm \ -lvx_data2d_nccf \ -lvx_statistics \ -lvx_data2d \ + -lvx_seeps \ -lvx_nc_util \ -lvx_regrid \ -lvx_grid \ - -lvx_seeps \ -lvx_config \ -lvx_cal \ -lvx_util_math \ diff --git a/src/tools/core/wavelet_stat/wavelet_stat.cc b/src/tools/core/wavelet_stat/wavelet_stat.cc index fba1cc753d..233f261384 100644 --- a/src/tools/core/wavelet_stat/wavelet_stat.cc +++ b/src/tools/core/wavelet_stat/wavelet_stat.cc @@ -38,6 +38,7 @@ // 013 04/01/19 Fillmore Add FCST and OBS units. // 014 07/09/21 Linden MET #1746 Skip thresholding. // 015 07/06/22 Howard Soh METplus-Internal #19 Rename main to met_main +// 016 10/03/22 Prestopnik MET #2227 Remove using namespace netCDF from header files // //////////////////////////////////////////////////////////////////////// @@ -56,6 +57,9 @@ using namespace std; #include #include +#include +using namespace netCDF; + #include "wavelet_stat.h" #include "vx_statistics.h" diff --git a/src/tools/core/wavelet_stat/wavelet_stat.h b/src/tools/core/wavelet_stat/wavelet_stat.h index c27548cae6..57155d4d8b 100644 --- a/src/tools/core/wavelet_stat/wavelet_stat.h +++ b/src/tools/core/wavelet_stat/wavelet_stat.h @@ -15,6 +15,7 @@ // Mod# Date Name Description // ---- ---- ---- ----------- // 000 11/11/08 Halley Gotway New +// 001 09/28/22 Prestopnik MET #2227 Remove namespace std and netCDF from header files // //////////////////////////////////////////////////////////////////////// @@ -25,8 +26,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -41,7 +40,6 @@ using namespace std; #include #include -using namespace netCDF; #include "wavelet_stat_conf_info.h" @@ -95,30 +93,30 @@ static ConcatString out_dir; // Output NetCDF file static ConcatString out_nc_file; -static NcFile *nc_out = (NcFile *) 0; -static NcDim x_dim ; -static NcDim y_dim ; -static NcDim scale_dim ; -static NcDim tile_dim ; -static NcVar fcst_var ; -static NcVar obs_var ; -static NcVar diff_var ; +static netCDF::NcFile *nc_out = (netCDF::NcFile *) 0; +static netCDF::NcDim x_dim ; +static netCDF::NcDim y_dim ; +static netCDF::NcDim scale_dim ; +static netCDF::NcDim tile_dim ; +static netCDF::NcVar fcst_var ; +static netCDF::NcVar obs_var ; +static netCDF::NcVar diff_var ; // Output PostScript file static ConcatString out_ps_file; static PSfile *ps_out = (PSfile *) 0; // Output STAT file -static ConcatString stat_file; -static ofstream *stat_out = (ofstream *) 0; -static AsciiTable stat_at; -static int i_stat_row; +static ConcatString stat_file; +static std::ofstream *stat_out = (std::ofstream *) 0; +static AsciiTable stat_at; +static int i_stat_row; // Optional ISC output file -static ConcatString isc_file; -static ofstream *isc_out = (ofstream *) 0; -static AsciiTable isc_at; -static int i_isc_row; +static ConcatString isc_file; +static std::ofstream *isc_out = (std::ofstream *) 0; +static AsciiTable isc_at; +static int i_isc_row; //////////////////////////////////////////////////////////////////////// // diff --git a/src/tools/dev_utils/gen_climo_bin.cc b/src/tools/dev_utils/gen_climo_bin.cc index 5983eba9aa..a063fd9df8 100644 --- a/src/tools/dev_utils/gen_climo_bin.cc +++ b/src/tools/dev_utils/gen_climo_bin.cc @@ -15,6 +15,7 @@ // Mod# Date Name Description // ---- ---- ---- ----------- // 000 07/06/22 Howard Soh METplus-Internal #19 Rename main to met_main +// 001 09/29/22 Prestopnik MET #2227 Remove namespace netCDF from header files // //////////////////////////////////////////////////////////////////////// @@ -31,6 +32,9 @@ using namespace std; #include #include +#include +using namespace netCDF; + #include "main.h" #include "vx_util.h" #include "vx_nc_util.h" diff --git a/src/tools/dev_utils/insitu_nc_file.cc b/src/tools/dev_utils/insitu_nc_file.cc index d1bde55beb..db3955924d 100644 --- a/src/tools/dev_utils/insitu_nc_file.cc +++ b/src/tools/dev_utils/insitu_nc_file.cc @@ -20,6 +20,9 @@ using namespace std; #include #include +#include +using namespace netCDF; + #include "vx_math.h" #include "vx_cal.h" #include "vx_log.h" diff --git a/src/tools/dev_utils/insitu_nc_file.h b/src/tools/dev_utils/insitu_nc_file.h index f4b316d344..473dc4af5e 100644 --- a/src/tools/dev_utils/insitu_nc_file.h +++ b/src/tools/dev_utils/insitu_nc_file.h @@ -23,9 +23,6 @@ #include -#include -using namespace netCDF; - #include "vx_grid.h" #include "data_plane.h" #include "long_array.h" @@ -53,7 +50,7 @@ class InsituNcFile { void close(); - NcFile * _ncFile; // allocated + netCDF::NcFile * _ncFile; // allocated long _numRecords; long _currRecord; diff --git a/src/tools/dev_utils/met_nc_file.cc b/src/tools/dev_utils/met_nc_file.cc index 20e11cbeaf..c98c962f37 100644 --- a/src/tools/dev_utils/met_nc_file.cc +++ b/src/tools/dev_utils/met_nc_file.cc @@ -14,6 +14,9 @@ using namespace std; +#include +using namespace netCDF; + #include "vx_log.h" #include "vx_math.h" @@ -101,13 +104,13 @@ bool MetNcFile::readFile(const int desired_grib_code, _nhdrDim = &nhdrDim; _nobsDim = &nobsDim; _strlDim = &strlDim; - + hdrArrVar = get_nc_var(_ncFile, "hdr_arr"); hdrTypeVar = get_nc_var(_ncFile, "hdr_typ"); hdrSidVar = get_nc_var(_ncFile, "hdr_sid"); hdrVldVar = get_nc_var(_ncFile, "hdr_vld"); obsArrVar = get_nc_var(_ncFile, "obs_arr"); - + _hdrArrVar = &hdrArrVar ; _hdrTypeVar = &hdrTypeVar; _hdrSidVar = &hdrSidVar ; @@ -161,16 +164,16 @@ bool MetNcFile::readFile(const int desired_grib_code, // Loop through the observations, saving the ones that we are // interested in - + //int buf_size = ((nobs_count > DEF_NC_BUFFER_SIZE) ? DEF_NC_BUFFER_SIZE : (nobs_count)); int buf_size = obs_count; int hdr_buf_size = hdr_count; - + // // Allocate space to store the data // - + char hdr_typ_str_full[hdr_buf_size][typ_len]; char hdr_sid_str_full[hdr_buf_size][sid_len]; char hdr_vld_str_full[hdr_buf_size][vld_len]; @@ -182,7 +185,7 @@ bool MetNcFile::readFile(const int desired_grib_code, long offsets[2] = { 0, 0 }; long lengths[2] = { 1, 1 }; - + lengths[0] = hdr_buf_size; // @@ -224,10 +227,10 @@ bool MetNcFile::readFile(const int desired_grib_code, << "trouble getting hdr_arr\n\n"; exit(1); } - + //for(int i_start=0; i_start DEF_NC_BUFFER_SIZE) ? DEF_NC_BUFFER_SIZE : (nobs_count-i_start); - + offsets[0] = 0; lengths[0] = buf_size; lengths[1] = obs_arr_len; @@ -243,81 +246,82 @@ bool MetNcFile::readFile(const int desired_grib_code, // mlog << Error << "\nmain() -> trouble getting obs_arr\n\n"; // exit(1); //} - - for (unsigned int i = 0; i < GET_NC_SIZE_P(_nobsDim); ++i) - { - - // Copy the current observation message - for (int k=0; k < obs_arr_len; k++) - obs_arr[k] = obs_arr_block[i][k]; - if (obs_arr[0] >= 1.0E10 && obs_arr[1] >= 1.0E10) - break; + if (OBS_ARRAY_LEN == obs_arr_len) { + for (unsigned int i = 0; i < GET_NC_SIZE_P(_nobsDim); ++i) + { + + // Copy the current observation message + for (int k=0; k < obs_arr_len; k++) + obs_arr[k] = obs_arr_block[i][k]; - // Read the current observation quality flag + if (obs_arr[0] >= 1.0E10 && obs_arr[1] >= 1.0E10) + break; - // Get the header index and variable type for this observation. + // Read the current observation quality flag - int hdr_index = nint(obs_arr[0]); - int grib_code = nint(obs_arr[1]); + // Get the header index and variable type for this observation. - // Check if we want to plot this variable type. + int hdr_index = nint(obs_arr[0]); + int grib_code = nint(obs_arr[1]); - if (grib_code != desired_grib_code) - continue; + // Check if we want to plot this variable type. - // Get the corresponding header message type - // Read the corresponding header array for this observation - for (int k=0; k < obs_arr_len; k++) - hdr_arr[k] = hdr_arr_full[hdr_index][k]; - - int str_length; - char message_type_buffer[max_str_len]; - char station_id_buffer[max_str_len]; - char hdr_vld_buffer[max_str_len]; - // Read the corresponding header type for this observation - str_length = m_strlen(hdr_typ_str_full[hdr_index]); - if (str_length > typ_len) str_length = typ_len; - m_strncpy(message_type_buffer, hdr_typ_str_full[hdr_index], str_length, - method_name.c_str(), "message_type_buffer"); - message_type_buffer[str_length] = bad_data_char; + if (grib_code != desired_grib_code) + continue; - // Read the corresponding header Station ID for this observation - str_length = m_strlen(hdr_sid_str_full[hdr_index]); - if (str_length > sid_len) str_length = sid_len; - m_strncpy(station_id_buffer, hdr_sid_str_full[hdr_index], str_length, - method_name.c_str(), "station_id_buffer"); - station_id_buffer[str_length] = bad_data_char; + // Get the corresponding header message type + // Read the corresponding header array for this observation + for (int k=0; k < hdr_arr_len; k++) + hdr_arr[k] = hdr_arr_full[hdr_index][k]; - // Read the corresponding valid time for this observation - str_length = m_strlen(hdr_vld_str_full[hdr_index]); - if (str_length > vld_len) str_length = vld_len; - m_strncpy(hdr_vld_buffer, hdr_vld_str_full[hdr_index], str_length, - method_name.c_str(), "hdr_vld_buffer"); - hdr_vld_buffer[str_length] = bad_data_char; - + int str_length; + char message_type_buffer[max_str_len]; + char station_id_buffer[max_str_len]; + char hdr_vld_buffer[max_str_len]; + // Read the corresponding header type for this observation + str_length = m_strlen(hdr_typ_str_full[hdr_index]); + if (str_length > typ_len) str_length = typ_len; + m_strncpy(message_type_buffer, hdr_typ_str_full[hdr_index], str_length, + method_name.c_str(), "message_type_buffer"); + message_type_buffer[str_length] = bad_data_char; - string message_type = message_type_buffer; + // Read the corresponding header Station ID for this observation + str_length = m_strlen(hdr_sid_str_full[hdr_index]); + if (str_length > sid_len) str_length = sid_len; + m_strncpy(station_id_buffer, hdr_sid_str_full[hdr_index], str_length, + method_name.c_str(), "station_id_buffer"); + station_id_buffer[str_length] = bad_data_char; - if (message_type != desired_message_type) - continue; + // Read the corresponding valid time for this observation + str_length = m_strlen(hdr_vld_str_full[hdr_index]); + if (str_length > vld_len) str_length = vld_len; + m_strncpy(hdr_vld_buffer, hdr_vld_str_full[hdr_index], str_length, + method_name.c_str(), "hdr_vld_buffer"); + hdr_vld_buffer[str_length] = bad_data_char; - // Get the corresponding header station id - string station_id = station_id_buffer; - if (station_id != desired_station_id) - continue; + string message_type = message_type_buffer; - // Get the corresponding header valid time + if (message_type != desired_message_type) + continue; + // Get the corresponding header station id + string station_id = station_id_buffer; - // If we get here, this is an observation that we want to use + if (station_id != desired_station_id) + continue; - SDObservation obs(hdr_vld_buffer, obs_arr[4]); + // Get the corresponding header valid time - observations.push_back(obs); - } // end for i + // If we get here, this is an observation that we want to use + + SDObservation obs(hdr_vld_buffer, obs_arr[4]); + + observations.push_back(obs); + } // end for i + } // Cleanup if (obs_arr) { delete [] obs_arr; obs_arr = (float *) 0; } diff --git a/src/tools/dev_utils/met_nc_file.h b/src/tools/dev_utils/met_nc_file.h index 0b89cbdf40..81b702e2b9 100644 --- a/src/tools/dev_utils/met_nc_file.h +++ b/src/tools/dev_utils/met_nc_file.h @@ -23,9 +23,6 @@ #include #include -#include -using namespace netCDF; - #include "vx_time_series.h" //////////////////////////////////////////////////////////////////////// @@ -36,14 +33,14 @@ class MetNcFile public: - MetNcFile(const string &file_path); + MetNcFile(const std::string &file_path); virtual ~MetNcFile(); bool readFile(const int desired_grib_code, - const string &desired_station_id, - const string &desired_message_type, - vector< SDObservation > &observations); + const std::string &desired_station_id, + const std::string &desired_message_type, + std::vector< SDObservation > &observations); protected: @@ -52,34 +49,34 @@ class MetNcFile // Protected members // /////////////////////// - string _filePath; + std::string _filePath; - NcFile *_ncFile; - - NcDim *_hdrArrDim; - NcDim *_obsArrDim; - NcDim *_nhdrDim; - NcDim *_nobsDim; - NcDim *_strlDim; - - NcDim hdrArrDim; - NcDim obsArrDim; - NcDim nhdrDim; - NcDim nobsDim; - NcDim strlDim; - NcDim strllDim; - - NcVar *_hdrArrVar; - NcVar *_hdrTypeVar; - NcVar *_hdrSidVar; - NcVar *_hdrVldVar; - NcVar *_obsArrVar; + netCDF::NcFile *_ncFile; + + netCDF::NcDim *_hdrArrDim; + netCDF::NcDim *_obsArrDim; + netCDF::NcDim *_nhdrDim; + netCDF::NcDim *_nobsDim; + netCDF::NcDim *_strlDim; + + netCDF::NcDim hdrArrDim; + netCDF::NcDim obsArrDim; + netCDF::NcDim nhdrDim; + netCDF::NcDim nobsDim; + netCDF::NcDim strlDim; + netCDF::NcDim strllDim; + + netCDF::NcVar *_hdrArrVar; + netCDF::NcVar *_hdrTypeVar; + netCDF::NcVar *_hdrSidVar; + netCDF::NcVar *_hdrVldVar; + netCDF::NcVar *_obsArrVar; - NcVar hdrArrVar; - NcVar hdrTypeVar; - NcVar hdrSidVar; - NcVar hdrVldVar; - NcVar obsArrVar; + netCDF::NcVar hdrArrVar; + netCDF::NcVar hdrTypeVar; + netCDF::NcVar hdrSidVar; + netCDF::NcVar hdrVldVar; + netCDF::NcVar obsArrVar; /////////////////////// // Protected methods // diff --git a/src/tools/dev_utils/nceptab_to_flat.cc b/src/tools/dev_utils/nceptab_to_flat.cc index 5c9934e163..73c48ca14a 100644 --- a/src/tools/dev_utils/nceptab_to_flat.cc +++ b/src/tools/dev_utils/nceptab_to_flat.cc @@ -9,6 +9,9 @@ //////////////////////////////////////////////////////////////////////// +using namespace std; + +//////////////////////////////////////////////////////////////////////// // // Takes a bunch of C source files from the wgrib code diff --git a/src/tools/dev_utils/pbtime.cc b/src/tools/dev_utils/pbtime.cc index ec3bcc4517..6d2c49a001 100644 --- a/src/tools/dev_utils/pbtime.cc +++ b/src/tools/dev_utils/pbtime.cc @@ -15,9 +15,12 @@ // Mod# Date Name Description // ---- ---- ---- ----------- // 000 07/06/22 Howard Soh METplus-Internal #19 Rename main to met_main +// 001 09/28/22 Prestopnik MET #2227 Remove namespace std from header files // //////////////////////////////////////////////////////////////////////// +using namespace std; + #include #include #include diff --git a/src/tools/dev_utils/reformat_county_data.cc b/src/tools/dev_utils/reformat_county_data.cc index a81f84dfa6..fb563b9ad8 100644 --- a/src/tools/dev_utils/reformat_county_data.cc +++ b/src/tools/dev_utils/reformat_county_data.cc @@ -9,6 +9,7 @@ //////////////////////////////////////////////////////////////////////// +using namespace std; #include #include diff --git a/src/tools/dev_utils/reformat_map_data.cc b/src/tools/dev_utils/reformat_map_data.cc index ce0eb1a631..f87be38ea9 100644 --- a/src/tools/dev_utils/reformat_map_data.cc +++ b/src/tools/dev_utils/reformat_map_data.cc @@ -9,6 +9,7 @@ //////////////////////////////////////////////////////////////////////// +using namespace std; #include #include diff --git a/src/tools/dev_utils/swinging_door.cc b/src/tools/dev_utils/swinging_door.cc index c38032dc30..49bc48657c 100644 --- a/src/tools/dev_utils/swinging_door.cc +++ b/src/tools/dev_utils/swinging_door.cc @@ -18,10 +18,13 @@ // ---- ---- ---- ----------- // 000 08-19-14 Rehak New // 001 04-27-154 Halley Gotway List and format output files -// 002 07/06/22 Howard Soh METplus-Internal #19 Rename main to met_main +// 002 07-06-22 Howard Soh METplus-Internal #19 Rename main to met_main +// 003 09-12-22 Prestopnik MET #2227 Remove namespace std from header files // //////////////////////////////////////////////////////////////////////// +using namespace std; + #include #include #include diff --git a/src/tools/other/ascii2nc/Makefile.am b/src/tools/other/ascii2nc/Makefile.am index 09e7b76179..1e0d1693eb 100644 --- a/src/tools/other/ascii2nc/Makefile.am +++ b/src/tools/other/ascii2nc/Makefile.am @@ -25,6 +25,8 @@ ascii2nc_SOURCES = ascii2nc.cc \ surfrad_handler.cc surfrad_handler.h \ wwsis_handler.cc wwsis_handler.h \ airnow_handler.cc airnow_handler.h \ + ndbc_handler.cc ndbc_handler.h \ + ndbc_locations.cc ndbc_locations.h \ airnow_locations.cc airnow_locations.h \ aeronet_handler.cc aeronet_handler.h $(OPT_PYTHON_SOURCES) diff --git a/src/tools/other/ascii2nc/Makefile.in b/src/tools/other/ascii2nc/Makefile.in index d4b3ddbdd4..c4610b6d10 100644 --- a/src/tools/other/ascii2nc/Makefile.in +++ b/src/tools/other/ascii2nc/Makefile.in @@ -107,9 +107,10 @@ am__ascii2nc_SOURCES_DIST = ascii2nc.cc ascii2nc_conf_info.cc \ little_r_handler.cc little_r_handler.h met_handler.cc \ met_handler.h surfrad_handler.cc surfrad_handler.h \ wwsis_handler.cc wwsis_handler.h airnow_handler.cc \ - airnow_handler.h airnow_locations.cc airnow_locations.h \ - aeronet_handler.cc aeronet_handler.h python_handler.h \ - python_handler.cc + airnow_handler.h ndbc_handler.cc ndbc_handler.h \ + ndbc_locations.cc ndbc_locations.h airnow_locations.cc \ + airnow_locations.h aeronet_handler.cc aeronet_handler.h \ + python_handler.h python_handler.cc @ENABLE_PYTHON_TRUE@am__objects_1 = ascii2nc-python_handler.$(OBJEXT) am__objects_2 = $(am__objects_1) am_ascii2nc_OBJECTS = ascii2nc-ascii2nc.$(OBJEXT) \ @@ -120,6 +121,8 @@ am_ascii2nc_OBJECTS = ascii2nc-ascii2nc.$(OBJEXT) \ ascii2nc-surfrad_handler.$(OBJEXT) \ ascii2nc-wwsis_handler.$(OBJEXT) \ ascii2nc-airnow_handler.$(OBJEXT) \ + ascii2nc-ndbc_handler.$(OBJEXT) \ + ascii2nc-ndbc_locations.$(OBJEXT) \ ascii2nc-airnow_locations.$(OBJEXT) \ ascii2nc-aeronet_handler.$(OBJEXT) $(am__objects_2) ascii2nc_OBJECTS = $(am_ascii2nc_OBJECTS) @@ -151,6 +154,8 @@ am__depfiles_remade = ./$(DEPDIR)/ascii2nc-aeronet_handler.Po \ ./$(DEPDIR)/ascii2nc-file_handler.Po \ ./$(DEPDIR)/ascii2nc-little_r_handler.Po \ ./$(DEPDIR)/ascii2nc-met_handler.Po \ + ./$(DEPDIR)/ascii2nc-ndbc_handler.Po \ + ./$(DEPDIR)/ascii2nc-ndbc_locations.Po \ ./$(DEPDIR)/ascii2nc-python_handler.Po \ ./$(DEPDIR)/ascii2nc-surfrad_handler.Po \ ./$(DEPDIR)/ascii2nc-wwsis_handler.Po @@ -366,6 +371,8 @@ ascii2nc_SOURCES = ascii2nc.cc \ surfrad_handler.cc surfrad_handler.h \ wwsis_handler.cc wwsis_handler.h \ airnow_handler.cc airnow_handler.h \ + ndbc_handler.cc ndbc_handler.h \ + ndbc_locations.cc ndbc_locations.h \ airnow_locations.cc airnow_locations.h \ aeronet_handler.cc aeronet_handler.h $(OPT_PYTHON_SOURCES) @@ -493,6 +500,8 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ascii2nc-file_handler.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ascii2nc-little_r_handler.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ascii2nc-met_handler.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ascii2nc-ndbc_handler.Po@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ascii2nc-ndbc_locations.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ascii2nc-python_handler.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ascii2nc-surfrad_handler.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ascii2nc-wwsis_handler.Po@am__quote@ # am--include-marker @@ -629,6 +638,34 @@ ascii2nc-airnow_handler.obj: airnow_handler.cc @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ascii2nc_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ascii2nc-airnow_handler.obj `if test -f 'airnow_handler.cc'; then $(CYGPATH_W) 'airnow_handler.cc'; else $(CYGPATH_W) '$(srcdir)/airnow_handler.cc'; fi` +ascii2nc-ndbc_handler.o: ndbc_handler.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ascii2nc_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ascii2nc-ndbc_handler.o -MD -MP -MF $(DEPDIR)/ascii2nc-ndbc_handler.Tpo -c -o ascii2nc-ndbc_handler.o `test -f 'ndbc_handler.cc' || echo '$(srcdir)/'`ndbc_handler.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/ascii2nc-ndbc_handler.Tpo $(DEPDIR)/ascii2nc-ndbc_handler.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='ndbc_handler.cc' object='ascii2nc-ndbc_handler.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ascii2nc_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ascii2nc-ndbc_handler.o `test -f 'ndbc_handler.cc' || echo '$(srcdir)/'`ndbc_handler.cc + +ascii2nc-ndbc_handler.obj: ndbc_handler.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ascii2nc_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ascii2nc-ndbc_handler.obj -MD -MP -MF $(DEPDIR)/ascii2nc-ndbc_handler.Tpo -c -o ascii2nc-ndbc_handler.obj `if test -f 'ndbc_handler.cc'; then $(CYGPATH_W) 'ndbc_handler.cc'; else $(CYGPATH_W) '$(srcdir)/ndbc_handler.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/ascii2nc-ndbc_handler.Tpo $(DEPDIR)/ascii2nc-ndbc_handler.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='ndbc_handler.cc' object='ascii2nc-ndbc_handler.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ascii2nc_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ascii2nc-ndbc_handler.obj `if test -f 'ndbc_handler.cc'; then $(CYGPATH_W) 'ndbc_handler.cc'; else $(CYGPATH_W) '$(srcdir)/ndbc_handler.cc'; fi` + +ascii2nc-ndbc_locations.o: ndbc_locations.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ascii2nc_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ascii2nc-ndbc_locations.o -MD -MP -MF $(DEPDIR)/ascii2nc-ndbc_locations.Tpo -c -o ascii2nc-ndbc_locations.o `test -f 'ndbc_locations.cc' || echo '$(srcdir)/'`ndbc_locations.cc +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/ascii2nc-ndbc_locations.Tpo $(DEPDIR)/ascii2nc-ndbc_locations.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='ndbc_locations.cc' object='ascii2nc-ndbc_locations.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ascii2nc_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ascii2nc-ndbc_locations.o `test -f 'ndbc_locations.cc' || echo '$(srcdir)/'`ndbc_locations.cc + +ascii2nc-ndbc_locations.obj: ndbc_locations.cc +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ascii2nc_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ascii2nc-ndbc_locations.obj -MD -MP -MF $(DEPDIR)/ascii2nc-ndbc_locations.Tpo -c -o ascii2nc-ndbc_locations.obj `if test -f 'ndbc_locations.cc'; then $(CYGPATH_W) 'ndbc_locations.cc'; else $(CYGPATH_W) '$(srcdir)/ndbc_locations.cc'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/ascii2nc-ndbc_locations.Tpo $(DEPDIR)/ascii2nc-ndbc_locations.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='ndbc_locations.cc' object='ascii2nc-ndbc_locations.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ascii2nc_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ascii2nc-ndbc_locations.obj `if test -f 'ndbc_locations.cc'; then $(CYGPATH_W) 'ndbc_locations.cc'; else $(CYGPATH_W) '$(srcdir)/ndbc_locations.cc'; fi` + ascii2nc-airnow_locations.o: airnow_locations.cc @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ascii2nc_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ascii2nc-airnow_locations.o -MD -MP -MF $(DEPDIR)/ascii2nc-airnow_locations.Tpo -c -o ascii2nc-airnow_locations.o `test -f 'airnow_locations.cc' || echo '$(srcdir)/'`airnow_locations.cc @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/ascii2nc-airnow_locations.Tpo $(DEPDIR)/ascii2nc-airnow_locations.Po @@ -807,6 +844,8 @@ distclean: distclean-am -rm -f ./$(DEPDIR)/ascii2nc-file_handler.Po -rm -f ./$(DEPDIR)/ascii2nc-little_r_handler.Po -rm -f ./$(DEPDIR)/ascii2nc-met_handler.Po + -rm -f ./$(DEPDIR)/ascii2nc-ndbc_handler.Po + -rm -f ./$(DEPDIR)/ascii2nc-ndbc_locations.Po -rm -f ./$(DEPDIR)/ascii2nc-python_handler.Po -rm -f ./$(DEPDIR)/ascii2nc-surfrad_handler.Po -rm -f ./$(DEPDIR)/ascii2nc-wwsis_handler.Po @@ -863,6 +902,8 @@ maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/ascii2nc-file_handler.Po -rm -f ./$(DEPDIR)/ascii2nc-little_r_handler.Po -rm -f ./$(DEPDIR)/ascii2nc-met_handler.Po + -rm -f ./$(DEPDIR)/ascii2nc-ndbc_handler.Po + -rm -f ./$(DEPDIR)/ascii2nc-ndbc_locations.Po -rm -f ./$(DEPDIR)/ascii2nc-python_handler.Po -rm -f ./$(DEPDIR)/ascii2nc-surfrad_handler.Po -rm -f ./$(DEPDIR)/ascii2nc-wwsis_handler.Po diff --git a/src/tools/other/ascii2nc/airnow_locations.cc b/src/tools/other/ascii2nc/airnow_locations.cc index 0435ad8281..10810c8727 100644 --- a/src/tools/other/ascii2nc/airnow_locations.cc +++ b/src/tools/other/ascii2nc/airnow_locations.cc @@ -12,7 +12,6 @@ using namespace std; - #include #include #include @@ -103,7 +102,7 @@ bool AirnowLocations::initialize(const string &fileName) // assume the full aqsid are unique compared to the non-full simple aqsid or even the station id // look for the 'full' - std::vector::const_iterator it; + vector::const_iterator it; it = find(monitoringSiteFullAqsid.begin(), monitoringSiteFullAqsid.end(), fullaqsid); if (it == monitoringSiteFullAqsid.end()) { monitoringSiteAqsid.push_back(aqsid); diff --git a/src/tools/other/ascii2nc/ascii2nc.cc b/src/tools/other/ascii2nc/ascii2nc.cc index e1be8ba119..e55753ca23 100644 --- a/src/tools/other/ascii2nc/ascii2nc.cc +++ b/src/tools/other/ascii2nc/ascii2nc.cc @@ -46,10 +46,14 @@ // 018 03-01-21 Fillmore Replace pickle files for temporary // ascii. // 019 07/06/22 Howard Soh METplus-Internal #19 Rename main to met_main -// 020 08/26/22 Dave Albo Add AirNow observations. +// 020 08/26/22 Dave Albo MET #2142 Add AirNow observations +// 021 10/03/22 Prestopnik MET #2227 Remove using namespace std from header files +// 022 10/07/22 Dave Albo MET #2276 Add NDBC Buoy data // //////////////////////////////////////////////////////////////////////// +using namespace std; + #include #include #include @@ -81,6 +85,7 @@ #include "wwsis_handler.h" #include "aeronet_handler.h" #include "airnow_handler.h" +#include "ndbc_handler.h" #ifdef ENABLE_PYTHON #include "global_python.h" @@ -107,6 +112,7 @@ enum ASCIIFormat { ASCIIFormat_Airnow_dailyv2, ASCIIFormat_Airnow_hourlyaqobs, ASCIIFormat_Airnow_hourly, + ASCIIFormat_NDBC_standard, ASCIIFormat_Aeronet_v2, ASCIIFormat_Aeronet_v3, ASCIIFormat_Python, @@ -150,6 +156,7 @@ static void setup_wrapper_path(); int met_main(int argc, char *argv[]) { CommandLine cline; + // // Check for zero arguments // @@ -309,6 +316,12 @@ FileHandler *create_file_handler(const ASCIIFormat format, const ConcatString &a return((FileHandler *) handler); } + case ASCIIFormat_NDBC_standard: { + NdbcHandler *handler = new NdbcHandler(program_name); + handler->setFormatVersion(NdbcHandler::NDBC_FORMAT_VERSION_STANDARD); + return((FileHandler *) handler); + } + case ASCIIFormat_Aeronet_v2: { AeronetHandler *handler = new AeronetHandler(program_name); handler->setFormatVersion(2); @@ -434,6 +447,19 @@ FileHandler *determine_ascii_format(const ConcatString &ascii_filename) { delete airnow_file; + // + // See if this is an NDBC file. + // + f_in.rewind(); + NdbcHandler *ndbc_file = new NdbcHandler(program_name); + + if(ndbc_file->isFileType(f_in)) { + f_in.close(); + return((FileHandler *) ndbc_file); + } + + delete ndbc_file; + // // If we get here, we didn't recognize the file contents. // @@ -480,6 +506,7 @@ void usage() { << AirnowHandler::getFormatStringDailyV2() << "\", \"" << AirnowHandler::getFormatStringHourlyAqObs() << "\", \"" << AirnowHandler::getFormatStringHourly() << "\", \"" + << NdbcHandler::getFormatStringStandard() << "\", \"" << AeronetHandler::getFormatString() << "\", \"" << AeronetHandler::getFormatString_v2() << "\", \"" << AeronetHandler::getFormatString_v3() << "\""; @@ -559,6 +586,9 @@ void set_format(const StringArray & a) { else if(AirnowHandler::getFormatStringHourly() == a[0]) { ascii_format = ASCIIFormat_Airnow_hourly; } + else if(NdbcHandler::getFormatStringStandard() == a[0]) { + ascii_format = ASCIIFormat_NDBC_standard; + } else if(AeronetHandler::getFormatString() == a[0] || AeronetHandler::getFormatString_v2() == a[0]) { ascii_format = ASCIIFormat_Aeronet_v2; diff --git a/src/tools/other/ascii2nc/file_handler.cc b/src/tools/other/ascii2nc/file_handler.cc index 9be6e86495..492398c89b 100644 --- a/src/tools/other/ascii2nc/file_handler.cc +++ b/src/tools/other/ascii2nc/file_handler.cc @@ -15,6 +15,9 @@ using namespace std; #include #include +#include +using namespace netCDF; + #include "vx_math.h" #include "vx_nc_util.h" diff --git a/src/tools/other/ascii2nc/file_handler.h b/src/tools/other/ascii2nc/file_handler.h index 092fd0340a..495705b803 100644 --- a/src/tools/other/ascii2nc/file_handler.h +++ b/src/tools/other/ascii2nc/file_handler.h @@ -23,7 +23,6 @@ #include #include -using namespace netCDF; #include "mask_poly.h" #include "vx_grid.h" @@ -85,7 +84,7 @@ class FileHandler // Variables for writing output NetCDF file - NcFile *_ncFile; + netCDF::NcFile *_ncFile; MetNcPointObsOut nc_point_obs; long _nhdr; diff --git a/src/tools/other/ascii2nc/ndbc_handler.cc b/src/tools/other/ascii2nc/ndbc_handler.cc new file mode 100644 index 0000000000..f76df3c4d8 --- /dev/null +++ b/src/tools/other/ascii2nc/ndbc_handler.cc @@ -0,0 +1,501 @@ +// *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* +// ** Copyright UCAR (c) 1992 - 2022 +// ** 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 +// *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* + + +//////////////////////////////////////////////////////////////////////// + + +using namespace std; + + +#include +#include +#include +#include +#include + +#include "vx_log.h" +#include "vx_math.h" +#include "vx_util.h" + +#include "ndbc_handler.h" + +static const char *stations_env = "MET_NDBC_STATIONS"; + +const int NdbcHandler::NDBC_FORMAT_VERSION_STANDARD = 1; +const int NdbcHandler::NDBC_FORMAT_VERSION_UNKNOWN= -1; + +const int NdbcHandler::NUM_COLS_STANDARD = 19; +const int NdbcHandler::NUM_DATA_COLS_STANDARD = 14; + +// Time related header values +const string hdr_year = "#YY"; +const string hdr_month = "MM"; +const string hdr_day = "DD"; +const string hdr_hour = "hh"; +const string hdr_minute = "mm"; + +// Data related header values +const string hdr_wind_dir = "WDIR"; +const string hdr_wind_speed = "WSPD"; +const string hdr_gust_speed = "GST"; +const string hdr_wave_height = "WVHT"; +const string hdr_dominant_wave_period = "DPD"; +const string hdr_average_wave_period = "APD"; +const string hdr_dominant_wave_direction = "MWD"; +const string hdr_sea_level_pressure = "PRES"; +const string hdr_air_temp = "ATMP"; +const string hdr_sea_surface_temp = "WTMP"; +const string hdr_dewpoint = "DEWP"; +const string hdr_visibility = "VIS"; +const string hdr_pressure_tendency = "PTDY"; +const string hdr_tide = "TIDE"; + +//////////////////////////////////////////////////////////////////////// + + +// +// Code for class NdbcHandler +// + + +//////////////////////////////////////////////////////////////////////// + + +NdbcHandler::NdbcHandler(const string &program_name) : + FileHandler(program_name) +{ + use_var_id = true; + format_version = NDBC_FORMAT_VERSION_UNKNOWN; + + ConcatString fname; + + // + // search for MET_NDBC_STATIONS environment variable + // if not defined, use a hardwired value + // + if(get_env(stations_env, fname)) { + locationsFileName = fname; + } else { + locationsFileName = "MET_BASE/table_files/ndbc_stations.xml"; + } + + // read in and parse the locations file + if (!locations.initialize(locationsFileName)) { + mlog << Error << "\ncould not initialize station loations file\n\n"; + exit(1); + } + //locations.print(); + + // + // store column info for all the data columns (column names) + // NOTE these will be used as index values in the observations + // 0 = wind dir, 1 = wind speed, etc. + // + column.push_back(Column(hdr_wind_dir)); + column.push_back(Column(hdr_wind_speed)); + column.push_back(Column(hdr_gust_speed)); + column.push_back(Column(hdr_wave_height)); + column.push_back(Column(hdr_dominant_wave_period)); + column.push_back(Column(hdr_average_wave_period)); + column.push_back(Column(hdr_dominant_wave_direction)); + column.push_back(Column(hdr_sea_level_pressure)); + column.push_back(Column(hdr_air_temp)); + column.push_back(Column(hdr_sea_surface_temp)); + column.push_back(Column(hdr_dewpoint)); + column.push_back(Column(hdr_visibility)); + column.push_back(Column(hdr_pressure_tendency)); + column.push_back(Column(hdr_tide)); + + numMissingStations = 0; +} + +//////////////////////////////////////////////////////////////////////// + + +NdbcHandler::~NdbcHandler() +{ + mlog << Debug(1) << "Number of NDBC skipped files due to no lookup " << numMissingStations + << "\n"; +} + + +//////////////////////////////////////////////////////////////////////// + + +bool NdbcHandler::isFileType(LineDataFile &ascii_file) const +{ + // + // Initialize the return value. + // + bool is_file_type = false; + + // + // Read the first line from the file. + // which should be the header + // + DataLine dl; + dl.set_delimiter(" "); + ascii_file >> dl; + string line = dl.get_line(); + ConcatString cstring(line); + + // see if it fits the NDBC standard, the header line has the same + // number of columns as everything else + StringArray tokens = cstring.split(" "); + if (NUM_COLS_STANDARD == tokens.n_elements()) { + // look at the first token it should be #YY + if (tokens[0] == "#YY") { + is_file_type = true; + return is_file_type; + } + } + return is_file_type; +} + + +//////////////////////////////////////////////////////////////////////// + + +void NdbcHandler::setFormatVersion(int version) { + + format_version = version; +} + +//////////////////////////////////////////////////////////////////////// +// Private/Protected methods +//////////////////////////////////////////////////////////////////////// + +bool NdbcHandler::_readObservations(LineDataFile &ascii_file) +{ + + DataLine data_line; + string method_name = "NdbcHandler::_readObservations() "; + + if (format_version == NDBC_FORMAT_VERSION_UNKNOWN) { + // try to figure out which one it is and set it + if (!_determineFileType(ascii_file)) { + return false; + } + } + + if (!_readHeaderInfo(ascii_file)) + return false; + + string fname = ascii_file.filename(); + // parse this name to set the station id, and use that to set up the lat/lon/elev + if (!_setStationInfo(fname)) { + numMissingStations++; + return true; + } + + // + // Process the observation lines + // + int bad_line_count = 0; + data_line.set_delimiter(" "); + + // skip the next line which is also a header + // (can pull out units if we want) + ascii_file >> data_line; + + while (ascii_file >> data_line) { + if (!_parseObservationLineStandard(data_line, ascii_file.filename())) { + bad_line_count++; + } + } + return true; +} + +//////////////////////////////////////////////////////////////////////// + +bool NdbcHandler::_parseObservationLineStandard(DataLine &data_line, + const string &filename) +{ + string method_name = "NdbcHandler::_parseObservationLineStandard() "; + + if (format_version != NDBC_FORMAT_VERSION_STANDARD) { + mlog << Error << "\n" << method_name << "->" + << "Standard NDBC format is the only supported format\n\n"; + return false; + } + + // + // Make sure that the line contains the correct number of tokens + // + if (data_line.n_items() != NUM_COLS_STANDARD) { + mlog << Error << "\n" << method_name << "-> " + << "line number " << data_line.line_number() + << " does not have the correct number of columns " << data_line.n_items() + << " (" << NUM_COLS_STANDARD << "). Skipping this line in \"" + << filename << "\".\n\n"; + return false; + } + + // + // extract the time information + // + time_t valid_time = _getValidTime(data_line); + if (valid_time == 0) { + mlog << Error << "\n" << method_name << "-> " + << "line number " << data_line.line_number() + << " time could not be parsed, skipping this line in \"" + << filename << "\".\n\n"; + return false; + } + + string quality_flag = na_str; + int grib_code = 0; + double pressure_level_hpa = bad_data_double; + double height_m = stationAlt; + string header_type = "NDBC_STANDARD"; + + double value; + string name; + for (size_t i=0; i.txt as the name + i0 = fname.find(".txt"); + if (i0 == string::npos) { + mlog << Error << "\n" << "expect file name of format '.txt'\n" + << "Got " << fname << "\n\n"; + return false; + } + stationId = fname.substr(0, i0); + if (!locations.lookupLatLonElev(stationId, stationLat, stationLon, + stationAlt)) { + mlog << Error << "\n" << "No location information found for station " + << stationId << " do not process file " << filename << "\n\n"; + return false; + } + return true; +} + +//////////////////////////////////////////////////////////////////////// + +bool NdbcHandler::_determineFileType(LineDataFile &ascii_file) +{ + // + // Read the first line from the file. + // + DataLine dl; + dl.set_delimiter(" "); + ascii_file >> dl; + ascii_file.rewind(); + string line = dl.get_line(); + ConcatString cstring(line); + + StringArray tokens = cstring.split(" "); + if (NUM_COLS_STANDARD == tokens.n_elements()) { + if (tokens[0] == "#YY") { + format_version = NDBC_FORMAT_VERSION_STANDARD; + return true; + } + } + format_version = NDBC_FORMAT_VERSION_UNKNOWN; + mlog << Error << "\nNdbcHandler::_determineFileType -> " + << "Unknown file type\n\n"; + return false; +} + +//////////////////////////////////////////////////////////////////////// + +time_t NdbcHandler::_getValidTime(const DataLine &data_line) const +{ + // + // Pull out the date information + // + if (column_pointer_year < 0 || column_pointer_month < 0 || column_pointer_day < 0 || + column_pointer_hour < 0 || column_pointer_minute < 0) { + mlog << Error << "\nNdbcHandler::_getValidTime -> " + << "Not all time related column pointers are set\n\n"; + return 0; + } + string year = _extractColumn(data_line, column_pointer_year); + string month = _extractColumn(data_line, column_pointer_month); + string day = _extractColumn(data_line, column_pointer_day); + string hour = _extractColumn(data_line, column_pointer_hour); + string min = _extractColumn(data_line, column_pointer_minute); + string sec = "00"; + + if (year.size() == 2) { + // assume it's at least the year 2000 and this is the last 2 digits + // (really should look at file name). This will work till 2099 if + // assumptions are true + year = "20" + year; + } + + // + // Set up the time structure + // + struct tm time_struct; + memset(&time_struct, 0, sizeof(time_struct)); + + time_struct.tm_year = atoi(year.c_str()) -1900; + time_struct.tm_mon = atoi(month.c_str()) - 1; + time_struct.tm_mday = atoi(day.c_str()); + time_struct.tm_hour = atoi(hour.c_str()); + time_struct.tm_min = atoi(min.c_str()); + time_struct.tm_sec = atoi(sec.c_str()); + return timegm(&time_struct); +} + +//////////////////////////////////////////////////////////////////////// + +bool NdbcHandler::_readHeaderInfo(LineDataFile &ascii_file) +{ + // initialize all pointers to not set + column_pointer_year = -1; + column_pointer_month = -1; + column_pointer_day = -1; + column_pointer_hour = -1; + column_pointer_minute = -1; + for (size_t i=0; i> data_line)) { + mlog << Error << "\nNdbcHandler::_readHeaderInfo() -> " + << "error reading header line from input ASCII file \"" + << ascii_file.filename() << "\"\n\n"; + return false; + } + + // + // Check for the correct number of columns in the header line + // + if (data_line.n_items() != NUM_COLS_STANDARD) { + mlog << Error << "\nNdbcHandler::_readHeaderInfo() -> " + << "NDBC file has incorrect number of columns (" + << data_line.n_items() << ") in header line\n\n"; + return false; + } + + // + // look at each column, attempt to match to what we want and store column index + // + bool status = true; + for (int i=0; i " + << "NDBC file has unknown header item " << s << "\n\n"; + status = false; + } + } + } + if (column_pointer_year == -1 || column_pointer_month == -1 || + column_pointer_day == -1 || column_pointer_hour == -1 || + column_pointer_minute == -1) { + mlog << Error << "\nNdbcHandler::_readHeaderInfo() -> " + << "NDBC file did not have all time fields in header \n\n"; + status = false; + } + for (size_t j=0; j " + << "NDBC file did not have all expected fields in header \n\n"; + status = false; + break; + } + } + + return status; +} + +//////////////////////////////////////////////////////////////////////// + +string NdbcHandler::_extractColumn(const DataLine &data_line, int ptr) const +{ + string c = data_line[ptr]; + // if you see a '\r' at the end remove that + std::size_t i1 = c.find_last_of("\r"); + if (i1 == string::npos) { + return c; + } + return c.substr(0, i1-1); +} + +//////////////////////////////////////////////////////////////////////// + +double NdbcHandler::_extractDouble(const DataLine &data_line, int ptr) const +{ + string c = _extractColumn(data_line, ptr); + // 'MM' is missing, but also need to guess which '99' containing values + // should be missing, based on documentation here: + // https://www.ndbc.noaa.gov/measdes.shtml + // which suggests 'anything with only 9s is missing data' + if (c == "MM" || + c == "99" || c == "99.0" || + c == "999" || c == "999.0" || + c == "9999" || c == "9999.0" || + c == "99999" || c == "99999.0" || + c == "999999" || c == "999999.0" || + c == "9999999" ||c == "9999999.0" || + c == "-99" || c == "-99.0" || + c == "-999" || c == "-999.0" || + c == "-9999" || c == "-9999.0" || + c == "-99999" || c == "-99999.0" || + c == "-999999" || c == "-999999.0" || + c == "-9999999" ||c == "-9999999.0") { + return bad_data_double; + } + + double value = atof(c.c_str()); + return value; +} diff --git a/src/tools/other/ascii2nc/ndbc_handler.h b/src/tools/other/ascii2nc/ndbc_handler.h new file mode 100644 index 0000000000..56795dce27 --- /dev/null +++ b/src/tools/other/ascii2nc/ndbc_handler.h @@ -0,0 +1,170 @@ +// *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* +// ** Copyright UCAR (c) 1992 - 2022 +// ** 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 __NDBCHANDLER_H__ +#define __NDBCHANDLER_H__ + + +//////////////////////////////////////////////////////////////////////// + + +#include +#include +#include + +#include "file_handler.h" +#include "ndbc_locations.h" + + +//////////////////////////////////////////////////////////////////////// + + +class NdbcHandler : public FileHandler +{ +private: + // + // private simple class, storage for column header names and pointers to a column + // (in case the order ever changes, this handles that possibility) + // + class Column + { + public: + string name; // name of the header as found in the file + int ptr; // column index for that data (0,1,..) + inline Column(const string &n) : name(n), ptr(-1) {} + inline ~Column() {} + inline void clear(void) {ptr = -1;} + inline bool nameEquals(const string &s) const {return name == s;} + inline void setPtr(int ipt) {ptr = ipt;} + inline bool notSet(void) const {return ptr == -1;} + }; + + +public: + + NdbcHandler(const string &program_name); + virtual ~NdbcHandler(); + + virtual bool isFileType(LineDataFile &ascii_file) const; + + void setFormatVersion(int version); + + static string getFormatStringStandard() + { + return "ndbc_standard"; + } + + ///////////////////////// + // Protected constants // + ///////////////////////// + + // + // The format versions map to integers (only 1 so far) + // + static const int NDBC_FORMAT_VERSION_STANDARD; + static const int NDBC_FORMAT_VERSION_UNKNOWN; + + // + // Number of columns expected + // + static const int NUM_COLS_STANDARD; + + // + // Number of columns not time related + // + static const int NUM_DATA_COLS_STANDARD; + +protected: + + ///////////////////////// + // Protected constants // + ///////////////////////// + + // + // Unchanging header information for a file (each file is one station) + // + string stationId; + double stationLat; + double stationLon; + double stationAlt; + + int format_version; + + // column pointers set in real time for time information + int column_pointer_year; + int column_pointer_month; + int column_pointer_day; + int column_pointer_hour; + int column_pointer_minute; + + // storage for non time column information (name/pointer) + vector column; + + // the lookup file for location information + string locationsFileName; + + // the lookup object + NdbcLocations locations; + + // a count of how many stations were not in the lookup file + int numMissingStations; + + /////////////////////// + // Protected methods // + /////////////////////// + + // + // parse the file name to identify the station, then lookup and set the + // location + // + bool _setStationInfo(const string &filename); + + // Read and save the header information from the given file, The file pointer + // is assumed to be at the beginning of the file. Sets all the pointers based + // on what is in the header line + bool _readHeaderInfo(LineDataFile &ascii_file); + + bool _determineFileType(LineDataFile &ascii_file); + + + // + // Get the observation valid time from the given observation line + // + time_t _getValidTime(const DataLine &data_line) const; + + + // Read the observations from the given file and add them to the + // _observations vector. + + virtual bool _readObservations(LineDataFile &ascii_file); + + // + // parse one line from the ascii file and add to observations + + bool _parseObservationLineStandard(DataLine &data_line, + const string &filename); + + string _extractColumn(const DataLine &data_line, int ptr) const; + double _extractDouble(const DataLine &data_line, int ptr) const; + +}; + + +//////////////////////////////////////////////////////////////////////// + + +#endif /* __NDBC_HANDLER_H */ + + +//////////////////////////////////////////////////////////////////////// + + diff --git a/src/tools/other/ascii2nc/ndbc_locations.cc b/src/tools/other/ascii2nc/ndbc_locations.cc new file mode 100644 index 0000000000..121aa3aacd --- /dev/null +++ b/src/tools/other/ascii2nc/ndbc_locations.cc @@ -0,0 +1,182 @@ +// *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* +// ** Copyright UCAR (c) 1992 - 2022 +// ** 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 +// *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* + + +//////////////////////////////////////////////////////////////////////// + + +using namespace std; + + +#include +#include +#include +#include +#include + +#include "vx_log.h" +#include "vx_math.h" +#include "vx_util.h" + +#include "ndbc_locations.h" + + +static bool _parseLine(const string &sline, const string &key, string &value); +static bool _parseLineForDouble(const string &sline, const string &key, double &value); + +//////////////////////////////////////////////////////////////////////// + + +// +// Code for class NdbcLocations +// + + +//////////////////////////////////////////////////////////////////////// + + +NdbcLocations::NdbcLocations() +{ + // + // this is a default + // + fileName = "activestations.xml"; +} + + +//////////////////////////////////////////////////////////////////////// + + +NdbcLocations::~NdbcLocations() +{ +} + + +//////////////////////////////////////////////////////////////////////// + +bool NdbcLocations::initialize(const string &fName) +{ + string method_name = "NdbcLocations::initialize() "; + + fileName = fName; + LineDataFile locFile; + if (!locFile.open(fileName.c_str())) { + mlog << Error << method_name << "->" + << "can't open input ASCII file \"" << fileName + << "\" for reading\n\n"; + return false; + } + DataLine data_line; + string sidKey = "station id="; + string latKey = "lat="; + string lonKey = "lon="; + string elevKey = "elev="; + + while (locFile >> data_line) { + string sline = data_line.get_line(); + string stationId; + double lat, lon, elev; + if (!_parseLine(sline, sidKey, stationId)) { + // assume not a line we want + continue; + } + if (!_parseLineForDouble(sline, latKey, lat)) { + mlog << Warning << method_name << "-> " + << "parsing out lat from line '" << sline << "'\n" + << "in file \"" << fileName << "\n\n"; + continue; + } + if (!_parseLineForDouble(sline, lonKey, lon)) { + mlog << Warning << method_name << "-> " + << "parsing out lon from line '" << sline << "'\n" + << "in file \"" << fileName << "\n\n"; + continue; + } + if (!_parseLineForDouble(sline, elevKey, elev)) { + // elev can be missing + elev = bad_data_double; + } + + // store lower case only, for later comparisons + std::transform(stationId.begin(), stationId.end(), stationId.begin(), ::tolower); + StationId.push_back(stationId); + Lat.push_back(lat); + Lon.push_back(lon); + Elev.push_back(elev); + } + locFile.close(); + return true; +} + +//////////////////////////////////////////////////////////////////////// + +bool NdbcLocations::lookupLatLonElev(const string aqsid, double &lat, double &lon, double &elev) const +{ + string method_name = "NdbcLocations::lookupLatLonElev()"; + + string locId = aqsid; + std::transform(locId.begin(), locId.end(), locId.begin(), ::tolower); + + vector::const_iterator it; + it = find(StationId.begin(), StationId.end(), locId); + if (it == StationId.end()) { + return false; + } + int index = (int)(it - StationId.begin()); + lat = Lat[index]; + lon = Lon[index]; + elev = Elev[index]; + return true; +} + +//////////////////////////////////////////////////////////////////////// + +void NdbcLocations::print(void) const +{ + for (size_t i=0; i +#include + +//////////////////////////////////////////////////////////////////////// + + +class NdbcLocations +{ + +public: + + NdbcLocations(); + virtual ~NdbcLocations(); + bool initialize(const string &locationsFile); + bool lookupLatLonElev(const string aqsid, double &lat, double &lon, double &elev) const; + void print(void) const; + +private: + + bool _setPtr(DataLine &data_line, const string &headerName, int &ptr) const; + + string fileName; + + vector StationId; + vector Lat; + vector Lon; + vector Elev; + +}; + + +//////////////////////////////////////////////////////////////////////// + + +#endif + + +//////////////////////////////////////////////////////////////////////// + + diff --git a/src/tools/other/gen_ens_prod/Makefile.am b/src/tools/other/gen_ens_prod/Makefile.am index de1913ed11..a67d8f72c5 100644 --- a/src/tools/other/gen_ens_prod/Makefile.am +++ b/src/tools/other/gen_ens_prod/Makefile.am @@ -28,10 +28,10 @@ gen_ens_prod_LDADD = -lvx_stat_out \ $(PYTHON_LIBS) \ -lvx_data2d \ -lvx_nc_obs \ + -lvx_seeps \ -lvx_nc_util \ -lvx_regrid \ -lvx_grid \ - -lvx_seeps \ -lvx_config \ -lvx_color \ -lvx_util_math \ diff --git a/src/tools/other/gen_ens_prod/Makefile.in b/src/tools/other/gen_ens_prod/Makefile.in index f89cc6b0d4..a569327ee7 100644 --- a/src/tools/other/gen_ens_prod/Makefile.in +++ b/src/tools/other/gen_ens_prod/Makefile.in @@ -335,10 +335,10 @@ gen_ens_prod_LDADD = -lvx_stat_out \ $(PYTHON_LIBS) \ -lvx_data2d \ -lvx_nc_obs \ + -lvx_seeps \ -lvx_nc_util \ -lvx_regrid \ -lvx_grid \ - -lvx_seeps \ -lvx_config \ -lvx_color \ -lvx_util_math \ diff --git a/src/tools/other/gen_ens_prod/gen_ens_prod.cc b/src/tools/other/gen_ens_prod/gen_ens_prod.cc index 32948bf06a..f0140b840e 100644 --- a/src/tools/other/gen_ens_prod/gen_ens_prod.cc +++ b/src/tools/other/gen_ens_prod/gen_ens_prod.cc @@ -19,9 +19,12 @@ // 002 01/14/21 McCabe MET #1695 All members in one file. // 003 02/17/22 Halley Gotway MET #1918 Add normalize config option. // 004 07/06/22 Howard Soh METplus-Internal #19 Rename main to met_main +// 005 10/03/22 Prestopnik MET #2227 Remove using namespace std and netCDF from header files // //////////////////////////////////////////////////////////////////////// +using namespace std; + #include #include #include @@ -33,6 +36,9 @@ #include #include +#include +using namespace netCDF; + #include "main.h" #include "gen_ens_prod.h" diff --git a/src/tools/other/gen_ens_prod/gen_ens_prod.h b/src/tools/other/gen_ens_prod/gen_ens_prod.h index 332c7594a7..cfe0120a8e 100644 --- a/src/tools/other/gen_ens_prod/gen_ens_prod.h +++ b/src/tools/other/gen_ens_prod/gen_ens_prod.h @@ -15,6 +15,7 @@ // Mod# Date Name Description // ---- ---- ---- ----------- // 000 09/10/21 Halley Gotway MET #1904 Initial version. +// 001 09/29/22 Prestopnik MET #2227 Remove namespace std and netCDF from header files // //////////////////////////////////////////////////////////////////////// @@ -23,8 +24,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -39,7 +38,6 @@ using namespace std; #include #include -using namespace netCDF; #include "gen_ens_prod_conf_info.h" @@ -83,9 +81,9 @@ static unixtime ens_valid_ut = (unixtime) 0; //////////////////////////////////////////////////////////////////////// // Output NetCDF file -static NcFile *nc_out = (NcFile *) 0; -static NcDim lat_dim; -static NcDim lon_dim; +static netCDF::NcFile *nc_out = (netCDF::NcFile *) 0; +static netCDF::NcDim lat_dim; +static netCDF::NcDim lon_dim; // List of output NetCDF variable names static StringArray nc_ens_var_sa; diff --git a/src/tools/other/gen_ens_prod/gen_ens_prod_conf_info.h b/src/tools/other/gen_ens_prod/gen_ens_prod_conf_info.h index f92a49d153..c6199639c2 100644 --- a/src/tools/other/gen_ens_prod/gen_ens_prod_conf_info.h +++ b/src/tools/other/gen_ens_prod/gen_ens_prod_conf_info.h @@ -82,9 +82,9 @@ class GenEnsProdConfInfo { ConcatString desc; // Description ConcatString control_id; // Control ID - vector ens_input; // Vector of GenEnsProdVarInfo pointers (allocated) - vector cdf_info; // Array of climo CDF info objects - StringArray ens_member_ids; // Array of ensemble member ID strings + std::vector ens_input; // Vector of GenEnsProdVarInfo pointers (allocated) + std::vector cdf_info; // Array of climo CDF info objects + StringArray ens_member_ids; // Array of ensemble member ID strings NbrhdInfo nbrhd_prob; // Neighborhood probability definition InterpInfo nmep_smooth; // Neighborhood maximum smoothing information diff --git a/src/tools/other/gen_vx_mask/gen_vx_mask.cc b/src/tools/other/gen_vx_mask/gen_vx_mask.cc index 55572b1a2b..f65d466fd6 100644 --- a/src/tools/other/gen_vx_mask/gen_vx_mask.cc +++ b/src/tools/other/gen_vx_mask/gen_vx_mask.cc @@ -28,10 +28,13 @@ // 010 08/30/21 Halley Gotway MET #1891 Fix input and mask fields. // 011 12/13/21 Halley Gotway MET #1993 Fix -type grid. // 012 05/05/22 Halley Gotway MET #2152 Add -type poly_xy. -// 013 07/06/22 Howard Soh METplus-Internal #19 Rename main to met_main +// 013 07/06/22 Howard Soh METplus-Internal #19 Rename main to met_main +// 014 09/28/22 Prestopnik MET #2227 Remove namespace std and netCDF from header files // //////////////////////////////////////////////////////////////////////// +using namespace std; + #include #include #include @@ -43,6 +46,9 @@ #include #include +#include +using namespace netCDF; + #include "main.h" #include "gen_vx_mask.h" diff --git a/src/tools/other/gen_vx_mask/gen_vx_mask.h b/src/tools/other/gen_vx_mask/gen_vx_mask.h index 937b5db8c5..d87ed09c0f 100644 --- a/src/tools/other/gen_vx_mask/gen_vx_mask.h +++ b/src/tools/other/gen_vx_mask/gen_vx_mask.h @@ -20,6 +20,7 @@ // 003 06/03/21 Seth Linden Changed default mask type to MaskType_None. // 004 08/30/21 Halley Gotway MET #1891 fix input and mask fields. // 005 05/05/22 Halley Gotway MET #2152 Add -type poly_xy. +// 006 09/29/22 Prestopnik MET #2227 Remove namespace std from header files // //////////////////////////////////////////////////////////////////////// @@ -28,8 +29,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include "vx_util.h" #include "vx_cal.h" #include "mask_poly.h" diff --git a/src/tools/other/gis_utils/gis_dump_dbf.cc b/src/tools/other/gis_utils/gis_dump_dbf.cc index 1afd53e07f..8b9a1c6157 100644 --- a/src/tools/other/gis_utils/gis_dump_dbf.cc +++ b/src/tools/other/gis_utils/gis_dump_dbf.cc @@ -12,6 +12,7 @@ //////////////////////////////////////////////////////////////////////// +using namespace std; #include #include diff --git a/src/tools/other/gis_utils/gis_dump_shp.cc b/src/tools/other/gis_utils/gis_dump_shp.cc index 6db3275963..37d0c06f0b 100644 --- a/src/tools/other/gis_utils/gis_dump_shp.cc +++ b/src/tools/other/gis_utils/gis_dump_shp.cc @@ -12,6 +12,7 @@ //////////////////////////////////////////////////////////////////////// +using namespace std; #include #include @@ -89,7 +90,7 @@ cline.parse(); if ( cline.n() != 1 ) usage(); - ConcatString input_filename = (string)cline[0]; +ConcatString input_filename = (string)cline[0]; ShpFile f; diff --git a/src/tools/other/gis_utils/gis_dump_shx.cc b/src/tools/other/gis_utils/gis_dump_shx.cc index d8b37d049f..c22700d653 100644 --- a/src/tools/other/gis_utils/gis_dump_shx.cc +++ b/src/tools/other/gis_utils/gis_dump_shx.cc @@ -12,6 +12,7 @@ //////////////////////////////////////////////////////////////////////// +using namespace std; #include #include diff --git a/src/tools/other/grid_diag/grid_diag.cc b/src/tools/other/grid_diag/grid_diag.cc index a8e2212371..96e3be2a94 100644 --- a/src/tools/other/grid_diag/grid_diag.cc +++ b/src/tools/other/grid_diag/grid_diag.cc @@ -18,10 +18,13 @@ // 001 07/28/20 Halley Gotway Updates for #1391. // 002 03/04/21 Halley Gotway Bugfix #1694. // 003 08/20/21 Halley Gotway Bugfix #1886 for integer overflow. -// 004 07/06/22 Howard Soh METplus-Internal #19 Rename main to met_main +// 004 07/06/22 Howard Soh METplus-Internal #19 Rename main to met_main +// 005 10/03/22 Prestopnik MET #2227 Remove using namespace std and netCDF from header files // //////////////////////////////////////////////////////////////////////// +using namespace std; + #include #include #include @@ -33,6 +36,9 @@ #include #include +#include +using namespace netCDF; + #include "main.h" #include "grid_diag.h" #include "series_data.h" diff --git a/src/tools/other/grid_diag/grid_diag.h b/src/tools/other/grid_diag/grid_diag.h index 1bc4d4f30d..18b18d3326 100644 --- a/src/tools/other/grid_diag/grid_diag.h +++ b/src/tools/other/grid_diag/grid_diag.h @@ -15,6 +15,7 @@ // Mod# Date Name Description // ---- ---- ---- ----------- // 000 10/01/19 Fillmore New +// 001 09/29/22 Prestopnik MET #2227 Remove namespace std and netCDF from header files // //////////////////////////////////////////////////////////////////////// @@ -23,8 +24,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -40,7 +39,6 @@ using namespace std; #include #include -using namespace netCDF; #include "grid_diag_conf_info.h" @@ -87,10 +85,10 @@ static GridDiagConfInfo conf_info; //////////////////////////////////////////////////////////////////////// // Output NetCDF file -static NcFile *nc_out = (NcFile *) 0; -vector data_var_dims; -vector hist_vars; -vector joint_hist_vars; +static netCDF::NcFile *nc_out = (netCDF::NcFile *) 0; +vector data_var_dims; +vector hist_vars; +vector joint_hist_vars; //////////////////////////////////////////////////////////////////////// // diff --git a/src/tools/other/gsi_tools/Makefile.am b/src/tools/other/gsi_tools/Makefile.am index 7f4f5acdf5..653582b255 100644 --- a/src/tools/other/gsi_tools/Makefile.am +++ b/src/tools/other/gsi_tools/Makefile.am @@ -46,10 +46,10 @@ gsid2mpr_LDADD = -lvx_stat_out \ -lvx_data2d_nccf \ -lvx_data2d_grib $(GRIB2_LIBS) \ -lvx_data2d \ + -lvx_seeps \ -lvx_nc_util \ -lvx_regrid \ -lvx_grid \ - -lvx_seeps \ -lvx_config \ -lvx_gsl_prob \ -lvx_cal \ @@ -93,10 +93,10 @@ gsidens2orank_LDADD = -lvx_stat_out \ -lvx_data2d_nccf \ -lvx_data2d_grib $(GRIB2_LIBS) \ -lvx_data2d \ + -lvx_seeps \ -lvx_nc_util \ -lvx_regrid \ -lvx_grid \ - -lvx_seeps \ -lvx_config \ -lvx_gsl_prob \ -lvx_cal \ diff --git a/src/tools/other/gsi_tools/Makefile.in b/src/tools/other/gsi_tools/Makefile.in index 550b454f44..f4f846b2c6 100644 --- a/src/tools/other/gsi_tools/Makefile.in +++ b/src/tools/other/gsi_tools/Makefile.in @@ -386,10 +386,10 @@ gsid2mpr_LDADD = -lvx_stat_out \ -lvx_data2d_nccf \ -lvx_data2d_grib $(GRIB2_LIBS) \ -lvx_data2d \ + -lvx_seeps \ -lvx_nc_util \ -lvx_regrid \ -lvx_grid \ - -lvx_seeps \ -lvx_config \ -lvx_gsl_prob \ -lvx_cal \ @@ -434,10 +434,10 @@ gsidens2orank_LDADD = -lvx_stat_out \ -lvx_data2d_nccf \ -lvx_data2d_grib $(GRIB2_LIBS) \ -lvx_data2d \ + -lvx_seeps \ -lvx_nc_util \ -lvx_regrid \ -lvx_grid \ - -lvx_seeps \ -lvx_config \ -lvx_gsl_prob \ -lvx_cal \ diff --git a/src/tools/other/gsi_tools/gsi_util.h b/src/tools/other/gsi_tools/gsi_util.h index cc3f5aa3ee..f8477162cd 100644 --- a/src/tools/other/gsi_tools/gsi_util.h +++ b/src/tools/other/gsi_tools/gsi_util.h @@ -13,8 +13,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include "vx_stat_out.h" //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/gsi_tools/gsid2mpr.cc b/src/tools/other/gsi_tools/gsid2mpr.cc index 33b841d370..83527ea9e1 100644 --- a/src/tools/other/gsi_tools/gsid2mpr.cc +++ b/src/tools/other/gsi_tools/gsid2mpr.cc @@ -16,10 +16,13 @@ // ---- ---- ---- ----------- // 000 06/09/15 Bullock New // 001 01/26/16 Halley Gotway Add -no_check_dup option. -// 002 07/06/22 Howard Soh METplus-Internal #19 Rename main to met_main +// 002 07/06/22 Howard Soh METplus-Internal #19 Rename main to met_main +// 003 10/03/22 Prestopnik MET #2227 Remove using namespace std from header files // //////////////////////////////////////////////////////////////////////// +using namespace std; + #include #include #include diff --git a/src/tools/other/gsi_tools/gsid2mpr.h b/src/tools/other/gsi_tools/gsid2mpr.h index 32b0733b9a..04001d5479 100644 --- a/src/tools/other/gsi_tools/gsid2mpr.h +++ b/src/tools/other/gsi_tools/gsid2mpr.h @@ -16,6 +16,7 @@ // ---- ---- ---- ----------- // 000 06/09/15 Bullock New // 001 01/26/16 Halley Gotway Add -no_check_dup option. +// 002 09/29/22 Prestopnik MET #2227 Remove namespace std from header files // //////////////////////////////////////////////////////////////////////// @@ -24,8 +25,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include "vx_util.h" diff --git a/src/tools/other/gsi_tools/gsidens2orank.cc b/src/tools/other/gsi_tools/gsidens2orank.cc index 903960793f..744ba5fff6 100644 --- a/src/tools/other/gsi_tools/gsidens2orank.cc +++ b/src/tools/other/gsi_tools/gsidens2orank.cc @@ -16,9 +16,12 @@ // ---- ---- ---- ----------- // 000 07/09/15 Halley Gotway New // 001 07/06/22 Howard Soh METplus-Internal #19 Rename main to met_main +// 002 10/03/22 Prestopnik MET #2227 Remove namespace std from header files // //////////////////////////////////////////////////////////////////////// +using namespace std; + #include #include #include diff --git a/src/tools/other/gsi_tools/gsidens2orank.h b/src/tools/other/gsi_tools/gsidens2orank.h index 0e8fb7dcdd..e68b0d9b09 100644 --- a/src/tools/other/gsi_tools/gsidens2orank.h +++ b/src/tools/other/gsi_tools/gsidens2orank.h @@ -15,6 +15,7 @@ // Mod# Date Name Description // ---- ---- ---- ----------- // 000 07/09/15 Halley Gotway New +// 001 09/29/22 Prestopnik MET #2227 Removing namespace std from header files // //////////////////////////////////////////////////////////////////////// @@ -23,8 +24,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include "vx_util.h" diff --git a/src/tools/other/ioda2nc/ioda2nc.cc b/src/tools/other/ioda2nc/ioda2nc.cc index 90c6c75c34..1aaef67ba1 100644 --- a/src/tools/other/ioda2nc/ioda2nc.cc +++ b/src/tools/other/ioda2nc/ioda2nc.cc @@ -21,9 +21,12 @@ // ---- ---- ---- ----------- // 000 07-21-20 Howard Soh New // 001 07-06-22 Howard Soh METplus-Internal #19 Rename main to met_main +// 002 09-29-22 Prestopnik MET #2227 Remove namespace std and netCDF from header files // //////////////////////////////////////////////////////////////////////// +using namespace std; + #include #include #include @@ -31,6 +34,9 @@ #include #include +#include +using namespace netCDF; + #include "main.h" #include "apply_mask.h" #include "ioda2nc_conf_info.h" diff --git a/src/tools/other/lidar2nc/lidar2nc.cc b/src/tools/other/lidar2nc/lidar2nc.cc index 18adf15d73..49b649059b 100644 --- a/src/tools/other/lidar2nc/lidar2nc.cc +++ b/src/tools/other/lidar2nc/lidar2nc.cc @@ -18,6 +18,7 @@ // ---- ---- ---- ----------- // 000 03-22-17 Bullock New // 001 07-06-22 Howard Soh METplus-Internal #19 Rename main to met_main +// 002 09-12-22 Prestopnik MET #2227 Remove namespace std and netCDF from header files // //////////////////////////////////////////////////////////////////////// @@ -27,6 +28,7 @@ static const char hdr_typ_string[] = "calipso"; //////////////////////////////////////////////////////////////////////// +using namespace std; #include #include @@ -41,6 +43,7 @@ static const char hdr_typ_string[] = "calipso"; #include #include +using namespace netCDF; #include "hdf.h" #include "mfhdf.h" diff --git a/src/tools/other/madis2nc/madis2nc.cc b/src/tools/other/madis2nc/madis2nc.cc index fd5640210b..ecf635a539 100644 --- a/src/tools/other/madis2nc/madis2nc.cc +++ b/src/tools/other/madis2nc/madis2nc.cc @@ -33,9 +33,12 @@ // 006 07-23-18 Halley Gotway Support masks from gen_vx_mask. // 007 01-11-19 Howard Soh Added config file option. // 008 07-06-22 Howard Soh METplus-Internal #19 Rename main to met_main +// 009 09-29-22 Prestopnik MET #2227 Remove namespace std and netCDF from header files // //////////////////////////////////////////////////////////////////////// +using namespace std; + #include #include #include @@ -47,6 +50,9 @@ #include #include +#include +using namespace netCDF; + #include "main.h" #include "madis2nc.h" diff --git a/src/tools/other/madis2nc/madis2nc.h b/src/tools/other/madis2nc/madis2nc.h index 3317fed702..5dd20f8133 100644 --- a/src/tools/other/madis2nc/madis2nc.h +++ b/src/tools/other/madis2nc/madis2nc.h @@ -19,6 +19,7 @@ // Mod# Date Name Description // ---- ---- ---- ----------- // 000 07-21-11 Halley Gotway Adapted from contributed code. +// 001 09-29-22 Prestopnik MET #2227 Remove namespace std from header files // //////////////////////////////////////////////////////////////////////// @@ -27,10 +28,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - -//////////////////////////////////////////////////////////////////////// - #include "vx_log.h" #include "mask_poly.h" #include "vx_grid.h" diff --git a/src/tools/other/madis2nc/madis2nc_conf_info.h b/src/tools/other/madis2nc/madis2nc_conf_info.h index 8e25d40694..0ced5aafef 100644 --- a/src/tools/other/madis2nc/madis2nc_conf_info.h +++ b/src/tools/other/madis2nc/madis2nc_conf_info.h @@ -27,8 +27,8 @@ class Madis2NcConfInfo { Madis2NcConfInfo(); ~Madis2NcConfInfo(); - void read_config(const string &default_filename, - const string &user_filename); + void read_config(const std::string &default_filename, + const std::string &user_filename); TimeSummaryInfo getSummaryInfo() const { diff --git a/src/tools/other/mode_graphics/cgraph_font.h b/src/tools/other/mode_graphics/cgraph_font.h index 0c2ea2cff5..f8e4f8b493 100644 --- a/src/tools/other/mode_graphics/cgraph_font.h +++ b/src/tools/other/mode_graphics/cgraph_font.h @@ -50,7 +50,7 @@ class CgFont { void clear(); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; void set_by_number(int); // for builtin fonts @@ -109,7 +109,7 @@ class CgFontCollection { void clear(); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; int n_fonts() const; diff --git a/src/tools/other/mode_graphics/color_stack.h b/src/tools/other/mode_graphics/color_stack.h index 9afd846a91..a583fc4efa 100644 --- a/src/tools/other/mode_graphics/color_stack.h +++ b/src/tools/other/mode_graphics/color_stack.h @@ -54,7 +54,7 @@ class ColorStack { void clear(); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; void set_alloc_inc(int = 0); // 0 means default value (10) diff --git a/src/tools/other/mode_graphics/mode_nc_output_file.cc b/src/tools/other/mode_graphics/mode_nc_output_file.cc index ce45948a81..c50d28554f 100644 --- a/src/tools/other/mode_graphics/mode_nc_output_file.cc +++ b/src/tools/other/mode_graphics/mode_nc_output_file.cc @@ -19,6 +19,9 @@ using namespace std; #include #include +#include +using namespace netCDF; + #include "mode_nc_output_file.h" #include "nc_var_info.h" #include "nc_utils.h" diff --git a/src/tools/other/mode_graphics/mode_nc_output_file.h b/src/tools/other/mode_graphics/mode_nc_output_file.h index 5959dedd73..68a398017e 100644 --- a/src/tools/other/mode_graphics/mode_nc_output_file.h +++ b/src/tools/other/mode_graphics/mode_nc_output_file.h @@ -18,7 +18,6 @@ #include -using namespace netCDF; #include "data_plane.h" #include "vx_grid.h" @@ -50,36 +49,36 @@ class ModeNcOutputFile { ConcatString Filename; - int get_int (NcVar *, int x, int y) const; - double get_float (NcVar *, int x, int y) const; + int get_int (netCDF::NcVar *, int x, int y) const; + double get_float (netCDF::NcVar *, int x, int y) const; - int count_objects(NcVar *) const; + int count_objects(netCDF::NcVar *) const; DataPlane select_obj(ModeObjectField, int) const; - void calc_data_range(NcVar *, double & min_value, double & max_value); + void calc_data_range(netCDF::NcVar *, double & min_value, double & max_value); - NcFile * f; // allocated + netCDF::NcFile * f; // allocated Grid * _Grid; // allocated - NcVar * FcstObjId; // NOT allocated - NcVar * FcstClusId; // NOT allocated + netCDF::NcVar * FcstObjId; // NOT allocated + netCDF::NcVar * FcstClusId; // NOT allocated - NcVar * ObsObjId; // NOT allocated - NcVar * ObsClusId; // NOT allocated + netCDF::NcVar * ObsObjId; // NOT allocated + netCDF::NcVar * ObsClusId; // NOT allocated - NcVar * FcstRaw; // NOT allocated - NcVar * ObsRaw; // NOT allocated + netCDF::NcVar * FcstRaw; // NOT allocated + netCDF::NcVar * ObsRaw; // NOT allocated - NcVar _FcstObjId; // - NcVar _FcstClusId; // + netCDF::NcVar _FcstObjId; // + netCDF::NcVar _FcstClusId; // - NcVar _ObsObjId; // - NcVar _ObsClusId; // + netCDF::NcVar _ObsObjId; // + netCDF::NcVar _ObsClusId; // - NcVar _FcstRaw; // - NcVar _ObsRaw; // + netCDF::NcVar _FcstRaw; // + netCDF::NcVar _ObsRaw; // ModeNcOutputFile(const ModeNcOutputFile &); ModeNcOutputFile & operator=(const ModeNcOutputFile &); @@ -115,7 +114,7 @@ class ModeNcOutputFile { void close(); - void dump(ostream &) const; + void dump(std::ostream &) const; ConcatString filename() const; ConcatString short_filename() const; diff --git a/src/tools/other/mode_graphics/plot_mode_field.cc b/src/tools/other/mode_graphics/plot_mode_field.cc index 118fbe9b6d..ebd917c4ef 100644 --- a/src/tools/other/mode_graphics/plot_mode_field.cc +++ b/src/tools/other/mode_graphics/plot_mode_field.cc @@ -17,6 +17,7 @@ // ---- ---- ---- ----------- // 000 09-05-14 Bullock New // 001 07-06-22 Howard Soh METplus-Internal #19 Rename main to met_main +// 002 09-13-22 Prestopnik MET #2227 Remove namespace std from header files // //////////////////////////////////////////////////////////////////////// @@ -30,6 +31,7 @@ static const int ctable_text_width = 30; //////////////////////////////////////////////////////////////////////// +using namespace std; #include #include diff --git a/src/tools/other/mode_time_domain/3d_conv.cc b/src/tools/other/mode_time_domain/3d_conv.cc index 5a4027eafb..bc28ed8d7e 100644 --- a/src/tools/other/mode_time_domain/3d_conv.cc +++ b/src/tools/other/mode_time_domain/3d_conv.cc @@ -28,6 +28,9 @@ using namespace std; #include #include +#include +using namespace netCDF; + #include "vx_cal.h" #include "vx_util.h" #include "vx_pxm.h" diff --git a/src/tools/other/mode_time_domain/mm_engine.cc b/src/tools/other/mode_time_domain/mm_engine.cc index 200823c9c5..f114544f56 100644 --- a/src/tools/other/mode_time_domain/mm_engine.cc +++ b/src/tools/other/mode_time_domain/mm_engine.cc @@ -268,7 +268,7 @@ if ( mlog.verbosity_level() > 5 ) { s << "Composites ...\n"; - for (j=0; j #include diff --git a/src/tools/other/mode_time_domain/mtd_file_base.cc b/src/tools/other/mode_time_domain/mtd_file_base.cc index f1e3571d17..2c4244ded4 100644 --- a/src/tools/other/mode_time_domain/mtd_file_base.cc +++ b/src/tools/other/mode_time_domain/mtd_file_base.cc @@ -20,6 +20,9 @@ using namespace std; #include #include +#include +using namespace netCDF; + #include "mtd_file.h" #include "mtd_partition.h" #include "mtd_nc_defs.h" diff --git a/src/tools/other/mode_time_domain/mtd_file_base.h b/src/tools/other/mode_time_domain/mtd_file_base.h index 98d30f10a1..bc84dbf37b 100644 --- a/src/tools/other/mode_time_domain/mtd_file_base.h +++ b/src/tools/other/mode_time_domain/mtd_file_base.h @@ -21,7 +21,6 @@ #include #include -using namespace netCDF; #include "vx_util.h" #include "vx_cal.h" @@ -77,8 +76,8 @@ class MtdFileBase { void base_assign(const MtdFileBase &); - virtual void read (NcFile &); - virtual void write (NcFile &) const; + virtual void read (netCDF::NcFile &); + virtual void write (netCDF::NcFile &) const; Grid * G; // allocated diff --git a/src/tools/other/mode_time_domain/mtd_file_float.cc b/src/tools/other/mode_time_domain/mtd_file_float.cc index 6d7cb262a4..56304c428b 100644 --- a/src/tools/other/mode_time_domain/mtd_file_float.cc +++ b/src/tools/other/mode_time_domain/mtd_file_float.cc @@ -21,6 +21,9 @@ using namespace std; #include #include +#include +using namespace netCDF; + #include "mtd_file.h" #include "mtd_partition.h" #include "mtd_nc_defs.h" diff --git a/src/tools/other/mode_time_domain/mtd_file_float.h b/src/tools/other/mode_time_domain/mtd_file_float.h index 20493e5965..615b9a3c93 100644 --- a/src/tools/other/mode_time_domain/mtd_file_float.h +++ b/src/tools/other/mode_time_domain/mtd_file_float.h @@ -47,8 +47,8 @@ class MtdFloatFile : public MtdFileBase { void float_assign(const MtdFloatFile &); - virtual void read (NcFile &); - virtual void write (NcFile &) const; + virtual void read (netCDF::NcFile &); + virtual void write (netCDF::NcFile &) const; float * Data; // allocated diff --git a/src/tools/other/mode_time_domain/mtd_file_int.cc b/src/tools/other/mode_time_domain/mtd_file_int.cc index 931a3cb994..4bf41a4792 100644 --- a/src/tools/other/mode_time_domain/mtd_file_int.cc +++ b/src/tools/other/mode_time_domain/mtd_file_int.cc @@ -21,6 +21,9 @@ using namespace std; #include #include +#include +using namespace netCDF; + #include "mtd_file.h" #include "mtd_partition.h" #include "mtd_nc_defs.h" diff --git a/src/tools/other/mode_time_domain/mtd_file_int.h b/src/tools/other/mode_time_domain/mtd_file_int.h index 8611b25368..098d56d046 100644 --- a/src/tools/other/mode_time_domain/mtd_file_int.h +++ b/src/tools/other/mode_time_domain/mtd_file_int.h @@ -43,8 +43,8 @@ class MtdIntFile : public MtdFileBase { void int_assign(const MtdIntFile &); - virtual void read (NcFile &); - virtual void write (NcFile &) const; + virtual void read (netCDF::NcFile &); + virtual void write (netCDF::NcFile &) const; diff --git a/src/tools/other/mode_time_domain/mtd_nc_output.cc b/src/tools/other/mode_time_domain/mtd_nc_output.cc index 86f1f84c48..7fd50136e2 100644 --- a/src/tools/other/mode_time_domain/mtd_nc_output.cc +++ b/src/tools/other/mode_time_domain/mtd_nc_output.cc @@ -17,6 +17,9 @@ using namespace std; #include #include +#include +using namespace netCDF; + #include "mtd_nc_output.h" #include "write_netcdf.h" diff --git a/src/tools/other/mode_time_domain/nc_grid.cc b/src/tools/other/mode_time_domain/nc_grid.cc index 516f24756a..e31246ab4d 100644 --- a/src/tools/other/mode_time_domain/nc_grid.cc +++ b/src/tools/other/mode_time_domain/nc_grid.cc @@ -20,6 +20,9 @@ using namespace std; #include #include +#include +using namespace netCDF; + #include "nc_utils_local.h" #include "nc_grid.h" diff --git a/src/tools/other/mode_time_domain/nc_grid.h b/src/tools/other/mode_time_domain/nc_grid.h index 47bc766d37..70b45fdef9 100644 --- a/src/tools/other/mode_time_domain/nc_grid.h +++ b/src/tools/other/mode_time_domain/nc_grid.h @@ -25,9 +25,9 @@ //////////////////////////////////////////////////////////////////////// -extern bool read_nc_grid(NcFile &, Grid &); +extern bool read_nc_grid(netCDF::NcFile &, Grid &); -extern bool write_nc_grid(NcFile &, const Grid &); +extern bool write_nc_grid(netCDF::NcFile &, const Grid &); //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/mode_time_domain/nc_utils_local.cc b/src/tools/other/mode_time_domain/nc_utils_local.cc index 12a056f376..87af32b3ab 100644 --- a/src/tools/other/mode_time_domain/nc_utils_local.cc +++ b/src/tools/other/mode_time_domain/nc_utils_local.cc @@ -20,6 +20,9 @@ using namespace std; #include #include +#include +using namespace netCDF; + #include "nc_utils.h" #include "nc_utils_local.h" #include "vx_log.h" diff --git a/src/tools/other/mode_time_domain/nc_utils_local.h b/src/tools/other/mode_time_domain/nc_utils_local.h index 9cf6d18587..528f2b566a 100644 --- a/src/tools/other/mode_time_domain/nc_utils_local.h +++ b/src/tools/other/mode_time_domain/nc_utils_local.h @@ -25,10 +25,10 @@ //////////////////////////////////////////////////////////////////////// -extern const char * string_att (const NcFile &, const char * name); -extern int string_att_as_int (const NcFile &, const char * name); -extern long long string_att_as_ll (const NcFile &, const char * name); -extern double string_att_as_double (const NcFile &, const char * name); +extern const char * string_att (const netCDF::NcFile &, const char * name); +extern int string_att_as_int (const netCDF::NcFile &, const char * name); +extern long long string_att_as_ll (const netCDF::NcFile &, const char * name); +extern double string_att_as_double (const netCDF::NcFile &, const char * name); //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/other/modis_regrid/cloudsat_swath_file.h b/src/tools/other/modis_regrid/cloudsat_swath_file.h index 2cd797b84a..11f63f33c4 100644 --- a/src/tools/other/modis_regrid/cloudsat_swath_file.h +++ b/src/tools/other/modis_regrid/cloudsat_swath_file.h @@ -52,7 +52,7 @@ class SatDimension { void clear(); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; // // set stuff @@ -125,7 +125,7 @@ class SatAttribute { void clear(); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; // // set stuff @@ -213,7 +213,7 @@ class SwathDataField { void clear(); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; // // set stuff @@ -307,7 +307,7 @@ class CloudsatSwath { void clear(); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; // // set stuff @@ -417,7 +417,7 @@ class CloudsatSwathFile { void close(); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; // // set stuff diff --git a/src/tools/other/modis_regrid/data_plane_to_netcdf.cc b/src/tools/other/modis_regrid/data_plane_to_netcdf.cc index 67baabf37c..e084cf0d97 100644 --- a/src/tools/other/modis_regrid/data_plane_to_netcdf.cc +++ b/src/tools/other/modis_regrid/data_plane_to_netcdf.cc @@ -21,6 +21,9 @@ using namespace std; #include #include +#include +using namespace netCDF; + #include "data_plane_to_netcdf.h" #include "vx_log.h" // mlog #include "vx_cal.h" // bad_data_float diff --git a/src/tools/other/modis_regrid/modis_file.h b/src/tools/other/modis_regrid/modis_file.h index c50510d683..757641c9d7 100644 --- a/src/tools/other/modis_regrid/modis_file.h +++ b/src/tools/other/modis_regrid/modis_file.h @@ -91,7 +91,7 @@ class ModisFile { void close(); - void dump(ostream &, int = 0) const; + void dump(std::ostream &, int = 0) const; // // set stuff diff --git a/src/tools/other/modis_regrid/modis_regrid.cc b/src/tools/other/modis_regrid/modis_regrid.cc index 0157de39fd..6e41bcee8c 100644 --- a/src/tools/other/modis_regrid/modis_regrid.cc +++ b/src/tools/other/modis_regrid/modis_regrid.cc @@ -15,6 +15,7 @@ static const char default_units [] = "none"; //////////////////////////////////////////////////////////////////////// +using namespace std; #include #include diff --git a/src/tools/other/pb2nc/pb2nc.cc b/src/tools/other/pb2nc/pb2nc.cc index 985b027b10..e1dc57a6e9 100644 --- a/src/tools/other/pb2nc/pb2nc.cc +++ b/src/tools/other/pb2nc/pb2nc.cc @@ -54,9 +54,13 @@ // 015 02/10/18 Halley Gotway Add message_type_group_map. // 016 07/23/18 Halley Gotway Support masks defined by gen_vx_mask. // 017 07/06/22 Howard Soh METplus-Internal #19 Rename main to met_main +// 018 09/12/22 Prestopnik MET #2227 Remove namespace std and netCDF +// from header files // //////////////////////////////////////////////////////////////////////// +using namespace std; + #include #include #include @@ -69,6 +73,9 @@ #include #include +#include +using namespace netCDF; + #include "main.h" #include "pb2nc_conf_info.h" #include "data_class.h" @@ -1057,7 +1064,7 @@ void process_pbfile(int i_pb) { if(mlog.verbosity_level() >= debug_level_for_performance) { end_t = clock(); cout << (end_t-start_t)/double(CLOCKS_PER_SEC) - << " seconds\n"; + << " seconds\n"; start_t = clock(); } } @@ -2502,7 +2509,7 @@ void write_netcdf_hdr_data() { map obs_var_map = conf_info.getObsVarMap(); for(int i=0; i pqtzuv_map_tq, float *pqtzuv_merged = (float *) 0; float *next_pqtzuv, *prev_pqtzuv; float tq_pres_max, tq_pres_min, uv_pres_max, uv_pres_min; - std::map::iterator it, it_tq, it_uv; + map::iterator it, it_tq, it_uv; // Gets pressure levels for TQZ records it = pqtzuv_map_tq.begin(); @@ -3042,7 +3049,7 @@ float compute_pbl(map pqtzuv_map_tq, int pbl_level; int tq_count = pqtzuv_map_tq.size(); int uv_count = pqtzuv_map_uv.size(); - std::map::iterator it; + map::iterator it; static const char *method_name = "compute_pbl() "; hpbl = bad_data_float; @@ -3317,7 +3324,7 @@ void merge_records(float *first_pqtzuv, map pqtzuv_map_pivot, float cur_pres; float *cur_pqtzuv, *next_pqtzuv, *prev_pqtzuv; float *pqtzuv_merged; - std::map::iterator it_pivot, it_aux; + map::iterator it_pivot, it_aux; static const char *method_name = "merge_records() "; float first_pres = first_pqtzuv[0]; @@ -3389,7 +3396,7 @@ void log_tqz_and_uv(map pqtzuv_map_tq, int offset; ConcatString buf; StringArray log_array; - std::map::iterator it; + map::iterator it; for (it=pqtzuv_map_tq.begin(); it!=pqtzuv_map_tq.end(); ++it) { float *pqtzuv = it->second; @@ -3429,7 +3436,7 @@ void log_merged_tqz_uv(map pqtzuv_map_tq, const char *method_name) { ConcatString buf; StringArray log_array; - for (std::map::iterator it=pqtzuv_map_merged.begin(); + for (map::iterator it=pqtzuv_map_merged.begin(); it!=pqtzuv_map_merged.end(); ++it) { float *pqtzuv = it->second; buf.clear(); diff --git a/src/tools/other/pb2nc/pb2nc_conf_info.h b/src/tools/other/pb2nc/pb2nc_conf_info.h index 5bff649adf..401e0271f0 100644 --- a/src/tools/other/pb2nc/pb2nc_conf_info.h +++ b/src/tools/other/pb2nc/pb2nc_conf_info.h @@ -57,8 +57,8 @@ class PB2NCConfInfo { ConcatString tmp_dir; // Directory for temporary files ConcatString version; // Config file version - map obs_bufr_map; - map message_type_map; + std::map obs_bufr_map; + std::map message_type_map; StringArray surface_message_types; TimeSummaryInfo timeSummaryInfo; @@ -70,8 +70,8 @@ class PB2NCConfInfo { void clear(); - map getObsVarMap() const { return obs_bufr_map; } - map getMessageTypeMap() const { return message_type_map; } + std::map getObsVarMap() const { return obs_bufr_map; } + std::map getMessageTypeMap() const { return message_type_map; } TimeSummaryInfo getSummaryInfo() const { return timeSummaryInfo; }; void read_config(const char *, const char *); diff --git a/src/tools/other/plot_data_plane/plot_data_plane.cc b/src/tools/other/plot_data_plane/plot_data_plane.cc index b373c520f4..940a355073 100644 --- a/src/tools/other/plot_data_plane/plot_data_plane.cc +++ b/src/tools/other/plot_data_plane/plot_data_plane.cc @@ -25,10 +25,13 @@ // Mod# Date Name Description // ---- ---- ---- ----------- // 000 12/19/11 Holmes New -// 001 07/06/22 Howard Soh METplus-Internal #19 Rename main to met_main +// 001 07/06/22 Howard Soh METplus-Internal #19 Rename main to met_main +// 002 09/28/22 Prestopnik MET #2227 Remove namespace std from header files // //////////////////////////////////////////////////////////////////////// +using namespace std; + #include #include #include @@ -97,7 +100,7 @@ int met_main(int argc, char * argv[]) { double data_min, data_max; bool status = false; - std::ios::sync_with_stdio(true); + ios::sync_with_stdio(true); // // set the default color table diff --git a/src/tools/other/plot_point_obs/plot_point_obs.cc b/src/tools/other/plot_point_obs/plot_point_obs.cc index 47ccd59e44..164d4304f7 100644 --- a/src/tools/other/plot_point_obs/plot_point_obs.cc +++ b/src/tools/other/plot_point_obs/plot_point_obs.cc @@ -26,9 +26,12 @@ // 003 01/24/13 Halley Gotway Add -dotsize. // 004 11/10/20 Halley Gotway Add -config and -plot_grid. // 005 07/06/22 Howard Soh METplus-Internal #19 Rename main to met_mai +// 006 09/29/22 Prestopnik MET #2227 Remove namespace std from header files // //////////////////////////////////////////////////////////////////////// +using namespace std; + #include #include #include diff --git a/src/tools/other/plot_point_obs/plot_point_obs.h b/src/tools/other/plot_point_obs/plot_point_obs.h index aeef6c87b2..41c8c0f47b 100644 --- a/src/tools/other/plot_point_obs/plot_point_obs.h +++ b/src/tools/other/plot_point_obs/plot_point_obs.h @@ -15,6 +15,7 @@ // Mod# Date Name Description // ---- ---- ---- ----------- // 000 11/05/20 Halley Gotway New +// 001 09/29/22 Prestopnik MET #2227 Remove namespace std and netCDF from header files // //////////////////////////////////////////////////////////////////////// @@ -23,8 +24,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -38,8 +37,6 @@ using namespace std; #include #include -#include -using namespace netCDF; #include "plot_point_obs_conf_info.h" diff --git a/src/tools/other/plot_point_obs/plot_point_obs_conf_info.h b/src/tools/other/plot_point_obs/plot_point_obs_conf_info.h index 0791512f7c..38c6c06a2d 100644 --- a/src/tools/other/plot_point_obs/plot_point_obs_conf_info.h +++ b/src/tools/other/plot_point_obs/plot_point_obs_conf_info.h @@ -103,7 +103,7 @@ class PlotPointObsOpt { // Unique collection of locations int n_obs; - vector locations; + std::vector locations; // Flags bool store_obs_val; @@ -150,7 +150,7 @@ class PlotPointObsConfInfo { UserFunc_1Arg const_dotsize_fx; // Options for plotting point data - vector point_opts; + std::vector point_opts; ConcatString tmp_dir; // Directory for temporary files ConcatString version; // Config file version diff --git a/src/tools/other/point2grid/point2grid.cc b/src/tools/other/point2grid/point2grid.cc index 78c622e17c..496e3384e0 100644 --- a/src/tools/other/point2grid/point2grid.cc +++ b/src/tools/other/point2grid/point2grid.cc @@ -20,13 +20,19 @@ // 000 12-11-19 Howard Soh Support GOES-16 // 001 01-25-21 Halley Gotway MET #1630 Handle zero obs. // 002 07-06-22 Howard Soh METplus-Internal #19 Rename main to met_main +// 003 10-03-23 Prestopnik MET #2227 Remove namespace std and netCDF from header files // //////////////////////////////////////////////////////////////////////// +using namespace std; + #include #include #include +#include +using namespace netCDF; + #include "main.h" #include "vx_log.h" #include "vx_data2d_factory.h" diff --git a/src/tools/other/regrid_data_plane/regrid_data_plane.cc b/src/tools/other/regrid_data_plane/regrid_data_plane.cc index 253fe37c47..8218a7984c 100644 --- a/src/tools/other/regrid_data_plane/regrid_data_plane.cc +++ b/src/tools/other/regrid_data_plane/regrid_data_plane.cc @@ -24,9 +24,12 @@ // 004 01-28-20 Howard Soh Moved GOES-16/17 to point2grib // 005 04-09-20 Halley Gotway Add convert and censor options. // 006 07-06-22 Howard Soh METplus-Internal #19 Rename main to met_main +// 007 09-29-22 Prestopnik MET #2227 Remove namespace std and netCDF from header files // //////////////////////////////////////////////////////////////////////// +using namespace std; + #include #include #include @@ -40,6 +43,9 @@ #include #include +#include +using namespace netCDF; + #include "main.h" #include "vx_log.h" #include "vx_data2d_factory.h" diff --git a/src/tools/other/shift_data_plane/shift_data_plane.cc b/src/tools/other/shift_data_plane/shift_data_plane.cc index f41e0f2d5b..2600b5b20b 100644 --- a/src/tools/other/shift_data_plane/shift_data_plane.cc +++ b/src/tools/other/shift_data_plane/shift_data_plane.cc @@ -22,9 +22,13 @@ // 000 11-12-14 Halley Gotway New // 001 06-07-22 Halley Gotway MET #2173 Fix python embedding // 002 07-06-22 Howard Soh METplus-Internal #19 Rename main to met_main +// 003 09-12-22 Prestopnik MET #2227 Remove namespace std and netCDF +// from header files // //////////////////////////////////////////////////////////////////////// +using namespace std; + #include #include #include @@ -36,6 +40,9 @@ #include #include +#include +using namespace netCDF; + #include "GridTemplate.h" #include "vx_log.h" @@ -375,7 +382,7 @@ void usage() { << "\t-to lat lon\n" << "\t[-method type]\n" << "\t[-width n]\n" - << "\t[-shape SHAPE]\n" + << "\t[-shape SHAPE]\n" << "\t[-log file]\n" << "\t[-v level]\n" << "\t[-compress level]\n\n" @@ -406,8 +413,6 @@ void usage() { << "\t\t\"-shape\" overrides the default interpolation shape (SQUARE) " << "(optional).\n" - - << "\t\t\"-log file\" outputs log messages to the specified " << "file (optional).\n" diff --git a/src/tools/other/wwmca_tool/nc_output.cc b/src/tools/other/wwmca_tool/nc_output.cc index 5fd8431615..eab5533a57 100644 --- a/src/tools/other/wwmca_tool/nc_output.cc +++ b/src/tools/other/wwmca_tool/nc_output.cc @@ -17,6 +17,9 @@ using namespace std; #include #include +#include +using namespace netCDF; + #include "vx_log.h" #include "vx_cal.h" diff --git a/src/tools/other/wwmca_tool/wwmca_plot.cc b/src/tools/other/wwmca_tool/wwmca_plot.cc index 1e742cf99a..e251493038 100644 --- a/src/tools/other/wwmca_tool/wwmca_plot.cc +++ b/src/tools/other/wwmca_tool/wwmca_plot.cc @@ -9,6 +9,7 @@ //////////////////////////////////////////////////////////////////////// +using namespace std; static const int gray_min = 130; // these values must be between 0 and 255 inclusive static const int gray_max = 255; diff --git a/src/tools/tc_utils/rmw_analysis/Makefile.am b/src/tools/tc_utils/rmw_analysis/Makefile.am index a912434654..e0b72bb127 100644 --- a/src/tools/tc_utils/rmw_analysis/Makefile.am +++ b/src/tools/tc_utils/rmw_analysis/Makefile.am @@ -34,6 +34,7 @@ rmw_analysis_LDADD = -lvx_stat_out \ -lvx_config \ -lvx_gsl_prob \ -lvx_cal \ + -lvx_nav \ -lvx_util_math \ -lvx_util \ -lvx_math \ diff --git a/src/tools/tc_utils/rmw_analysis/Makefile.in b/src/tools/tc_utils/rmw_analysis/Makefile.in index e87a7303e3..a6dfaa3dd9 100644 --- a/src/tools/tc_utils/rmw_analysis/Makefile.in +++ b/src/tools/tc_utils/rmw_analysis/Makefile.in @@ -341,6 +341,7 @@ rmw_analysis_LDADD = -lvx_stat_out \ -lvx_config \ -lvx_gsl_prob \ -lvx_cal \ + -lvx_nav \ -lvx_util_math \ -lvx_util \ -lvx_math \ diff --git a/src/tools/tc_utils/rmw_analysis/rmw_analysis.cc b/src/tools/tc_utils/rmw_analysis/rmw_analysis.cc index 0ae2a6584f..1465aa706f 100644 --- a/src/tools/tc_utils/rmw_analysis/rmw_analysis.cc +++ b/src/tools/tc_utils/rmw_analysis/rmw_analysis.cc @@ -6,6 +6,8 @@ // ** P.O.Box 3000, Boulder, Colorado, 80307-3000, USA // *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=* +using namespace std; + #include #include #include @@ -16,6 +18,9 @@ #include #include +#include +using namespace netCDF; + #include "main.h" #include "rmw_analysis.h" diff --git a/src/tools/tc_utils/rmw_analysis/rmw_analysis.h b/src/tools/tc_utils/rmw_analysis/rmw_analysis.h index 541f069dc5..c4575a1534 100644 --- a/src/tools/tc_utils/rmw_analysis/rmw_analysis.h +++ b/src/tools/tc_utils/rmw_analysis/rmw_analysis.h @@ -12,9 +12,10 @@ // // Description: // -// Mod# Date Name Description -// ---- ---- ---- ----------- -// 000 08/19/19 Fillmore New +// Mod# Date Name Description +// ---- ---- ---- ----------- +// 000 08/19/19 Fillmore New +// 001 09/28/22 Prestopnik MET #2227 Remove namespace std and netCDF from header files // //////////////////////////////////////////////////////////////////////// @@ -23,8 +24,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -39,7 +38,6 @@ using namespace std; #include #include -using namespace netCDF; #include "rmw_analysis_conf_info.h" @@ -83,23 +81,23 @@ static ConcatString out_dir; ConcatString out_file; // NetCDF file information -static NcFile* nc_in = (NcFile*) 0; -static NcFile* nc_out = (NcFile*) 0; +static netCDF::NcFile* nc_in = (netCDF::NcFile*) 0; +static netCDF::NcFile* nc_out = (netCDF::NcFile*) 0; // Grid dimension information -static NcDim range_dim; -static NcDim azimuth_dim; -static NcDim level_dim; -static NcDim track_point_dim; +static netCDF::NcDim range_dim; +static netCDF::NcDim azimuth_dim; +static netCDF::NcDim level_dim; +static netCDF::NcDim track_point_dim; -static string range_name; -static string range_units; -static string azimuth_name; -static string azimuth_units; -static string level_name; -static string level_units; +static std::string range_name; +static std::string range_units; +static std::string azimuth_name; +static std::string azimuth_units; +static std::string level_name; +static std::string level_units; -static NcVar valid_time_var; +static netCDF::NcVar valid_time_var; // Grid data static int n_range; @@ -108,27 +106,27 @@ static int n_level; static int n_track_point; static int n_track_line; -vector range_coord; -vector azimuth_coord; -vector level_coord; +std::vector range_coord; +std::vector azimuth_coord; +std::vector level_coord; -vector track_valid_time; -vector track_lat; -vector track_lon; -vector track_rmw; +std::vector track_valid_time; +std::vector track_lat; +std::vector track_lon; +std::vector track_rmw; // Variable information -static vector data_names; -static vector data_n_dims; -static vector data_long_names; -static vector data_units; +static std::vector data_names; +static std::vector data_n_dims; +static std::vector data_long_names; +static std::vector data_units; // Variable data -static vector data_counts; -static vector data_means; -static vector data_stdevs; -static vector data_mins; -static vector data_maxs; +static std::vector data_counts; +static std::vector data_means; +static std::vector data_stdevs; +static std::vector data_mins; +static std::vector data_maxs; // Track information static TrackInfoArray adeck_tracks; diff --git a/src/tools/tc_utils/rmw_analysis/rmw_analysis_conf_info.cc b/src/tools/tc_utils/rmw_analysis/rmw_analysis_conf_info.cc index 28f6d0c864..ed8860ed5f 100644 --- a/src/tools/tc_utils/rmw_analysis/rmw_analysis_conf_info.cc +++ b/src/tools/tc_utils/rmw_analysis/rmw_analysis_conf_info.cc @@ -8,6 +8,8 @@ //////////////////////////////////////////////////////////////////////// +using namespace std; + #include #include #include diff --git a/src/tools/tc_utils/rmw_analysis/rmw_analysis_conf_info.h b/src/tools/tc_utils/rmw_analysis/rmw_analysis_conf_info.h index ff1e1b7193..37b5db6188 100644 --- a/src/tools/tc_utils/rmw_analysis/rmw_analysis_conf_info.h +++ b/src/tools/tc_utils/rmw_analysis/rmw_analysis_conf_info.h @@ -13,8 +13,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include "vx_config.h" diff --git a/src/tools/tc_utils/tc_dland/tc_dland.cc b/src/tools/tc_utils/tc_dland/tc_dland.cc index 2c043a9619..dac4f15243 100644 --- a/src/tools/tc_utils/tc_dland/tc_dland.cc +++ b/src/tools/tc_utils/tc_dland/tc_dland.cc @@ -18,9 +18,13 @@ // 001 07/25/14 Halley Gotway Add -land option and update how // distances are computed. // 002 07/06/22 Howard Soh METplus-Internal #19 Rename main to met_main +// 003 09/28/22 Prestopnik MET #2227 Remove namspace std and netCDF +// from header files // //////////////////////////////////////////////////////////////////////// +using namespace std; + #include #include #include @@ -31,6 +35,9 @@ #include #include +#include +using namespace netCDF; + #include "main.h" #include "grib_classes.h" @@ -311,7 +318,7 @@ void process_distances() { void usage() { cout << "\n*** Model Evaluation Tools (MET" << met_version - << ") ***\n\n" + << ") ***\n\n" << "Usage: " << program_name << "\n" << "\tout_file\n" diff --git a/src/tools/tc_utils/tc_dland/tc_poly.h b/src/tools/tc_utils/tc_dland/tc_poly.h index 35c9ab9428..758f2131d9 100644 --- a/src/tools/tc_utils/tc_dland/tc_poly.h +++ b/src/tools/tc_utils/tc_dland/tc_poly.h @@ -32,7 +32,7 @@ class TCPoly { friend class TCPolyArray; - friend bool operator>>(istream &, TCPoly &); + friend bool operator>>(std::istream &, TCPoly &); private: @@ -69,7 +69,7 @@ inline ConcatString TCPoly::name() const { return(Name); } //////////////////////////////////////////////////////////////////////// -extern bool operator>>(istream &, TCPoly &); +extern bool operator>>(std::istream &, TCPoly &); //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/tc_utils/tc_gen/Makefile.am b/src/tools/tc_utils/tc_gen/Makefile.am index 7f739ade46..f66a1577ef 100644 --- a/src/tools/tc_utils/tc_gen/Makefile.am +++ b/src/tools/tc_utils/tc_gen/Makefile.am @@ -30,10 +30,10 @@ tc_gen_LDADD = -lvx_stat_out \ -lvx_statistics \ -lvx_gis \ -lvx_data2d \ + -lvx_seeps \ -lvx_nc_util \ -lvx_regrid \ -lvx_grid \ - -lvx_seeps \ -lvx_config \ -lvx_pb_util \ -lvx_cal \ diff --git a/src/tools/tc_utils/tc_gen/tc_gen.cc b/src/tools/tc_utils/tc_gen/tc_gen.cc index f28d121d12..76f1a09652 100644 --- a/src/tools/tc_utils/tc_gen/tc_gen.cc +++ b/src/tools/tc_utils/tc_gen/tc_gen.cc @@ -24,9 +24,13 @@ // 007 11/22/21 Halley Gotway MET #1810 Add -shape option // 008 05/02/22 Halley Gotway MET #2148 Fix init_hour and lead misses // 009 07/06/22 Howard Soh METplus-Internal #19 Rename main to met_main +// 010 09/28/22 Prestopnik MET #2227 Remove using namespace std and netCDF from header files +// // //////////////////////////////////////////////////////////////////////// +using namespace std; + #include #include #include @@ -38,6 +42,9 @@ #include #include +#include +using namespace netCDF; + #include "main.h" #include "tc_gen.h" #include "pair_data_genesis.h" diff --git a/src/tools/tc_utils/tc_gen/tc_gen.h b/src/tools/tc_utils/tc_gen/tc_gen.h index 64cc8975c7..ad1d164729 100644 --- a/src/tools/tc_utils/tc_gen/tc_gen.h +++ b/src/tools/tc_utils/tc_gen/tc_gen.h @@ -13,8 +13,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -30,7 +28,6 @@ using namespace std; #include #include -using namespace netCDF; #include "tc_gen_conf_info.h" @@ -116,9 +113,9 @@ static ConcatString out_base; // Output NetCDF file static ConcatString out_nc_file; -static NcFile *nc_out = (NcFile *) 0; -static NcDim lat_dim; -static NcDim lon_dim; +static netCDF::NcFile *nc_out = (netCDF::NcFile *) 0; +static netCDF::NcDim lat_dim; +static netCDF::NcDim lon_dim; // List of output NetCDF variable names static StringArray nc_var_sa; diff --git a/src/tools/tc_utils/tc_pairs/tc_pairs.cc b/src/tools/tc_utils/tc_pairs/tc_pairs.cc index fd5f6d20ba..70469e584d 100644 --- a/src/tools/tc_utils/tc_pairs/tc_pairs.cc +++ b/src/tools/tc_utils/tc_pairs/tc_pairs.cc @@ -33,10 +33,13 @@ // that contain all required lead times. // 011 07/27/18 Halley Gotway Support masks defined by // the gen_vx_mask tool. -// 020 07/06/22 Howard Soh METplus-Internal #19 Rename main to met_main +// 012 07/06/22 Howard Soh METplus-Internal #19 Rename main to met_main +// 013 09/28/22 Prestopnik MET #2227 Remove namespace std from header files // //////////////////////////////////////////////////////////////////////// +using namespace std; + #include #include #include @@ -171,7 +174,7 @@ int met_main(int argc, char *argv[]) { //////////////////////////////////////////////////////////////////////// const string get_tool_name() { - return "tc_gen"; + return "tc_pairs"; } //////////////////////////////////////////////////////////////////////// diff --git a/src/tools/tc_utils/tc_pairs/tc_pairs.h b/src/tools/tc_utils/tc_pairs/tc_pairs.h index 2e1d2f17ea..e49aed3c3d 100644 --- a/src/tools/tc_utils/tc_pairs/tc_pairs.h +++ b/src/tools/tc_utils/tc_pairs/tc_pairs.h @@ -16,6 +16,7 @@ // ---- ---- ---- ----------- // 000 03/14/12 Halley Gotway New // 001 03/09/17 Halley Gotway Define BEST track time step. +// 002 09/28/22 Prestopnik MET #2227 Remove namespace std from header files // //////////////////////////////////////////////////////////////////////// @@ -24,8 +25,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include diff --git a/src/tools/tc_utils/tc_pairs/tc_pairs_conf_info.h b/src/tools/tc_utils/tc_pairs/tc_pairs_conf_info.h index 4b7b2e364f..3fc82f2671 100644 --- a/src/tools/tc_utils/tc_pairs/tc_pairs_conf_info.h +++ b/src/tools/tc_utils/tc_pairs/tc_pairs_conf_info.h @@ -112,7 +112,7 @@ class TCPairsConfInfo { int WatchWarnOffset; // Basin Map - map BasinMap; + std::map BasinMap; // Config file version ConcatString Version; diff --git a/src/tools/tc_utils/tc_rmw/Makefile.am b/src/tools/tc_utils/tc_rmw/Makefile.am index b2f3262661..d125fb2bed 100644 --- a/src/tools/tc_utils/tc_rmw/Makefile.am +++ b/src/tools/tc_utils/tc_rmw/Makefile.am @@ -35,6 +35,7 @@ tc_rmw_LDADD = -lvx_stat_out \ -lvx_config \ -lvx_gsl_prob \ -lvx_cal \ + -lvx_nav \ -lvx_util_math \ -lvx_util \ -lvx_math \ diff --git a/src/tools/tc_utils/tc_rmw/Makefile.in b/src/tools/tc_utils/tc_rmw/Makefile.in index 1ab4002cec..3a00b9ee32 100644 --- a/src/tools/tc_utils/tc_rmw/Makefile.in +++ b/src/tools/tc_utils/tc_rmw/Makefile.in @@ -344,6 +344,7 @@ tc_rmw_LDADD = -lvx_stat_out \ -lvx_config \ -lvx_gsl_prob \ -lvx_cal \ + -lvx_nav \ -lvx_util_math \ -lvx_util \ -lvx_math \ diff --git a/src/tools/tc_utils/tc_rmw/tc_rmw.cc b/src/tools/tc_utils/tc_rmw/tc_rmw.cc index 0ddfcdd710..09b60a0336 100644 --- a/src/tools/tc_utils/tc_rmw/tc_rmw.cc +++ b/src/tools/tc_utils/tc_rmw/tc_rmw.cc @@ -16,10 +16,13 @@ // ---- ---- ---- ----------- // 000 04/18/19 Fillmore New // 001 05/15/20 Halley Gotway Fix data file list option logic. -// 002 07/06/22 Howard Soh METplus-Internal #19 Rename main to met_main +// 002 07/06/22 Howard Soh METplus-Internal #19 Rename main to met_main +// 003 09/28/22 Prestopnik MET #2227 Remove namspace std and netCDF from header files // //////////////////////////////////////////////////////////////////////// +using namespace std; + #include #include #include @@ -30,6 +33,9 @@ #include #include +#include +using namespace netCDF; + #include "main.h" #include "tc_rmw.h" diff --git a/src/tools/tc_utils/tc_rmw/tc_rmw.h b/src/tools/tc_utils/tc_rmw/tc_rmw.h index 1a0e6ab178..0975708a20 100644 --- a/src/tools/tc_utils/tc_rmw/tc_rmw.h +++ b/src/tools/tc_utils/tc_rmw/tc_rmw.h @@ -12,9 +12,10 @@ // // Description: // -// Mod# Date Name Description -// ---- ---- ---- ----------- -// 000 04/18/19 Fillmore New +// Mod# Date Name Description +// ---- ---- ---- ----------- +// 000 04/18/19 Fillmore New +// 001 09/28/22 Prestopnik MET #2227 Remove namespace std and netCDF from header files // //////////////////////////////////////////////////////////////////////// @@ -23,7 +24,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; #include #include @@ -39,7 +39,6 @@ using namespace std; #include #include -using namespace netCDF; #include "tc_rmw_conf_info.h" #include "tc_rmw_wind_converter.h" @@ -98,33 +97,33 @@ static ConcatString out_prefix; // Output NetCDF file static ConcatString out_file; -static NcFile* nc_out = (NcFile*) 0; -static NcDim range_dim; -static NcDim azimuth_dim; -static NcDim pressure_dim; -static NcDim track_point_dim; -static NcVar lat_arr_var; -static NcVar lon_arr_var; -static NcVar valid_time_var; -static NcVar data_var; -static NcVar wind_r_var; -static NcVar wind_a_var; - -static vector data_vars; -static vector azi_mean_data_vars; - -static map data_3d_vars; +static netCDF::NcFile* nc_out = (netCDF::NcFile*) 0; +static netCDF::NcDim range_dim; +static netCDF::NcDim azimuth_dim; +static netCDF::NcDim pressure_dim; +static netCDF::NcDim track_point_dim; +static netCDF::NcVar lat_arr_var; +static netCDF::NcVar lon_arr_var; +static netCDF::NcVar valid_time_var; +static netCDF::NcVar data_var; +static netCDF::NcVar wind_r_var; +static netCDF::NcVar wind_a_var; + +static std::vector data_vars; +static std::vector azi_mean_data_vars; + +static std::map data_3d_vars; // List of output NetCDF variable names static StringArray nc_var_sa; -static map > variable_levels; -static map variable_long_names; -static map variable_units; +static std::map > variable_levels; +static std::map variable_long_names; +static std::map variable_units; -static set pressure_level_strings; -static set pressure_levels; -static map pressure_level_indices; +static std::set pressure_level_strings; +static std::set pressure_levels; +static std::map pressure_level_indices; //////////////////////////////////////////////////////////////////////// // diff --git a/src/tools/tc_utils/tc_rmw/tc_rmw_conf_info.cc b/src/tools/tc_utils/tc_rmw/tc_rmw_conf_info.cc index 92906015de..951c43f193 100644 --- a/src/tools/tc_utils/tc_rmw/tc_rmw_conf_info.cc +++ b/src/tools/tc_utils/tc_rmw/tc_rmw_conf_info.cc @@ -8,6 +8,8 @@ //////////////////////////////////////////////////////////////////////// +using namespace std; + #include #include #include diff --git a/src/tools/tc_utils/tc_rmw/tc_rmw_wind_converter.cc b/src/tools/tc_utils/tc_rmw/tc_rmw_wind_converter.cc index 762fc29edd..3ed71fc98f 100644 --- a/src/tools/tc_utils/tc_rmw/tc_rmw_wind_converter.cc +++ b/src/tools/tc_utils/tc_rmw/tc_rmw_wind_converter.cc @@ -16,9 +16,11 @@ // Mod# Date Name Description // ---- ---- ---- ----------- // 000 05/11/22 Albo Pulled the wind conversion into a class +// 001 09/28/22 Prestopnik MET #2227 Remove namespace std from header files // //////////////////////////////////////////////////////////////////////// +using namespace std; #include "tc_rmw_wind_converter.h" #include "series_data.h" @@ -111,7 +113,7 @@ void TCRMW_WindConverter::init(const TCRMWConfInfo *conf) { //////////////////////////////////////////////////////////////////////// -void TCRMW_WindConverter::update_input(const std::string &variableName, const std::string &units) { +void TCRMW_WindConverter::update_input(const string &variableName, const string &units) { if (_computeWinds) { if (variableName == _conf->u_wind_field_name.string()) { _foundUInInput = true; diff --git a/src/tools/tc_utils/tc_rmw/tc_rmw_wind_converter.h b/src/tools/tc_utils/tc_rmw/tc_rmw_wind_converter.h index d07f770c3c..a400841b24 100644 --- a/src/tools/tc_utils/tc_rmw/tc_rmw_wind_converter.h +++ b/src/tools/tc_utils/tc_rmw/tc_rmw_wind_converter.h @@ -97,9 +97,9 @@ class TCRMW_WindConverter { // append to the input maps for tangential and radial winds data // if configured to compute winds, but didn't find U or V, turn off // the wind computations and report an error - void append_nc_output_vars(map > &variable_levels, - map &variable_long_names, - map &variable_units); + void append_nc_output_vars(std::map > &variable_levels, + std::map &variable_long_names, + std::map &variable_units); // Check input varName against U, and if it's a match, lookup V using the // map members, and then compute tangential and radial winds if it is so diff --git a/src/tools/tc_utils/tc_stat/Makefile.am b/src/tools/tc_utils/tc_stat/Makefile.am index 02b7d39821..60827d3d98 100644 --- a/src/tools/tc_utils/tc_stat/Makefile.am +++ b/src/tools/tc_utils/tc_stat/Makefile.am @@ -31,14 +31,15 @@ tc_stat_LDADD = -lvx_stat_out \ -lvx_data2d_nccf \ -lvx_statistics \ -lvx_data2d \ + -lvx_seeps \ -lvx_nc_util \ -lvx_regrid \ -lvx_grid \ - -lvx_seeps \ -lvx_config \ -lvx_gsl_prob \ -lvx_pb_util \ -lvx_cal \ + -lvx_nav \ -lvx_util_math \ -lvx_util \ -lvx_math \ diff --git a/src/tools/tc_utils/tc_stat/Makefile.in b/src/tools/tc_utils/tc_stat/Makefile.in index e2f297ef2d..df8bbe5b6a 100644 --- a/src/tools/tc_utils/tc_stat/Makefile.in +++ b/src/tools/tc_utils/tc_stat/Makefile.in @@ -348,6 +348,7 @@ tc_stat_LDADD = -lvx_stat_out \ -lvx_gsl_prob \ -lvx_pb_util \ -lvx_cal \ + -lvx_nav \ -lvx_util_math \ -lvx_util \ -lvx_math \ diff --git a/src/tools/tc_utils/tc_stat/tc_stat.cc b/src/tools/tc_utils/tc_stat/tc_stat.cc index ae2610eba4..c536227149 100644 --- a/src/tools/tc_utils/tc_stat/tc_stat.cc +++ b/src/tools/tc_utils/tc_stat/tc_stat.cc @@ -19,10 +19,13 @@ // 002 09/28/16 Halley Gotway Add DESC output column. // 003 07/27/18 Halley Gotway Support masks defined by // the gen_vx_mask tool. -// 020 07/06/22 Howard Soh METplus-Internal #19 Rename main to met_main +// 004 07/06/22 Howard Soh METplus-Internal #19 Rename main to met_main +// 005 09/28/22 Prestopnik MET #2227 Remove namespace std from header files // //////////////////////////////////////////////////////////////////////// +using namespace std; + #include #include #include @@ -307,7 +310,7 @@ void close_out_file() { void usage() { cout << "\n*** Model Evaluation Tools (MET" << met_version - << ") ***\n\n" + << ") ***\n\n" << "Usage: " << program_name << "\n" << "\t-lookin source\n" diff --git a/src/tools/tc_utils/tc_stat/tc_stat.h b/src/tools/tc_utils/tc_stat/tc_stat.h index 0e526f46ee..e037f69bb5 100644 --- a/src/tools/tc_utils/tc_stat/tc_stat.h +++ b/src/tools/tc_utils/tc_stat/tc_stat.h @@ -15,6 +15,7 @@ // Mod# Date Name Description // ---- ---- ---- ----------- // 000 04/03/12 Halley Gotway New +// 001 09/28/22 Prestopnik MET #2227 Remove namespace std from header files // //////////////////////////////////////////////////////////////////////// @@ -23,8 +24,6 @@ //////////////////////////////////////////////////////////////////////// -using namespace std; - #include #include #include @@ -82,7 +81,7 @@ static ConcatString command_line_job; //////////////////////////////////////////////////////////////////////// // Output file stream -static ofstream *tc_stat_out = (ofstream *) 0; +static std::ofstream *tc_stat_out = (std::ofstream *) 0; //////////////////////////////////////////////////////////////////////// // diff --git a/src/tools/tc_utils/tc_stat/tc_stat_job.h b/src/tools/tc_utils/tc_stat/tc_stat_job.h index 8d35120a5d..c01bcaeb2d 100644 --- a/src/tools/tc_utils/tc_stat/tc_stat_job.h +++ b/src/tools/tc_utils/tc_stat/tc_stat_job.h @@ -195,7 +195,7 @@ class TCStatJob { void clear(); - void dump(ostream &, int depth = 0) const; + void dump(std::ostream &, int depth = 0) const; ////////////////////////////////////////////////////////////////// @@ -224,8 +224,8 @@ class TCStatJob { void open_stat_file(); void close_stat_file(); - void dump_pair(const TrackPairInfo &, ofstream *); - void dump_line(const TCStatLine &, ofstream *); + void dump_pair(const TrackPairInfo &, std::ofstream *); + void dump_line(const TCStatLine &, std::ofstream *); virtual ConcatString serialize() const; @@ -285,27 +285,27 @@ class TCStatJob { bool WaterOnly; // Numeric column thresholds - map ColumnThreshMap; + std::map ColumnThreshMap; // ASCII column string matching - map ColumnStrIncMap; - map ColumnStrExcMap; + std::map ColumnStrIncMap; + std::map ColumnStrExcMap; // Numeric column thresholds - map InitThreshMap; + std::map InitThreshMap; // ASCII column string matching - map InitStrIncMap; - map InitStrExcMap; + std::map InitStrIncMap; + std::map InitStrExcMap; // Variables to the store the analysis job specification - ConcatString DumpFile; // Dump TrackPairInfo used to a file - ofstream *DumpOut; // Dump output file stream - ofstream *JobOut; // Job output file stream (not allocated) + ConcatString DumpFile; // Dump TrackPairInfo used to a file + std::ofstream *DumpOut; // Dump output file stream + std::ofstream *JobOut; // Job output file stream (not allocated) // Derived output statistics - ConcatString StatFile; // File name for output statistics - ofstream *StatOut; // Output statistics file stream + ConcatString StatFile; // File name for output statistics + std::ofstream *StatOut; // Output statistics file stream // Polyline masking regions ConcatString OutInitMaskFile; @@ -376,7 +376,7 @@ class TCStatJobFilter : public TCStatJob { void filter_tracks(TCLineCounts &); void filter_lines (TCLineCounts &); - void do_output(ostream &); + void do_output(std::ostream &); }; @@ -413,9 +413,9 @@ class TCStatJobSummary : public TCStatJob { void process_pair(TrackPairInfo &); void process_line(TCStatLine &); - void add_map(map&); + void add_map(std::map&); - void do_output(ostream &); + void do_output(std::ostream &); void compute_fsp(NumArray &, NumArray &, NumArray &); @@ -436,7 +436,7 @@ class TCStatJobSummary : public TCStatJob { SingleThresh FSPThresh; // Map column and case info to column values - map SummaryMap; + std::map SummaryMap; }; @@ -451,7 +451,7 @@ class TCStatJobRIRW : public TCStatJob { void assign(const TCStatJobRIRW &); ConcatString DumpFileCTC[4]; - ofstream *DumpOutCTC[4]; + std::ofstream *DumpOutCTC[4]; public: @@ -473,12 +473,12 @@ class TCStatJobRIRW : public TCStatJob { void process_pair(TrackPairInfo &); - void add_map(map&); + void add_map(std::map&); - void do_output (ostream &); - void do_ctc_output(ostream &); - void do_cts_output(ostream &); - void do_mpr_output(ostream &); + void do_output (std::ostream &); + void do_ctc_output(std::ostream &); + void do_cts_output(std::ostream &); + void do_mpr_output(std::ostream &); // Store the case information StringArray ByColumn; @@ -490,7 +490,7 @@ class TCStatJobRIRW : public TCStatJob { StringArray OutLineType; // Map column and case info to column values - map RIRWMap; + std::map RIRWMap; }; @@ -523,7 +523,7 @@ class TCStatJobProbRIRW : public TCStatJob { void process_pair(ProbRIRWPairInfo &); - void do_output(ostream &); + void do_output(std::ostream &); // Probability information bool ProbRIRWExact; // True for exact change, false for maximum change @@ -544,7 +544,7 @@ class TCStatJobProbRIRW : public TCStatJob { StringArray OutLineType; // Map column and case info to column values - map ProbRIRWMap; + std::map ProbRIRWMap; };