From 5301b6aef9b62803b6f8f3da988de92b71dece2f Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Wed, 4 Dec 2024 13:30:57 -0800 Subject: [PATCH 01/80] pds 4.49 --- src/grib2.h.in | 2 +- src/pdstemplates.c | 7 +++++-- tests/tst_pdstemplates.c | 5 +++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/grib2.h.in b/src/grib2.h.in index 3f12474c..dc3b46f4 100644 --- a/src/grib2.h.in +++ b/src/grib2.h.in @@ -291,7 +291,7 @@ g2int g2_gribend(unsigned char *cgrib); /* Constants to help with templates. */ #define G2C_MAX_GDS_TEMPLATE 31 /**< Maximum number of grid templates. */ #define G2C_MAX_GDS_TEMPLATE_MAPLEN 28 /**< Maximum grid template map length. */ -#define G2C_MAX_PDS_TEMPLATE 47 /**< Maximum number of PDS templates. */ +#define G2C_MAX_PDS_TEMPLATE 48 /**< Maximum number of PDS templates. */ #define G2C_MAX_PDS_TEMPLATE_MAPLEN 45 /**< Maximum template map length. */ #define G2C_MAX_DRS_TEMPLATE 10 /**< Maximum number of DRS templates. */ #define G2C_MAX_DRS_TEMPLATE_MAPLEN 18 /**< Maximum DRS template map length. */ diff --git a/src/pdstemplates.c b/src/pdstemplates.c index fdd29fb8..e862b7e0 100644 --- a/src/pdstemplates.c +++ b/src/pdstemplates.c @@ -222,8 +222,11 @@ static const struct pdstemplate templatespds[G2C_MAX_PDS_TEMPLATE] = 4.35: Individual ensemble reforecast, control and perturbed, at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval. */ - {35, 6, 1, {1, 1, 1, 1, 1, 1}} - + {35, 6, 1, {1, 1, 1, 1, 1, 1}}, + /** 4.49: Individual Ensemble Forecast, Control and Perturbed, + at a horizontal level or in a horizontal layer at a point in time + for Optical Properties of Aerosol for Optical Properties of Aerosol */ + {49, 29, 0, { 1, 1, 2, 1, -1, -4, -1, -4, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}}, }; /** diff --git a/tests/tst_pdstemplates.c b/tests/tst_pdstemplates.c index 8f5d4622..f8722752 100644 --- a/tests/tst_pdstemplates.c +++ b/tests/tst_pdstemplates.c @@ -356,11 +356,11 @@ main() printf("ok!\n"); printf("Testing all getpdstemplate() calls with extensions...\n"); { -#define NUM_TEST 47 +#define NUM_TEST 48 int number[NUM_TEST] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 20, 30, 31, 40, 41, 42, 43, 254, 1000, 1001, 1002, 1100, 1101, 32, 44, 45, 46, 47, 48, 50, 52, - 51, 91, 33, 34, 53, 54, 57, 60, 61, 35}; + 51, 91, 33, 34, 53, 54, 57, 60, 61, 35, 49}; int expected_maplen[NUM_TEST] = { 15, 18, 17, 31, 30, 22, 16, 15, 29, 36, 30, 32, 31, 45, 44, 18, 19, 5, 5, 16, 19, 30, 33, 3, 9, 16, 15, 15, 22, 10, 21, 24, 35, 38, 26, 21, 15, 16, @@ -416,6 +416,7 @@ main() {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1}, /* 60 */ {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 61 */ {1, 1, 1, 1, 1, 1}, /* 35 */ + {1, 1, 2, 1, -1, -4, -1, -4, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 49*/ }; int t; int ext_t = 0; From 8a91b54ea5eaab3e111cbd46a50ca615aee61548 Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Wed, 4 Dec 2024 13:39:33 -0800 Subject: [PATCH 02/80] fixing test for 4.49 --- src/pdstemplates.c | 2 +- tests/tst_pdstemplates.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pdstemplates.c b/src/pdstemplates.c index e862b7e0..bdd302b5 100644 --- a/src/pdstemplates.c +++ b/src/pdstemplates.c @@ -226,7 +226,7 @@ static const struct pdstemplate templatespds[G2C_MAX_PDS_TEMPLATE] = /** 4.49: Individual Ensemble Forecast, Control and Perturbed, at a horizontal level or in a horizontal layer at a point in time for Optical Properties of Aerosol for Optical Properties of Aerosol */ - {49, 29, 0, { 1, 1, 2, 1, -1, -4, -1, -4, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}}, + {49, 29, 0, {1, 1, 2, 1, -1, -4, -1, -4, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}}, }; /** diff --git a/tests/tst_pdstemplates.c b/tests/tst_pdstemplates.c index f8722752..6eb87ebd 100644 --- a/tests/tst_pdstemplates.c +++ b/tests/tst_pdstemplates.c @@ -364,10 +364,10 @@ main() int expected_maplen[NUM_TEST] = { 15, 18, 17, 31, 30, 22, 16, 15, 29, 36, 30, 32, 31, 45, 44, 18, 19, 5, 5, 16, 19, 30, 33, 3, 9, 16, 15, 15, 22, 10, 21, 24, 35, 38, 26, 21, 15, 16, - 36, 18, 32, 19, 22, 7, 24, 38, 6}; + 36, 18, 32, 19, 22, 7, 24, 38, 6, 29}; int expected_needext[NUM_TEST] = { 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, - 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1}; + 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0}; int expected_map[NUM_TEST][48] = { {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 0 */ {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 1 */ @@ -416,7 +416,7 @@ main() {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1}, /* 60 */ {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 61 */ {1, 1, 1, 1, 1, 1}, /* 35 */ - {1, 1, 2, 1, -1, -4, -1, -4, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 49*/ + {1, 1, 2, 1, -1, -4, -1, -4, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 49 */ }; int t; int ext_t = 0; From 5b1202d17d9d41e157afe73c9e94e4fcdd6f1715 Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Wed, 4 Dec 2024 13:47:42 -0800 Subject: [PATCH 03/80] pds 4.55 --- src/grib2.h.in | 2 +- src/pdstemplates.c | 3 +++ tests/tst_pdstemplates.c | 9 +++++---- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/grib2.h.in b/src/grib2.h.in index dc3b46f4..88a3a1d1 100644 --- a/src/grib2.h.in +++ b/src/grib2.h.in @@ -291,7 +291,7 @@ g2int g2_gribend(unsigned char *cgrib); /* Constants to help with templates. */ #define G2C_MAX_GDS_TEMPLATE 31 /**< Maximum number of grid templates. */ #define G2C_MAX_GDS_TEMPLATE_MAPLEN 28 /**< Maximum grid template map length. */ -#define G2C_MAX_PDS_TEMPLATE 48 /**< Maximum number of PDS templates. */ +#define G2C_MAX_PDS_TEMPLATE 49 /**< Maximum number of PDS templates. */ #define G2C_MAX_PDS_TEMPLATE_MAPLEN 45 /**< Maximum template map length. */ #define G2C_MAX_DRS_TEMPLATE 10 /**< Maximum number of DRS templates. */ #define G2C_MAX_DRS_TEMPLATE_MAPLEN 18 /**< Maximum DRS template map length. */ diff --git a/src/pdstemplates.c b/src/pdstemplates.c index bdd302b5..c2314c93 100644 --- a/src/pdstemplates.c +++ b/src/pdstemplates.c @@ -227,6 +227,9 @@ static const struct pdstemplate templatespds[G2C_MAX_PDS_TEMPLATE] = at a horizontal level or in a horizontal layer at a point in time for Optical Properties of Aerosol for Optical Properties of Aerosol */ {49, 29, 0, {1, 1, 2, 1, -1, -4, -1, -4, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}}, + /** 4.55: Spatio-temporal changing tiles + at a horizontal level or horizontal layer at a point in time */ + {55, 21, 0, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}}, }; /** diff --git a/tests/tst_pdstemplates.c b/tests/tst_pdstemplates.c index 6eb87ebd..dcdd7b63 100644 --- a/tests/tst_pdstemplates.c +++ b/tests/tst_pdstemplates.c @@ -356,18 +356,18 @@ main() printf("ok!\n"); printf("Testing all getpdstemplate() calls with extensions...\n"); { -#define NUM_TEST 48 +#define NUM_TEST 49 int number[NUM_TEST] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 20, 30, 31, 40, 41, 42, 43, 254, 1000, 1001, 1002, 1100, 1101, 32, 44, 45, 46, 47, 48, 50, 52, - 51, 91, 33, 34, 53, 54, 57, 60, 61, 35, 49}; + 51, 91, 33, 34, 53, 54, 57, 60, 61, 35, 49, 55}; int expected_maplen[NUM_TEST] = { 15, 18, 17, 31, 30, 22, 16, 15, 29, 36, 30, 32, 31, 45, 44, 18, 19, 5, 5, 16, 19, 30, 33, 3, 9, 16, 15, 15, 22, 10, 21, 24, 35, 38, 26, 21, 15, 16, - 36, 18, 32, 19, 22, 7, 24, 38, 6, 29}; + 36, 18, 32, 19, 22, 7, 24, 38, 6, 29, 21}; int expected_needext[NUM_TEST] = { 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, - 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0}; + 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0}; int expected_map[NUM_TEST][48] = { {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 0 */ {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 1 */ @@ -417,6 +417,7 @@ main() {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 61 */ {1, 1, 1, 1, 1, 1}, /* 35 */ {1, 1, 2, 1, -1, -4, -1, -4, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 49 */ + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 55 */ }; int t; int ext_t = 0; From 2f5293e573ce023c97fa2863ad55cce75337b321 Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Wed, 4 Dec 2024 14:17:37 -0800 Subject: [PATCH 04/80] pds 4.58 + extension --- src/grib2.h.in | 2 +- src/pdstemplates.c | 39 ++++++++++++++++++-- tests/tst_pdstemplates.c | 77 ++++++++++++++++++++++++---------------- 3 files changed, 84 insertions(+), 34 deletions(-) diff --git a/src/grib2.h.in b/src/grib2.h.in index 88a3a1d1..b4a03685 100644 --- a/src/grib2.h.in +++ b/src/grib2.h.in @@ -291,7 +291,7 @@ g2int g2_gribend(unsigned char *cgrib); /* Constants to help with templates. */ #define G2C_MAX_GDS_TEMPLATE 31 /**< Maximum number of grid templates. */ #define G2C_MAX_GDS_TEMPLATE_MAPLEN 28 /**< Maximum grid template map length. */ -#define G2C_MAX_PDS_TEMPLATE 49 /**< Maximum number of PDS templates. */ +#define G2C_MAX_PDS_TEMPLATE 50 /**< Maximum number of PDS templates. */ #define G2C_MAX_PDS_TEMPLATE_MAPLEN 45 /**< Maximum template map length. */ #define G2C_MAX_DRS_TEMPLATE 10 /**< Maximum number of DRS templates. */ #define G2C_MAX_DRS_TEMPLATE_MAPLEN 18 /**< Maximum DRS template map length. */ diff --git a/src/pdstemplates.c b/src/pdstemplates.c index c2314c93..72953880 100644 --- a/src/pdstemplates.c +++ b/src/pdstemplates.c @@ -223,13 +223,20 @@ static const struct pdstemplate templatespds[G2C_MAX_PDS_TEMPLATE] = at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval. */ {35, 6, 1, {1, 1, 1, 1, 1, 1}}, - /** 4.49: Individual Ensemble Forecast, Control and Perturbed, + /** PDT 4.49 (12/04/2024) + 4.49: Individual Ensemble Forecast, Control and Perturbed, at a horizontal level or in a horizontal layer at a point in time for Optical Properties of Aerosol for Optical Properties of Aerosol */ {49, 29, 0, {1, 1, 2, 1, -1, -4, -1, -4, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}}, - /** 4.55: Spatio-temporal changing tiles + /** PDT 4.55 (12/04/2024) + 4.55: Spatio-temporal changing tiles at a horizontal level or horizontal layer at a point in time */ {55, 21, 0, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}}, + /** PDT 4.58 (12/04/2024) + 4.58: Individual Ensemble Forecast, Control and Perturbed, at a + horizontal level or in a horizontal layer at a point in time interval for + Atmospheric Chemical Constituents based on a distribution function */ + {58, 7, 1, {1, 1, 2, 2, 2, 2, 1}}, }; /** @@ -738,6 +745,34 @@ extpdstemplate(g2int number, g2int *list) new->ext[l + 4] = 4; } } + /* PDT 4.58 (12/04/2024) */ + else if (number == 58) + { + new->extlen = list[6] * 18; + new->ext = malloc(sizeof(g2int) * new->extlen); + for (i = 0; i < list[6]; i++) + { + l = i * 18; + new->ext[l] = -1; + new->ext[l + 1] = -4; + new->ext[l + 2] = 1; + new->ext[l + 3] = 1; + new->ext[l + 4] = 1; + new->ext[l + 5] = 2; + new->ext[l + 6] = 1; + new->ext[l + 7] = 1; + new->ext[l + 8] = -4; + new->ext[l + 9] = 1; + new->ext[l + 10] = -1; + new->ext[l + 11] =-4; + new->ext[l + 12] = 1; + new->ext[l + 13] = -1; + new->ext[l + 14] = -4; + new->ext[l + 15] = 1; + new->ext[l + 16] = 1; + new->ext[l + 17] = 1; + } + } return new; } diff --git a/tests/tst_pdstemplates.c b/tests/tst_pdstemplates.c index dcdd7b63..6c8995d0 100644 --- a/tests/tst_pdstemplates.c +++ b/tests/tst_pdstemplates.c @@ -352,22 +352,33 @@ main() return G2C_ERROR; free(tmpl->ext); free(tmpl); + + /* Check for one that's there but does need an extension. */ + tmpl = extpdstemplate(58, list); + if (!tmpl) + return G2C_ERROR; + if (tmpl->num != 58 || tmpl->maplen != 7 || !tmpl->needext) + return G2C_ERROR; + if (!tmpl->ext) + return G2C_ERROR; + free(tmpl->ext); + free(tmpl); } printf("ok!\n"); printf("Testing all getpdstemplate() calls with extensions...\n"); { -#define NUM_TEST 49 +#define NUM_TEST 50 int number[NUM_TEST] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 20, 30, 31, 40, 41, 42, 43, 254, 1000, 1001, 1002, 1100, 1101, 32, 44, 45, 46, 47, 48, 50, 52, - 51, 91, 33, 34, 53, 54, 57, 60, 61, 35, 49, 55}; + 51, 91, 33, 34, 53, 54, 57, 60, 61, 35, 49, 55, 58}; int expected_maplen[NUM_TEST] = { 15, 18, 17, 31, 30, 22, 16, 15, 29, 36, 30, 32, 31, 45, 44, 18, 19, 5, 5, 16, 19, 30, 33, 3, 9, 16, 15, 15, 22, 10, 21, 24, 35, 38, 26, 21, 15, 16, - 36, 18, 32, 19, 22, 7, 24, 38, 6, 29, 21}; + 36, 18, 32, 19, 22, 7, 24, 38, 6, 29, 21, 7}; int expected_needext[NUM_TEST] = { 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, - 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0}; + 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1}; int expected_map[NUM_TEST][48] = { {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 0 */ {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 1 */ @@ -418,6 +429,7 @@ main() {1, 1, 1, 1, 1, 1}, /* 35 */ {1, 1, 2, 1, -1, -4, -1, -4, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 49 */ {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 55 */ + {1, 1, 2, 2, 2, 2, 1}, /* 58 */ }; int t; int ext_t = 0; @@ -459,35 +471,36 @@ main() if (map[m] != expected_map[t][m]) return G2C_ERROR; -#define NUM_EXT_TEST 25 +#define NUM_EXT_TEST 26 int template[G2C_MAX_PDS_TEMPLATE_MAPLEN]; - int expected_extlen[NUM_EXT_TEST] = {2, 2, 6, 6, 6, 6, 6, 8, 8, 10, 10, 6, 6, 10, 6, 6, 12, 8, 2, 8, 2, 2, 30, 6, 10}; + int expected_extlen[NUM_EXT_TEST] = {2, 2, 6, 6, 6, 6, 6, 8, 8, 10, 10, 6, 6, 10, 6, 6, 12, 8, 2, 8, 2, 2, 30, 6, 10, 36}; int expected_ext[NUM_EXT_TEST][48] = { - {1, 1}, /* 3 */ - {1, 1}, /* 4 */ - {1, 1, 1, 4, 1, 4}, /* 8 */ - {1, 1, 1, 4, 1, 4}, /* 9 */ - {1, 1, 1, 4, 1, 4}, /* 10 */ - {1, 1, 1, 4, 1, 4}, /* 11 */ - {1, 1, 1, 4, 1, 4}, /* 12 */ - {1, 1, 1, 4, 1, 4, 1, 1}, /* 13 */ - {1, 1, 1, 4, 1, 4, 1, 1}, /* 14 */ - {2, 2, 1, 1, 4, 2, 2, 1, 1, 4}, /* 30 */ - {2, 2, 2, 1, 4, 2, 2, 2, 1, 4}, /* 31 */ - {1, 1, 1, 4, 1, 4}, /* 42 */ - {1, 1, 1, 4, 1, 4}, /* 43 */ - {2, 2, 2, -1, -4, 2, 2, 2, -1, -4}, /* 32 */ - {1, 1, 1, 4, 1, 4}, /* 46 */ - {1, 1, 1, 4, 1, 4}, /* 47 */ - {1, 1, -1, -4, -1, -4, 1, 1, -1, -4, -1, -4}, /* 51 */ - {1, 1, 1, 4, 1, 4, 1, 1}, /* 91 */ - {1, 1}, /* 33 */ - {1, 1, 1, 4, 1, 4, 1, 1}, /* 34 */ - {1, 1}, /* 53 */ - {1, 1}, /* 54 */ - {1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 57 */ - {1, 1, 1, 4, 1, 4}, /* 61 */ - {2, 2, 2, 1, 4, 2, 2, 2, 1, 4}, /* 35 */ + {1, 1}, /* 3 */ + {1, 1}, /* 4 */ + {1, 1, 1, 4, 1, 4}, /* 8 */ + {1, 1, 1, 4, 1, 4}, /* 9 */ + {1, 1, 1, 4, 1, 4}, /* 10 */ + {1, 1, 1, 4, 1, 4}, /* 11 */ + {1, 1, 1, 4, 1, 4}, /* 12 */ + {1, 1, 1, 4, 1, 4, 1, 1}, /* 13 */ + {1, 1, 1, 4, 1, 4, 1, 1}, /* 14 */ + {2, 2, 1, 1, 4, 2, 2, 1, 1, 4}, /* 30 */ + {2, 2, 2, 1, 4, 2, 2, 2, 1, 4}, /* 31 */ + {1, 1, 1, 4, 1, 4}, /* 42 */ + {1, 1, 1, 4, 1, 4}, /* 43 */ + {2, 2, 2, -1, -4, 2, 2, 2, -1, -4}, /* 32 */ + {1, 1, 1, 4, 1, 4}, /* 46 */ + {1, 1, 1, 4, 1, 4}, /* 47 */ + {1, 1, -1, -4, -1, -4, 1, 1, -1, -4, -1, -4}, /* 51 */ + {1, 1, 1, 4, 1, 4, 1, 1}, /* 91 */ + {1, 1}, /* 33 */ + {1, 1, 1, 4, 1, 4, 1, 1}, /* 34 */ + {1, 1}, /* 53 */ + {1, 1}, /* 54 */ + {1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 57 */ + {1, 1, 1, 4, 1, 4}, /* 61 */ + {2, 2, 2, 1, 4, 2, 2, 2, 1, 4}, /* 35 */ + {-1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 58 */ }; if (needext) @@ -579,6 +592,8 @@ main() case 35: template[5] = 2; break; + case 58: + template[6] = 2; default: return G2C_ERROR; } From 85c8bb5b7666f2fd1a2544a53551b7edb452a61b Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Wed, 4 Dec 2024 14:32:10 -0800 Subject: [PATCH 05/80] Update tst_pdstemplates.c --- tests/tst_pdstemplates.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/tst_pdstemplates.c b/tests/tst_pdstemplates.c index 6c8995d0..a35cdbb0 100644 --- a/tests/tst_pdstemplates.c +++ b/tests/tst_pdstemplates.c @@ -594,6 +594,7 @@ main() break; case 58: template[6] = 2; + break; default: return G2C_ERROR; } From 48cc7d9fc501b74cff63a52be2486284e34f33c7 Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Wed, 4 Dec 2024 14:36:58 -0800 Subject: [PATCH 06/80] fix format for clang --- src/pdstemplates.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pdstemplates.c b/src/pdstemplates.c index 72953880..2cb3bc53 100644 --- a/src/pdstemplates.c +++ b/src/pdstemplates.c @@ -764,7 +764,7 @@ extpdstemplate(g2int number, g2int *list) new->ext[l + 8] = -4; new->ext[l + 9] = 1; new->ext[l + 10] = -1; - new->ext[l + 11] =-4; + new->ext[l + 11] = -4; new->ext[l + 12] = 1; new->ext[l + 13] = -1; new->ext[l + 14] = -4; From ec82b586c8cec9e8369fed8fc2f7cf5f0511dcca Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Wed, 4 Dec 2024 14:42:02 -0800 Subject: [PATCH 07/80] pds 4.59 --- src/grib2.h.in | 2 +- src/pdstemplates.c | 4 ++++ tests/tst_pdstemplates.c | 10 ++++++---- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/grib2.h.in b/src/grib2.h.in index b4a03685..0ca273c4 100644 --- a/src/grib2.h.in +++ b/src/grib2.h.in @@ -291,7 +291,7 @@ g2int g2_gribend(unsigned char *cgrib); /* Constants to help with templates. */ #define G2C_MAX_GDS_TEMPLATE 31 /**< Maximum number of grid templates. */ #define G2C_MAX_GDS_TEMPLATE_MAPLEN 28 /**< Maximum grid template map length. */ -#define G2C_MAX_PDS_TEMPLATE 50 /**< Maximum number of PDS templates. */ +#define G2C_MAX_PDS_TEMPLATE 51 /**< Maximum number of PDS templates. */ #define G2C_MAX_PDS_TEMPLATE_MAPLEN 45 /**< Maximum template map length. */ #define G2C_MAX_DRS_TEMPLATE 10 /**< Maximum number of DRS templates. */ #define G2C_MAX_DRS_TEMPLATE_MAPLEN 18 /**< Maximum DRS template map length. */ diff --git a/src/pdstemplates.c b/src/pdstemplates.c index 2cb3bc53..567df6a2 100644 --- a/src/pdstemplates.c +++ b/src/pdstemplates.c @@ -237,6 +237,10 @@ static const struct pdstemplate templatespds[G2C_MAX_PDS_TEMPLATE] = horizontal level or in a horizontal layer at a point in time interval for Atmospheric Chemical Constituents based on a distribution function */ {58, 7, 1, {1, 1, 2, 2, 2, 2, 1}}, + /** PDT 4.59 (12/04/2024) + 4.59: Individual Ensemble Forecast, Control and Perturbed, at a horizontal level or in + a horizontal layer at a point in time interval for Spatio-Temporal changing tile parameters */ + {59, 24, 0, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}}, }; /** diff --git a/tests/tst_pdstemplates.c b/tests/tst_pdstemplates.c index a35cdbb0..36c0e8de 100644 --- a/tests/tst_pdstemplates.c +++ b/tests/tst_pdstemplates.c @@ -367,18 +367,19 @@ main() printf("ok!\n"); printf("Testing all getpdstemplate() calls with extensions...\n"); { -#define NUM_TEST 50 +#define NUM_TEST 51 int number[NUM_TEST] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 20, 30, 31, 40, 41, 42, 43, 254, 1000, 1001, 1002, 1100, 1101, 32, 44, 45, 46, 47, 48, 50, 52, - 51, 91, 33, 34, 53, 54, 57, 60, 61, 35, 49, 55, 58}; + 51, 91, 33, 34, 53, 54, 57, 60, 61, 35, 49, 55, 58, 59}; int expected_maplen[NUM_TEST] = { 15, 18, 17, 31, 30, 22, 16, 15, 29, 36, 30, 32, 31, 45, 44, 18, 19, 5, 5, 16, 19, 30, 33, 3, 9, 16, 15, 15, 22, 10, 21, 24, 35, 38, 26, 21, 15, 16, - 36, 18, 32, 19, 22, 7, 24, 38, 6, 29, 21, 7}; + 36, 18, 32, 19, 22, 7, 24, 38, 6, 29, 21, 7, 24}; int expected_needext[NUM_TEST] = { 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, - 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1}; + 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, + 0}; int expected_map[NUM_TEST][48] = { {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 0 */ {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 1 */ @@ -430,6 +431,7 @@ main() {1, 1, 2, 1, -1, -4, -1, -4, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 49 */ {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 55 */ {1, 1, 2, 2, 2, 2, 1}, /* 58 */ + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 59 */ }; int t; int ext_t = 0; From 99d333c9a95cee1464d556b768324a8a7083f1fc Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Wed, 4 Dec 2024 15:04:11 -0800 Subject: [PATCH 08/80] pds 4.62 --- src/grib2.h.in | 2 +- src/pdstemplates.c | 23 +++++++++++++++++++++++ tests/tst_pdstemplates.c | 26 +++++++++++++++++++++----- 3 files changed, 45 insertions(+), 6 deletions(-) diff --git a/src/grib2.h.in b/src/grib2.h.in index 0ca273c4..d70cc8f2 100644 --- a/src/grib2.h.in +++ b/src/grib2.h.in @@ -291,7 +291,7 @@ g2int g2_gribend(unsigned char *cgrib); /* Constants to help with templates. */ #define G2C_MAX_GDS_TEMPLATE 31 /**< Maximum number of grid templates. */ #define G2C_MAX_GDS_TEMPLATE_MAPLEN 28 /**< Maximum grid template map length. */ -#define G2C_MAX_PDS_TEMPLATE 51 /**< Maximum number of PDS templates. */ +#define G2C_MAX_PDS_TEMPLATE 52 /**< Maximum number of PDS templates. */ #define G2C_MAX_PDS_TEMPLATE_MAPLEN 45 /**< Maximum template map length. */ #define G2C_MAX_DRS_TEMPLATE 10 /**< Maximum number of DRS templates. */ #define G2C_MAX_DRS_TEMPLATE_MAPLEN 18 /**< Maximum DRS template map length. */ diff --git a/src/pdstemplates.c b/src/pdstemplates.c index 567df6a2..6f8ce970 100644 --- a/src/pdstemplates.c +++ b/src/pdstemplates.c @@ -241,6 +241,12 @@ static const struct pdstemplate templatespds[G2C_MAX_PDS_TEMPLATE] = 4.59: Individual Ensemble Forecast, Control and Perturbed, at a horizontal level or in a horizontal layer at a point in time interval for Spatio-Temporal changing tile parameters */ {59, 24, 0, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}}, + /** PDT 4.62 (12/04/2024) + 4.62: Average, Accumulation and/or Extreme values or other + Statistically-processed values at a horizontal level or in a horizontal + layer in a continuous or non-continuous time interval for spatio-temporal + changing tiles at a horizontal level or horizontal layer at a point in time */ + {62, 35, 1, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, -2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, -4, 1, 4}}, }; /** @@ -777,6 +783,23 @@ extpdstemplate(g2int number, g2int *list) new->ext[l + 17] = 1; } } + /* PDT 4.62 (12/04/2024) */ + else if (number == 62) + { + if (list[27] > 1) + { + new->extlen = (list[27] - 1) * 6; + new->ext = malloc(sizeof(g2int) * new->extlen); + for (j = 2; j <= list[27]; j++) + { + l = (j - 2) * 6; + for (k = 0; k < 6; k++) + { + new->ext[l + k] = new->map[29 + k]; + } + } + } + } return new; } diff --git a/tests/tst_pdstemplates.c b/tests/tst_pdstemplates.c index 36c0e8de..27f2885f 100644 --- a/tests/tst_pdstemplates.c +++ b/tests/tst_pdstemplates.c @@ -363,23 +363,34 @@ main() return G2C_ERROR; free(tmpl->ext); free(tmpl); + + /* Check for one that's there but does need an extension. */ + tmpl = extpdstemplate(62, list); + if (!tmpl) + return G2C_ERROR; + if (tmpl->num != 62 || tmpl->maplen != 35 || !tmpl->needext) + return G2C_ERROR; + if (!tmpl->ext) + return G2C_ERROR; + free(tmpl->ext); + free(tmpl); } printf("ok!\n"); printf("Testing all getpdstemplate() calls with extensions...\n"); { -#define NUM_TEST 51 +#define NUM_TEST 52 int number[NUM_TEST] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 20, 30, 31, 40, 41, 42, 43, 254, 1000, 1001, 1002, 1100, 1101, 32, 44, 45, 46, 47, 48, 50, 52, - 51, 91, 33, 34, 53, 54, 57, 60, 61, 35, 49, 55, 58, 59}; + 51, 91, 33, 34, 53, 54, 57, 60, 61, 35, 49, 55, 58, 59, 62}; int expected_maplen[NUM_TEST] = { 15, 18, 17, 31, 30, 22, 16, 15, 29, 36, 30, 32, 31, 45, 44, 18, 19, 5, 5, 16, 19, 30, 33, 3, 9, 16, 15, 15, 22, 10, 21, 24, 35, 38, 26, 21, 15, 16, - 36, 18, 32, 19, 22, 7, 24, 38, 6, 29, 21, 7, 24}; + 36, 18, 32, 19, 22, 7, 24, 38, 6, 29, 21, 7, 24, 35}; int expected_needext[NUM_TEST] = { 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, - 0}; + 0, 1}; int expected_map[NUM_TEST][48] = { {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 0 */ {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 1 */ @@ -432,6 +443,7 @@ main() {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 55 */ {1, 1, 2, 2, 2, 2, 1}, /* 58 */ {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 59 */ + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, -2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, -4, 1, 4}, /* 62 */ }; int t; int ext_t = 0; @@ -475,7 +487,7 @@ main() #define NUM_EXT_TEST 26 int template[G2C_MAX_PDS_TEMPLATE_MAPLEN]; - int expected_extlen[NUM_EXT_TEST] = {2, 2, 6, 6, 6, 6, 6, 8, 8, 10, 10, 6, 6, 10, 6, 6, 12, 8, 2, 8, 2, 2, 30, 6, 10, 36}; + int expected_extlen[NUM_EXT_TEST] = {2, 2, 6, 6, 6, 6, 6, 8, 8, 10, 10, 6, 6, 10, 6, 6, 12, 8, 2, 8, 2, 2, 30, 6, 10, 36, 6}; int expected_ext[NUM_EXT_TEST][48] = { {1, 1}, /* 3 */ {1, 1}, /* 4 */ @@ -503,6 +515,7 @@ main() {1, 1, 1, 4, 1, 4}, /* 61 */ {2, 2, 2, 1, 4, 2, 2, 2, 1, 4}, /* 35 */ {-1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 58 */ + {1, 1, 1, 4, 1, 4}, /* 62 */ }; if (needext) @@ -597,6 +610,9 @@ main() case 58: template[6] = 2; break; + case 62: + template[27] = 2; + break; default: return G2C_ERROR; } From 755f810358bacc00430f2a6da5acd0d6243726d9 Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Wed, 4 Dec 2024 15:06:24 -0800 Subject: [PATCH 09/80] Update tst_pdstemplates.c --- tests/tst_pdstemplates.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/tst_pdstemplates.c b/tests/tst_pdstemplates.c index 27f2885f..53c37ecf 100644 --- a/tests/tst_pdstemplates.c +++ b/tests/tst_pdstemplates.c @@ -485,7 +485,7 @@ main() if (map[m] != expected_map[t][m]) return G2C_ERROR; -#define NUM_EXT_TEST 26 +#define NUM_EXT_TEST 27 int template[G2C_MAX_PDS_TEMPLATE_MAPLEN]; int expected_extlen[NUM_EXT_TEST] = {2, 2, 6, 6, 6, 6, 6, 8, 8, 10, 10, 6, 6, 10, 6, 6, 12, 8, 2, 8, 2, 2, 30, 6, 10, 36, 6}; int expected_ext[NUM_EXT_TEST][48] = { From 87efee45c577bf73a035f4de22612acff090bb76 Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Wed, 4 Dec 2024 15:20:05 -0800 Subject: [PATCH 10/80] fix template 62 map --- src/pdstemplates.c | 2 +- tests/tst_pdstemplates.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pdstemplates.c b/src/pdstemplates.c index 6f8ce970..127dae17 100644 --- a/src/pdstemplates.c +++ b/src/pdstemplates.c @@ -246,7 +246,7 @@ static const struct pdstemplate templatespds[G2C_MAX_PDS_TEMPLATE] = Statistically-processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for spatio-temporal changing tiles at a horizontal level or horizontal layer at a point in time */ - {62, 35, 1, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, -2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, -4, 1, 4}}, + {62, 35, 1, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}}, }; /** diff --git a/tests/tst_pdstemplates.c b/tests/tst_pdstemplates.c index 53c37ecf..8540fef0 100644 --- a/tests/tst_pdstemplates.c +++ b/tests/tst_pdstemplates.c @@ -443,7 +443,7 @@ main() {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 55 */ {1, 1, 2, 2, 2, 2, 1}, /* 58 */ {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 59 */ - {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, -2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, -4, 1, 4}, /* 62 */ + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 62 */ }; int t; int ext_t = 0; From 895a7195e422df12d557484de3c1b1655bf7665b Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Wed, 4 Dec 2024 15:31:16 -0800 Subject: [PATCH 11/80] pds 4.63 --- src/grib2.h.in | 2 +- src/pdstemplates.c | 22 ++++++++++++++++++++++ tests/tst_pdstemplates.c | 21 +++++++++++++++++---- 3 files changed, 40 insertions(+), 5 deletions(-) diff --git a/src/grib2.h.in b/src/grib2.h.in index d70cc8f2..2240f5b7 100644 --- a/src/grib2.h.in +++ b/src/grib2.h.in @@ -291,7 +291,7 @@ g2int g2_gribend(unsigned char *cgrib); /* Constants to help with templates. */ #define G2C_MAX_GDS_TEMPLATE 31 /**< Maximum number of grid templates. */ #define G2C_MAX_GDS_TEMPLATE_MAPLEN 28 /**< Maximum grid template map length. */ -#define G2C_MAX_PDS_TEMPLATE 52 /**< Maximum number of PDS templates. */ +#define G2C_MAX_PDS_TEMPLATE 53 /**< Maximum number of PDS templates. */ #define G2C_MAX_PDS_TEMPLATE_MAPLEN 45 /**< Maximum template map length. */ #define G2C_MAX_DRS_TEMPLATE 10 /**< Maximum number of DRS templates. */ #define G2C_MAX_DRS_TEMPLATE_MAPLEN 18 /**< Maximum DRS template map length. */ diff --git a/src/pdstemplates.c b/src/pdstemplates.c index 127dae17..2c947a3e 100644 --- a/src/pdstemplates.c +++ b/src/pdstemplates.c @@ -247,6 +247,11 @@ static const struct pdstemplate templatespds[G2C_MAX_PDS_TEMPLATE] = layer in a continuous or non-continuous time interval for spatio-temporal changing tiles at a horizontal level or horizontal layer at a point in time */ {62, 35, 1, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}}, + /** PDT 4.63 (12/04/2024) + 4.63: Individual ensemble forecast, control and perturbed, + at a horizontal level or in a horizontal layer in a continuous or + non-continuous time interval for spatio-temporal changing tiles */ + {63, 38, 1, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}}, }; /** @@ -800,6 +805,23 @@ extpdstemplate(g2int number, g2int *list) } } } + /* PDT 4.63 (12/04/2024) */ + else if (number == 63) + { + if (list[30] > 1) + { + new->extlen = (list[30] - 1) * 6; + new->ext = malloc(sizeof(g2int) * new->extlen); + for (j = 2; j <= list[30]; j++) + { + l = (j - 2) * 6; + for (k = 0; k < 6; k++) + { + new->ext[l + k] = new->map[32 + k]; + } + } + } + } return new; } diff --git a/tests/tst_pdstemplates.c b/tests/tst_pdstemplates.c index 8540fef0..33a22e19 100644 --- a/tests/tst_pdstemplates.c +++ b/tests/tst_pdstemplates.c @@ -374,11 +374,22 @@ main() return G2C_ERROR; free(tmpl->ext); free(tmpl); + + /* Check for one that's there but does need an extension. */ + tmpl = extpdstemplate(63, list); + if (!tmpl) + return G2C_ERROR; + if (tmpl->num != 63 || tmpl->maplen != 38 || !tmpl->needext) + return G2C_ERROR; + if (!tmpl->ext) + return G2C_ERROR; + free(tmpl->ext); + free(tmpl); } printf("ok!\n"); printf("Testing all getpdstemplate() calls with extensions...\n"); { -#define NUM_TEST 52 +#define NUM_TEST 53 int number[NUM_TEST] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 20, 30, 31, 40, 41, 42, 43, 254, 1000, 1001, 1002, 1100, 1101, 32, 44, 45, 46, 47, 48, 50, 52, @@ -443,7 +454,8 @@ main() {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 55 */ {1, 1, 2, 2, 2, 2, 1}, /* 58 */ {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 59 */ - {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 62 */ + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 62 */ + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 63 */ }; int t; int ext_t = 0; @@ -485,9 +497,9 @@ main() if (map[m] != expected_map[t][m]) return G2C_ERROR; -#define NUM_EXT_TEST 27 +#define NUM_EXT_TEST 28 int template[G2C_MAX_PDS_TEMPLATE_MAPLEN]; - int expected_extlen[NUM_EXT_TEST] = {2, 2, 6, 6, 6, 6, 6, 8, 8, 10, 10, 6, 6, 10, 6, 6, 12, 8, 2, 8, 2, 2, 30, 6, 10, 36, 6}; + int expected_extlen[NUM_EXT_TEST] = {2, 2, 6, 6, 6, 6, 6, 8, 8, 10, 10, 6, 6, 10, 6, 6, 12, 8, 2, 8, 2, 2, 30, 6, 10, 36, 6, 6}; int expected_ext[NUM_EXT_TEST][48] = { {1, 1}, /* 3 */ {1, 1}, /* 4 */ @@ -516,6 +528,7 @@ main() {2, 2, 2, 1, 4, 2, 2, 2, 1, 4}, /* 35 */ {-1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 58 */ {1, 1, 1, 4, 1, 4}, /* 62 */ + {1, 1, 1, 4, 1, 4}, /* 63 */ }; if (needext) From 0427c27d94e0a343e85aa32695b0336e949fe708 Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Wed, 4 Dec 2024 15:36:28 -0800 Subject: [PATCH 12/80] Update tst_pdstemplates.c --- tests/tst_pdstemplates.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/tst_pdstemplates.c b/tests/tst_pdstemplates.c index 33a22e19..f0afe84b 100644 --- a/tests/tst_pdstemplates.c +++ b/tests/tst_pdstemplates.c @@ -393,15 +393,15 @@ main() int number[NUM_TEST] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 20, 30, 31, 40, 41, 42, 43, 254, 1000, 1001, 1002, 1100, 1101, 32, 44, 45, 46, 47, 48, 50, 52, - 51, 91, 33, 34, 53, 54, 57, 60, 61, 35, 49, 55, 58, 59, 62}; + 51, 91, 33, 34, 53, 54, 57, 60, 61, 35, 49, 55, 58, 59, 62, 63}; int expected_maplen[NUM_TEST] = { 15, 18, 17, 31, 30, 22, 16, 15, 29, 36, 30, 32, 31, 45, 44, 18, 19, 5, 5, 16, 19, 30, 33, 3, 9, 16, 15, 15, 22, 10, 21, 24, 35, 38, 26, 21, 15, 16, - 36, 18, 32, 19, 22, 7, 24, 38, 6, 29, 21, 7, 24, 35}; + 36, 18, 32, 19, 22, 7, 24, 38, 6, 29, 21, 7, 24, 35, 38}; int expected_needext[NUM_TEST] = { 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, - 0, 1}; + 0, 1, 1}; int expected_map[NUM_TEST][48] = { {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 0 */ {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 1 */ From ee8192e7693757ad7b3ea3eee1a74657d697c2f8 Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Wed, 4 Dec 2024 15:43:07 -0800 Subject: [PATCH 13/80] debug test --- tests/tst_pdstemplates.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/tst_pdstemplates.c b/tests/tst_pdstemplates.c index f0afe84b..15ca9710 100644 --- a/tests/tst_pdstemplates.c +++ b/tests/tst_pdstemplates.c @@ -626,6 +626,9 @@ main() case 62: template[27] = 2; break; + case 63: + template[30] = 2; + break; default: return G2C_ERROR; } From 6cbed76a1dcd8b5f124f45d852a41f141ad9bc95 Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Wed, 4 Dec 2024 16:35:16 -0800 Subject: [PATCH 14/80] pds 4.67 and fix extension for 4.58 --- src/grib2.h.in | 2 +- src/pdstemplates.c | 83 ++++++++++++++++++++++++++++++--------- tests/tst_pdstemplates.c | 85 ++++++++++++++++++++++++---------------- 3 files changed, 117 insertions(+), 53 deletions(-) diff --git a/src/grib2.h.in b/src/grib2.h.in index 2240f5b7..4d4a7f4d 100644 --- a/src/grib2.h.in +++ b/src/grib2.h.in @@ -291,7 +291,7 @@ g2int g2_gribend(unsigned char *cgrib); /* Constants to help with templates. */ #define G2C_MAX_GDS_TEMPLATE 31 /**< Maximum number of grid templates. */ #define G2C_MAX_GDS_TEMPLATE_MAPLEN 28 /**< Maximum grid template map length. */ -#define G2C_MAX_PDS_TEMPLATE 53 /**< Maximum number of PDS templates. */ +#define G2C_MAX_PDS_TEMPLATE 54 /**< Maximum number of PDS templates. */ #define G2C_MAX_PDS_TEMPLATE_MAPLEN 45 /**< Maximum template map length. */ #define G2C_MAX_DRS_TEMPLATE 10 /**< Maximum number of DRS templates. */ #define G2C_MAX_DRS_TEMPLATE_MAPLEN 18 /**< Maximum DRS template map length. */ diff --git a/src/pdstemplates.c b/src/pdstemplates.c index 2c947a3e..671f63b9 100644 --- a/src/pdstemplates.c +++ b/src/pdstemplates.c @@ -252,6 +252,12 @@ static const struct pdstemplate templatespds[G2C_MAX_PDS_TEMPLATE] = at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for spatio-temporal changing tiles */ {63, 38, 1, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}}, + /** PDT 4.67 (12/04/2024) + 4.67: Average, Accumulation, and/or Extreme values or Other + statistically-processed values at a horizontal level or in a + horizontal layer in a continuous or non-continuous time interval for + Atmospheric Chemical Constituents based on a distribution function */ + {67, 7, 1, {1, 1, 2, 2, 2, 2, 1}}, }; /** @@ -763,30 +769,31 @@ extpdstemplate(g2int number, g2int *list) /* PDT 4.58 (12/04/2024) */ else if (number == 58) { - new->extlen = list[6] * 18; + k = list[6] * 2; + new->extlen = k + 16; new->ext = malloc(sizeof(g2int) * new->extlen); for (i = 0; i < list[6]; i++) { - l = i * 18; + l = i * 2; new->ext[l] = -1; new->ext[l + 1] = -4; - new->ext[l + 2] = 1; - new->ext[l + 3] = 1; - new->ext[l + 4] = 1; - new->ext[l + 5] = 2; - new->ext[l + 6] = 1; - new->ext[l + 7] = 1; - new->ext[l + 8] = -4; - new->ext[l + 9] = 1; - new->ext[l + 10] = -1; - new->ext[l + 11] = -4; - new->ext[l + 12] = 1; - new->ext[l + 13] = -1; - new->ext[l + 14] = -4; - new->ext[l + 15] = 1; - new->ext[l + 16] = 1; - new->ext[l + 17] = 1; } + new->ext[k] = 1; + new->ext[k + 1] = 1; + new->ext[k + 2] = 1; + new->ext[k + 3] = 2; + new->ext[k + 4] = 1; + new->ext[k + 5] = 1; + new->ext[k + 6] = -4; + new->ext[k + 7] = 1; + new->ext[k + 8] = -1; + new->ext[k + 9] = -4; + new->ext[k + 10] = 1; + new->ext[k + 11] = -1; + new->ext[k + 12] = -4; + new->ext[k + 13] = 1; + new->ext[k + 14] = 1; + new->ext[k + 15] = 1; } /* PDT 4.62 (12/04/2024) */ else if (number == 62) @@ -822,6 +829,46 @@ extpdstemplate(g2int number, g2int *list) } } } + /* PDT 4.67 (12/04/2024) */ + else if (number == 67) + { + k = list[6] * 2; + new->extlen = k + 27; + new->ext = malloc(sizeof(g2int) * new->extlen); + for (i = 0; i < list[6]; i++) + { + l = i * 2; + new->ext[l] = -1; + new->ext[l + 1] = -4; + } + new->ext[k] = 1; + new->ext[k + 1] = 1; + new->ext[k + 2] = 1; + new->ext[k + 3] = 2; + new->ext[k + 4] = 1; + new->ext[k + 5] = 1; + new->ext[k + 6] = -4; + new->ext[k + 7] = 1; + new->ext[k + 8] = -1; + new->ext[k + 9] = -4; + new->ext[k + 10] = 1; + new->ext[k + 11] = -1; + new->ext[k + 12] = -4; + new->ext[k + 13] = 2; + new->ext[k + 14] = 1; + new->ext[k + 15] = 1; + new->ext[k + 16] = 1; + new->ext[k + 17] = 1; + new->ext[k + 18] = 1; + new->ext[k + 19] = 1; + new->ext[k + 20] = 4; + new->ext[k + 21] = 1; + new->ext[k + 22] = 1; + new->ext[k + 23] = 1; + new->ext[k + 24] = 4; + new->ext[k + 25] = 1; + new->ext[k + 26] = 4; + } return new; } diff --git a/tests/tst_pdstemplates.c b/tests/tst_pdstemplates.c index 15ca9710..24d11ee2 100644 --- a/tests/tst_pdstemplates.c +++ b/tests/tst_pdstemplates.c @@ -385,23 +385,34 @@ main() return G2C_ERROR; free(tmpl->ext); free(tmpl); + + /* Check for one that's there but does need an extension. */ + tmpl = extpdstemplate(67, list); + if (!tmpl) + return G2C_ERROR; + if (tmpl->num != 67 || tmpl->maplen != 7 || !tmpl->needext) + return G2C_ERROR; + if (!tmpl->ext) + return G2C_ERROR; + free(tmpl->ext); + free(tmpl); } printf("ok!\n"); printf("Testing all getpdstemplate() calls with extensions...\n"); { -#define NUM_TEST 53 +#define NUM_TEST 54 int number[NUM_TEST] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 20, 30, 31, 40, 41, 42, 43, 254, 1000, 1001, 1002, 1100, 1101, 32, 44, 45, 46, 47, 48, 50, 52, - 51, 91, 33, 34, 53, 54, 57, 60, 61, 35, 49, 55, 58, 59, 62, 63}; + 51, 91, 33, 34, 53, 54, 57, 60, 61, 35, 49, 55, 58, 59, 62, 63, 67}; int expected_maplen[NUM_TEST] = { 15, 18, 17, 31, 30, 22, 16, 15, 29, 36, 30, 32, 31, 45, 44, 18, 19, 5, 5, 16, 19, 30, 33, 3, 9, 16, 15, 15, 22, 10, 21, 24, 35, 38, 26, 21, 15, 16, - 36, 18, 32, 19, 22, 7, 24, 38, 6, 29, 21, 7, 24, 35, 38}; + 36, 18, 32, 19, 22, 7, 24, 38, 6, 29, 21, 7, 24, 35, 38, 7}; int expected_needext[NUM_TEST] = { 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, - 0, 1, 1}; + 0, 1, 1, 1}; int expected_map[NUM_TEST][48] = { {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 0 */ {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 1 */ @@ -456,6 +467,7 @@ main() {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 59 */ {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 62 */ {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 63 */ + {1, 1, 2, 2, 2, 2, 1}, /* 67 */ }; int t; int ext_t = 0; @@ -497,38 +509,40 @@ main() if (map[m] != expected_map[t][m]) return G2C_ERROR; -#define NUM_EXT_TEST 28 +#define NUM_EXT_TEST 29 int template[G2C_MAX_PDS_TEMPLATE_MAPLEN]; - int expected_extlen[NUM_EXT_TEST] = {2, 2, 6, 6, 6, 6, 6, 8, 8, 10, 10, 6, 6, 10, 6, 6, 12, 8, 2, 8, 2, 2, 30, 6, 10, 36, 6, 6}; + int expected_extlen[NUM_EXT_TEST] = {2, 2, 6, 6, 6, 6, 6, 8, 8, 10, 10, 6, 6, 10, 6, 6, 12, 8, 2, 8, 2, 2, 30, 6, + 10, 20, 6, 6, 31}; int expected_ext[NUM_EXT_TEST][48] = { - {1, 1}, /* 3 */ - {1, 1}, /* 4 */ - {1, 1, 1, 4, 1, 4}, /* 8 */ - {1, 1, 1, 4, 1, 4}, /* 9 */ - {1, 1, 1, 4, 1, 4}, /* 10 */ - {1, 1, 1, 4, 1, 4}, /* 11 */ - {1, 1, 1, 4, 1, 4}, /* 12 */ - {1, 1, 1, 4, 1, 4, 1, 1}, /* 13 */ - {1, 1, 1, 4, 1, 4, 1, 1}, /* 14 */ - {2, 2, 1, 1, 4, 2, 2, 1, 1, 4}, /* 30 */ - {2, 2, 2, 1, 4, 2, 2, 2, 1, 4}, /* 31 */ - {1, 1, 1, 4, 1, 4}, /* 42 */ - {1, 1, 1, 4, 1, 4}, /* 43 */ - {2, 2, 2, -1, -4, 2, 2, 2, -1, -4}, /* 32 */ - {1, 1, 1, 4, 1, 4}, /* 46 */ - {1, 1, 1, 4, 1, 4}, /* 47 */ - {1, 1, -1, -4, -1, -4, 1, 1, -1, -4, -1, -4}, /* 51 */ - {1, 1, 1, 4, 1, 4, 1, 1}, /* 91 */ - {1, 1}, /* 33 */ - {1, 1, 1, 4, 1, 4, 1, 1}, /* 34 */ - {1, 1}, /* 53 */ - {1, 1}, /* 54 */ - {1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 57 */ - {1, 1, 1, 4, 1, 4}, /* 61 */ - {2, 2, 2, 1, 4, 2, 2, 2, 1, 4}, /* 35 */ - {-1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 58 */ - {1, 1, 1, 4, 1, 4}, /* 62 */ - {1, 1, 1, 4, 1, 4}, /* 63 */ + {1, 1}, /* 3 */ + {1, 1}, /* 4 */ + {1, 1, 1, 4, 1, 4}, /* 8 */ + {1, 1, 1, 4, 1, 4}, /* 9 */ + {1, 1, 1, 4, 1, 4}, /* 10 */ + {1, 1, 1, 4, 1, 4}, /* 11 */ + {1, 1, 1, 4, 1, 4}, /* 12 */ + {1, 1, 1, 4, 1, 4, 1, 1}, /* 13 */ + {1, 1, 1, 4, 1, 4, 1, 1}, /* 14 */ + {2, 2, 1, 1, 4, 2, 2, 1, 1, 4}, /* 30 */ + {2, 2, 2, 1, 4, 2, 2, 2, 1, 4}, /* 31 */ + {1, 1, 1, 4, 1, 4}, /* 42 */ + {1, 1, 1, 4, 1, 4}, /* 43 */ + {2, 2, 2, -1, -4, 2, 2, 2, -1, -4}, /* 32 */ + {1, 1, 1, 4, 1, 4}, /* 46 */ + {1, 1, 1, 4, 1, 4}, /* 47 */ + {1, 1, -1, -4, -1, -4, 1, 1, -1, -4, -1, -4}, /* 51 */ + {1, 1, 1, 4, 1, 4, 1, 1}, /* 91 */ + {1, 1}, /* 33 */ + {1, 1, 1, 4, 1, 4, 1, 1}, /* 34 */ + {1, 1}, /* 53 */ + {1, 1}, /* 54 */ + {1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 57 */ + {1, 1, 1, 4, 1, 4}, /* 61 */ + {2, 2, 2, 1, 4, 2, 2, 2, 1, 4}, /* 35 */ + {-1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 58 */ + {1, 1, 1, 4, 1, 4}, /* 62 */ + {1, 1, 1, 4, 1, 4}, /* 63 */ + {-1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 67 */ }; if (needext) @@ -629,6 +643,9 @@ main() case 63: template[30] = 2; break; + case 67: + template[6] = 2; + break; default: return G2C_ERROR; } From a72b21957845e05344334b440b5bc626bbfaaf7f Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Wed, 4 Dec 2024 16:39:09 -0800 Subject: [PATCH 15/80] format --- tests/tst_pdstemplates.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/tst_pdstemplates.c b/tests/tst_pdstemplates.c index 24d11ee2..63822cab 100644 --- a/tests/tst_pdstemplates.c +++ b/tests/tst_pdstemplates.c @@ -511,7 +511,8 @@ main() #define NUM_EXT_TEST 29 int template[G2C_MAX_PDS_TEMPLATE_MAPLEN]; - int expected_extlen[NUM_EXT_TEST] = {2, 2, 6, 6, 6, 6, 6, 8, 8, 10, 10, 6, 6, 10, 6, 6, 12, 8, 2, 8, 2, 2, 30, 6, + int expected_extlen[NUM_EXT_TEST] = { + 2, 2, 6, 6, 6, 6, 6, 8, 8, 10, 10, 6, 6, 10, 6, 6, 12, 8, 2, 8, 2, 2, 30, 6, 10, 20, 6, 6, 31}; int expected_ext[NUM_EXT_TEST][48] = { {1, 1}, /* 3 */ From c9dbc86976b9386a0737b4e1ee8df97b4eabc193 Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Thu, 5 Dec 2024 08:54:31 -0800 Subject: [PATCH 16/80] pds 4.68 --- src/grib2.h.in | 2 +- src/pdstemplates.c | 48 ++++++++++++++++++++++ tests/tst_pdstemplates.c | 86 ++++++++++++++++++++++++---------------- 3 files changed, 100 insertions(+), 36 deletions(-) diff --git a/src/grib2.h.in b/src/grib2.h.in index 4d4a7f4d..b29e3b41 100644 --- a/src/grib2.h.in +++ b/src/grib2.h.in @@ -291,7 +291,7 @@ g2int g2_gribend(unsigned char *cgrib); /* Constants to help with templates. */ #define G2C_MAX_GDS_TEMPLATE 31 /**< Maximum number of grid templates. */ #define G2C_MAX_GDS_TEMPLATE_MAPLEN 28 /**< Maximum grid template map length. */ -#define G2C_MAX_PDS_TEMPLATE 54 /**< Maximum number of PDS templates. */ +#define G2C_MAX_PDS_TEMPLATE 55 /**< Maximum number of PDS templates. */ #define G2C_MAX_PDS_TEMPLATE_MAPLEN 45 /**< Maximum template map length. */ #define G2C_MAX_DRS_TEMPLATE 10 /**< Maximum number of DRS templates. */ #define G2C_MAX_DRS_TEMPLATE_MAPLEN 18 /**< Maximum DRS template map length. */ diff --git a/src/pdstemplates.c b/src/pdstemplates.c index 671f63b9..0c186bc8 100644 --- a/src/pdstemplates.c +++ b/src/pdstemplates.c @@ -258,6 +258,11 @@ static const struct pdstemplate templatespds[G2C_MAX_PDS_TEMPLATE] = horizontal layer in a continuous or non-continuous time interval for Atmospheric Chemical Constituents based on a distribution function */ {67, 7, 1, {1, 1, 2, 2, 2, 2, 1}}, + /** PDT 4.68 (12/04/2024) + 4.68: Individual ensemble forecast, control and perturbed, at a horizontal level + or in a horizontal layer in a continuous or non-continuous time interval + for Atmospheric Chemical Constituents based on a distribution function */ + {68, 7, 1, {1, 1, 2, 2, 2, 2, 1}}, }; /** @@ -869,6 +874,49 @@ extpdstemplate(g2int number, g2int *list) new->ext[k + 25] = 1; new->ext[k + 26] = 4; } + /* PDT 4.68 (12/04/2024) */ + else if (number == 67) + { + k = list[6] * 2; + new->extlen = k + 30; + new->ext = malloc(sizeof(g2int) * new->extlen); + for (i = 0; i < list[6]; i++) + { + l = i * 2; + new->ext[l] = -1; + new->ext[l + 1] = -4; + } + new->ext[k] = 1; + new->ext[k + 1] = 1; + new->ext[k + 2] = 1; + new->ext[k + 3] = 2; + new->ext[k + 4] = 1; + new->ext[k + 5] = 1; + new->ext[k + 6] = -4; + new->ext[k + 7] = 1; + new->ext[k + 8] = -1; + new->ext[k + 9] = -4; + new->ext[k + 10] = 1; + new->ext[k + 11] = -1; + new->ext[k + 12] = -4; + new->ext[k + 13] = 1; + new->ext[k + 14] = 1; + new->ext[k + 15] = 1; + new->ext[k + 16] = 2; + new->ext[k + 17] = 1; + new->ext[k + 18] = 1; + new->ext[k + 19] = 1; + new->ext[k + 20] = 1; + new->ext[k + 21] = 1; + new->ext[k + 22] = 1; + new->ext[k + 23] = 2; + new->ext[k + 24] = 1; + new->ext[k + 25] = 1; + new->ext[k + 26] = 1; + new->ext[k + 27] = 4; + new->ext[k + 28] = 1; + new->ext[k + 29] = 4; + } return new; } diff --git a/tests/tst_pdstemplates.c b/tests/tst_pdstemplates.c index 63822cab..c87209f7 100644 --- a/tests/tst_pdstemplates.c +++ b/tests/tst_pdstemplates.c @@ -396,23 +396,34 @@ main() return G2C_ERROR; free(tmpl->ext); free(tmpl); + + /* Check for one that's there but does need an extension. */ + tmpl = extpdstemplate(68, list); + if (!tmpl) + return G2C_ERROR; + if (tmpl->num != 68 || tmpl->maplen != 7 || !tmpl->needext) + return G2C_ERROR; + if (!tmpl->ext) + return G2C_ERROR; + free(tmpl->ext); + free(tmpl); } printf("ok!\n"); printf("Testing all getpdstemplate() calls with extensions...\n"); { -#define NUM_TEST 54 +#define NUM_TEST 55 int number[NUM_TEST] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 20, 30, 31, 40, 41, 42, 43, 254, 1000, 1001, 1002, 1100, 1101, 32, 44, 45, 46, 47, 48, 50, 52, - 51, 91, 33, 34, 53, 54, 57, 60, 61, 35, 49, 55, 58, 59, 62, 63, 67}; + 51, 91, 33, 34, 53, 54, 57, 60, 61, 35, 49, 55, 58, 59, 62, 63, 67, 68}; int expected_maplen[NUM_TEST] = { 15, 18, 17, 31, 30, 22, 16, 15, 29, 36, 30, 32, 31, 45, 44, 18, 19, 5, 5, 16, 19, 30, 33, 3, 9, 16, 15, 15, 22, 10, 21, 24, 35, 38, 26, 21, 15, 16, - 36, 18, 32, 19, 22, 7, 24, 38, 6, 29, 21, 7, 24, 35, 38, 7}; + 36, 18, 32, 19, 22, 7, 24, 38, 6, 29, 21, 7, 24, 35, 38, 7, 7}; int expected_needext[NUM_TEST] = { 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, - 0, 1, 1, 1}; + 0, 1, 1, 1, 1}; int expected_map[NUM_TEST][48] = { {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 0 */ {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 1 */ @@ -468,6 +479,7 @@ main() {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 62 */ {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 63 */ {1, 1, 2, 2, 2, 2, 1}, /* 67 */ + {1, 1, 2, 2, 2, 2, 1}, /* 68 */ }; int t; int ext_t = 0; @@ -509,41 +521,42 @@ main() if (map[m] != expected_map[t][m]) return G2C_ERROR; -#define NUM_EXT_TEST 29 +#define NUM_EXT_TEST 30 int template[G2C_MAX_PDS_TEMPLATE_MAPLEN]; int expected_extlen[NUM_EXT_TEST] = { 2, 2, 6, 6, 6, 6, 6, 8, 8, 10, 10, 6, 6, 10, 6, 6, 12, 8, 2, 8, 2, 2, 30, 6, - 10, 20, 6, 6, 31}; + 10, 20, 6, 6, 31, 34}; int expected_ext[NUM_EXT_TEST][48] = { - {1, 1}, /* 3 */ - {1, 1}, /* 4 */ - {1, 1, 1, 4, 1, 4}, /* 8 */ - {1, 1, 1, 4, 1, 4}, /* 9 */ - {1, 1, 1, 4, 1, 4}, /* 10 */ - {1, 1, 1, 4, 1, 4}, /* 11 */ - {1, 1, 1, 4, 1, 4}, /* 12 */ - {1, 1, 1, 4, 1, 4, 1, 1}, /* 13 */ - {1, 1, 1, 4, 1, 4, 1, 1}, /* 14 */ - {2, 2, 1, 1, 4, 2, 2, 1, 1, 4}, /* 30 */ - {2, 2, 2, 1, 4, 2, 2, 2, 1, 4}, /* 31 */ - {1, 1, 1, 4, 1, 4}, /* 42 */ - {1, 1, 1, 4, 1, 4}, /* 43 */ - {2, 2, 2, -1, -4, 2, 2, 2, -1, -4}, /* 32 */ - {1, 1, 1, 4, 1, 4}, /* 46 */ - {1, 1, 1, 4, 1, 4}, /* 47 */ - {1, 1, -1, -4, -1, -4, 1, 1, -1, -4, -1, -4}, /* 51 */ - {1, 1, 1, 4, 1, 4, 1, 1}, /* 91 */ - {1, 1}, /* 33 */ - {1, 1, 1, 4, 1, 4, 1, 1}, /* 34 */ - {1, 1}, /* 53 */ - {1, 1}, /* 54 */ - {1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 57 */ - {1, 1, 1, 4, 1, 4}, /* 61 */ - {2, 2, 2, 1, 4, 2, 2, 2, 1, 4}, /* 35 */ - {-1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 58 */ - {1, 1, 1, 4, 1, 4}, /* 62 */ - {1, 1, 1, 4, 1, 4}, /* 63 */ - {-1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 67 */ + {1, 1}, /* 3 */ + {1, 1}, /* 4 */ + {1, 1, 1, 4, 1, 4}, /* 8 */ + {1, 1, 1, 4, 1, 4}, /* 9 */ + {1, 1, 1, 4, 1, 4}, /* 10 */ + {1, 1, 1, 4, 1, 4}, /* 11 */ + {1, 1, 1, 4, 1, 4}, /* 12 */ + {1, 1, 1, 4, 1, 4, 1, 1}, /* 13 */ + {1, 1, 1, 4, 1, 4, 1, 1}, /* 14 */ + {2, 2, 1, 1, 4, 2, 2, 1, 1, 4}, /* 30 */ + {2, 2, 2, 1, 4, 2, 2, 2, 1, 4}, /* 31 */ + {1, 1, 1, 4, 1, 4}, /* 42 */ + {1, 1, 1, 4, 1, 4}, /* 43 */ + {2, 2, 2, -1, -4, 2, 2, 2, -1, -4}, /* 32 */ + {1, 1, 1, 4, 1, 4}, /* 46 */ + {1, 1, 1, 4, 1, 4}, /* 47 */ + {1, 1, -1, -4, -1, -4, 1, 1, -1, -4, -1, -4}, /* 51 */ + {1, 1, 1, 4, 1, 4, 1, 1}, /* 91 */ + {1, 1}, /* 33 */ + {1, 1, 1, 4, 1, 4, 1, 1}, /* 34 */ + {1, 1}, /* 53 */ + {1, 1}, /* 54 */ + {1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 57 */ + {1, 1, 1, 4, 1, 4}, /* 61 */ + {2, 2, 2, 1, 4, 2, 2, 2, 1, 4}, /* 35 */ + {-1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 58 */ + {1, 1, 1, 4, 1, 4}, /* 62 */ + {1, 1, 1, 4, 1, 4}, /* 63 */ + {-1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 67 */ + {-1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 4, 1, 4}, /* 68 */ }; if (needext) @@ -647,6 +660,9 @@ main() case 67: template[6] = 2; break; + case 68: + template[6] = 2; + break; default: return G2C_ERROR; } From c9400d08c7c4b7f822b38bf3db987cc8fa7b7a82 Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Thu, 5 Dec 2024 09:02:53 -0800 Subject: [PATCH 17/80] typo --- src/pdstemplates.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pdstemplates.c b/src/pdstemplates.c index 0c186bc8..8999b93f 100644 --- a/src/pdstemplates.c +++ b/src/pdstemplates.c @@ -875,7 +875,7 @@ extpdstemplate(g2int number, g2int *list) new->ext[k + 26] = 4; } /* PDT 4.68 (12/04/2024) */ - else if (number == 67) + else if (number == 68) { k = list[6] * 2; new->extlen = k + 30; From 3d007d78e96b02be2ea93fa0ea0ca433b24f4735 Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Thu, 5 Dec 2024 09:21:44 -0800 Subject: [PATCH 18/80] pds 4.70 --- src/grib2.h.in | 2 +- src/pdstemplates.c | 4 ++++ tests/tst_pdstemplates.c | 9 +++++---- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/grib2.h.in b/src/grib2.h.in index b29e3b41..814e4701 100644 --- a/src/grib2.h.in +++ b/src/grib2.h.in @@ -291,7 +291,7 @@ g2int g2_gribend(unsigned char *cgrib); /* Constants to help with templates. */ #define G2C_MAX_GDS_TEMPLATE 31 /**< Maximum number of grid templates. */ #define G2C_MAX_GDS_TEMPLATE_MAPLEN 28 /**< Maximum grid template map length. */ -#define G2C_MAX_PDS_TEMPLATE 55 /**< Maximum number of PDS templates. */ +#define G2C_MAX_PDS_TEMPLATE 56 /**< Maximum number of PDS templates. */ #define G2C_MAX_PDS_TEMPLATE_MAPLEN 45 /**< Maximum template map length. */ #define G2C_MAX_DRS_TEMPLATE 10 /**< Maximum number of DRS templates. */ #define G2C_MAX_DRS_TEMPLATE_MAPLEN 18 /**< Maximum DRS template map length. */ diff --git a/src/pdstemplates.c b/src/pdstemplates.c index 8999b93f..fdf65815 100644 --- a/src/pdstemplates.c +++ b/src/pdstemplates.c @@ -263,6 +263,10 @@ static const struct pdstemplate templatespds[G2C_MAX_PDS_TEMPLATE] = or in a horizontal layer in a continuous or non-continuous time interval for Atmospheric Chemical Constituents based on a distribution function */ {68, 7, 1, {1, 1, 2, 2, 2, 2, 1}}, + /** PDT 4.70 (12/04/2024) + 4.70: Post-processing Analysis or Forecast at a + horizontal level or in a horizontal layer at a point in time */ + {70, 19, 0, {1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}}, }; /** diff --git a/tests/tst_pdstemplates.c b/tests/tst_pdstemplates.c index c87209f7..5b99e2b7 100644 --- a/tests/tst_pdstemplates.c +++ b/tests/tst_pdstemplates.c @@ -411,19 +411,19 @@ main() printf("ok!\n"); printf("Testing all getpdstemplate() calls with extensions...\n"); { -#define NUM_TEST 55 +#define NUM_TEST 56 int number[NUM_TEST] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 20, 30, 31, 40, 41, 42, 43, 254, 1000, 1001, 1002, 1100, 1101, 32, 44, 45, 46, 47, 48, 50, 52, - 51, 91, 33, 34, 53, 54, 57, 60, 61, 35, 49, 55, 58, 59, 62, 63, 67, 68}; + 51, 91, 33, 34, 53, 54, 57, 60, 61, 35, 49, 55, 58, 59, 62, 63, 67, 68, 70}; int expected_maplen[NUM_TEST] = { 15, 18, 17, 31, 30, 22, 16, 15, 29, 36, 30, 32, 31, 45, 44, 18, 19, 5, 5, 16, 19, 30, 33, 3, 9, 16, 15, 15, 22, 10, 21, 24, 35, 38, 26, 21, 15, 16, - 36, 18, 32, 19, 22, 7, 24, 38, 6, 29, 21, 7, 24, 35, 38, 7, 7}; + 36, 18, 32, 19, 22, 7, 24, 38, 6, 29, 21, 7, 24, 35, 38, 7, 7, 19}; int expected_needext[NUM_TEST] = { 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, - 0, 1, 1, 1, 1}; + 0, 1, 1, 1, 1, 0}; int expected_map[NUM_TEST][48] = { {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 0 */ {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 1 */ @@ -480,6 +480,7 @@ main() {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 63 */ {1, 1, 2, 2, 2, 2, 1}, /* 67 */ {1, 1, 2, 2, 2, 2, 1}, /* 68 */ + {1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 70 */ }; int t; int ext_t = 0; From 31e074575db9d47d8fd32cb4009a4fce46d21a4c Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Thu, 5 Dec 2024 09:27:09 -0800 Subject: [PATCH 19/80] pds 4.71 --- src/grib2.h.in | 2 +- src/pdstemplates.c | 4 ++++ tests/tst_pdstemplates.c | 10 ++++++---- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/grib2.h.in b/src/grib2.h.in index 814e4701..98838eac 100644 --- a/src/grib2.h.in +++ b/src/grib2.h.in @@ -291,7 +291,7 @@ g2int g2_gribend(unsigned char *cgrib); /* Constants to help with templates. */ #define G2C_MAX_GDS_TEMPLATE 31 /**< Maximum number of grid templates. */ #define G2C_MAX_GDS_TEMPLATE_MAPLEN 28 /**< Maximum grid template map length. */ -#define G2C_MAX_PDS_TEMPLATE 56 /**< Maximum number of PDS templates. */ +#define G2C_MAX_PDS_TEMPLATE 57 /**< Maximum number of PDS templates. */ #define G2C_MAX_PDS_TEMPLATE_MAPLEN 45 /**< Maximum template map length. */ #define G2C_MAX_DRS_TEMPLATE 10 /**< Maximum number of DRS templates. */ #define G2C_MAX_DRS_TEMPLATE_MAPLEN 18 /**< Maximum DRS template map length. */ diff --git a/src/pdstemplates.c b/src/pdstemplates.c index fdf65815..3edb851e 100644 --- a/src/pdstemplates.c +++ b/src/pdstemplates.c @@ -267,6 +267,10 @@ static const struct pdstemplate templatespds[G2C_MAX_PDS_TEMPLATE] = 4.70: Post-processing Analysis or Forecast at a horizontal level or in a horizontal layer at a point in time */ {70, 19, 0, {1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}}, + /** PDT 4.71 (12/04/2024) + 4.71: Post-processing Individual Ensemble Forecast, Control and + Perturbed, at a horizontal level or in a horizontal layer at a point in time */ + {71, 21, 0, {1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}}, }; /** diff --git a/tests/tst_pdstemplates.c b/tests/tst_pdstemplates.c index 5b99e2b7..3b697e06 100644 --- a/tests/tst_pdstemplates.c +++ b/tests/tst_pdstemplates.c @@ -411,19 +411,20 @@ main() printf("ok!\n"); printf("Testing all getpdstemplate() calls with extensions...\n"); { -#define NUM_TEST 56 +#define NUM_TEST 57 int number[NUM_TEST] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 20, 30, 31, 40, 41, 42, 43, 254, 1000, 1001, 1002, 1100, 1101, 32, 44, 45, 46, 47, 48, 50, 52, - 51, 91, 33, 34, 53, 54, 57, 60, 61, 35, 49, 55, 58, 59, 62, 63, 67, 68, 70}; + 51, 91, 33, 34, 53, 54, 57, 60, 61, 35, 49, 55, 58, 59, 62, 63, 67, 68, 70, + 71}; int expected_maplen[NUM_TEST] = { 15, 18, 17, 31, 30, 22, 16, 15, 29, 36, 30, 32, 31, 45, 44, 18, 19, 5, 5, 16, 19, 30, 33, 3, 9, 16, 15, 15, 22, 10, 21, 24, 35, 38, 26, 21, 15, 16, - 36, 18, 32, 19, 22, 7, 24, 38, 6, 29, 21, 7, 24, 35, 38, 7, 7, 19}; + 36, 18, 32, 19, 22, 7, 24, 38, 6, 29, 21, 7, 24, 35, 38, 7, 7, 19, 21}; int expected_needext[NUM_TEST] = { 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, - 0, 1, 1, 1, 1, 0}; + 0, 1, 1, 1, 1, 0, 0}; int expected_map[NUM_TEST][48] = { {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 0 */ {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 1 */ @@ -481,6 +482,7 @@ main() {1, 1, 2, 2, 2, 2, 1}, /* 67 */ {1, 1, 2, 2, 2, 2, 1}, /* 68 */ {1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 70 */ + {1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 71 */ }; int t; int ext_t = 0; From 315348be24104bf9274c57a6b661988c33ee22c4 Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Thu, 5 Dec 2024 09:43:54 -0800 Subject: [PATCH 20/80] pds 4.72 --- src/grib2.h.in | 2 +- src/pdstemplates.c | 22 ++++++++++++++++++++++ tests/tst_pdstemplates.c | 28 ++++++++++++++++++++++------ 3 files changed, 45 insertions(+), 7 deletions(-) diff --git a/src/grib2.h.in b/src/grib2.h.in index 98838eac..be690550 100644 --- a/src/grib2.h.in +++ b/src/grib2.h.in @@ -291,7 +291,7 @@ g2int g2_gribend(unsigned char *cgrib); /* Constants to help with templates. */ #define G2C_MAX_GDS_TEMPLATE 31 /**< Maximum number of grid templates. */ #define G2C_MAX_GDS_TEMPLATE_MAPLEN 28 /**< Maximum grid template map length. */ -#define G2C_MAX_PDS_TEMPLATE 57 /**< Maximum number of PDS templates. */ +#define G2C_MAX_PDS_TEMPLATE 58 /**< Maximum number of PDS templates. */ #define G2C_MAX_PDS_TEMPLATE_MAPLEN 45 /**< Maximum template map length. */ #define G2C_MAX_DRS_TEMPLATE 10 /**< Maximum number of DRS templates. */ #define G2C_MAX_DRS_TEMPLATE_MAPLEN 18 /**< Maximum DRS template map length. */ diff --git a/src/pdstemplates.c b/src/pdstemplates.c index 3edb851e..6c7bf7be 100644 --- a/src/pdstemplates.c +++ b/src/pdstemplates.c @@ -271,6 +271,11 @@ static const struct pdstemplate templatespds[G2C_MAX_PDS_TEMPLATE] = 4.71: Post-processing Individual Ensemble Forecast, Control and Perturbed, at a horizontal level or in a horizontal layer at a point in time */ {71, 21, 0, {1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}}, + /** PDT 4.72 (12/04/2024) + 4.72: Post-processing Average, Accumulation, Extreme values + or other Statistically processed values at a horizontal level or in + a horizontal layer in a continuous or non-continuous time interval */ + {72, 32, 1, {1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}}, }; /** @@ -925,6 +930,23 @@ extpdstemplate(g2int number, g2int *list) new->ext[k + 28] = 1; new->ext[k + 29] = 4; } + /* PDT 4.72 (12/04/2024) */ + else if (number == 72) + { + if (list[24] > 1) + { + new->extlen = (list[24] - 1) * 6; + new->ext = malloc(sizeof(g2int) * new->extlen); + for (j = 2; j <= list[24]; j++) + { + l = (j - 2) * 6; + for (k = 0; k < 6; k++) + { + new->ext[l + k] = new->map[26 + k]; + } + } + } + } return new; } diff --git a/tests/tst_pdstemplates.c b/tests/tst_pdstemplates.c index 3b697e06..610ab0e5 100644 --- a/tests/tst_pdstemplates.c +++ b/tests/tst_pdstemplates.c @@ -407,24 +407,35 @@ main() return G2C_ERROR; free(tmpl->ext); free(tmpl); + + /* Check for one that's there but does need an extension. */ + tmpl = extpdstemplate(72, list); + if (!tmpl) + return G2C_ERROR; + if (tmpl->num != 72 || tmpl->maplen != 32 || !tmpl->needext) + return G2C_ERROR; + if (!tmpl->ext) + return G2C_ERROR; + free(tmpl->ext); + free(tmpl); } printf("ok!\n"); printf("Testing all getpdstemplate() calls with extensions...\n"); { -#define NUM_TEST 57 +#define NUM_TEST 58 int number[NUM_TEST] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 20, 30, 31, 40, 41, 42, 43, 254, 1000, 1001, 1002, 1100, 1101, 32, 44, 45, 46, 47, 48, 50, 52, 51, 91, 33, 34, 53, 54, 57, 60, 61, 35, 49, 55, 58, 59, 62, 63, 67, 68, 70, - 71}; + 71, 72}; int expected_maplen[NUM_TEST] = { 15, 18, 17, 31, 30, 22, 16, 15, 29, 36, 30, 32, 31, 45, 44, 18, 19, 5, 5, 16, 19, 30, 33, 3, 9, 16, 15, 15, 22, 10, 21, 24, 35, 38, 26, 21, 15, 16, - 36, 18, 32, 19, 22, 7, 24, 38, 6, 29, 21, 7, 24, 35, 38, 7, 7, 19, 21}; + 36, 18, 32, 19, 22, 7, 24, 38, 6, 29, 21, 7, 24, 35, 38, 7, 7, 19, 21, 32}; int expected_needext[NUM_TEST] = { 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, - 0, 1, 1, 1, 1, 0, 0}; + 0, 1, 1, 1, 1, 0, 0, 1}; int expected_map[NUM_TEST][48] = { {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 0 */ {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 1 */ @@ -483,6 +494,7 @@ main() {1, 1, 2, 2, 2, 2, 1}, /* 68 */ {1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 70 */ {1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 71 */ + {1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 72 */ }; int t; int ext_t = 0; @@ -524,11 +536,11 @@ main() if (map[m] != expected_map[t][m]) return G2C_ERROR; -#define NUM_EXT_TEST 30 +#define NUM_EXT_TEST 31 int template[G2C_MAX_PDS_TEMPLATE_MAPLEN]; int expected_extlen[NUM_EXT_TEST] = { 2, 2, 6, 6, 6, 6, 6, 8, 8, 10, 10, 6, 6, 10, 6, 6, 12, 8, 2, 8, 2, 2, 30, 6, - 10, 20, 6, 6, 31, 34}; + 10, 20, 6, 6, 31, 34, 6}; int expected_ext[NUM_EXT_TEST][48] = { {1, 1}, /* 3 */ {1, 1}, /* 4 */ @@ -560,6 +572,7 @@ main() {1, 1, 1, 4, 1, 4}, /* 63 */ {-1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 67 */ {-1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 4, 1, 4}, /* 68 */ + {1, 1, 1, 4, 1, 4}, /* 72 */ }; if (needext) @@ -666,6 +679,9 @@ main() case 68: template[6] = 2; break; + case 72: + template[24] = 2; + break; default: return G2C_ERROR; } From 394114c5512294cb883145c0031ec8b4d82dd6dc Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Thu, 5 Dec 2024 09:57:03 -0800 Subject: [PATCH 21/80] pds 4.73 --- src/grib2.h.in | 2 +- src/pdstemplates.c | 21 +++++++++++++++++++++ tests/tst_pdstemplates.c | 29 +++++++++++++++++++++++------ 3 files changed, 45 insertions(+), 7 deletions(-) diff --git a/src/grib2.h.in b/src/grib2.h.in index be690550..8749f0b9 100644 --- a/src/grib2.h.in +++ b/src/grib2.h.in @@ -291,7 +291,7 @@ g2int g2_gribend(unsigned char *cgrib); /* Constants to help with templates. */ #define G2C_MAX_GDS_TEMPLATE 31 /**< Maximum number of grid templates. */ #define G2C_MAX_GDS_TEMPLATE_MAPLEN 28 /**< Maximum grid template map length. */ -#define G2C_MAX_PDS_TEMPLATE 58 /**< Maximum number of PDS templates. */ +#define G2C_MAX_PDS_TEMPLATE 59 /**< Maximum number of PDS templates. */ #define G2C_MAX_PDS_TEMPLATE_MAPLEN 45 /**< Maximum template map length. */ #define G2C_MAX_DRS_TEMPLATE 10 /**< Maximum number of DRS templates. */ #define G2C_MAX_DRS_TEMPLATE_MAPLEN 18 /**< Maximum DRS template map length. */ diff --git a/src/pdstemplates.c b/src/pdstemplates.c index 6c7bf7be..48b739bc 100644 --- a/src/pdstemplates.c +++ b/src/pdstemplates.c @@ -276,6 +276,10 @@ static const struct pdstemplate templatespds[G2C_MAX_PDS_TEMPLATE] = or other Statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval */ {72, 32, 1, {1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}}, + /** PDT 4.73 (12/04/2024) + 4.73: Post-processing Individual Ensemble Forecast, Control and Perturbed, at a + horizontal level or in a horizontal layer in a continuous or non-continuous time interval */ + {73, 34, 1, {1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 1}}, }; /** @@ -947,6 +951,23 @@ extpdstemplate(g2int number, g2int *list) } } } + /* PDT 4.73 (12/04/2024) */ + else if (number == 73) + { + if (list[29] > 1) + { + new->extlen = (list[29] - 1) * 6; + new->ext = malloc(sizeof(g2int) * new->extlen); + for (j = 2; j <= list[29]; j++) + { + l = (j - 2) * 6; + for (k = 0; k < 6; k++) + { + new->ext[l + k] = new->map[31 + k]; + } + } + } + } return new; } diff --git a/tests/tst_pdstemplates.c b/tests/tst_pdstemplates.c index 610ab0e5..4dbdf027 100644 --- a/tests/tst_pdstemplates.c +++ b/tests/tst_pdstemplates.c @@ -418,24 +418,36 @@ main() return G2C_ERROR; free(tmpl->ext); free(tmpl); + + /* Check for one that's there but does need an extension. */ + tmpl = extpdstemplate(73, list); + if (!tmpl) + return G2C_ERROR; + if (tmpl->num != 73 || tmpl->maplen != 34 || !tmpl->needext) + return G2C_ERROR; + if (!tmpl->ext) + return G2C_ERROR; + free(tmpl->ext); + free(tmpl); } printf("ok!\n"); printf("Testing all getpdstemplate() calls with extensions...\n"); { -#define NUM_TEST 58 +#define NUM_TEST 59 int number[NUM_TEST] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 20, 30, 31, 40, 41, 42, 43, 254, 1000, 1001, 1002, 1100, 1101, 32, 44, 45, 46, 47, 48, 50, 52, 51, 91, 33, 34, 53, 54, 57, 60, 61, 35, 49, 55, 58, 59, 62, 63, 67, 68, 70, - 71, 72}; + 71, 72, 73}; int expected_maplen[NUM_TEST] = { 15, 18, 17, 31, 30, 22, 16, 15, 29, 36, 30, 32, 31, 45, 44, 18, 19, 5, 5, 16, 19, 30, 33, 3, 9, 16, 15, 15, 22, 10, 21, 24, 35, 38, 26, 21, 15, 16, - 36, 18, 32, 19, 22, 7, 24, 38, 6, 29, 21, 7, 24, 35, 38, 7, 7, 19, 21, 32}; + 36, 18, 32, 19, 22, 7, 24, 38, 6, 29, 21, 7, 24, 35, 38, 7, 7, 19, 21, 32, + 34}; int expected_needext[NUM_TEST] = { 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, - 0, 1, 1, 1, 1, 0, 0, 1}; + 0, 1, 1, 1, 1, 0, 0, 1, 1}; int expected_map[NUM_TEST][48] = { {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 0 */ {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 1 */ @@ -495,6 +507,7 @@ main() {1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 70 */ {1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 71 */ {1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 72 */ + {1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 73 */ }; int t; int ext_t = 0; @@ -536,11 +549,11 @@ main() if (map[m] != expected_map[t][m]) return G2C_ERROR; -#define NUM_EXT_TEST 31 +#define NUM_EXT_TEST 32 int template[G2C_MAX_PDS_TEMPLATE_MAPLEN]; int expected_extlen[NUM_EXT_TEST] = { 2, 2, 6, 6, 6, 6, 6, 8, 8, 10, 10, 6, 6, 10, 6, 6, 12, 8, 2, 8, 2, 2, 30, 6, - 10, 20, 6, 6, 31, 34, 6}; + 10, 20, 6, 6, 31, 34, 6, 6}; int expected_ext[NUM_EXT_TEST][48] = { {1, 1}, /* 3 */ {1, 1}, /* 4 */ @@ -573,6 +586,7 @@ main() {-1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 67 */ {-1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 4, 1, 4}, /* 68 */ {1, 1, 1, 4, 1, 4}, /* 72 */ + {1, 1, 1, 4, 1, 4}, /* 73 */ }; if (needext) @@ -682,6 +696,9 @@ main() case 72: template[24] = 2; break; + case 73: + template[29] = 2; + break; default: return G2C_ERROR; } From af1e388ea65f28a9f8a455d5b2fb2a3a36be707e Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Thu, 5 Dec 2024 09:59:00 -0800 Subject: [PATCH 22/80] Update pdstemplates.c --- src/pdstemplates.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pdstemplates.c b/src/pdstemplates.c index 48b739bc..dcf9022c 100644 --- a/src/pdstemplates.c +++ b/src/pdstemplates.c @@ -279,7 +279,7 @@ static const struct pdstemplate templatespds[G2C_MAX_PDS_TEMPLATE] = /** PDT 4.73 (12/04/2024) 4.73: Post-processing Individual Ensemble Forecast, Control and Perturbed, at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval */ - {73, 34, 1, {1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 1}}, + {73, 34, 1, {1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}}, }; /** From b201f2f88f12f509f5d1a0427ffa248d8c1105ba Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Thu, 5 Dec 2024 10:01:58 -0800 Subject: [PATCH 23/80] fix 4.73 extension --- src/pdstemplates.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pdstemplates.c b/src/pdstemplates.c index dcf9022c..33625765 100644 --- a/src/pdstemplates.c +++ b/src/pdstemplates.c @@ -954,16 +954,16 @@ extpdstemplate(g2int number, g2int *list) /* PDT 4.73 (12/04/2024) */ else if (number == 73) { - if (list[29] > 1) + if (list[27] > 1) { - new->extlen = (list[29] - 1) * 6; + new->extlen = (list[27] - 1) * 6; new->ext = malloc(sizeof(g2int) * new->extlen); - for (j = 2; j <= list[29]; j++) + for (j = 2; j <= list[27]; j++) { l = (j - 2) * 6; for (k = 0; k < 6; k++) { - new->ext[l + k] = new->map[31 + k]; + new->ext[l + k] = new->map[29 + k]; } } } From 060d0c5a68d4dcbb243e85ff1bc8f19e3c16ac52 Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Thu, 5 Dec 2024 10:05:16 -0800 Subject: [PATCH 24/80] pds 4.76 --- src/grib2.h.in | 2 +- src/pdstemplates.c | 4 ++++ tests/tst_pdstemplates.c | 9 +++++---- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/grib2.h.in b/src/grib2.h.in index 8749f0b9..cff84f99 100644 --- a/src/grib2.h.in +++ b/src/grib2.h.in @@ -291,7 +291,7 @@ g2int g2_gribend(unsigned char *cgrib); /* Constants to help with templates. */ #define G2C_MAX_GDS_TEMPLATE 31 /**< Maximum number of grid templates. */ #define G2C_MAX_GDS_TEMPLATE_MAPLEN 28 /**< Maximum grid template map length. */ -#define G2C_MAX_PDS_TEMPLATE 59 /**< Maximum number of PDS templates. */ +#define G2C_MAX_PDS_TEMPLATE 60 /**< Maximum number of PDS templates. */ #define G2C_MAX_PDS_TEMPLATE_MAPLEN 45 /**< Maximum template map length. */ #define G2C_MAX_DRS_TEMPLATE 10 /**< Maximum number of DRS templates. */ #define G2C_MAX_DRS_TEMPLATE_MAPLEN 18 /**< Maximum DRS template map length. */ diff --git a/src/pdstemplates.c b/src/pdstemplates.c index 33625765..2b43e12f 100644 --- a/src/pdstemplates.c +++ b/src/pdstemplates.c @@ -280,6 +280,10 @@ static const struct pdstemplate templatespds[G2C_MAX_PDS_TEMPLATE] = 4.73: Post-processing Individual Ensemble Forecast, Control and Perturbed, at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval */ {73, 34, 1, {1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}}, + /** PDT 4.76 (12/04/2024) + 4.76: Analysis or forecast at a horizontal level or in a horizontal layer at a point in + time for atmospheric chemical constituents with source or sink */ + {76, 17, 0, {1, 1, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}}, }; /** diff --git a/tests/tst_pdstemplates.c b/tests/tst_pdstemplates.c index 4dbdf027..df0c473b 100644 --- a/tests/tst_pdstemplates.c +++ b/tests/tst_pdstemplates.c @@ -433,21 +433,21 @@ main() printf("ok!\n"); printf("Testing all getpdstemplate() calls with extensions...\n"); { -#define NUM_TEST 59 +#define NUM_TEST 60 int number[NUM_TEST] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 20, 30, 31, 40, 41, 42, 43, 254, 1000, 1001, 1002, 1100, 1101, 32, 44, 45, 46, 47, 48, 50, 52, 51, 91, 33, 34, 53, 54, 57, 60, 61, 35, 49, 55, 58, 59, 62, 63, 67, 68, 70, - 71, 72, 73}; + 71, 72, 73, 76}; int expected_maplen[NUM_TEST] = { 15, 18, 17, 31, 30, 22, 16, 15, 29, 36, 30, 32, 31, 45, 44, 18, 19, 5, 5, 16, 19, 30, 33, 3, 9, 16, 15, 15, 22, 10, 21, 24, 35, 38, 26, 21, 15, 16, 36, 18, 32, 19, 22, 7, 24, 38, 6, 29, 21, 7, 24, 35, 38, 7, 7, 19, 21, 32, - 34}; + 34, 17}; int expected_needext[NUM_TEST] = { 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, - 0, 1, 1, 1, 1, 0, 0, 1, 1}; + 0, 1, 1, 1, 1, 0, 0, 1, 1, 0}; int expected_map[NUM_TEST][48] = { {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 0 */ {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 1 */ @@ -508,6 +508,7 @@ main() {1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 71 */ {1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 72 */ {1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 73 */ + {1, 1, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 76 */ }; int t; int ext_t = 0; From c237c2dd3fb1d10d91f49a8c30292055b78b2740 Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Thu, 5 Dec 2024 10:09:09 -0800 Subject: [PATCH 25/80] pds 4.77 --- src/grib2.h.in | 2 +- src/pdstemplates.c | 4 ++++ tests/tst_pdstemplates.c | 9 +++++---- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/grib2.h.in b/src/grib2.h.in index cff84f99..91b4bf7f 100644 --- a/src/grib2.h.in +++ b/src/grib2.h.in @@ -291,7 +291,7 @@ g2int g2_gribend(unsigned char *cgrib); /* Constants to help with templates. */ #define G2C_MAX_GDS_TEMPLATE 31 /**< Maximum number of grid templates. */ #define G2C_MAX_GDS_TEMPLATE_MAPLEN 28 /**< Maximum grid template map length. */ -#define G2C_MAX_PDS_TEMPLATE 60 /**< Maximum number of PDS templates. */ +#define G2C_MAX_PDS_TEMPLATE 61 /**< Maximum number of PDS templates. */ #define G2C_MAX_PDS_TEMPLATE_MAPLEN 45 /**< Maximum template map length. */ #define G2C_MAX_DRS_TEMPLATE 10 /**< Maximum number of DRS templates. */ #define G2C_MAX_DRS_TEMPLATE_MAPLEN 18 /**< Maximum DRS template map length. */ diff --git a/src/pdstemplates.c b/src/pdstemplates.c index 2b43e12f..1b0025d2 100644 --- a/src/pdstemplates.c +++ b/src/pdstemplates.c @@ -284,6 +284,10 @@ static const struct pdstemplate templatespds[G2C_MAX_PDS_TEMPLATE] = 4.76: Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for atmospheric chemical constituents with source or sink */ {76, 17, 0, {1, 1, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}}, + /** PDT 4.77 (12/04/2024) + 4.77: Individual ensemble forecast, control and perturbed, at a horizontal level or in + a horizontal layer at a point in time for atmospheric chemical constituents with source or sink */ + {77, 20, 0, {1, 1, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}}, }; /** diff --git a/tests/tst_pdstemplates.c b/tests/tst_pdstemplates.c index df0c473b..09090620 100644 --- a/tests/tst_pdstemplates.c +++ b/tests/tst_pdstemplates.c @@ -433,21 +433,21 @@ main() printf("ok!\n"); printf("Testing all getpdstemplate() calls with extensions...\n"); { -#define NUM_TEST 60 +#define NUM_TEST 61 int number[NUM_TEST] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 20, 30, 31, 40, 41, 42, 43, 254, 1000, 1001, 1002, 1100, 1101, 32, 44, 45, 46, 47, 48, 50, 52, 51, 91, 33, 34, 53, 54, 57, 60, 61, 35, 49, 55, 58, 59, 62, 63, 67, 68, 70, - 71, 72, 73, 76}; + 71, 72, 73, 76, 77}; int expected_maplen[NUM_TEST] = { 15, 18, 17, 31, 30, 22, 16, 15, 29, 36, 30, 32, 31, 45, 44, 18, 19, 5, 5, 16, 19, 30, 33, 3, 9, 16, 15, 15, 22, 10, 21, 24, 35, 38, 26, 21, 15, 16, 36, 18, 32, 19, 22, 7, 24, 38, 6, 29, 21, 7, 24, 35, 38, 7, 7, 19, 21, 32, - 34, 17}; + 34, 17, 20}; int expected_needext[NUM_TEST] = { 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, - 0, 1, 1, 1, 1, 0, 0, 1, 1, 0}; + 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0}; int expected_map[NUM_TEST][48] = { {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 0 */ {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 1 */ @@ -509,6 +509,7 @@ main() {1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 72 */ {1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 73 */ {1, 1, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 76 */ + {1, 1, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 77 */ }; int t; int ext_t = 0; From c213aa5ab1bf3628da47d8fdbaa3e47a9c7e870d Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Thu, 5 Dec 2024 10:17:52 -0800 Subject: [PATCH 26/80] pds 4.78 --- src/grib2.h.in | 2 +- src/pdstemplates.c | 22 ++++++++++++++++++++++ tests/tst_pdstemplates.c | 28 ++++++++++++++++++++++------ 3 files changed, 45 insertions(+), 7 deletions(-) diff --git a/src/grib2.h.in b/src/grib2.h.in index 91b4bf7f..d4523b7c 100644 --- a/src/grib2.h.in +++ b/src/grib2.h.in @@ -291,7 +291,7 @@ g2int g2_gribend(unsigned char *cgrib); /* Constants to help with templates. */ #define G2C_MAX_GDS_TEMPLATE 31 /**< Maximum number of grid templates. */ #define G2C_MAX_GDS_TEMPLATE_MAPLEN 28 /**< Maximum grid template map length. */ -#define G2C_MAX_PDS_TEMPLATE 61 /**< Maximum number of PDS templates. */ +#define G2C_MAX_PDS_TEMPLATE 62 /**< Maximum number of PDS templates. */ #define G2C_MAX_PDS_TEMPLATE_MAPLEN 45 /**< Maximum template map length. */ #define G2C_MAX_DRS_TEMPLATE 10 /**< Maximum number of DRS templates. */ #define G2C_MAX_DRS_TEMPLATE_MAPLEN 18 /**< Maximum DRS template map length. */ diff --git a/src/pdstemplates.c b/src/pdstemplates.c index 1b0025d2..1cdc7f54 100644 --- a/src/pdstemplates.c +++ b/src/pdstemplates.c @@ -288,6 +288,11 @@ static const struct pdstemplate templatespds[G2C_MAX_PDS_TEMPLATE] = 4.77: Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for atmospheric chemical constituents with source or sink */ {77, 20, 0, {1, 1, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}}, + /** PDT 4.78 (12/04/2024) + 4.78: Average, accumulation, and/or extreme values or other statistically + processed values at a horizontal level or in a horizontal layer in a continuous or + non-continuous time interval for atmospheric chemical constituents with source or sink */ + {78, 31, 1, {1, 1, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}}, }; /** @@ -976,6 +981,23 @@ extpdstemplate(g2int number, g2int *list) } } } + /* PDT 4.78 (12/04/2024) */ + else if (number == 78) + { + if (list[23] > 1) + { + new->extlen = (list[23] - 1) * 6; + new->ext = malloc(sizeof(g2int) * new->extlen); + for (j = 2; j <= list[23]; j++) + { + l = (j - 2) * 6; + for (k = 0; k < 6; k++) + { + new->ext[l + k] = new->map[25 + k]; + } + } + } + } return new; } diff --git a/tests/tst_pdstemplates.c b/tests/tst_pdstemplates.c index 09090620..a6b6f556 100644 --- a/tests/tst_pdstemplates.c +++ b/tests/tst_pdstemplates.c @@ -429,25 +429,36 @@ main() return G2C_ERROR; free(tmpl->ext); free(tmpl); + + /* Check for one that's there but does need an extension. */ + tmpl = extpdstemplate(78, list); + if (!tmpl) + return G2C_ERROR; + if (tmpl->num != 78 || tmpl->maplen != 31 || !tmpl->needext) + return G2C_ERROR; + if (!tmpl->ext) + return G2C_ERROR; + free(tmpl->ext); + free(tmpl); } printf("ok!\n"); printf("Testing all getpdstemplate() calls with extensions...\n"); { -#define NUM_TEST 61 +#define NUM_TEST 62 int number[NUM_TEST] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 20, 30, 31, 40, 41, 42, 43, 254, 1000, 1001, 1002, 1100, 1101, 32, 44, 45, 46, 47, 48, 50, 52, 51, 91, 33, 34, 53, 54, 57, 60, 61, 35, 49, 55, 58, 59, 62, 63, 67, 68, 70, - 71, 72, 73, 76, 77}; + 71, 72, 73, 76, 77, 78}; int expected_maplen[NUM_TEST] = { 15, 18, 17, 31, 30, 22, 16, 15, 29, 36, 30, 32, 31, 45, 44, 18, 19, 5, 5, 16, 19, 30, 33, 3, 9, 16, 15, 15, 22, 10, 21, 24, 35, 38, 26, 21, 15, 16, 36, 18, 32, 19, 22, 7, 24, 38, 6, 29, 21, 7, 24, 35, 38, 7, 7, 19, 21, 32, - 34, 17, 20}; + 34, 17, 20, 31}; int expected_needext[NUM_TEST] = { 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, - 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0}; + 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1}; int expected_map[NUM_TEST][48] = { {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 0 */ {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 1 */ @@ -510,6 +521,7 @@ main() {1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 73 */ {1, 1, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 76 */ {1, 1, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 77 */ + {1, 1, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 78 */ }; int t; int ext_t = 0; @@ -551,11 +563,11 @@ main() if (map[m] != expected_map[t][m]) return G2C_ERROR; -#define NUM_EXT_TEST 32 +#define NUM_EXT_TEST 33 int template[G2C_MAX_PDS_TEMPLATE_MAPLEN]; int expected_extlen[NUM_EXT_TEST] = { 2, 2, 6, 6, 6, 6, 6, 8, 8, 10, 10, 6, 6, 10, 6, 6, 12, 8, 2, 8, 2, 2, 30, 6, - 10, 20, 6, 6, 31, 34, 6, 6}; + 10, 20, 6, 6, 31, 34, 6, 6, 6}; int expected_ext[NUM_EXT_TEST][48] = { {1, 1}, /* 3 */ {1, 1}, /* 4 */ @@ -589,6 +601,7 @@ main() {-1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 4, 1, 4}, /* 68 */ {1, 1, 1, 4, 1, 4}, /* 72 */ {1, 1, 1, 4, 1, 4}, /* 73 */ + {1, 1, 1, 4, 1, 4}, /* 78 */ }; if (needext) @@ -701,6 +714,9 @@ main() case 73: template[29] = 2; break; + case 74: + template[23] = 2; + break; default: return G2C_ERROR; } From 02d0bd8943ac8cca98d75f69cb89c7fcc4278ed3 Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Thu, 5 Dec 2024 10:20:11 -0800 Subject: [PATCH 27/80] typo --- tests/tst_pdstemplates.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/tst_pdstemplates.c b/tests/tst_pdstemplates.c index a6b6f556..d11a76b4 100644 --- a/tests/tst_pdstemplates.c +++ b/tests/tst_pdstemplates.c @@ -714,7 +714,7 @@ main() case 73: template[29] = 2; break; - case 74: + case 78: template[23] = 2; break; default: From 8328c458a7787be0cbbf10a8554f92c288bb0efa Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Thu, 5 Dec 2024 10:28:05 -0800 Subject: [PATCH 28/80] pds 4.79 --- src/grib2.h.in | 2 +- src/pdstemplates.c | 22 ++++++++++++++++++++++ tests/tst_pdstemplates.c | 28 ++++++++++++++++++++++------ 3 files changed, 45 insertions(+), 7 deletions(-) diff --git a/src/grib2.h.in b/src/grib2.h.in index d4523b7c..e3312e24 100644 --- a/src/grib2.h.in +++ b/src/grib2.h.in @@ -291,7 +291,7 @@ g2int g2_gribend(unsigned char *cgrib); /* Constants to help with templates. */ #define G2C_MAX_GDS_TEMPLATE 31 /**< Maximum number of grid templates. */ #define G2C_MAX_GDS_TEMPLATE_MAPLEN 28 /**< Maximum grid template map length. */ -#define G2C_MAX_PDS_TEMPLATE 62 /**< Maximum number of PDS templates. */ +#define G2C_MAX_PDS_TEMPLATE 63 /**< Maximum number of PDS templates. */ #define G2C_MAX_PDS_TEMPLATE_MAPLEN 45 /**< Maximum template map length. */ #define G2C_MAX_DRS_TEMPLATE 10 /**< Maximum number of DRS templates. */ #define G2C_MAX_DRS_TEMPLATE_MAPLEN 18 /**< Maximum DRS template map length. */ diff --git a/src/pdstemplates.c b/src/pdstemplates.c index 1cdc7f54..984eb166 100644 --- a/src/pdstemplates.c +++ b/src/pdstemplates.c @@ -293,6 +293,11 @@ static const struct pdstemplate templatespds[G2C_MAX_PDS_TEMPLATE] = processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for atmospheric chemical constituents with source or sink */ {78, 31, 1, {1, 1, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}}, + /** PDT 4.79 (12/04/2024) + 4.79: Individual ensemble forecast, control and perturbed, at a horizontal level or in a + horizontal layer in a continuous or non-continuous time + interval for atmospheric chemical constituents with source or sink */ + {79, 34, 1, {1, 1, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}}, }; /** @@ -998,6 +1003,23 @@ extpdstemplate(g2int number, g2int *list) } } } + /* PDT 4.79 (12/04/2024) */ + else if (number == 79) + { + if (list[26] > 1) + { + new->extlen = (list[26] - 1) * 6; + new->ext = malloc(sizeof(g2int) * new->extlen); + for (j = 2; j <= list[26]; j++) + { + l = (j - 2) * 6; + for (k = 0; k < 6; k++) + { + new->ext[l + k] = new->map[28 + k]; + } + } + } + } return new; } diff --git a/tests/tst_pdstemplates.c b/tests/tst_pdstemplates.c index d11a76b4..76d8f140 100644 --- a/tests/tst_pdstemplates.c +++ b/tests/tst_pdstemplates.c @@ -440,25 +440,36 @@ main() return G2C_ERROR; free(tmpl->ext); free(tmpl); + + /* Check for one that's there but does need an extension. */ + tmpl = extpdstemplate(79, list); + if (!tmpl) + return G2C_ERROR; + if (tmpl->num != 79 || tmpl->maplen != 34 || !tmpl->needext) + return G2C_ERROR; + if (!tmpl->ext) + return G2C_ERROR; + free(tmpl->ext); + free(tmpl); } printf("ok!\n"); printf("Testing all getpdstemplate() calls with extensions...\n"); { -#define NUM_TEST 62 +#define NUM_TEST 63 int number[NUM_TEST] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 20, 30, 31, 40, 41, 42, 43, 254, 1000, 1001, 1002, 1100, 1101, 32, 44, 45, 46, 47, 48, 50, 52, 51, 91, 33, 34, 53, 54, 57, 60, 61, 35, 49, 55, 58, 59, 62, 63, 67, 68, 70, - 71, 72, 73, 76, 77, 78}; + 71, 72, 73, 76, 77, 78, 79}; int expected_maplen[NUM_TEST] = { 15, 18, 17, 31, 30, 22, 16, 15, 29, 36, 30, 32, 31, 45, 44, 18, 19, 5, 5, 16, 19, 30, 33, 3, 9, 16, 15, 15, 22, 10, 21, 24, 35, 38, 26, 21, 15, 16, 36, 18, 32, 19, 22, 7, 24, 38, 6, 29, 21, 7, 24, 35, 38, 7, 7, 19, 21, 32, - 34, 17, 20, 31}; + 34, 17, 20, 31, 34}; int expected_needext[NUM_TEST] = { 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, - 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1}; + 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1}; int expected_map[NUM_TEST][48] = { {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 0 */ {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 1 */ @@ -522,6 +533,7 @@ main() {1, 1, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 76 */ {1, 1, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 77 */ {1, 1, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 78 */ + {1, 1, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 79 */ }; int t; int ext_t = 0; @@ -563,11 +575,11 @@ main() if (map[m] != expected_map[t][m]) return G2C_ERROR; -#define NUM_EXT_TEST 33 +#define NUM_EXT_TEST 34 int template[G2C_MAX_PDS_TEMPLATE_MAPLEN]; int expected_extlen[NUM_EXT_TEST] = { 2, 2, 6, 6, 6, 6, 6, 8, 8, 10, 10, 6, 6, 10, 6, 6, 12, 8, 2, 8, 2, 2, 30, 6, - 10, 20, 6, 6, 31, 34, 6, 6, 6}; + 10, 20, 6, 6, 31, 34, 6, 6, 6, 6}; int expected_ext[NUM_EXT_TEST][48] = { {1, 1}, /* 3 */ {1, 1}, /* 4 */ @@ -602,6 +614,7 @@ main() {1, 1, 1, 4, 1, 4}, /* 72 */ {1, 1, 1, 4, 1, 4}, /* 73 */ {1, 1, 1, 4, 1, 4}, /* 78 */ + {1, 1, 1, 4, 1, 4}, /* 79 */ }; if (needext) @@ -717,6 +730,9 @@ main() case 78: template[23] = 2; break; + case 79: + template[26] = 2; + break; default: return G2C_ERROR; } From 77cc9bee14635913d9a91aa22cf0ae13e448510a Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Thu, 5 Dec 2024 10:33:13 -0800 Subject: [PATCH 29/80] pds 4.80 --- src/grib2.h.in | 2 +- src/pdstemplates.c | 4 ++++ tests/tst_pdstemplates.c | 9 +++++---- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/grib2.h.in b/src/grib2.h.in index e3312e24..c21e9ec4 100644 --- a/src/grib2.h.in +++ b/src/grib2.h.in @@ -291,7 +291,7 @@ g2int g2_gribend(unsigned char *cgrib); /* Constants to help with templates. */ #define G2C_MAX_GDS_TEMPLATE 31 /**< Maximum number of grid templates. */ #define G2C_MAX_GDS_TEMPLATE_MAPLEN 28 /**< Maximum grid template map length. */ -#define G2C_MAX_PDS_TEMPLATE 63 /**< Maximum number of PDS templates. */ +#define G2C_MAX_PDS_TEMPLATE 64 /**< Maximum number of PDS templates. */ #define G2C_MAX_PDS_TEMPLATE_MAPLEN 45 /**< Maximum template map length. */ #define G2C_MAX_DRS_TEMPLATE 10 /**< Maximum number of DRS templates. */ #define G2C_MAX_DRS_TEMPLATE_MAPLEN 18 /**< Maximum DRS template map length. */ diff --git a/src/pdstemplates.c b/src/pdstemplates.c index 984eb166..640a27d0 100644 --- a/src/pdstemplates.c +++ b/src/pdstemplates.c @@ -298,6 +298,10 @@ static const struct pdstemplate templatespds[G2C_MAX_PDS_TEMPLATE] = horizontal layer in a continuous or non-continuous time interval for atmospheric chemical constituents with source or sink */ {79, 34, 1, {1, 1, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}}, + /** PDT 4.80 (12/04/2024) + 4.80: Analysis or forecast at a horizontal level or in a horizontal layer + at a point in time for optical properties of aerosol with source or sink */ + {80, 27, 0, {1, 1, 2, 1, 1, -1, -4, -1, -4, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}}, }; /** diff --git a/tests/tst_pdstemplates.c b/tests/tst_pdstemplates.c index 76d8f140..1b322a51 100644 --- a/tests/tst_pdstemplates.c +++ b/tests/tst_pdstemplates.c @@ -455,21 +455,21 @@ main() printf("ok!\n"); printf("Testing all getpdstemplate() calls with extensions...\n"); { -#define NUM_TEST 63 +#define NUM_TEST 64 int number[NUM_TEST] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 20, 30, 31, 40, 41, 42, 43, 254, 1000, 1001, 1002, 1100, 1101, 32, 44, 45, 46, 47, 48, 50, 52, 51, 91, 33, 34, 53, 54, 57, 60, 61, 35, 49, 55, 58, 59, 62, 63, 67, 68, 70, - 71, 72, 73, 76, 77, 78, 79}; + 71, 72, 73, 76, 77, 78, 79, 80}; int expected_maplen[NUM_TEST] = { 15, 18, 17, 31, 30, 22, 16, 15, 29, 36, 30, 32, 31, 45, 44, 18, 19, 5, 5, 16, 19, 30, 33, 3, 9, 16, 15, 15, 22, 10, 21, 24, 35, 38, 26, 21, 15, 16, 36, 18, 32, 19, 22, 7, 24, 38, 6, 29, 21, 7, 24, 35, 38, 7, 7, 19, 21, 32, - 34, 17, 20, 31, 34}; + 34, 17, 20, 31, 34, 27}; int expected_needext[NUM_TEST] = { 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, - 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1}; + 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0}; int expected_map[NUM_TEST][48] = { {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 0 */ {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 1 */ @@ -534,6 +534,7 @@ main() {1, 1, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 77 */ {1, 1, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 78 */ {1, 1, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 79 */ + {1, 1, 2, 1, 1, -1, -4, -1, -4, 1, -1 ,-4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 80 */ }; int t; int ext_t = 0; From c66611353661ffbd7d02770ce9d456827a8ce549 Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Thu, 5 Dec 2024 10:36:06 -0800 Subject: [PATCH 30/80] format --- tests/tst_pdstemplates.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/tst_pdstemplates.c b/tests/tst_pdstemplates.c index 1b322a51..252b2e40 100644 --- a/tests/tst_pdstemplates.c +++ b/tests/tst_pdstemplates.c @@ -534,7 +534,7 @@ main() {1, 1, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 77 */ {1, 1, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 78 */ {1, 1, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 79 */ - {1, 1, 2, 1, 1, -1, -4, -1, -4, 1, -1 ,-4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 80 */ + {1, 1, 2, 1, 1, -1, -4, -1, -4, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 80 */ }; int t; int ext_t = 0; From dc91c1ae84794ece7c61b4f04f99210164df6754 Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Thu, 5 Dec 2024 10:40:03 -0800 Subject: [PATCH 31/80] pds 4.81 --- src/grib2.h.in | 2 +- src/pdstemplates.c | 4 ++++ tests/tst_pdstemplates.c | 9 +++++---- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/grib2.h.in b/src/grib2.h.in index c21e9ec4..7becc5d4 100644 --- a/src/grib2.h.in +++ b/src/grib2.h.in @@ -291,7 +291,7 @@ g2int g2_gribend(unsigned char *cgrib); /* Constants to help with templates. */ #define G2C_MAX_GDS_TEMPLATE 31 /**< Maximum number of grid templates. */ #define G2C_MAX_GDS_TEMPLATE_MAPLEN 28 /**< Maximum grid template map length. */ -#define G2C_MAX_PDS_TEMPLATE 64 /**< Maximum number of PDS templates. */ +#define G2C_MAX_PDS_TEMPLATE 65 /**< Maximum number of PDS templates. */ #define G2C_MAX_PDS_TEMPLATE_MAPLEN 45 /**< Maximum template map length. */ #define G2C_MAX_DRS_TEMPLATE 10 /**< Maximum number of DRS templates. */ #define G2C_MAX_DRS_TEMPLATE_MAPLEN 18 /**< Maximum DRS template map length. */ diff --git a/src/pdstemplates.c b/src/pdstemplates.c index 640a27d0..4dcbbab8 100644 --- a/src/pdstemplates.c +++ b/src/pdstemplates.c @@ -302,6 +302,10 @@ static const struct pdstemplate templatespds[G2C_MAX_PDS_TEMPLATE] = 4.80: Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for optical properties of aerosol with source or sink */ {80, 27, 0, {1, 1, 2, 1, 1, -1, -4, -1, -4, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}}, + /** PDT 4.81 (12/04/2024) + 4.81: Individual ensemble forecast, control and perturbed, at a horizonal level + or in a horizontal layer at a point in time for optical properties of aerosol with source or sink */ + {81, 30, 0, {1, 1, 2, 1, 1, -1, -4, -1, -4, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -3, 1, -1, -4, 1, 1, 1}}, }; /** diff --git a/tests/tst_pdstemplates.c b/tests/tst_pdstemplates.c index 252b2e40..f14f0e45 100644 --- a/tests/tst_pdstemplates.c +++ b/tests/tst_pdstemplates.c @@ -455,21 +455,21 @@ main() printf("ok!\n"); printf("Testing all getpdstemplate() calls with extensions...\n"); { -#define NUM_TEST 64 +#define NUM_TEST 65 int number[NUM_TEST] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 20, 30, 31, 40, 41, 42, 43, 254, 1000, 1001, 1002, 1100, 1101, 32, 44, 45, 46, 47, 48, 50, 52, 51, 91, 33, 34, 53, 54, 57, 60, 61, 35, 49, 55, 58, 59, 62, 63, 67, 68, 70, - 71, 72, 73, 76, 77, 78, 79, 80}; + 71, 72, 73, 76, 77, 78, 79, 80, 81}; int expected_maplen[NUM_TEST] = { 15, 18, 17, 31, 30, 22, 16, 15, 29, 36, 30, 32, 31, 45, 44, 18, 19, 5, 5, 16, 19, 30, 33, 3, 9, 16, 15, 15, 22, 10, 21, 24, 35, 38, 26, 21, 15, 16, 36, 18, 32, 19, 22, 7, 24, 38, 6, 29, 21, 7, 24, 35, 38, 7, 7, 19, 21, 32, - 34, 17, 20, 31, 34, 27}; + 34, 17, 20, 31, 34, 27, 30}; int expected_needext[NUM_TEST] = { 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, - 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0}; + 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0}; int expected_map[NUM_TEST][48] = { {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 0 */ {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 1 */ @@ -535,6 +535,7 @@ main() {1, 1, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 78 */ {1, 1, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 79 */ {1, 1, 2, 1, 1, -1, -4, -1, -4, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 80 */ + {1, 1, 2, 1, 1, -1, -4, -1, -4, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 81 */ }; int t; int ext_t = 0; From aee6db3039cebc10322737609e0e281f98b056ed Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Thu, 5 Dec 2024 10:42:23 -0800 Subject: [PATCH 32/80] typo --- src/pdstemplates.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pdstemplates.c b/src/pdstemplates.c index 4dcbbab8..a7390e5b 100644 --- a/src/pdstemplates.c +++ b/src/pdstemplates.c @@ -305,7 +305,7 @@ static const struct pdstemplate templatespds[G2C_MAX_PDS_TEMPLATE] = /** PDT 4.81 (12/04/2024) 4.81: Individual ensemble forecast, control and perturbed, at a horizonal level or in a horizontal layer at a point in time for optical properties of aerosol with source or sink */ - {81, 30, 0, {1, 1, 2, 1, 1, -1, -4, -1, -4, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -3, 1, -1, -4, 1, 1, 1}}, + {81, 30, 0, {1, 1, 2, 1, 1, -1, -4, -1, -4, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}}, }; /** From c5db290479b3ab415104d4072c07ee27e870e83c Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Thu, 5 Dec 2024 10:51:12 -0800 Subject: [PATCH 33/80] pds 4.82 --- src/grib2.h.in | 2 +- src/pdstemplates.c | 22 ++++++++++++++++++++++ tests/tst_pdstemplates.c | 28 ++++++++++++++++++++++------ 3 files changed, 45 insertions(+), 7 deletions(-) diff --git a/src/grib2.h.in b/src/grib2.h.in index 7becc5d4..12aab82b 100644 --- a/src/grib2.h.in +++ b/src/grib2.h.in @@ -291,7 +291,7 @@ g2int g2_gribend(unsigned char *cgrib); /* Constants to help with templates. */ #define G2C_MAX_GDS_TEMPLATE 31 /**< Maximum number of grid templates. */ #define G2C_MAX_GDS_TEMPLATE_MAPLEN 28 /**< Maximum grid template map length. */ -#define G2C_MAX_PDS_TEMPLATE 65 /**< Maximum number of PDS templates. */ +#define G2C_MAX_PDS_TEMPLATE 66 /**< Maximum number of PDS templates. */ #define G2C_MAX_PDS_TEMPLATE_MAPLEN 45 /**< Maximum template map length. */ #define G2C_MAX_DRS_TEMPLATE 10 /**< Maximum number of DRS templates. */ #define G2C_MAX_DRS_TEMPLATE_MAPLEN 18 /**< Maximum DRS template map length. */ diff --git a/src/pdstemplates.c b/src/pdstemplates.c index a7390e5b..e7064574 100644 --- a/src/pdstemplates.c +++ b/src/pdstemplates.c @@ -306,6 +306,11 @@ static const struct pdstemplate templatespds[G2C_MAX_PDS_TEMPLATE] = 4.81: Individual ensemble forecast, control and perturbed, at a horizonal level or in a horizontal layer at a point in time for optical properties of aerosol with source or sink */ {81, 30, 0, {1, 1, 2, 1, 1, -1, -4, -1, -4, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}}, + /** PDT 4.82 (12/04/2024) + 4.82: Average, accumulation, and/or extreme values or other statistically processed values + at a horizontal level or in a horizontal layer in a continuous + or non-continuous time interval for aerosol with source or sink */ + {82, 36, 1, {1, 1, 2, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}}, }; /** @@ -1028,6 +1033,23 @@ extpdstemplate(g2int number, g2int *list) } } } + /* PDT 4.82 (12/04/2024) */ + else if (number == 82) + { + if (list[28] > 1) + { + new->extlen = (list[28] - 1) * 6; + new->ext = malloc(sizeof(g2int) * new->extlen); + for (j = 2; j <= list[28]; j++) + { + l = (j - 2) * 6; + for (k = 0; k < 6; k++) + { + new->ext[l + k] = new->map[30 + k]; + } + } + } + } return new; } diff --git a/tests/tst_pdstemplates.c b/tests/tst_pdstemplates.c index f14f0e45..198fd695 100644 --- a/tests/tst_pdstemplates.c +++ b/tests/tst_pdstemplates.c @@ -451,25 +451,36 @@ main() return G2C_ERROR; free(tmpl->ext); free(tmpl); + + /* Check for one that's there but does need an extension. */ + tmpl = extpdstemplate(82, list); + if (!tmpl) + return G2C_ERROR; + if (tmpl->num != 82 || tmpl->maplen != 36 || !tmpl->needext) + return G2C_ERROR; + if (!tmpl->ext) + return G2C_ERROR; + free(tmpl->ext); + free(tmpl); } printf("ok!\n"); printf("Testing all getpdstemplate() calls with extensions...\n"); { -#define NUM_TEST 65 +#define NUM_TEST 66 int number[NUM_TEST] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 20, 30, 31, 40, 41, 42, 43, 254, 1000, 1001, 1002, 1100, 1101, 32, 44, 45, 46, 47, 48, 50, 52, 51, 91, 33, 34, 53, 54, 57, 60, 61, 35, 49, 55, 58, 59, 62, 63, 67, 68, 70, - 71, 72, 73, 76, 77, 78, 79, 80, 81}; + 71, 72, 73, 76, 77, 78, 79, 80, 81, 82}; int expected_maplen[NUM_TEST] = { 15, 18, 17, 31, 30, 22, 16, 15, 29, 36, 30, 32, 31, 45, 44, 18, 19, 5, 5, 16, 19, 30, 33, 3, 9, 16, 15, 15, 22, 10, 21, 24, 35, 38, 26, 21, 15, 16, 36, 18, 32, 19, 22, 7, 24, 38, 6, 29, 21, 7, 24, 35, 38, 7, 7, 19, 21, 32, - 34, 17, 20, 31, 34, 27, 30}; + 34, 17, 20, 31, 34, 27, 30, 36}; int expected_needext[NUM_TEST] = { 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, - 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0}; + 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1}; int expected_map[NUM_TEST][48] = { {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 0 */ {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 1 */ @@ -536,6 +547,7 @@ main() {1, 1, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 79 */ {1, 1, 2, 1, 1, -1, -4, -1, -4, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 80 */ {1, 1, 2, 1, 1, -1, -4, -1, -4, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 81 */ + {1, 1, 2, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 82 */ }; int t; int ext_t = 0; @@ -577,11 +589,11 @@ main() if (map[m] != expected_map[t][m]) return G2C_ERROR; -#define NUM_EXT_TEST 34 +#define NUM_EXT_TEST 35 int template[G2C_MAX_PDS_TEMPLATE_MAPLEN]; int expected_extlen[NUM_EXT_TEST] = { 2, 2, 6, 6, 6, 6, 6, 8, 8, 10, 10, 6, 6, 10, 6, 6, 12, 8, 2, 8, 2, 2, 30, 6, - 10, 20, 6, 6, 31, 34, 6, 6, 6, 6}; + 10, 20, 6, 6, 31, 34, 6, 6, 6, 6, 6}; int expected_ext[NUM_EXT_TEST][48] = { {1, 1}, /* 3 */ {1, 1}, /* 4 */ @@ -617,6 +629,7 @@ main() {1, 1, 1, 4, 1, 4}, /* 73 */ {1, 1, 1, 4, 1, 4}, /* 78 */ {1, 1, 1, 4, 1, 4}, /* 79 */ + {1, 1, 1, 4, 1, 4}, /* 82 */ }; if (needext) @@ -735,6 +748,9 @@ main() case 79: template[26] = 2; break; + case 82: + template[28] = 2; + break; default: return G2C_ERROR; } From 3e487e52938280ac73aa6f7ad7e58bf8671865d3 Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Thu, 5 Dec 2024 11:01:33 -0800 Subject: [PATCH 34/80] pds 4.83 --- src/grib2.h.in | 2 +- src/pdstemplates.c | 21 +++++++++++++++++++++ tests/tst_pdstemplates.c | 28 ++++++++++++++++++++++------ 3 files changed, 44 insertions(+), 7 deletions(-) diff --git a/src/grib2.h.in b/src/grib2.h.in index 12aab82b..d0bf643e 100644 --- a/src/grib2.h.in +++ b/src/grib2.h.in @@ -291,7 +291,7 @@ g2int g2_gribend(unsigned char *cgrib); /* Constants to help with templates. */ #define G2C_MAX_GDS_TEMPLATE 31 /**< Maximum number of grid templates. */ #define G2C_MAX_GDS_TEMPLATE_MAPLEN 28 /**< Maximum grid template map length. */ -#define G2C_MAX_PDS_TEMPLATE 66 /**< Maximum number of PDS templates. */ +#define G2C_MAX_PDS_TEMPLATE 67 /**< Maximum number of PDS templates. */ #define G2C_MAX_PDS_TEMPLATE_MAPLEN 45 /**< Maximum template map length. */ #define G2C_MAX_DRS_TEMPLATE 10 /**< Maximum number of DRS templates. */ #define G2C_MAX_DRS_TEMPLATE_MAPLEN 18 /**< Maximum DRS template map length. */ diff --git a/src/pdstemplates.c b/src/pdstemplates.c index e7064574..6109de0c 100644 --- a/src/pdstemplates.c +++ b/src/pdstemplates.c @@ -311,6 +311,10 @@ static const struct pdstemplate templatespds[G2C_MAX_PDS_TEMPLATE] = at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for aerosol with source or sink */ {82, 36, 1, {1, 1, 2, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}}, + /** PDT 4.83 (12/04/2024) + 4.83: Individual ensemble forecast, control and perturbed, at a horizontal level or in a + horizontal layer in a continuous or non-continuous time interval for aerosol with source or sink */ + {83, 40, 1, {1, 1, 1, 2, 1, 1, -1, -4, -1, -4, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 1, 4, 1, 4}}, }; /** @@ -1050,6 +1054,23 @@ extpdstemplate(g2int number, g2int *list) } } } + /* PDT 4.83 (12/04/2024) */ + else if (number == 83) + { + if (list[31] > 1) + { + new->extlen = (list[31] - 1) * 6; + new->ext = malloc(sizeof(g2int) * new->extlen); + for (j = 2; j <= list[31]; j++) + { + l = (j - 2) * 6; + for (k = 0; k < 6; k++) + { + new->ext[l + k] = new->map[34 + k]; + } + } + } + } return new; } diff --git a/tests/tst_pdstemplates.c b/tests/tst_pdstemplates.c index 198fd695..6ba106d8 100644 --- a/tests/tst_pdstemplates.c +++ b/tests/tst_pdstemplates.c @@ -462,25 +462,36 @@ main() return G2C_ERROR; free(tmpl->ext); free(tmpl); + + /* Check for one that's there but does need an extension. */ + tmpl = extpdstemplate(83, list); + if (!tmpl) + return G2C_ERROR; + if (tmpl->num != 83 || tmpl->maplen != 40 || !tmpl->needext) + return G2C_ERROR; + if (!tmpl->ext) + return G2C_ERROR; + free(tmpl->ext); + free(tmpl); } printf("ok!\n"); printf("Testing all getpdstemplate() calls with extensions...\n"); { -#define NUM_TEST 66 +#define NUM_TEST 67 int number[NUM_TEST] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 20, 30, 31, 40, 41, 42, 43, 254, 1000, 1001, 1002, 1100, 1101, 32, 44, 45, 46, 47, 48, 50, 52, 51, 91, 33, 34, 53, 54, 57, 60, 61, 35, 49, 55, 58, 59, 62, 63, 67, 68, 70, - 71, 72, 73, 76, 77, 78, 79, 80, 81, 82}; + 71, 72, 73, 76, 77, 78, 79, 80, 81, 82, 83}; int expected_maplen[NUM_TEST] = { 15, 18, 17, 31, 30, 22, 16, 15, 29, 36, 30, 32, 31, 45, 44, 18, 19, 5, 5, 16, 19, 30, 33, 3, 9, 16, 15, 15, 22, 10, 21, 24, 35, 38, 26, 21, 15, 16, 36, 18, 32, 19, 22, 7, 24, 38, 6, 29, 21, 7, 24, 35, 38, 7, 7, 19, 21, 32, - 34, 17, 20, 31, 34, 27, 30, 36}; + 34, 17, 20, 31, 34, 27, 30, 36, 40}; int expected_needext[NUM_TEST] = { 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, - 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1}; + 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1}; int expected_map[NUM_TEST][48] = { {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 0 */ {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 1 */ @@ -548,6 +559,7 @@ main() {1, 1, 2, 1, 1, -1, -4, -1, -4, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 80 */ {1, 1, 2, 1, 1, -1, -4, -1, -4, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 81 */ {1, 1, 2, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 82 */ + {1, 1, 1, 2, 1, 1, -1, -4, -1, -4, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 1, 4, 1, 4}, /* 83 */ }; int t; int ext_t = 0; @@ -589,11 +601,11 @@ main() if (map[m] != expected_map[t][m]) return G2C_ERROR; -#define NUM_EXT_TEST 35 +#define NUM_EXT_TEST 36 int template[G2C_MAX_PDS_TEMPLATE_MAPLEN]; int expected_extlen[NUM_EXT_TEST] = { 2, 2, 6, 6, 6, 6, 6, 8, 8, 10, 10, 6, 6, 10, 6, 6, 12, 8, 2, 8, 2, 2, 30, 6, - 10, 20, 6, 6, 31, 34, 6, 6, 6, 6, 6}; + 10, 20, 6, 6, 31, 34, 6, 6, 6, 6, 6, 6}; int expected_ext[NUM_EXT_TEST][48] = { {1, 1}, /* 3 */ {1, 1}, /* 4 */ @@ -630,6 +642,7 @@ main() {1, 1, 1, 4, 1, 4}, /* 78 */ {1, 1, 1, 4, 1, 4}, /* 79 */ {1, 1, 1, 4, 1, 4}, /* 82 */ + {1, 1, 1, 4, 1, 4}, /* 83 */ }; if (needext) @@ -751,6 +764,9 @@ main() case 82: template[28] = 2; break; + case 83: + template[31] = 2; + break; default: return G2C_ERROR; } From 4d0818d2d54a1fceb6f254da2511f11971d9b266 Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Thu, 5 Dec 2024 11:40:33 -0800 Subject: [PATCH 35/80] pds 4.84 --- src/grib2.h.in | 2 +- src/pdstemplates.c | 22 ++++++++++++++++++++++ tests/tst_pdstemplates.c | 28 ++++++++++++++++++++++------ 3 files changed, 45 insertions(+), 7 deletions(-) diff --git a/src/grib2.h.in b/src/grib2.h.in index d0bf643e..5369b120 100644 --- a/src/grib2.h.in +++ b/src/grib2.h.in @@ -291,7 +291,7 @@ g2int g2_gribend(unsigned char *cgrib); /* Constants to help with templates. */ #define G2C_MAX_GDS_TEMPLATE 31 /**< Maximum number of grid templates. */ #define G2C_MAX_GDS_TEMPLATE_MAPLEN 28 /**< Maximum grid template map length. */ -#define G2C_MAX_PDS_TEMPLATE 67 /**< Maximum number of PDS templates. */ +#define G2C_MAX_PDS_TEMPLATE 68 /**< Maximum number of PDS templates. */ #define G2C_MAX_PDS_TEMPLATE_MAPLEN 45 /**< Maximum template map length. */ #define G2C_MAX_DRS_TEMPLATE 10 /**< Maximum number of DRS templates. */ #define G2C_MAX_DRS_TEMPLATE_MAPLEN 18 /**< Maximum DRS template map length. */ diff --git a/src/pdstemplates.c b/src/pdstemplates.c index 6109de0c..b4d8d56e 100644 --- a/src/pdstemplates.c +++ b/src/pdstemplates.c @@ -315,6 +315,11 @@ static const struct pdstemplate templatespds[G2C_MAX_PDS_TEMPLATE] = 4.83: Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for aerosol with source or sink */ {83, 40, 1, {1, 1, 1, 2, 1, 1, -1, -4, -1, -4, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 1, 4, 1, 4}}, + /** PDT 4.84 (12/04/2024) + 4.84: Average, accumulation, and/or extreme values or other statistically processed values + at a horizontal level or in a horizontal layer in a continuous + or non-continuous time interval for aerosol with source or sink */ + {84, 39, 1, {1, 1, 2, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}}, }; /** @@ -1071,6 +1076,23 @@ extpdstemplate(g2int number, g2int *list) } } } + /* PDT 4.84 (12/04/2024) */ + else if (number == 84) + { + if (list[31] > 1) + { + new->extlen = (list[31] - 1) * 6; + new->ext = malloc(sizeof(g2int) * new->extlen); + for (j = 2; j <= list[31]; j++) + { + l = (j - 2) * 6; + for (k = 0; k < 6; k++) + { + new->ext[l + k] = new->map[33 + k]; + } + } + } + } return new; } diff --git a/tests/tst_pdstemplates.c b/tests/tst_pdstemplates.c index 6ba106d8..8846d1a4 100644 --- a/tests/tst_pdstemplates.c +++ b/tests/tst_pdstemplates.c @@ -473,25 +473,36 @@ main() return G2C_ERROR; free(tmpl->ext); free(tmpl); + + /* Check for one that's there but does need an extension. */ + tmpl = extpdstemplate(84, list); + if (!tmpl) + return G2C_ERROR; + if (tmpl->num != 84 || tmpl->maplen != 39 || !tmpl->needext) + return G2C_ERROR; + if (!tmpl->ext) + return G2C_ERROR; + free(tmpl->ext); + free(tmpl); } printf("ok!\n"); printf("Testing all getpdstemplate() calls with extensions...\n"); { -#define NUM_TEST 67 +#define NUM_TEST 68 int number[NUM_TEST] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 20, 30, 31, 40, 41, 42, 43, 254, 1000, 1001, 1002, 1100, 1101, 32, 44, 45, 46, 47, 48, 50, 52, 51, 91, 33, 34, 53, 54, 57, 60, 61, 35, 49, 55, 58, 59, 62, 63, 67, 68, 70, - 71, 72, 73, 76, 77, 78, 79, 80, 81, 82, 83}; + 71, 72, 73, 76, 77, 78, 79, 80, 81, 82, 83, 84}; int expected_maplen[NUM_TEST] = { 15, 18, 17, 31, 30, 22, 16, 15, 29, 36, 30, 32, 31, 45, 44, 18, 19, 5, 5, 16, 19, 30, 33, 3, 9, 16, 15, 15, 22, 10, 21, 24, 35, 38, 26, 21, 15, 16, 36, 18, 32, 19, 22, 7, 24, 38, 6, 29, 21, 7, 24, 35, 38, 7, 7, 19, 21, 32, - 34, 17, 20, 31, 34, 27, 30, 36, 40}; + 34, 17, 20, 31, 34, 27, 30, 36, 40, 39}; int expected_needext[NUM_TEST] = { 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, - 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1}; + 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1}; int expected_map[NUM_TEST][48] = { {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 0 */ {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 1 */ @@ -560,6 +571,7 @@ main() {1, 1, 2, 1, 1, -1, -4, -1, -4, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 81 */ {1, 1, 2, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 82 */ {1, 1, 1, 2, 1, 1, -1, -4, -1, -4, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 1, 4, 1, 4}, /* 83 */ + {1, 1, 2, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 84 */ }; int t; int ext_t = 0; @@ -601,11 +613,11 @@ main() if (map[m] != expected_map[t][m]) return G2C_ERROR; -#define NUM_EXT_TEST 36 +#define NUM_EXT_TEST 37 int template[G2C_MAX_PDS_TEMPLATE_MAPLEN]; int expected_extlen[NUM_EXT_TEST] = { 2, 2, 6, 6, 6, 6, 6, 8, 8, 10, 10, 6, 6, 10, 6, 6, 12, 8, 2, 8, 2, 2, 30, 6, - 10, 20, 6, 6, 31, 34, 6, 6, 6, 6, 6, 6}; + 10, 20, 6, 6, 31, 34, 6, 6, 6, 6, 6, 6, 6}; int expected_ext[NUM_EXT_TEST][48] = { {1, 1}, /* 3 */ {1, 1}, /* 4 */ @@ -643,6 +655,7 @@ main() {1, 1, 1, 4, 1, 4}, /* 79 */ {1, 1, 1, 4, 1, 4}, /* 82 */ {1, 1, 1, 4, 1, 4}, /* 83 */ + {1, 1, 1, 4, 1, 4}, /* 84 */ }; if (needext) @@ -767,6 +780,9 @@ main() case 83: template[31] = 2; break; + case 84: + template[31] = 2; + break; default: return G2C_ERROR; } From 6a2a048653b63f7da9ace3821301c25f7b939ff1 Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Thu, 5 Dec 2024 11:48:59 -0800 Subject: [PATCH 36/80] pds 4.85 --- src/grib2.h.in | 2 +- src/pdstemplates.c | 21 +++++++++++++++++++++ tests/tst_pdstemplates.c | 28 ++++++++++++++++++++++------ 3 files changed, 44 insertions(+), 7 deletions(-) diff --git a/src/grib2.h.in b/src/grib2.h.in index 5369b120..41297411 100644 --- a/src/grib2.h.in +++ b/src/grib2.h.in @@ -291,7 +291,7 @@ g2int g2_gribend(unsigned char *cgrib); /* Constants to help with templates. */ #define G2C_MAX_GDS_TEMPLATE 31 /**< Maximum number of grid templates. */ #define G2C_MAX_GDS_TEMPLATE_MAPLEN 28 /**< Maximum grid template map length. */ -#define G2C_MAX_PDS_TEMPLATE 68 /**< Maximum number of PDS templates. */ +#define G2C_MAX_PDS_TEMPLATE 69 /**< Maximum number of PDS templates. */ #define G2C_MAX_PDS_TEMPLATE_MAPLEN 45 /**< Maximum template map length. */ #define G2C_MAX_DRS_TEMPLATE 10 /**< Maximum number of DRS templates. */ #define G2C_MAX_DRS_TEMPLATE_MAPLEN 18 /**< Maximum DRS template map length. */ diff --git a/src/pdstemplates.c b/src/pdstemplates.c index b4d8d56e..1a20d871 100644 --- a/src/pdstemplates.c +++ b/src/pdstemplates.c @@ -320,6 +320,10 @@ static const struct pdstemplate templatespds[G2C_MAX_PDS_TEMPLATE] = at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for aerosol with source or sink */ {84, 39, 1, {1, 1, 2, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}}, + /** PDT 4.85 (12/04/2024) + 4.85: Individual ensemble forecast, control and perturbed, at a horizontal level + or in a horizontal layer in a continuous or non-continuous time interval for aerosol */ + {85, 38, 1, {1, 1, 2, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}}, }; /** @@ -1093,6 +1097,23 @@ extpdstemplate(g2int number, g2int *list) } } } + /* PDT 4.85 (12/04/2024) */ + else if (number == 85) + { + if (list[30] > 1) + { + new->extlen = (list[30] - 1) * 6; + new->ext = malloc(sizeof(g2int) * new->extlen); + for (j = 2; j <= list[30]; j++) + { + l = (j - 2) * 6; + for (k = 0; k < 6; k++) + { + new->ext[l + k] = new->map[32 + k]; + } + } + } + } return new; } diff --git a/tests/tst_pdstemplates.c b/tests/tst_pdstemplates.c index 8846d1a4..06e3137e 100644 --- a/tests/tst_pdstemplates.c +++ b/tests/tst_pdstemplates.c @@ -484,25 +484,36 @@ main() return G2C_ERROR; free(tmpl->ext); free(tmpl); + + /* Check for one that's there but does need an extension. */ + tmpl = extpdstemplate(85, list); + if (!tmpl) + return G2C_ERROR; + if (tmpl->num != 85 || tmpl->maplen != 38 || !tmpl->needext) + return G2C_ERROR; + if (!tmpl->ext) + return G2C_ERROR; + free(tmpl->ext); + free(tmpl); } printf("ok!\n"); printf("Testing all getpdstemplate() calls with extensions...\n"); { -#define NUM_TEST 68 +#define NUM_TEST 69 int number[NUM_TEST] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 20, 30, 31, 40, 41, 42, 43, 254, 1000, 1001, 1002, 1100, 1101, 32, 44, 45, 46, 47, 48, 50, 52, 51, 91, 33, 34, 53, 54, 57, 60, 61, 35, 49, 55, 58, 59, 62, 63, 67, 68, 70, - 71, 72, 73, 76, 77, 78, 79, 80, 81, 82, 83, 84}; + 71, 72, 73, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85}; int expected_maplen[NUM_TEST] = { 15, 18, 17, 31, 30, 22, 16, 15, 29, 36, 30, 32, 31, 45, 44, 18, 19, 5, 5, 16, 19, 30, 33, 3, 9, 16, 15, 15, 22, 10, 21, 24, 35, 38, 26, 21, 15, 16, 36, 18, 32, 19, 22, 7, 24, 38, 6, 29, 21, 7, 24, 35, 38, 7, 7, 19, 21, 32, - 34, 17, 20, 31, 34, 27, 30, 36, 40, 39}; + 34, 17, 20, 31, 34, 27, 30, 36, 40, 39, 38}; int expected_needext[NUM_TEST] = { 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, - 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1}; + 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1}; int expected_map[NUM_TEST][48] = { {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 0 */ {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 1 */ @@ -572,6 +583,7 @@ main() {1, 1, 2, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 82 */ {1, 1, 1, 2, 1, 1, -1, -4, -1, -4, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 1, 4, 1, 4}, /* 83 */ {1, 1, 2, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 84 */ + {1, 1, 2, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 85 */ }; int t; int ext_t = 0; @@ -613,11 +625,11 @@ main() if (map[m] != expected_map[t][m]) return G2C_ERROR; -#define NUM_EXT_TEST 37 +#define NUM_EXT_TEST 38 int template[G2C_MAX_PDS_TEMPLATE_MAPLEN]; int expected_extlen[NUM_EXT_TEST] = { 2, 2, 6, 6, 6, 6, 6, 8, 8, 10, 10, 6, 6, 10, 6, 6, 12, 8, 2, 8, 2, 2, 30, 6, - 10, 20, 6, 6, 31, 34, 6, 6, 6, 6, 6, 6, 6}; + 10, 20, 6, 6, 31, 34, 6, 6, 6, 6, 6, 6, 6, 6}; int expected_ext[NUM_EXT_TEST][48] = { {1, 1}, /* 3 */ {1, 1}, /* 4 */ @@ -656,6 +668,7 @@ main() {1, 1, 1, 4, 1, 4}, /* 82 */ {1, 1, 1, 4, 1, 4}, /* 83 */ {1, 1, 1, 4, 1, 4}, /* 84 */ + {1, 1, 1, 4, 1, 4}, /* 85 */ }; if (needext) @@ -783,6 +796,9 @@ main() case 84: template[31] = 2; break; + case 85: + template[30] = 2; + break; default: return G2C_ERROR; } From 326f7c7251d91440a4ef6bcd0cb3165e822bb343 Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Thu, 5 Dec 2024 11:56:47 -0800 Subject: [PATCH 37/80] pds 4.86 --- src/grib2.h.in | 2 +- src/pdstemplates.c | 3 +++ tests/tst_pdstemplates.c | 9 +++++---- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/grib2.h.in b/src/grib2.h.in index 41297411..4f236418 100644 --- a/src/grib2.h.in +++ b/src/grib2.h.in @@ -291,7 +291,7 @@ g2int g2_gribend(unsigned char *cgrib); /* Constants to help with templates. */ #define G2C_MAX_GDS_TEMPLATE 31 /**< Maximum number of grid templates. */ #define G2C_MAX_GDS_TEMPLATE_MAPLEN 28 /**< Maximum grid template map length. */ -#define G2C_MAX_PDS_TEMPLATE 69 /**< Maximum number of PDS templates. */ +#define G2C_MAX_PDS_TEMPLATE 70 /**< Maximum number of PDS templates. */ #define G2C_MAX_PDS_TEMPLATE_MAPLEN 45 /**< Maximum template map length. */ #define G2C_MAX_DRS_TEMPLATE 10 /**< Maximum number of DRS templates. */ #define G2C_MAX_DRS_TEMPLATE_MAPLEN 18 /**< Maximum DRS template map length. */ diff --git a/src/pdstemplates.c b/src/pdstemplates.c index 1a20d871..f963963b 100644 --- a/src/pdstemplates.c +++ b/src/pdstemplates.c @@ -324,6 +324,9 @@ static const struct pdstemplate templatespds[G2C_MAX_PDS_TEMPLATE] = 4.85: Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for aerosol */ {85, 38, 1, {1, 1, 2, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}}, + /** PDT 4.86 (12/04/2024) + 4.86: Quantile forecasts at a horizontal level or in a horizontal layer at a point in time */ + {86, 17, 0, {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 2}}, }; /** diff --git a/tests/tst_pdstemplates.c b/tests/tst_pdstemplates.c index 06e3137e..ed8f112a 100644 --- a/tests/tst_pdstemplates.c +++ b/tests/tst_pdstemplates.c @@ -499,21 +499,21 @@ main() printf("ok!\n"); printf("Testing all getpdstemplate() calls with extensions...\n"); { -#define NUM_TEST 69 +#define NUM_TEST 70 int number[NUM_TEST] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 20, 30, 31, 40, 41, 42, 43, 254, 1000, 1001, 1002, 1100, 1101, 32, 44, 45, 46, 47, 48, 50, 52, 51, 91, 33, 34, 53, 54, 57, 60, 61, 35, 49, 55, 58, 59, 62, 63, 67, 68, 70, - 71, 72, 73, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85}; + 71, 72, 73, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86}; int expected_maplen[NUM_TEST] = { 15, 18, 17, 31, 30, 22, 16, 15, 29, 36, 30, 32, 31, 45, 44, 18, 19, 5, 5, 16, 19, 30, 33, 3, 9, 16, 15, 15, 22, 10, 21, 24, 35, 38, 26, 21, 15, 16, 36, 18, 32, 19, 22, 7, 24, 38, 6, 29, 21, 7, 24, 35, 38, 7, 7, 19, 21, 32, - 34, 17, 20, 31, 34, 27, 30, 36, 40, 39, 38}; + 34, 17, 20, 31, 34, 27, 30, 36, 40, 39, 38, 17}; int expected_needext[NUM_TEST] = { 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, - 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1}; + 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0}; int expected_map[NUM_TEST][48] = { {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 0 */ {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 1 */ @@ -584,6 +584,7 @@ main() {1, 1, 1, 2, 1, 1, -1, -4, -1, -4, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 1, 4, 1, 4}, /* 83 */ {1, 1, 2, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 84 */ {1, 1, 2, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 85 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 2}, /* 86 */ }; int t; int ext_t = 0; From dee75f80dc7438d413f4cd961454d2779aa303e9 Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Thu, 5 Dec 2024 11:59:38 -0800 Subject: [PATCH 38/80] format --- tests/tst_pdstemplates.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/tst_pdstemplates.c b/tests/tst_pdstemplates.c index ed8f112a..1b3cce2a 100644 --- a/tests/tst_pdstemplates.c +++ b/tests/tst_pdstemplates.c @@ -584,7 +584,7 @@ main() {1, 1, 1, 2, 1, 1, -1, -4, -1, -4, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 1, 4, 1, 4}, /* 83 */ {1, 1, 2, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 84 */ {1, 1, 2, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 85 */ - {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 2}, /* 86 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 2}, /* 86 */ }; int t; int ext_t = 0; From aaa2495ef88892ae31f94b7613a942b10511ce7f Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Thu, 5 Dec 2024 12:34:06 -0800 Subject: [PATCH 39/80] pds 4.87 --- src/grib2.h.in | 2 +- src/pdstemplates.c | 21 +++++++++++++++++++++ tests/tst_pdstemplates.c | 28 ++++++++++++++++++++++------ 3 files changed, 44 insertions(+), 7 deletions(-) diff --git a/src/grib2.h.in b/src/grib2.h.in index 4f236418..e1dc23e1 100644 --- a/src/grib2.h.in +++ b/src/grib2.h.in @@ -291,7 +291,7 @@ g2int g2_gribend(unsigned char *cgrib); /* Constants to help with templates. */ #define G2C_MAX_GDS_TEMPLATE 31 /**< Maximum number of grid templates. */ #define G2C_MAX_GDS_TEMPLATE_MAPLEN 28 /**< Maximum grid template map length. */ -#define G2C_MAX_PDS_TEMPLATE 70 /**< Maximum number of PDS templates. */ +#define G2C_MAX_PDS_TEMPLATE 71 /**< Maximum number of PDS templates. */ #define G2C_MAX_PDS_TEMPLATE_MAPLEN 45 /**< Maximum template map length. */ #define G2C_MAX_DRS_TEMPLATE 10 /**< Maximum number of DRS templates. */ #define G2C_MAX_DRS_TEMPLATE_MAPLEN 18 /**< Maximum DRS template map length. */ diff --git a/src/pdstemplates.c b/src/pdstemplates.c index f963963b..af974b86 100644 --- a/src/pdstemplates.c +++ b/src/pdstemplates.c @@ -327,6 +327,10 @@ static const struct pdstemplate templatespds[G2C_MAX_PDS_TEMPLATE] = /** PDT 4.86 (12/04/2024) 4.86: Quantile forecasts at a horizontal level or in a horizontal layer at a point in time */ {86, 17, 0, {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 2}}, + /** PDT 4.87 (12/04/2024) + 4.87: Quantile forecasts at a horizontal level or in a horizontal layer + in a continuous or non-continuous time interval */ + {87, 31, 1, {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 2, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}}, }; /** @@ -1117,6 +1121,23 @@ extpdstemplate(g2int number, g2int *list) } } } + /* PDT 4.87 (12/04/2024) */ + else if (number == 87) + { + if (list[23] > 1) + { + new->extlen = (list[23] - 1) * 6; + new->ext = malloc(sizeof(g2int) * new->extlen); + for (j = 2; j <= list[23]; j++) + { + l = (j - 2) * 6; + for (k = 0; k < 6; k++) + { + new->ext[l + k] = new->map[25 + k]; + } + } + } + } return new; } diff --git a/tests/tst_pdstemplates.c b/tests/tst_pdstemplates.c index 1b3cce2a..af2b78c2 100644 --- a/tests/tst_pdstemplates.c +++ b/tests/tst_pdstemplates.c @@ -495,25 +495,36 @@ main() return G2C_ERROR; free(tmpl->ext); free(tmpl); + + /* Check for one that's there but does need an extension. */ + tmpl = extpdstemplate(87, list); + if (!tmpl) + return G2C_ERROR; + if (tmpl->num != 87 || tmpl->maplen != 31 || !tmpl->needext) + return G2C_ERROR; + if (!tmpl->ext) + return G2C_ERROR; + free(tmpl->ext); + free(tmpl); } printf("ok!\n"); printf("Testing all getpdstemplate() calls with extensions...\n"); { -#define NUM_TEST 70 +#define NUM_TEST 71 int number[NUM_TEST] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 20, 30, 31, 40, 41, 42, 43, 254, 1000, 1001, 1002, 1100, 1101, 32, 44, 45, 46, 47, 48, 50, 52, 51, 91, 33, 34, 53, 54, 57, 60, 61, 35, 49, 55, 58, 59, 62, 63, 67, 68, 70, - 71, 72, 73, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86}; + 71, 72, 73, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87}; int expected_maplen[NUM_TEST] = { 15, 18, 17, 31, 30, 22, 16, 15, 29, 36, 30, 32, 31, 45, 44, 18, 19, 5, 5, 16, 19, 30, 33, 3, 9, 16, 15, 15, 22, 10, 21, 24, 35, 38, 26, 21, 15, 16, 36, 18, 32, 19, 22, 7, 24, 38, 6, 29, 21, 7, 24, 35, 38, 7, 7, 19, 21, 32, - 34, 17, 20, 31, 34, 27, 30, 36, 40, 39, 38, 17}; + 34, 17, 20, 31, 34, 27, 30, 36, 40, 39, 38, 17, 31}; int expected_needext[NUM_TEST] = { 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, - 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0}; + 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1}; int expected_map[NUM_TEST][48] = { {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 0 */ {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 1 */ @@ -585,6 +596,7 @@ main() {1, 1, 2, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 84 */ {1, 1, 2, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 85 */ {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 2}, /* 86 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 2, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 87 */ }; int t; int ext_t = 0; @@ -626,11 +638,11 @@ main() if (map[m] != expected_map[t][m]) return G2C_ERROR; -#define NUM_EXT_TEST 38 +#define NUM_EXT_TEST 39 int template[G2C_MAX_PDS_TEMPLATE_MAPLEN]; int expected_extlen[NUM_EXT_TEST] = { 2, 2, 6, 6, 6, 6, 6, 8, 8, 10, 10, 6, 6, 10, 6, 6, 12, 8, 2, 8, 2, 2, 30, 6, - 10, 20, 6, 6, 31, 34, 6, 6, 6, 6, 6, 6, 6, 6}; + 10, 20, 6, 6, 31, 34, 6, 6, 6, 6, 6, 6, 6, 6, 6}; int expected_ext[NUM_EXT_TEST][48] = { {1, 1}, /* 3 */ {1, 1}, /* 4 */ @@ -670,6 +682,7 @@ main() {1, 1, 1, 4, 1, 4}, /* 83 */ {1, 1, 1, 4, 1, 4}, /* 84 */ {1, 1, 1, 4, 1, 4}, /* 85 */ + {1, 1, 1, 4, 1, 4}, /* 87 */ }; if (needext) @@ -800,6 +813,9 @@ main() case 85: template[30] = 2; break; + case 87: + template[23] = 2; + break; default: return G2C_ERROR; } From e2aa1afc09d61ba7f87cb6dd6a2c68e670f5804a Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Thu, 5 Dec 2024 12:45:16 -0800 Subject: [PATCH 40/80] pds 4.88 --- src/grib2.h.in | 2 +- src/pdstemplates.c | 20 ++++++++++++++++++++ tests/tst_pdstemplates.c | 28 ++++++++++++++++++++++------ 3 files changed, 43 insertions(+), 7 deletions(-) diff --git a/src/grib2.h.in b/src/grib2.h.in index e1dc23e1..5b94aa5c 100644 --- a/src/grib2.h.in +++ b/src/grib2.h.in @@ -291,7 +291,7 @@ g2int g2_gribend(unsigned char *cgrib); /* Constants to help with templates. */ #define G2C_MAX_GDS_TEMPLATE 31 /**< Maximum number of grid templates. */ #define G2C_MAX_GDS_TEMPLATE_MAPLEN 28 /**< Maximum grid template map length. */ -#define G2C_MAX_PDS_TEMPLATE 71 /**< Maximum number of PDS templates. */ +#define G2C_MAX_PDS_TEMPLATE 72 /**< Maximum number of PDS templates. */ #define G2C_MAX_PDS_TEMPLATE_MAPLEN 45 /**< Maximum template map length. */ #define G2C_MAX_DRS_TEMPLATE 10 /**< Maximum number of DRS templates. */ #define G2C_MAX_DRS_TEMPLATE_MAPLEN 18 /**< Maximum DRS template map length. */ diff --git a/src/pdstemplates.c b/src/pdstemplates.c index af974b86..57a9ff94 100644 --- a/src/pdstemplates.c +++ b/src/pdstemplates.c @@ -331,6 +331,9 @@ static const struct pdstemplate templatespds[G2C_MAX_PDS_TEMPLATE] = 4.87: Quantile forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval */ {87, 31, 1, {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 2, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}}, + /** PDT 4.88 (12/04/2024) + 4.88: Analysis or forecast at a horizontal level or in a horizontal layer at a specified local time */ + {88, 24, 1, {1, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}}, }; /** @@ -1138,6 +1141,23 @@ extpdstemplate(g2int number, g2int *list) } } } + /* PDT 4.88 (12/04/2024) */ + else if (number == 88) + { + if (list[12] > 1) + { + new->extlen = (list[12] - 1) * 11; + new->ext = malloc(sizeof(g2int) * new->extlen); + for (j = 2; j <= list[12]; j++) + { + l = (j - 2) * 11; + for (k = 0; k < 11; k++) + { + new->ext[l + k] = new->map[13 + k]; + } + } + } + } return new; } diff --git a/tests/tst_pdstemplates.c b/tests/tst_pdstemplates.c index af2b78c2..be037e79 100644 --- a/tests/tst_pdstemplates.c +++ b/tests/tst_pdstemplates.c @@ -506,25 +506,36 @@ main() return G2C_ERROR; free(tmpl->ext); free(tmpl); + + /* Check for one that's there but does need an extension. */ + tmpl = extpdstemplate(88, list); + if (!tmpl) + return G2C_ERROR; + if (tmpl->num != 88 || tmpl->maplen != 24 || !tmpl->needext) + return G2C_ERROR; + if (!tmpl->ext) + return G2C_ERROR; + free(tmpl->ext); + free(tmpl); } printf("ok!\n"); printf("Testing all getpdstemplate() calls with extensions...\n"); { -#define NUM_TEST 71 +#define NUM_TEST 72 int number[NUM_TEST] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 20, 30, 31, 40, 41, 42, 43, 254, 1000, 1001, 1002, 1100, 1101, 32, 44, 45, 46, 47, 48, 50, 52, 51, 91, 33, 34, 53, 54, 57, 60, 61, 35, 49, 55, 58, 59, 62, 63, 67, 68, 70, - 71, 72, 73, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87}; + 71, 72, 73, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88}; int expected_maplen[NUM_TEST] = { 15, 18, 17, 31, 30, 22, 16, 15, 29, 36, 30, 32, 31, 45, 44, 18, 19, 5, 5, 16, 19, 30, 33, 3, 9, 16, 15, 15, 22, 10, 21, 24, 35, 38, 26, 21, 15, 16, 36, 18, 32, 19, 22, 7, 24, 38, 6, 29, 21, 7, 24, 35, 38, 7, 7, 19, 21, 32, - 34, 17, 20, 31, 34, 27, 30, 36, 40, 39, 38, 17, 31}; + 34, 17, 20, 31, 34, 27, 30, 36, 40, 39, 38, 17, 31, 24}; int expected_needext[NUM_TEST] = { 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, - 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1}; + 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1}; int expected_map[NUM_TEST][48] = { {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 0 */ {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 1 */ @@ -597,6 +608,7 @@ main() {1, 1, 2, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 85 */ {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 2}, /* 86 */ {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 2, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 87 */ + {1, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 88 */ }; int t; int ext_t = 0; @@ -638,11 +650,11 @@ main() if (map[m] != expected_map[t][m]) return G2C_ERROR; -#define NUM_EXT_TEST 39 +#define NUM_EXT_TEST 40 int template[G2C_MAX_PDS_TEMPLATE_MAPLEN]; int expected_extlen[NUM_EXT_TEST] = { 2, 2, 6, 6, 6, 6, 6, 8, 8, 10, 10, 6, 6, 10, 6, 6, 12, 8, 2, 8, 2, 2, 30, 6, - 10, 20, 6, 6, 31, 34, 6, 6, 6, 6, 6, 6, 6, 6, 6}; + 10, 20, 6, 6, 31, 34, 6, 6, 6, 6, 6, 6, 6, 6, 6, 11}; int expected_ext[NUM_EXT_TEST][48] = { {1, 1}, /* 3 */ {1, 1}, /* 4 */ @@ -683,6 +695,7 @@ main() {1, 1, 1, 4, 1, 4}, /* 84 */ {1, 1, 1, 4, 1, 4}, /* 85 */ {1, 1, 1, 4, 1, 4}, /* 87 */ + {2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 88 */ }; if (needext) @@ -816,6 +829,9 @@ main() case 87: template[23] = 2; break; + case 88: + template[12] = 2; + break; default: return G2C_ERROR; } From 880468a2e45f4df7a603e9303f4d33a67f7db2bc Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Thu, 5 Dec 2024 12:54:58 -0800 Subject: [PATCH 41/80] pds 4.89 --- src/grib2.h.in | 2 +- src/pdstemplates.c | 3 +++ tests/tst_pdstemplates.c | 9 +++++---- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/grib2.h.in b/src/grib2.h.in index 5b94aa5c..a7fc6492 100644 --- a/src/grib2.h.in +++ b/src/grib2.h.in @@ -291,7 +291,7 @@ g2int g2_gribend(unsigned char *cgrib); /* Constants to help with templates. */ #define G2C_MAX_GDS_TEMPLATE 31 /**< Maximum number of grid templates. */ #define G2C_MAX_GDS_TEMPLATE_MAPLEN 28 /**< Maximum grid template map length. */ -#define G2C_MAX_PDS_TEMPLATE 72 /**< Maximum number of PDS templates. */ +#define G2C_MAX_PDS_TEMPLATE 73 /**< Maximum number of PDS templates. */ #define G2C_MAX_PDS_TEMPLATE_MAPLEN 45 /**< Maximum template map length. */ #define G2C_MAX_DRS_TEMPLATE 10 /**< Maximum number of DRS templates. */ #define G2C_MAX_DRS_TEMPLATE_MAPLEN 18 /**< Maximum DRS template map length. */ diff --git a/src/pdstemplates.c b/src/pdstemplates.c index 57a9ff94..ae18b531 100644 --- a/src/pdstemplates.c +++ b/src/pdstemplates.c @@ -334,6 +334,9 @@ static const struct pdstemplate templatespds[G2C_MAX_PDS_TEMPLATE] = /** PDT 4.88 (12/04/2024) 4.88: Analysis or forecast at a horizontal level or in a horizontal layer at a specified local time */ {88, 24, 1, {1, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}}, + /** PDT 4.89 (12/04/2024) + 4.89: Post-processed quantile forecasts at a horizontal level or in a horizontal layer at a point in time */ + {89, 20, 0, {1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 2}}, }; /** diff --git a/tests/tst_pdstemplates.c b/tests/tst_pdstemplates.c index be037e79..b29f1dc8 100644 --- a/tests/tst_pdstemplates.c +++ b/tests/tst_pdstemplates.c @@ -521,21 +521,21 @@ main() printf("ok!\n"); printf("Testing all getpdstemplate() calls with extensions...\n"); { -#define NUM_TEST 72 +#define NUM_TEST 73 int number[NUM_TEST] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 20, 30, 31, 40, 41, 42, 43, 254, 1000, 1001, 1002, 1100, 1101, 32, 44, 45, 46, 47, 48, 50, 52, 51, 91, 33, 34, 53, 54, 57, 60, 61, 35, 49, 55, 58, 59, 62, 63, 67, 68, 70, - 71, 72, 73, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88}; + 71, 72, 73, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89}; int expected_maplen[NUM_TEST] = { 15, 18, 17, 31, 30, 22, 16, 15, 29, 36, 30, 32, 31, 45, 44, 18, 19, 5, 5, 16, 19, 30, 33, 3, 9, 16, 15, 15, 22, 10, 21, 24, 35, 38, 26, 21, 15, 16, 36, 18, 32, 19, 22, 7, 24, 38, 6, 29, 21, 7, 24, 35, 38, 7, 7, 19, 21, 32, - 34, 17, 20, 31, 34, 27, 30, 36, 40, 39, 38, 17, 31, 24}; + 34, 17, 20, 31, 34, 27, 30, 36, 40, 39, 38, 17, 31, 24, 20}; int expected_needext[NUM_TEST] = { 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, - 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1}; + 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0}; int expected_map[NUM_TEST][48] = { {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 0 */ {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 1 */ @@ -609,6 +609,7 @@ main() {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 2}, /* 86 */ {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 2, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 87 */ {1, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 88 */ + {1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 2}, /* 89 */ }; int t; int ext_t = 0; From 1b1d9fafe546af9f18583403bb9055d535705852 Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Thu, 5 Dec 2024 13:05:16 -0800 Subject: [PATCH 42/80] pds 4.90 --- src/grib2.h.in | 2 +- src/pdstemplates.c | 21 +++++++++++++++++++++ tests/tst_pdstemplates.c | 28 ++++++++++++++++++++++------ 3 files changed, 44 insertions(+), 7 deletions(-) diff --git a/src/grib2.h.in b/src/grib2.h.in index a7fc6492..08aae39b 100644 --- a/src/grib2.h.in +++ b/src/grib2.h.in @@ -291,7 +291,7 @@ g2int g2_gribend(unsigned char *cgrib); /* Constants to help with templates. */ #define G2C_MAX_GDS_TEMPLATE 31 /**< Maximum number of grid templates. */ #define G2C_MAX_GDS_TEMPLATE_MAPLEN 28 /**< Maximum grid template map length. */ -#define G2C_MAX_PDS_TEMPLATE 73 /**< Maximum number of PDS templates. */ +#define G2C_MAX_PDS_TEMPLATE 74 /**< Maximum number of PDS templates. */ #define G2C_MAX_PDS_TEMPLATE_MAPLEN 45 /**< Maximum template map length. */ #define G2C_MAX_DRS_TEMPLATE 10 /**< Maximum number of DRS templates. */ #define G2C_MAX_DRS_TEMPLATE_MAPLEN 18 /**< Maximum DRS template map length. */ diff --git a/src/pdstemplates.c b/src/pdstemplates.c index ae18b531..6b1a3909 100644 --- a/src/pdstemplates.c +++ b/src/pdstemplates.c @@ -337,6 +337,10 @@ static const struct pdstemplate templatespds[G2C_MAX_PDS_TEMPLATE] = /** PDT 4.89 (12/04/2024) 4.89: Post-processed quantile forecasts at a horizontal level or in a horizontal layer at a point in time */ {89, 20, 0, {1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 2}}, + /** PDT 4.90 (12/04/2024) + 4.90: Post-processed quantile forecasts at a horizontal level or in a horizontal layer in a continuous + or non-continuous time interval */ + {90, 34, 1, {1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 2, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}}, }; /** @@ -1161,6 +1165,23 @@ extpdstemplate(g2int number, g2int *list) } } } + /* PDT 4.90 (12/04/2024) */ + else if (number == 90) + { + if (list[26] > 1) + { + new->extlen = (list[26] - 1) * 6; + new->ext = malloc(sizeof(g2int) * new->extlen); + for (j = 2; j <= list[26]; j++) + { + l = (j - 2) * 6; + for (k = 0; k < 6; k++) + { + new->ext[l + k] = new->map[28 + k]; + } + } + } + } return new; } diff --git a/tests/tst_pdstemplates.c b/tests/tst_pdstemplates.c index b29f1dc8..fddbeb63 100644 --- a/tests/tst_pdstemplates.c +++ b/tests/tst_pdstemplates.c @@ -517,25 +517,36 @@ main() return G2C_ERROR; free(tmpl->ext); free(tmpl); + + /* Check for one that's there but does need an extension. */ + tmpl = extpdstemplate(90, list); + if (!tmpl) + return G2C_ERROR; + if (tmpl->num != 90 || tmpl->maplen != 34 || !tmpl->needext) + return G2C_ERROR; + if (!tmpl->ext) + return G2C_ERROR; + free(tmpl->ext); + free(tmpl); } printf("ok!\n"); printf("Testing all getpdstemplate() calls with extensions...\n"); { -#define NUM_TEST 73 +#define NUM_TEST 74 int number[NUM_TEST] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 20, 30, 31, 40, 41, 42, 43, 254, 1000, 1001, 1002, 1100, 1101, 32, 44, 45, 46, 47, 48, 50, 52, 51, 91, 33, 34, 53, 54, 57, 60, 61, 35, 49, 55, 58, 59, 62, 63, 67, 68, 70, - 71, 72, 73, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89}; + 71, 72, 73, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90}; int expected_maplen[NUM_TEST] = { 15, 18, 17, 31, 30, 22, 16, 15, 29, 36, 30, 32, 31, 45, 44, 18, 19, 5, 5, 16, 19, 30, 33, 3, 9, 16, 15, 15, 22, 10, 21, 24, 35, 38, 26, 21, 15, 16, 36, 18, 32, 19, 22, 7, 24, 38, 6, 29, 21, 7, 24, 35, 38, 7, 7, 19, 21, 32, - 34, 17, 20, 31, 34, 27, 30, 36, 40, 39, 38, 17, 31, 24, 20}; + 34, 17, 20, 31, 34, 27, 30, 36, 40, 39, 38, 17, 31, 24, 20, 34}; int expected_needext[NUM_TEST] = { 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, - 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0}; + 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1}; int expected_map[NUM_TEST][48] = { {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 0 */ {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 1 */ @@ -610,6 +621,7 @@ main() {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 2, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 87 */ {1, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 88 */ {1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 2}, /* 89 */ + {1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, 4, 1, -1, -4, 2, 2, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 90 */ }; int t; int ext_t = 0; @@ -651,11 +663,11 @@ main() if (map[m] != expected_map[t][m]) return G2C_ERROR; -#define NUM_EXT_TEST 40 +#define NUM_EXT_TEST 41 int template[G2C_MAX_PDS_TEMPLATE_MAPLEN]; int expected_extlen[NUM_EXT_TEST] = { 2, 2, 6, 6, 6, 6, 6, 8, 8, 10, 10, 6, 6, 10, 6, 6, 12, 8, 2, 8, 2, 2, 30, 6, - 10, 20, 6, 6, 31, 34, 6, 6, 6, 6, 6, 6, 6, 6, 6, 11}; + 10, 20, 6, 6, 31, 34, 6, 6, 6, 6, 6, 6, 6, 6, 6, 11, 6}; int expected_ext[NUM_EXT_TEST][48] = { {1, 1}, /* 3 */ {1, 1}, /* 4 */ @@ -697,6 +709,7 @@ main() {1, 1, 1, 4, 1, 4}, /* 85 */ {1, 1, 1, 4, 1, 4}, /* 87 */ {2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 88 */ + {1, 1, 1, 4, 1, 4}, /* 90 */ }; if (needext) @@ -833,6 +846,9 @@ main() case 88: template[12] = 2; break; + case 90: + template[26] = 2; + break; default: return G2C_ERROR; } From 6da7259e8d54c2ce60ef0bfc8db30995415988a9 Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Thu, 5 Dec 2024 13:07:53 -0800 Subject: [PATCH 43/80] Update tst_pdstemplates.c --- tests/tst_pdstemplates.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/tst_pdstemplates.c b/tests/tst_pdstemplates.c index fddbeb63..9e9d0286 100644 --- a/tests/tst_pdstemplates.c +++ b/tests/tst_pdstemplates.c @@ -621,7 +621,7 @@ main() {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 2, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 87 */ {1, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 88 */ {1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 2}, /* 89 */ - {1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, 4, 1, -1, -4, 2, 2, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 90 */ + {1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 2, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 90 */ }; int t; int ext_t = 0; From 9945e5386451af86b1a4b12b49abd061a6dd2282 Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Thu, 5 Dec 2024 13:23:58 -0800 Subject: [PATCH 44/80] pds 4.92 --- src/grib2.h.in | 2 +- src/pdstemplates.c | 21 +++++++++++++++++++++ tests/tst_pdstemplates.c | 28 ++++++++++++++++++++++------ 3 files changed, 44 insertions(+), 7 deletions(-) diff --git a/src/grib2.h.in b/src/grib2.h.in index 08aae39b..e585e35b 100644 --- a/src/grib2.h.in +++ b/src/grib2.h.in @@ -291,7 +291,7 @@ g2int g2_gribend(unsigned char *cgrib); /* Constants to help with templates. */ #define G2C_MAX_GDS_TEMPLATE 31 /**< Maximum number of grid templates. */ #define G2C_MAX_GDS_TEMPLATE_MAPLEN 28 /**< Maximum grid template map length. */ -#define G2C_MAX_PDS_TEMPLATE 74 /**< Maximum number of PDS templates. */ +#define G2C_MAX_PDS_TEMPLATE 75 /**< Maximum number of PDS templates. */ #define G2C_MAX_PDS_TEMPLATE_MAPLEN 45 /**< Maximum template map length. */ #define G2C_MAX_DRS_TEMPLATE 10 /**< Maximum number of DRS templates. */ #define G2C_MAX_DRS_TEMPLATE_MAPLEN 18 /**< Maximum DRS template map length. */ diff --git a/src/pdstemplates.c b/src/pdstemplates.c index 6b1a3909..399ef850 100644 --- a/src/pdstemplates.c +++ b/src/pdstemplates.c @@ -341,6 +341,10 @@ static const struct pdstemplate templatespds[G2C_MAX_PDS_TEMPLATE] = 4.90: Post-processed quantile forecasts at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval */ {90, 34, 1, {1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 2, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}}, + /** PDT 4.92 (12/04/2024) + 4.92: Individual ensemble forecast, control and perturbed, at a horizontal + level or in a horizontal layer at a specified local time. */ + {92, 27, 1, {1, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}}, }; /** @@ -1182,6 +1186,23 @@ extpdstemplate(g2int number, g2int *list) } } } + /* PDT 4.92 (12/04/2024) */ + else if (number == 92) + { + if (list[15] > 1) + { + new->extlen = (list[15] - 1) * 11; + new->ext = malloc(sizeof(g2int) * new->extlen); + for (j = 2; j <= list[15]; j++) + { + l = (j - 2) * 11; + for (k = 0; k < 11; k++) + { + new->ext[l + k] = new->map[16 + k]; + } + } + } + } return new; } diff --git a/tests/tst_pdstemplates.c b/tests/tst_pdstemplates.c index 9e9d0286..88d7257a 100644 --- a/tests/tst_pdstemplates.c +++ b/tests/tst_pdstemplates.c @@ -528,25 +528,36 @@ main() return G2C_ERROR; free(tmpl->ext); free(tmpl); + + /* Check for one that's there but does need an extension. */ + tmpl = extpdstemplate(92, list); + if (!tmpl) + return G2C_ERROR; + if (tmpl->num != 92 || tmpl->maplen != 27 || !tmpl->needext) + return G2C_ERROR; + if (!tmpl->ext) + return G2C_ERROR; + free(tmpl->ext); + free(tmpl); } printf("ok!\n"); printf("Testing all getpdstemplate() calls with extensions...\n"); { -#define NUM_TEST 74 +#define NUM_TEST 75 int number[NUM_TEST] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 20, 30, 31, 40, 41, 42, 43, 254, 1000, 1001, 1002, 1100, 1101, 32, 44, 45, 46, 47, 48, 50, 52, 51, 91, 33, 34, 53, 54, 57, 60, 61, 35, 49, 55, 58, 59, 62, 63, 67, 68, 70, - 71, 72, 73, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90}; + 71, 72, 73, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 92}; int expected_maplen[NUM_TEST] = { 15, 18, 17, 31, 30, 22, 16, 15, 29, 36, 30, 32, 31, 45, 44, 18, 19, 5, 5, 16, 19, 30, 33, 3, 9, 16, 15, 15, 22, 10, 21, 24, 35, 38, 26, 21, 15, 16, 36, 18, 32, 19, 22, 7, 24, 38, 6, 29, 21, 7, 24, 35, 38, 7, 7, 19, 21, 32, - 34, 17, 20, 31, 34, 27, 30, 36, 40, 39, 38, 17, 31, 24, 20, 34}; + 34, 17, 20, 31, 34, 27, 30, 36, 40, 39, 38, 17, 31, 24, 20, 34, 27}; int expected_needext[NUM_TEST] = { 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, - 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1}; + 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1}; int expected_map[NUM_TEST][48] = { {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 0 */ {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 1 */ @@ -622,6 +633,7 @@ main() {1, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 88 */ {1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 2}, /* 89 */ {1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 2, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 90 */ + {1, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 92 */ }; int t; int ext_t = 0; @@ -663,11 +675,11 @@ main() if (map[m] != expected_map[t][m]) return G2C_ERROR; -#define NUM_EXT_TEST 41 +#define NUM_EXT_TEST 42 int template[G2C_MAX_PDS_TEMPLATE_MAPLEN]; int expected_extlen[NUM_EXT_TEST] = { 2, 2, 6, 6, 6, 6, 6, 8, 8, 10, 10, 6, 6, 10, 6, 6, 12, 8, 2, 8, 2, 2, 30, 6, - 10, 20, 6, 6, 31, 34, 6, 6, 6, 6, 6, 6, 6, 6, 6, 11, 6}; + 10, 20, 6, 6, 31, 34, 6, 6, 6, 6, 6, 6, 6, 6, 6, 11, 6, 11}; int expected_ext[NUM_EXT_TEST][48] = { {1, 1}, /* 3 */ {1, 1}, /* 4 */ @@ -710,6 +722,7 @@ main() {1, 1, 1, 4, 1, 4}, /* 87 */ {2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 88 */ {1, 1, 1, 4, 1, 4}, /* 90 */ + {2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 92 */ }; if (needext) @@ -849,6 +862,9 @@ main() case 90: template[26] = 2; break; + case 92: + template[15] = 2; + break; default: return G2C_ERROR; } From bc459561fca672c0d8e9d6bedf85b2c0c1662c2e Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Thu, 5 Dec 2024 13:30:05 -0800 Subject: [PATCH 45/80] pds 4.93 --- src/grib2.h.in | 2 +- src/pdstemplates.c | 20 ++++++++++++++++++++ tests/tst_pdstemplates.c | 30 ++++++++++++++++++++++++------ 3 files changed, 45 insertions(+), 7 deletions(-) diff --git a/src/grib2.h.in b/src/grib2.h.in index e585e35b..3196e960 100644 --- a/src/grib2.h.in +++ b/src/grib2.h.in @@ -291,7 +291,7 @@ g2int g2_gribend(unsigned char *cgrib); /* Constants to help with templates. */ #define G2C_MAX_GDS_TEMPLATE 31 /**< Maximum number of grid templates. */ #define G2C_MAX_GDS_TEMPLATE_MAPLEN 28 /**< Maximum grid template map length. */ -#define G2C_MAX_PDS_TEMPLATE 75 /**< Maximum number of PDS templates. */ +#define G2C_MAX_PDS_TEMPLATE 76 /**< Maximum number of PDS templates. */ #define G2C_MAX_PDS_TEMPLATE_MAPLEN 45 /**< Maximum template map length. */ #define G2C_MAX_DRS_TEMPLATE 10 /**< Maximum number of DRS templates. */ #define G2C_MAX_DRS_TEMPLATE_MAPLEN 18 /**< Maximum DRS template map length. */ diff --git a/src/pdstemplates.c b/src/pdstemplates.c index 399ef850..333955c3 100644 --- a/src/pdstemplates.c +++ b/src/pdstemplates.c @@ -345,6 +345,9 @@ static const struct pdstemplate templatespds[G2C_MAX_PDS_TEMPLATE] = 4.92: Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a specified local time. */ {92, 27, 1, {1, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}}, + /** PDT 4.93 (12/04/2024) + 4.93: Post-processing analysis or forecast at a horizontal level or in a horizontal layer at a specified local time */ + {93, 27, 1, {1, 1, 2, 2, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}}, }; /** @@ -1203,6 +1206,23 @@ extpdstemplate(g2int number, g2int *list) } } } + /* PDT 4.93 (12/04/2024) */ + else if (number == 93) + { + if (list[15] > 1) + { + new->extlen = (list[15] - 1) * 11; + new->ext = malloc(sizeof(g2int) * new->extlen); + for (j = 2; j <= list[15]; j++) + { + l = (j - 2) * 11; + for (k = 0; k < 11; k++) + { + new->ext[l + k] = new->map[16 + k]; + } + } + } + } return new; } diff --git a/tests/tst_pdstemplates.c b/tests/tst_pdstemplates.c index 88d7257a..cf8a3508 100644 --- a/tests/tst_pdstemplates.c +++ b/tests/tst_pdstemplates.c @@ -539,25 +539,38 @@ main() return G2C_ERROR; free(tmpl->ext); free(tmpl); + + /* Check for one that's there but does need an extension. */ + tmpl = extpdstemplate(93, list); + if (!tmpl) + return G2C_ERROR; + if (tmpl->num != 93 || tmpl->maplen != 27 || !tmpl->needext) + return G2C_ERROR; + if (!tmpl->ext) + return G2C_ERROR; + free(tmpl->ext); + free(tmpl); } printf("ok!\n"); printf("Testing all getpdstemplate() calls with extensions...\n"); { -#define NUM_TEST 75 +#define NUM_TEST 76 int number[NUM_TEST] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 20, 30, 31, 40, 41, 42, 43, 254, 1000, 1001, 1002, 1100, 1101, 32, 44, 45, 46, 47, 48, 50, 52, 51, 91, 33, 34, 53, 54, 57, 60, 61, 35, 49, 55, 58, 59, 62, 63, 67, 68, 70, - 71, 72, 73, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 92}; + 71, 72, 73, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 92, + 93}; int expected_maplen[NUM_TEST] = { 15, 18, 17, 31, 30, 22, 16, 15, 29, 36, 30, 32, 31, 45, 44, 18, 19, 5, 5, 16, 19, 30, 33, 3, 9, 16, 15, 15, 22, 10, 21, 24, 35, 38, 26, 21, 15, 16, 36, 18, 32, 19, 22, 7, 24, 38, 6, 29, 21, 7, 24, 35, 38, 7, 7, 19, 21, 32, - 34, 17, 20, 31, 34, 27, 30, 36, 40, 39, 38, 17, 31, 24, 20, 34, 27}; + 34, 17, 20, 31, 34, 27, 30, 36, 40, 39, 38, 17, 31, 24, 20, 34, 27, 27}; int expected_needext[NUM_TEST] = { 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, - 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1}; + 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, + 1}; int expected_map[NUM_TEST][48] = { {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 0 */ {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 1 */ @@ -634,6 +647,7 @@ main() {1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 2}, /* 89 */ {1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 2, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 90 */ {1, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 92 */ + {1, 1, 2, 2, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 93 */ }; int t; int ext_t = 0; @@ -675,11 +689,11 @@ main() if (map[m] != expected_map[t][m]) return G2C_ERROR; -#define NUM_EXT_TEST 42 +#define NUM_EXT_TEST 43 int template[G2C_MAX_PDS_TEMPLATE_MAPLEN]; int expected_extlen[NUM_EXT_TEST] = { 2, 2, 6, 6, 6, 6, 6, 8, 8, 10, 10, 6, 6, 10, 6, 6, 12, 8, 2, 8, 2, 2, 30, 6, - 10, 20, 6, 6, 31, 34, 6, 6, 6, 6, 6, 6, 6, 6, 6, 11, 6, 11}; + 10, 20, 6, 6, 31, 34, 6, 6, 6, 6, 6, 6, 6, 6, 6, 11, 6, 11, 11}; int expected_ext[NUM_EXT_TEST][48] = { {1, 1}, /* 3 */ {1, 1}, /* 4 */ @@ -723,6 +737,7 @@ main() {2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 88 */ {1, 1, 1, 4, 1, 4}, /* 90 */ {2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 92 */ + {2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 93 */ }; if (needext) @@ -865,6 +880,9 @@ main() case 92: template[15] = 2; break; + case 93: + template[15] = 2; + break; default: return G2C_ERROR; } From 7a17df30c5fea2e3c7466abeccafe1a1b5e09503 Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Thu, 5 Dec 2024 13:38:03 -0800 Subject: [PATCH 46/80] pds 4.94 --- src/grib2.h.in | 2 +- src/pdstemplates.c | 20 ++++++++++++++++++++ tests/tst_pdstemplates.c | 28 ++++++++++++++++++++++------ 3 files changed, 43 insertions(+), 7 deletions(-) diff --git a/src/grib2.h.in b/src/grib2.h.in index 3196e960..231ab726 100644 --- a/src/grib2.h.in +++ b/src/grib2.h.in @@ -291,7 +291,7 @@ g2int g2_gribend(unsigned char *cgrib); /* Constants to help with templates. */ #define G2C_MAX_GDS_TEMPLATE 31 /**< Maximum number of grid templates. */ #define G2C_MAX_GDS_TEMPLATE_MAPLEN 28 /**< Maximum grid template map length. */ -#define G2C_MAX_PDS_TEMPLATE 76 /**< Maximum number of PDS templates. */ +#define G2C_MAX_PDS_TEMPLATE 77 /**< Maximum number of PDS templates. */ #define G2C_MAX_PDS_TEMPLATE_MAPLEN 45 /**< Maximum template map length. */ #define G2C_MAX_DRS_TEMPLATE 10 /**< Maximum number of DRS templates. */ #define G2C_MAX_DRS_TEMPLATE_MAPLEN 18 /**< Maximum DRS template map length. */ diff --git a/src/pdstemplates.c b/src/pdstemplates.c index 333955c3..0953dd50 100644 --- a/src/pdstemplates.c +++ b/src/pdstemplates.c @@ -348,6 +348,9 @@ static const struct pdstemplate templatespds[G2C_MAX_PDS_TEMPLATE] = /** PDT 4.93 (12/04/2024) 4.93: Post-processing analysis or forecast at a horizontal level or in a horizontal layer at a specified local time */ {93, 27, 1, {1, 1, 2, 2, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}}, + /** PDT 4.94 (12/04/2024) + 4.94: Post-processing analysis or forecast at a horizontal level or in a horizontal layer at a specified local time */ + {94, 29, 1, {1, 1, 2, 2, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}}, }; /** @@ -1223,6 +1226,23 @@ extpdstemplate(g2int number, g2int *list) } } } + /* PDT 4.94 (12/04/2024) */ + else if (number == 94) + { + if (list[17] > 1) + { + new->extlen = (list[17] - 1) * 11; + new->ext = malloc(sizeof(g2int) * new->extlen); + for (j = 2; j <= list[17]; j++) + { + l = (j - 2) * 11; + for (k = 0; k < 11; k++) + { + new->ext[l + k] = new->map[18 + k]; + } + } + } + } return new; } diff --git a/tests/tst_pdstemplates.c b/tests/tst_pdstemplates.c index cf8a3508..d5c61588 100644 --- a/tests/tst_pdstemplates.c +++ b/tests/tst_pdstemplates.c @@ -550,27 +550,38 @@ main() return G2C_ERROR; free(tmpl->ext); free(tmpl); + + /* Check for one that's there but does need an extension. */ + tmpl = extpdstemplate(94, list); + if (!tmpl) + return G2C_ERROR; + if (tmpl->num != 94 || tmpl->maplen != 29 || !tmpl->needext) + return G2C_ERROR; + if (!tmpl->ext) + return G2C_ERROR; + free(tmpl->ext); + free(tmpl); } printf("ok!\n"); printf("Testing all getpdstemplate() calls with extensions...\n"); { -#define NUM_TEST 76 +#define NUM_TEST 77 int number[NUM_TEST] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 20, 30, 31, 40, 41, 42, 43, 254, 1000, 1001, 1002, 1100, 1101, 32, 44, 45, 46, 47, 48, 50, 52, 51, 91, 33, 34, 53, 54, 57, 60, 61, 35, 49, 55, 58, 59, 62, 63, 67, 68, 70, 71, 72, 73, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 92, - 93}; + 93, 94}; int expected_maplen[NUM_TEST] = { 15, 18, 17, 31, 30, 22, 16, 15, 29, 36, 30, 32, 31, 45, 44, 18, 19, 5, 5, 16, 19, 30, 33, 3, 9, 16, 15, 15, 22, 10, 21, 24, 35, 38, 26, 21, 15, 16, 36, 18, 32, 19, 22, 7, 24, 38, 6, 29, 21, 7, 24, 35, 38, 7, 7, 19, 21, 32, - 34, 17, 20, 31, 34, 27, 30, 36, 40, 39, 38, 17, 31, 24, 20, 34, 27, 27}; + 34, 17, 20, 31, 34, 27, 30, 36, 40, 39, 38, 17, 31, 24, 20, 34, 27, 27, 29}; int expected_needext[NUM_TEST] = { 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, - 1}; + 1, 1}; int expected_map[NUM_TEST][48] = { {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 0 */ {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 1 */ @@ -648,6 +659,7 @@ main() {1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 2, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 90 */ {1, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 92 */ {1, 1, 2, 2, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 93 */ + {1, 1, 2, 2, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 94 */ }; int t; int ext_t = 0; @@ -689,11 +701,11 @@ main() if (map[m] != expected_map[t][m]) return G2C_ERROR; -#define NUM_EXT_TEST 43 +#define NUM_EXT_TEST 44 int template[G2C_MAX_PDS_TEMPLATE_MAPLEN]; int expected_extlen[NUM_EXT_TEST] = { 2, 2, 6, 6, 6, 6, 6, 8, 8, 10, 10, 6, 6, 10, 6, 6, 12, 8, 2, 8, 2, 2, 30, 6, - 10, 20, 6, 6, 31, 34, 6, 6, 6, 6, 6, 6, 6, 6, 6, 11, 6, 11, 11}; + 10, 20, 6, 6, 31, 34, 6, 6, 6, 6, 6, 6, 6, 6, 6, 11, 6, 11, 11, 11}; int expected_ext[NUM_EXT_TEST][48] = { {1, 1}, /* 3 */ {1, 1}, /* 4 */ @@ -738,6 +750,7 @@ main() {1, 1, 1, 4, 1, 4}, /* 90 */ {2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 92 */ {2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 93 */ + {2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 94 */ }; if (needext) @@ -883,6 +896,9 @@ main() case 93: template[15] = 2; break; + case 94: + template[17] = 2; + break; default: return G2C_ERROR; } From e52c2249e117c625006473e5fc1058671df36824 Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Thu, 5 Dec 2024 13:38:35 -0800 Subject: [PATCH 47/80] edit comment --- src/pdstemplates.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pdstemplates.c b/src/pdstemplates.c index 0953dd50..7ece33da 100644 --- a/src/pdstemplates.c +++ b/src/pdstemplates.c @@ -349,7 +349,8 @@ static const struct pdstemplate templatespds[G2C_MAX_PDS_TEMPLATE] = 4.93: Post-processing analysis or forecast at a horizontal level or in a horizontal layer at a specified local time */ {93, 27, 1, {1, 1, 2, 2, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}}, /** PDT 4.94 (12/04/2024) - 4.94: Post-processing analysis or forecast at a horizontal level or in a horizontal layer at a specified local time */ + 4.94: Post-processing individual ensemble forecast, control and perturbed, at a horizontal level + or in a horizontal layer at a specified local time*/ {94, 29, 1, {1, 1, 2, 2, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}}, }; From c7a79d10e55cbef82eb08edb6e2720f2abbea7df Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Thu, 5 Dec 2024 13:43:06 -0800 Subject: [PATCH 48/80] fix template --- src/pdstemplates.c | 10 +++++----- tests/tst_pdstemplates.c | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/pdstemplates.c b/src/pdstemplates.c index 7ece33da..d23d18cd 100644 --- a/src/pdstemplates.c +++ b/src/pdstemplates.c @@ -351,7 +351,7 @@ static const struct pdstemplate templatespds[G2C_MAX_PDS_TEMPLATE] = /** PDT 4.94 (12/04/2024) 4.94: Post-processing individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a specified local time*/ - {94, 29, 1, {1, 1, 2, 2, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}}, + {94, 30, 1, {1, 1, 2, 2, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}}, }; /** @@ -1230,16 +1230,16 @@ extpdstemplate(g2int number, g2int *list) /* PDT 4.94 (12/04/2024) */ else if (number == 94) { - if (list[17] > 1) + if (list[18] > 1) { - new->extlen = (list[17] - 1) * 11; + new->extlen = (list[18] - 1) * 11; new->ext = malloc(sizeof(g2int) * new->extlen); - for (j = 2; j <= list[17]; j++) + for (j = 2; j <= list[18]; j++) { l = (j - 2) * 11; for (k = 0; k < 11; k++) { - new->ext[l + k] = new->map[18 + k]; + new->ext[l + k] = new->map[19 + k]; } } } diff --git a/tests/tst_pdstemplates.c b/tests/tst_pdstemplates.c index d5c61588..25d5df96 100644 --- a/tests/tst_pdstemplates.c +++ b/tests/tst_pdstemplates.c @@ -555,7 +555,7 @@ main() tmpl = extpdstemplate(94, list); if (!tmpl) return G2C_ERROR; - if (tmpl->num != 94 || tmpl->maplen != 29 || !tmpl->needext) + if (tmpl->num != 94 || tmpl->maplen != 30 || !tmpl->needext) return G2C_ERROR; if (!tmpl->ext) return G2C_ERROR; @@ -576,7 +576,7 @@ main() 15, 18, 17, 31, 30, 22, 16, 15, 29, 36, 30, 32, 31, 45, 44, 18, 19, 5, 5, 16, 19, 30, 33, 3, 9, 16, 15, 15, 22, 10, 21, 24, 35, 38, 26, 21, 15, 16, 36, 18, 32, 19, 22, 7, 24, 38, 6, 29, 21, 7, 24, 35, 38, 7, 7, 19, 21, 32, - 34, 17, 20, 31, 34, 27, 30, 36, 40, 39, 38, 17, 31, 24, 20, 34, 27, 27, 29}; + 34, 17, 20, 31, 34, 27, 30, 36, 40, 39, 38, 17, 31, 24, 20, 34, 27, 27, 30}; int expected_needext[NUM_TEST] = { 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, @@ -897,7 +897,7 @@ main() template[15] = 2; break; case 94: - template[17] = 2; + template[18] = 2; break; default: return G2C_ERROR; From 6ff7af5496ad6278a0e7c9b8d77aacce322bfc29 Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Thu, 5 Dec 2024 13:57:27 -0800 Subject: [PATCH 49/80] pds 4.95 --- src/grib2.h.in | 2 +- src/pdstemplates.c | 23 ++++++++++++++++++++++- tests/tst_pdstemplates.c | 29 +++++++++++++++++++++++------ 3 files changed, 46 insertions(+), 8 deletions(-) diff --git a/src/grib2.h.in b/src/grib2.h.in index 231ab726..4585bea1 100644 --- a/src/grib2.h.in +++ b/src/grib2.h.in @@ -291,7 +291,7 @@ g2int g2_gribend(unsigned char *cgrib); /* Constants to help with templates. */ #define G2C_MAX_GDS_TEMPLATE 31 /**< Maximum number of grid templates. */ #define G2C_MAX_GDS_TEMPLATE_MAPLEN 28 /**< Maximum grid template map length. */ -#define G2C_MAX_PDS_TEMPLATE 77 /**< Maximum number of PDS templates. */ +#define G2C_MAX_PDS_TEMPLATE 78 /**< Maximum number of PDS templates. */ #define G2C_MAX_PDS_TEMPLATE_MAPLEN 45 /**< Maximum template map length. */ #define G2C_MAX_DRS_TEMPLATE 10 /**< Maximum number of DRS templates. */ #define G2C_MAX_DRS_TEMPLATE_MAPLEN 18 /**< Maximum DRS template map length. */ diff --git a/src/pdstemplates.c b/src/pdstemplates.c index d23d18cd..30d36b7e 100644 --- a/src/pdstemplates.c +++ b/src/pdstemplates.c @@ -350,8 +350,12 @@ static const struct pdstemplate templatespds[G2C_MAX_PDS_TEMPLATE] = {93, 27, 1, {1, 1, 2, 2, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}}, /** PDT 4.94 (12/04/2024) 4.94: Post-processing individual ensemble forecast, control and perturbed, at a horizontal level - or in a horizontal layer at a specified local time*/ + or in a horizontal layer at a specified local time */ {94, 30, 1, {1, 1, 2, 2, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}}, + /** PDT 4.95 (12/04/2024) + 4.95: Average, accumulation, extreme values or other statistically processed value + at a horizontal level or in a horizontal layer at a local time */ + {95, 28, 1, {1, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}}, }; /** @@ -1244,6 +1248,23 @@ extpdstemplate(g2int number, g2int *list) } } } + /* PDT 4.95 (12/04/2024) */ + else if (number == 95) + { + if (list[16] > 1) + { + new->extlen = (list[16] - 1) * 11; + new->ext = malloc(sizeof(g2int) * new->extlen); + for (j = 2; j <= list[16]; j++) + { + l = (j - 2) * 11; + for (k = 0; k < 11; k++) + { + new->ext[l + k] = new->map[17 + k]; + } + } + } + } return new; } diff --git a/tests/tst_pdstemplates.c b/tests/tst_pdstemplates.c index 25d5df96..6e2bd927 100644 --- a/tests/tst_pdstemplates.c +++ b/tests/tst_pdstemplates.c @@ -561,27 +561,39 @@ main() return G2C_ERROR; free(tmpl->ext); free(tmpl); + + /* Check for one that's there but does need an extension. */ + tmpl = extpdstemplate(95, list); + if (!tmpl) + return G2C_ERROR; + if (tmpl->num != 95 || tmpl->maplen != 28 || !tmpl->needext) + return G2C_ERROR; + if (!tmpl->ext) + return G2C_ERROR; + free(tmpl->ext); + free(tmpl); } printf("ok!\n"); printf("Testing all getpdstemplate() calls with extensions...\n"); { -#define NUM_TEST 77 +#define NUM_TEST 78 int number[NUM_TEST] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 20, 30, 31, 40, 41, 42, 43, 254, 1000, 1001, 1002, 1100, 1101, 32, 44, 45, 46, 47, 48, 50, 52, 51, 91, 33, 34, 53, 54, 57, 60, 61, 35, 49, 55, 58, 59, 62, 63, 67, 68, 70, 71, 72, 73, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 92, - 93, 94}; + 93, 94, 95}; int expected_maplen[NUM_TEST] = { 15, 18, 17, 31, 30, 22, 16, 15, 29, 36, 30, 32, 31, 45, 44, 18, 19, 5, 5, 16, 19, 30, 33, 3, 9, 16, 15, 15, 22, 10, 21, 24, 35, 38, 26, 21, 15, 16, 36, 18, 32, 19, 22, 7, 24, 38, 6, 29, 21, 7, 24, 35, 38, 7, 7, 19, 21, 32, - 34, 17, 20, 31, 34, 27, 30, 36, 40, 39, 38, 17, 31, 24, 20, 34, 27, 27, 30}; + 34, 17, 20, 31, 34, 27, 30, 36, 40, 39, 38, 17, 31, 24, 20, 34, 27, 27, 30, + 28}; int expected_needext[NUM_TEST] = { 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, - 1, 1}; + 1, 1, 1}; int expected_map[NUM_TEST][48] = { {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 0 */ {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 1 */ @@ -660,6 +672,7 @@ main() {1, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 92 */ {1, 1, 2, 2, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 93 */ {1, 1, 2, 2, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 94 */ + {1, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 95 */ }; int t; int ext_t = 0; @@ -701,11 +714,11 @@ main() if (map[m] != expected_map[t][m]) return G2C_ERROR; -#define NUM_EXT_TEST 44 +#define NUM_EXT_TEST 45 int template[G2C_MAX_PDS_TEMPLATE_MAPLEN]; int expected_extlen[NUM_EXT_TEST] = { 2, 2, 6, 6, 6, 6, 6, 8, 8, 10, 10, 6, 6, 10, 6, 6, 12, 8, 2, 8, 2, 2, 30, 6, - 10, 20, 6, 6, 31, 34, 6, 6, 6, 6, 6, 6, 6, 6, 6, 11, 6, 11, 11, 11}; + 10, 20, 6, 6, 31, 34, 6, 6, 6, 6, 6, 6, 6, 6, 6, 11, 6, 11, 11, 11, 11}; int expected_ext[NUM_EXT_TEST][48] = { {1, 1}, /* 3 */ {1, 1}, /* 4 */ @@ -751,6 +764,7 @@ main() {2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 92 */ {2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 93 */ {2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 94 */ + {2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 95 */ }; if (needext) @@ -899,6 +913,9 @@ main() case 94: template[18] = 2; break; + case 95: + template[16] = 2; + break; default: return G2C_ERROR; } From 9889ec97e0f0365b90063a04fbcc6c2751faaae0 Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Thu, 5 Dec 2024 14:09:29 -0800 Subject: [PATCH 50/80] pds 4.96 --- src/grib2.h.in | 2 +- src/pdstemplates.c | 21 +++++++++++++++++++++ tests/tst_pdstemplates.c | 28 ++++++++++++++++++++++------ 3 files changed, 44 insertions(+), 7 deletions(-) diff --git a/src/grib2.h.in b/src/grib2.h.in index 4585bea1..4411432e 100644 --- a/src/grib2.h.in +++ b/src/grib2.h.in @@ -291,7 +291,7 @@ g2int g2_gribend(unsigned char *cgrib); /* Constants to help with templates. */ #define G2C_MAX_GDS_TEMPLATE 31 /**< Maximum number of grid templates. */ #define G2C_MAX_GDS_TEMPLATE_MAPLEN 28 /**< Maximum grid template map length. */ -#define G2C_MAX_PDS_TEMPLATE 78 /**< Maximum number of PDS templates. */ +#define G2C_MAX_PDS_TEMPLATE 79 /**< Maximum number of PDS templates. */ #define G2C_MAX_PDS_TEMPLATE_MAPLEN 45 /**< Maximum template map length. */ #define G2C_MAX_DRS_TEMPLATE 10 /**< Maximum number of DRS templates. */ #define G2C_MAX_DRS_TEMPLATE_MAPLEN 18 /**< Maximum DRS template map length. */ diff --git a/src/pdstemplates.c b/src/pdstemplates.c index 30d36b7e..b0ed1b1f 100644 --- a/src/pdstemplates.c +++ b/src/pdstemplates.c @@ -356,6 +356,10 @@ static const struct pdstemplate templatespds[G2C_MAX_PDS_TEMPLATE] = 4.95: Average, accumulation, extreme values or other statistically processed value at a horizontal level or in a horizontal layer at a local time */ {95, 28, 1, {1, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}}, + /** PDT 4.96 (12/04/2024) + 4.96: Average, accumulation, extreme values or other statistically processed values of an individual ensemble forecast, + control and perturbed, at a horizontal level or in a horizontal layer at a local time */ + {96, 31, 1, {1, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 1, 1, 1, 4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}}, }; /** @@ -1265,6 +1269,23 @@ extpdstemplate(g2int number, g2int *list) } } } + /* PDT 4.96 (12/04/2024) */ + else if (number == 96) + { + if (list[19] > 1) + { + new->extlen = (list[19] - 1) * 11; + new->ext = malloc(sizeof(g2int) * new->extlen); + for (j = 2; j <= list[19]; j++) + { + l = (j - 2) * 11; + for (k = 0; k < 11; k++) + { + new->ext[l + k] = new->map[20 + k]; + } + } + } + } return new; } diff --git a/tests/tst_pdstemplates.c b/tests/tst_pdstemplates.c index 6e2bd927..c2151b7a 100644 --- a/tests/tst_pdstemplates.c +++ b/tests/tst_pdstemplates.c @@ -572,28 +572,39 @@ main() return G2C_ERROR; free(tmpl->ext); free(tmpl); + + /* Check for one that's there but does need an extension. */ + tmpl = extpdstemplate(96, list); + if (!tmpl) + return G2C_ERROR; + if (tmpl->num != 96 || tmpl->maplen != 31 || !tmpl->needext) + return G2C_ERROR; + if (!tmpl->ext) + return G2C_ERROR; + free(tmpl->ext); + free(tmpl); } printf("ok!\n"); printf("Testing all getpdstemplate() calls with extensions...\n"); { -#define NUM_TEST 78 +#define NUM_TEST 79 int number[NUM_TEST] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 20, 30, 31, 40, 41, 42, 43, 254, 1000, 1001, 1002, 1100, 1101, 32, 44, 45, 46, 47, 48, 50, 52, 51, 91, 33, 34, 53, 54, 57, 60, 61, 35, 49, 55, 58, 59, 62, 63, 67, 68, 70, 71, 72, 73, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 92, - 93, 94, 95}; + 93, 94, 95, 96}; int expected_maplen[NUM_TEST] = { 15, 18, 17, 31, 30, 22, 16, 15, 29, 36, 30, 32, 31, 45, 44, 18, 19, 5, 5, 16, 19, 30, 33, 3, 9, 16, 15, 15, 22, 10, 21, 24, 35, 38, 26, 21, 15, 16, 36, 18, 32, 19, 22, 7, 24, 38, 6, 29, 21, 7, 24, 35, 38, 7, 7, 19, 21, 32, 34, 17, 20, 31, 34, 27, 30, 36, 40, 39, 38, 17, 31, 24, 20, 34, 27, 27, 30, - 28}; + 28, 31}; int expected_needext[NUM_TEST] = { 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, - 1, 1, 1}; + 1, 1, 1, 1}; int expected_map[NUM_TEST][48] = { {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 0 */ {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 1 */ @@ -673,6 +684,7 @@ main() {1, 1, 2, 2, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 93 */ {1, 1, 2, 2, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 94 */ {1, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 95 */ + {1, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 1, 1, 1, 4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 96 */ }; int t; int ext_t = 0; @@ -714,11 +726,11 @@ main() if (map[m] != expected_map[t][m]) return G2C_ERROR; -#define NUM_EXT_TEST 45 +#define NUM_EXT_TEST 46 int template[G2C_MAX_PDS_TEMPLATE_MAPLEN]; int expected_extlen[NUM_EXT_TEST] = { 2, 2, 6, 6, 6, 6, 6, 8, 8, 10, 10, 6, 6, 10, 6, 6, 12, 8, 2, 8, 2, 2, 30, 6, - 10, 20, 6, 6, 31, 34, 6, 6, 6, 6, 6, 6, 6, 6, 6, 11, 6, 11, 11, 11, 11}; + 10, 20, 6, 6, 31, 34, 6, 6, 6, 6, 6, 6, 6, 6, 6, 11, 6, 11, 11, 11, 11, 11}; int expected_ext[NUM_EXT_TEST][48] = { {1, 1}, /* 3 */ {1, 1}, /* 4 */ @@ -765,6 +777,7 @@ main() {2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 93 */ {2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 94 */ {2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 95 */ + {2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 96 */ }; if (needext) @@ -916,6 +929,9 @@ main() case 95: template[16] = 2; break; + case 96: + template[19] = 2; + break; default: return G2C_ERROR; } From 1ca1550ca2f254fd7dca97767ba87cbfcba3524a Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Thu, 5 Dec 2024 14:18:10 -0800 Subject: [PATCH 51/80] pds 4.97 --- src/grib2.h.in | 2 +- src/pdstemplates.c | 21 +++++++++++++++++++++ tests/tst_pdstemplates.c | 29 +++++++++++++++++++++++------ 3 files changed, 45 insertions(+), 7 deletions(-) diff --git a/src/grib2.h.in b/src/grib2.h.in index 4411432e..8c00c6be 100644 --- a/src/grib2.h.in +++ b/src/grib2.h.in @@ -291,7 +291,7 @@ g2int g2_gribend(unsigned char *cgrib); /* Constants to help with templates. */ #define G2C_MAX_GDS_TEMPLATE 31 /**< Maximum number of grid templates. */ #define G2C_MAX_GDS_TEMPLATE_MAPLEN 28 /**< Maximum grid template map length. */ -#define G2C_MAX_PDS_TEMPLATE 79 /**< Maximum number of PDS templates. */ +#define G2C_MAX_PDS_TEMPLATE 80 /**< Maximum number of PDS templates. */ #define G2C_MAX_PDS_TEMPLATE_MAPLEN 45 /**< Maximum template map length. */ #define G2C_MAX_DRS_TEMPLATE 10 /**< Maximum number of DRS templates. */ #define G2C_MAX_DRS_TEMPLATE_MAPLEN 18 /**< Maximum DRS template map length. */ diff --git a/src/pdstemplates.c b/src/pdstemplates.c index b0ed1b1f..0cf4c457 100644 --- a/src/pdstemplates.c +++ b/src/pdstemplates.c @@ -360,6 +360,10 @@ static const struct pdstemplate templatespds[G2C_MAX_PDS_TEMPLATE] = 4.96: Average, accumulation, extreme values or other statistically processed values of an individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a local time */ {96, 31, 1, {1, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 1, 1, 1, 4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}}, + /** PDT 4.97 (12/04/2024) + 4.97: Average, accumulation, extreme values or other statistically processed values of post-processing analysis or forecast + at a horizontal level or in a horizontal layer at a local time */ + {97, 31, 1, {1, 1, 2, 2, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}}, }; /** @@ -1286,6 +1290,23 @@ extpdstemplate(g2int number, g2int *list) } } } + /* PDT 4.97 (12/04/2024) */ + else if (number == 97) + { + if (list[19] > 1) + { + new->extlen = (list[19] - 1) * 11; + new->ext = malloc(sizeof(g2int) * new->extlen); + for (j = 2; j <= list[19]; j++) + { + l = (j - 2) * 11; + for (k = 0; k < 11; k++) + { + new->ext[l + k] = new->map[20 + k]; + } + } + } + } return new; } diff --git a/tests/tst_pdstemplates.c b/tests/tst_pdstemplates.c index c2151b7a..ba76bbb5 100644 --- a/tests/tst_pdstemplates.c +++ b/tests/tst_pdstemplates.c @@ -583,28 +583,39 @@ main() return G2C_ERROR; free(tmpl->ext); free(tmpl); + + /* Check for one that's there but does need an extension. */ + tmpl = extpdstemplate(97, list); + if (!tmpl) + return G2C_ERROR; + if (tmpl->num != 97 || tmpl->maplen != 31 || !tmpl->needext) + return G2C_ERROR; + if (!tmpl->ext) + return G2C_ERROR; + free(tmpl->ext); + free(tmpl); } printf("ok!\n"); printf("Testing all getpdstemplate() calls with extensions...\n"); { -#define NUM_TEST 79 +#define NUM_TEST 80 int number[NUM_TEST] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 20, 30, 31, 40, 41, 42, 43, 254, 1000, 1001, 1002, 1100, 1101, 32, 44, 45, 46, 47, 48, 50, 52, 51, 91, 33, 34, 53, 54, 57, 60, 61, 35, 49, 55, 58, 59, 62, 63, 67, 68, 70, 71, 72, 73, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 92, - 93, 94, 95, 96}; + 93, 94, 95, 96, 97}; int expected_maplen[NUM_TEST] = { 15, 18, 17, 31, 30, 22, 16, 15, 29, 36, 30, 32, 31, 45, 44, 18, 19, 5, 5, 16, 19, 30, 33, 3, 9, 16, 15, 15, 22, 10, 21, 24, 35, 38, 26, 21, 15, 16, 36, 18, 32, 19, 22, 7, 24, 38, 6, 29, 21, 7, 24, 35, 38, 7, 7, 19, 21, 32, 34, 17, 20, 31, 34, 27, 30, 36, 40, 39, 38, 17, 31, 24, 20, 34, 27, 27, 30, - 28, 31}; + 28, 31, 31}; int expected_needext[NUM_TEST] = { 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, - 1, 1, 1, 1}; + 1, 1, 1, 1, 1}; int expected_map[NUM_TEST][48] = { {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 0 */ {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 1 */ @@ -685,6 +696,7 @@ main() {1, 1, 2, 2, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 94 */ {1, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 95 */ {1, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 1, 1, 1, 4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 96 */ + {1, 1, 2, 2, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 97 */ }; int t; int ext_t = 0; @@ -726,11 +738,12 @@ main() if (map[m] != expected_map[t][m]) return G2C_ERROR; -#define NUM_EXT_TEST 46 +#define NUM_EXT_TEST 47 int template[G2C_MAX_PDS_TEMPLATE_MAPLEN]; int expected_extlen[NUM_EXT_TEST] = { 2, 2, 6, 6, 6, 6, 6, 8, 8, 10, 10, 6, 6, 10, 6, 6, 12, 8, 2, 8, 2, 2, 30, 6, - 10, 20, 6, 6, 31, 34, 6, 6, 6, 6, 6, 6, 6, 6, 6, 11, 6, 11, 11, 11, 11, 11}; + 10, 20, 6, 6, 31, 34, 6, 6, 6, 6, 6, 6, 6, 6, 6, 11, 6, 11, 11, 11, 11, 11, + 11}; int expected_ext[NUM_EXT_TEST][48] = { {1, 1}, /* 3 */ {1, 1}, /* 4 */ @@ -778,6 +791,7 @@ main() {2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 94 */ {2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 95 */ {2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 96 */ + {2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 97 */ }; if (needext) @@ -932,6 +946,9 @@ main() case 96: template[19] = 2; break; + case 97: + template[19] = 2; + break; default: return G2C_ERROR; } From 5e2e66eeae5107e2308baa84955bd5e32c1d6c43 Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Thu, 5 Dec 2024 14:24:08 -0800 Subject: [PATCH 52/80] pds 4.98 --- src/grib2.h.in | 2 +- src/pdstemplates.c | 21 +++++++++++++++++++++ tests/tst_pdstemplates.c | 28 ++++++++++++++++++++++------ 3 files changed, 44 insertions(+), 7 deletions(-) diff --git a/src/grib2.h.in b/src/grib2.h.in index 8c00c6be..9ab3e8b8 100644 --- a/src/grib2.h.in +++ b/src/grib2.h.in @@ -291,7 +291,7 @@ g2int g2_gribend(unsigned char *cgrib); /* Constants to help with templates. */ #define G2C_MAX_GDS_TEMPLATE 31 /**< Maximum number of grid templates. */ #define G2C_MAX_GDS_TEMPLATE_MAPLEN 28 /**< Maximum grid template map length. */ -#define G2C_MAX_PDS_TEMPLATE 80 /**< Maximum number of PDS templates. */ +#define G2C_MAX_PDS_TEMPLATE 81 /**< Maximum number of PDS templates. */ #define G2C_MAX_PDS_TEMPLATE_MAPLEN 45 /**< Maximum template map length. */ #define G2C_MAX_DRS_TEMPLATE 10 /**< Maximum number of DRS templates. */ #define G2C_MAX_DRS_TEMPLATE_MAPLEN 18 /**< Maximum DRS template map length. */ diff --git a/src/pdstemplates.c b/src/pdstemplates.c index 0cf4c457..fc0aee65 100644 --- a/src/pdstemplates.c +++ b/src/pdstemplates.c @@ -364,6 +364,10 @@ static const struct pdstemplate templatespds[G2C_MAX_PDS_TEMPLATE] = 4.97: Average, accumulation, extreme values or other statistically processed values of post-processing analysis or forecast at a horizontal level or in a horizontal layer at a local time */ {97, 31, 1, {1, 1, 2, 2, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}}, + /** PDT 4.98 (12/04/2024) + 4.98: Average, accumulation, extreme values or other statistically processed values of a post-processing individual + ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a local time */ + {98, 34, 1, {1, 1, 2, 2, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 1, 1, 1, 4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}}, }; /** @@ -1307,6 +1311,23 @@ extpdstemplate(g2int number, g2int *list) } } } + /* PDT 4.98 (12/04/2024) */ + else if (number == 98) + { + if (list[22] > 1) + { + new->extlen = (list[22] - 1) * 11; + new->ext = malloc(sizeof(g2int) * new->extlen); + for (j = 2; j <= list[22]; j++) + { + l = (j - 2) * 11; + for (k = 0; k < 11; k++) + { + new->ext[l + k] = new->map[23 + k]; + } + } + } + } return new; } diff --git a/tests/tst_pdstemplates.c b/tests/tst_pdstemplates.c index ba76bbb5..1584b4f9 100644 --- a/tests/tst_pdstemplates.c +++ b/tests/tst_pdstemplates.c @@ -594,28 +594,39 @@ main() return G2C_ERROR; free(tmpl->ext); free(tmpl); + + /* Check for one that's there but does need an extension. */ + tmpl = extpdstemplate(98, list); + if (!tmpl) + return G2C_ERROR; + if (tmpl->num != 98 || tmpl->maplen != 34 || !tmpl->needext) + return G2C_ERROR; + if (!tmpl->ext) + return G2C_ERROR; + free(tmpl->ext); + free(tmpl); } printf("ok!\n"); printf("Testing all getpdstemplate() calls with extensions...\n"); { -#define NUM_TEST 80 +#define NUM_TEST 81 int number[NUM_TEST] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 20, 30, 31, 40, 41, 42, 43, 254, 1000, 1001, 1002, 1100, 1101, 32, 44, 45, 46, 47, 48, 50, 52, 51, 91, 33, 34, 53, 54, 57, 60, 61, 35, 49, 55, 58, 59, 62, 63, 67, 68, 70, 71, 72, 73, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 92, - 93, 94, 95, 96, 97}; + 93, 94, 95, 96, 97, 98}; int expected_maplen[NUM_TEST] = { 15, 18, 17, 31, 30, 22, 16, 15, 29, 36, 30, 32, 31, 45, 44, 18, 19, 5, 5, 16, 19, 30, 33, 3, 9, 16, 15, 15, 22, 10, 21, 24, 35, 38, 26, 21, 15, 16, 36, 18, 32, 19, 22, 7, 24, 38, 6, 29, 21, 7, 24, 35, 38, 7, 7, 19, 21, 32, 34, 17, 20, 31, 34, 27, 30, 36, 40, 39, 38, 17, 31, 24, 20, 34, 27, 27, 30, - 28, 31, 31}; + 28, 31, 31, 34}; int expected_needext[NUM_TEST] = { 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, - 1, 1, 1, 1, 1}; + 1, 1, 1, 1, 1, 1}; int expected_map[NUM_TEST][48] = { {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 0 */ {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 1 */ @@ -697,6 +708,7 @@ main() {1, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 95 */ {1, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 1, 1, 1, 4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 96 */ {1, 1, 2, 2, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 97 */ + {1, 1, 2, 2, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 1, 1, 1, 4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 98 */ }; int t; int ext_t = 0; @@ -738,12 +750,12 @@ main() if (map[m] != expected_map[t][m]) return G2C_ERROR; -#define NUM_EXT_TEST 47 +#define NUM_EXT_TEST 48 int template[G2C_MAX_PDS_TEMPLATE_MAPLEN]; int expected_extlen[NUM_EXT_TEST] = { 2, 2, 6, 6, 6, 6, 6, 8, 8, 10, 10, 6, 6, 10, 6, 6, 12, 8, 2, 8, 2, 2, 30, 6, 10, 20, 6, 6, 31, 34, 6, 6, 6, 6, 6, 6, 6, 6, 6, 11, 6, 11, 11, 11, 11, 11, - 11}; + 11, 11}; int expected_ext[NUM_EXT_TEST][48] = { {1, 1}, /* 3 */ {1, 1}, /* 4 */ @@ -792,6 +804,7 @@ main() {2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 95 */ {2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 96 */ {2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 97 */ + {2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 98 */ }; if (needext) @@ -949,6 +962,9 @@ main() case 97: template[19] = 2; break; + case 98: + template[22] = 2; + break; default: return G2C_ERROR; } From 27882bc5db3d747a186798d7b55eace9dfa038a8 Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Thu, 5 Dec 2024 14:46:16 -0800 Subject: [PATCH 53/80] pds 4.99 --- src/grib2.h.in | 2 +- src/pdstemplates.c | 21 +++++++++++++++++++++ tests/tst_pdstemplates.c | 29 +++++++++++++++++++++++------ 3 files changed, 45 insertions(+), 7 deletions(-) diff --git a/src/grib2.h.in b/src/grib2.h.in index 9ab3e8b8..18868f8a 100644 --- a/src/grib2.h.in +++ b/src/grib2.h.in @@ -291,7 +291,7 @@ g2int g2_gribend(unsigned char *cgrib); /* Constants to help with templates. */ #define G2C_MAX_GDS_TEMPLATE 31 /**< Maximum number of grid templates. */ #define G2C_MAX_GDS_TEMPLATE_MAPLEN 28 /**< Maximum grid template map length. */ -#define G2C_MAX_PDS_TEMPLATE 81 /**< Maximum number of PDS templates. */ +#define G2C_MAX_PDS_TEMPLATE 82 /**< Maximum number of PDS templates. */ #define G2C_MAX_PDS_TEMPLATE_MAPLEN 45 /**< Maximum template map length. */ #define G2C_MAX_DRS_TEMPLATE 10 /**< Maximum number of DRS templates. */ #define G2C_MAX_DRS_TEMPLATE_MAPLEN 18 /**< Maximum DRS template map length. */ diff --git a/src/pdstemplates.c b/src/pdstemplates.c index fc0aee65..32251e5a 100644 --- a/src/pdstemplates.c +++ b/src/pdstemplates.c @@ -368,6 +368,10 @@ static const struct pdstemplate templatespds[G2C_MAX_PDS_TEMPLATE] = 4.98: Average, accumulation, extreme values or other statistically processed values of a post-processing individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a local time */ {98, 34, 1, {1, 1, 2, 2, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 1, 1, 1, 4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}}, + /** PDT 4.99 (12/04/2024) + 4.99: Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for wave 2D spectra + with explicit list of frequencies and directions */ + {99, 14, 1, {1, 1, 2, 2, 2, 2, 1, 1, 1, 2, 1, 1, -4, -1}}, }; /** @@ -1328,6 +1332,23 @@ extpdstemplate(g2int number, g2int *list) } } } + /* PDT 4.99 (12/04/2024) */ + else if (number == 99) + { + j = list[3]; + k = list[5]; + new->extlen = j + k + 1; + new->ext = malloc(sizeof(g2int) * new->extlen); + for (i = 0; i < j; i++) + { + new->ext[i] = -4; + } + new->ext[j] = -1; + for (i = 0; i < k; i++) + { + new->ext[j + 1 + i] = -4; + } + } return new; } diff --git a/tests/tst_pdstemplates.c b/tests/tst_pdstemplates.c index 1584b4f9..234a6a0f 100644 --- a/tests/tst_pdstemplates.c +++ b/tests/tst_pdstemplates.c @@ -605,28 +605,39 @@ main() return G2C_ERROR; free(tmpl->ext); free(tmpl); + + /* Check for one that's there but does need an extension. */ + tmpl = extpdstemplate(99, list); + if (!tmpl) + return G2C_ERROR; + if (tmpl->num != 99 || tmpl->maplen != 14 || !tmpl->needext) + return G2C_ERROR; + if (!tmpl->ext) + return G2C_ERROR; + free(tmpl->ext); + free(tmpl); } printf("ok!\n"); printf("Testing all getpdstemplate() calls with extensions...\n"); { -#define NUM_TEST 81 +#define NUM_TEST 82 int number[NUM_TEST] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 20, 30, 31, 40, 41, 42, 43, 254, 1000, 1001, 1002, 1100, 1101, 32, 44, 45, 46, 47, 48, 50, 52, 51, 91, 33, 34, 53, 54, 57, 60, 61, 35, 49, 55, 58, 59, 62, 63, 67, 68, 70, 71, 72, 73, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 92, - 93, 94, 95, 96, 97, 98}; + 93, 94, 95, 96, 97, 98, 99}; int expected_maplen[NUM_TEST] = { 15, 18, 17, 31, 30, 22, 16, 15, 29, 36, 30, 32, 31, 45, 44, 18, 19, 5, 5, 16, 19, 30, 33, 3, 9, 16, 15, 15, 22, 10, 21, 24, 35, 38, 26, 21, 15, 16, 36, 18, 32, 19, 22, 7, 24, 38, 6, 29, 21, 7, 24, 35, 38, 7, 7, 19, 21, 32, 34, 17, 20, 31, 34, 27, 30, 36, 40, 39, 38, 17, 31, 24, 20, 34, 27, 27, 30, - 28, 31, 31, 34}; + 28, 31, 31, 34, 14}; int expected_needext[NUM_TEST] = { 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, - 1, 1, 1, 1, 1, 1}; + 1, 1, 1, 1, 1, 1, 1}; int expected_map[NUM_TEST][48] = { {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 0 */ {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 1 */ @@ -709,6 +720,7 @@ main() {1, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 1, 1, 1, 4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 96 */ {1, 1, 2, 2, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 97 */ {1, 1, 2, 2, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 1, 1, 1, 4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 98 */ + {1, 1, 2, 2, 2, 2, 1, 1, 1, 2, 1, 1, -4, -1}, /* 99 */ }; int t; int ext_t = 0; @@ -750,12 +762,12 @@ main() if (map[m] != expected_map[t][m]) return G2C_ERROR; -#define NUM_EXT_TEST 48 +#define NUM_EXT_TEST 49 int template[G2C_MAX_PDS_TEMPLATE_MAPLEN]; int expected_extlen[NUM_EXT_TEST] = { 2, 2, 6, 6, 6, 6, 6, 8, 8, 10, 10, 6, 6, 10, 6, 6, 12, 8, 2, 8, 2, 2, 30, 6, 10, 20, 6, 6, 31, 34, 6, 6, 6, 6, 6, 6, 6, 6, 6, 11, 6, 11, 11, 11, 11, 11, - 11, 11}; + 11, 11, 5}; int expected_ext[NUM_EXT_TEST][48] = { {1, 1}, /* 3 */ {1, 1}, /* 4 */ @@ -805,6 +817,7 @@ main() {2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 96 */ {2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 97 */ {2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 98 */ + {-4, -4, -1, -4, -4}, /* 99 */ }; if (needext) @@ -965,6 +978,10 @@ main() case 98: template[22] = 2; break; + case 99: + template[3] = 2; + template[5] = 2; + break; default: return G2C_ERROR; } From 67748446d693eeb343c56040e6bd00ff243b41ca Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Thu, 5 Dec 2024 14:55:34 -0800 Subject: [PATCH 54/80] pds 4.100 --- src/grib2.h.in | 2 +- src/pdstemplates.c | 21 +++++++++++++++++++++ tests/tst_pdstemplates.c | 29 +++++++++++++++++++++++------ 3 files changed, 45 insertions(+), 7 deletions(-) diff --git a/src/grib2.h.in b/src/grib2.h.in index 18868f8a..4e5c8095 100644 --- a/src/grib2.h.in +++ b/src/grib2.h.in @@ -291,7 +291,7 @@ g2int g2_gribend(unsigned char *cgrib); /* Constants to help with templates. */ #define G2C_MAX_GDS_TEMPLATE 31 /**< Maximum number of grid templates. */ #define G2C_MAX_GDS_TEMPLATE_MAPLEN 28 /**< Maximum grid template map length. */ -#define G2C_MAX_PDS_TEMPLATE 82 /**< Maximum number of PDS templates. */ +#define G2C_MAX_PDS_TEMPLATE 83 /**< Maximum number of PDS templates. */ #define G2C_MAX_PDS_TEMPLATE_MAPLEN 45 /**< Maximum template map length. */ #define G2C_MAX_DRS_TEMPLATE 10 /**< Maximum number of DRS templates. */ #define G2C_MAX_DRS_TEMPLATE_MAPLEN 18 /**< Maximum DRS template map length. */ diff --git a/src/pdstemplates.c b/src/pdstemplates.c index 32251e5a..849138ad 100644 --- a/src/pdstemplates.c +++ b/src/pdstemplates.c @@ -372,6 +372,10 @@ static const struct pdstemplate templatespds[G2C_MAX_PDS_TEMPLATE] = 4.99: Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for wave 2D spectra with explicit list of frequencies and directions */ {99, 14, 1, {1, 1, 2, 2, 2, 2, 1, 1, 1, 2, 1, 1, -4, -1}}, + /** PDT 4.100 (12/04/2024) + 4.100: Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a + point in time for wave 2D spectra with explicit list of frequencies and directions */ + {100, 17, 1, {1, 1, 2, 2, 2, 2, 1, 1, 1, 2, 1, 1, -4, 1, 1, 1, -1}}, }; /** @@ -1349,6 +1353,23 @@ extpdstemplate(g2int number, g2int *list) new->ext[j + 1 + i] = -4; } } + /* PDT 4.100 (12/04/2024) */ + else if (number == 100) + { + j = list[3]; + k = list[5]; + new->extlen = j + k + 1; + new->ext = malloc(sizeof(g2int) * new->extlen); + for (i = 0; i < j; i++) + { + new->ext[i] = -4; + } + new->ext[j] = -1; + for (i = 0; i < k; i++) + { + new->ext[j + 1 + i] = -4; + } + } return new; } diff --git a/tests/tst_pdstemplates.c b/tests/tst_pdstemplates.c index 234a6a0f..3500f00f 100644 --- a/tests/tst_pdstemplates.c +++ b/tests/tst_pdstemplates.c @@ -616,28 +616,39 @@ main() return G2C_ERROR; free(tmpl->ext); free(tmpl); + + /* Check for one that's there but does need an extension. */ + tmpl = extpdstemplate(100, list); + if (!tmpl) + return G2C_ERROR; + if (tmpl->num != 100 || tmpl->maplen != 17 || !tmpl->needext) + return G2C_ERROR; + if (!tmpl->ext) + return G2C_ERROR; + free(tmpl->ext); + free(tmpl); } printf("ok!\n"); printf("Testing all getpdstemplate() calls with extensions...\n"); { -#define NUM_TEST 82 +#define NUM_TEST 83 int number[NUM_TEST] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 20, 30, 31, 40, 41, 42, 43, 254, 1000, 1001, 1002, 1100, 1101, 32, 44, 45, 46, 47, 48, 50, 52, 51, 91, 33, 34, 53, 54, 57, 60, 61, 35, 49, 55, 58, 59, 62, 63, 67, 68, 70, 71, 72, 73, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 92, - 93, 94, 95, 96, 97, 98, 99}; + 93, 94, 95, 96, 97, 98, 99, 100}; int expected_maplen[NUM_TEST] = { 15, 18, 17, 31, 30, 22, 16, 15, 29, 36, 30, 32, 31, 45, 44, 18, 19, 5, 5, 16, 19, 30, 33, 3, 9, 16, 15, 15, 22, 10, 21, 24, 35, 38, 26, 21, 15, 16, 36, 18, 32, 19, 22, 7, 24, 38, 6, 29, 21, 7, 24, 35, 38, 7, 7, 19, 21, 32, 34, 17, 20, 31, 34, 27, 30, 36, 40, 39, 38, 17, 31, 24, 20, 34, 27, 27, 30, - 28, 31, 31, 34, 14}; + 28, 31, 31, 34, 14, 17}; int expected_needext[NUM_TEST] = { 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, - 1, 1, 1, 1, 1, 1, 1}; + 1, 1, 1, 1, 1, 1, 1, 1}; int expected_map[NUM_TEST][48] = { {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 0 */ {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 1 */ @@ -721,6 +732,7 @@ main() {1, 1, 2, 2, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 97 */ {1, 1, 2, 2, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 1, 1, 1, 4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 98 */ {1, 1, 2, 2, 2, 2, 1, 1, 1, 2, 1, 1, -4, -1}, /* 99 */ + {1, 1, 2, 2, 2, 2, 1, 1, 1, 2, 1, 1, -4, 1, 1, 1, -1}, /* 100 */ }; int t; int ext_t = 0; @@ -762,12 +774,12 @@ main() if (map[m] != expected_map[t][m]) return G2C_ERROR; -#define NUM_EXT_TEST 49 +#define NUM_EXT_TEST 50 int template[G2C_MAX_PDS_TEMPLATE_MAPLEN]; int expected_extlen[NUM_EXT_TEST] = { 2, 2, 6, 6, 6, 6, 6, 8, 8, 10, 10, 6, 6, 10, 6, 6, 12, 8, 2, 8, 2, 2, 30, 6, 10, 20, 6, 6, 31, 34, 6, 6, 6, 6, 6, 6, 6, 6, 6, 11, 6, 11, 11, 11, 11, 11, - 11, 11, 5}; + 11, 11, 5, 5}; int expected_ext[NUM_EXT_TEST][48] = { {1, 1}, /* 3 */ {1, 1}, /* 4 */ @@ -818,6 +830,7 @@ main() {2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 97 */ {2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 98 */ {-4, -4, -1, -4, -4}, /* 99 */ + {-4, -4, -1, -4, -4}, /* 100 */ }; if (needext) @@ -982,6 +995,10 @@ main() template[3] = 2; template[5] = 2; break; + case 100: + template[3] = 2; + template[5] = 2; + break; default: return G2C_ERROR; } From 3b57e8acd46047fb89a058b36484a72151377abe Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Fri, 6 Dec 2024 09:52:11 -0800 Subject: [PATCH 55/80] pds 4.103 --- src/grib2.h.in | 2 +- src/pdstemplates.c | 4 ++++ tests/tst_pdstemplates.c | 9 +++++---- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/grib2.h.in b/src/grib2.h.in index 4e5c8095..b8914634 100644 --- a/src/grib2.h.in +++ b/src/grib2.h.in @@ -291,7 +291,7 @@ g2int g2_gribend(unsigned char *cgrib); /* Constants to help with templates. */ #define G2C_MAX_GDS_TEMPLATE 31 /**< Maximum number of grid templates. */ #define G2C_MAX_GDS_TEMPLATE_MAPLEN 28 /**< Maximum grid template map length. */ -#define G2C_MAX_PDS_TEMPLATE 83 /**< Maximum number of PDS templates. */ +#define G2C_MAX_PDS_TEMPLATE 84 /**< Maximum number of PDS templates. */ #define G2C_MAX_PDS_TEMPLATE_MAPLEN 45 /**< Maximum template map length. */ #define G2C_MAX_DRS_TEMPLATE 10 /**< Maximum number of DRS templates. */ #define G2C_MAX_DRS_TEMPLATE_MAPLEN 18 /**< Maximum DRS template map length. */ diff --git a/src/pdstemplates.c b/src/pdstemplates.c index 849138ad..630cd4f7 100644 --- a/src/pdstemplates.c +++ b/src/pdstemplates.c @@ -376,6 +376,10 @@ static const struct pdstemplate templatespds[G2C_MAX_PDS_TEMPLATE] = 4.100: Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for wave 2D spectra with explicit list of frequencies and directions */ {100, 17, 1, {1, 1, 2, 2, 2, 2, 1, 1, 1, 2, 1, 1, -4, 1, 1, 1, -1}}, + /** PDT 4.103 (12/04/2024) + 4.103: Analysis or forecast at a horizontal level or in a horizontal layer at a point in time + for waves selected by period range */ + {103, 20, 0, {1, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}}, }; /** diff --git a/tests/tst_pdstemplates.c b/tests/tst_pdstemplates.c index 3500f00f..b3e6e2f0 100644 --- a/tests/tst_pdstemplates.c +++ b/tests/tst_pdstemplates.c @@ -631,24 +631,24 @@ main() printf("ok!\n"); printf("Testing all getpdstemplate() calls with extensions...\n"); { -#define NUM_TEST 83 +#define NUM_TEST 84 int number[NUM_TEST] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 20, 30, 31, 40, 41, 42, 43, 254, 1000, 1001, 1002, 1100, 1101, 32, 44, 45, 46, 47, 48, 50, 52, 51, 91, 33, 34, 53, 54, 57, 60, 61, 35, 49, 55, 58, 59, 62, 63, 67, 68, 70, 71, 72, 73, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 92, - 93, 94, 95, 96, 97, 98, 99, 100}; + 93, 94, 95, 96, 97, 98, 99, 100, 103}; int expected_maplen[NUM_TEST] = { 15, 18, 17, 31, 30, 22, 16, 15, 29, 36, 30, 32, 31, 45, 44, 18, 19, 5, 5, 16, 19, 30, 33, 3, 9, 16, 15, 15, 22, 10, 21, 24, 35, 38, 26, 21, 15, 16, 36, 18, 32, 19, 22, 7, 24, 38, 6, 29, 21, 7, 24, 35, 38, 7, 7, 19, 21, 32, 34, 17, 20, 31, 34, 27, 30, 36, 40, 39, 38, 17, 31, 24, 20, 34, 27, 27, 30, - 28, 31, 31, 34, 14, 17}; + 28, 31, 31, 34, 14, 17, 20}; int expected_needext[NUM_TEST] = { 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1}; + 1, 1, 1, 1, 1, 1, 1, 1, 0}; int expected_map[NUM_TEST][48] = { {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 0 */ {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 1 */ @@ -733,6 +733,7 @@ main() {1, 1, 2, 2, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 1, 1, 1, 4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 98 */ {1, 1, 2, 2, 2, 2, 1, 1, 1, 2, 1, 1, -4, -1}, /* 99 */ {1, 1, 2, 2, 2, 2, 1, 1, 1, 2, 1, 1, -4, 1, 1, 1, -1}, /* 100 */ + {1, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 103 */ }; int t; int ext_t = 0; From ec2d1b712ecb1900d49961ac400e88b82cf1adfa Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Fri, 6 Dec 2024 09:57:17 -0800 Subject: [PATCH 56/80] pds 4.104 --- src/grib2.h.in | 2 +- src/pdstemplates.c | 4 ++++ tests/tst_pdstemplates.c | 9 +++++---- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/grib2.h.in b/src/grib2.h.in index b8914634..62c86713 100644 --- a/src/grib2.h.in +++ b/src/grib2.h.in @@ -291,7 +291,7 @@ g2int g2_gribend(unsigned char *cgrib); /* Constants to help with templates. */ #define G2C_MAX_GDS_TEMPLATE 31 /**< Maximum number of grid templates. */ #define G2C_MAX_GDS_TEMPLATE_MAPLEN 28 /**< Maximum grid template map length. */ -#define G2C_MAX_PDS_TEMPLATE 84 /**< Maximum number of PDS templates. */ +#define G2C_MAX_PDS_TEMPLATE 85 /**< Maximum number of PDS templates. */ #define G2C_MAX_PDS_TEMPLATE_MAPLEN 45 /**< Maximum template map length. */ #define G2C_MAX_DRS_TEMPLATE 10 /**< Maximum number of DRS templates. */ #define G2C_MAX_DRS_TEMPLATE_MAPLEN 18 /**< Maximum DRS template map length. */ diff --git a/src/pdstemplates.c b/src/pdstemplates.c index 630cd4f7..64909b2d 100644 --- a/src/pdstemplates.c +++ b/src/pdstemplates.c @@ -380,6 +380,10 @@ static const struct pdstemplate templatespds[G2C_MAX_PDS_TEMPLATE] = 4.103: Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for waves selected by period range */ {103, 20, 0, {1, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}}, + /** PDT 4.104 (12/04/2024) + 4.104: Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point + in time for waves selected by period range */ + {104, 23, 0, {1, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}}, }; /** diff --git a/tests/tst_pdstemplates.c b/tests/tst_pdstemplates.c index b3e6e2f0..d1246b98 100644 --- a/tests/tst_pdstemplates.c +++ b/tests/tst_pdstemplates.c @@ -631,24 +631,24 @@ main() printf("ok!\n"); printf("Testing all getpdstemplate() calls with extensions...\n"); { -#define NUM_TEST 84 +#define NUM_TEST 85 int number[NUM_TEST] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 20, 30, 31, 40, 41, 42, 43, 254, 1000, 1001, 1002, 1100, 1101, 32, 44, 45, 46, 47, 48, 50, 52, 51, 91, 33, 34, 53, 54, 57, 60, 61, 35, 49, 55, 58, 59, 62, 63, 67, 68, 70, 71, 72, 73, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 92, - 93, 94, 95, 96, 97, 98, 99, 100, 103}; + 93, 94, 95, 96, 97, 98, 99, 100, 103, 104}; int expected_maplen[NUM_TEST] = { 15, 18, 17, 31, 30, 22, 16, 15, 29, 36, 30, 32, 31, 45, 44, 18, 19, 5, 5, 16, 19, 30, 33, 3, 9, 16, 15, 15, 22, 10, 21, 24, 35, 38, 26, 21, 15, 16, 36, 18, 32, 19, 22, 7, 24, 38, 6, 29, 21, 7, 24, 35, 38, 7, 7, 19, 21, 32, 34, 17, 20, 31, 34, 27, 30, 36, 40, 39, 38, 17, 31, 24, 20, 34, 27, 27, 30, - 28, 31, 31, 34, 14, 17, 20}; + 28, 31, 31, 34, 14, 17, 20, 23}; int expected_needext[NUM_TEST] = { 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 0}; + 1, 1, 1, 1, 1, 1, 1, 1, 0, 0}; int expected_map[NUM_TEST][48] = { {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 0 */ {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 1 */ @@ -734,6 +734,7 @@ main() {1, 1, 2, 2, 2, 2, 1, 1, 1, 2, 1, 1, -4, -1}, /* 99 */ {1, 1, 2, 2, 2, 2, 1, 1, 1, 2, 1, 1, -4, 1, 1, 1, -1}, /* 100 */ {1, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 103 */ + {1, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 104 */ }; int t; int ext_t = 0; From f8a6d93ba3f109f0d6db0fac61e57ea530e95e6b Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Fri, 6 Dec 2024 10:03:48 -0800 Subject: [PATCH 57/80] pds 4.108 --- src/grib2.h.in | 2 +- src/pdstemplates.c | 3 +++ tests/tst_pdstemplates.c | 9 +++++---- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/grib2.h.in b/src/grib2.h.in index 62c86713..71eeb034 100644 --- a/src/grib2.h.in +++ b/src/grib2.h.in @@ -291,7 +291,7 @@ g2int g2_gribend(unsigned char *cgrib); /* Constants to help with templates. */ #define G2C_MAX_GDS_TEMPLATE 31 /**< Maximum number of grid templates. */ #define G2C_MAX_GDS_TEMPLATE_MAPLEN 28 /**< Maximum grid template map length. */ -#define G2C_MAX_PDS_TEMPLATE 85 /**< Maximum number of PDS templates. */ +#define G2C_MAX_PDS_TEMPLATE 86 /**< Maximum number of PDS templates. */ #define G2C_MAX_PDS_TEMPLATE_MAPLEN 45 /**< Maximum template map length. */ #define G2C_MAX_DRS_TEMPLATE 10 /**< Maximum number of DRS templates. */ #define G2C_MAX_DRS_TEMPLATE_MAPLEN 18 /**< Maximum DRS template map length. */ diff --git a/src/pdstemplates.c b/src/pdstemplates.c index 64909b2d..bbc29f12 100644 --- a/src/pdstemplates.c +++ b/src/pdstemplates.c @@ -384,6 +384,9 @@ static const struct pdstemplate templatespds[G2C_MAX_PDS_TEMPLATE] = 4.104: Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for waves selected by period range */ {104, 23, 0, {1, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}}, + /** PDT 4.108 (12/04/2024) + 4.108: Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for generic optical products */ + {108, 20, 0, {1, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}}, }; /** diff --git a/tests/tst_pdstemplates.c b/tests/tst_pdstemplates.c index d1246b98..a3693c08 100644 --- a/tests/tst_pdstemplates.c +++ b/tests/tst_pdstemplates.c @@ -631,24 +631,24 @@ main() printf("ok!\n"); printf("Testing all getpdstemplate() calls with extensions...\n"); { -#define NUM_TEST 85 +#define NUM_TEST 86 int number[NUM_TEST] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 20, 30, 31, 40, 41, 42, 43, 254, 1000, 1001, 1002, 1100, 1101, 32, 44, 45, 46, 47, 48, 50, 52, 51, 91, 33, 34, 53, 54, 57, 60, 61, 35, 49, 55, 58, 59, 62, 63, 67, 68, 70, 71, 72, 73, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 92, - 93, 94, 95, 96, 97, 98, 99, 100, 103, 104}; + 93, 94, 95, 96, 97, 98, 99, 100, 103, 104, 108}; int expected_maplen[NUM_TEST] = { 15, 18, 17, 31, 30, 22, 16, 15, 29, 36, 30, 32, 31, 45, 44, 18, 19, 5, 5, 16, 19, 30, 33, 3, 9, 16, 15, 15, 22, 10, 21, 24, 35, 38, 26, 21, 15, 16, 36, 18, 32, 19, 22, 7, 24, 38, 6, 29, 21, 7, 24, 35, 38, 7, 7, 19, 21, 32, 34, 17, 20, 31, 34, 27, 30, 36, 40, 39, 38, 17, 31, 24, 20, 34, 27, 27, 30, - 28, 31, 31, 34, 14, 17, 20, 23}; + 28, 31, 31, 34, 14, 17, 20, 23, 20}; int expected_needext[NUM_TEST] = { 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 0, 0}; + 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0}; int expected_map[NUM_TEST][48] = { {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 0 */ {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 1 */ @@ -735,6 +735,7 @@ main() {1, 1, 2, 2, 2, 2, 1, 1, 1, 2, 1, 1, -4, 1, 1, 1, -1}, /* 100 */ {1, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 103 */ {1, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 104 */ + {1, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 108 */ }; int t; int ext_t = 0; From e2b157974fe15e7fcc9acce15bb280968164c9aa Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Fri, 6 Dec 2024 10:07:33 -0800 Subject: [PATCH 58/80] pds 4.109 --- src/grib2.h.in | 2 +- src/pdstemplates.c | 4 ++++ tests/tst_pdstemplates.c | 9 +++++---- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/grib2.h.in b/src/grib2.h.in index 71eeb034..8471661d 100644 --- a/src/grib2.h.in +++ b/src/grib2.h.in @@ -291,7 +291,7 @@ g2int g2_gribend(unsigned char *cgrib); /* Constants to help with templates. */ #define G2C_MAX_GDS_TEMPLATE 31 /**< Maximum number of grid templates. */ #define G2C_MAX_GDS_TEMPLATE_MAPLEN 28 /**< Maximum grid template map length. */ -#define G2C_MAX_PDS_TEMPLATE 86 /**< Maximum number of PDS templates. */ +#define G2C_MAX_PDS_TEMPLATE 87 /**< Maximum number of PDS templates. */ #define G2C_MAX_PDS_TEMPLATE_MAPLEN 45 /**< Maximum template map length. */ #define G2C_MAX_DRS_TEMPLATE 10 /**< Maximum number of DRS templates. */ #define G2C_MAX_DRS_TEMPLATE_MAPLEN 18 /**< Maximum DRS template map length. */ diff --git a/src/pdstemplates.c b/src/pdstemplates.c index bbc29f12..0f9682f7 100644 --- a/src/pdstemplates.c +++ b/src/pdstemplates.c @@ -387,6 +387,10 @@ static const struct pdstemplate templatespds[G2C_MAX_PDS_TEMPLATE] = /** PDT 4.108 (12/04/2024) 4.108: Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for generic optical products */ {108, 20, 0, {1, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}}, + /** PDT 4.109 (12/04/2024) + 4.109: Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a + point in time for generic optical products */ + {109, 23, 0, {1, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}}, }; /** diff --git a/tests/tst_pdstemplates.c b/tests/tst_pdstemplates.c index a3693c08..fb0374e7 100644 --- a/tests/tst_pdstemplates.c +++ b/tests/tst_pdstemplates.c @@ -631,24 +631,24 @@ main() printf("ok!\n"); printf("Testing all getpdstemplate() calls with extensions...\n"); { -#define NUM_TEST 86 +#define NUM_TEST 87 int number[NUM_TEST] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 20, 30, 31, 40, 41, 42, 43, 254, 1000, 1001, 1002, 1100, 1101, 32, 44, 45, 46, 47, 48, 50, 52, 51, 91, 33, 34, 53, 54, 57, 60, 61, 35, 49, 55, 58, 59, 62, 63, 67, 68, 70, 71, 72, 73, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 92, - 93, 94, 95, 96, 97, 98, 99, 100, 103, 104, 108}; + 93, 94, 95, 96, 97, 98, 99, 100, 103, 104, 108, 109}; int expected_maplen[NUM_TEST] = { 15, 18, 17, 31, 30, 22, 16, 15, 29, 36, 30, 32, 31, 45, 44, 18, 19, 5, 5, 16, 19, 30, 33, 3, 9, 16, 15, 15, 22, 10, 21, 24, 35, 38, 26, 21, 15, 16, 36, 18, 32, 19, 22, 7, 24, 38, 6, 29, 21, 7, 24, 35, 38, 7, 7, 19, 21, 32, 34, 17, 20, 31, 34, 27, 30, 36, 40, 39, 38, 17, 31, 24, 20, 34, 27, 27, 30, - 28, 31, 31, 34, 14, 17, 20, 23, 20}; + 28, 31, 31, 34, 14, 17, 20, 23, 20, 23}; int expected_needext[NUM_TEST] = { 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0}; + 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0}; int expected_map[NUM_TEST][48] = { {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 0 */ {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 1 */ @@ -736,6 +736,7 @@ main() {1, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 103 */ {1, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 104 */ {1, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 108 */ + {1, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 109 */ }; int t; int ext_t = 0; From 4e91b772cde59e692f1004d1806e6c29e76395bb Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Fri, 6 Dec 2024 10:15:58 -0800 Subject: [PATCH 59/80] pds 4.110 --- src/grib2.h.in | 2 +- src/pdstemplates.c | 21 +++++++++++++++++++++ tests/tst_pdstemplates.c | 28 ++++++++++++++++++++++------ 3 files changed, 44 insertions(+), 7 deletions(-) diff --git a/src/grib2.h.in b/src/grib2.h.in index 8471661d..28d1cf75 100644 --- a/src/grib2.h.in +++ b/src/grib2.h.in @@ -291,7 +291,7 @@ g2int g2_gribend(unsigned char *cgrib); /* Constants to help with templates. */ #define G2C_MAX_GDS_TEMPLATE 31 /**< Maximum number of grid templates. */ #define G2C_MAX_GDS_TEMPLATE_MAPLEN 28 /**< Maximum grid template map length. */ -#define G2C_MAX_PDS_TEMPLATE 87 /**< Maximum number of PDS templates. */ +#define G2C_MAX_PDS_TEMPLATE 88 /**< Maximum number of PDS templates. */ #define G2C_MAX_PDS_TEMPLATE_MAPLEN 45 /**< Maximum template map length. */ #define G2C_MAX_DRS_TEMPLATE 10 /**< Maximum number of DRS templates. */ #define G2C_MAX_DRS_TEMPLATE_MAPLEN 18 /**< Maximum DRS template map length. */ diff --git a/src/pdstemplates.c b/src/pdstemplates.c index 0f9682f7..53f6106f 100644 --- a/src/pdstemplates.c +++ b/src/pdstemplates.c @@ -391,6 +391,10 @@ static const struct pdstemplate templatespds[G2C_MAX_PDS_TEMPLATE] = 4.109: Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time for generic optical products */ {109, 23, 0, {1, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}}, + /** PDT 4.110 (12/04/2024) + 4.110: Average, accumulation, extreme values or other statistically processed values at a horizontal level or + in a horizontal layer in a continuous or non-continuous time interval for generic optical products */ + {110, 34, 1, {1, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}}, }; /** @@ -1385,6 +1389,23 @@ extpdstemplate(g2int number, g2int *list) new->ext[j + 1 + i] = -4; } } + /* PDT 4.110 (12/04/2024) */ + else if (number == 110) + { + if (list[26] > 1) + { + new->extlen = (list[26] - 1) * 6; + new->ext = malloc(sizeof(g2int) * new->extlen); + for (j = 2; j <= list[26]; j++) + { + l = (j - 2) * 6; + for (k = 0; k < 6; k++) + { + new->ext[l + k] = new->map[28 + k]; + } + } + } + } return new; } diff --git a/tests/tst_pdstemplates.c b/tests/tst_pdstemplates.c index fb0374e7..c0188fb5 100644 --- a/tests/tst_pdstemplates.c +++ b/tests/tst_pdstemplates.c @@ -627,28 +627,39 @@ main() return G2C_ERROR; free(tmpl->ext); free(tmpl); + + /* Check for one that's there but does need an extension. */ + tmpl = extpdstemplate(110, list); + if (!tmpl) + return G2C_ERROR; + if (tmpl->num != 110 || tmpl->maplen != 34 || !tmpl->needext) + return G2C_ERROR; + if (!tmpl->ext) + return G2C_ERROR; + free(tmpl->ext); + free(tmpl); } printf("ok!\n"); printf("Testing all getpdstemplate() calls with extensions...\n"); { -#define NUM_TEST 87 +#define NUM_TEST 88 int number[NUM_TEST] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 20, 30, 31, 40, 41, 42, 43, 254, 1000, 1001, 1002, 1100, 1101, 32, 44, 45, 46, 47, 48, 50, 52, 51, 91, 33, 34, 53, 54, 57, 60, 61, 35, 49, 55, 58, 59, 62, 63, 67, 68, 70, 71, 72, 73, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 92, - 93, 94, 95, 96, 97, 98, 99, 100, 103, 104, 108, 109}; + 93, 94, 95, 96, 97, 98, 99, 100, 103, 104, 108, 109, 110}; int expected_maplen[NUM_TEST] = { 15, 18, 17, 31, 30, 22, 16, 15, 29, 36, 30, 32, 31, 45, 44, 18, 19, 5, 5, 16, 19, 30, 33, 3, 9, 16, 15, 15, 22, 10, 21, 24, 35, 38, 26, 21, 15, 16, 36, 18, 32, 19, 22, 7, 24, 38, 6, 29, 21, 7, 24, 35, 38, 7, 7, 19, 21, 32, 34, 17, 20, 31, 34, 27, 30, 36, 40, 39, 38, 17, 31, 24, 20, 34, 27, 27, 30, - 28, 31, 31, 34, 14, 17, 20, 23, 20, 23}; + 28, 31, 31, 34, 14, 17, 20, 23, 20, 23, 34}; int expected_needext[NUM_TEST] = { 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0}; + 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1}; int expected_map[NUM_TEST][48] = { {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 0 */ {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 1 */ @@ -737,6 +748,7 @@ main() {1, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 104 */ {1, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 108 */ {1, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 109 */ + {1, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 110 */ }; int t; int ext_t = 0; @@ -778,12 +790,12 @@ main() if (map[m] != expected_map[t][m]) return G2C_ERROR; -#define NUM_EXT_TEST 50 +#define NUM_EXT_TEST 51 int template[G2C_MAX_PDS_TEMPLATE_MAPLEN]; int expected_extlen[NUM_EXT_TEST] = { 2, 2, 6, 6, 6, 6, 6, 8, 8, 10, 10, 6, 6, 10, 6, 6, 12, 8, 2, 8, 2, 2, 30, 6, 10, 20, 6, 6, 31, 34, 6, 6, 6, 6, 6, 6, 6, 6, 6, 11, 6, 11, 11, 11, 11, 11, - 11, 11, 5, 5}; + 11, 11, 5, 5, 6}; int expected_ext[NUM_EXT_TEST][48] = { {1, 1}, /* 3 */ {1, 1}, /* 4 */ @@ -835,6 +847,7 @@ main() {2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 98 */ {-4, -4, -1, -4, -4}, /* 99 */ {-4, -4, -1, -4, -4}, /* 100 */ + {1, 1, 1, 4, 1, 4}, /* 110 */ }; if (needext) @@ -1003,6 +1016,9 @@ main() template[3] = 2; template[5] = 2; break; + case 110: + template[26] = 2; + break; default: return G2C_ERROR; } From bc0fc937084b2ced9d2a2fef5f24e29ea48e3694 Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Fri, 6 Dec 2024 10:23:51 -0800 Subject: [PATCH 60/80] pds 4.111 --- src/grib2.h.in | 2 +- src/pdstemplates.c | 21 +++++++++++++++++++++ tests/tst_pdstemplates.c | 28 ++++++++++++++++++++++------ 3 files changed, 44 insertions(+), 7 deletions(-) diff --git a/src/grib2.h.in b/src/grib2.h.in index 28d1cf75..2e3c9cb8 100644 --- a/src/grib2.h.in +++ b/src/grib2.h.in @@ -291,7 +291,7 @@ g2int g2_gribend(unsigned char *cgrib); /* Constants to help with templates. */ #define G2C_MAX_GDS_TEMPLATE 31 /**< Maximum number of grid templates. */ #define G2C_MAX_GDS_TEMPLATE_MAPLEN 28 /**< Maximum grid template map length. */ -#define G2C_MAX_PDS_TEMPLATE 88 /**< Maximum number of PDS templates. */ +#define G2C_MAX_PDS_TEMPLATE 89 /**< Maximum number of PDS templates. */ #define G2C_MAX_PDS_TEMPLATE_MAPLEN 45 /**< Maximum template map length. */ #define G2C_MAX_DRS_TEMPLATE 10 /**< Maximum number of DRS templates. */ #define G2C_MAX_DRS_TEMPLATE_MAPLEN 18 /**< Maximum DRS template map length. */ diff --git a/src/pdstemplates.c b/src/pdstemplates.c index 53f6106f..55cae30b 100644 --- a/src/pdstemplates.c +++ b/src/pdstemplates.c @@ -395,6 +395,10 @@ static const struct pdstemplate templatespds[G2C_MAX_PDS_TEMPLATE] = 4.110: Average, accumulation, extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for generic optical products */ {110, 34, 1, {1, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}}, + /** PDT 4.111 (12/04/2024) + 4.110: Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer, + in a continuous or non-continuous interval for generic optical products */ + {111, 37, 1, {1, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}}, }; /** @@ -1406,6 +1410,23 @@ extpdstemplate(g2int number, g2int *list) } } } + /* PDT 4.111 (12/04/2024) */ + else if (number == 111) + { + if (list[29] > 1) + { + new->extlen = (list[29] - 1) * 6; + new->ext = malloc(sizeof(g2int) * new->extlen); + for (j = 2; j <= list[29]; j++) + { + l = (j - 2) * 6; + for (k = 0; k < 6; k++) + { + new->ext[l + k] = new->map[31 + k]; + } + } + } + } return new; } diff --git a/tests/tst_pdstemplates.c b/tests/tst_pdstemplates.c index c0188fb5..ef85fe14 100644 --- a/tests/tst_pdstemplates.c +++ b/tests/tst_pdstemplates.c @@ -638,28 +638,39 @@ main() return G2C_ERROR; free(tmpl->ext); free(tmpl); + + /* Check for one that's there but does need an extension. */ + tmpl = extpdstemplate(111, list); + if (!tmpl) + return G2C_ERROR; + if (tmpl->num != 111 || tmpl->maplen != 37 || !tmpl->needext) + return G2C_ERROR; + if (!tmpl->ext) + return G2C_ERROR; + free(tmpl->ext); + free(tmpl); } printf("ok!\n"); printf("Testing all getpdstemplate() calls with extensions...\n"); { -#define NUM_TEST 88 +#define NUM_TEST 89 int number[NUM_TEST] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 20, 30, 31, 40, 41, 42, 43, 254, 1000, 1001, 1002, 1100, 1101, 32, 44, 45, 46, 47, 48, 50, 52, 51, 91, 33, 34, 53, 54, 57, 60, 61, 35, 49, 55, 58, 59, 62, 63, 67, 68, 70, 71, 72, 73, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 92, - 93, 94, 95, 96, 97, 98, 99, 100, 103, 104, 108, 109, 110}; + 93, 94, 95, 96, 97, 98, 99, 100, 103, 104, 108, 109, 110, 111}; int expected_maplen[NUM_TEST] = { 15, 18, 17, 31, 30, 22, 16, 15, 29, 36, 30, 32, 31, 45, 44, 18, 19, 5, 5, 16, 19, 30, 33, 3, 9, 16, 15, 15, 22, 10, 21, 24, 35, 38, 26, 21, 15, 16, 36, 18, 32, 19, 22, 7, 24, 38, 6, 29, 21, 7, 24, 35, 38, 7, 7, 19, 21, 32, 34, 17, 20, 31, 34, 27, 30, 36, 40, 39, 38, 17, 31, 24, 20, 34, 27, 27, 30, - 28, 31, 31, 34, 14, 17, 20, 23, 20, 23, 34}; + 28, 31, 31, 34, 14, 17, 20, 23, 20, 23, 34, 37}; int expected_needext[NUM_TEST] = { 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1}; + 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1}; int expected_map[NUM_TEST][48] = { {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 0 */ {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 1 */ @@ -749,6 +760,7 @@ main() {1, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 108 */ {1, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 109 */ {1, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 110 */ + {1, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1 ,-4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 111 */ }; int t; int ext_t = 0; @@ -790,12 +802,12 @@ main() if (map[m] != expected_map[t][m]) return G2C_ERROR; -#define NUM_EXT_TEST 51 +#define NUM_EXT_TEST 52 int template[G2C_MAX_PDS_TEMPLATE_MAPLEN]; int expected_extlen[NUM_EXT_TEST] = { 2, 2, 6, 6, 6, 6, 6, 8, 8, 10, 10, 6, 6, 10, 6, 6, 12, 8, 2, 8, 2, 2, 30, 6, 10, 20, 6, 6, 31, 34, 6, 6, 6, 6, 6, 6, 6, 6, 6, 11, 6, 11, 11, 11, 11, 11, - 11, 11, 5, 5, 6}; + 11, 11, 5, 5, 6, 6}; int expected_ext[NUM_EXT_TEST][48] = { {1, 1}, /* 3 */ {1, 1}, /* 4 */ @@ -848,6 +860,7 @@ main() {-4, -4, -1, -4, -4}, /* 99 */ {-4, -4, -1, -4, -4}, /* 100 */ {1, 1, 1, 4, 1, 4}, /* 110 */ + {1, 1, 1, 4, 1, 4}, /* 111 */ }; if (needext) @@ -1019,6 +1032,9 @@ main() case 110: template[26] = 2; break; + case 111: + template[29] = 2; + break; default: return G2C_ERROR; } From d485ce05a76845d33dca06ec66961b59927deaf4 Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Fri, 6 Dec 2024 10:36:39 -0800 Subject: [PATCH 61/80] pds 4.113 --- src/grib2.h.in | 2 +- src/pdstemplates.c | 32 +++++++++++++++++++++++++++++++- tests/tst_pdstemplates.c | 30 +++++++++++++++++++++++------- 3 files changed, 55 insertions(+), 9 deletions(-) diff --git a/src/grib2.h.in b/src/grib2.h.in index 2e3c9cb8..9b86435e 100644 --- a/src/grib2.h.in +++ b/src/grib2.h.in @@ -291,7 +291,7 @@ g2int g2_gribend(unsigned char *cgrib); /* Constants to help with templates. */ #define G2C_MAX_GDS_TEMPLATE 31 /**< Maximum number of grid templates. */ #define G2C_MAX_GDS_TEMPLATE_MAPLEN 28 /**< Maximum grid template map length. */ -#define G2C_MAX_PDS_TEMPLATE 89 /**< Maximum number of PDS templates. */ +#define G2C_MAX_PDS_TEMPLATE 90 /**< Maximum number of PDS templates. */ #define G2C_MAX_PDS_TEMPLATE_MAPLEN 45 /**< Maximum template map length. */ #define G2C_MAX_DRS_TEMPLATE 10 /**< Maximum number of DRS templates. */ #define G2C_MAX_DRS_TEMPLATE_MAPLEN 18 /**< Maximum DRS template map length. */ diff --git a/src/pdstemplates.c b/src/pdstemplates.c index 55cae30b..de306c8e 100644 --- a/src/pdstemplates.c +++ b/src/pdstemplates.c @@ -396,9 +396,12 @@ static const struct pdstemplate templatespds[G2C_MAX_PDS_TEMPLATE] = in a horizontal layer in a continuous or non-continuous time interval for generic optical products */ {110, 34, 1, {1, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}}, /** PDT 4.111 (12/04/2024) - 4.110: Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer, + 4.111: Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer, in a continuous or non-continuous interval for generic optical products */ {111, 37, 1, {1, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}}, + /** PDT 4.113 (12/04/2024) + 4.113: Generalized tiles at a horizontal level or horizontal layer at a point in time */ + {113, 7, 1, {1, 1, 1, 2, 1, 1, 1}}, }; /** @@ -1427,6 +1430,33 @@ extpdstemplate(g2int number, g2int *list) } } } + /* PDT 4.113 (12/04/2024) */ + else if (number == 113) + { + new->extlen = list[6] + 16; + new->ext = malloc(sizeof(g2int) * new->extlen); + for (i = 0; i < list[6]; i++) + { + new->ext[i] = 1; + } + l = list[6] + new->ext[l] = 1; + new->ext[l + 1] = 1; + new->ext[l + 2] = 16; + new->ext[l + 3] = 1; + new->ext[l + 4] = 1; + new->ext[l + 5] = 1; + new->ext[l + 6] = 2; + new->ext[l + 7] = 1; + new->ext[l + 8] = 1; + new->ext[l + 9] = -4; + new->ext[l + 10] = 1; + new->ext[l + 11] = -1; + new->ext[l + 12] = -4; + new->ext[l + 13] = 1; + new->ext[l + 14] = -1; + new->ext[l + 15] = -4; + } return new; } diff --git a/tests/tst_pdstemplates.c b/tests/tst_pdstemplates.c index ef85fe14..fb1b0de6 100644 --- a/tests/tst_pdstemplates.c +++ b/tests/tst_pdstemplates.c @@ -649,28 +649,39 @@ main() return G2C_ERROR; free(tmpl->ext); free(tmpl); + + /* Check for one that's there but does need an extension. */ + tmpl = extpdstemplate(113, list); + if (!tmpl) + return G2C_ERROR; + if (tmpl->num != 113 || tmpl->maplen != 7 || !tmpl->needext) + return G2C_ERROR; + if (!tmpl->ext) + return G2C_ERROR; + free(tmpl->ext); + free(tmpl); } printf("ok!\n"); printf("Testing all getpdstemplate() calls with extensions...\n"); { -#define NUM_TEST 89 +#define NUM_TEST 90 int number[NUM_TEST] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 20, 30, 31, 40, 41, 42, 43, 254, 1000, 1001, 1002, 1100, 1101, 32, 44, 45, 46, 47, 48, 50, 52, 51, 91, 33, 34, 53, 54, 57, 60, 61, 35, 49, 55, 58, 59, 62, 63, 67, 68, 70, 71, 72, 73, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 92, - 93, 94, 95, 96, 97, 98, 99, 100, 103, 104, 108, 109, 110, 111}; + 93, 94, 95, 96, 97, 98, 99, 100, 103, 104, 108, 109, 110, 111, 113}; int expected_maplen[NUM_TEST] = { 15, 18, 17, 31, 30, 22, 16, 15, 29, 36, 30, 32, 31, 45, 44, 18, 19, 5, 5, 16, 19, 30, 33, 3, 9, 16, 15, 15, 22, 10, 21, 24, 35, 38, 26, 21, 15, 16, 36, 18, 32, 19, 22, 7, 24, 38, 6, 29, 21, 7, 24, 35, 38, 7, 7, 19, 21, 32, 34, 17, 20, 31, 34, 27, 30, 36, 40, 39, 38, 17, 31, 24, 20, 34, 27, 27, 30, - 28, 31, 31, 34, 14, 17, 20, 23, 20, 23, 34, 37}; + 28, 31, 31, 34, 14, 17, 20, 23, 20, 23, 34, 37, 7}; int expected_needext[NUM_TEST] = { 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1}; + 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1}; int expected_map[NUM_TEST][48] = { {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 0 */ {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 1 */ @@ -760,7 +771,8 @@ main() {1, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 108 */ {1, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 109 */ {1, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 110 */ - {1, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1 ,-4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 111 */ + {1, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 111 */ + {1, 1, 1, 2, 1, 1, 1}, /* 113 */ }; int t; int ext_t = 0; @@ -802,12 +814,12 @@ main() if (map[m] != expected_map[t][m]) return G2C_ERROR; -#define NUM_EXT_TEST 52 +#define NUM_EXT_TEST 53 int template[G2C_MAX_PDS_TEMPLATE_MAPLEN]; int expected_extlen[NUM_EXT_TEST] = { 2, 2, 6, 6, 6, 6, 6, 8, 8, 10, 10, 6, 6, 10, 6, 6, 12, 8, 2, 8, 2, 2, 30, 6, 10, 20, 6, 6, 31, 34, 6, 6, 6, 6, 6, 6, 6, 6, 6, 11, 6, 11, 11, 11, 11, 11, - 11, 11, 5, 5, 6, 6}; + 11, 11, 5, 5, 6, 6, 18}; int expected_ext[NUM_EXT_TEST][48] = { {1, 1}, /* 3 */ {1, 1}, /* 4 */ @@ -861,6 +873,7 @@ main() {-4, -4, -1, -4, -4}, /* 100 */ {1, 1, 1, 4, 1, 4}, /* 110 */ {1, 1, 1, 4, 1, 4}, /* 111 */ + {1, 1, 1, 1, 16, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 113 */ }; if (needext) @@ -1035,6 +1048,9 @@ main() case 111: template[29] = 2; break; + case 113: + template[6] = 2; + break; default: return G2C_ERROR; } From 5bb11ba5bfd5d7dddb14f8e84d021c0c0216bbbb Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Fri, 6 Dec 2024 10:37:51 -0800 Subject: [PATCH 62/80] typo --- src/pdstemplates.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pdstemplates.c b/src/pdstemplates.c index de306c8e..e1bff8ab 100644 --- a/src/pdstemplates.c +++ b/src/pdstemplates.c @@ -1439,7 +1439,7 @@ extpdstemplate(g2int number, g2int *list) { new->ext[i] = 1; } - l = list[6] + l = list[6]; new->ext[l] = 1; new->ext[l + 1] = 1; new->ext[l + 2] = 16; From ba0f23aeb57613120e19aa771d3a61d77d54176a Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Fri, 6 Dec 2024 10:46:47 -0800 Subject: [PATCH 63/80] pds 4.114 --- src/grib2.h.in | 2 +- src/pdstemplates.c | 45 ++++++++++++++++++++++++++++++++++++++++ tests/tst_pdstemplates.c | 28 +++++++++++++++++++------ 3 files changed, 68 insertions(+), 7 deletions(-) diff --git a/src/grib2.h.in b/src/grib2.h.in index 9b86435e..d34d8833 100644 --- a/src/grib2.h.in +++ b/src/grib2.h.in @@ -291,7 +291,7 @@ g2int g2_gribend(unsigned char *cgrib); /* Constants to help with templates. */ #define G2C_MAX_GDS_TEMPLATE 31 /**< Maximum number of grid templates. */ #define G2C_MAX_GDS_TEMPLATE_MAPLEN 28 /**< Maximum grid template map length. */ -#define G2C_MAX_PDS_TEMPLATE 90 /**< Maximum number of PDS templates. */ +#define G2C_MAX_PDS_TEMPLATE 91 /**< Maximum number of PDS templates. */ #define G2C_MAX_PDS_TEMPLATE_MAPLEN 45 /**< Maximum template map length. */ #define G2C_MAX_DRS_TEMPLATE 10 /**< Maximum number of DRS templates. */ #define G2C_MAX_DRS_TEMPLATE_MAPLEN 18 /**< Maximum DRS template map length. */ diff --git a/src/pdstemplates.c b/src/pdstemplates.c index e1bff8ab..3dde92dc 100644 --- a/src/pdstemplates.c +++ b/src/pdstemplates.c @@ -402,6 +402,10 @@ static const struct pdstemplate templatespds[G2C_MAX_PDS_TEMPLATE] = /** PDT 4.113 (12/04/2024) 4.113: Generalized tiles at a horizontal level or horizontal layer at a point in time */ {113, 7, 1, {1, 1, 1, 2, 1, 1, 1}}, + /** PDT 4.114 (12/04/2024) + 4.114: Average, accumulation, and/or extreme values or other statistically processed values on generalized tiles at a + horizontal level or in a horizontal layer in a continuous or non-continuous time interval */ + {114, 7, 1, {1, 1, 1, 2, 1, 1, 1}}, }; /** @@ -1457,6 +1461,47 @@ extpdstemplate(g2int number, g2int *list) new->ext[l + 14] = -1; new->ext[l + 15] = -4; } + /* PDT 4.114 (12/04/2024) */ + else if (number == 114) + { + new->extlen = list[6] + 30; + new->ext = malloc(sizeof(g2int) * new->extlen); + for (i = 0; i < list[6]; i++) + { + new->ext[i] = 1; + } + l = list[6]; + new->ext[l] = 1; + new->ext[l + 1] = 1; + new->ext[l + 2] = 16; + new->ext[l + 3] = 1; + new->ext[l + 4] = 1; + new->ext[l + 5] = 1; + new->ext[l + 6] = 2; + new->ext[l + 7] = 1; + new->ext[l + 8] = 1; + new->ext[l + 9] = -4; + new->ext[l + 10] = 1; + new->ext[l + 11] = -1; + new->ext[l + 12] = -4; + new->ext[l + 13] = 1; + new->ext[l + 14] = -1; + new->ext[l + 15] = -4; + new->ext[l + 16] = 2; + new->ext[l + 17] = 1; + new->ext[l + 18] = 1; + new->ext[l + 19] = 1; + new->ext[l + 20] = 1; + new->ext[l + 21] = 1; + new->ext[l + 22] = 1; + new->ext[l + 23] = 4; + new->ext[l + 24] = 1; + new->ext[l + 25] = 1; + new->ext[l + 26] = 1; + new->ext[l + 27] = 4; + new->ext[l + 28] = 1; + new->ext[l + 29] = 4; + } return new; } diff --git a/tests/tst_pdstemplates.c b/tests/tst_pdstemplates.c index fb1b0de6..9275e6e6 100644 --- a/tests/tst_pdstemplates.c +++ b/tests/tst_pdstemplates.c @@ -660,28 +660,39 @@ main() return G2C_ERROR; free(tmpl->ext); free(tmpl); + + /* Check for one that's there but does need an extension. */ + tmpl = extpdstemplate(114, list); + if (!tmpl) + return G2C_ERROR; + if (tmpl->num != 114 || tmpl->maplen != 7 || !tmpl->needext) + return G2C_ERROR; + if (!tmpl->ext) + return G2C_ERROR; + free(tmpl->ext); + free(tmpl); } printf("ok!\n"); printf("Testing all getpdstemplate() calls with extensions...\n"); { -#define NUM_TEST 90 +#define NUM_TEST 91 int number[NUM_TEST] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 20, 30, 31, 40, 41, 42, 43, 254, 1000, 1001, 1002, 1100, 1101, 32, 44, 45, 46, 47, 48, 50, 52, 51, 91, 33, 34, 53, 54, 57, 60, 61, 35, 49, 55, 58, 59, 62, 63, 67, 68, 70, 71, 72, 73, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 92, - 93, 94, 95, 96, 97, 98, 99, 100, 103, 104, 108, 109, 110, 111, 113}; + 93, 94, 95, 96, 97, 98, 99, 100, 103, 104, 108, 109, 110, 111, 113, 114}; int expected_maplen[NUM_TEST] = { 15, 18, 17, 31, 30, 22, 16, 15, 29, 36, 30, 32, 31, 45, 44, 18, 19, 5, 5, 16, 19, 30, 33, 3, 9, 16, 15, 15, 22, 10, 21, 24, 35, 38, 26, 21, 15, 16, 36, 18, 32, 19, 22, 7, 24, 38, 6, 29, 21, 7, 24, 35, 38, 7, 7, 19, 21, 32, 34, 17, 20, 31, 34, 27, 30, 36, 40, 39, 38, 17, 31, 24, 20, 34, 27, 27, 30, - 28, 31, 31, 34, 14, 17, 20, 23, 20, 23, 34, 37, 7}; + 28, 31, 31, 34, 14, 17, 20, 23, 20, 23, 34, 37, 7, 7}; int expected_needext[NUM_TEST] = { 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1}; + 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1}; int expected_map[NUM_TEST][48] = { {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 0 */ {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 1 */ @@ -773,6 +784,7 @@ main() {1, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 110 */ {1, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 111 */ {1, 1, 1, 2, 1, 1, 1}, /* 113 */ + {1, 1, 1, 2, 1, 1, 1}, /* 114 */ }; int t; int ext_t = 0; @@ -814,12 +826,12 @@ main() if (map[m] != expected_map[t][m]) return G2C_ERROR; -#define NUM_EXT_TEST 53 +#define NUM_EXT_TEST 54 int template[G2C_MAX_PDS_TEMPLATE_MAPLEN]; int expected_extlen[NUM_EXT_TEST] = { 2, 2, 6, 6, 6, 6, 6, 8, 8, 10, 10, 6, 6, 10, 6, 6, 12, 8, 2, 8, 2, 2, 30, 6, 10, 20, 6, 6, 31, 34, 6, 6, 6, 6, 6, 6, 6, 6, 6, 11, 6, 11, 11, 11, 11, 11, - 11, 11, 5, 5, 6, 6, 18}; + 11, 11, 5, 5, 6, 6, 18, 32}; int expected_ext[NUM_EXT_TEST][48] = { {1, 1}, /* 3 */ {1, 1}, /* 4 */ @@ -874,6 +886,7 @@ main() {1, 1, 1, 4, 1, 4}, /* 110 */ {1, 1, 1, 4, 1, 4}, /* 111 */ {1, 1, 1, 1, 16, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 113 */ + {1, 1, 1, 1, 16, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 1}, /* 114 */ }; if (needext) @@ -1051,6 +1064,9 @@ main() case 113: template[6] = 2; break; + case 114: + template[6] = 2; + break; default: return G2C_ERROR; } From 454c491c0949737935cc1b83996c3ca4bd3096e8 Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Fri, 6 Dec 2024 10:49:03 -0800 Subject: [PATCH 64/80] Update tst_pdstemplates.c --- tests/tst_pdstemplates.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/tst_pdstemplates.c b/tests/tst_pdstemplates.c index 9275e6e6..b25628dc 100644 --- a/tests/tst_pdstemplates.c +++ b/tests/tst_pdstemplates.c @@ -886,7 +886,7 @@ main() {1, 1, 1, 4, 1, 4}, /* 110 */ {1, 1, 1, 4, 1, 4}, /* 111 */ {1, 1, 1, 1, 16, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 113 */ - {1, 1, 1, 1, 16, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 1}, /* 114 */ + {1, 1, 1, 1, 16, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 114 */ }; if (needext) From 9ce28056108c8bd0c51d9e95dc1ba33fb08544fb Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Fri, 6 Dec 2024 10:55:58 -0800 Subject: [PATCH 65/80] pds 4.115 --- src/grib2.h.in | 2 +- src/pdstemplates.c | 33 +++++++++++++++++++++++++++++++++ tests/tst_pdstemplates.c | 27 ++++++++++++++++++++++----- 3 files changed, 56 insertions(+), 6 deletions(-) diff --git a/src/grib2.h.in b/src/grib2.h.in index d34d8833..9a982217 100644 --- a/src/grib2.h.in +++ b/src/grib2.h.in @@ -291,7 +291,7 @@ g2int g2_gribend(unsigned char *cgrib); /* Constants to help with templates. */ #define G2C_MAX_GDS_TEMPLATE 31 /**< Maximum number of grid templates. */ #define G2C_MAX_GDS_TEMPLATE_MAPLEN 28 /**< Maximum grid template map length. */ -#define G2C_MAX_PDS_TEMPLATE 91 /**< Maximum number of PDS templates. */ +#define G2C_MAX_PDS_TEMPLATE 92 /**< Maximum number of PDS templates. */ #define G2C_MAX_PDS_TEMPLATE_MAPLEN 45 /**< Maximum template map length. */ #define G2C_MAX_DRS_TEMPLATE 10 /**< Maximum number of DRS templates. */ #define G2C_MAX_DRS_TEMPLATE_MAPLEN 18 /**< Maximum DRS template map length. */ diff --git a/src/pdstemplates.c b/src/pdstemplates.c index 3dde92dc..9c7bfcf2 100644 --- a/src/pdstemplates.c +++ b/src/pdstemplates.c @@ -406,6 +406,10 @@ static const struct pdstemplate templatespds[G2C_MAX_PDS_TEMPLATE] = 4.114: Average, accumulation, and/or extreme values or other statistically processed values on generalized tiles at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval */ {114, 7, 1, {1, 1, 1, 2, 1, 1, 1}}, + /** PDT 4.115 (12/04/2024) + 4.115: Individual ensemble forecast, control and perturbed on generalized tiles at a horizontal level or in a horizontal + layer at a point in time */ + {115, 7, 1, {1, 1, 1, 2, 1, 1, 1}}, }; /** @@ -1502,6 +1506,35 @@ extpdstemplate(g2int number, g2int *list) new->ext[l + 28] = 1; new->ext[l + 29] = 4; } + else if (number == 115) + { + new->extlen = list[6] + 19; + new->ext = malloc(sizeof(g2int) * new->extlen); + for (i = 0; i < list[6]; i++) + { + new->ext[i] = 1; + } + l = list[6]; + new->ext[l] = 1; + new->ext[l + 1] = 1; + new->ext[l + 2] = 16; + new->ext[l + 3] = 1; + new->ext[l + 4] = 1; + new->ext[l + 5] = 1; + new->ext[l + 6] = 2; + new->ext[l + 7] = 1; + new->ext[l + 8] = 1; + new->ext[l + 9] = -4; + new->ext[l + 10] = 1; + new->ext[l + 11] = -1; + new->ext[l + 12] = -4; + new->ext[l + 13] = 1; + new->ext[l + 14] = -1; + new->ext[l + 15] = -4; + new->ext[l + 16] = 1; + new->ext[l + 17] = 1; + new->ext[l + 18] = 1; + } return new; } diff --git a/tests/tst_pdstemplates.c b/tests/tst_pdstemplates.c index b25628dc..2cf198e1 100644 --- a/tests/tst_pdstemplates.c +++ b/tests/tst_pdstemplates.c @@ -671,28 +671,40 @@ main() return G2C_ERROR; free(tmpl->ext); free(tmpl); + + /* Check for one that's there but does need an extension. */ + tmpl = extpdstemplate(115, list); + if (!tmpl) + return G2C_ERROR; + if (tmpl->num != 115 || tmpl->maplen != 7 || !tmpl->needext) + return G2C_ERROR; + if (!tmpl->ext) + return G2C_ERROR; + free(tmpl->ext); + free(tmpl); } printf("ok!\n"); printf("Testing all getpdstemplate() calls with extensions...\n"); { -#define NUM_TEST 91 +#define NUM_TEST 92 int number[NUM_TEST] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 20, 30, 31, 40, 41, 42, 43, 254, 1000, 1001, 1002, 1100, 1101, 32, 44, 45, 46, 47, 48, 50, 52, 51, 91, 33, 34, 53, 54, 57, 60, 61, 35, 49, 55, 58, 59, 62, 63, 67, 68, 70, 71, 72, 73, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 92, - 93, 94, 95, 96, 97, 98, 99, 100, 103, 104, 108, 109, 110, 111, 113, 114}; + 93, 94, 95, 96, 97, 98, 99, 100, 103, 104, 108, 109, 110, 111, 113, 114, + 115}; int expected_maplen[NUM_TEST] = { 15, 18, 17, 31, 30, 22, 16, 15, 29, 36, 30, 32, 31, 45, 44, 18, 19, 5, 5, 16, 19, 30, 33, 3, 9, 16, 15, 15, 22, 10, 21, 24, 35, 38, 26, 21, 15, 16, 36, 18, 32, 19, 22, 7, 24, 38, 6, 29, 21, 7, 24, 35, 38, 7, 7, 19, 21, 32, 34, 17, 20, 31, 34, 27, 30, 36, 40, 39, 38, 17, 31, 24, 20, 34, 27, 27, 30, - 28, 31, 31, 34, 14, 17, 20, 23, 20, 23, 34, 37, 7, 7}; + 28, 31, 31, 34, 14, 17, 20, 23, 20, 23, 34, 37, 7, 7, 7}; int expected_needext[NUM_TEST] = { 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1}; + 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1}; int expected_map[NUM_TEST][48] = { {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 0 */ {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 1 */ @@ -785,6 +797,7 @@ main() {1, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 111 */ {1, 1, 1, 2, 1, 1, 1}, /* 113 */ {1, 1, 1, 2, 1, 1, 1}, /* 114 */ + {1, 1, 1, 2, 1, 1, 1}, /* 115 */ }; int t; int ext_t = 0; @@ -831,7 +844,7 @@ main() int expected_extlen[NUM_EXT_TEST] = { 2, 2, 6, 6, 6, 6, 6, 8, 8, 10, 10, 6, 6, 10, 6, 6, 12, 8, 2, 8, 2, 2, 30, 6, 10, 20, 6, 6, 31, 34, 6, 6, 6, 6, 6, 6, 6, 6, 6, 11, 6, 11, 11, 11, 11, 11, - 11, 11, 5, 5, 6, 6, 18, 32}; + 11, 11, 5, 5, 6, 6, 18, 32, 21}; int expected_ext[NUM_EXT_TEST][48] = { {1, 1}, /* 3 */ {1, 1}, /* 4 */ @@ -887,6 +900,7 @@ main() {1, 1, 1, 4, 1, 4}, /* 111 */ {1, 1, 1, 1, 16, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 113 */ {1, 1, 1, 1, 16, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 114 */ + {1, 1, 1, 1, 16, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 115 */ }; if (needext) @@ -1067,6 +1081,9 @@ main() case 114: template[6] = 2; break; + case 115: + template[6] = 2; + break; default: return G2C_ERROR; } From 598f4a95eaa686af9d0e6968ec256a8d00a8ee87 Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Fri, 6 Dec 2024 11:00:22 -0800 Subject: [PATCH 66/80] fix 4.115 extension + test --- src/pdstemplates.c | 4 ++-- tests/tst_pdstemplates.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pdstemplates.c b/src/pdstemplates.c index 9c7bfcf2..45f4b9af 100644 --- a/src/pdstemplates.c +++ b/src/pdstemplates.c @@ -1532,8 +1532,8 @@ extpdstemplate(g2int number, g2int *list) new->ext[l + 14] = -1; new->ext[l + 15] = -4; new->ext[l + 16] = 1; - new->ext[l + 17] = 1; - new->ext[l + 18] = 1; + new->ext[l + 17] = 4; + new->ext[l + 18] = 4; } return new; } diff --git a/tests/tst_pdstemplates.c b/tests/tst_pdstemplates.c index 2cf198e1..0b4c0abf 100644 --- a/tests/tst_pdstemplates.c +++ b/tests/tst_pdstemplates.c @@ -839,7 +839,7 @@ main() if (map[m] != expected_map[t][m]) return G2C_ERROR; -#define NUM_EXT_TEST 54 +#define NUM_EXT_TEST 55 int template[G2C_MAX_PDS_TEMPLATE_MAPLEN]; int expected_extlen[NUM_EXT_TEST] = { 2, 2, 6, 6, 6, 6, 6, 8, 8, 10, 10, 6, 6, 10, 6, 6, 12, 8, 2, 8, 2, 2, 30, 6, @@ -900,7 +900,7 @@ main() {1, 1, 1, 4, 1, 4}, /* 111 */ {1, 1, 1, 1, 16, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 113 */ {1, 1, 1, 1, 16, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 114 */ - {1, 1, 1, 1, 16, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 115 */ + {1, 1, 1, 1, 16, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 4, 4}, /* 115 */ }; if (needext) From 21ff896d43e75764e32366db1446e1e260925464 Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Fri, 6 Dec 2024 11:09:16 -0800 Subject: [PATCH 67/80] pds 4.116 --- src/grib2.h.in | 2 +- src/pdstemplates.c | 48 ++++++++++++++++++++++++++++++++++++++++ tests/tst_pdstemplates.c | 28 ++++++++++++++++++----- 3 files changed, 71 insertions(+), 7 deletions(-) diff --git a/src/grib2.h.in b/src/grib2.h.in index 9a982217..794ada34 100644 --- a/src/grib2.h.in +++ b/src/grib2.h.in @@ -291,7 +291,7 @@ g2int g2_gribend(unsigned char *cgrib); /* Constants to help with templates. */ #define G2C_MAX_GDS_TEMPLATE 31 /**< Maximum number of grid templates. */ #define G2C_MAX_GDS_TEMPLATE_MAPLEN 28 /**< Maximum grid template map length. */ -#define G2C_MAX_PDS_TEMPLATE 92 /**< Maximum number of PDS templates. */ +#define G2C_MAX_PDS_TEMPLATE 93 /**< Maximum number of PDS templates. */ #define G2C_MAX_PDS_TEMPLATE_MAPLEN 45 /**< Maximum template map length. */ #define G2C_MAX_DRS_TEMPLATE 10 /**< Maximum number of DRS templates. */ #define G2C_MAX_DRS_TEMPLATE_MAPLEN 18 /**< Maximum DRS template map length. */ diff --git a/src/pdstemplates.c b/src/pdstemplates.c index 45f4b9af..c7aa696d 100644 --- a/src/pdstemplates.c +++ b/src/pdstemplates.c @@ -410,6 +410,10 @@ static const struct pdstemplate templatespds[G2C_MAX_PDS_TEMPLATE] = 4.115: Individual ensemble forecast, control and perturbed on generalized tiles at a horizontal level or in a horizontal layer at a point in time */ {115, 7, 1, {1, 1, 1, 2, 1, 1, 1}}, + /** PDT 4.116 (12/04/2024) + 4.116: Individual ensemble forecast, control and perturbed on generalized tiles at a horizontal level or in a horizontal + layer in a continuous or non-continuous time interval */ + {116, 7, 1, {1, 1, 1, 2, 1, 1, 1}}, }; /** @@ -1535,6 +1539,50 @@ extpdstemplate(g2int number, g2int *list) new->ext[l + 17] = 4; new->ext[l + 18] = 4; } + /* PDT 4.116 (12/04/2024) */ + else if (number == 116) + { + new->extlen = list[6] + 33; + new->ext = malloc(sizeof(g2int) * new->extlen); + for (i = 0; i < list[6]; i++) + { + new->ext[i] = 1; + } + l = list[6]; + new->ext[l] = 1; + new->ext[l + 1] = 1; + new->ext[l + 2] = 16; + new->ext[l + 3] = 1; + new->ext[l + 4] = 1; + new->ext[l + 5] = 1; + new->ext[l + 6] = 2; + new->ext[l + 7] = 1; + new->ext[l + 8] = 1; + new->ext[l + 9] = -4; + new->ext[l + 10] = 1; + new->ext[l + 11] = -1; + new->ext[l + 12] = -4; + new->ext[l + 13] = 1; + new->ext[l + 14] = -1; + new->ext[l + 15] = -4; + new->ext[l + 16] = 1; + new->ext[l + 17] = 4; + new->ext[l + 18] = 4; + new->ext[l + 19] = 2; + new->ext[l + 20] = 1; + new->ext[l + 21] = 1; + new->ext[l + 22] = 1; + new->ext[l + 23] = 1; + new->ext[l + 24] = 1; + new->ext[l + 25] = 1; + new->ext[l + 26] = 4; + new->ext[l + 27] = 1; + new->ext[l + 28] = 1; + new->ext[l + 29] = 1; + new->ext[l + 30] = 4; + new->ext[l + 31] = 1; + new->ext[l + 32] = 4; + } return new; } diff --git a/tests/tst_pdstemplates.c b/tests/tst_pdstemplates.c index 0b4c0abf..898c718a 100644 --- a/tests/tst_pdstemplates.c +++ b/tests/tst_pdstemplates.c @@ -682,29 +682,40 @@ main() return G2C_ERROR; free(tmpl->ext); free(tmpl); + + /* Check for one that's there but does need an extension. */ + tmpl = extpdstemplate(116, list); + if (!tmpl) + return G2C_ERROR; + if (tmpl->num != 116 || tmpl->maplen != 7 || !tmpl->needext) + return G2C_ERROR; + if (!tmpl->ext) + return G2C_ERROR; + free(tmpl->ext); + free(tmpl); } printf("ok!\n"); printf("Testing all getpdstemplate() calls with extensions...\n"); { -#define NUM_TEST 92 +#define NUM_TEST 93 int number[NUM_TEST] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 20, 30, 31, 40, 41, 42, 43, 254, 1000, 1001, 1002, 1100, 1101, 32, 44, 45, 46, 47, 48, 50, 52, 51, 91, 33, 34, 53, 54, 57, 60, 61, 35, 49, 55, 58, 59, 62, 63, 67, 68, 70, 71, 72, 73, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 92, 93, 94, 95, 96, 97, 98, 99, 100, 103, 104, 108, 109, 110, 111, 113, 114, - 115}; + 115, 116}; int expected_maplen[NUM_TEST] = { 15, 18, 17, 31, 30, 22, 16, 15, 29, 36, 30, 32, 31, 45, 44, 18, 19, 5, 5, 16, 19, 30, 33, 3, 9, 16, 15, 15, 22, 10, 21, 24, 35, 38, 26, 21, 15, 16, 36, 18, 32, 19, 22, 7, 24, 38, 6, 29, 21, 7, 24, 35, 38, 7, 7, 19, 21, 32, 34, 17, 20, 31, 34, 27, 30, 36, 40, 39, 38, 17, 31, 24, 20, 34, 27, 27, 30, - 28, 31, 31, 34, 14, 17, 20, 23, 20, 23, 34, 37, 7, 7, 7}; + 28, 31, 31, 34, 14, 17, 20, 23, 20, 23, 34, 37, 7, 7, 7, 7}; int expected_needext[NUM_TEST] = { 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1}; + 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1}; int expected_map[NUM_TEST][48] = { {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 0 */ {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 1 */ @@ -798,6 +809,7 @@ main() {1, 1, 1, 2, 1, 1, 1}, /* 113 */ {1, 1, 1, 2, 1, 1, 1}, /* 114 */ {1, 1, 1, 2, 1, 1, 1}, /* 115 */ + {1, 1, 1, 2, 1, 1, 1}, /* 116 */ }; int t; int ext_t = 0; @@ -839,12 +851,12 @@ main() if (map[m] != expected_map[t][m]) return G2C_ERROR; -#define NUM_EXT_TEST 55 +#define NUM_EXT_TEST 56 int template[G2C_MAX_PDS_TEMPLATE_MAPLEN]; int expected_extlen[NUM_EXT_TEST] = { 2, 2, 6, 6, 6, 6, 6, 8, 8, 10, 10, 6, 6, 10, 6, 6, 12, 8, 2, 8, 2, 2, 30, 6, 10, 20, 6, 6, 31, 34, 6, 6, 6, 6, 6, 6, 6, 6, 6, 11, 6, 11, 11, 11, 11, 11, - 11, 11, 5, 5, 6, 6, 18, 32, 21}; + 11, 11, 5, 5, 6, 6, 18, 32, 21, 35}; int expected_ext[NUM_EXT_TEST][48] = { {1, 1}, /* 3 */ {1, 1}, /* 4 */ @@ -901,6 +913,7 @@ main() {1, 1, 1, 1, 16, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 113 */ {1, 1, 1, 1, 16, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 114 */ {1, 1, 1, 1, 16, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 4, 4}, /* 115 */ + {1, 1, 1, 1, 16, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 4, 4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 116 */ }; if (needext) @@ -1084,6 +1097,9 @@ main() case 115: template[6] = 2; break; + case 116: + template[6] = 2; + break; default: return G2C_ERROR; } From 268da3500d6b4875aacc671c14b8fba102aedf57 Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Fri, 6 Dec 2024 11:13:35 -0800 Subject: [PATCH 68/80] pds 4.117 --- src/grib2.h.in | 2 +- src/pdstemplates.c | 4 ++++ tests/tst_pdstemplates.c | 9 +++++---- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/grib2.h.in b/src/grib2.h.in index 794ada34..f620c0cd 100644 --- a/src/grib2.h.in +++ b/src/grib2.h.in @@ -291,7 +291,7 @@ g2int g2_gribend(unsigned char *cgrib); /* Constants to help with templates. */ #define G2C_MAX_GDS_TEMPLATE 31 /**< Maximum number of grid templates. */ #define G2C_MAX_GDS_TEMPLATE_MAPLEN 28 /**< Maximum grid template map length. */ -#define G2C_MAX_PDS_TEMPLATE 93 /**< Maximum number of PDS templates. */ +#define G2C_MAX_PDS_TEMPLATE 94 /**< Maximum number of PDS templates. */ #define G2C_MAX_PDS_TEMPLATE_MAPLEN 45 /**< Maximum template map length. */ #define G2C_MAX_DRS_TEMPLATE 10 /**< Maximum number of DRS templates. */ #define G2C_MAX_DRS_TEMPLATE_MAPLEN 18 /**< Maximum DRS template map length. */ diff --git a/src/pdstemplates.c b/src/pdstemplates.c index c7aa696d..ef2585bd 100644 --- a/src/pdstemplates.c +++ b/src/pdstemplates.c @@ -414,6 +414,10 @@ static const struct pdstemplate templatespds[G2C_MAX_PDS_TEMPLATE] = 4.116: Individual ensemble forecast, control and perturbed on generalized tiles at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval */ {116, 7, 1, {1, 1, 1, 2, 1, 1, 1}}, + /** PDT 4.117 (12/04/2024) + 4.117: Individual large ensemble forecast, control and perturbed, at a horizontal + level or in a horizontal layer at a point in time */ + {117, 18, 0, {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 4, 4}}, }; /** diff --git a/tests/tst_pdstemplates.c b/tests/tst_pdstemplates.c index 898c718a..0db1511f 100644 --- a/tests/tst_pdstemplates.c +++ b/tests/tst_pdstemplates.c @@ -697,25 +697,25 @@ main() printf("ok!\n"); printf("Testing all getpdstemplate() calls with extensions...\n"); { -#define NUM_TEST 93 +#define NUM_TEST 94 int number[NUM_TEST] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 20, 30, 31, 40, 41, 42, 43, 254, 1000, 1001, 1002, 1100, 1101, 32, 44, 45, 46, 47, 48, 50, 52, 51, 91, 33, 34, 53, 54, 57, 60, 61, 35, 49, 55, 58, 59, 62, 63, 67, 68, 70, 71, 72, 73, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 92, 93, 94, 95, 96, 97, 98, 99, 100, 103, 104, 108, 109, 110, 111, 113, 114, - 115, 116}; + 115, 116, 117}; int expected_maplen[NUM_TEST] = { 15, 18, 17, 31, 30, 22, 16, 15, 29, 36, 30, 32, 31, 45, 44, 18, 19, 5, 5, 16, 19, 30, 33, 3, 9, 16, 15, 15, 22, 10, 21, 24, 35, 38, 26, 21, 15, 16, 36, 18, 32, 19, 22, 7, 24, 38, 6, 29, 21, 7, 24, 35, 38, 7, 7, 19, 21, 32, 34, 17, 20, 31, 34, 27, 30, 36, 40, 39, 38, 17, 31, 24, 20, 34, 27, 27, 30, - 28, 31, 31, 34, 14, 17, 20, 23, 20, 23, 34, 37, 7, 7, 7, 7}; + 28, 31, 31, 34, 14, 17, 20, 23, 20, 23, 34, 37, 7, 7, 7, 7, 18}; int expected_needext[NUM_TEST] = { 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1}; + 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0}; int expected_map[NUM_TEST][48] = { {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 0 */ {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 1 */ @@ -810,6 +810,7 @@ main() {1, 1, 1, 2, 1, 1, 1}, /* 114 */ {1, 1, 1, 2, 1, 1, 1}, /* 115 */ {1, 1, 1, 2, 1, 1, 1}, /* 116 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 4, 4}, /* 117 */ }; int t; int ext_t = 0; From b4275bb1ae848c7aa568378229258b27633d5bd7 Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Fri, 6 Dec 2024 11:22:10 -0800 Subject: [PATCH 69/80] pds 4.118 --- src/grib2.h.in | 2 +- src/pdstemplates.c | 21 +++++++++++++++++++++ tests/tst_pdstemplates.c | 28 ++++++++++++++++++++++------ 3 files changed, 44 insertions(+), 7 deletions(-) diff --git a/src/grib2.h.in b/src/grib2.h.in index f620c0cd..1acb0671 100644 --- a/src/grib2.h.in +++ b/src/grib2.h.in @@ -291,7 +291,7 @@ g2int g2_gribend(unsigned char *cgrib); /* Constants to help with templates. */ #define G2C_MAX_GDS_TEMPLATE 31 /**< Maximum number of grid templates. */ #define G2C_MAX_GDS_TEMPLATE_MAPLEN 28 /**< Maximum grid template map length. */ -#define G2C_MAX_PDS_TEMPLATE 94 /**< Maximum number of PDS templates. */ +#define G2C_MAX_PDS_TEMPLATE 95 /**< Maximum number of PDS templates. */ #define G2C_MAX_PDS_TEMPLATE_MAPLEN 45 /**< Maximum template map length. */ #define G2C_MAX_DRS_TEMPLATE 10 /**< Maximum number of DRS templates. */ #define G2C_MAX_DRS_TEMPLATE_MAPLEN 18 /**< Maximum DRS template map length. */ diff --git a/src/pdstemplates.c b/src/pdstemplates.c index ef2585bd..f19a1d38 100644 --- a/src/pdstemplates.c +++ b/src/pdstemplates.c @@ -418,6 +418,10 @@ static const struct pdstemplate templatespds[G2C_MAX_PDS_TEMPLATE] = 4.117: Individual large ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time */ {117, 18, 0, {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 4, 4}}, + /** PDT 4.118 (12/04/2024) + 4.118: Individual large ensemble forecast, control and perturbed, at a horizontal + level or in a horizontal layer at a point in time */ + {118, 32, 1, {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 4, 4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}}, }; /** @@ -1587,6 +1591,23 @@ extpdstemplate(g2int number, g2int *list) new->ext[l + 31] = 1; new->ext[l + 32] = 4; } + /* PDT 4.118 (12/04/2024) */ + else if (number == 118) + { + if (list[24] > 1) + { + new->extlen = (list[24] - 1) * 6; + new->ext = malloc(sizeof(g2int) * new->extlen); + for (j = 2; j <= list[24]; j++) + { + l = (j - 2) * 6; + for (k = 0; k < 6; k++) + { + new->ext[l + k] = new->map[26 + k]; + } + } + } + } return new; } diff --git a/tests/tst_pdstemplates.c b/tests/tst_pdstemplates.c index 0db1511f..1ec94393 100644 --- a/tests/tst_pdstemplates.c +++ b/tests/tst_pdstemplates.c @@ -693,29 +693,40 @@ main() return G2C_ERROR; free(tmpl->ext); free(tmpl); + + /* Check for one that's there but does need an extension. */ + tmpl = extpdstemplate(118, list); + if (!tmpl) + return G2C_ERROR; + if (tmpl->num != 118 || tmpl->maplen != 32 || !tmpl->needext) + return G2C_ERROR; + if (!tmpl->ext) + return G2C_ERROR; + free(tmpl->ext); + free(tmpl); } printf("ok!\n"); printf("Testing all getpdstemplate() calls with extensions...\n"); { -#define NUM_TEST 94 +#define NUM_TEST 95 int number[NUM_TEST] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 20, 30, 31, 40, 41, 42, 43, 254, 1000, 1001, 1002, 1100, 1101, 32, 44, 45, 46, 47, 48, 50, 52, 51, 91, 33, 34, 53, 54, 57, 60, 61, 35, 49, 55, 58, 59, 62, 63, 67, 68, 70, 71, 72, 73, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 92, 93, 94, 95, 96, 97, 98, 99, 100, 103, 104, 108, 109, 110, 111, 113, 114, - 115, 116, 117}; + 115, 116, 117, 118}; int expected_maplen[NUM_TEST] = { 15, 18, 17, 31, 30, 22, 16, 15, 29, 36, 30, 32, 31, 45, 44, 18, 19, 5, 5, 16, 19, 30, 33, 3, 9, 16, 15, 15, 22, 10, 21, 24, 35, 38, 26, 21, 15, 16, 36, 18, 32, 19, 22, 7, 24, 38, 6, 29, 21, 7, 24, 35, 38, 7, 7, 19, 21, 32, 34, 17, 20, 31, 34, 27, 30, 36, 40, 39, 38, 17, 31, 24, 20, 34, 27, 27, 30, - 28, 31, 31, 34, 14, 17, 20, 23, 20, 23, 34, 37, 7, 7, 7, 7, 18}; + 28, 31, 31, 34, 14, 17, 20, 23, 20, 23, 34, 37, 7, 7, 7, 7, 18, 32}; int expected_needext[NUM_TEST] = { 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0}; + 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1}; int expected_map[NUM_TEST][48] = { {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 0 */ {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 1 */ @@ -811,6 +822,7 @@ main() {1, 1, 1, 2, 1, 1, 1}, /* 115 */ {1, 1, 1, 2, 1, 1, 1}, /* 116 */ {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 4, 4}, /* 117 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 4, 4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 118 */ }; int t; int ext_t = 0; @@ -852,12 +864,12 @@ main() if (map[m] != expected_map[t][m]) return G2C_ERROR; -#define NUM_EXT_TEST 56 +#define NUM_EXT_TEST 57 int template[G2C_MAX_PDS_TEMPLATE_MAPLEN]; int expected_extlen[NUM_EXT_TEST] = { 2, 2, 6, 6, 6, 6, 6, 8, 8, 10, 10, 6, 6, 10, 6, 6, 12, 8, 2, 8, 2, 2, 30, 6, 10, 20, 6, 6, 31, 34, 6, 6, 6, 6, 6, 6, 6, 6, 6, 11, 6, 11, 11, 11, 11, 11, - 11, 11, 5, 5, 6, 6, 18, 32, 21, 35}; + 11, 11, 5, 5, 6, 6, 18, 32, 21, 35, 6}; int expected_ext[NUM_EXT_TEST][48] = { {1, 1}, /* 3 */ {1, 1}, /* 4 */ @@ -915,6 +927,7 @@ main() {1, 1, 1, 1, 16, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 114 */ {1, 1, 1, 1, 16, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 4, 4}, /* 115 */ {1, 1, 1, 1, 16, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 4, 4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 116 */ + {1, 1, 1, 4, 1, 4}, /* 118 */ }; if (needext) @@ -1101,6 +1114,9 @@ main() case 116: template[6] = 2; break; + case 118: + template[24] = 2; + break; default: return G2C_ERROR; } From 73f806b7b1ea33530f5e403f422bbb9ae45125d4 Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Fri, 6 Dec 2024 11:29:41 -0800 Subject: [PATCH 70/80] pds 4.119 --- src/grib2.h.in | 2 +- src/pdstemplates.c | 4 ++++ tests/tst_pdstemplates.c | 9 +++++---- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/grib2.h.in b/src/grib2.h.in index 1acb0671..64197793 100644 --- a/src/grib2.h.in +++ b/src/grib2.h.in @@ -291,7 +291,7 @@ g2int g2_gribend(unsigned char *cgrib); /* Constants to help with templates. */ #define G2C_MAX_GDS_TEMPLATE 31 /**< Maximum number of grid templates. */ #define G2C_MAX_GDS_TEMPLATE_MAPLEN 28 /**< Maximum grid template map length. */ -#define G2C_MAX_PDS_TEMPLATE 95 /**< Maximum number of PDS templates. */ +#define G2C_MAX_PDS_TEMPLATE 96 /**< Maximum number of PDS templates. */ #define G2C_MAX_PDS_TEMPLATE_MAPLEN 45 /**< Maximum template map length. */ #define G2C_MAX_DRS_TEMPLATE 10 /**< Maximum number of DRS templates. */ #define G2C_MAX_DRS_TEMPLATE_MAPLEN 18 /**< Maximum DRS template map length. */ diff --git a/src/pdstemplates.c b/src/pdstemplates.c index f19a1d38..46390948 100644 --- a/src/pdstemplates.c +++ b/src/pdstemplates.c @@ -422,6 +422,10 @@ static const struct pdstemplate templatespds[G2C_MAX_PDS_TEMPLATE] = 4.118: Individual large ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer at a point in time */ {118, 32, 1, {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 4, 4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}}, + /** PDT 4.119 (12/04/2024) + 4.119: Probability forecasts from large ensemble at a horizontal level or in a + horizontal layer at a point in time */ + {119, 24, 0, {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 4, 1, 1, 1, -1, -4, -1, -4}}, }; /** diff --git a/tests/tst_pdstemplates.c b/tests/tst_pdstemplates.c index 1ec94393..aacf1dd3 100644 --- a/tests/tst_pdstemplates.c +++ b/tests/tst_pdstemplates.c @@ -708,25 +708,25 @@ main() printf("ok!\n"); printf("Testing all getpdstemplate() calls with extensions...\n"); { -#define NUM_TEST 95 +#define NUM_TEST 96 int number[NUM_TEST] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 20, 30, 31, 40, 41, 42, 43, 254, 1000, 1001, 1002, 1100, 1101, 32, 44, 45, 46, 47, 48, 50, 52, 51, 91, 33, 34, 53, 54, 57, 60, 61, 35, 49, 55, 58, 59, 62, 63, 67, 68, 70, 71, 72, 73, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 92, 93, 94, 95, 96, 97, 98, 99, 100, 103, 104, 108, 109, 110, 111, 113, 114, - 115, 116, 117, 118}; + 115, 116, 117, 118, 119}; int expected_maplen[NUM_TEST] = { 15, 18, 17, 31, 30, 22, 16, 15, 29, 36, 30, 32, 31, 45, 44, 18, 19, 5, 5, 16, 19, 30, 33, 3, 9, 16, 15, 15, 22, 10, 21, 24, 35, 38, 26, 21, 15, 16, 36, 18, 32, 19, 22, 7, 24, 38, 6, 29, 21, 7, 24, 35, 38, 7, 7, 19, 21, 32, 34, 17, 20, 31, 34, 27, 30, 36, 40, 39, 38, 17, 31, 24, 20, 34, 27, 27, 30, - 28, 31, 31, 34, 14, 17, 20, 23, 20, 23, 34, 37, 7, 7, 7, 7, 18, 32}; + 28, 31, 31, 34, 14, 17, 20, 23, 20, 23, 34, 37, 7, 7, 7, 7, 18, 32, 24}; int expected_needext[NUM_TEST] = { 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1}; + 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0}; int expected_map[NUM_TEST][48] = { {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 0 */ {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 1 */ @@ -823,6 +823,7 @@ main() {1, 1, 1, 2, 1, 1, 1}, /* 116 */ {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 4, 4}, /* 117 */ {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 4, 4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 118 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 4, 1, 1, 1, -1, -4, -1, -4}, /* 119 */ }; int t; int ext_t = 0; From 1e60326dc4cba6dc933d22968130bc235cfbea29 Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Fri, 6 Dec 2024 11:38:18 -0800 Subject: [PATCH 71/80] pds 4.120 --- src/grib2.h.in | 2 +- src/pdstemplates.c | 21 +++++++++++++++++++++ tests/tst_pdstemplates.c | 28 ++++++++++++++++++++++------ 3 files changed, 44 insertions(+), 7 deletions(-) diff --git a/src/grib2.h.in b/src/grib2.h.in index 64197793..52ce0446 100644 --- a/src/grib2.h.in +++ b/src/grib2.h.in @@ -291,7 +291,7 @@ g2int g2_gribend(unsigned char *cgrib); /* Constants to help with templates. */ #define G2C_MAX_GDS_TEMPLATE 31 /**< Maximum number of grid templates. */ #define G2C_MAX_GDS_TEMPLATE_MAPLEN 28 /**< Maximum grid template map length. */ -#define G2C_MAX_PDS_TEMPLATE 96 /**< Maximum number of PDS templates. */ +#define G2C_MAX_PDS_TEMPLATE 97 /**< Maximum number of PDS templates. */ #define G2C_MAX_PDS_TEMPLATE_MAPLEN 45 /**< Maximum template map length. */ #define G2C_MAX_DRS_TEMPLATE 10 /**< Maximum number of DRS templates. */ #define G2C_MAX_DRS_TEMPLATE_MAPLEN 18 /**< Maximum DRS template map length. */ diff --git a/src/pdstemplates.c b/src/pdstemplates.c index 46390948..d70ff924 100644 --- a/src/pdstemplates.c +++ b/src/pdstemplates.c @@ -426,6 +426,10 @@ static const struct pdstemplate templatespds[G2C_MAX_PDS_TEMPLATE] = 4.119: Probability forecasts from large ensemble at a horizontal level or in a horizontal layer at a point in time */ {119, 24, 0, {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 4, 1, 1, 1, -1, -4, -1, -4}}, + /** PDT 4.120 (12/04/2024) + 4.120: Probability forecasts from large ensemble at a horizontal level or in a + horizontal layer in a continuous or non-continuous time interval */ + {120, 38, 1, {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 4, 1, 1, 1, -1, -4, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}}, }; /** @@ -1612,6 +1616,23 @@ extpdstemplate(g2int number, g2int *list) } } } + /* PDT 4.120 (12/04/2024) */ + else if (number == 120) + { + if (list[30] > 1) + { + new->extlen = (list[30] - 1) * 6; + new->ext = malloc(sizeof(g2int) * new->extlen); + for (j = 2; j <= list[30]; j++) + { + l = (j - 2) * 6; + for (k = 0; k < 6; k++) + { + new->ext[l + k] = new->map[32 + k]; + } + } + } + } return new; } diff --git a/tests/tst_pdstemplates.c b/tests/tst_pdstemplates.c index aacf1dd3..75e1e613 100644 --- a/tests/tst_pdstemplates.c +++ b/tests/tst_pdstemplates.c @@ -704,29 +704,40 @@ main() return G2C_ERROR; free(tmpl->ext); free(tmpl); + + /* Check for one that's there but does need an extension. */ + tmpl = extpdstemplate(120, list); + if (!tmpl) + return G2C_ERROR; + if (tmpl->num != 120 || tmpl->maplen != 38 || !tmpl->needext) + return G2C_ERROR; + if (!tmpl->ext) + return G2C_ERROR; + free(tmpl->ext); + free(tmpl); } printf("ok!\n"); printf("Testing all getpdstemplate() calls with extensions...\n"); { -#define NUM_TEST 96 +#define NUM_TEST 97 int number[NUM_TEST] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 20, 30, 31, 40, 41, 42, 43, 254, 1000, 1001, 1002, 1100, 1101, 32, 44, 45, 46, 47, 48, 50, 52, 51, 91, 33, 34, 53, 54, 57, 60, 61, 35, 49, 55, 58, 59, 62, 63, 67, 68, 70, 71, 72, 73, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 92, 93, 94, 95, 96, 97, 98, 99, 100, 103, 104, 108, 109, 110, 111, 113, 114, - 115, 116, 117, 118, 119}; + 115, 116, 117, 118, 119, 120}; int expected_maplen[NUM_TEST] = { 15, 18, 17, 31, 30, 22, 16, 15, 29, 36, 30, 32, 31, 45, 44, 18, 19, 5, 5, 16, 19, 30, 33, 3, 9, 16, 15, 15, 22, 10, 21, 24, 35, 38, 26, 21, 15, 16, 36, 18, 32, 19, 22, 7, 24, 38, 6, 29, 21, 7, 24, 35, 38, 7, 7, 19, 21, 32, 34, 17, 20, 31, 34, 27, 30, 36, 40, 39, 38, 17, 31, 24, 20, 34, 27, 27, 30, - 28, 31, 31, 34, 14, 17, 20, 23, 20, 23, 34, 37, 7, 7, 7, 7, 18, 32, 24}; + 28, 31, 31, 34, 14, 17, 20, 23, 20, 23, 34, 37, 7, 7, 7, 7, 18, 32, 24, 38}; int expected_needext[NUM_TEST] = { 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0}; + 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1}; int expected_map[NUM_TEST][48] = { {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 0 */ {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 1 */ @@ -824,6 +835,7 @@ main() {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 4, 4}, /* 117 */ {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 4, 4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 118 */ {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 4, 1, 1, 1, -1, -4, -1, -4}, /* 119 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 4, 1, 1, 1, -1, -4, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 120 */ }; int t; int ext_t = 0; @@ -865,12 +877,12 @@ main() if (map[m] != expected_map[t][m]) return G2C_ERROR; -#define NUM_EXT_TEST 57 +#define NUM_EXT_TEST 58 int template[G2C_MAX_PDS_TEMPLATE_MAPLEN]; int expected_extlen[NUM_EXT_TEST] = { 2, 2, 6, 6, 6, 6, 6, 8, 8, 10, 10, 6, 6, 10, 6, 6, 12, 8, 2, 8, 2, 2, 30, 6, 10, 20, 6, 6, 31, 34, 6, 6, 6, 6, 6, 6, 6, 6, 6, 11, 6, 11, 11, 11, 11, 11, - 11, 11, 5, 5, 6, 6, 18, 32, 21, 35, 6}; + 11, 11, 5, 5, 6, 6, 18, 32, 21, 35, 6, 6}; int expected_ext[NUM_EXT_TEST][48] = { {1, 1}, /* 3 */ {1, 1}, /* 4 */ @@ -929,6 +941,7 @@ main() {1, 1, 1, 1, 16, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 4, 4}, /* 115 */ {1, 1, 1, 1, 16, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 4, 4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 116 */ {1, 1, 1, 4, 1, 4}, /* 118 */ + {1, 1, 1, 4, 1, 4}, /* 120 */ }; if (needext) @@ -1118,6 +1131,9 @@ main() case 118: template[24] = 2; break; + case 120: + template[30] = 2; + break; default: return G2C_ERROR; } From c43e64966a7663c34480fc32e0b8e34894f68d18 Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Fri, 6 Dec 2024 11:49:55 -0800 Subject: [PATCH 72/80] pds 4.121 --- src/grib2.h.in | 2 +- src/pdstemplates.c | 23 +++++++++++++++++++++++ tests/tst_pdstemplates.c | 29 +++++++++++++++++++++++------ 3 files changed, 47 insertions(+), 7 deletions(-) diff --git a/src/grib2.h.in b/src/grib2.h.in index 52ce0446..f5b4867c 100644 --- a/src/grib2.h.in +++ b/src/grib2.h.in @@ -291,7 +291,7 @@ g2int g2_gribend(unsigned char *cgrib); /* Constants to help with templates. */ #define G2C_MAX_GDS_TEMPLATE 31 /**< Maximum number of grid templates. */ #define G2C_MAX_GDS_TEMPLATE_MAPLEN 28 /**< Maximum grid template map length. */ -#define G2C_MAX_PDS_TEMPLATE 97 /**< Maximum number of PDS templates. */ +#define G2C_MAX_PDS_TEMPLATE 98 /**< Maximum number of PDS templates. */ #define G2C_MAX_PDS_TEMPLATE_MAPLEN 45 /**< Maximum template map length. */ #define G2C_MAX_DRS_TEMPLATE 10 /**< Maximum number of DRS templates. */ #define G2C_MAX_DRS_TEMPLATE_MAPLEN 18 /**< Maximum DRS template map length. */ diff --git a/src/pdstemplates.c b/src/pdstemplates.c index d70ff924..9d04fe44 100644 --- a/src/pdstemplates.c +++ b/src/pdstemplates.c @@ -430,6 +430,10 @@ static const struct pdstemplate templatespds[G2C_MAX_PDS_TEMPLATE] = 4.120: Probability forecasts from large ensemble at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval */ {120, 38, 1, {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 4, 1, 1, 1, -1, -4, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}}, + /** PDT 4.121 (12/04/2024) + 4.121: Probability forecasts from large ensembles with spatiotemporal processing + based on focal (moving window) statistics at a horizontal level or in a horizontal layer at a point in time */ + {121, 26, 1, {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 4, 1, 1, 1, -1, -4, -1, -4, 1, 1}}, }; /** @@ -1633,6 +1637,25 @@ extpdstemplate(g2int number, g2int *list) } } } + /* PDT 4.121 (12/04/2024) */ + else if (number == 121) + { + new->extlen = list[25] * 9; + new->ext = malloc(sizeof(g2int) * new->extlen); + for (i = 0; i < list[25]; i++) + { + l = i * 9; + new->ext[l] = -4; + new->ext[l + 1] = 1; + new->ext[l + 2] = 2; + new->ext[l + 3] = 2; + new->ext[l + 4] = 1; + new->ext[l + 5] = 1; + new->ext[l + 6] = 1; + new->ext[l + 7] = 4; + new->ext[l + 8] = 4; + } + } return new; } diff --git a/tests/tst_pdstemplates.c b/tests/tst_pdstemplates.c index 75e1e613..03836b10 100644 --- a/tests/tst_pdstemplates.c +++ b/tests/tst_pdstemplates.c @@ -715,29 +715,41 @@ main() return G2C_ERROR; free(tmpl->ext); free(tmpl); + + /* Check for one that's there but does need an extension. */ + tmpl = extpdstemplate(121, list); + if (!tmpl) + return G2C_ERROR; + if (tmpl->num != 121 || tmpl->maplen != 26 || !tmpl->needext) + return G2C_ERROR; + if (!tmpl->ext) + return G2C_ERROR; + free(tmpl->ext); + free(tmpl); } printf("ok!\n"); printf("Testing all getpdstemplate() calls with extensions...\n"); { -#define NUM_TEST 97 +#define NUM_TEST 98 int number[NUM_TEST] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 20, 30, 31, 40, 41, 42, 43, 254, 1000, 1001, 1002, 1100, 1101, 32, 44, 45, 46, 47, 48, 50, 52, 51, 91, 33, 34, 53, 54, 57, 60, 61, 35, 49, 55, 58, 59, 62, 63, 67, 68, 70, 71, 72, 73, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 92, 93, 94, 95, 96, 97, 98, 99, 100, 103, 104, 108, 109, 110, 111, 113, 114, - 115, 116, 117, 118, 119, 120}; + 115, 116, 117, 118, 119, 120, 121}; int expected_maplen[NUM_TEST] = { 15, 18, 17, 31, 30, 22, 16, 15, 29, 36, 30, 32, 31, 45, 44, 18, 19, 5, 5, 16, 19, 30, 33, 3, 9, 16, 15, 15, 22, 10, 21, 24, 35, 38, 26, 21, 15, 16, 36, 18, 32, 19, 22, 7, 24, 38, 6, 29, 21, 7, 24, 35, 38, 7, 7, 19, 21, 32, 34, 17, 20, 31, 34, 27, 30, 36, 40, 39, 38, 17, 31, 24, 20, 34, 27, 27, 30, - 28, 31, 31, 34, 14, 17, 20, 23, 20, 23, 34, 37, 7, 7, 7, 7, 18, 32, 24, 38}; + 28, 31, 31, 34, 14, 17, 20, 23, 20, 23, 34, 37, 7, 7, 7, 7, 18, 32, 24, 38, + 26}; int expected_needext[NUM_TEST] = { 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1}; + 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1}; int expected_map[NUM_TEST][48] = { {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 0 */ {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 1 */ @@ -836,6 +848,7 @@ main() {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 4, 4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 118 */ {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 4, 1, 1, 1, -1, -4, -1, -4}, /* 119 */ {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 4, 1, 1, 1, -1, -4, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 120 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 4, 1, 1, 1, -1, -4, -1, -4, 1, 1}, /* 121 */ }; int t; int ext_t = 0; @@ -877,12 +890,12 @@ main() if (map[m] != expected_map[t][m]) return G2C_ERROR; -#define NUM_EXT_TEST 58 +#define NUM_EXT_TEST 59 int template[G2C_MAX_PDS_TEMPLATE_MAPLEN]; int expected_extlen[NUM_EXT_TEST] = { 2, 2, 6, 6, 6, 6, 6, 8, 8, 10, 10, 6, 6, 10, 6, 6, 12, 8, 2, 8, 2, 2, 30, 6, 10, 20, 6, 6, 31, 34, 6, 6, 6, 6, 6, 6, 6, 6, 6, 11, 6, 11, 11, 11, 11, 11, - 11, 11, 5, 5, 6, 6, 18, 32, 21, 35, 6, 6}; + 11, 11, 5, 5, 6, 6, 18, 32, 21, 35, 6, 6, 18}; int expected_ext[NUM_EXT_TEST][48] = { {1, 1}, /* 3 */ {1, 1}, /* 4 */ @@ -942,6 +955,7 @@ main() {1, 1, 1, 1, 16, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 4, 4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 116 */ {1, 1, 1, 4, 1, 4}, /* 118 */ {1, 1, 1, 4, 1, 4}, /* 120 */ + {-4, 1, 2, 2, 1, 1, 1, 4, 4, -4, 1, 2, 2, 1, 1, 1, 4, 4}, /* 121 */ }; if (needext) @@ -1134,6 +1148,9 @@ main() case 120: template[30] = 2; break; + case 121: + template[25] = 2; + break; default: return G2C_ERROR; } From 66d990f1ee764028c0f18900e27df1d8705325a1 Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Fri, 6 Dec 2024 11:55:42 -0800 Subject: [PATCH 73/80] pds 4.124 --- src/grib2.h.in | 2 +- src/pdstemplates.c | 3 +++ tests/tst_pdstemplates.c | 9 +++++---- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/grib2.h.in b/src/grib2.h.in index f5b4867c..1955b1c3 100644 --- a/src/grib2.h.in +++ b/src/grib2.h.in @@ -291,7 +291,7 @@ g2int g2_gribend(unsigned char *cgrib); /* Constants to help with templates. */ #define G2C_MAX_GDS_TEMPLATE 31 /**< Maximum number of grid templates. */ #define G2C_MAX_GDS_TEMPLATE_MAPLEN 28 /**< Maximum grid template map length. */ -#define G2C_MAX_PDS_TEMPLATE 98 /**< Maximum number of PDS templates. */ +#define G2C_MAX_PDS_TEMPLATE 99 /**< Maximum number of PDS templates. */ #define G2C_MAX_PDS_TEMPLATE_MAPLEN 45 /**< Maximum template map length. */ #define G2C_MAX_DRS_TEMPLATE 10 /**< Maximum number of DRS templates. */ #define G2C_MAX_DRS_TEMPLATE_MAPLEN 18 /**< Maximum DRS template map length. */ diff --git a/src/pdstemplates.c b/src/pdstemplates.c index 9d04fe44..45bfc974 100644 --- a/src/pdstemplates.c +++ b/src/pdstemplates.c @@ -434,6 +434,9 @@ static const struct pdstemplate templatespds[G2C_MAX_PDS_TEMPLATE] = 4.121: Probability forecasts from large ensembles with spatiotemporal processing based on focal (moving window) statistics at a horizontal level or in a horizontal layer at a point in time */ {121, 26, 1, {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 4, 1, 1, 1, -1, -4, -1, -4, 1, 1}}, + /** PDT 4.124 (12/04/2024) + 4.124: Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for for radionuclides */ + {124, 32, 0, {1, 1, 2, 1, 2, 2, 2, 2, 2, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}}, }; /** diff --git a/tests/tst_pdstemplates.c b/tests/tst_pdstemplates.c index 03836b10..b4fa115e 100644 --- a/tests/tst_pdstemplates.c +++ b/tests/tst_pdstemplates.c @@ -730,26 +730,26 @@ main() printf("ok!\n"); printf("Testing all getpdstemplate() calls with extensions...\n"); { -#define NUM_TEST 98 +#define NUM_TEST 99 int number[NUM_TEST] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 20, 30, 31, 40, 41, 42, 43, 254, 1000, 1001, 1002, 1100, 1101, 32, 44, 45, 46, 47, 48, 50, 52, 51, 91, 33, 34, 53, 54, 57, 60, 61, 35, 49, 55, 58, 59, 62, 63, 67, 68, 70, 71, 72, 73, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 92, 93, 94, 95, 96, 97, 98, 99, 100, 103, 104, 108, 109, 110, 111, 113, 114, - 115, 116, 117, 118, 119, 120, 121}; + 115, 116, 117, 118, 119, 120, 121, 124}; int expected_maplen[NUM_TEST] = { 15, 18, 17, 31, 30, 22, 16, 15, 29, 36, 30, 32, 31, 45, 44, 18, 19, 5, 5, 16, 19, 30, 33, 3, 9, 16, 15, 15, 22, 10, 21, 24, 35, 38, 26, 21, 15, 16, 36, 18, 32, 19, 22, 7, 24, 38, 6, 29, 21, 7, 24, 35, 38, 7, 7, 19, 21, 32, 34, 17, 20, 31, 34, 27, 30, 36, 40, 39, 38, 17, 31, 24, 20, 34, 27, 27, 30, 28, 31, 31, 34, 14, 17, 20, 23, 20, 23, 34, 37, 7, 7, 7, 7, 18, 32, 24, 38, - 26}; + 26, 32}; int expected_needext[NUM_TEST] = { 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1}; + 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0}; int expected_map[NUM_TEST][48] = { {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 0 */ {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 1 */ @@ -849,6 +849,7 @@ main() {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 4, 1, 1, 1, -1, -4, -1, -4}, /* 119 */ {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 4, 1, 1, 1, -1, -4, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 120 */ {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 4, 1, 1, 1, -1, -4, -1, -4, 1, 1}, /* 121 */ + {1, 1, 2, 1, 2, 2, 2, 2, 2, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 124 */ }; int t; int ext_t = 0; From f576cf840b3c982a6d4aa59fe252d8894f9881c8 Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Fri, 6 Dec 2024 12:00:04 -0800 Subject: [PATCH 74/80] pds 4.125 --- src/grib2.h.in | 2 +- src/pdstemplates.c | 3 +++ tests/tst_pdstemplates.c | 9 +++++---- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/grib2.h.in b/src/grib2.h.in index 1955b1c3..f3ba3874 100644 --- a/src/grib2.h.in +++ b/src/grib2.h.in @@ -291,7 +291,7 @@ g2int g2_gribend(unsigned char *cgrib); /* Constants to help with templates. */ #define G2C_MAX_GDS_TEMPLATE 31 /**< Maximum number of grid templates. */ #define G2C_MAX_GDS_TEMPLATE_MAPLEN 28 /**< Maximum grid template map length. */ -#define G2C_MAX_PDS_TEMPLATE 99 /**< Maximum number of PDS templates. */ +#define G2C_MAX_PDS_TEMPLATE 100 /**< Maximum number of PDS templates. */ #define G2C_MAX_PDS_TEMPLATE_MAPLEN 45 /**< Maximum template map length. */ #define G2C_MAX_DRS_TEMPLATE 10 /**< Maximum number of DRS templates. */ #define G2C_MAX_DRS_TEMPLATE_MAPLEN 18 /**< Maximum DRS template map length. */ diff --git a/src/pdstemplates.c b/src/pdstemplates.c index 45bfc974..4902d218 100644 --- a/src/pdstemplates.c +++ b/src/pdstemplates.c @@ -437,6 +437,9 @@ static const struct pdstemplate templatespds[G2C_MAX_PDS_TEMPLATE] = /** PDT 4.124 (12/04/2024) 4.124: Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for for radionuclides */ {124, 32, 0, {1, 1, 2, 1, 2, 2, 2, 2, 2, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}}, + /** PDT 4.125 (12/04/2024) + 4.125: Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for for radionuclides */ + {125, 35, 0, {1, 1, 2, 1, 2, 2, 2, 2, 2, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}}, }; /** diff --git a/tests/tst_pdstemplates.c b/tests/tst_pdstemplates.c index b4fa115e..addd37e2 100644 --- a/tests/tst_pdstemplates.c +++ b/tests/tst_pdstemplates.c @@ -730,26 +730,26 @@ main() printf("ok!\n"); printf("Testing all getpdstemplate() calls with extensions...\n"); { -#define NUM_TEST 99 +#define NUM_TEST 100 int number[NUM_TEST] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 20, 30, 31, 40, 41, 42, 43, 254, 1000, 1001, 1002, 1100, 1101, 32, 44, 45, 46, 47, 48, 50, 52, 51, 91, 33, 34, 53, 54, 57, 60, 61, 35, 49, 55, 58, 59, 62, 63, 67, 68, 70, 71, 72, 73, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 92, 93, 94, 95, 96, 97, 98, 99, 100, 103, 104, 108, 109, 110, 111, 113, 114, - 115, 116, 117, 118, 119, 120, 121, 124}; + 115, 116, 117, 118, 119, 120, 121, 124, 125}; int expected_maplen[NUM_TEST] = { 15, 18, 17, 31, 30, 22, 16, 15, 29, 36, 30, 32, 31, 45, 44, 18, 19, 5, 5, 16, 19, 30, 33, 3, 9, 16, 15, 15, 22, 10, 21, 24, 35, 38, 26, 21, 15, 16, 36, 18, 32, 19, 22, 7, 24, 38, 6, 29, 21, 7, 24, 35, 38, 7, 7, 19, 21, 32, 34, 17, 20, 31, 34, 27, 30, 36, 40, 39, 38, 17, 31, 24, 20, 34, 27, 27, 30, 28, 31, 31, 34, 14, 17, 20, 23, 20, 23, 34, 37, 7, 7, 7, 7, 18, 32, 24, 38, - 26, 32}; + 26, 32, 35}; int expected_needext[NUM_TEST] = { 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0}; + 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0}; int expected_map[NUM_TEST][48] = { {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 0 */ {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 1 */ @@ -850,6 +850,7 @@ main() {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 4, 1, 1, 1, -1, -4, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 120 */ {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 4, 1, 1, 1, -1, -4, -1, -4, 1, 1}, /* 121 */ {1, 1, 2, 1, 2, 2, 2, 2, 2, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 124 */ + {1, 1, 2, 1, 2, 2, 2, 2, 2, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 125 */ }; int t; int ext_t = 0; From 567cb0de947002b896506660b467f98efefe6261 Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Fri, 6 Dec 2024 12:11:51 -0800 Subject: [PATCH 75/80] pds 4.126 --- src/grib2.h.in | 4 +- src/pdstemplates.c | 26 ++++- tests/tst_pdstemplates.c | 229 +++++++++++++++++++++------------------ 3 files changed, 149 insertions(+), 110 deletions(-) diff --git a/src/grib2.h.in b/src/grib2.h.in index f3ba3874..eb041c47 100644 --- a/src/grib2.h.in +++ b/src/grib2.h.in @@ -291,8 +291,8 @@ g2int g2_gribend(unsigned char *cgrib); /* Constants to help with templates. */ #define G2C_MAX_GDS_TEMPLATE 31 /**< Maximum number of grid templates. */ #define G2C_MAX_GDS_TEMPLATE_MAPLEN 28 /**< Maximum grid template map length. */ -#define G2C_MAX_PDS_TEMPLATE 100 /**< Maximum number of PDS templates. */ -#define G2C_MAX_PDS_TEMPLATE_MAPLEN 45 /**< Maximum template map length. */ +#define G2C_MAX_PDS_TEMPLATE 101 /**< Maximum number of PDS templates. */ +#define G2C_MAX_PDS_TEMPLATE_MAPLEN 47 /**< Maximum template map length. */ #define G2C_MAX_DRS_TEMPLATE 10 /**< Maximum number of DRS templates. */ #define G2C_MAX_DRS_TEMPLATE_MAPLEN 18 /**< Maximum DRS template map length. */ diff --git a/src/pdstemplates.c b/src/pdstemplates.c index 4902d218..330af9de 100644 --- a/src/pdstemplates.c +++ b/src/pdstemplates.c @@ -435,11 +435,16 @@ static const struct pdstemplate templatespds[G2C_MAX_PDS_TEMPLATE] = based on focal (moving window) statistics at a horizontal level or in a horizontal layer at a point in time */ {121, 26, 1, {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 4, 1, 1, 1, -1, -4, -1, -4, 1, 1}}, /** PDT 4.124 (12/04/2024) - 4.124: Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for for radionuclides */ + 4.124: Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for radionuclides */ {124, 32, 0, {1, 1, 2, 1, 2, 2, 2, 2, 2, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}}, /** PDT 4.125 (12/04/2024) - 4.125: Analysis or forecast at a horizontal level or in a horizontal layer at a point in time for for radionuclides */ + 4.125: Individual ensemble forecast, control and perturbed, at a horizontal + level or in a horizontal layer at a point in time for radionuclides */ {125, 35, 0, {1, 1, 2, 1, 2, 2, 2, 2, 2, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}}, + /** PDT 4.126 (12/04/2024) + 4.126: Average, accumulation, or extreme values or other statistically processed values at a horizontal level or in a horizontal + layer in a continuous or non-continuous time interval for radionuclides */ + {126, 47, 1, {1, 1, 2, 1, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}}, }; /** @@ -1662,6 +1667,23 @@ extpdstemplate(g2int number, g2int *list) new->ext[l + 8] = 4; } } + /* PDT 4.126 (12/04/2024) */ + else if (number == 126) + { + if (list[39] > 1) + { + new->extlen = (list[39] - 1) * 6; + new->ext = malloc(sizeof(g2int) * new->extlen); + for (j = 2; j <= list[39]; j++) + { + l = (j - 2) * 6; + for (k = 0; k < 6; k++) + { + new->ext[l + k] = new->map[41 + k]; + } + } + } + } return new; } diff --git a/tests/tst_pdstemplates.c b/tests/tst_pdstemplates.c index addd37e2..9607fefb 100644 --- a/tests/tst_pdstemplates.c +++ b/tests/tst_pdstemplates.c @@ -726,131 +726,144 @@ main() return G2C_ERROR; free(tmpl->ext); free(tmpl); + + /* Check for one that's there but does need an extension. */ + tmpl = extpdstemplate(126, list); + if (!tmpl) + return G2C_ERROR; + if (tmpl->num != 126 || tmpl->maplen != 47 || !tmpl->needext) + return G2C_ERROR; + if (!tmpl->ext) + return G2C_ERROR; + free(tmpl->ext); + free(tmpl); } printf("ok!\n"); printf("Testing all getpdstemplate() calls with extensions...\n"); { -#define NUM_TEST 100 +#define NUM_TEST 101 int number[NUM_TEST] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 20, 30, 31, 40, 41, 42, 43, 254, 1000, 1001, 1002, 1100, 1101, 32, 44, 45, 46, 47, 48, 50, 52, 51, 91, 33, 34, 53, 54, 57, 60, 61, 35, 49, 55, 58, 59, 62, 63, 67, 68, 70, 71, 72, 73, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 92, 93, 94, 95, 96, 97, 98, 99, 100, 103, 104, 108, 109, 110, 111, 113, 114, - 115, 116, 117, 118, 119, 120, 121, 124, 125}; + 115, 116, 117, 118, 119, 120, 121, 124, 125, 126}; int expected_maplen[NUM_TEST] = { 15, 18, 17, 31, 30, 22, 16, 15, 29, 36, 30, 32, 31, 45, 44, 18, 19, 5, 5, 16, 19, 30, 33, 3, 9, 16, 15, 15, 22, 10, 21, 24, 35, 38, 26, 21, 15, 16, 36, 18, 32, 19, 22, 7, 24, 38, 6, 29, 21, 7, 24, 35, 38, 7, 7, 19, 21, 32, 34, 17, 20, 31, 34, 27, 30, 36, 40, 39, 38, 17, 31, 24, 20, 34, 27, 27, 30, 28, 31, 31, 34, 14, 17, 20, 23, 20, 23, 34, 37, 7, 7, 7, 7, 18, 32, 24, 38, - 26, 32, 35}; + 26, 32, 35, 47}; int expected_needext[NUM_TEST] = { 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0}; + 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0, + 1}; int expected_map[NUM_TEST][48] = { - {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 0 */ - {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 1 */ - {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1}, /* 2 */ - {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 1, 1, 1, 1, -4, -4, 4, 4, 1, -1, 4, -1, 4}, /* 3 */ - {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 1, 1, 1, 1, -4, 4, 4, 1, -1, 4, -1, 4}, /* 4 */ - {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, -1, -4, -1, -4}, /* 5 */ - {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1}, /* 6 */ - {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 7 */ - {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 8 */ - {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, -1, -4, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 9 */ - {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 10 */ - {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 11 */ - {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 12 */ - {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 1, 1, 1, 1, -4, -4, 4, 4, 1, -1, 4, -1, 4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 13 */ - {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 1, 1, 1, 1, -4, 4, 4, 1, -1, 4, -1, 4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 14 */ - {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 15 */ - {1, 1, 1, 1, 1, -4, 4, 2, 4, 2, 1, 1, 1, 1, 1, 2, 1, 3, 2}, /* 20 */ - {1, 1, 1, 1, 1}, /* 30 */ - {1, 1, 1, 1, 1}, /* 31 */ - {1, 1, 2, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 40 */ - {1, 1, 2, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 41 */ - {1, 1, 2, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 42 */ - {1, 1, 2, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 43 */ - {1, 1, 4}, /* 254 */ - {1, 1, 1, 1, 1, 2, 1, 1, -4}, /* 1000 */ - {1, 1, 1, 1, 1, 2, 1, 1, -4, 4, 1, 1, 1, 4, 1, 4}, /* 1001 */ - {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, 1, 1, 4, 4, 2}, /* 1002 */ - {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 1100 */ - {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 4, 1, 1, 1, 4, 1, 4}, /* 1101 */ - {1, 1, 1, 1, 1, 2, 1, 1, -4, 1}, /* 32 */ - {1, 1, 2, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -2, 1, -1, -4, 1, -1, -4}, /* 44 */ - {1, 1, 2, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 45 */ - {1, 1, 2, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 46 */ - {1, 1, 1, 2, 1, -1, -4, -1, -4, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 47 */ - {1, 1, 2, 1, -1, -4, -1, -4, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 48 */ - {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 4, 4, 4, 4}, /* 50 */ - {1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4}, /* 52 */ - {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1}, /* 51 */ - {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, -1, -4, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 91 */ - {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, 2, 2, 2, -1, -4, 1, 1, 1}, /* 33 */ - {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, 2, 2, 2, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 34 */ - {1, 1, 1, 1, 4, 2, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 53 */ - {1, 1, 1, 1, 4, 2, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 54 */ - {1, 1, 2, 2, 2, 2, 1}, /* 57 */ - {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1}, /* 60 */ - {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 61 */ - {1, 1, 1, 1, 1, 1}, /* 35 */ - {1, 1, 2, 1, -1, -4, -1, -4, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 49 */ - {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 55 */ - {1, 1, 2, 2, 2, 2, 1}, /* 58 */ - {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 59 */ - {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 62 */ - {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 63 */ - {1, 1, 2, 2, 2, 2, 1}, /* 67 */ - {1, 1, 2, 2, 2, 2, 1}, /* 68 */ - {1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 70 */ - {1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 71 */ - {1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 72 */ - {1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 73 */ - {1, 1, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 76 */ - {1, 1, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 77 */ - {1, 1, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 78 */ - {1, 1, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 79 */ - {1, 1, 2, 1, 1, -1, -4, -1, -4, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 80 */ - {1, 1, 2, 1, 1, -1, -4, -1, -4, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 81 */ - {1, 1, 2, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 82 */ - {1, 1, 1, 2, 1, 1, -1, -4, -1, -4, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 1, 4, 1, 4}, /* 83 */ - {1, 1, 2, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 84 */ - {1, 1, 2, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 85 */ - {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 2}, /* 86 */ - {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 2, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 87 */ - {1, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 88 */ - {1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 2}, /* 89 */ - {1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 2, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 90 */ - {1, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 92 */ - {1, 1, 2, 2, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 93 */ - {1, 1, 2, 2, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 94 */ - {1, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 95 */ - {1, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 1, 1, 1, 4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 96 */ - {1, 1, 2, 2, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 97 */ - {1, 1, 2, 2, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 1, 1, 1, 4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 98 */ - {1, 1, 2, 2, 2, 2, 1, 1, 1, 2, 1, 1, -4, -1}, /* 99 */ - {1, 1, 2, 2, 2, 2, 1, 1, 1, 2, 1, 1, -4, 1, 1, 1, -1}, /* 100 */ - {1, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 103 */ - {1, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 104 */ - {1, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 108 */ - {1, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 109 */ - {1, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 110 */ - {1, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 111 */ - {1, 1, 1, 2, 1, 1, 1}, /* 113 */ - {1, 1, 1, 2, 1, 1, 1}, /* 114 */ - {1, 1, 1, 2, 1, 1, 1}, /* 115 */ - {1, 1, 1, 2, 1, 1, 1}, /* 116 */ - {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 4, 4}, /* 117 */ - {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 4, 4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 118 */ - {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 4, 1, 1, 1, -1, -4, -1, -4}, /* 119 */ - {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 4, 1, 1, 1, -1, -4, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 120 */ - {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 4, 1, 1, 1, -1, -4, -1, -4, 1, 1}, /* 121 */ - {1, 1, 2, 1, 2, 2, 2, 2, 2, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 124 */ - {1, 1, 2, 1, 2, 2, 2, 2, 2, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 125 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 0 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 1 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1}, /* 2 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 1, 1, 1, 1, -4, -4, 4, 4, 1, -1, 4, -1, 4}, /* 3 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 1, 1, 1, 1, -4, 4, 4, 1, -1, 4, -1, 4}, /* 4 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, -1, -4, -1, -4}, /* 5 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1}, /* 6 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 7 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 8 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, -1, -4, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 9 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 10 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 11 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 12 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 1, 1, 1, 1, -4, -4, 4, 4, 1, -1, 4, -1, 4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 13 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 1, 1, 1, 1, -4, 4, 4, 1, -1, 4, -1, 4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 14 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 15 */ + {1, 1, 1, 1, 1, -4, 4, 2, 4, 2, 1, 1, 1, 1, 1, 2, 1, 3, 2}, /* 20 */ + {1, 1, 1, 1, 1}, /* 30 */ + {1, 1, 1, 1, 1}, /* 31 */ + {1, 1, 2, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 40 */ + {1, 1, 2, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 41 */ + {1, 1, 2, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 42 */ + {1, 1, 2, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 43 */ + {1, 1, 4}, /* 254 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4}, /* 1000 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4, 4, 1, 1, 1, 4, 1, 4}, /* 1001 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, 1, 1, 4, 4, 2}, /* 1002 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 1100 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 4, 1, 1, 1, 4, 1, 4}, /* 1101 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4, 1}, /* 32 */ + {1, 1, 2, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -2, 1, -1, -4, 1, -1, -4}, /* 44 */ + {1, 1, 2, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 45 */ + {1, 1, 2, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 46 */ + {1, 1, 1, 2, 1, -1, -4, -1, -4, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 47 */ + {1, 1, 2, 1, -1, -4, -1, -4, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 48 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 4, 4, 4, 4}, /* 50 */ + {1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4}, /* 52 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1}, /* 51 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, -1, -4, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 91 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, 2, 2, 2, -1, -4, 1, 1, 1}, /* 33 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, 2, 2, 2, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 34 */ + {1, 1, 1, 1, 4, 2, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 53 */ + {1, 1, 1, 1, 4, 2, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 54 */ + {1, 1, 2, 2, 2, 2, 1}, /* 57 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1}, /* 60 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 61 */ + {1, 1, 1, 1, 1, 1}, /* 35 */ + {1, 1, 2, 1, -1, -4, -1, -4, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 49 */ + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 55 */ + {1, 1, 2, 2, 2, 2, 1}, /* 58 */ + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 59 */ + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 62 */ + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 63 */ + {1, 1, 2, 2, 2, 2, 1}, /* 67 */ + {1, 1, 2, 2, 2, 2, 1}, /* 68 */ + {1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 70 */ + {1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 71 */ + {1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 72 */ + {1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 73 */ + {1, 1, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 76 */ + {1, 1, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 77 */ + {1, 1, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 78 */ + {1, 1, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 79 */ + {1, 1, 2, 1, 1, -1, -4, -1, -4, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 80 */ + {1, 1, 2, 1, 1, -1, -4, -1, -4, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 81 */ + {1, 1, 2, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 82 */ + {1, 1, 1, 2, 1, 1, -1, -4, -1, -4, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 1, 4, 1, 4}, /* 83 */ + {1, 1, 2, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 84 */ + {1, 1, 2, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 85 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 2}, /* 86 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 2, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 87 */ + {1, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 88 */ + {1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 2}, /* 89 */ + {1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 2, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 90 */ + {1, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 92 */ + {1, 1, 2, 2, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 93 */ + {1, 1, 2, 2, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 94 */ + {1, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 95 */ + {1, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 1, 1, 1, 4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 96 */ + {1, 1, 2, 2, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 97 */ + {1, 1, 2, 2, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 1, 1, 1, 4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 98 */ + {1, 1, 2, 2, 2, 2, 1, 1, 1, 2, 1, 1, -4, -1}, /* 99 */ + {1, 1, 2, 2, 2, 2, 1, 1, 1, 2, 1, 1, -4, 1, 1, 1, -1}, /* 100 */ + {1, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 103 */ + {1, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 104 */ + {1, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 108 */ + {1, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 109 */ + {1, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 110 */ + {1, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 111 */ + {1, 1, 1, 2, 1, 1, 1}, /* 113 */ + {1, 1, 1, 2, 1, 1, 1}, /* 114 */ + {1, 1, 1, 2, 1, 1, 1}, /* 115 */ + {1, 1, 1, 2, 1, 1, 1}, /* 116 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 4, 4}, /* 117 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 4, 4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 118 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 4, 1, 1, 1, -1, -4, -1, -4}, /* 119 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 4, 1, 1, 1, -1, -4, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 120 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 4, 1, 1, 1, -1, -4, -1, -4, 1, 1}, /* 121 */ + {1, 1, 2, 1, 2, 2, 2, 2, 2, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 124 */ + {1, 1, 2, 1, 2, 2, 2, 2, 2, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 125 */ + {1, 1, 2, 1, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 126 */ }; int t; int ext_t = 0; @@ -892,12 +905,12 @@ main() if (map[m] != expected_map[t][m]) return G2C_ERROR; -#define NUM_EXT_TEST 59 +#define NUM_EXT_TEST 60 int template[G2C_MAX_PDS_TEMPLATE_MAPLEN]; int expected_extlen[NUM_EXT_TEST] = { 2, 2, 6, 6, 6, 6, 6, 8, 8, 10, 10, 6, 6, 10, 6, 6, 12, 8, 2, 8, 2, 2, 30, 6, 10, 20, 6, 6, 31, 34, 6, 6, 6, 6, 6, 6, 6, 6, 6, 11, 6, 11, 11, 11, 11, 11, - 11, 11, 5, 5, 6, 6, 18, 32, 21, 35, 6, 6, 18}; + 11, 11, 5, 5, 6, 6, 18, 32, 21, 35, 6, 6, 18, 6}; int expected_ext[NUM_EXT_TEST][48] = { {1, 1}, /* 3 */ {1, 1}, /* 4 */ @@ -958,6 +971,7 @@ main() {1, 1, 1, 4, 1, 4}, /* 118 */ {1, 1, 1, 4, 1, 4}, /* 120 */ {-4, 1, 2, 2, 1, 1, 1, 4, 4, -4, 1, 2, 2, 1, 1, 1, 4, 4}, /* 121 */ + {1, 1, 1, 4, 1, 4}, /* 126 */ }; if (needext) @@ -1153,6 +1167,9 @@ main() case 121: template[25] = 2; break; + case 126: + template[39] = 2; + break; default: return G2C_ERROR; } From 389b4ba46ecec232204dfce20a867f12076860f6 Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Fri, 6 Dec 2024 12:23:43 -0800 Subject: [PATCH 76/80] pds 4.127 --- src/grib2.h.in | 4 +- src/pdstemplates.c | 21 ++++ tests/tst_pdstemplates.c | 232 +++++++++++++++++++++------------------ 3 files changed, 147 insertions(+), 110 deletions(-) diff --git a/src/grib2.h.in b/src/grib2.h.in index eb041c47..ed856b14 100644 --- a/src/grib2.h.in +++ b/src/grib2.h.in @@ -291,8 +291,8 @@ g2int g2_gribend(unsigned char *cgrib); /* Constants to help with templates. */ #define G2C_MAX_GDS_TEMPLATE 31 /**< Maximum number of grid templates. */ #define G2C_MAX_GDS_TEMPLATE_MAPLEN 28 /**< Maximum grid template map length. */ -#define G2C_MAX_PDS_TEMPLATE 101 /**< Maximum number of PDS templates. */ -#define G2C_MAX_PDS_TEMPLATE_MAPLEN 47 /**< Maximum 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. */ #define G2C_MAX_DRS_TEMPLATE 10 /**< Maximum number of DRS templates. */ #define G2C_MAX_DRS_TEMPLATE_MAPLEN 18 /**< Maximum DRS template map length. */ diff --git a/src/pdstemplates.c b/src/pdstemplates.c index 330af9de..ea6aa1dd 100644 --- a/src/pdstemplates.c +++ b/src/pdstemplates.c @@ -445,6 +445,10 @@ static const struct pdstemplate templatespds[G2C_MAX_PDS_TEMPLATE] = 4.126: Average, accumulation, or extreme values or other statistically processed values at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for radionuclides */ {126, 47, 1, {1, 1, 2, 1, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}}, + /** PDT 4.127 (12/04/2024) + 4.127: Individual ensemble forecast, control and perturbed, at a horizontal + level or in a horizontal layer in a continuous or non-continuous time interval for radionuclides */ + {126, 50, 1, {1, 1, 2, 1, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}}, }; /** @@ -1684,6 +1688,23 @@ extpdstemplate(g2int number, g2int *list) } } } + /* PDT 4.127 (12/04/2024) */ + else if (number == 127) + { + if (list[42] > 1) + { + new->extlen = (list[42] - 1) * 6; + new->ext = malloc(sizeof(g2int) * new->extlen); + for (j = 2; j <= list[42]; j++) + { + l = (j - 2) * 6; + for (k = 0; k < 6; k++) + { + new->ext[l + k] = new->map[44 + k]; + } + } + } + } return new; } diff --git a/tests/tst_pdstemplates.c b/tests/tst_pdstemplates.c index 9607fefb..53889760 100644 --- a/tests/tst_pdstemplates.c +++ b/tests/tst_pdstemplates.c @@ -737,133 +737,145 @@ main() return G2C_ERROR; free(tmpl->ext); free(tmpl); + + /* Check for one that's there but does need an extension. */ + tmpl = extpdstemplate(127, list); + if (!tmpl) + return G2C_ERROR; + if (tmpl->num != 127 || tmpl->maplen != 50 || !tmpl->needext) + return G2C_ERROR; + if (!tmpl->ext) + return G2C_ERROR; + free(tmpl->ext); + free(tmpl); } printf("ok!\n"); printf("Testing all getpdstemplate() calls with extensions...\n"); { -#define NUM_TEST 101 +#define NUM_TEST 102 int number[NUM_TEST] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 20, 30, 31, 40, 41, 42, 43, 254, 1000, 1001, 1002, 1100, 1101, 32, 44, 45, 46, 47, 48, 50, 52, 51, 91, 33, 34, 53, 54, 57, 60, 61, 35, 49, 55, 58, 59, 62, 63, 67, 68, 70, 71, 72, 73, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 92, 93, 94, 95, 96, 97, 98, 99, 100, 103, 104, 108, 109, 110, 111, 113, 114, - 115, 116, 117, 118, 119, 120, 121, 124, 125, 126}; + 115, 116, 117, 118, 119, 120, 121, 124, 125, 126, 127}; int expected_maplen[NUM_TEST] = { 15, 18, 17, 31, 30, 22, 16, 15, 29, 36, 30, 32, 31, 45, 44, 18, 19, 5, 5, 16, 19, 30, 33, 3, 9, 16, 15, 15, 22, 10, 21, 24, 35, 38, 26, 21, 15, 16, 36, 18, 32, 19, 22, 7, 24, 38, 6, 29, 21, 7, 24, 35, 38, 7, 7, 19, 21, 32, 34, 17, 20, 31, 34, 27, 30, 36, 40, 39, 38, 17, 31, 24, 20, 34, 27, 27, 30, 28, 31, 31, 34, 14, 17, 20, 23, 20, 23, 34, 37, 7, 7, 7, 7, 18, 32, 24, 38, - 26, 32, 35, 47}; + 26, 32, 35, 47, 50}; int expected_needext[NUM_TEST] = { 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 0, - 1}; - int expected_map[NUM_TEST][48] = { - {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 0 */ - {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 1 */ - {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1}, /* 2 */ - {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 1, 1, 1, 1, -4, -4, 4, 4, 1, -1, 4, -1, 4}, /* 3 */ - {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 1, 1, 1, 1, -4, 4, 4, 1, -1, 4, -1, 4}, /* 4 */ - {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, -1, -4, -1, -4}, /* 5 */ - {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1}, /* 6 */ - {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 7 */ - {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 8 */ - {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, -1, -4, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 9 */ - {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 10 */ - {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 11 */ - {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 12 */ - {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 1, 1, 1, 1, -4, -4, 4, 4, 1, -1, 4, -1, 4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 13 */ - {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 1, 1, 1, 1, -4, 4, 4, 1, -1, 4, -1, 4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 14 */ - {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 15 */ - {1, 1, 1, 1, 1, -4, 4, 2, 4, 2, 1, 1, 1, 1, 1, 2, 1, 3, 2}, /* 20 */ - {1, 1, 1, 1, 1}, /* 30 */ - {1, 1, 1, 1, 1}, /* 31 */ - {1, 1, 2, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 40 */ - {1, 1, 2, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 41 */ - {1, 1, 2, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 42 */ - {1, 1, 2, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 43 */ - {1, 1, 4}, /* 254 */ - {1, 1, 1, 1, 1, 2, 1, 1, -4}, /* 1000 */ - {1, 1, 1, 1, 1, 2, 1, 1, -4, 4, 1, 1, 1, 4, 1, 4}, /* 1001 */ - {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, 1, 1, 4, 4, 2}, /* 1002 */ - {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 1100 */ - {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 4, 1, 1, 1, 4, 1, 4}, /* 1101 */ - {1, 1, 1, 1, 1, 2, 1, 1, -4, 1}, /* 32 */ - {1, 1, 2, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -2, 1, -1, -4, 1, -1, -4}, /* 44 */ - {1, 1, 2, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 45 */ - {1, 1, 2, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 46 */ - {1, 1, 1, 2, 1, -1, -4, -1, -4, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 47 */ - {1, 1, 2, 1, -1, -4, -1, -4, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 48 */ - {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 4, 4, 4, 4}, /* 50 */ - {1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4}, /* 52 */ - {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1}, /* 51 */ - {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, -1, -4, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 91 */ - {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, 2, 2, 2, -1, -4, 1, 1, 1}, /* 33 */ - {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, 2, 2, 2, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 34 */ - {1, 1, 1, 1, 4, 2, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 53 */ - {1, 1, 1, 1, 4, 2, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 54 */ - {1, 1, 2, 2, 2, 2, 1}, /* 57 */ - {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1}, /* 60 */ - {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 61 */ - {1, 1, 1, 1, 1, 1}, /* 35 */ - {1, 1, 2, 1, -1, -4, -1, -4, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 49 */ - {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 55 */ - {1, 1, 2, 2, 2, 2, 1}, /* 58 */ - {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 59 */ - {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 62 */ - {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 63 */ - {1, 1, 2, 2, 2, 2, 1}, /* 67 */ - {1, 1, 2, 2, 2, 2, 1}, /* 68 */ - {1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 70 */ - {1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 71 */ - {1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 72 */ - {1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 73 */ - {1, 1, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 76 */ - {1, 1, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 77 */ - {1, 1, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 78 */ - {1, 1, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 79 */ - {1, 1, 2, 1, 1, -1, -4, -1, -4, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 80 */ - {1, 1, 2, 1, 1, -1, -4, -1, -4, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 81 */ - {1, 1, 2, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 82 */ - {1, 1, 1, 2, 1, 1, -1, -4, -1, -4, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 1, 4, 1, 4}, /* 83 */ - {1, 1, 2, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 84 */ - {1, 1, 2, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 85 */ - {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 2}, /* 86 */ - {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 2, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 87 */ - {1, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 88 */ - {1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 2}, /* 89 */ - {1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 2, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 90 */ - {1, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 92 */ - {1, 1, 2, 2, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 93 */ - {1, 1, 2, 2, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 94 */ - {1, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 95 */ - {1, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 1, 1, 1, 4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 96 */ - {1, 1, 2, 2, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 97 */ - {1, 1, 2, 2, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 1, 1, 1, 4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 98 */ - {1, 1, 2, 2, 2, 2, 1, 1, 1, 2, 1, 1, -4, -1}, /* 99 */ - {1, 1, 2, 2, 2, 2, 1, 1, 1, 2, 1, 1, -4, 1, 1, 1, -1}, /* 100 */ - {1, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 103 */ - {1, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 104 */ - {1, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 108 */ - {1, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 109 */ - {1, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 110 */ - {1, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 111 */ - {1, 1, 1, 2, 1, 1, 1}, /* 113 */ - {1, 1, 1, 2, 1, 1, 1}, /* 114 */ - {1, 1, 1, 2, 1, 1, 1}, /* 115 */ - {1, 1, 1, 2, 1, 1, 1}, /* 116 */ - {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 4, 4}, /* 117 */ - {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 4, 4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 118 */ - {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 4, 1, 1, 1, -1, -4, -1, -4}, /* 119 */ - {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 4, 1, 1, 1, -1, -4, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 120 */ - {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 4, 1, 1, 1, -1, -4, -1, -4, 1, 1}, /* 121 */ - {1, 1, 2, 1, 2, 2, 2, 2, 2, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 124 */ - {1, 1, 2, 1, 2, 2, 2, 2, 2, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 125 */ - {1, 1, 2, 1, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 126 */ + 1, 1}; + int expected_map[NUM_TEST][50] = { + {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 0 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 1 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1}, /* 2 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 1, 1, 1, 1, -4, -4, 4, 4, 1, -1, 4, -1, 4}, /* 3 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 1, 1, 1, 1, -4, 4, 4, 1, -1, 4, -1, 4}, /* 4 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, -1, -4, -1, -4}, /* 5 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1}, /* 6 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 7 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 8 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, -1, -4, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 9 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 10 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 11 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 12 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 1, 1, 1, 1, -4, -4, 4, 4, 1, -1, 4, -1, 4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 13 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 1, 1, 1, 1, -4, 4, 4, 1, -1, 4, -1, 4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 14 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 15 */ + {1, 1, 1, 1, 1, -4, 4, 2, 4, 2, 1, 1, 1, 1, 1, 2, 1, 3, 2}, /* 20 */ + {1, 1, 1, 1, 1}, /* 30 */ + {1, 1, 1, 1, 1}, /* 31 */ + {1, 1, 2, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 40 */ + {1, 1, 2, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 41 */ + {1, 1, 2, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 42 */ + {1, 1, 2, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 43 */ + {1, 1, 4}, /* 254 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4}, /* 1000 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4, 4, 1, 1, 1, 4, 1, 4}, /* 1001 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, 1, 1, 4, 4, 2}, /* 1002 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 1100 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 4, 1, 1, 1, 4, 1, 4}, /* 1101 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4, 1}, /* 32 */ + {1, 1, 2, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -2, 1, -1, -4, 1, -1, -4}, /* 44 */ + {1, 1, 2, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 45 */ + {1, 1, 2, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 46 */ + {1, 1, 1, 2, 1, -1, -4, -1, -4, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 47 */ + {1, 1, 2, 1, -1, -4, -1, -4, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 48 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 4, 4, 4, 4}, /* 50 */ + {1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4}, /* 52 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1}, /* 51 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, -1, -4, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 91 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, 2, 2, 2, -1, -4, 1, 1, 1}, /* 33 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, 2, 2, 2, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 34 */ + {1, 1, 1, 1, 4, 2, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 53 */ + {1, 1, 1, 1, 4, 2, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 54 */ + {1, 1, 2, 2, 2, 2, 1}, /* 57 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1}, /* 60 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 61 */ + {1, 1, 1, 1, 1, 1}, /* 35 */ + {1, 1, 2, 1, -1, -4, -1, -4, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 49 */ + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 55 */ + {1, 1, 2, 2, 2, 2, 1}, /* 58 */ + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 59 */ + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 62 */ + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 63 */ + {1, 1, 2, 2, 2, 2, 1}, /* 67 */ + {1, 1, 2, 2, 2, 2, 1}, /* 68 */ + {1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 70 */ + {1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 71 */ + {1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 72 */ + {1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 73 */ + {1, 1, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 76 */ + {1, 1, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 77 */ + {1, 1, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 78 */ + {1, 1, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 79 */ + {1, 1, 2, 1, 1, -1, -4, -1, -4, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 80 */ + {1, 1, 2, 1, 1, -1, -4, -1, -4, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 81 */ + {1, 1, 2, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 82 */ + {1, 1, 1, 2, 1, 1, -1, -4, -1, -4, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 1, 4, 1, 4}, /* 83 */ + {1, 1, 2, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 84 */ + {1, 1, 2, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 85 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 2}, /* 86 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 2, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 87 */ + {1, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 88 */ + {1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 2}, /* 89 */ + {1, 1, 2, 2, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 2, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 90 */ + {1, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 92 */ + {1, 1, 2, 2, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 93 */ + {1, 1, 2, 2, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 94 */ + {1, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 95 */ + {1, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 1, 1, 1, 4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 96 */ + {1, 1, 2, 2, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 97 */ + {1, 1, 2, 2, 1, 1, 1, 1, 1, -1, -4, 1, -1, -4, 1, 1, 1, 1, 1, 4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, -4, 1, 1, 4}, /* 98 */ + {1, 1, 2, 2, 2, 2, 1, 1, 1, 2, 1, 1, -4, -1}, /* 99 */ + {1, 1, 2, 2, 2, 2, 1, 1, 1, 2, 1, 1, -4, 1, 1, 1, -1}, /* 100 */ + {1, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 103 */ + {1, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 104 */ + {1, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 108 */ + {1, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 109 */ + {1, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 110 */ + {1, 1, 1, -1, -4, -1, -4, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 111 */ + {1, 1, 1, 2, 1, 1, 1}, /* 113 */ + {1, 1, 1, 2, 1, 1, 1}, /* 114 */ + {1, 1, 1, 2, 1, 1, 1}, /* 115 */ + {1, 1, 1, 2, 1, 1, 1}, /* 116 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 4, 4}, /* 117 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 4, 4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 118 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 4, 1, 1, 1, -1, -4, -1, -4}, /* 119 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 4, 1, 1, 1, -1, -4, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 120 */ + {1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 4, 1, 1, 1, -1, -4, -1, -4, 1, 1}, /* 121 */ + {1, 1, 2, 1, 2, 2, 2, 2, 2, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4}, /* 124 */ + {1, 1, 2, 1, 2, 2, 2, 2, 2, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1}, /* 125 */ + {1, 1, 2, 1, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 126 */ + {1, 1, 2, 1, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}, /* 127 */ }; int t; int ext_t = 0; @@ -905,12 +917,12 @@ main() if (map[m] != expected_map[t][m]) return G2C_ERROR; -#define NUM_EXT_TEST 60 +#define NUM_EXT_TEST 61 int template[G2C_MAX_PDS_TEMPLATE_MAPLEN]; int expected_extlen[NUM_EXT_TEST] = { 2, 2, 6, 6, 6, 6, 6, 8, 8, 10, 10, 6, 6, 10, 6, 6, 12, 8, 2, 8, 2, 2, 30, 6, 10, 20, 6, 6, 31, 34, 6, 6, 6, 6, 6, 6, 6, 6, 6, 11, 6, 11, 11, 11, 11, 11, - 11, 11, 5, 5, 6, 6, 18, 32, 21, 35, 6, 6, 18, 6}; + 11, 11, 5, 5, 6, 6, 18, 32, 21, 35, 6, 6, 18, 6, 6}; int expected_ext[NUM_EXT_TEST][48] = { {1, 1}, /* 3 */ {1, 1}, /* 4 */ @@ -972,6 +984,7 @@ main() {1, 1, 1, 4, 1, 4}, /* 120 */ {-4, 1, 2, 2, 1, 1, 1, 4, 4, -4, 1, 2, 2, 1, 1, 1, 4, 4}, /* 121 */ {1, 1, 1, 4, 1, 4}, /* 126 */ + {1, 1, 1, 4, 1, 4}, /* 127 */ }; if (needext) @@ -1170,6 +1183,9 @@ main() case 126: template[39] = 2; break; + case 127: + template[42] = 2; + break; default: return G2C_ERROR; } From 80f4df2d14cb74fdd85d2be1d3ba6344d9e8cb00 Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Fri, 6 Dec 2024 12:26:05 -0800 Subject: [PATCH 77/80] fix template num --- src/pdstemplates.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pdstemplates.c b/src/pdstemplates.c index ea6aa1dd..937c54cb 100644 --- a/src/pdstemplates.c +++ b/src/pdstemplates.c @@ -448,7 +448,7 @@ static const struct pdstemplate templatespds[G2C_MAX_PDS_TEMPLATE] = /** PDT 4.127 (12/04/2024) 4.127: Individual ensemble forecast, control and perturbed, at a horizontal level or in a horizontal layer in a continuous or non-continuous time interval for radionuclides */ - {126, 50, 1, {1, 1, 2, 1, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}}, + {127, 50, 1, {1, 1, 2, 1, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, -4, 1, -1, -4, 1, -1, -4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 4, 1, 4}}, }; /** From 72b8e2c5af9022db75f9cccc423199a80237c9d3 Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Fri, 6 Dec 2024 12:33:16 -0800 Subject: [PATCH 78/80] debug tests --- tests/tst_pdstemplates.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/tst_pdstemplates.c b/tests/tst_pdstemplates.c index 53889760..30f8e6ba 100644 --- a/tests/tst_pdstemplates.c +++ b/tests/tst_pdstemplates.c @@ -739,7 +739,7 @@ main() free(tmpl); /* Check for one that's there but does need an extension. */ - tmpl = extpdstemplate(127, list); + /* tmpl = extpdstemplate(127, list); if (!tmpl) return G2C_ERROR; if (tmpl->num != 127 || tmpl->maplen != 50 || !tmpl->needext) @@ -747,7 +747,7 @@ main() if (!tmpl->ext) return G2C_ERROR; free(tmpl->ext); - free(tmpl); + free(tmpl); */ } printf("ok!\n"); printf("Testing all getpdstemplate() calls with extensions...\n"); From 982a0ddf6310250d2152ab9460d21bd9bd66f330 Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Fri, 6 Dec 2024 12:37:52 -0800 Subject: [PATCH 79/80] debug --- tests/tst_pdstemplates.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/tst_pdstemplates.c b/tests/tst_pdstemplates.c index 30f8e6ba..dd051014 100644 --- a/tests/tst_pdstemplates.c +++ b/tests/tst_pdstemplates.c @@ -57,7 +57,7 @@ main() printf("ok!\n"); printf("Testing extpdstemplate() calls..."); { -#define MAX_LIST 40 +#define MAX_LIST 50 gtemplate *tmpl; g2int list[MAX_LIST]; int i; @@ -739,7 +739,7 @@ main() free(tmpl); /* Check for one that's there but does need an extension. */ - /* tmpl = extpdstemplate(127, list); + tmpl = extpdstemplate(127, list); if (!tmpl) return G2C_ERROR; if (tmpl->num != 127 || tmpl->maplen != 50 || !tmpl->needext) @@ -747,7 +747,7 @@ main() if (!tmpl->ext) return G2C_ERROR; free(tmpl->ext); - free(tmpl); */ + free(tmpl); } printf("ok!\n"); printf("Testing all getpdstemplate() calls with extensions...\n"); From 41fd343febb31ba682261f21d0f17f8725f1aafa Mon Sep 17 00:00:00 2001 From: AlysonStahl-NOAA <166434581+AlysonStahl-NOAA@users.noreply.github.com> Date: Wed, 11 Dec 2024 11:25:07 -0800 Subject: [PATCH 80/80] added comments to history log --- src/pdstemplates.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/pdstemplates.c b/src/pdstemplates.c index 937c54cb..ccf71ce9 100644 --- a/src/pdstemplates.c +++ b/src/pdstemplates.c @@ -35,6 +35,8 @@ * 2013-08-05 | Vuong | Corrected 4.91 and added Templates 4.33,4.34,4.53,4.54 * 2015-10-07 | Vuong | Added Templates 4.57, 4.60, 4.61 and allow a forecast time to be negative * 2022-10-18 | Hartnett | Added g2c_get_pds_template() and g2c_get_pds_template_extension(). + * 2024-09-09 | Stahl | Added extension for Template 4.35 + * 2024-12-04 | Stahl | Added 55 missing templates, including those from July 2024 WMO updates. * * @author Stephen Gilbert @date 2001-06-28 */