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

turned on intel test again #543

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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/workflows/Intel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:

- name: build
run: |
cmake -S g2c -B g2c/build -DJasper_ROOT=$GITHUB_WORKSPACE/nceplibs/jasper -DBUILD_G2C=OFF
cmake -S g2c -B g2c/build -DJasper_ROOT=$GITHUB_WORKSPACE/nceplibs/jasper
cmake --build g2c/build --parallel 2 --verbose

- name: Perform CodeQL Analysis
Expand Down
12 changes: 9 additions & 3 deletions src/g2cdegrib2.c
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,11 @@ g2c_get_level_desc(int ipdtn, long long int *ipdtmpl, char *level_desc)
*
* @param g2cid Indentifier for the file, returned by g2c_open() or
* g2c_create().
* @param avg_round Number of digits to show for average. This is
* useful for limiting the difference of the "AVE" value between
* different compilers, which will come out with slightly different
* answers. The degrib2 Fortran utility shows 8 numbers after the
* decimal. In testing, 3 works everywhere we've tried.
* @param fileout Path of output file. Any existing file of this name
* will be overwritten.
*
Expand All @@ -631,7 +636,7 @@ g2c_get_level_desc(int ipdtn, long long int *ipdtmpl, char *level_desc)
* @author Ed Hartnett @date Sep 17, 2022
*/
int
g2c_degrib2(int g2cid, const char *fileout)
g2c_degrib2(int g2cid, int avg_round, const char *fileout)
{
FILE *f;
G2C_MESSAGE_INFO_T *msg;
Expand Down Expand Up @@ -680,7 +685,8 @@ g2c_degrib2(int g2cid, const char *fileout)
char level_desc[G2C_MAX_TYPE_OF_FIXED_SURFACE_LEN + 1];
char date_time[100 + 1];
float *data = NULL;
float total = 0.0, max = 0.0, min = 0.0, avg = 0;
double total = 0.0, avg = 0;
float max = 0.0, min = 0.0;
int t;

fprintf(f, "\n");
Expand Down Expand Up @@ -828,7 +834,7 @@ g2c_degrib2(int g2cid, const char *fileout)
avg = total / sec5_info->num_data_points;
}
fprintf(f, "( PARM= %s ) : MIN=%25.8f AVE=%25.8f MAX=%25.8f\n",
abbrev, min, avg, max);
abbrev, min, (float)avg, max);

/* Free the data. */
if (sec5_info->num_data_points)
Expand Down
2 changes: 1 addition & 1 deletion src/grib2.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ int g2c_aecunpackd(unsigned char *cpack, size_t len, int *idrstmpl, size_t ndpts
int g2c_compare(int g2cid1, int g2cid2);

/* Output. */
int g2c_degrib2(int g2cid, const char *fileout);
int g2c_degrib2(int g2cid, int avg_rount, const char *fileout);

/* Parameters. */
int g2c_param_g1tog2(int g1val, int g1ver, int *g2disc, int *g2cat, int *g2num);
Expand Down
2 changes: 1 addition & 1 deletion tests/tst_g2_testfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ main()
return ret;

/* Write degrib2 output. */
if ((ret = g2c_degrib2(g2cid, DEGRIB2_FILENAME)))
if ((ret = g2c_degrib2(g2cid, 8, DEGRIB2_FILENAME)))
return ret;

/* Check results. */
Expand Down
3 changes: 2 additions & 1 deletion utils/g2c_degrib2.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ main(int argc, char **argv)
char *filein = NULL;
char *fileidx = NULL;
char *fileout = NULL;
int avg_round = 8;
int ret;

opterr = 0;
Expand Down Expand Up @@ -117,7 +118,7 @@ main(int argc, char **argv)
}

/* Write the degrib2 summary. */
if ((ret = g2c_degrib2(g2cid, fileout)))
if ((ret = g2c_degrib2(g2cid, avg_round, fileout)))
{
fprintf(stderr, "Could not write degrib2 summary to %s.\n", fileout);
return ret;
Expand Down
Loading