diff --git a/data/config/ConfigConstants b/data/config/ConfigConstants index 8cbbeef1e9..c28b13ec28 100644 --- a/data/config/ConfigConstants +++ b/data/config/ConfigConstants @@ -35,6 +35,13 @@ F_to_K(t) = C_to_K(F_to_C(t)); MM_to_IN(x) = x / 25.4; IN_to_MM(x) = x * 25.4; +M_to_FT(x) = x * 3.28084; +FT_to_M(x) = x / 3.28084; +M_to_KFT(x) = M_to_FT(x) / 1000.0; +KFT_to_M(x) = FT_to_M(x * 1000.0); +KM_to_KFT(x) = M_to_KFT(1000.0 * x); +KFT_to_KM(x) = KFT_to_M(x) / 1000.0; + PA_to_HPA(p) = p / 100.0; HPA_to_PA(p) = p * 100.0; PA_to_MB(p) = PA_to_HPA(p); diff --git a/data/table_files/met_header_columns_V11.0.txt b/data/table_files/met_header_columns_V11.0.txt index 0c30295879..86f6887d7e 100644 --- a/data/table_files/met_header_columns_V11.0.txt +++ b/data/table_files/met_header_columns_V11.0.txt @@ -25,9 +25,9 @@ V11.0 : STAT : RELP : VERSION MODEL DESC FCST_LEAD FCST_VALID_BEG FCST_VALID V11.0 : STAT : SAL1L2 : 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 TOTAL FABAR OABAR FOABAR FFABAR OOABAR MAE V11.0 : STAT : SL1L2 : 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 TOTAL FBAR OBAR FOBAR FFBAR OOBAR MAE V11.0 : STAT : SSVAR : 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 TOTAL N_BIN BIN_i BIN_N VAR_MIN VAR_MAX VAR_MEAN FBAR OBAR FOBAR FFBAR OOBAR FBAR_NCL FBAR_NCU FSTDEV FSTDEV_NCL FSTDEV_NCU OBAR_NCL OBAR_NCU OSTDEV OSTDEV_NCL OSTDEV_NCU PR_CORR PR_CORR_NCL PR_CORR_NCU ME ME_NCL ME_NCU ESTDEV ESTDEV_NCL ESTDEV_NCU MBIAS MSE BCMSE RMSE -V11.0 : STAT : VAL1L2 : 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 TOTAL UFABAR VFABAR UOABAR VOABAR UVFOABAR UVFFABAR UVOOABAR +V11.0 : STAT : VAL1L2 : 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 TOTAL UFABAR VFABAR UOABAR VOABAR UVFOABAR UVFFABAR UVOOABAR FA_SPEED_BAR OA_SPEED_BAR V11.0 : STAT : VL1L2 : 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 TOTAL UFBAR VFBAR UOBAR VOBAR UVFOBAR UVFFBAR UVOOBAR F_SPEED_BAR O_SPEED_BAR -V11.0 : STAT : VCNT : 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 TOTAL FBAR FBAR_BCL FBAR_BCU OBAR OBAR_BCL OBAR_BCU FS_RMS FS_RMS_BCL FS_RMS_BCU OS_RMS OS_RMS_BCL OS_RMS_BCU MSVE MSVE_BCL MSVE_BCU RMSVE RMSVE_BCL RMSVE_BCU FSTDEV FSTDEV_BCL FSTDEV_BCU OSTDEV OSTDEV_BCL OSTDEV_BCU FDIR FDIR_BCL FDIR_BCU ODIR ODIR_BCL ODIR_BCU FBAR_SPEED FBAR_SPEED_BCL FBAR_SPEED_BCU OBAR_SPEED OBAR_SPEED_BCL OBAR_SPEED_BCU VDIFF_SPEED VDIFF_SPEED_BCL VDIFF_SPEED_BCU VDIFF_DIR VDIFF_DIR_BCL VDIFF_DIR_BCU SPEED_ERR SPEED_ERR_BCL SPEED_ERR_BCU SPEED_ABSERR SPEED_ABSERR_BCL SPEED_ABSERR_BCU DIR_ERR DIR_ERR_BCL DIR_ERR_BCU DIR_ABSERR DIR_ABSERR_BCL DIR_ABSERR_BCU +V11.0 : STAT : VCNT : 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 TOTAL FBAR FBAR_BCL FBAR_BCU OBAR OBAR_BCL OBAR_BCU FS_RMS FS_RMS_BCL FS_RMS_BCU OS_RMS OS_RMS_BCL OS_RMS_BCU MSVE MSVE_BCL MSVE_BCU RMSVE RMSVE_BCL RMSVE_BCU FSTDEV FSTDEV_BCL FSTDEV_BCU OSTDEV OSTDEV_BCL OSTDEV_BCU FDIR FDIR_BCL FDIR_BCU ODIR ODIR_BCL ODIR_BCU FBAR_SPEED FBAR_SPEED_BCL FBAR_SPEED_BCU OBAR_SPEED OBAR_SPEED_BCL OBAR_SPEED_BCU VDIFF_SPEED VDIFF_SPEED_BCL VDIFF_SPEED_BCU VDIFF_DIR VDIFF_DIR_BCL VDIFF_DIR_BCU SPEED_ERR SPEED_ERR_BCL SPEED_ERR_BCU SPEED_ABSERR SPEED_ABSERR_BCL SPEED_ABSERR_BCU DIR_ERR DIR_ERR_BCL DIR_ERR_BCU DIR_ABSERR DIR_ABSERR_BCL DIR_ABSERR_BCU ANOM_CORR ANOM_CORR_NCL ANOM_CORR_NCU ANOM_CORR_BCL ANOM_CORR_BCU ANOM_CORR_UNCNTR ANOM_CORR_UNCNTR_BCL ANOM_CORR_UNCNTR_BCU V11.0 : STAT : GENMPR : 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 TOTAL INDEX STORM_ID PROB_LEAD PROB_VAL AGEN_INIT AGEN_FHR AGEN_LAT AGEN_LON AGEN_DLAND BGEN_LAT BGEN_LON BGEN_DLAND GEN_DIST GEN_TDIFF INIT_TDIFF DEV_CAT OPS_CAT V11.0 : STAT : SSIDX : 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 FCST_MODEL REF_MODEL N_INIT N_TERM N_VLD SS_INDEX diff --git a/docs/Users_Guide/point-stat.rst b/docs/Users_Guide/point-stat.rst index 8ee096b946..37d8a9175c 100644 --- a/docs/Users_Guide/point-stat.rst +++ b/docs/Users_Guide/point-stat.rst @@ -1297,10 +1297,16 @@ The first set of header columns are common to all of the output files generated * - 32 - UVOOABAR - Mean((uo-uc)²+(vo-vc)²) + * - 33 + - FA_SPEED_BAR + - Mean forecast wind speed anomaly + * - 34 + - OA_SPEED_BAR + - Mean observed wind speed anomaly .. _table_PS_format_info_VCNT: -.. list-table:: Format information for VCNT (Vector Continuous Statistics) output line type. Note that each statistic (except TOTAL) is followed by two columns giving bootstrap confidence intervals. These confidence intervals are not currently calculated for this release of MET, but will be in future releases. +.. list-table:: Format information for VCNT (Vector Continuous Statistics) output line type. Note that the bootstrap confidence intervals columns ending with BCL and BCU are not currently calculated for this release of MET, but will be in future releases. :widths: auto :header-rows: 2 @@ -1317,59 +1323,65 @@ The first set of header columns are common to all of the output files generated - TOTAL - Total number of data points * - 26-28 - - FBAR - - Mean value of forecast wind speed + - FBAR, :raw-html:`
` FBAR_BCL, :raw-html:`
` FBAR_BCU + - Mean value of forecast wind speed including bootstrap upper and lower confidence limits * - 29-31 - - OBAR - - Mean value of observed wind speed + - OBAR, :raw-html:`
` OBAR_BCL, :raw-html:`
` OBAR_BCU + - Mean value of observed wind speed including bootstrap upper and lower confidence limits * - 32-34 - - FS_RMS - - Root mean square forecast wind speed + - FS_RMS, :raw-html:`
` FS_RMS_BCL, :raw-html:`
` FS_RMS_BCU + - Root mean square forecast wind speed including bootstrap upper and lower confidence limits * - 35-37 - - OS_RMS - - Root mean square observed wind speed + - OS_RMS, :raw-html:`
` OS_RMS_BCL, :raw-html:`
` OS_RMS_BCU + - Root mean square observed wind speed including bootstrap upper and lower confidence limits * - 38-40 - - MSVE - - Mean squared length of the vector difference between the forecast and observed winds + - MSVE, :raw-html:`
` MSVE_BCL, :raw-html:`
` MSVE_BCU + - Mean squared length of the vector difference between the forecast and observed winds including bootstrap upper and lower confidence limits * - 41-43 - - RMSVE - - Square root of MSVE + - RMSVE, :raw-html:`
` RMSVE_BCL, :raw-html:`
` RMSVE_BCU + - Square root of MSVE including bootstrap upper and lower confidence limits * - 45-46 - - FSTDEV - - Standard deviation of the forecast wind speed + - FSTDEV, :raw-html:`
` FSTDEV_BCL, :raw-html:`
` FSTDEV_BCU + - Standard deviation of the forecast wind speed including bootstrap upper and lower confidence limits * - 47-49 - - OSTDEV - - Standard deviation of the observed wind field + - OSTDEV, :raw-html:`
` OSTDEV_BCL, :raw-html:`
` OSTDEV_BCU + - Standard deviation of the observed wind field including bootstrap upper and lower confidence limits * - 50-52 - - FDIR - - Direction of the average forecast wind vector + - FDIR, :raw-html:`
` FDIR_BCL, :raw-html:`
` FDIR_BCU + - Direction of the average forecast wind vector including bootstrap upper and lower confidence limits * - 53-55 - - ODIR - - Direction of the average observed wind vector + - ODIR, :raw-html:`
` ODIR_BCL, :raw-html:`
` ODIR_BCU + - Direction of the average observed wind vector including bootstrap upper and lower confidence limits * - 56-58 - - FBAR_SPEED - - Length (speed) of the average forecast wind vector + - FBAR_SPEED, :raw-html:`
` FBAR_SPEED_BCL, :raw-html:`
` FBAR_SPEED_BCU + - Length (speed) of the average forecast wind vector including bootstrap upper and lower confidence limits * - 59-61 - - OBAR_SPEED - - Length (speed) of the average observed wind vector + - OBAR_SPEED, :raw-html:`
` OBAR_SPEED_BCL, :raw-html:`
` OBAR_SPEED_BCU + - Length (speed) of the average observed wind vector including bootstrap upper and lower confidence limits * - 62-64 - - VDIFF_SPEED - - Length (speed) of the vector difference between the average forecast and average observed wind vectors + - VDIFF_SPEED, :raw-html:`
` VDIFF_SPEED_BCL, :raw-html:`
` VDIFF_SPEED_BCU + - Length (speed) of the vector difference between the average forecast and average observed wind vectors including bootstrap upper and lower confidence limits * - 65-67 - - VDIFF_DIR - - Direction of the vector difference between the average forecast and average wind vectors + - VDIFF_DIR, :raw-html:`
` VDIFF_DIR_BCL, :raw-html:`
` VDIFF_DIR_BCU + - Direction of the vector difference between the average forecast and average wind vectors including bootstrap upper and lower confidence limits * - 68-70 - - SPEED_ERR - - Difference between the length of the average forecast wind vector and the average observed wind vector (in the sense F - O) + - SPEED_ERR, :raw-html:`
` SPEED_ERR_BCL, :raw-html:`
` SPEED_ERR_BCU + - Difference between the length of the average forecast wind vector and the average observed wind vector (in the sense F - O) including bootstrap upper and lower confidence limits * - 71-73 - - SPEED_ABSERR - - Absolute value of SPEED_ERR + - SPEED_ABSERR, :raw-html:`
` SPEED_ABSERR_BCL, :raw-html:`
` SPEED_ABSERR_BCU + - Absolute value of SPEED_ERR including bootstrap upper and lower confidence limits * - 74-76 - - DIR_ERR - - Signed angle between the directions of the average forecast and observed wing vectors. Positive if the forecast wind vector is counterclockwise from the observed wind vector + - DIR_ERR, :raw-html:`
` DIR_ERR_BCL, :raw-html:`
` DIR_ERR_BCU + - Signed angle between the directions of the average forecast and observed wing vectors. Positive if the forecast wind vector is counterclockwise from the observed wind vector including bootstrap upper and lower confidence limits * - 77-79 - - DIR_ABSERR - - Absolute value of DIR_ABSERR + - DIR_ABSERR, :raw-html:`
` DIR_ABSERR_BCL, :raw-html:`
` DIR_ABSERR_BCU + - Absolute value of DIR_ABSERR including bootstrap upper and lower confidence limits + * - 80-84 + - ANOM_CORR, :raw-html:`
` ANOM_CORR_NCL, :raw-html:`
` ANOM_CORR_NCU, :raw-html:`
` ANOM_CORR_BCL, :raw-html:`
` ANOM_CORR_BCU + - Vector Anomaly Correlation including mean error with normal and bootstrap upper and lower confidence limits + * - 85-87 + - ANOM_CORR_UNCNTR, :raw-html:`
` ANOM_CORR_UNCNTR_BCL, :raw-html:`
` ANOM_CORR_UNCNTR_BCU + - Uncentered vector Anomaly Correlation excluding mean error including bootstrap upper and lower confidence limits .. _table_PS_format_info_MPR: diff --git a/docs/Users_Guide/stat-analysis.rst b/docs/Users_Guide/stat-analysis.rst index b1b3e8367a..30ad22187f 100644 --- a/docs/Users_Guide/stat-analysis.rst +++ b/docs/Users_Guide/stat-analysis.rst @@ -45,7 +45,7 @@ The Stat-Analysis "aggregate" job aggregates values from multiple STAT lines of Aggregate STAT lines and produce aggregated statistics ------------------------------------------------------ -The Stat-Analysis "aggregate-stat" job aggregates multiple STAT lines of the same type together and produces relevant statistics from the aggregated line. This may be done in the same manner listed above in :numref:`StA_Aggregated-values-from`. However, rather than writing out the aggregated STAT line itself, the relevant statistics generated from that aggregated line are provided in the output. Specifically, if a contingency table line type (FHO, CTC, PCT, MCTC, or NBRCTC) has been aggregated, contingency table statistics (CTS, ECLV, PSTD, MCTS, or NBRCTS) line types can be computed. If a partial sums line type (SL1L2 or SAL1L2) has been aggregated, the continuous statistics (CNT) line type can be computed. If a vector partial sums line type (VL1L2) has been aggregated, the vector continuous statistics (VCNT) line type can be computed. For ensembles, the ORANK line type can be accumulated into ECNT, RPS, RHIST, PHIST, RELP, or SSVAR output. If the matched pair line type (MPR) has been aggregated, may output line types (FHO, CTC, CTS, CNT, MCTC, MCTS, SL1L2, SAL1L2, VL1L2, VCNT, WDIR, PCT, PSTD, PJC, PRC, or ECLV) can be computed. Multiple output line types may be specified for each "aggregate-stat" job, as long as each output is derivable from the input. +The Stat-Analysis "aggregate-stat" job aggregates multiple STAT lines of the same type together and produces relevant statistics from the aggregated line. This may be done in the same manner listed above in :numref:`StA_Aggregated-values-from`. However, rather than writing out the aggregated STAT line itself, the relevant statistics generated from that aggregated line are provided in the output. Specifically, if a contingency table line type (FHO, CTC, PCT, MCTC, or NBRCTC) has been aggregated, contingency table statistics (CTS, ECLV, PSTD, MCTS, or NBRCTS) line types can be computed. If a partial sums line type (SL1L2 or SAL1L2) has been aggregated, the continuous statistics (CNT) line type can be computed. If a vector partial sums line type (VL1L2 or VAL1L2) has been aggregated, the vector continuous statistics (VCNT) line type can be computed. For ensembles, the ORANK line type can be accumulated into ECNT, RPS, RHIST, PHIST, RELP, or SSVAR output. If the matched pair line type (MPR) has been aggregated, may output line types (FHO, CTC, CTS, CNT, MCTC, MCTS, SL1L2, SAL1L2, VL1L2, VCNT, WDIR, PCT, PSTD, PJC, PRC, or ECLV) can be computed. Multiple output line types may be specified for each "aggregate-stat" job, as long as each output is derivable from the input. When aggregating the matched pair line type (MPR), additional required job command options are determined by the requested output line type(s). For example, the "-out_thresh" (or "-out_fcst_thresh" and "-out_obs_thresh" options) are required to compute contingnecy table counts (FHO, CTC) or statistics (CTS). Those same job command options can also specify filtering thresholds when computing continuous partial sums (SL1L2, SAL1L2) or statistics (CNT). Output is written for each threshold specified. @@ -779,7 +779,7 @@ This job is similar to the "**aggregate**" job listed above, however the format * - SL1L2 or SAL1L2 - CNT * - VL1L2 or VAL1L2 - - WDIR (wind direction) + - WDIR (wind direction), VCNT * - PCT - PSTD, PJC, PRC * - NBRCTC diff --git a/internal/scripts/sonarqube/run_sonarqube.sh b/internal/scripts/sonarqube/run_sonarqube.sh index 5061adee35..491c8b6cea 100755 --- a/internal/scripts/sonarqube/run_sonarqube.sh +++ b/internal/scripts/sonarqube/run_sonarqube.sh @@ -5,7 +5,7 @@ # # This run_sonarqube.sh script will check out the specified version # of MET and run the SonarQube Source Code Analyzer on it. First, -# go to the directory where you would like the SCA output written and +# go to the directory where you would like the scanning output written and # then run: # # git clone https://github.com/dtcenter/MET @@ -121,17 +121,26 @@ run_command "./configure --prefix=`pwd` \ # Set the build id #BUILD_ID="MET-${1}" -# Copy sonar-project.properties -[ ! -e "sonar-project.properties" ] && cp -p $SCRIPT_DIR/sonar-project.properties . +SONAR_PROPERTIES=sonar-project.properties + +# Copy sonar-project.properties for Python code +[ -e $SONAR_PROPERTIES ] && rm $SONAR_PROPERTIES +cp -p $SCRIPT_DIR/python.sonar-project.properties $SONAR_PROPERTIES + +# Run SonarQube scan for Python code +run_command "${SONARQUBE_SCANNER_BIN}/sonar-scanner" + +# Copy sonar-project.properties for C/C++ code +[ -e $SONAR_PROPERTIES ] && rm $SONAR_PROPERTIES +cp -p $SCRIPT_DIR/$SONAR_PROPERTIES . # Run SonarQube clean run_command "make clean" - # Run SonarQube make run_command "${SONARQUBE_WRAPPER_BIN}/build-wrapper-linux-x86-64 --out-dir $SONARQUBE_OUT_DIR make" -# Run SonarQube scan +# Run SonarQube scan for C/C++ code run_command "${SONARQUBE_SCANNER_BIN}/sonar-scanner" # Run SonarQube report generator to make a PDF file diff --git a/internal/scripts/sonarqube/sonar-project.properties b/internal/scripts/sonarqube/sonar-project.properties index 387a9a3d74..a18d10de16 100644 --- a/internal/scripts/sonarqube/sonar-project.properties +++ b/internal/scripts/sonarqube/sonar-project.properties @@ -1,5 +1,5 @@ sonar.projectKey=org.sonarqube:MET_develop_NB -sonar.projectName=MET Nightly build +sonar.projectName=MET Nightly Build sonar.projectVersion=1.0 sonar.sources=src diff --git a/internal/test_unit/hdr/met_11_0.hdr b/internal/test_unit/hdr/met_11_0.hdr index 84f5b5a950..4b5bf6272a 100644 --- a/internal/test_unit/hdr/met_11_0.hdr +++ b/internal/test_unit/hdr/met_11_0.hdr @@ -26,8 +26,8 @@ SAL1L2 : VERSION MODEL DESC FCST_LEAD FCST_VALID_BEG FCST_VALID_END OBS_L SL1L2 : 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 TOTAL FBAR OBAR FOBAR FFBAR OOBAR MAE SSVAR : 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 TOTAL N_BIN BIN_i BIN_N VAR_MIN VAR_MAX VAR_MEAN FBAR OBAR FOBAR FFBAR OOBAR FBAR_NCL FBAR_NCU FSTDEV FSTDEV_NCL FSTDEV_NCU OBAR_NCL OBAR_NCU OSTDEV OSTDEV_NCL OSTDEV_NCU PR_CORR PR_CORR_NCL PR_CORR_NCU ME ME_NCL ME_NCU ESTDEV ESTDEV_NCL ESTDEV_NCU MBIAS MSE BCMSE RMSE VL1L2 : 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 TOTAL UFBAR VFBAR UOBAR VOBAR UVFOBAR UVFFBAR UVOOBAR F_SPEED_BAR O_SPEED_BAR -VAL1L2 : 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 TOTAL UFABAR VFABAR UOABAR VOABAR UVFOABAR UVFFABAR UVOOABAR -VCNT : 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 TOTAL FBAR FBAR_BCL FBAR_BCU OBAR OBAR_BCL OBAR_BCU FS_RMS FS_RMS_BCL FS_RMS_BCU OS_RMS OS_RMS_BCL OS_RMS_BCU MSVE MSVE_BCL MSVE_BCU RMSVE RMSVE_BCL RMSVE_BCU FSTDEV FSTDEV_BCL FSTDEV_BCU OSTDEV OSTDEV_BCL OSTDEV_BCU FDIR FDIR_BCL FDIR_BCU ODIR ODIR_BCL ODIR_BCU FBAR_SPEED FBAR_SPEED_BCL FBAR_SPEED_BCU OBAR_SPEED OBAR_SPEED_BCL OBAR_SPEED_BCU VDIFF_SPEED VDIFF_SPEED_BCL VDIFF_SPEED_BCU VDIFF_DIR VDIFF_DIR_BCL VDIFF_DIR_BCU SPEED_ERR SPEED_ERR_BCL SPEED_ERR_BCU SPEED_ABSERR SPEED_ABSERR_BCL SPEED_ABSERR_BCU DIR_ERR DIR_ERR_BCL DIR_ERR_BCU DIR_ABSERR DIR_ABSERR_BCL DIR_ABSERR_BCU +VAL1L2 : 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 TOTAL UFABAR VFABAR UOABAR VOABAR UVFOABAR UVFFABAR UVOOABAR FA_SPEED_BAR OA_SPEED_BAR +VCNT : 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 TOTAL FBAR FBAR_BCL FBAR_BCU OBAR OBAR_BCL OBAR_BCU FS_RMS FS_RMS_BCL FS_RMS_BCU OS_RMS OS_RMS_BCL OS_RMS_BCU MSVE MSVE_BCL MSVE_BCU RMSVE RMSVE_BCL RMSVE_BCU FSTDEV FSTDEV_BCL FSTDEV_BCU OSTDEV OSTDEV_BCL OSTDEV_BCU FDIR FDIR_BCL FDIR_BCU ODIR ODIR_BCL ODIR_BCU FBAR_SPEED FBAR_SPEED_BCL FBAR_SPEED_BCU OBAR_SPEED OBAR_SPEED_BCL OBAR_SPEED_BCU VDIFF_SPEED VDIFF_SPEED_BCL VDIFF_SPEED_BCU VDIFF_DIR VDIFF_DIR_BCL VDIFF_DIR_BCU SPEED_ERR SPEED_ERR_BCL SPEED_ERR_BCU SPEED_ABSERR SPEED_ABSERR_BCL SPEED_ABSERR_BCU DIR_ERR DIR_ERR_BCL DIR_ERR_BCU DIR_ABSERR DIR_ABSERR_BCL DIR_ABSERR_BCU ANOM_CORR ANOM_CORR_NCL ANOM_CORR_NCU ANOM_CORR_BCL ANOM_CORR_BCU ANOM_CORR_UNCNTR ANOM_CORR_UNCNTR_BCL ANOM_CORR_UNCNTR_BCU GENMPR : 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 TOTAL INDEX STORM_ID PROB_LEAD PROB_VAL AGEN_INIT AGEN_FHR AGEN_LAT AGEN_LON AGEN_DLAND BGEN_LAT BGEN_LON BGEN_DLAND GEN_DIST GEN_TDIFF INIT_TDIFF DEV_CAT OPS_CAT SSIDX : 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 FCST_MODEL REF_MODEL N_INIT N_TERM N_VLD SS_INDEX 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 diff --git a/internal/test_unit/xml/unit_climatology_1.5deg.xml b/internal/test_unit/xml/unit_climatology_1.5deg.xml index 52dd69897b..cd1a86b353 100644 --- a/internal/test_unit/xml/unit_climatology_1.5deg.xml +++ b/internal/test_unit/xml/unit_climatology_1.5deg.xml @@ -47,7 +47,7 @@ - + &MET_BIN;/stat_analysis OUTPUT_DIR &OUTPUT_DIR;/climatology_1.5deg @@ -62,6 +62,21 @@ + + &MET_BIN;/stat_analysis + + OUTPUT_DIR &OUTPUT_DIR;/climatology_1.5deg + + \ + -lookin &OUTPUT_DIR;/climatology_1.5deg/point_stat_WMO_CLIMO_1.5DEG_120000L_20120409_120000V.stat \ + -job aggregate_stat -line_type VAL1L2 -out_line_type VCNT -by FCST_LEV \ + -out_stat &OUTPUT_DIR;/climatology_1.5deg/stat_analysis_WMO_1.5DEG_VAL1L2_to_VCNT_out.stat + + + &OUTPUT_DIR;/climatology_1.5deg/stat_analysis_WMO_1.5DEG_VAL1L2_to_VCNT_out.stat + + + &MET_BIN;/stat_analysis diff --git a/internal/test_unit/xml/unit_point_stat.xml b/internal/test_unit/xml/unit_point_stat.xml index d5446343cd..dd607efaff 100644 --- a/internal/test_unit/xml/unit_point_stat.xml +++ b/internal/test_unit/xml/unit_point_stat.xml @@ -45,6 +45,7 @@ &OUTPUT_DIR;/point_stat/point_stat_GRIB1_NAM_GDAS_120000L_20120409_120000V_sal1l2.txt &OUTPUT_DIR;/point_stat/point_stat_GRIB1_NAM_GDAS_120000L_20120409_120000V_vl1l2.txt &OUTPUT_DIR;/point_stat/point_stat_GRIB1_NAM_GDAS_120000L_20120409_120000V_val1l2.txt + &OUTPUT_DIR;/point_stat/point_stat_GRIB1_NAM_GDAS_120000L_20120409_120000V_vcnt.txt &OUTPUT_DIR;/point_stat/point_stat_GRIB1_NAM_GDAS_120000L_20120409_120000V_mpr.txt @@ -94,6 +95,7 @@ &OUTPUT_DIR;/point_stat/point_stat_GRIB1_NAM_GDAS_MASK_SID_120000L_20120409_120000V_sal1l2.txt &OUTPUT_DIR;/point_stat/point_stat_GRIB1_NAM_GDAS_MASK_SID_120000L_20120409_120000V_vl1l2.txt &OUTPUT_DIR;/point_stat/point_stat_GRIB1_NAM_GDAS_MASK_SID_120000L_20120409_120000V_val1l2.txt + &OUTPUT_DIR;/point_stat/point_stat_GRIB1_NAM_GDAS_MASK_SID_120000L_20120409_120000V_vcnt.txt &OUTPUT_DIR;/point_stat/point_stat_GRIB1_NAM_GDAS_MASK_SID_120000L_20120409_120000V_mpr.txt @@ -123,6 +125,7 @@ &OUTPUT_DIR;/point_stat/point_stat_GRIB2_NAM_NDAS_120000L_20120409_120000V_sal1l2.txt &OUTPUT_DIR;/point_stat/point_stat_GRIB2_NAM_NDAS_120000L_20120409_120000V_vl1l2.txt &OUTPUT_DIR;/point_stat/point_stat_GRIB2_NAM_NDAS_120000L_20120409_120000V_val1l2.txt + &OUTPUT_DIR;/point_stat/point_stat_GRIB2_NAM_NDAS_120000L_20120409_120000V_vcnt.txt &OUTPUT_DIR;/point_stat/point_stat_GRIB2_NAM_NDAS_120000L_20120409_120000V_mpr.txt @@ -150,6 +153,7 @@ &OUTPUT_DIR;/point_stat/point_stat_GRIB2_SREF_GDAS_150000L_20120409_120000V_cnt.txt &OUTPUT_DIR;/point_stat/point_stat_GRIB2_SREF_GDAS_150000L_20120409_120000V_sl1l2.txt &OUTPUT_DIR;/point_stat/point_stat_GRIB2_SREF_GDAS_150000L_20120409_120000V_vl1l2.txt + &OUTPUT_DIR;/point_stat/point_stat_GRIB2_SREF_GDAS_150000L_20120409_120000V_vcnt.txt &OUTPUT_DIR;/point_stat/point_stat_GRIB2_SREF_GDAS_150000L_20120409_120000V_mpr.txt diff --git a/scripts/sonarqube/python.sonar-project.properties b/scripts/sonarqube/python.sonar-project.properties new file mode 100644 index 0000000000..497cf3f623 --- /dev/null +++ b/scripts/sonarqube/python.sonar-project.properties @@ -0,0 +1,17 @@ +sonar.projectKey=org.sonarqube:MET_python_NB +sonar.projectName=MET python Nightly Build +sonar.projectVersion=1.0 + +sonar.sources=scripts/python,data/wrappers + +# The build-wrapper output dir + +# Encoding of the source files +sonar.sourceEncoding=UTF-8 + +#----- Default SonarQube server +#sonar.host.url=http://localhost:9000 +sonar.host.url=http://mandan:9000 + +sonar.login=met +sonar.password=met@sonar.ucar diff --git a/src/basic/vx_util/stat_column_defs.h b/src/basic/vx_util/stat_column_defs.h index 130f41bcb1..98aadcbd44 100644 --- a/src/basic/vx_util/stat_column_defs.h +++ b/src/basic/vx_util/stat_column_defs.h @@ -123,39 +123,39 @@ static const char * vl1l2_columns [] = { "TOTAL", "UFBAR", "VFBAR", "UOBAR", "VOBAR", "UVFOBAR", "UVFFBAR", "UVOOBAR", "F_SPEED_BAR", - "O_SPEED_BAR", + "O_SPEED_BAR" }; static const char * val1l2_columns [] = { "TOTAL", "UFABAR", "VFABAR", "UOABAR", "VOABAR", "UVFOABAR", - "UVFFABAR", "UVOOABAR" + "UVFFABAR", "UVOOABAR", "FA_SPEED_BAR", + "OA_SPEED_BAR" }; static const char * vcnt_columns [] = { - "TOTAL", - - "FBAR", "FBAR_BCL", "FBAR_BCU", - "OBAR", "OBAR_BCL", "OBAR_BCU", - "FS_RMS", "FS_RMS_BCL", "FS_RMS_BCU", - "OS_RMS", "OS_RMS_BCL", "OS_RMS_BCU", - "MSVE", "MSVE_BCL", "MSVE_BCU", - "RMSVE", "RMSVE_BCL", "RMSVE_BCU", - "FSTDEV", "FSTDEV_BCL", "FSTDEV_BCU", - "OSTDEV", "OSTDEV_BCL", "OSTDEV_BCU", - "FDIR", "FDIR_BCL", "FDIR_BCU", - "ODIR", "ODIR_BCL", "ODIR_BCU", - "FBAR_SPEED", "FBAR_SPEED_BCL", "FBAR_SPEED_BCU", - "OBAR_SPEED", "OBAR_SPEED_BCL", "OBAR_SPEED_BCU", - "VDIFF_SPEED", "VDIFF_SPEED_BCL", "VDIFF_SPEED_BCU", - "VDIFF_DIR", "VDIFF_DIR_BCL", "VDIFF_DIR_BCU", - "SPEED_ERR", "SPEED_ERR_BCL", "SPEED_ERR_BCU", - "SPEED_ABSERR", "SPEED_ABSERR_BCL", "SPEED_ABSERR_BCU", - "DIR_ERR", "DIR_ERR_BCL", "DIR_ERR_BCU", - "DIR_ABSERR", "DIR_ABSERR_BCL", "DIR_ABSERR_BCU", - + "FBAR", "FBAR_BCL", "FBAR_BCU", + "OBAR", "OBAR_BCL", "OBAR_BCU", + "FS_RMS", "FS_RMS_BCL", "FS_RMS_BCU", + "OS_RMS", "OS_RMS_BCL", "OS_RMS_BCU", + "MSVE", "MSVE_BCL", "MSVE_BCU", + "RMSVE", "RMSVE_BCL", "RMSVE_BCU", + "FSTDEV", "FSTDEV_BCL", "FSTDEV_BCU", + "OSTDEV", "OSTDEV_BCL", "OSTDEV_BCU", + "FDIR", "FDIR_BCL", "FDIR_BCU", + "ODIR", "ODIR_BCL", "ODIR_BCU", + "FBAR_SPEED", "FBAR_SPEED_BCL", "FBAR_SPEED_BCU", + "OBAR_SPEED", "OBAR_SPEED_BCL", "OBAR_SPEED_BCU", + "VDIFF_SPEED", "VDIFF_SPEED_BCL", "VDIFF_SPEED_BCU", + "VDIFF_DIR", "VDIFF_DIR_BCL", "VDIFF_DIR_BCU", + "SPEED_ERR", "SPEED_ERR_BCL", "SPEED_ERR_BCU", + "SPEED_ABSERR", "SPEED_ABSERR_BCL", "SPEED_ABSERR_BCU", + "DIR_ERR", "DIR_ERR_BCL", "DIR_ERR_BCU", + "DIR_ABSERR", "DIR_ABSERR_BCL", "DIR_ABSERR_BCU", + "ANOM_CORR", "ANOM_CORR_NCL", "ANOM_CORR_NCU", "ANOM_CORR_BCL", "ANOM_CORR_BCU", + "ANOM_CORR_UNCNTR", "ANOM_CORR_UNCNTR_BCL", "ANOM_CORR_UNCNTR_BCU", }; static const char * pct_columns [] = { diff --git a/src/libcode/vx_stat_out/stat_columns.cc b/src/libcode/vx_stat_out/stat_columns.cc index c09d6aab51..4ca1718ba8 100644 --- a/src/libcode/vx_stat_out/stat_columns.cc +++ b/src/libcode/vx_stat_out/stat_columns.cc @@ -954,11 +954,11 @@ void write_val1l2_row(StatHdrColumns &shc, const VL1L2Info &vl1l2_info, //////////////////////////////////////////////////////////////////////// - void write_vcnt_row(StatHdrColumns &shc, const VL1L2Info &vcnt_info, STATOutputType out_type, AsciiTable &stat_at, int &stat_row, AsciiTable &txt_at, int &txt_row) { + int i; // VL1L2 line type shc.set_line_type(stat_vcnt_str); @@ -970,24 +970,30 @@ void write_vcnt_row(StatHdrColumns &shc, const VL1L2Info &vcnt_info, // Not Applicable shc.set_cov_thresh(na_str); - shc.set_alpha(bad_data_double); - // Write the header columns - write_header_cols(shc, stat_at, stat_row); + // Write a line for each alpha value + for(i=0; i 0) { @@ -1342,16 +1346,18 @@ VL1L2Info & VL1L2Info::operator+=(const VL1L2Info &c) { v_info.vacount = vacount + c.vacount; if(v_info.vacount > 0) { - v_info.ufa_bar = (ufa_bar*vacount + c.ufa_bar*c.vacount) /v_info.vacount; - v_info.vfa_bar = (vfa_bar*vacount + c.vfa_bar*c.vacount) /v_info.vacount; - v_info.uoa_bar = (uoa_bar*vacount + c.uoa_bar*c.vacount) /v_info.vacount; - v_info.voa_bar = (voa_bar*vacount + c.voa_bar*c.vacount) /v_info.vacount; - v_info.uvfoa_bar = (uvfoa_bar*vacount + c.uvfoa_bar*c.vacount)/v_info.vacount; - v_info.uvffa_bar = (uvffa_bar*vacount + c.uvffa_bar*c.vacount)/v_info.vacount; - v_info.uvooa_bar = (uvooa_bar*vacount + c.uvooa_bar*c.vacount)/v_info.vacount; + v_info.ufa_bar = (ufa_bar*vacount + c.ufa_bar*c.vacount) /v_info.vacount; + v_info.vfa_bar = (vfa_bar*vacount + c.vfa_bar*c.vacount) /v_info.vacount; + v_info.uoa_bar = (uoa_bar*vacount + c.uoa_bar*c.vacount) /v_info.vacount; + v_info.voa_bar = (voa_bar*vacount + c.voa_bar*c.vacount) /v_info.vacount; + v_info.uvfoa_bar = (uvfoa_bar*vacount + c.uvfoa_bar*c.vacount)/v_info.vacount; + v_info.uvffa_bar = (uvffa_bar*vacount + c.uvffa_bar*c.vacount)/v_info.vacount; + v_info.uvooa_bar = (uvooa_bar*vacount + c.uvooa_bar*c.vacount)/v_info.vacount; + v_info.fa_speed_bar = (fa_speed_bar*vacount + c.fa_speed_bar*c.vacount)/v_info.vacount; + v_info.oa_speed_bar = (oa_speed_bar*vacount + c.oa_speed_bar*c.vacount)/v_info.vacount; } - v_info.calc_ncep_stats(); + v_info.compute_stats(); assign(v_info); @@ -1362,6 +1368,8 @@ VL1L2Info & VL1L2Info::operator+=(const VL1L2Info &c) { void VL1L2Info::init_from_scratch() { + alpha = (double *) 0; + clear(); return; @@ -1369,7 +1377,6 @@ void VL1L2Info::init_from_scratch() { //////////////////////////////////////////////////////////////////////// - void VL1L2Info::zero_out() { // @@ -1393,48 +1400,23 @@ void VL1L2Info::zero_out() { rmse = 0.0; speed_bias = 0.0; - FBAR = 0.0; - OBAR = 0.0; - - FS_RMS = 0.0; - OS_RMS = 0.0; - - MSVE = 0.0; - RMSVE = 0.0; - - FSTDEV = 0.0; - OSTDEV = 0.0; - - FDIR = 0.0; - ODIR = 0.0; - - FBAR_SPEED = 0.0; - OBAR_SPEED = 0.0; - - VDIFF_SPEED = 0.0; - VDIFF_DIR = 0.0; - - SPEED_ERR = 0.0; - SPEED_ABSERR = 0.0; - - DIR_ERR = 0.0; - DIR_ABSERR = 0.0; - vcount = 0; // // VAL1L2 Quantities // - ufa_bar = 0.0; - vfa_bar = 0.0; - uoa_bar = 0.0; - voa_bar = 0.0; - uvfoa_bar = 0.0; - uvffa_bar = 0.0; - uvooa_bar = 0.0; + ufa_bar = 0.0; + vfa_bar = 0.0; + uoa_bar = 0.0; + voa_bar = 0.0; + uvfoa_bar = 0.0; + uvffa_bar = 0.0; + uvooa_bar = 0.0; + fa_speed_bar = 0.0; + oa_speed_bar = 0.0; - vacount = 0; + vacount = 0; return; } @@ -1443,10 +1425,35 @@ void VL1L2Info::zero_out() { void VL1L2Info::clear() { + n = 0; + n_alpha = 0; + if(alpha) { delete [] alpha; alpha = (double *) 0; } + fthresh.clear(); othresh.clear(); logic = SetLogic_None; + FBAR.clear(); + OBAR.clear(); + FS_RMS.clear(); + OS_RMS.clear(); + MSVE.clear(); + RMSVE.clear(); + FSTDEV.clear(); + OSTDEV.clear(); + FDIR.clear(); + ODIR.clear(); + FBAR_SPEED.clear(); + OBAR_SPEED.clear(); + VDIFF_SPEED.clear(); + VDIFF_DIR.clear(); + SPEED_ERR.clear(); + SPEED_ABSERR.clear(); + DIR_ERR.clear(); + DIR_ABSERR.clear(); + ANOM_CORR.clear(); + ANOM_CORR_UNCNTR.clear(); + zero_out(); return; @@ -1455,13 +1462,18 @@ void VL1L2Info::clear() { //////////////////////////////////////////////////////////////////////// void VL1L2Info::assign(const VL1L2Info &c) { - + int i; + clear(); fthresh = c.fthresh; othresh = c.othresh; logic = c.logic; + n = c.n; + allocate_n_alpha(c.n_alpha); + for(i=0; i 0) calc_ncep_stats(); + if(vcount > 0) compute_stats(); // Check for 0 points if(vcount == 0) { - uf_bar = bad_data_double; - vf_bar = bad_data_double; - uo_bar = bad_data_double; - vo_bar = bad_data_double; - uvfo_bar = bad_data_double; - uvff_bar = bad_data_double; - uvoo_bar = bad_data_double; + uf_bar = bad_data_double; + vf_bar = bad_data_double; + uo_bar = bad_data_double; + vo_bar = bad_data_double; + uvfo_bar = bad_data_double; + uvff_bar = bad_data_double; + uvoo_bar = bad_data_double; + f_speed_bar = bad_data_double; + o_speed_bar = bad_data_double; - me = bad_data_double; - mse = bad_data_double; - rmse = bad_data_double; - speed_bias = bad_data_double; + me = bad_data_double; + mse = bad_data_double; + rmse = bad_data_double; + speed_bias = bad_data_double; - FBAR = bad_data_double; - OBAR = bad_data_double; + FBAR.v = bad_data_double; + OBAR.v = bad_data_double; - FS_RMS = bad_data_double; - OS_RMS = bad_data_double; + FS_RMS.v = bad_data_double; + OS_RMS.v = bad_data_double; - MSVE = bad_data_double; - RMSVE = bad_data_double; + MSVE.v = bad_data_double; + RMSVE.v = bad_data_double; - FSTDEV = bad_data_double; - OSTDEV = bad_data_double; + FSTDEV.v = bad_data_double; + OSTDEV.v = bad_data_double; - FDIR = bad_data_double; - ODIR = bad_data_double; + FDIR.v = bad_data_double; + ODIR.v = bad_data_double; - FBAR_SPEED = bad_data_double; - OBAR_SPEED = bad_data_double; + FBAR_SPEED.v = bad_data_double; + OBAR_SPEED.v = bad_data_double; - VDIFF_SPEED = bad_data_double; - VDIFF_DIR = bad_data_double; + VDIFF_SPEED.v = bad_data_double; + VDIFF_DIR.v = bad_data_double; - SPEED_ERR = bad_data_double; - SPEED_ABSERR = bad_data_double; + SPEED_ERR.v = bad_data_double; + SPEED_ABSERR.v = bad_data_double; - DIR_ERR = bad_data_double; - DIR_ABSERR = bad_data_double; + DIR_ERR.v = bad_data_double; + DIR_ABSERR.v = bad_data_double; - } else { - rmse = sqrt(mse); + ANOM_CORR.v = bad_data_double; + ANOM_CORR_UNCNTR.v = bad_data_double; + } + else { + rmse = sqrt(mse); } if(vacount == 0) { - ufa_bar = bad_data_double; - vfa_bar = bad_data_double; - uoa_bar = bad_data_double; - voa_bar = bad_data_double; - uvfoa_bar = bad_data_double; - uvffa_bar = bad_data_double; - uvooa_bar = bad_data_double; + ufa_bar = bad_data_double; + vfa_bar = bad_data_double; + uoa_bar = bad_data_double; + voa_bar = bad_data_double; + uvfoa_bar = bad_data_double; + uvffa_bar = bad_data_double; + uvooa_bar = bad_data_double; + fa_speed_bar = bad_data_double; + oa_speed_bar = bad_data_double; } return; } +//////////////////////////////////////////////////////////////////////// + +void VL1L2Info::allocate_n_alpha(int i) { + + n_alpha = i; + + if(n_alpha > 0) { + + alpha = new double [n_alpha]; + + if(!alpha) { + mlog << Error << "\nVL1L2Info::allocate_n_alpha() -> " + << "Memory allocation error!\n\n"; + exit(1); + } + + FBAR.allocate_n_alpha(n_alpha); + OBAR.allocate_n_alpha(n_alpha); + FS_RMS.allocate_n_alpha(n_alpha); + OS_RMS.allocate_n_alpha(n_alpha); + MSVE.allocate_n_alpha(n_alpha); + RMSVE.allocate_n_alpha(n_alpha); + FSTDEV.allocate_n_alpha(n_alpha); + OSTDEV.allocate_n_alpha(n_alpha); + FDIR.allocate_n_alpha(n_alpha); + ODIR.allocate_n_alpha(n_alpha); + FBAR_SPEED.allocate_n_alpha(n_alpha); + OBAR_SPEED.allocate_n_alpha(n_alpha); + VDIFF_SPEED.allocate_n_alpha(n_alpha); + VDIFF_DIR.allocate_n_alpha(n_alpha); + SPEED_ERR.allocate_n_alpha(n_alpha); + SPEED_ABSERR.allocate_n_alpha(n_alpha); + DIR_ERR.allocate_n_alpha(n_alpha); + DIR_ABSERR.allocate_n_alpha(n_alpha); + ANOM_CORR.allocate_n_alpha(n_alpha); + ANOM_CORR_UNCNTR.allocate_n_alpha(n_alpha); + } + + return; +} + +//////////////////////////////////////////////////////////////////////// + +void VL1L2Info::compute_stats() { + int n; + + if(vcount > 0) { + + n = vcount; + + double u_diff = uf_bar - uo_bar; + double v_diff = vf_bar - vo_bar; + + FBAR.v = f_speed_bar; + OBAR.v = o_speed_bar; + + FS_RMS.v = sqrt(uvff_bar); + OS_RMS.v = sqrt(uvoo_bar); + + MSVE.v = uvff_bar - 2.0*uvfo_bar + uvoo_bar; + + RMSVE.v = sqrt(MSVE.v); + + FSTDEV.v = compute_stdev(f_speed_bar*n, uvff_bar*n, n); + OSTDEV.v = compute_stdev(o_speed_bar*n, uvoo_bar*n, n); + + FDIR.v = convert_u_v_to_wdir(uf_bar, vf_bar); + ODIR.v = convert_u_v_to_wdir(uo_bar, vo_bar); + + FBAR_SPEED.v = convert_u_v_to_wind(uf_bar, vf_bar); + OBAR_SPEED.v = convert_u_v_to_wind(uo_bar, vo_bar); + + VDIFF_SPEED.v = convert_u_v_to_wind(u_diff, v_diff); + + VDIFF_DIR.v = convert_u_v_to_wdir(u_diff, v_diff); + + SPEED_ERR.v = FBAR_SPEED.v - OBAR_SPEED.v; + + SPEED_ABSERR.v = fabs(SPEED_ERR.v); + + DIR_ERR.v = atan2d(vf_bar*uo_bar - uf_bar*vo_bar, + uf_bar*uo_bar + vf_bar*vo_bar); + + DIR_ABSERR.v = fabs(DIR_ERR.v); + } + + if(vacount > 0) { + + n = vacount; + + // Check for bad data since new are not present for previous versions + if(is_bad_data(fa_speed_bar) || is_bad_data(oa_speed_bar)) { + ANOM_CORR.v = bad_data_double; + } + else { + ANOM_CORR.v = compute_corr(fa_speed_bar*n, oa_speed_bar*n, + uvffa_bar*n, uvooa_bar*n, + uvfoa_bar*n, n); + } + + ANOM_CORR_UNCNTR.v = compute_anom_corr_uncntr(uvffa_bar, uvooa_bar, uvfoa_bar); + } + + // Compute parametric confidence intervals + compute_ci(); + + return; +} + +//////////////////////////////////////////////////////////////////////// + +void VL1L2Info::compute_ci() { + int i; + double cv_normal_l, cv_normal_u; + double v, cl, cu; + + // + // Compute the confidence interval for each alpha value specified + // + for(i=0; i= large_sample_threshold) { + cv_normal_l = normal_cdf_inv(alpha[i]/2.0, 0.0, 1.0); + cv_normal_u = normal_cdf_inv(1.0 - (alpha[i]/2.0), 0.0, 1.0); + } + // + // If the number of samples is less than the large sample threshold, + // use the T-distribution + // + else { + cv_normal_l = students_t_cdf_inv(alpha[i]/2.0, n-1); + cv_normal_u = students_t_cdf_inv(1.0 - (alpha[i]/2.0), n-1); + } + + // + // Compute confidence interval for the anomaly correlation coefficient + // + if(is_bad_data(ANOM_CORR.v) || n <= 3 || + is_eq(ANOM_CORR.v, 1.0) || is_eq(ANOM_CORR.v, -1.0)) { + ANOM_CORR.v_ncl[i] = bad_data_double; + ANOM_CORR.v_ncu[i] = bad_data_double; + } + else { + v = 0.5*log((1 + ANOM_CORR.v)/(1 - ANOM_CORR.v)); + cl = v + cv_normal_l/sqrt((double) (n-3)); + cu = v + cv_normal_u/sqrt((double) (n-3)); + ANOM_CORR.v_ncl[i] = (pow(vx_math_e, 2*cl) - 1)/(pow(vx_math_e, 2*cl) + 1); + ANOM_CORR.v_ncu[i] = (pow(vx_math_e, 2*cu) - 1)/(pow(vx_math_e, 2*cu) + 1); + } + + } // end for i + + return; +} + + //////////////////////////////////////////////////////////////////////// double VL1L2Info::get_stat(const char *stat_name) { double v = bad_data_double; - if(strcmp(stat_name, "TOTAL" ) == 0) v = vcount; - else if(strcmp(stat_name, "FBAR" ) == 0) v = FBAR; - else if(strcmp(stat_name, "OBAR" ) == 0) v = OBAR; - else if(strcmp(stat_name, "FS_RMS" ) == 0) v = FS_RMS; - else if(strcmp(stat_name, "OS_RMS" ) == 0) v = OS_RMS; - else if(strcmp(stat_name, "MSVE" ) == 0) v = MSVE; - else if(strcmp(stat_name, "RMSVE" ) == 0) v = RMSVE; - else if(strcmp(stat_name, "FSTDEV" ) == 0) v = FSTDEV; - else if(strcmp(stat_name, "OSTDEV" ) == 0) v = OSTDEV; - else if(strcmp(stat_name, "FDIR" ) == 0) v = FDIR; - else if(strcmp(stat_name, "ODIR" ) == 0) v = ODIR; - else if(strcmp(stat_name, "FBAR_SPEED" ) == 0) v = FBAR_SPEED; - else if(strcmp(stat_name, "OBAR_SPEED" ) == 0) v = OBAR_SPEED; - else if(strcmp(stat_name, "VDIFF_SPEED" ) == 0) v = VDIFF_SPEED; - else if(strcmp(stat_name, "VDIFF_DIR" ) == 0) v = VDIFF_DIR; - else if(strcmp(stat_name, "SPEED_ERR" ) == 0) v = SPEED_ERR; - else if(strcmp(stat_name, "SPEED_ABSERR") == 0) v = SPEED_ABSERR; - else if(strcmp(stat_name, "DIR_ERR" ) == 0) v = DIR_ERR; - else if(strcmp(stat_name, "DIR_ABSERR" ) == 0) v = DIR_ABSERR; + if(strcmp(stat_name, "TOTAL" ) == 0) v = vcount; + else if(strcmp(stat_name, "FBAR" ) == 0) v = FBAR.v; + else if(strcmp(stat_name, "OBAR" ) == 0) v = OBAR.v; + else if(strcmp(stat_name, "FS_RMS" ) == 0) v = FS_RMS.v; + else if(strcmp(stat_name, "OS_RMS" ) == 0) v = OS_RMS.v; + else if(strcmp(stat_name, "MSVE" ) == 0) v = MSVE.v; + else if(strcmp(stat_name, "RMSVE" ) == 0) v = RMSVE.v; + else if(strcmp(stat_name, "FSTDEV" ) == 0) v = FSTDEV.v; + else if(strcmp(stat_name, "OSTDEV" ) == 0) v = OSTDEV.v; + else if(strcmp(stat_name, "FDIR" ) == 0) v = FDIR.v; + else if(strcmp(stat_name, "ODIR" ) == 0) v = ODIR.v; + else if(strcmp(stat_name, "FBAR_SPEED" ) == 0) v = FBAR_SPEED.v; + else if(strcmp(stat_name, "OBAR_SPEED" ) == 0) v = OBAR_SPEED.v; + else if(strcmp(stat_name, "VDIFF_SPEED" ) == 0) v = VDIFF_SPEED.v; + else if(strcmp(stat_name, "VDIFF_DIR" ) == 0) v = VDIFF_DIR.v; + else if(strcmp(stat_name, "SPEED_ERR" ) == 0) v = SPEED_ERR.v; + else if(strcmp(stat_name, "SPEED_ABSERR" ) == 0) v = SPEED_ABSERR.v; + else if(strcmp(stat_name, "DIR_ERR" ) == 0) v = DIR_ERR.v; + else if(strcmp(stat_name, "DIR_ABSERR" ) == 0) v = DIR_ABSERR.v; + else if(strcmp(stat_name, "ANOM_CORR" ) == 0) v = ANOM_CORR.v; + else if(strcmp(stat_name, "ANOM_CORR_UNCNTR") == 0) v = ANOM_CORR_UNCNTR.v; else { mlog << Error << "\nVL1L2Info::get_stat() -> " << "unknown continuous statistic name \"" << stat_name diff --git a/src/libcode/vx_statistics/met_stats.h b/src/libcode/vx_statistics/met_stats.h index 77a245c6f4..7ba5247e8a 100644 --- a/src/libcode/vx_statistics/met_stats.h +++ b/src/libcode/vx_statistics/met_stats.h @@ -264,15 +264,20 @@ class VL1L2Info { VL1L2Info & operator=(const VL1L2Info &); VL1L2Info & operator+=(const VL1L2Info &); - void calc_ncep_stats(); - - // Filtering thresholds + // Filtering thresholds SingleThresh fthresh; SingleThresh othresh; SetLogic logic; - // VL1L2 Quantities + // Confidence interval alpha values + int n_alpha; + double *alpha; + + // Number of points + int n; + + // VL1L2 Quantities double uf_bar; double vf_bar; @@ -283,45 +288,44 @@ class VL1L2Info { double uvff_bar; double uvoo_bar; - // New VL1L2 Quantities added from vector stats whitepaper - double f_speed_bar; double o_speed_bar; - // New VL1L2 Quantities added from vector stats whitepaper + // Vector continuous statistics derived from VL1L2 and VAL1L2 partial sums - double FBAR; - double OBAR; + CIInfo FBAR; + CIInfo OBAR; - double FS_RMS; - double OS_RMS; + CIInfo FS_RMS; + CIInfo OS_RMS; - double MSVE; - double RMSVE; + CIInfo MSVE; + CIInfo RMSVE; - double FSTDEV; - double OSTDEV; + CIInfo FSTDEV; + CIInfo OSTDEV; - // double COV; + CIInfo FDIR; + CIInfo ODIR; - double FDIR; - double ODIR; + CIInfo FBAR_SPEED; + CIInfo OBAR_SPEED; - double FBAR_SPEED; - double OBAR_SPEED; + CIInfo VDIFF_SPEED; + CIInfo VDIFF_DIR; - double VDIFF_SPEED; - double VDIFF_DIR; + CIInfo SPEED_ERR; + CIInfo SPEED_ABSERR; - double SPEED_ERR; - double SPEED_ABSERR; + CIInfo DIR_ERR; + CIInfo DIR_ABSERR; - double DIR_ERR; - double DIR_ABSERR; + CIInfo ANOM_CORR; + CIInfo ANOM_CORR_UNCNTR; - // - // extra VL1L2 quantities for NCEP - // + // + // Extra VL1L2 quantities + // double f_bar; // fcst wind speed double o_bar; // obs wind speed @@ -341,17 +345,25 @@ class VL1L2Info { double vfa_bar; double uoa_bar; double voa_bar; + double uvfoa_bar; double uvffa_bar; double uvooa_bar; + double fa_speed_bar; + double oa_speed_bar; + int vacount; // Compute sums void set(const PairDataPoint &, const PairDataPoint &); - - void zero_out(); + void clear(); + void zero_out(); + + void allocate_n_alpha(int); + void compute_stats(); + void compute_ci(); double get_stat(const char *); }; diff --git a/src/tools/core/grid_stat/grid_stat.cc b/src/tools/core/grid_stat/grid_stat.cc index fbbdfbc773..cb3ad48ffe 100644 --- a/src/tools/core/grid_stat/grid_stat.cc +++ b/src/tools/core/grid_stat/grid_stat.cc @@ -2155,7 +2155,7 @@ void do_cnt_sl1l2(const GridStatVxOpt &vx_opt, const PairDataPoint *pd_ptr) { void do_vl1l2(VL1L2Info *&v_info, int i_vx, const PairDataPoint *pd_u_ptr, const PairDataPoint *pd_v_ptr) { - int i; + int i, j; // Check that the number of pairs are the same if(pd_u_ptr->n_obs != pd_v_ptr->n_obs) { @@ -2178,6 +2178,11 @@ void do_vl1l2(VL1L2Info *&v_info, int i_vx, v_info[i].fthresh = conf_info.vx_opt[i_vx].fwind_ta[i]; v_info[i].othresh = conf_info.vx_opt[i_vx].owind_ta[i]; v_info[i].logic = conf_info.vx_opt[i_vx].wind_logic; + v_info[i].allocate_n_alpha(conf_info.vx_opt[i_vx].get_n_ci_alpha()); + + for(j=0; j VCNT + // VL1L2, VAL1L2 -> VCNT // - else if(in_lt == stat_vl1l2 && - has_line_type(out_lt, stat_vcnt)) { + else if((in_lt == stat_vl1l2 || + in_lt == stat_val1l2) && + has_line_type(out_lt, stat_vcnt)) { aggr_psum_lines(f, job, psum_map, n_in, n_out); for(it=out_lt.begin(); it!=out_lt.end(); it++) { write_job_aggr_psum(job, *it, psum_map, out_at); @@ -1763,7 +1764,9 @@ void write_job_aggr_psum(STATAnalysisJob &job, STATLineType lt, shc = it->second.hdr.get_shc(it->first, job.by_column, job.hdr_name, job.hdr_value, lt); if(job.stat_out) { - if(lt == stat_cnt || lt == stat_nbrcnt) shc.set_alpha(job.out_alpha); + if(lt == stat_cnt || lt == stat_vcnt || lt == stat_nbrcnt) { + shc.set_alpha(job.out_alpha); + } write_header_cols(shc, job.stat_at, job.stat_row); } @@ -1864,13 +1867,13 @@ void write_job_aggr_psum(STATAnalysisJob &job, STATLineType lt, // else if(lt == stat_vcnt) { if(job.stat_out) { - write_vcnt_cols(it->second.vl1l2_info, job.stat_at, + write_vcnt_cols(it->second.vl1l2_info, 0, job.stat_at, job.stat_row++, n_header_columns); } else { at.set_entry(r, c++, (string)"VCNT:"); write_case_cols(it->first, at, r, c); - write_vcnt_cols(it->second.vl1l2_info, at, r++, c); + write_vcnt_cols(it->second.vl1l2_info, 0, at, r++, c); } } // @@ -3428,13 +3431,13 @@ void write_job_aggr_mpr_wind(STATAnalysisJob &job, STATLineType lt, // else if(lt == stat_vcnt) { if(job.stat_out) { - write_vcnt_cols(it->second.vl1l2_info, job.stat_at, + write_vcnt_cols(it->second.vl1l2_info, 0, job.stat_at, job.stat_row++, n_header_columns); } else { at.set_entry(r, c++, "VCNT:"); write_case_cols(it->first, at, r, c); - write_vcnt_cols(it->second.vl1l2_info, at, r++, c); + write_vcnt_cols(it->second.vl1l2_info, 0, at, r++, c); } } //