Skip to content

Commit

Permalink
3.23
Browse files Browse the repository at this point in the history
  • Loading branch information
AlysonStahl-NOAA committed Jan 6, 2025
1 parent d0d97a1 commit eefe2e7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/grib2.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ g2int g2_gribend(unsigned char *cgrib);
#define G2C_SECTION1_LEN 13 /**< Length of section 1 array. */

/* Constants to help with templates. */
#define G2C_MAX_GDS_TEMPLATE 32 /**< Maximum number of grid templates. */
#define G2C_MAX_GDS_TEMPLATE 33 /**< Maximum number of grid templates. */
#define G2C_MAX_GDS_TEMPLATE_MAPLEN 28 /**< Maximum grid template map length. */
#define G2C_MAX_PDS_TEMPLATE 102 /**< Maximum number of PDS templates. */
#define G2C_MAX_PDS_TEMPLATE_MAPLEN 50 /**< Maximum template map length. */
Expand Down
2 changes: 2 additions & 0 deletions src/gridtemplates.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ static const struct gridtemplate templatesgrid[G2C_MAX_GDS_TEMPLATE] =

/* 3.13: Mercator with modelling subdomains definition */
{13, 23, 0, {1, 1, 4, 1, 4, 1, 4, 4, 4, -4, 4, 1, -4, -4, 4, 1, 4, 4, 4, 4, 4, 4, 4}}
/* 3.23: Polar stereographic projection with modelling subdomains definition */
{23, 22, 0, {1, 1, 4, 1, 4, 1, 4, 4, 4, -4, 4, 1, -4, 4, 4, 4, 1, 1, 4, 4, 4, 4}},
};

/**
Expand Down
11 changes: 6 additions & 5 deletions tests/tst_get_grid_template.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "grib2_int.h"

/* Number of grid templates to test. */
#define NUM_TESTS 32
#define NUM_TESTS 33

/* Number of grid templates with extensions. */
#define NUM_EXT_TESTS 5
Expand All @@ -20,14 +20,14 @@ main()
{
int template_number[NUM_TESTS] = {
0, 1, 2, 3, 4, 5, 12, 101, 140, 10, 20, 30, 31, 40, 41, 42, 43, 50, 51, 52, 53, 90, 100, 110, 120,
204, 32768, 32769, 1000, 1100, 1200, 13};
204, 32768, 32769, 1000, 1100, 1200, 13, 23};
int expected_maplen[NUM_TESTS] = {
19, 22, 22, 25, 13, 16, 22, 4, 17, 19, 18, 22, 22, 19, 22, 22, 25, 5, 8, 8, 11, 21, 11, 16, 7, 19,
19, 21, 20, 28, 16, 23};
19, 21, 20, 28, 16, 23. 22};
int expected_needsext[NUM_TESTS] = {
0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,0, 1, 0, 0, 0, 1, 0, 1, 0};
0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,0, 1, 0, 0, 0, 1, 0, 1, 0, 0};
int expected_extlen[NUM_TESTS] = {
0, 0, 0, 0, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 2, 0, 2, 0};
0, 0, 0, 0, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 2, 0, 2, 0, 0};
int expected_map[NUM_TESTS][28] = {
{1, 1, 4, 1, 4, 1, 4, 4, 4, 4, 4, -4, 4, 1, -4, 4, 4, 4, 1, 0, 0, 0}, /* 0 */
{1, 1, 4, 1, 4, 1, 4, 4, 4, 4, 4, -4, 4, 1, -4, 4, 4, 4, 1, -4, 4, 4, 0, 0, 0}, /* 1 */
Expand Down Expand Up @@ -61,6 +61,7 @@ main()
{1, 1, 4, 1, 4, 1, 4, 4, 4, 4, -4, 4, 1, -4, 4, 1, 4, 1, -4, 1, 1, -4, 2, 1, 1, 1, 1, 1}, /* 1100 */
{4, 1, -4, 1, 1, -4, 2, 1, 1, 1, 1, 1, 2, 1, 1, 2}, /* 1200 */
{1, 1, 4, 1, 4, 1, 4, 4, 4, -4, 4, 1, -4, -4, 4, 1, 4, 4, 4, 4, 4, 4, 4}, /* 13 */
{1, 1, 4, 1, 4, 1, 4, 4, 4, -4, 4, 1, -4, 4, 4, 4, 1, 1, 4, 4, 4, 4}, /* 23 */
};
int expected_ext[NUM_EXT_TESTS][8] = {
{4, 4, -4, -4},
Expand Down

0 comments on commit eefe2e7

Please sign in to comment.