diff --git a/README.md b/README.md index cf5e145..e69de29 100644 --- a/README.md +++ b/README.md @@ -1,37 +0,0 @@ -# g2clib - -#### 介绍 -GRIB2 encoder/decoder and search/indexing routines in C - -#### 软件架构 -软件架构说明 - - -#### 安装教程 - -1. xxxx -2. xxxx -3. xxxx - -#### 使用说明 - -1. xxxx -2. xxxx -3. xxxx - -#### 参与贡献 - -1. Fork 本仓库 -2. 新建 Feat_xxx 分支 -3. 提交代码 -4. 新建 Pull Request - - -#### 特技 - -1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md -2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com) -3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目 -4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目 -5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) -6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) diff --git a/g2clib-1.6.0.tar b/g2clib-1.6.0.tar new file mode 100644 index 0000000..4bd17a9 Binary files /dev/null and b/g2clib-1.6.0.tar differ diff --git a/g2clib-64bit.patch b/g2clib-64bit.patch new file mode 100644 index 0000000..25505f7 --- /dev/null +++ b/g2clib-64bit.patch @@ -0,0 +1,169 @@ +diff -up g2clib-1.6.0_orig/g2_addfield.c g2clib-1.6.0/g2_addfield.c +--- g2clib-1.6.0_orig/g2_addfield.c 2015-05-06 13:54:24.000000000 +0200 ++++ g2clib-1.6.0/g2_addfield.c 2017-08-13 10:02:58.232596592 +0200 +@@ -1,3 +1,4 @@ ++#include + #include + #include + #include "grib2.h" +@@ -190,8 +191,8 @@ g2int g2_addfield(unsigned char *cgrib,g + // total length, then there is a problem. + if ( len > lencurr ) { + printf("g2_addfield: Section byte counts don''t add to total.\n"); +- printf("g2_addfield: Sum of section byte counts = %ld\n",len); +- printf("g2_addfield: Total byte count in Section 0 = %ld\n",lencurr); ++ printf("g2_addfield: Sum of section byte counts = %"PRId32"\n",len); ++ printf("g2_addfield: Total byte count in Section 0 = %"PRId32"\n",lencurr); + ierr=-3; + return(ierr); + } +@@ -392,7 +393,7 @@ g2int g2_addfield(unsigned char *cgrib,g + } + #endif /* USE_PNG */ + else { +- printf("g2_addfield: Data Representation Template 5.%ld not yet implemented.\n",idrsnum); ++ printf("g2_addfield: Data Representation Template 5.%"PRId32" not yet implemented.\n",idrsnum); + ierr=-7; + return(ierr); + } +diff -up g2clib-1.6.0_orig/g2_addgrid.c g2clib-1.6.0/g2_addgrid.c +--- g2clib-1.6.0_orig/g2_addgrid.c 2015-05-06 13:54:24.000000000 +0200 ++++ g2clib-1.6.0/g2_addgrid.c 2017-08-13 10:02:58.233596570 +0200 +@@ -1,3 +1,4 @@ ++#include + #include + #include + #include "grib2.h" +@@ -125,8 +126,8 @@ g2int g2_addgrid(unsigned char *cgrib,g2 + // total length, then there is a problem. + if ( len > lencurr ) { + printf("g2_addgrid: Section byte counts don''t add to total.\n"); +- printf("g2_addgrid: Sum of section byte counts = %ld\n",len); +- printf("g2_addgrid: Total byte count in Section 0 = %ld\n",lencurr); ++ printf("g2_addgrid: Sum of section byte counts = %"PRId32"\n",len); ++ printf("g2_addgrid: Total byte count in Section 0 = %"PRId32"\n",lencurr); + ierr=-3; + return(ierr); + } +diff -up g2clib-1.6.0_orig/g2_addlocal.c g2clib-1.6.0/g2_addlocal.c +--- g2clib-1.6.0_orig/g2_addlocal.c 2015-05-06 13:54:24.000000000 +0200 ++++ g2clib-1.6.0/g2_addlocal.c 2017-08-13 10:02:58.233596570 +0200 +@@ -1,3 +1,4 @@ ++#include + #include + #include "grib2.h" + +@@ -102,8 +103,8 @@ g2int g2_addlocal(unsigned char *cgrib,u + // total length, then there is a problem. + if ( len > lencurr ) { + printf("g2_addlocal: Section byte counts don't add to total.\n"); +- printf("g2_addlocal: Sum of section byte counts = %ld\n",len); +- printf("g2_addlocal: Total byte count in Section 0 = %ld\n",lencurr); ++ printf("g2_addlocal: Sum of section byte counts = %"PRId32"\n",len); ++ printf("g2_addlocal: Total byte count in Section 0 = %"PRId32"\n",lencurr); + ierr=-3; + return(ierr); + } +@@ -113,7 +114,7 @@ g2int g2_addlocal(unsigned char *cgrib,u + // + if ( (isecnum!=1) && (isecnum!=7) ) { + printf("g2_addlocal: Section 2 can only be added after Section 1 or Section 7.\n"); +- printf("g2_addlocal: Section %ld was the last found in given GRIB message.\n",isecnum); ++ printf("g2_addlocal: Section %"PRId32" was the last found in given GRIB message.\n",isecnum); + ierr=-4; + return(ierr); + } +diff -up g2clib-1.6.0_orig/g2_getfld.c g2clib-1.6.0/g2_getfld.c +--- g2clib-1.6.0_orig/g2_getfld.c 2015-05-06 13:54:25.000000000 +0200 ++++ g2clib-1.6.0/g2_getfld.c 2017-08-13 10:02:58.234596548 +0200 +@@ -1,3 +1,4 @@ ++#include + #include + #include + #include "grib2.h" +@@ -345,12 +346,12 @@ g2int g2_getfld(unsigned char *cgrib,g2i + iofst=iofst+32; + gbit(cgrib,&isecnum,iofst,8); // Get Section number + iofst=iofst+8; +- //printf(" lensec= %ld secnum= %ld \n",lensec,isecnum); ++ //printf(" lensec= %"PRId32" secnum= %"PRId32" \n",lensec,isecnum); + // + // Check to see if section number is valid + // + if ( isecnum<1 || isecnum>7 ) { +- printf("g2_getfld: Unrecognized Section Encountered=%ld\n",isecnum); ++ printf("g2_getfld: Unrecognized Section Encountered=%"PRId32"\n",isecnum); + ierr=8; + return(ierr); + } +@@ -543,8 +544,8 @@ g2int g2_getfld(unsigned char *cgrib,g2i + // If exited from above loop, the end of the GRIB message was reached + // before the requested field was found. + // +- printf("g2_getfld: GRIB message contained %ld different fields.\n",numfld); +- printf("g2_getfld: The request was for field %ld.\n",ifldnum); ++ printf("g2_getfld: GRIB message contained %"PRId32" different fields.\n",numfld); ++ printf("g2_getfld: The request was for field %"PRId32".\n",ifldnum); + ierr=6; + + return(ierr); +diff -up g2clib-1.6.0_orig/g2_gribend.c g2clib-1.6.0/g2_gribend.c +--- g2clib-1.6.0_orig/g2_gribend.c 2015-05-06 13:54:25.000000000 +0200 ++++ g2clib-1.6.0/g2_gribend.c 2017-08-13 10:02:58.234596548 +0200 +@@ -1,3 +1,4 @@ ++#include + #include + #include "grib2.h" + +@@ -97,7 +98,7 @@ g2int g2_gribend(unsigned char *cgrib) + // + if ( isecnum != 7 ) { + printf("g2_gribend: Section 8 can only be added after Section 7.\n"); +- printf("g2_gribend: Section %ld was the last found in given GRIB message.\n",isecnum); ++ printf("g2_gribend: Section %"PRId32" was the last found in given GRIB message.\n",isecnum); + ierr=-4; + return (ierr); + } +diff -up g2clib-1.6.0_orig/g2_info.c g2clib-1.6.0/g2_info.c +--- g2clib-1.6.0_orig/g2_info.c 2015-05-06 13:54:25.000000000 +0200 ++++ g2clib-1.6.0/g2_info.c 2017-08-13 10:02:58.234596548 +0200 +@@ -1,3 +1,4 @@ ++#include + #include + #include + #include "grib2.h" +@@ -178,7 +179,7 @@ g2int g2_info(unsigned char *cgrib,g2int + (*numfields)++; + } + else { +- printf("g2_info: Invalid section number found in GRIB message: %ld\n" ,isecnum); ++ printf("g2_info: Invalid section number found in GRIB message: %"PRId32"\n" ,isecnum); + ierr=6; + return(ierr); + } +diff -up g2clib-1.6.0_orig/grib2.h g2clib-1.6.0/grib2.h +--- g2clib-1.6.0_orig/grib2.h 2016-01-22 13:27:13.000000000 +0100 ++++ g2clib-1.6.0/grib2.h 2017-08-13 10:02:58.235596526 +0200 +@@ -1,5 +1,6 @@ + #ifndef _grib2_H + #define _grib2_H ++#include + #include + + #define G2_VERSION "g2clib-1.6.0" +@@ -151,13 +152,8 @@ + // that holds the data. + */ + +-#ifdef __64BIT__ +-typedef int g2int; +-typedef unsigned int g2intu; +-#else +-typedef long g2int; +-typedef unsigned long g2intu; +-#endif ++typedef int32_t g2int; ++typedef uint32_t g2intu; + typedef float g2float; + + struct gtemplate { diff --git a/g2clib-degrib.patch b/g2clib-degrib.patch new file mode 100644 index 0000000..655eaad --- /dev/null +++ b/g2clib-degrib.patch @@ -0,0 +1,18 @@ +diff -up g2clib-1.6.0.p123/gridtemplates.c g2clib-1.6.0.p1234/gridtemplates.c +--- g2clib-1.6.0.p123/gridtemplates.c 2017-08-13 10:50:40.668001879 +0200 ++++ g2clib-1.6.0.p1234/gridtemplates.c 2017-08-13 10:52:24.579434531 +0200 +@@ -24,11 +24,11 @@ const struct gridtemplate templatesgrid[ + {140, 17, 0, {1,1,4,1,4,1,4,4,4,-4,4,4,4,1,4,4,1} }, + // + // 3.10: Mercator +- {10, 19, 0, {1,1,4,1,4,1,4,4,4,-4,4,1,-4,-4,4,1,4,4,4} }, ++ {10, 19, 0, {1,1,4,1,4,1,4,4,4,-4,-4,1,-4,-4,-4,1,4,4,4} }, + // 3.20: Polar Stereographic Projection +- {20, 18, 0, {1,1,4,1,4,1,4,4,4,-4,4,1,-4,4,4,4,1,1} }, ++ {20, 18, 0, {1,1,4,1,4,1,4,4,4,-4,-4,1,-4,-4,4,4,1,1} }, + // 3.30: Lambert Conformal +- {30, 22, 0, {1,1,4,1,4,1,4,4,4,-4,4,1,-4,4,4,4,1,1,-4,-4,-4,4} }, ++ {30, 22, 0, {1,1,4,1,4,1,4,4,4,-4,-4,1,-4,-4,4,4,1,1,-4,-4,-4,-4} }, + // 3.31: Albers equal area + {31, 22, 0, {1,1,4,1,4,1,4,4,4,-4,4,1,-4,4,4,4,1,1,-4,-4,-4,4} }, + // 3.40: Guassian Lat/Lon diff --git a/g2clib-jasper2.patch b/g2clib-jasper2.patch new file mode 100644 index 0000000..783ef17 --- /dev/null +++ b/g2clib-jasper2.patch @@ -0,0 +1,13 @@ +diff -up g2clib-1.6.0.p1234/enc_jpeg2000.c g2clib-1.6.0.p12345/enc_jpeg2000.c +--- g2clib-1.6.0.p1234/enc_jpeg2000.c 2017-08-13 10:52:12.990720854 +0200 ++++ g2clib-1.6.0.p12345/enc_jpeg2000.c 2017-08-13 10:55:41.220584631 +0200 +@@ -121,7 +121,9 @@ int enc_jpeg2000(unsigned char *cin,g2in + image.clrspc_=JAS_CLRSPC_SGRAY; /* grayscale Image */ + image.cmprof_=0; + #endif ++#if JAS_VERSION_MAJOR == 1 + image.inmem_=1; ++#endif + + cmpt.tlx_=0; + cmpt.tly_=0; diff --git a/g2clib-msg.txt b/g2clib-msg.txt new file mode 100644 index 0000000..e9aa569 --- /dev/null +++ b/g2clib-msg.txt @@ -0,0 +1,60 @@ +Date: Fri, 24 Aug 2007 08:03:05 -0400 +From: "Justin Cooke" +To: pertusus@free.fr +Subject: Re: [pmb.dataflow #1013] grib2 related programs license +Reply-To: ncep.pmb.dataflow@noaa.gov +X-Loop: WREQ 2 +Status: RO +Content-Length: 1358 +Lines: 49 + +Your request #1013 was updated by justin.cooke: + +Hi Pat, + +Yes all code available on the NCEP website, including cnvgrib, is +public domain. + +I will pass along the request to add the public domain message to +the documentation of cnvgrib. + +Justin Cooke +NCEP Central Operations + +>>>>>>>>>>>>>>>>>> Original Message >>>>>>>>>>>>>>>>>> +>From: Patrice Dumas +>Subject: grib2 related programs license +>To: NCEP.List.PMB-PCSP@noaa.gov + +Hello, + +It is possible that I am not adressing this mail to the right people, +but this seems to me to be the simplest way to reach the right people. + +On +http://www.nco.ncep.noaa.gov/pmb/codes/GRIB2/ +there are some codes, but the license isn't stated anywhere. It could +mean Public Domain if there was no author mention, but there is some +mention of the authors, like + PRGMMR: Gilbert +(I only checked g2clib and g2lib, I don't know for the other softwares). + +On the disclaimer page: +http://www.weather.gov/disclaimer.php +there is no reference to the programming codes found on the site, only +to data and text. + +My feeling is that these codes are public domain, but I prefer to ask to +be sure. Also if it is true, maybe you could mention it in the README? + +Cordially, + +-- +Pat + + +>>>>>>>>>>>>>>>>>> Action Log >>>>>>>>>>>>>>>>>> +====================== Updated/Mailed by justin.cooke Aug 24 8:3:4 2007 (1187956984) + + + diff --git a/g2clib-simunpack.patch b/g2clib-simunpack.patch new file mode 100644 index 0000000..15d935c --- /dev/null +++ b/g2clib-simunpack.patch @@ -0,0 +1,12 @@ +diff -up g2clib-1.6.0.p12/simunpack.c g2clib-1.6.0.p123/simunpack.c +--- g2clib-1.6.0.p12/simunpack.c 2017-08-13 10:24:02.266764550 +0200 ++++ g2clib-1.6.0.p123/simunpack.c 2017-08-13 10:50:49.881774231 +0200 +@@ -49,7 +49,7 @@ g2int simunpack(unsigned char *cpack,g2i + nbits = idrstmpl[3]; + itype = idrstmpl[4]; + +- ifld=(g2int *)calloc(ndpts,sizeof(g2int)); ++ ifld=(g2int *)calloc((ndpts ? ndpts : 1),sizeof(g2int)); + if ( ifld == 0 ) { + fprintf(stderr,"Could not allocate space in simunpack.\n Data field NOT upacked.\n"); + return(1); diff --git a/g2clib-templates.patch b/g2clib-templates.patch new file mode 100644 index 0000000..0454691 --- /dev/null +++ b/g2clib-templates.patch @@ -0,0 +1,592 @@ +diff -up g2clib-1.6.0.p1/drstemplates.c g2clib-1.6.0.p12/drstemplates.c +--- g2clib-1.6.0.p1/drstemplates.c 2017-08-13 10:17:37.479288682 +0200 ++++ g2clib-1.6.0.p12/drstemplates.c 2017-08-13 10:26:59.958196881 +0200 +@@ -2,6 +2,29 @@ + #include "grib2.h" + #include "drstemplates.h" + ++const struct drstemplate templatesdrs[MAXDRSTEMP] = { ++ // 5.0: Grid point data - Simple Packing ++ { 0, 5, 0, {4,-2,-2,1,1} }, ++ // 5.2: Grid point data - Complex Packing ++ { 2, 16, 0, {4,-2,-2,1,1,1,1,4,4,4,1,1,4,1,4,1} }, ++ // 5.3: Grid point data - Complex Packing and spatial differencing ++ { 3, 18, 0, {4,-2,-2,1,1,1,1,4,4,4,1,1,4,1,4,1,1,1} }, ++ // 5.50: Spectral Data - Simple Packing ++ { 50, 5, 0, {4,-2,-2,1,4} }, ++ // 5.51: Spherical Harmonics data - Complex packing ++ { 51, 10, 0, {4,-2,-2,1,-4,2,2,2,4,1} }, ++// // 5.1: Matrix values at gridpoint - Simple packing ++// { 1, 15, 1, {4,-2,-2,1,1,1,4,2,2,1,1,1,1,1,1} }, ++ // 5.40: Grid point data - JPEG2000 encoding ++ { 40, 7, 0, {4,-2,-2,1,1,1,1} }, ++ // 5.41: Grid point data - PNG encoding ++ { 41, 5, 0, {4,-2,-2,1,1} }, ++ // 5.40000: Grid point data - JPEG2000 encoding ++ { 40000, 7, 0, {4,-2,-2,1,1,1,1} }, ++ // 5.40010: Grid point data - PNG encoding ++ { 40010, 5, 0, {4,-2,-2,1,1} } ++} ; ++ + g2int getdrsindex(g2int number) + /*!$$$ SUBPROGRAM DOCUMENTATION BLOCK + ! . . . . +diff -up g2clib-1.6.0.p1/drstemplates.h g2clib-1.6.0.p12/drstemplates.h +--- g2clib-1.6.0.p1/drstemplates.h 2017-08-13 10:17:37.479288682 +0200 ++++ g2clib-1.6.0.p12/drstemplates.h 2017-08-13 10:26:38.492728755 +0200 +@@ -42,28 +42,8 @@ + g2int mapdrs[MAXDRSMAPLEN]; + }; + +- const struct drstemplate templatesdrs[MAXDRSTEMP] = { +- // 5.0: Grid point data - Simple Packing +- { 0, 5, 0, {4,-2,-2,1,1} }, +- // 5.2: Grid point data - Complex Packing +- { 2, 16, 0, {4,-2,-2,1,1,1,1,4,4,4,1,1,4,1,4,1} }, +- // 5.3: Grid point data - Complex Packing and spatial differencing +- { 3, 18, 0, {4,-2,-2,1,1,1,1,4,4,4,1,1,4,1,4,1,1,1} }, +- // 5.50: Spectral Data - Simple Packing +- { 50, 5, 0, {4,-2,-2,1,4} }, +- // 5.51: Spherical Harmonics data - Complex packing +- { 51, 10, 0, {4,-2,-2,1,-4,2,2,2,4,1} }, +-// // 5.1: Matrix values at gridpoint - Simple packing +-// { 1, 15, 1, {4,-2,-2,1,1,1,4,2,2,1,1,1,1,1,1} }, +- // 5.40: Grid point data - JPEG2000 encoding +- { 40, 7, 0, {4,-2,-2,1,1,1,1} }, +- // 5.41: Grid point data - PNG encoding +- { 41, 5, 0, {4,-2,-2,1,1} }, +- // 5.40000: Grid point data - JPEG2000 encoding +- { 40000, 7, 0, {4,-2,-2,1,1,1,1} }, +- // 5.40010: Grid point data - PNG encoding +- { 40010, 5, 0, {4,-2,-2,1,1} } +- } ; ++ extern const struct drstemplate templatesdrs[]; + ++ g2int getdrsindex(g2int number); + + #endif /* _drstemplates_H */ +Binary files g2clib-1.6.0.p1/grib2c.doc.gz and g2clib-1.6.0.p12/grib2c.doc.gz differ +diff -up g2clib-1.6.0.p1/gridtemplates.c g2clib-1.6.0.p12/gridtemplates.c +--- g2clib-1.6.0.p1/gridtemplates.c 2017-08-13 10:17:37.481288632 +0200 ++++ g2clib-1.6.0.p12/gridtemplates.c 2017-08-13 10:41:53.079066944 +0200 +@@ -2,6 +2,75 @@ + #include "grib2.h" + #include "gridtemplates.h" + ++const struct gridtemplate templatesgrid[MAXGRIDTEMP] = { ++ // 3.0: Lat/Lon grid ++ { 0, 19, 0, {1,1,4,1,4,1,4,4,4,4,4,-4,4,1,-4,4,4,4,1} }, ++ // 3.1: Rotated Lat/Lon grid ++ { 1, 22, 0, {1,1,4,1,4,1,4,4,4,4,4,-4,4,1,-4,4,4,4,1,-4,4,4} }, ++ // 3.2: Stretched Lat/Lon grid ++ { 2, 22, 0, {1,1,4,1,4,1,4,4,4,4,4,-4,4,1,-4,4,4,4,1,-4,4,-4} }, ++ // 3.3: Stretched & Rotated Lat/Lon grid ++ { 3, 25, 0, {1,1,4,1,4,1,4,4,4,4,4,-4,4,1,-4,4,4,4,1,-4,4,4,-4,4,-4} }, ++// Added GDT 3.4,3.5 (08/05/2013) ++ // 3.4: Variable resolution Latitude/Longitude ++ { 4, 13, 1, {1,1,4,1,4,1,4,4,4,4,4,1,1} }, ++ // 3.5: Variable resolution rotate Latitude/Longitude ++ { 5, 16, 1, {1,1,4,1,4,1,4,4,4,4,4,1,1,-4,4,4} }, ++ // 3.12: Transverse Mercator ++ {12, 22, 0, {1,1,4,1,4,1,4,4,4,-4,4,1,-4,4,4,1,4,4,-4,-4,-4,-4} }, ++ // 3.101: General unstructured grid ++ {101, 4, 0, {1,4,1,-4} }, ++ // 3.140: Lambert Azimuthal Equal Area Projection ++ {140, 17, 0, {1,1,4,1,4,1,4,4,4,-4,4,4,4,1,4,4,1} }, ++// ++ // 3.10: Mercator ++ {10, 19, 0, {1,1,4,1,4,1,4,4,4,-4,4,1,-4,-4,4,1,4,4,4} }, ++ // 3.20: Polar Stereographic Projection ++ {20, 18, 0, {1,1,4,1,4,1,4,4,4,-4,4,1,-4,4,4,4,1,1} }, ++ // 3.30: Lambert Conformal ++ {30, 22, 0, {1,1,4,1,4,1,4,4,4,-4,4,1,-4,4,4,4,1,1,-4,-4,-4,4} }, ++ // 3.31: Albers equal area ++ {31, 22, 0, {1,1,4,1,4,1,4,4,4,-4,4,1,-4,4,4,4,1,1,-4,-4,-4,4} }, ++ // 3.40: Guassian Lat/Lon ++ {40, 19, 0, {1,1,4,1,4,1,4,4,4,4,4,-4,4,1,-4,4,4,4,1} }, ++ // 3.41: Rotated Gaussian Lat/Lon ++ {41, 22, 0, {1,1,4,1,4,1,4,4,4,4,4,-4,4,1,-4,4,4,4,1,-4,4,4} }, ++ // 3.42: Stretched Gaussian Lat/Lon ++ {42, 22, 0, {1,1,4,1,4,1,4,4,4,4,4,-4,4,1,-4,4,4,4,1,-4,4,-4} }, ++ // 3.43: Stretched and Rotated Gaussian Lat/Lon ++ {43, 25, 0, {1,1,4,1,4,1,4,4,4,4,4,-4,4,1,-4,4,4,4,1,-4,4,4,-4,4,-4} }, ++ // 3.50: Spherical Harmonic Coefficients ++ {50, 5, 0, {4,4,4,1,1} }, ++ // 3.51: Rotated Spherical Harmonic Coefficients ++ {51, 8, 0, {4,4,4,1,1,-4,4,4} }, ++ // 3.52: Stretched Spherical Harmonic Coefficients ++ {52, 8, 0, {4,4,4,1,1,-4,4,-4} }, ++ // 3.53: Stretched and Rotated Spherical Harmonic Coefficients ++ {53, 11, 0, {4,4,4,1,1,-4,4,4,-4,4,-4} }, ++ // 3.90: Space View Perspective or orthographic ++ {90, 21, 0, {1,1,4,1,4,1,4,4,4,-4,4,1,4,4,4,4,1,4,4,4,4} }, ++ // 3.100: Triangular grid based on an icosahedron ++ {100, 11, 0, {1,1,2,1,-4,4,4,1,1,1,4} }, ++ // 3.110: Equatorial Azimuthal equidistant ++ {110, 16, 0, {1,1,4,1,4,1,4,4,4,-4,4,1,4,4,1,1} }, ++ // 3.120: Azimuth-range projection ++ {120, 7, 1, {4,4,-4,4,4,4,1} }, ++ // 3.204: Curvilinear Orthogonal Grid ++ {204, 19, 0, {1,1,4,1,4,1,4,4,4,4,4,-4,4,1,-4,4,4,4,1} }, ++ // 3.32768: Rot Lat/Lon E-grid (Arakawa) ++ {32768, 19, 0, {1,1,4,1,4,1,4,4,4,4,4,-4,4,1,-4,4,4,4,1} }, ++ // 3.32769: Rot Lat/Lon Non-E Staggered grid (Arakawa) ++ {32769, 21, 0, {1,1,4,1,4,1,4,4,4,4,4,-4,4,1,-4,4,4,4,1,4,4} }, ++ // 3.1000: Cross Section Grid ++ {1000, 20, 1, {1,1,4,1,4,1,4,4,4,4,-4,4,1,4,4,1,2,1,1,2} }, ++ // 3.1100: Hovmoller Diagram Grid ++ {1100, 28, 0, {1,1,4,1,4,1,4,4,4,4,-4,4,1,-4,4,1,4,1,-4,1,1,-4,2,1,1,1,1,1} }, ++ // 3.1200: Time Section Grid ++ {1200, 16, 1, {4,1,-4,1,1,-4,2,1,1,1,1,1,2,1,1,2} } ++ ++} ; ++ ++ + g2int getgridindex(g2int number) + /*!$$$ SUBPROGRAM DOCUMENTATION BLOCK + ! . . . . +diff -up g2clib-1.6.0.p1/gridtemplates.h g2clib-1.6.0.p12/gridtemplates.h +--- g2clib-1.6.0.p1/gridtemplates.h 2017-08-13 10:17:37.481288632 +0200 ++++ g2clib-1.6.0.p12/gridtemplates.h 2017-08-13 10:30:23.584151390 +0200 +@@ -49,73 +49,8 @@ + g2int mapgrid[MAXGRIDMAPLEN]; + }; + +- const struct gridtemplate templatesgrid[MAXGRIDTEMP] = { +- // 3.0: Lat/Lon grid +- { 0, 19, 0, {1,1,4,1,4,1,4,4,4,4,4,-4,4,1,-4,4,4,4,1} }, +- // 3.1: Rotated Lat/Lon grid +- { 1, 22, 0, {1,1,4,1,4,1,4,4,4,4,4,-4,4,1,-4,4,4,4,1,-4,4,4} }, +- // 3.2: Stretched Lat/Lon grid +- { 2, 22, 0, {1,1,4,1,4,1,4,4,4,4,4,-4,4,1,-4,4,4,4,1,-4,4,-4} }, +- // 3.3: Stretched & Rotated Lat/Lon grid +- { 3, 25, 0, {1,1,4,1,4,1,4,4,4,4,4,-4,4,1,-4,4,4,4,1,-4,4,4,-4,4,-4} }, +-// Added GDT 3.4,3.5 (08/05/2013) +- // 3.4: Variable resolution Latitude/Longitude +- { 4, 13, 1, {1,1,4,1,4,1,4,4,4,4,4,1,1} }, +- // 3.5: Variable resolution rotate Latitude/Longitude +- { 5, 16, 1, {1,1,4,1,4,1,4,4,4,4,4,1,1,-4,4,4} }, +- // 3.12: Transverse Mercator +- {12, 22, 0, {1,1,4,1,4,1,4,4,4,-4,4,1,-4,4,4,1,4,4,-4,-4,-4,-4} }, +- // 3.101: General unstructured grid +- {101, 4, 0, {1,4,1,-4} }, +- // 3.140: Lambert Azimuthal Equal Area Projection +- {140, 17, 0, {1,1,4,1,4,1,4,4,4,-4,4,4,4,1,4,4,1} }, +-// +- // 3.10: Mercator +- {10, 19, 0, {1,1,4,1,4,1,4,4,4,-4,4,1,-4,-4,4,1,4,4,4} }, +- // 3.20: Polar Stereographic Projection +- {20, 18, 0, {1,1,4,1,4,1,4,4,4,-4,4,1,-4,4,4,4,1,1} }, +- // 3.30: Lambert Conformal +- {30, 22, 0, {1,1,4,1,4,1,4,4,4,-4,4,1,-4,4,4,4,1,1,-4,-4,-4,4} }, +- // 3.31: Albers equal area +- {31, 22, 0, {1,1,4,1,4,1,4,4,4,-4,4,1,-4,4,4,4,1,1,-4,-4,-4,4} }, +- // 3.40: Guassian Lat/Lon +- {40, 19, 0, {1,1,4,1,4,1,4,4,4,4,4,-4,4,1,-4,4,4,4,1} }, +- // 3.41: Rotated Gaussian Lat/Lon +- {41, 22, 0, {1,1,4,1,4,1,4,4,4,4,4,-4,4,1,-4,4,4,4,1,-4,4,4} }, +- // 3.42: Stretched Gaussian Lat/Lon +- {42, 22, 0, {1,1,4,1,4,1,4,4,4,4,4,-4,4,1,-4,4,4,4,1,-4,4,-4} }, +- // 3.43: Stretched and Rotated Gaussian Lat/Lon +- {43, 25, 0, {1,1,4,1,4,1,4,4,4,4,4,-4,4,1,-4,4,4,4,1,-4,4,4,-4,4,-4} }, +- // 3.50: Spherical Harmonic Coefficients +- {50, 5, 0, {4,4,4,1,1} }, +- // 3.51: Rotated Spherical Harmonic Coefficients +- {51, 8, 0, {4,4,4,1,1,-4,4,4} }, +- // 3.52: Stretched Spherical Harmonic Coefficients +- {52, 8, 0, {4,4,4,1,1,-4,4,-4} }, +- // 3.53: Stretched and Rotated Spherical Harmonic Coefficients +- {53, 11, 0, {4,4,4,1,1,-4,4,4,-4,4,-4} }, +- // 3.90: Space View Perspective or orthographic +- {90, 21, 0, {1,1,4,1,4,1,4,4,4,-4,4,1,4,4,4,4,1,4,4,4,4} }, +- // 3.100: Triangular grid based on an icosahedron +- {100, 11, 0, {1,1,2,1,-4,4,4,1,1,1,4} }, +- // 3.110: Equatorial Azimuthal equidistant +- {110, 16, 0, {1,1,4,1,4,1,4,4,4,-4,4,1,4,4,1,1} }, +- // 3.120: Azimuth-range projection +- {120, 7, 1, {4,4,-4,4,4,4,1} }, +- // 3.204: Curvilinear Orthogonal Grid +- {204, 19, 0, {1,1,4,1,4,1,4,4,4,4,4,-4,4,1,-4,4,4,4,1} }, +- // 3.32768: Rot Lat/Lon E-grid (Arakawa) +- {32768, 19, 0, {1,1,4,1,4,1,4,4,4,4,4,-4,4,1,-4,4,4,4,1} }, +- // 3.32769: Rot Lat/Lon Non-E Staggered grid (Arakawa) +- {32769, 21, 0, {1,1,4,1,4,1,4,4,4,4,4,-4,4,1,-4,4,4,4,1,4,4} }, +- // 3.1000: Cross Section Grid +- {1000, 20, 1, {1,1,4,1,4,1,4,4,4,4,-4,4,1,4,4,1,2,1,1,2} }, +- // 3.1100: Hovmoller Diagram Grid +- {1100, 28, 0, {1,1,4,1,4,1,4,4,4,4,-4,4,1,-4,4,1,4,1,-4,1,1,-4,2,1,1,1,1,1} }, +- // 3.1200: Time Section Grid +- {1200, 16, 1, {4,1,-4,1,1,-4,2,1,1,1,1,1,2,1,1,2} } +- +- } ; ++ extern const struct gridtemplate templatesgrid[]; + ++ g2int getgridindex(g2int number); + + #endif /* _gridtemplates_H */ +diff -up g2clib-1.6.0.p1/pdstemplates.c g2clib-1.6.0.p12/pdstemplates.c +--- g2clib-1.6.0.p1/pdstemplates.c 2017-08-13 10:17:37.482288608 +0200 ++++ g2clib-1.6.0.p12/pdstemplates.c 2017-08-13 10:47:53.643134973 +0200 +@@ -2,6 +2,179 @@ + #include "grib2.h" + #include "pdstemplates.h" + ++const struct pdstemplate templatespds[MAXPDSTEMP] = { ++ // 4.0: Analysis or Forecast at Horizontal Level/Layer ++ // at a point in time ++ {0,15,0, {1,1,1,1,1,2,1,1,-4,1,-1,-4,1,-1,-4} }, ++ // 4.1: Individual Ensemble Forecast at Horizontal Level/Layer ++ // at a point in time ++ {1,18,0, {1,1,1,1,1,2,1,1,-4,1,-1,-4,1,-1,-4,1,1,1} }, ++ // 4.2: Derived Fcst based on whole Ensemble at Horiz Level/Layer ++ // at a point in time ++ {2,17,0, {1,1,1,1,1,2,1,1,-4,1,-1,-4,1,-1,-4,1,1} }, ++ // 4.3: Derived Fcst based on Ensemble cluster over rectangular ++ // area at Horiz Level/Layer at a point in time ++ {3,31,1, {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} }, ++ // 4.4: Derived Fcst based on Ensemble cluster over circular ++ // area at Horiz Level/Layer at a point in time ++ {4,30,1, {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.5: Probablility Forecast at Horiz Level/Layer ++ // at a point in time ++ {5,22,0, {1,1,1,1,1,2,1,1,-4,1,-1,-4,1,-1,-4,1,1,1,-1,-4,-1,-4} }, ++ // 4.6: Percentile Forecast at Horiz Level/Layer ++ // at a point in time ++ {6,16,0, {1,1,1,1,1,2,1,1,-4,1,-1,-4,1,-1,-4,1} }, ++ // 4.7: Analysis or Forecast Error at Horizontal Level/Layer ++ // at a point in time ++ {7,15,0, {1,1,1,1,1,2,1,1,-4,1,-1,-4,1,-1,-4} }, ++ // 4.8: Ave/Accum/etc... at Horiz Level/Layer ++ // in a time interval ++ {8,29,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} }, ++ // 4.9: Probablility Forecast at Horiz Level/Layer ++ // in a time interval ++ {9,36,1, {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} }, ++ // 4.10: Percentile Forecast at Horiz Level/Layer ++ // in a time interval ++ {10,30,1, {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} }, ++ // 4.11: Individual Ensemble Forecast at Horizontal Level/Layer ++ // in a time interval ++ {11,32,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} }, ++ // 4.12: Derived Fcst based on whole Ensemble at Horiz Level/Layer ++ // in a time interval ++ {12,31,1, {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} }, ++ // 4.13: Derived Fcst based on Ensemble cluster over rectangular ++ // area at Horiz Level/Layer in a time interval ++ {13,45,1, {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} }, ++ // 4.14: Derived Fcst based on Ensemble cluster over circular ++ // area at Horiz Level/Layer in a time interval ++ {14,44,1, {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} }, ++ // 4.15: Average, accumulation, extreme values or other statistically-processed values over a ++ // spatial area at a horizontal level or in a horizontal layer at a point in time ++ {15,18,0, {1,1,1,1,1,2,1,1,-4,1,-1,-4,1,-1,-4,1,1,1} }, ++ // 4.20: Radar Product ++ {20,19,0, {1,1,1,1,1,-4,4,2,4,2,1,1,1,1,1,2,1,3,2} }, ++ // 4.30: Satellite Product ++ {30,5,1, {1,1,1,1,1} }, ++ // 4.31: Satellite Product ++ {31,5,1, {1,1,1,1,1} }, ++ // 4.40: Analysis or forecast at a horizontal level or in a horizontal layer ++ // at a point in time for atmospheric chemical constituents ++ {40,16,0, {1,1,2,1,1,1,2,1,1,-4,1,-1,-4,1,-1,-4} }, ++ // 4.41: Individual ensemble forecast, control and perturbed, at a horizontal level or ++ // in a horizontal layer at a point in time for atmospheric chemical constituents ++ {41,19,0, {1,1,2,1,1,1,2,1,1,-4,1,-1,-4,1,-1,-4,1,1,1} }, ++ // 4.42: 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 ++ {42,30,1, {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} }, ++ // 4.43: 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 ++ {43,33,1, {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} }, ++ // 4.254: CCITT IA5 Character String ++ {254,3,0, {1,1,4} }, ++ // 4.1000: Cross section of analysis or forecast ++ // at a point in time ++ {1000,9,0, {1,1,1,1,1,2,1,1,-4} }, ++ // 4.1001: Cross section of Ave/Accum/etc... analysis or forecast ++ // in a time interval ++ {1001,16,0, {1,1,1,1,1,2,1,1,4,4,1,1,1,4,1,4} }, ++ // 4.1001: Cross section of Ave/Accum/etc... analysis or forecast ++ // over latitude or longitude ++ {1002,15,0, {1,1,1,1,1,2,1,1,-4,1,1,1,4,4,2} }, ++ // 4.1100: Hovmoller-type grid w/ no averaging or other ++ // statistical processing ++ {1100,15,0, {1,1,1,1,1,2,1,1,-4,1,-1,-4,1,-1,-4} }, ++ // 4.1100: Hovmoller-type grid with averaging or other ++ // statistical processing ++ {1101,22,0, {1,1,1,1,1,2,1,1,-4,1,-1,-4,1,-1,-4,4,1,1,1,4,1,4} }, ++ // 4.32:Simulate (synthetic) Satellite Product ++ {32,10,1, {1,1,1,1,1,2,1,1,-2,1} }, ++ // 4.44: Analysis or forecast at a horizontal level or in a horizontal layer ++ // at a point in time for Aerosol ++ {44,21,0, {1,1,2,1,-1,-4,-1,-4,1,1,1,2,1,1,-2,1,-1,-4,1,-1,-4} }, ++ // 4.45: Individual ensemble forecast, control and ++ // perturbed, at a horizontal level or in a horizontal layer ++ // at a point in time for Aerosol ++ {45,24,0, {1,1,2,1,-1,-4,-1,-4,1,1,1,2,1,1,-4,1,-1,-4,1,-1,-4,1,1,1} }, ++ // 4.46: Ave or Accum or Extreme value at level/layer ++ // at horizontal level or in a horizontal in a continuous or ++ // non-continuous time interval for Aerosol ++ {46,35,1, {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} }, ++ // 4.47: Individual ensemble forecast, control and ++ // perturbed, at horizontal level or in a horizontal ++ // in a continuous or non-continuous time interval for Aerosol ++ {47,38,1, {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} }, ++ ++ // PDT 4.48 ++ // 4.48: Analysis or forecast at a horizontal level or in a horizontal layer ++ // at a point in time for Optical Properties of Aerosol ++ {48,26,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} }, ++ ++ // VALIDATION --- PDT 4.50 ++ // 4.50: Analysis or forecast of multi component parameter or ++ // matrix element at a point in time ++ {50,21,0, {1,1,1,1,1,2,1,1,-4,1,-1,-4,1,-1,-4,1,1,4,4,4,4} }, ++ ++ // VALIDATION --- PDT 4.52 ++ // 4.52: Analysis or forecast of Wave parameters ++ // at the Sea surface at a point in time ++ {52,15,0, {1,1,1,1,1,1,1,1,2,1,1,-4,1,-1,-4} }, ++ ++ // 4.51: Categorical forecasts at a horizontal level or ++ // in a horizontal layer at a point in time ++ {51,16,1, {1,1,1,1,1,2,1,1,-4,1,-1,-4,1,-1,-4,1} }, ++ ++ // 4.91: Categorical forecasts at a horizontal level or ++ // in a horizontal layer at a point in time ++ // in a continuous or non-continuous time interval ++ {91,36,1, {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} }, ++// PDT 4.33 (07/29/2013) ++ // 4.33: Individual ensemble forecast, control, perturbed, ++ // at a horizontal level or in a horizontal layer ++ // at a point in time for simulated (synthetic) Satellite data ++ {33,18,1, {1,1,1,1,1,2,1,1,-4,1,2,2,2,-1,-4,1,1,1} }, ++// PDT 4.34 (07/29/2013) ++ // 4.34: Individual ensemble forecast, control, perturbed, ++ // at a horizontal level or in a horizontal layer,in a continuous or ++ // non-continuous interval for simulated (synthetic) Satellite data ++ {34,32,1, {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} }, ++// PDT 4.53 (07/29/2013) ++ // 4.53: Partitioned parameters at ++ // horizontal level or horizontal layer ++ // at a point in time ++ {53,19,1, {1,1,1,1,4,2,1,1,1,2,1,1,-4,1,-1,-4,1,-1,-4} }, ++// PDT 4.54 (07/29/2013) ++ // 4.54: Individual ensemble forecast, control, perturbed, ++ // at a horizontal level or in a horizontal layer ++ // at a point in time for partitioned parameters ++ {54,22,1, {1,1,1,1,4,2,1,1,1,2,1,1,-4,1,-1,-4,1,-1,-4,1,1,1} }, ++// PDT 4.57 (10/07/2015) ++ // 4.57: Analysis or Forecast at a horizontal or in a ++ // horizontal layer at a point in time for ++ // atmospheric chemical constituents based on ++ // a distribution function ++ {57,7,1, {1,1,2,2,2,2,1} }, ++// PDT 4.60 (10/07/2015) ++ // 4.60: Individual ensemble reforecast, control and perturbed, ++ // at a horizontal level or in a horizontal layer ++ // at a point in time ++ {60,24,0, {1,1,1,1,1,2,1,1,-4,1,-1,-4,1,-1,-4,1,1,1,2,1,1,1,1,1} }, ++// PDT 4.61 (10/07/2015) ++ // 4.61: Individual ensemble reforecast, control and perturbed, ++ // at a horizontal level or in a horizontal layer ++ // in a continuous or non-continuous time interval ++ {61,38,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,2,1,1,1,1,1,1,4,1,1,1,4,1,4} }, ++// VALIDATION --- PDT 4.35 ++// PDT 4.35 (10/07/2015) ++ // 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} } ++ ++} ; ++ ++ + g2int getpdsindex(g2int number) + ///$$$ SUBPROGRAM DOCUMENTATION BLOCK + // . . . . +diff -up g2clib-1.6.0.p1/pdstemplates.h g2clib-1.6.0.p12/pdstemplates.h +--- g2clib-1.6.0.p1/pdstemplates.h 2017-08-13 10:17:37.483288583 +0200 ++++ g2clib-1.6.0.p12/pdstemplates.h 2017-08-13 10:36:42.046773771 +0200 +@@ -54,176 +54,8 @@ + g2int mappds[MAXPDSMAPLEN]; + }; + +- const struct pdstemplate templatespds[MAXPDSTEMP] = { +- // 4.0: Analysis or Forecast at Horizontal Level/Layer +- // at a point in time +- {0,15,0, {1,1,1,1,1,2,1,1,-4,1,-1,-4,1,-1,-4} }, +- // 4.1: Individual Ensemble Forecast at Horizontal Level/Layer +- // at a point in time +- {1,18,0, {1,1,1,1,1,2,1,1,-4,1,-1,-4,1,-1,-4,1,1,1} }, +- // 4.2: Derived Fcst based on whole Ensemble at Horiz Level/Layer +- // at a point in time +- {2,17,0, {1,1,1,1,1,2,1,1,-4,1,-1,-4,1,-1,-4,1,1} }, +- // 4.3: Derived Fcst based on Ensemble cluster over rectangular +- // area at Horiz Level/Layer at a point in time +- {3,31,1, {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} }, +- // 4.4: Derived Fcst based on Ensemble cluster over circular +- // area at Horiz Level/Layer at a point in time +- {4,30,1, {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.5: Probablility Forecast at Horiz Level/Layer +- // at a point in time +- {5,22,0, {1,1,1,1,1,2,1,1,-4,1,-1,-4,1,-1,-4,1,1,1,-1,-4,-1,-4} }, +- // 4.6: Percentile Forecast at Horiz Level/Layer +- // at a point in time +- {6,16,0, {1,1,1,1,1,2,1,1,-4,1,-1,-4,1,-1,-4,1} }, +- // 4.7: Analysis or Forecast Error at Horizontal Level/Layer +- // at a point in time +- {7,15,0, {1,1,1,1,1,2,1,1,-4,1,-1,-4,1,-1,-4} }, +- // 4.8: Ave/Accum/etc... at Horiz Level/Layer +- // in a time interval +- {8,29,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} }, +- // 4.9: Probablility Forecast at Horiz Level/Layer +- // in a time interval +- {9,36,1, {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} }, +- // 4.10: Percentile Forecast at Horiz Level/Layer +- // in a time interval +- {10,30,1, {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} }, +- // 4.11: Individual Ensemble Forecast at Horizontal Level/Layer +- // in a time interval +- {11,32,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} }, +- // 4.12: Derived Fcst based on whole Ensemble at Horiz Level/Layer +- // in a time interval +- {12,31,1, {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} }, +- // 4.13: Derived Fcst based on Ensemble cluster over rectangular +- // area at Horiz Level/Layer in a time interval +- {13,45,1, {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} }, +- // 4.14: Derived Fcst based on Ensemble cluster over circular +- // area at Horiz Level/Layer in a time interval +- {14,44,1, {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} }, +- // 4.15: Average, accumulation, extreme values or other statistically-processed values over a +- // spatial area at a horizontal level or in a horizontal layer at a point in time +- {15,18,0, {1,1,1,1,1,2,1,1,-4,1,-1,-4,1,-1,-4,1,1,1} }, +- // 4.20: Radar Product +- {20,19,0, {1,1,1,1,1,-4,4,2,4,2,1,1,1,1,1,2,1,3,2} }, +- // 4.30: Satellite Product +- {30,5,1, {1,1,1,1,1} }, +- // 4.31: Satellite Product +- {31,5,1, {1,1,1,1,1} }, +- // 4.40: Analysis or forecast at a horizontal level or in a horizontal layer +- // at a point in time for atmospheric chemical constituents +- {40,16,0, {1,1,2,1,1,1,2,1,1,-4,1,-1,-4,1,-1,-4} }, +- // 4.41: Individual ensemble forecast, control and perturbed, at a horizontal level or +- // in a horizontal layer at a point in time for atmospheric chemical constituents +- {41,19,0, {1,1,2,1,1,1,2,1,1,-4,1,-1,-4,1,-1,-4,1,1,1} }, +- // 4.42: 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 +- {42,30,1, {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} }, +- // 4.43: 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 +- {43,33,1, {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} }, +- // 4.254: CCITT IA5 Character String +- {254,3,0, {1,1,4} }, +- // 4.1000: Cross section of analysis or forecast +- // at a point in time +- {1000,9,0, {1,1,1,1,1,2,1,1,-4} }, +- // 4.1001: Cross section of Ave/Accum/etc... analysis or forecast +- // in a time interval +- {1001,16,0, {1,1,1,1,1,2,1,1,4,4,1,1,1,4,1,4} }, +- // 4.1001: Cross section of Ave/Accum/etc... analysis or forecast +- // over latitude or longitude +- {1002,15,0, {1,1,1,1,1,2,1,1,-4,1,1,1,4,4,2} }, +- // 4.1100: Hovmoller-type grid w/ no averaging or other +- // statistical processing +- {1100,15,0, {1,1,1,1,1,2,1,1,-4,1,-1,-4,1,-1,-4} }, +- // 4.1100: Hovmoller-type grid with averaging or other +- // statistical processing +- {1101,22,0, {1,1,1,1,1,2,1,1,-4,1,-1,-4,1,-1,-4,4,1,1,1,4,1,4} }, +- // 4.32:Simulate (synthetic) Satellite Product +- {32,10,1, {1,1,1,1,1,2,1,1,-2,1} }, +- // 4.44: Analysis or forecast at a horizontal level or in a horizontal layer +- // at a point in time for Aerosol +- {44,21,0, {1,1,2,1,-1,-4,-1,-4,1,1,1,2,1,1,-2,1,-1,-4,1,-1,-4} }, +- // 4.45: Individual ensemble forecast, control and +- // perturbed, at a horizontal level or in a horizontal layer +- // at a point in time for Aerosol +- {45,24,0, {1,1,2,1,-1,-4,-1,-4,1,1,1,2,1,1,-4,1,-1,-4,1,-1,-4,1,1,1} }, +- // 4.46: Ave or Accum or Extreme value at level/layer +- // at horizontal level or in a horizontal in a continuous or +- // non-continuous time interval for Aerosol +- {46,35,1, {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} }, +- // 4.47: Individual ensemble forecast, control and +- // perturbed, at horizontal level or in a horizontal +- // in a continuous or non-continuous time interval for Aerosol +- {47,38,1, {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} }, +- +- // PDT 4.48 +- // 4.48: Analysis or forecast at a horizontal level or in a horizontal layer +- // at a point in time for Optical Properties of Aerosol +- {48,26,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} }, +- +- // VALIDATION --- PDT 4.50 +- // 4.50: Analysis or forecast of multi component parameter or +- // matrix element at a point in time +- {50,21,0, {1,1,1,1,1,2,1,1,-4,1,-1,-4,1,-1,-4,1,1,4,4,4,4} }, +- +- // VALIDATION --- PDT 4.52 +- // 4.52: Analysis or forecast of Wave parameters +- // at the Sea surface at a point in time +- {52,15,0, {1,1,1,1,1,1,1,1,2,1,1,-4,1,-1,-4} }, +- +- // 4.51: Categorical forecasts at a horizontal level or +- // in a horizontal layer at a point in time +- {51,16,1, {1,1,1,1,1,2,1,1,-4,1,-1,-4,1,-1,-4,1} }, +- +- // 4.91: Categorical forecasts at a horizontal level or +- // in a horizontal layer at a point in time +- // in a continuous or non-continuous time interval +- {91,36,1, {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} }, +-// PDT 4.33 (07/29/2013) +- // 4.33: Individual ensemble forecast, control, perturbed, +- // at a horizontal level or in a horizontal layer +- // at a point in time for simulated (synthetic) Satellite data +- {33,18,1, {1,1,1,1,1,2,1,1,-4,1,2,2,2,-1,-4,1,1,1} }, +-// PDT 4.34 (07/29/2013) +- // 4.34: Individual ensemble forecast, control, perturbed, +- // at a horizontal level or in a horizontal layer,in a continuous or +- // non-continuous interval for simulated (synthetic) Satellite data +- {34,32,1, {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} }, +-// PDT 4.53 (07/29/2013) +- // 4.53: Partitioned parameters at +- // horizontal level or horizontal layer +- // at a point in time +- {53,19,1, {1,1,1,1,4,2,1,1,1,2,1,1,-4,1,-1,-4,1,-1,-4} }, +-// PDT 4.54 (07/29/2013) +- // 4.54: Individual ensemble forecast, control, perturbed, +- // at a horizontal level or in a horizontal layer +- // at a point in time for partitioned parameters +- {54,22,1, {1,1,1,1,4,2,1,1,1,2,1,1,-4,1,-1,-4,1,-1,-4,1,1,1} }, +-// PDT 4.57 (10/07/2015) +- // 4.57: Analysis or Forecast at a horizontal or in a +- // horizontal layer at a point in time for +- // atmospheric chemical constituents based on +- // a distribution function +- {57,7,1, {1,1,2,2,2,2,1} }, +-// PDT 4.60 (10/07/2015) +- // 4.60: Individual ensemble reforecast, control and perturbed, +- // at a horizontal level or in a horizontal layer +- // at a point in time +- {60,24,0, {1,1,1,1,1,2,1,1,-4,1,-1,-4,1,-1,-4,1,1,1,2,1,1,1,1,1} }, +-// PDT 4.61 (10/07/2015) +- // 4.61: Individual ensemble reforecast, control and perturbed, +- // at a horizontal level or in a horizontal layer +- // in a continuous or non-continuous time interval +- {61,38,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,2,1,1,1,1,1,1,4,1,1,1,4,1,4} }, +-// VALIDATION --- PDT 4.35 +-// PDT 4.35 (10/07/2015) +- // 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} } +- +- } ; ++ extern const struct pdstemplate templatespds[]; ++ ++ g2int getpdsindex(g2int number); + + #endif /* _pdstemplates_H */ diff --git a/g2clib.spec b/g2clib.spec new file mode 100644 index 0000000..54affb9 --- /dev/null +++ b/g2clib.spec @@ -0,0 +1,107 @@ +%global macrosdir %(d=%{_rpmconfigdir}/macros.d; [ -d $d ] || d=%{_sysconfdir}/rpm; echo $d) + +Name: g2clib +Version: 1.6.0 +Release: 1 +Summary: GRIB2 encoder/decoder and search/indexing routines in C + +License: Public Domain +URL: http://www.nco.ncep.noaa.gov/pmb/codes/GRIB2/ +Source0: http://www.nco.ncep.noaa.gov/pmb/codes/GRIB2/g2clib-%{version}.tar +Source1: g2clib-msg.txt +#Patch to fix up type detection and printf arguments on 64-bit machines +Patch0: g2clib-64bit.patch +# Patch to remove multiple definitions of templates +Patch1: g2clib-templates.patch +# Patch from Wesley Ebisuzaki to fix sigfault +# if simunpack() is called with 0 values to unpack +Patch2: g2clib-simunpack.patch +# Patch from degrib - appears to fix projection issues +Patch3: g2clib-degrib.patch +# Fix build with Jasper 2 +Patch4: g2clib-jasper2.patch + +BuildRequires: gcc +BuildRequires: libpng-devel jasper-devel +# static only library - no debuginfo +%global debug_package %{nil} + +%if %{lua: print(rpm.vercmp(rpm.expand("%version"),"1.6.0"))} >= 0 +%global g2clib g2c_v%{version} +%else +%global g2clib grib2c +%endif + +%description +This library contains "C" decoder/encoder +routines for GRIB edition 2. The user API for the GRIB2 routines +is described in ASCII file "grib2c.doc". + + +%package devel +Summary: Development files for %{name} +#Requires: %%{name} = %%{version}-%%{release} +Provides: %{name}-static = %{version}-%{release} +Requires: libpng-devel jasper-devel + +%description devel +This library contains "C" decoder/encoder +routines for GRIB edition 2. The user API for the GRIB2 routines +is described in file "grib2c.doc". + +The %{name}-devel package contains libraries and header files for +developing applications that use %{name}. + + +%prep +%setup -q +%patch0 -p1 -b .64bit +%patch1 -p1 -b .templates +%patch2 -p1 -b .simunpack +%patch3 -p1 -b .degrib +%patch4 -p1 -b .jasper2 +chmod a-x *.h *.c README CHANGES grib2c.doc makefile +cp -p %{SOURCE1} . + + +%build +CFLAGS="$RPM_OPT_FLAGS -DUSE_PNG -DUSE_JPEG2000" + +%ifarch sparc64 s390x %{mips64} +CFLAGS="$CFLAGS -D__64BIT__ -fPIC" +%endif +%ifarch x86_64 ia64 %{power64} aarch64 +CFLAGS="$CFLAGS -D__64BIT__ -fpic" +%endif +%ifarch %{ix86} %{arm} %{mips32} +CFLAGS="$CFLAGS -fpic" +%endif + +make CFLAGS="$CFLAGS" CC="%{__cc}" ARFLAGS= + + +%install +mkdir -p $RPM_BUILD_ROOT%{_libdir} $RPM_BUILD_ROOT%{_includedir} +install -p -m0644 lib%{g2clib}.a $RPM_BUILD_ROOT%{_libdir} +install -p -m0644 grib2.h $RPM_BUILD_ROOT%{_includedir} +install -p -m0644 drstemplates.h $RPM_BUILD_ROOT%{_includedir} +install -p -m0644 gridtemplates.h $RPM_BUILD_ROOT%{_includedir} +install -p -m0644 pdstemplates.h $RPM_BUILD_ROOT%{_includedir} +mkdir -p $RPM_BUILD_ROOT%{macrosdir} +echo %%g2clib %g2clib > $RPM_BUILD_ROOT%{macrosdir}/macros.g2clib + + +%files devel +%doc README CHANGES grib2c.doc g2clib-msg.txt +#%%{_libdir}/libgrib2c.a +%{_libdir}/lib%{g2clib}.a +%{_includedir}/grib2.h +%{_includedir}/drstemplates.h +%{_includedir}/gridtemplates.h +%{_includedir}/pdstemplates.h +%{macrosdir}/macros.g2clib + + +%changelog +* Web Feb 03 2021 yangshaoxing - 1.6.0-1 +- Package init