Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix 2370 mainv10.1 - 6 line headers and yyyy-MMM #2396

Closed
wants to merge 44 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
5bff065
Update the top-level README file to list ioda2nc, but also to trigger…
JohnHalleyGotway Mar 14, 2022
3e43b63
added logic to manually trigger a workflow via the GitHub… (#2107)
georgemccabe Mar 28, 2022
b46fa04
Bugfix #2102 main_v10.1 initialize modified_hdr_typ (#2108)
JohnHalleyGotway Mar 28, 2022
71f3d42
Bugfix #2115 main_v10.1 Rotated LatLon (#2116)
JohnHalleyGotway Apr 1, 2022
3b7d39f
Per #2123, added debug code to make this error that was unrepoducible…
JohnHalleyGotway Apr 5, 2022
bbb92e6
#2123 Initialize ValidTime if afile to read time bvariable
Apr 5, 2022
f379306
#2123 Support int64 data type
Apr 5, 2022
aed022d
#2123 Support int64 data type
hsoh-u Apr 6, 2022
62376a8
Merge pull request #2126 from dtcenter/bugfix_2123_main_v10.1_nccf_va…
hsoh-u Apr 6, 2022
ae5caba
added logic to manually trigger a workflow via the GitHub… (#2107)
georgemccabe Mar 28, 2022
6e99e8e
Bugfix #2118 main_v10.1 grib1_rotll (#2129)
JohnHalleyGotway Apr 8, 2022
205fc94
Bugfix #2106 main_v10.1 gcc (#2134)
JohnHalleyGotway Apr 11, 2022
17b0843
Feature 2141 v10.1.1 (#2144)
JohnHalleyGotway Apr 19, 2022
f4fa584
Merge branch 'main_v10.1-ref' into main_v10.1
JohnHalleyGotway Apr 21, 2022
edc669e
Update main_v10.1-ref after #2144 (#2145)
JohnHalleyGotway Apr 21, 2022
6b6e640
Add testing and docs badges.
JohnHalleyGotway May 5, 2022
0a5664b
#14 Using literal instead of numbers and make sure no overflow
May 10, 2022
f0579fc
#14 Using literal instead of numbers
May 10, 2022
6260335
#14 Added tmp_buf_size
May 10, 2022
ffa56ba
#14 Define n_kw_infos first
May 10, 2022
6d448da
#14 Using literal instead of numbers
May 10, 2022
cc7b0a8
Bugfix #2148 main_v10.1 misses (#2149)
JohnHalleyGotway May 10, 2022
44cd88d
dtcenter/METplus-Internal#14 formatting code
May 10, 2022
ee4deb7
Merge pull request #2156 from dtcenter/bugfix_14_main_v10.1_fixed_len…
hsoh-u May 10, 2022
1558222
Feature 2162 v10.1.2 (#2163)
jprestop May 16, 2022
2d49f71
Merge branch 'main_v10.1-ref' into main_v10.1
jprestop May 17, 2022
d0c66b8
Update main_v10.1-ref after #2163 (#2164)
jprestop May 19, 2022
b62ea2a
Merge branch 'main_v10.1' of https://github.com/dtcenter/MET into mai…
JohnHalleyGotway May 27, 2022
d2379e8
Bugfix #2173 main_v10.1 shift_data_plane (#2174)
JohnHalleyGotway Jun 7, 2022
7ad04ae
Bugfix #2170 main_v10.1 agg_ecnt (#2176)
JohnHalleyGotway Jun 10, 2022
55d40a4
Merge branch 'main_v10.1-ref' into main_v10.1
JohnHalleyGotway Jun 10, 2022
679780e
Feature #2180 main_v10.1 kft (#2182)
JohnHalleyGotway Jun 14, 2022
1958e02
Bugfix #2187 main_v10.1 ao_sf (#2189)
JohnHalleyGotway Jun 16, 2022
b4d343e
#2208 Check existence of ensemble member data before checking bad_data
Jul 27, 2022
0cbdd5f
Merge pull request #2214 from dtcenter/bugfix_2208_main_v10.1_ensembl…
hsoh-u Jul 27, 2022
e213c50
Updated templates for METdataio and changing Linked Issues to Develop…
jprestop Aug 16, 2022
e843f6e
automated tests: added ability to trigger build of develop-lite docke…
georgemccabe Sep 13, 2022
cb50758
Bugfix #2271 main_v10.1 nbrctc (#2274)
JohnHalleyGotway Sep 28, 2022
4d8f86c
Bugfix #2309 main_v10.1 tcmpr (#2311)
JohnHalleyGotway Oct 19, 2022
492d140
Hotfix to the main_v10.1 branch to correct the column numbers in the …
JohnHalleyGotway Nov 2, 2022
61e1928
Fix typo in prob_pct_thresh example.
JohnHalleyGotway Nov 8, 2022
0a5e227
#2370 Added month_name_to_m
Dec 22, 2022
f4abd58
#2370 Added a n argument date_offset to _getValidTime
Dec 22, 2022
80c4727
#2370 Support 6 line headers and yyyy-MMM date string for AERONET V3.…
Jan 10, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Describe the steps to reproduce the behavior:

## Define Related Issue(s) ##
Consider the impact to the other METplus components.
- [ ] [METplus](https://github.com/dtcenter/METplus/issues/new/choose), [MET](https://github.com/dtcenter/MET/issues/new/choose), [METdatadb](https://github.com/dtcenter/METdatadb/issues/new/choose), [METviewer](https://github.com/dtcenter/METviewer/issues/new/choose), [METexpress](https://github.com/dtcenter/METexpress/issues/new/choose), [METcalcpy](https://github.com/dtcenter/METcalcpy/issues/new/choose), [METplotpy](https://github.com/dtcenter/METplotpy/issues/new/choose)
- [ ] [METplus](https://github.com/dtcenter/METplus/issues/new/choose), [MET](https://github.com/dtcenter/MET/issues/new/choose), [METdataio](https://github.com/dtcenter/METdataio/issues/new/choose), [METviewer](https://github.com/dtcenter/METviewer/issues/new/choose), [METexpress](https://github.com/dtcenter/METexpress/issues/new/choose), [METcalcpy](https://github.com/dtcenter/METcalcpy/issues/new/choose), [METplotpy](https://github.com/dtcenter/METplotpy/issues/new/choose)

## Bugfix Checklist ##
See the [METplus Workflow](https://metplus.readthedocs.io/en/latest/Contributors_Guide/github_workflow.html) for details.
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/enhancement_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Consider breaking the enhancement down into sub-issues.

## Define Related Issue(s) ##
Consider the impact to the other METplus components.
- [ ] [METplus](https://github.com/dtcenter/METplus/issues/new/choose), [MET](https://github.com/dtcenter/MET/issues/new/choose), [METdatadb](https://github.com/dtcenter/METdatadb/issues/new/choose), [METviewer](https://github.com/dtcenter/METviewer/issues/new/choose), [METexpress](https://github.com/dtcenter/METexpress/issues/new/choose), [METcalcpy](https://github.com/dtcenter/METcalcpy/issues/new/choose), [METplotpy](https://github.com/dtcenter/METplotpy/issues/new/choose)
- [ ] [METplus](https://github.com/dtcenter/METplus/issues/new/choose), [MET](https://github.com/dtcenter/MET/issues/new/choose), [METdataio](https://github.com/dtcenter/METdataio/issues/new/choose), [METviewer](https://github.com/dtcenter/METviewer/issues/new/choose), [METexpress](https://github.com/dtcenter/METexpress/issues/new/choose), [METcalcpy](https://github.com/dtcenter/METcalcpy/issues/new/choose), [METplotpy](https://github.com/dtcenter/METplotpy/issues/new/choose)

## Enhancement Checklist ##
See the [METplus Workflow](https://metplus.readthedocs.io/en/latest/Contributors_Guide/github_workflow.html) for details.
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/new_feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Consider breaking the new feature down into sub-issues.

## Define Related Issue(s) ##
Consider the impact to the other METplus components.
- [ ] [METplus](https://github.com/dtcenter/METplus/issues/new/choose), [MET](https://github.com/dtcenter/MET/issues/new/choose), [METdatadb](https://github.com/dtcenter/METdatadb/issues/new/choose), [METviewer](https://github.com/dtcenter/METviewer/issues/new/choose), [METexpress](https://github.com/dtcenter/METexpress/issues/new/choose), [METcalcpy](https://github.com/dtcenter/METcalcpy/issues/new/choose), [METplotpy](https://github.com/dtcenter/METplotpy/issues/new/choose)
- [ ] [METplus](https://github.com/dtcenter/METplus/issues/new/choose), [MET](https://github.com/dtcenter/MET/issues/new/choose), [METdataio](https://github.com/dtcenter/METdataio/issues/new/choose), [METviewer](https://github.com/dtcenter/METviewer/issues/new/choose), [METexpress](https://github.com/dtcenter/METexpress/issues/new/choose), [METcalcpy](https://github.com/dtcenter/METcalcpy/issues/new/choose), [METplotpy](https://github.com/dtcenter/METplotpy/issues/new/choose)

## New Feature Checklist ##
See the [METplus Workflow](https://metplus.readthedocs.io/en/latest/Contributors_Guide/github_workflow.html) for details.
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/task.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Consider breaking the task down into sub-issues.

## Define Related Issue(s) ##
Consider the impact to the other METplus components.
- [ ] [METplus](https://github.com/dtcenter/METplus/issues/new/choose), [MET](https://github.com/dtcenter/MET/issues/new/choose), [METdatadb](https://github.com/dtcenter/METdatadb/issues/new/choose), [METviewer](https://github.com/dtcenter/METviewer/issues/new/choose), [METexpress](https://github.com/dtcenter/METexpress/issues/new/choose), [METcalcpy](https://github.com/dtcenter/METcalcpy/issues/new/choose), [METplotpy](https://github.com/dtcenter/METplotpy/issues/new/choose)
- [ ] [METplus](https://github.com/dtcenter/METplus/issues/new/choose), [MET](https://github.com/dtcenter/MET/issues/new/choose), [METdataio](https://github.com/dtcenter/METdataio/issues/new/choose), [METviewer](https://github.com/dtcenter/METviewer/issues/new/choose), [METexpress](https://github.com/dtcenter/METexpress/issues/new/choose), [METcalcpy](https://github.com/dtcenter/METcalcpy/issues/new/choose), [METplotpy](https://github.com/dtcenter/METplotpy/issues/new/choose)

## Task Checklist ##
See the [METplus Workflow](https://metplus.readthedocs.io/en/latest/Contributors_Guide/github_workflow.html) for details.
Expand Down
2 changes: 0 additions & 2 deletions .github/dummy_for_action

This file was deleted.

25 changes: 24 additions & 1 deletion .github/jobs/set_job_controls.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ if [ "${GITHUB_EVENT_NAME}" == "pull_request" ]; then

run_diff=true

# if pull request into main_vX.Y branch,
# set truth data version to branch name and set input data version to X.Y
if [ "${GITHUB_BASE_REF:0:6}" == "main_v" ]; then
truth_data_version=${GITHUB_BASE_REF}
input_data_version=${GITHUB_BASE_REF:6}
fi

fi

elif [ "${GITHUB_EVENT_NAME}" == "push" ]; then
Expand All @@ -30,6 +37,11 @@ elif [ "${GITHUB_EVENT_NAME}" == "push" ]; then
run_diff=true
truth_data_version=${branch_name:0: -4}

# if main_vX.Y-ref branch, use X.Y input data
if [ "${branch_name:0:6}" == "main_v" ]; then
input_data_version=${branch_name:6: -4}
fi

else

# if develop or main_vX.Y branch, run diff tests using branch's truth data
Expand All @@ -39,6 +51,11 @@ elif [ "${GITHUB_EVENT_NAME}" == "push" ]; then
run_diff=true
truth_data_version=${branch_name}

# if main_vX.Y branch, use X.Y input data
if [ "${branch_name:0:6}" == "main_v" ]; then
input_data_version=${branch_name:6}
fi

fi

# check commit messages for skip or force keywords
Expand Down Expand Up @@ -66,7 +83,13 @@ elif [ "${GITHUB_EVENT_NAME}" == "push" ]; then
fi

fi


elif [ "${GITHUB_EVENT_NAME}" == "workflow_dispatch" ]; then

if [ "${force_tests}" == "true" ]; then
run_diff=true
fi

fi

# if updating truth or running diff, run unit tests
Expand Down
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ See the [METplus Workflow](https://metplus.readthedocs.io/en/latest/Contributors
Select: **Reviewer(s)**
Select: **Organization** level software support **Project** or **Repository** level development cycle **Project**
Select: **Milestone** as the version that will include these changes
- [ ] After submitting the PR, select **Linked issues** with the original issue number.
- [ ] After submitting the PR, select **Development** with the original issue number.
- [ ] After the PR is approved, merge your changes. If permissions do not allow this, request that the reviewer do the merge.
- [ ] Close the linked issue and delete your feature or bugfix branch from GitHub.
2 changes: 2 additions & 0 deletions .github/workflows/build_docker_and_trigger_metplus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ on:
paths-ignore:
- 'met/docs/**'

workflow_dispatch:

env:
DOCKERHUB_REPO: dtcenter/met-dev

Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ on:
paths-ignore:
- 'met/docs/**'

workflow_dispatch:
inputs:
force_tests:
description: 'Run the unit tests'
default: true
type: boolean

env:
DOCKERHUB_REPO: dtcenter/met-dev

Expand All @@ -39,6 +46,7 @@ jobs:
run: .github/jobs/set_job_controls.sh
env:
commit_msg: ${{ github.event.head_commit.message }}
force_tests: ${{ github.event.inputs.force_tests }}

outputs:
run_compile: ${{ steps.job_status.outputs.run_compile }}
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ Model Evaluation Tools (MET) Repository
=======================================

<!-- Start of Badges -->
[![Tests](https://github.com/DTCenter/MET/actions/workflows/testing.yml/badge.svg?event=push)](https://github.com/DTCenter/MET/actions/workflows/testing.yml)
[![Docs](https://img.shields.io/badge/Documentation-latest-brightgreen.svg)](https://met.readthedocs.io)
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.5565322.svg)](https://doi.org/10.5281/zenodo.5565322)

This repository contains the source code for the Model Evaluation Tools package (met), unit test code (test), and scripts used to build and test the code (scripts).
Expand Down
3 changes: 2 additions & 1 deletion met/README
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ sub-directory, or the MET Online Tutorial:

- If all tools are enabled and the build is successful, the "<prefix>/bin"
directory (where <prefix> is the prefix you specified on your configure
command line) will contain 36 executables:
command line) will contain the following executables:
- ascii2nc
- ensemble_stat
- gen_ens_prod
Expand All @@ -200,6 +200,7 @@ sub-directory, or the MET Online Tutorial:
- grid_diag
- gsid2mpr
- gsidens2orank
- ioda2nc
- lidar2nc
- madis2nc
- mode
Expand Down
7 changes: 7 additions & 0 deletions met/data/config/ConfigConstants
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
7 changes: 7 additions & 0 deletions met/docs/Users_Guide/config_options.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ The configuration file language supports the following data types:
and 10 and "==1||==2" defines numbers exactly equal to 1 or 2.

* Percentile Thresholds:

* A threshold type (<, <=, ==, !=, >=, or >), followed by a percentile
type description (SFP, SOP, SCP, USP, CDP, or FBIAS), followed by a
numeric value, typically between 0 and 100.

* Note that the two letter threshold type abbreviations (lt, le, eq, ne,
ge, gt) are not supported for percentile thresholds.

* Thresholds may be defined as percentiles of the data being processed in
several places:
Expand Down
2 changes: 1 addition & 1 deletion met/docs/Users_Guide/ensemble-stat.rst
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ The **prob_pct_thresh** entry is an array of thresholds which define the Nx2 pro

.. code-block:: none

prob_cat_thresh = [ ==0.25 ];
prob_pct_thresh = [ ==0.25 ];

__________________

Expand Down
6 changes: 3 additions & 3 deletions met/docs/Users_Guide/point-stat.rst
Original file line number Diff line number Diff line change
Expand Up @@ -851,13 +851,13 @@ The first set of header columns are common to all of the output files generated
* - 113-115
- RMSFA, :raw-html:`<br />` RMSFA_BCL, :raw-html:`<br />` RMSFA_BCU
- Root mean squared forecast anomaly (f-c) including bootstrap upper and lower confidence limits
* - 117-119
* - 116-118
- RMSOA, :raw-html:`<br />` RMSOA_BCL, :raw-html:`<br />` RMSOA_BCU
- Root mean squared observation anomaly (o-c) including bootstrap upper and lower confidence limits
* - 120-122
* - 119-121
- ANOM_CORR_UNCNTR, :raw-html:`<br />` ANOM_CORR_UNCNTR_BCL, :raw-html:`<br />` ANOM_CORR_UNCNTR_BCU
- The uncentered Anomaly Correlation excluding mean error including bootstrap upper and lower confidence limits
* - 123-125
* - 122-124
- SI, :raw-html:`<br />` SI_BCL, :raw-html:`<br />` SI_BCU
- Scatter Index including bootstrap upper and lower confidence limits

Expand Down
17 changes: 17 additions & 0 deletions met/docs/Users_Guide/release-notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,23 @@ When applicable, release notes are followed by the GitHub issue number which des
enhancement, or new feature (`MET GitHub issues <https://github.com/dtcenter/MET/issues>`_).
Important issues are listed **in bold** for emphasis.

MET Version 10.1.2 release notes (20220516)
-------------------------------------------

* Bugfixes:

* Update static arrays with hard-coded size (`METplus-Internal #14 <https://github.com/dtcenter/METplus-Internal/issues/14>`_).
* Fix TC-Gen to only count misses from requested initialization hours and lead times (`#2148 <https://github.com/dtcenter/MET/issues/2148>`_).

MET Version 10.1.1 release notes (20220419)
-------------------------------------------

* Bugfixes:

* Fix support for reading rotated lat/lon grids from CF-compliant NetCDF files (`#2115 <https://github.com/dtcenter/MET/issues/2115>`_).
* Fix support for reading rotated lat/lon grids from GRIB1 files (grid type 10) (`#2118 <https://github.com/dtcenter/MET/issues/2118>`_).
* Fix support for int64 NetCDF variable types (`#2123 <https://github.com/dtcenter/MET/issues/2123>`_).

MET Version 10.1.0 release notes (20220314)
-------------------------------------------

Expand Down
5 changes: 3 additions & 2 deletions met/docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@
project = 'MET'
author = 'UCAR/NCAR, NOAA, CSU/CIRA, and CU/CIRES'
author_list = 'Newman, K., J. Opatz, T. Jensen, J. Prestopnik, H. Soh, L. Goodrich, B. Brown, R. Bullock, J. Halley Gotway'
version = '10.1.0'

version = '10.1.2'
verinfo = version
release = f'{version}'
release_year = '2022'
release_date = f'{release_year}-03-14'
release_date = f'{release_year}-05-16'
copyright = f'{release_year}, {author}'

# -- General configuration ---------------------------------------------------
Expand Down
30 changes: 30 additions & 0 deletions met/src/basic/vx_cal/unix_to_mdyhms.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ using namespace std;

#include <iostream>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <cmath>

Expand Down Expand Up @@ -94,6 +95,35 @@ const char * short_month_name[] = {
};


////////////////////////////////////////////////////////////////////////
// Converts a month string to month (1 to 12).

int month_name_to_m (const char *month_str)

{

int month = -1;
int str_len = strlen(month_str);
char t_month_str[str_len + 1];

for (int idx=0; idx<str_len; idx++) {
t_month_str[idx] = (idx==0) ? toupper(month_str[idx]) : tolower(month_str[idx]);
}
t_month_str[str_len] = 0;

for (int idx=1; idx<=12; idx++) {
if (0 == strcmp(short_month_name[idx], t_month_str)
|| 0 == strcmp(month_name[idx], t_month_str)) {
month = idx;
break;
}
}

return month;

}


////////////////////////////////////////////////////////////////////////


Expand Down
1 change: 1 addition & 0 deletions met/src/basic/vx_cal/vx_cal.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ extern unixtime doyhms_to_unix (int doy, int year, int hour, int minute, int
extern unixtime mdyhms_to_unix (int month, int day, int year, int hour, int minute, int second);

extern void unix_to_mdyhms (unixtime u, int & month, int & day, int & year, int & hour, int & minute, int & second);
extern int month_name_to_m (const char *month_str);


extern int date_to_mjd (int m, int d, int y);
Expand Down
12 changes: 9 additions & 3 deletions met/src/basic/vx_log/concat_string.cc
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,10 @@ void ConcatString::assign(const ConcatString & c)
if (c.text()) s->assign(c.text());
else s->clear();

memcpy(FloatFormat, c.FloatFormat, sizeof(FloatFormat));
int buf_size = sizeof(c.FloatFormat);
if (buf_size > concat_string_buf_size) buf_size = concat_string_buf_size;

memcpy(FloatFormat, c.FloatFormat, buf_size);
Precision = c.Precision;
}

Expand Down Expand Up @@ -337,9 +340,12 @@ if ( (k < 0) || (k > concat_string_max_precision) ) {
if (Precision != k) {
Precision = k;

memset(FloatFormat, 0, sizeof(FloatFormat));
int buf_size = sizeof(FloatFormat);
if (buf_size > concat_string_buf_size) buf_size = concat_string_buf_size;

memset(FloatFormat, 0, buf_size);

snprintf(FloatFormat, sizeof(FloatFormat), "%%.%df", Precision);
snprintf(FloatFormat, buf_size, "%%.%df", Precision);
}

return;
Expand Down
3 changes: 2 additions & 1 deletion met/src/basic/vx_log/concat_string.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ static const int max_str_len = 512;
static const int concat_string_default_precision = 5;

static const int concat_string_max_precision = 12;
static const int concat_string_buf_size = concat_string_max_precision + 4;


////////////////////////////////////////////////////////////////////////
Expand All @@ -73,7 +74,7 @@ class ConcatString {

int Precision;

char FloatFormat[16];
char FloatFormat[concat_string_buf_size];

std::string *s;

Expand Down
20 changes: 14 additions & 6 deletions met/src/basic/vx_util/ascii_table.cc
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,12 @@ BadDataValue = a.BadDataValue;

set_bad_data_str(a.BadDataStr);

memcpy(f_FloatFormat, a.f_FloatFormat, sizeof(f_FloatFormat));
memcpy(g_FloatFormat, a.g_FloatFormat, sizeof(g_FloatFormat));
int f_buf_size = sizeof(a.f_FloatFormat);
int g_buf_size = sizeof(a.g_FloatFormat);
if (f_buf_size > ascii_table_buf_size) f_buf_size = ascii_table_buf_size;
if (g_buf_size > ascii_table_buf_size) g_buf_size = ascii_table_buf_size;
memcpy(f_FloatFormat, a.f_FloatFormat, f_buf_size);
memcpy(g_FloatFormat, a.g_FloatFormat, g_buf_size);

DoCommaString = a.DoCommaString;

Expand Down Expand Up @@ -697,11 +701,15 @@ if ( (k < 0) || (k > ascii_table_max_precision) ) {

Precision = k;

memset(f_FloatFormat, 0, sizeof(f_FloatFormat));
memset(g_FloatFormat, 0, sizeof(g_FloatFormat));
int f_buf_size = sizeof(f_FloatFormat);
int g_buf_size = sizeof(g_FloatFormat);
if (f_buf_size > ascii_table_buf_size) f_buf_size = ascii_table_buf_size;
if (g_buf_size > ascii_table_buf_size) g_buf_size = ascii_table_buf_size;
memset(f_FloatFormat, 0, f_buf_size);
memset(g_FloatFormat, 0, g_buf_size);

snprintf(f_FloatFormat, sizeof(f_FloatFormat), "%%.%df", Precision);
snprintf(g_FloatFormat, sizeof(g_FloatFormat), "%%.%dg", Precision);
snprintf(f_FloatFormat, f_buf_size, "%%.%df", Precision);
snprintf(g_FloatFormat, g_buf_size, "%%.%dg", Precision);

return;

Expand Down
5 changes: 3 additions & 2 deletions met/src/basic/vx_util/ascii_table.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ static const bool default_fill_blank = false;
static const int ascii_table_default_precision = 2;

static const int ascii_table_max_precision = 12;
static const int ascii_table_buf_size = ascii_table_max_precision + 4;

static const double ascii_table_default_bad_data_value = -9999.0;

Expand Down Expand Up @@ -163,8 +164,8 @@ class AsciiTable {

std::string BadDataStr;

char f_FloatFormat[16];
char g_FloatFormat[16];
char f_FloatFormat[ascii_table_buf_size];
char g_FloatFormat[ascii_table_buf_size];


bool DoCommaString; // do comma string?
Expand Down
Loading