GRIB-744 use isOctahedral key

This commit is contained in:
Shahram Najm 2015-05-26 14:17:57 +01:00
parent b6a4eebbbd
commit 87ce084617
1 changed files with 6 additions and 1 deletions

View File

@ -110,6 +110,9 @@ int process_file(const char* filename)
angular_tolerance = get_precision(edition); angular_tolerance = get_precision(edition);
if (N <= 0) {
error("ERROR: N should be > 0!\n", N);
}
if ( Nj != 2*N ) { if ( Nj != 2*N ) {
error("ERROR: Nj is %ld but should be 2*N (%ld)!\n", Nj, 2*N); error("ERROR: Nj is %ld but should be 2*N (%ld)!\n", Nj, 2*N);
} }
@ -137,6 +140,7 @@ int process_file(const char* filename)
if (is_reduced) { if (is_reduced) {
int pl_sum = 0, max_pl = 0; int pl_sum = 0, max_pl = 0;
size_t i = 0, pl_len = 0; size_t i = 0, pl_len = 0;
long is_octahedral = 0;
int is_missing = codes_is_missing(h, "Ni", &err); int is_missing = codes_is_missing(h, "Ni", &err);
assert(err == CODES_SUCCESS); assert(err == CODES_SUCCESS);
if (!is_missing) { if (!is_missing) {
@ -171,7 +175,8 @@ int process_file(const char* filename)
if (pl_sum != numberOfDataPoints) { if (pl_sum != numberOfDataPoints) {
error("ERROR: Sum of pl array %ld does not match numberOfDataPoints %ld!\n", pl_sum, numberOfDataPoints); error("ERROR: Sum of pl array %ld does not match numberOfDataPoints %ld!\n", pl_sum, numberOfDataPoints);
} }
if (max_pl != 4*N) { CODES_CHECK(codes_get_long(h,"isOctahedral",&is_octahedral),0);
if (is_octahedral) {
printf("\tThis is an Octahedral Gaussian grid!\n"); printf("\tThis is an Octahedral Gaussian grid!\n");
expected_lon2 = 360.0 - 360.0/max_pl; expected_lon2 = 360.0 - 360.0/max_pl;
} }