Skip to content

Commit

Permalink
Update main_v10.1-ref after #2163 (#2164)
Browse files Browse the repository at this point in the history
* added logic to manually trigger a workflow via the GitHub… (#2107)

* Bugfix #2102 main_v10.1 initialize modified_hdr_typ (#2108)

* Bugfix #2115 main_v10.1 Rotated LatLon (#2116)

* Per #2123, added debug code to make this error that was unrepoducible, reproducible on seneca. Just initialize the newly allocated time_values array with values of -10. PLEASE REMOVE THAT TEST CODE PRIOR TO SUBMITTING A PR TO FIX THIS ISSUE.

* #2123 Initialize ValidTime if afile to read time bvariable

* #2123 Support int64 data type

* #2123 Support int64 data type

* Bugfix #2118 main_v10.1 grib1_rotll (#2129)

Co-authored-by: George McCabe <23407799+georgemccabe@users.noreply.github.com>

* Bugfix #2106 main_v10.1 gcc (#2134)

* Feature 2141 v10.1.1 (#2144)

* Add testing and docs badges.

* #14 Using literal instead of numbers and make sure no overflow

* #14 Using literal instead of numbers

* #14 Added tmp_buf_size

* #14 Define n_kw_infos first

* #14 Using literal instead of numbers

* Bugfix #2148 main_v10.1 misses (#2149)

Co-authored-by: George McCabe <23407799+georgemccabe@users.noreply.github.com>

* dtcenter/METplus-Internal#14 formatting code

* Feature 2162 v10.1.2 (#2163)

* Per #2162, update versions and notes for the 10.1.2 bugfix release

* Per #2162, update versions and notes for the 10.1.2 bugfix release

* Per #2162, fixing syntax error

* Add "METplus-Internal" before the issue number for clarity

Co-authored-by: johnhg <johnhg@ucar.edu>

Co-authored-by: Julie Prestopnik <jpresto@seneca.rap.ucar.edu>
Co-authored-by: johnhg <johnhg@ucar.edu>

Co-authored-by: George McCabe <23407799+georgemccabe@users.noreply.github.com>
Co-authored-by: johnhg <johnhg@ucar.edu>
Co-authored-by: Howard Soh <hsoh@seneca.rap.ucar.edu>
Co-authored-by: hsoh-u <hsoh@ucar.edu>
Co-authored-by: Julie Prestopnik <jpresto@seneca.rap.ucar.edu>
  • Loading branch information
6 people committed May 19, 2022
1 parent edc669e commit d0c66b8
Show file tree
Hide file tree
Showing 22 changed files with 119 additions and 67 deletions.
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
8 changes: 8 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,14 @@ 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)
-------------------------------------------

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.1'

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

# -- General configuration ---------------------------------------------------
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
5 changes: 3 additions & 2 deletions met/src/basic/vx_util/observation.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <time.h>

#include "config.h"
#include "util_constants.h"

#ifdef ENABLE_PYTHON
#include "vx_python3_utils.h"
Expand Down Expand Up @@ -223,7 +224,7 @@ class Observation
{
struct tm *time_struct = gmtime(&unix_time);

char time_string[80];
char time_string[tmp_buf_size];

snprintf(time_string, sizeof(time_string),
"%04d%02d%02d_%02d%02d%02d",
Expand All @@ -240,7 +241,7 @@ class Observation
string start_time_string = _getTimeString(start_time);
string end_time_string = _getTimeString(end_time);

char time_string[80];
char time_string[tmp_buf_size];

snprintf(time_string, sizeof(time_string),
"%s-%s",
Expand Down
5 changes: 4 additions & 1 deletion met/src/basic/vx_util/util_constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
////////////////////////////////////////////////////////////////////////

// Released versions of MET

static const char met_version_10_1_2[] = "V10.1.2";
static const char met_version_10_1_1[] = "V10.1.1";
static const char met_version_10_1_0[] = "V10.1.0";
static const char met_version_10_0_0[] = "V10.0.0";
Expand All @@ -41,7 +43,7 @@ static const char met_version_1_1[] = "V1.1";

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

static const char * const met_version = met_version_10_1_1;
static const char * const met_version = met_version_10_1_2;
static const char default_met_data_dir[] = "MET_BASE";
static const char txt_file_ext[] = ".txt";
static const char stat_file_ext[] = ".stat";
Expand Down Expand Up @@ -93,6 +95,7 @@ static const int boot_perc_flag = 1;
////////////////////////////////////////////////////////////////////////

static const int max_line_len = 2048;
static const int tmp_buf_size = 512;
static const double grib_earth_radius_km = 6371.20;
static const int default_nc_compression = 0;
static const int default_precision = 5;
Expand Down
14 changes: 7 additions & 7 deletions met/src/libcode/vx_afm/afm_keywords.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,13 @@ struct AfmKeywordInfo {
////////////////////////////////////////////////////////////////////////


static const AfmKeywordInfo kw_info[42] = {
static const int n_kw_infos = 42;


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


static const AfmKeywordInfo kw_info[n_kw_infos] = {

{ "StartFontMetrics", afm_keyword_StartFontMetrics },
{ "EndFontMetrics", afm_keyword_EndFontMetrics },
Expand Down Expand Up @@ -134,12 +140,6 @@ static const AfmKeywordInfo kw_info[42] = {
////////////////////////////////////////////////////////////////////////


static const int n_kw_infos = 42;


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


extern int is_afm_keyword (ConcatString text, AfmKeyword &);


Expand Down
3 changes: 2 additions & 1 deletion met/src/libcode/vx_color/color.h
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ extern ostream & operator<<(ostream &, const CtableEntry &);


static const int ctable_alloc_inc = 30;
static const int fudge_size = 256;


////////////////////////////////////////////////////////////////////////
Expand All @@ -226,7 +227,7 @@ class ColorTable {

double Gamma;

unsigned char fudge[256];
unsigned char fudge[fudge_size];


public:
Expand Down
6 changes: 3 additions & 3 deletions met/src/libcode/vx_color/color_table.cc
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ Nalloc = 0;

int j;

for (j=0; j<256; ++j) {
for (j=0; j<fudge_size; ++j) {

fudge[j] = (unsigned char) j;

Expand Down Expand Up @@ -368,7 +368,7 @@ for (j=0; j<Nentries; ++j) {

}

for (j=0; j<256; ++j) {
for (j=0; j<fudge_size; ++j) {

fudge[j] = c.fudge[j];

Expand Down Expand Up @@ -689,7 +689,7 @@ const double exponent = 1.0/Gamma;
int j, k;
double x, y;

for (j=0; j<256; ++j) {
for (j=0; j<fudge_size; ++j) {

x = ((double) j)/255.0;

Expand Down
4 changes: 2 additions & 2 deletions met/src/libcode/vx_pxm/ppm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,7 @@ if ( fabs(g - 1.0) < 1.0e-3 ) return;

int j, k;
int nxy;
unsigned char fudge[256];
unsigned char fudge[fudge_size];
double t;
double exponent;
Color color;
Expand All @@ -761,7 +761,7 @@ Color color;
exponent = 1.0/g;


for (j=0; j<256; ++j) {
for (j=0; j<fudge_size; ++j) {

t = ((double) j)/255.0;

Expand Down
4 changes: 3 additions & 1 deletion met/src/libcode/vx_render/ps_filter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,9 @@ if ( (k < 0) || (k > max_decimal_places) ) {

DecimalPlaces = k;

snprintf(double_format, sizeof(double_format), "%%.%df", DecimalPlaces); // example: "%.5f"
int buf_size = sizeof(double_format);
if (buf_size > filter_buf_size) buf_size = filter_buf_size;
snprintf(double_format, buf_size, "%%.%df", DecimalPlaces); // example: "%.5f"


return;
Expand Down
3 changes: 2 additions & 1 deletion met/src/libcode/vx_render/ps_filter.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ static const int FlateEncode = 4;


static const int max_filters = 10;
static const int filter_buf_size = 32;


////////////////////////////////////////////////////////////////////////
Expand All @@ -60,7 +61,7 @@ class PSFilter {

int DecimalPlaces;

char double_format[32];
char double_format[filter_buf_size];

virtual void eat(unsigned char);

Expand Down
11 changes: 6 additions & 5 deletions met/src/libcode/vx_summary/summary_obs.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "observation.h"
#include "summary_calc.h"
#include "time_summary_interval.h"
#include "util_constants.h"

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

Expand Down Expand Up @@ -135,7 +136,7 @@ class SummaryObs

// Create the string

char string_buffer[20];
char string_buffer[tmp_buf_size];

snprintf(string_buffer, sizeof(string_buffer), "%02d%02d%02d", hour, minute, second);

Expand Down Expand Up @@ -222,7 +223,7 @@ class SummaryObs
{
struct tm *time_struct = gmtime(&unix_time);

char time_string[80];
char time_string[tmp_buf_size];

snprintf(time_string, sizeof(time_string),
"%04d%02d%02d_%02d%02d%02d",
Expand All @@ -239,11 +240,11 @@ class SummaryObs
memset(&time_struct, 0, sizeof(time_struct));

time_struct.tm_year = atoi(time_string.substr(0, 4).c_str()) - 1900;
time_struct.tm_mon = atoi(time_string.substr(4, 2).c_str()) - 1;
time_struct.tm_mon = atoi(time_string.substr(4, 2).c_str()) - 1;
time_struct.tm_mday = atoi(time_string.substr(6, 2).c_str());
time_struct.tm_hour = atoi(time_string.substr(9, 2).c_str());
time_struct.tm_min = atoi(time_string.substr(11, 2).c_str());
time_struct.tm_sec = atoi(time_string.substr(13, 2).c_str());
time_struct.tm_min = atoi(time_string.substr(11, 2).c_str());
time_struct.tm_sec = atoi(time_string.substr(13, 2).c_str());

return timegm(&time_struct);
}
Expand Down
8 changes: 7 additions & 1 deletion met/src/libcode/vx_tc_util/pair_data_genesis.cc
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,8 @@ void PairDataGenesis::add_fcst_gen(const GenesisInfo *fgi) {
void PairDataGenesis::add_best_gen(const GenesisInfo *bgi,
const int fcst_beg, const int fcst_end, const int init_add,
const unixtime init_beg, const unixtime init_end,
const TimeArray &init_inc, const TimeArray &init_exc) {
const TimeArray &init_inc, const TimeArray &init_exc,
const NumArray &init_hour, const NumArray &lead) {

if(!bgi) return;

Expand All @@ -282,6 +283,11 @@ void PairDataGenesis::add_best_gen(const GenesisInfo *bgi,
(init_exc.n() > 0 && init_exc.has(init_ut)))
continue;

// Check if this initialization hour and lead time should be used
if((init_hour.n() > 0 && !init_hour.has(unix_to_sec_of_day(init_ut))) ||
(lead.n() > 0 && !lead.has(nint(bgi->genesis_time() - init_ut))))
continue;

// Check if this case already exists
if(!has_case(bgi->storm_id(), init_ut, i_case)) {

Expand Down
3 changes: 2 additions & 1 deletion met/src/libcode/vx_tc_util/pair_data_genesis.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ class PairDataGenesis {
void add_best_gen(const GenesisInfo *,
const int, const int, const int,
const unixtime, const unixtime,
const TimeArray &, const TimeArray &);
const TimeArray &, const TimeArray &,
const NumArray &, const NumArray &);

void add_gen_pair(const GenesisInfo *, const GenesisInfo *);
void set_gen_diff(int, const GenesisPairDiff &);
Expand Down
2 changes: 1 addition & 1 deletion met/src/libcode/vx_time_series/compute_swinging_door.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class SDObservation
{
struct tm *time_struct = gmtime(&unix_time);

char time_string[80];
char time_string[tmp_buf_size];

snprintf(time_string, sizeof(time_string),
"%04d%02d%02d_%02d%02d%02d",
Expand Down
Loading

0 comments on commit d0c66b8

Please sign in to comment.