Skip to content

Commit

Permalink
fixing 0 gridpoints problem (#486)
Browse files Browse the repository at this point in the history
  • Loading branch information
edwardhartnett authored Feb 28, 2024
1 parent c7175a4 commit 60eb050
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/g2cdegrib2.c
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,7 @@ 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;
float total = 0.0, max = 0.0, min = 0.0, avg = 0;
int t;

fprintf(f, "\n");
Expand Down Expand Up @@ -827,9 +827,10 @@ g2c_degrib2(int g2cid, const char *fileout)
if (data[i] < min)
min = data[i];
}
avg = total/sec5_info->num_data_points;
}
fprintf(f, "( PARM= %s ) : MIN=%25.8f AVE=%25.8f MAX=%25.8f\n",
abbrev, min, total/sec5_info->num_data_points, max);
abbrev, min, avg, max);

/* Free the data. */
if (sec5_info->num_data_points)
Expand Down

0 comments on commit 60eb050

Please sign in to comment.