Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/dtcenter/MET into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnHalleyGotway committed May 5, 2023
2 parents 728e031 + 48f9ffb commit 815b78d
Show file tree
Hide file tree
Showing 11 changed files with 46 additions and 25 deletions.
6 changes: 5 additions & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,14 @@ version: 2
#formats: all
formats: [pdf]

build:
os: ubuntu-22.04
tools:
python: "3.10"

# Optionally set the version of Python and requirements required to build your
# docs
python:
version: 3.8
install:
- requirements: docs/requirements.txt

Expand Down
3 changes: 3 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1086,6 +1086,9 @@ AM_CONDITIONAL([ENABLE_DEVELOPMENT], [test -n "$MET_DEVELOPMENT"])

CPPFLAGS=$CPPFLAGS' -DMET_BASE="\"$(pkgdatadir)\""'

# Add -std=c++11 to CXXFLAGS
CXXFLAGS=$CXXFLAGS' -std=c++11'

# Define other variables for the makefiles

AC_SUBST(FC_LIBS, [-lgfortran])
Expand Down
2 changes: 2 additions & 0 deletions docs/Users_Guide/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ Programming Languages

The MET package, including MET-TC, is written primarily in C/C++ in order to be compatible with an extensive verification code base in C/C++ already in existence. In addition, the object-based MODE and MODE-TD verification tools rely heavily on the object-oriented aspects of C++. Knowledge of C/C++ is not necessary to use the MET package. The MET package has been designed to be highly configurable through the use of ASCII configuration files, enabling a great deal of flexibility without the need for source code modifications.

With the release of MET-11.1.0, C++11 is now the minimum required version of the C++ programming language standard.

NCEP's BUFRLIB is written entirely in Fortran. The portion of MET that handles the interface to the BUFRLIB for reading PrepBUFR point observation files is also written in Fortran.

The MET package is intended to be a tool for the modeling community to use and adapt. As users make upgrades and improvements to the tools, they are encouraged to offer those upgrades to the broader community by offering feedback to the developers.
Expand Down
4 changes: 2 additions & 2 deletions src/libcode/vx_grid/goes_grid.cc
Original file line number Diff line number Diff line change
Expand Up @@ -493,13 +493,13 @@ void GoesImagerData::compute_lat_lon()
mlog << Error << method_name << " index=" << index
<< " too big than " << buf_len << "\n";
else {
if (isnan(lat_rad)) lat = bad_data_float;
if (std::isnan(lat_rad)) lat = bad_data_float;
else {
lat = lat_rad * deg_per_rad;
if (lat > lat_max) {lat_max = lat; idx_lat_max = index; }
if (lat < lat_min) {lat_min = lat; idx_lat_min = index; }
}
if (isnan(lon_rad)) lon = bad_data_float;
if (std::isnan(lon_rad)) lon = bad_data_float;
else {
lon = lon_of_projection_origin - (lon_rad * deg_per_rad);
if (lon > lon_max) {lon_max = lon; idx_lon_max = index; }
Expand Down
4 changes: 2 additions & 2 deletions src/libcode/vx_python3_utils/python3_script.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class Python3_Script {

ConcatString filename() const;

PyObject * module();
PyObject * get_module();
PyObject * dict();
PyObject * module_ascii();
PyObject * dict_ascii();
Expand Down Expand Up @@ -92,7 +92,7 @@ class Python3_Script {
////////////////////////////////////////////////////////////////////////


inline PyObject * Python3_Script::module() { return ( Module ); }
inline PyObject * Python3_Script::get_module() { return ( Module ); }

inline PyObject * Python3_Script::dict() { return ( Dict ); }

Expand Down
2 changes: 1 addition & 1 deletion src/libcode/vx_statistics/compute_stats.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1596,7 +1596,7 @@ void compute_aggregated_seeps_grid(const DataPlane &fcst_dp, const DataPlane &ob
else count_diagonal++;
}
seeps_score = seeps_mpr->score;
if (isnan(seeps_score)) {
if (std::isnan(seeps_score)) {
nan_count++;
seeps_score = bad_data_double;
}
Expand Down
2 changes: 1 addition & 1 deletion src/libcode/vx_statistics/contable_stats.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1146,7 +1146,7 @@ for (j=0; j<Nrows; ++j) {
// replace nan with bad data
//

if (isnan(sum)) sum = bad_data_double;
if (std::isnan(sum)) sum = bad_data_double;

//
// done
Expand Down
32 changes: 17 additions & 15 deletions src/tools/other/madis2nc/madis2nc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,13 @@ static void setup_netcdf_out(int nhdr);

static bool get_filtered_nc_data(NcVar var, float *data, const long dim,
const long cur, const char *var_name, bool required=true);
// Added data_len for SonarQube
static bool get_filtered_nc_data_2d(NcVar var, int *data, const LongArray &dim,
const LongArray &cur, const char *var_name,
bool count_bad=false);
int data_len=0, bool count_bad=false);
static bool get_filtered_nc_data_2d(NcVar var, float *data, const LongArray &dim,
const LongArray &cur, const char *var_name,
bool count_bad=false);
int data_len=0, bool count_bad=false);

static void check_quality_control_flag(int &value, const char qty, const char *var_name);
static void check_quality_control_flag(float &value, const char qty, const char *var_name);
Expand Down Expand Up @@ -459,12 +460,12 @@ static bool get_filtered_nc_data(NcVar var, float *data,

static bool get_filtered_nc_data_2d(NcVar var, int *data, const LongArray &dim,
const LongArray &cur, const char *var_name,
bool count_bad) {
int data_len, bool count_bad) {

bool status = false;
int data_len = dim[0] * dim[1];
const char *method_name = "get_filtered_nc_data_2d(int) ";

if (data_len <= 0) data_len = dim[0] * dim[1];
for (int offset=0; offset<data_len; offset++) {
data[offset] = bad_data_int;
}
Expand Down Expand Up @@ -503,12 +504,12 @@ static bool get_filtered_nc_data_2d(NcVar var, int *data, const LongArray &dim,

static bool get_filtered_nc_data_2d(NcVar var, float *data, const LongArray &dim,
const LongArray &cur, const char *var_name,
bool count_bad) {
int data_len, bool count_bad) {

bool status = false;
int data_len = dim[0] * dim[1];
const char *method_name = "get_filtered_nc_data_2d(float) ";

if (data_len <= 0) data_len = dim[0] * dim[1];
for (int offset=0; offset<data_len; offset++) {
data[offset] = bad_data_float;
}
Expand Down Expand Up @@ -2135,8 +2136,8 @@ void process_madis_profiler(NcFile *&f_in) {
if (IS_VALID_NC(in_vComponentQty_var)) get_nc_data(&in_vComponentQty_var, (char *)vComponentQty_arr, dim, cur);
else memset(vComponentQty_arr, 0, data_cnt*sizeof(char));

get_filtered_nc_data_2d(in_uComponent_var, (float *)uComponent_arr, dim, cur, "uComponent");
get_filtered_nc_data_2d(in_vComponent_var, (float *)vComponent_arr, dim, cur, "vComponent");
get_filtered_nc_data_2d(in_uComponent_var, (float *)uComponent_arr, dim, cur, "uComponent", data_cnt);
get_filtered_nc_data_2d(in_vComponent_var, (float *)vComponent_arr, dim, cur, "vComponent", data_cnt);

for (int i_idx=0; i_idx<buf_size; i_idx++) {

Expand Down Expand Up @@ -3354,13 +3355,14 @@ void process_madis_acarsProfiles(NcFile *&f_in) {
cur[0] = i_hdr_s;
dim[0] = buf_size;
dim[1] = maxLevels;
data_cnt = buf_size * maxLevels;

get_nc_data(&in_hdr_vld_var, tmp_dbl_arr, dim, cur);
get_nc_data(&in_hdr_lat_var, (float *)hdr_lat_arr, dim, cur);
get_nc_data(&in_hdr_lon_var, (float *)hdr_lon_arr, dim, cur);
get_filtered_nc_data_2d(in_hdr_elv_var, (float *)hdr_elv_arr, dim, cur, "elevation");
get_filtered_nc_data_2d(in_hdr_elv_var, (float *)hdr_elv_arr, dim, cur, "elevation", data_cnt);


data_cnt = buf_size * maxLevels;
if (IS_VALID_NC(in_temperatureQty_var)) get_nc_data(&in_temperatureQty_var, (char *)&temperatureQty_arr, dim, cur);
else memset(temperatureQty_arr, 0, data_cnt*sizeof(char));
if (IS_VALID_NC(in_dewpointQty_var)) get_nc_data(&in_dewpointQty_var, (char *)&dewpointQty_arr, dim, cur);
Expand All @@ -3372,11 +3374,11 @@ void process_madis_acarsProfiles(NcFile *&f_in) {
if (IS_VALID_NC(in_altitudeQty_var)) get_nc_data(&in_altitudeQty_var, (char *)&altitudeQty_arr, dim, cur);
else memset(altitudeQty_arr, 0, data_cnt*sizeof(char));

get_filtered_nc_data_2d(in_hdr_tob_var, (int *)&obsTimeOfDay_arr, dim, cur, "obsTimeOfDay");
get_filtered_nc_data_2d(in_temperature_var, (float *)&temperature_arr, dim, cur, "temperature");
get_filtered_nc_data_2d(in_dewpoint_var, (float *)&dewpoint_arr, dim, cur, "dewpoint");
get_filtered_nc_data_2d(in_windDir_var, (float *)&windDir_arr, dim, cur, "windDir");
get_filtered_nc_data_2d(in_windSpeed_var, (float *)&windSpeed_arr, dim, cur, "windSpeed");
get_filtered_nc_data_2d(in_hdr_tob_var, (int *)&obsTimeOfDay_arr, dim, cur, "obsTimeOfDay", data_cnt);
get_filtered_nc_data_2d(in_temperature_var, (float *)&temperature_arr, dim, cur, "temperature", data_cnt);
get_filtered_nc_data_2d(in_dewpoint_var, (float *)&dewpoint_arr, dim, cur, "dewpoint", data_cnt);
get_filtered_nc_data_2d(in_windDir_var, (float *)&windDir_arr, dim, cur, "windDir", data_cnt);
get_filtered_nc_data_2d(in_windSpeed_var, (float *)&windSpeed_arr, dim, cur, "windSpeed", data_cnt);

dim[1] = hdr_sid_len;
get_nc_data(&in_hdr_sid_var, (char *)hdr_sid_arr, dim, cur);
Expand Down
3 changes: 2 additions & 1 deletion src/tools/other/mode_time_domain/interest_calc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ void InterestCalculator::assign(const InterestCalculator & i)

clear();

if ( i.Nelements == 0 ) return;
if ( i.Nelements <= 0 ) return;

extend(i.Nelements);

Expand Down Expand Up @@ -256,6 +256,7 @@ if ( _weight < 0.0 ) {

}

if (Nelements < 0) Nelements = 0; // SonarQube findings

extend(Nelements + 1);

Expand Down
9 changes: 7 additions & 2 deletions src/tools/other/mode_time_domain/mtd_file_int.cc
Original file line number Diff line number Diff line change
Expand Up @@ -832,7 +832,7 @@ void MtdIntFile::fatten()
int x, y, n;
const int nxy = Nx*Ny;
int * u = new int [nxy];
int * a = 0;
int * a = nullptr;

a = u;

Expand Down Expand Up @@ -899,7 +899,9 @@ for (y = 0; y<(Ny - 2); ++y) {

for (x=0; x<(Nx - 2); ++x) {

if ( *a ) {
if (n >= (nxy-1)) break; // For SonarQube findings

if (n >=0 && *a ) {

Data[n + 1] = 1; // (x + 1, y)
Data[n + Nx] = 1; // (x, y + 1)
Expand Down Expand Up @@ -1719,11 +1721,14 @@ s.set_to_zeroes();

int * in = Data;
int * out = s.Data;
int out_size = s.nxyt();

v = 0;

for (j=0; j<n3; ++j) {

if (j >= out_size) break; // For SonarQube findings

if ( yesno[*in] ) { *out = 1; ++v; }

++in;
Expand Down
4 changes: 4 additions & 0 deletions src/tools/other/mode_time_domain/mtd_partition.cc
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,8 @@ void EquivalenceClass::add_no_repeat(int k)

if ( has(k) ) return;

if (Nelements < 0) Nelements = 0;

extend(Nelements + 1);

E[Nelements++] = k;
Expand Down Expand Up @@ -685,6 +687,8 @@ void Mtd_Partition::add_no_repeat(int k)

if ( has(k) ) return;

if (Nelements < 0) Nelements = 0;

extend(Nelements + 1);

C[Nelements] = new EquivalenceClass;
Expand Down

0 comments on commit 815b78d

Please sign in to comment.