Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/developer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ jobs:
cd wgrib2
mkdir build
cd build
export CFLAGS='-Wall -Werror -Wno-error=unused-parameter -Wno-error=unused-dummy-argument -g -fprofile-abs-path -fprofile-arcs -ftest-coverage -O0 -I/home/runner/work/wgrib2/wgrib2/nceplibs/NCEPLIBS-g2c/include'
export FCFLAGS='-Wall -Werror -Wno-error=unused-parameter -Wno-error=unused-dummy-argument -g -fprofile-abs-path -fprofile-arcs -ftest-coverage -O0'
export FFLAGS='-Wall -Werror -Wno-error=unused-parameter -Wno-error=unused-dummy-argument -g -fprofile-abs-path -fprofile-arcs -ftest-coverage -O0'
export CFLAGS='-Wall -Werror -Wno-error=unused-parameter -Wno-error=unused-dummy-argument -Wno-error=unused-but-set-variable -Wno-error=unused-variable -g -fprofile-abs-path -fprofile-arcs -ftest-coverage -O0 -I/home/runner/work/wgrib2/wgrib2/nceplibs/NCEPLIBS-g2c/include'
export FCFLAGS='-Wall -Werror -Wno-error=unused-parameter -Wno-error=unused-dummy-argument -Wno-error=unused-but-set-variable -Wno-error=unused-variable -g -fprofile-abs-path -fprofile-arcs -ftest-coverage -O0'
export FFLAGS='-Wall -Werror -Wno-error=unused-parameter -Wno-error=unused-dummy-argument -Wno-error=unused-but-set-variable -Wno-error=unused-variable -g -fprofile-abs-path -fprofile-arcs -ftest-coverage -O0'
cmake .. -DENABLE_DOCS=ON -DFTP_TEST_FILES=ON -DCMAKE_PREFIX_PATH="$GITHUB_WORKSPACE/nceplibs/NCEPLIBS-ip;$GITHUB_WORKSPACE/nceplibs/jasper;$GITHUB_WORKSPACE/nceplibs/NCEPLIBS-g2c" -DTEST_FILE_DIR=/home/runner/data -DMAKE_FTN_API=ON -DUSE_NETCDF=ON -DUSE_IPOLATES=ON -DUSE_G2CLIB_LOW=ON -DUSE_OPENMP=ON -DBUILD_WGRIB=OFF
make VERBOSE=1
ctest --verbose --output-on-failure --rerun-failed
Expand Down
4 changes: 0 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,10 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
option(ENABLE_DOCS "Enable generation of doxygen-based documentation." OFF)
option(USE_NETCDF "Use NetCDF" off)
option(USE_REGEX "Use Regex?" on)
option(USE_TIGGE "Use tigge?" on)
option(USE_MYSQL "Use MySQL?" off)
option(USE_IPOLATES "Use Ipolates" off)
option(USE_UDF "Use UDF?" off)
option(USE_OPENMP "Use OpenMP?" off)
option(USE_PROJ4 "Use Proj4?" off)
option(USE_WMO_VALIDATION "Use WMO Validation?" off)
option(DISABLE_TIMEZONE "Disable posix Timezone?" off)
option(DISABLE_ALARM "Disable Alarm?" off)
set(USE_NAMES "NCEP")
option(USE_G2CLIB_HIGH "Use g2c high-level decoder (-g2clib 2)?" off)
Expand Down
3 changes: 0 additions & 3 deletions docs/user_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,10 @@ Additional CMake build options can be used to configure the build by setting the
| FTP_TEST_FILES | Fetch and test with files on FTP site. | OFF |
| FTP_LARGE_TEST_FILES | Fetch and test with very large files on FTP site. | OFF |
| FTP_EXTRA_TEST_FILES | Test with more large files fetched via FTP. | OFF |
| USE_TIGGE | Enable use of TIGGE gribtables | ON |
| USE_UDF | Enable User-Defined functions | OFF |
| USE_WMO_VALIDATION | Use WMO Validation Tables (unofficial templates) | OFF |
| DISABLE_ALARM | Disable alarm for non-compatible systems | OFF |
| DISABLE_STAT | Disable POSIX feature | OFF |
| BUILD_EXTRA | Build user-contributed code. This code is no longer supported - use at your own risk. | OFF |
| USE_MYSQL | Use with BUILD_EXTRA = ON to enable user-contributed MySQL options. It is user's responsibility to ensure MySQL is available. | OFF |

## Documentation for Previous Versions of wgrib2

Expand Down
23 changes: 23 additions & 0 deletions extra/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,29 @@ include_directories(../wgrib2/)
add_library(wgrib2_extra OBJECT ${src})
target_compile_definitions(wgrib2_extra PUBLIC ${definitions_list})

# Optional MySQL support: detect and define USE_MYSQL if available
# This is intentionally NOT REQUIRED; build proceeds without MySQL.
find_package(MySQL QUIET)

if (MYSQL_FOUND)
message(STATUS "MySQL found: enabling USE_MYSQL for wgrib2_extra")
target_compile_definitions(wgrib2_extra PUBLIC USE_MYSQL)

if (DEFINED MYSQL_INCLUDE_DIRS)
target_include_directories(wgrib2_extra PUBLIC ${MYSQL_INCLUDE_DIRS})
elseif(DEFINED MYSQL_INCLUDE_DIR)
target_include_directories(wgrib2_extra PUBLIC ${MYSQL_INCLUDE_DIR})
endif()

if (DEFINED MYSQL_LIBRARIES)
target_link_libraries(wgrib2_extra PUBLIC ${MYSQL_LIBRARIES})
elseif(DEFINED MYSQL_LIBRARY)
target_link_libraries(wgrib2_extra PUBLIC ${MYSQL_LIBRARY})
endif()
else()
message(STATUS "MySQL not found: building wgrib2_extra without MySQL support")
endif()

if (BUILD_LIB)
set_property(TARGET wgrib2_extra PROPERTY POSITION_INDEPENDENT_CODE ON)
endif()
Expand Down
6 changes: 3 additions & 3 deletions spack/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def url_for_version(self, version):
description="Add commands for user-defined functions and shell commands",
)
variant("regex", default=True, description="Use regular expression library (POSIX-2)")
variant("tigge", default=True, description="Ability for TIGGE-like variable names")
variant("tigge", default=True, description="Ability for TIGGE-like variable names",when="@:3.8")
variant(
"proj4",
default=False,
Expand Down Expand Up @@ -177,7 +177,7 @@ def url_for_version(self, version):
when="@3.7:",
)
variant(
"disable_timezone", default=False, description="Some machines do not support timezones"
"disable_timezone", default=False, description="Some machines do not support timezones", when="@:3.8"
)
variant(
"disable_alarm",
Expand All @@ -197,7 +197,7 @@ def url_for_version(self, version):
when="@:3.7"
)
variant("openmp", default=True, description="OpenMP parallelization")
variant("wmo_validation", default=False, description="WMO validation")
variant("wmo_validation", default=False, description="WMO validation", when="@:3.1")
# variant("shared", default=False, description="Enable shared library", when="+lib")
variant("disable_stat", default=False, description="Disable POSIX feature", when="@:3.1")
variant("openjpeg", default=False, description="Enable OpenJPEG", when="@:3.7")
Expand Down
2 changes: 0 additions & 2 deletions wgrib2/CodeTable.c
Original file line number Diff line number Diff line change
Expand Up @@ -666,9 +666,7 @@ unsigned char *code_table_3_2_location(unsigned char **sec) {
case 204:
case 1000:
case 1100:
#ifdef WMO_VALIDATION
case 60:
#endif
return sec[3]+14;
default: break;
}
Expand Down
13 changes: 0 additions & 13 deletions wgrib2/Config.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,6 @@ int f_config(ARG0) {
strcat(inv_out, "AEC is installed\n" );
#endif

#ifdef USE_MYSQL
strcat(inv_out, "mysql package is installed\n");
#else
strcat(inv_out, "mysql package is not installed\n");
#endif


#ifdef USE_REGEX
strcat(inv_out, "regex package is installed\n");
#else
Expand All @@ -93,12 +86,6 @@ int f_config(ARG0) {
strcat(inv_out, "flush_mode determined by stat()\n");
#endif

#ifdef USE_TIGGE
strcat(inv_out, "tigge package is installed\n");
#else
strcat(inv_out, "tigge package is not installed\n");
#endif

#ifdef USE_IPOLATES
inv_out += strlen(inv_out);
sprintf(inv_out, "IPOLATES NCEPLIBS-ip\n");
Expand Down
7 changes: 0 additions & 7 deletions wgrib2/CubeFace2global.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include "grb2.h"
#include "wgrib2.h"
#include "fnlist.h"
#ifdef WMO_VALIDATION

/** Decode grib file flag. */
extern int decode;
Expand Down Expand Up @@ -205,9 +204,3 @@ int f_cubeface2global(ARG2) {
}
return 0;
}
#else
int f_cubeface2global(ARG2) {
fatal_error("cubeface2global: not installed","");
return 0;
}
#endif
4 changes: 0 additions & 4 deletions wgrib2/FlagTable.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,8 @@ unsigned char *flag_table_3_3_location(unsigned char **sec) {
case 90:
case 110:
return gds+46;
#ifdef WMO_VALIDATION
case 60:
return gds+71;
#endif
case 32768:
if (center == NCEP) return gds+54;
return NULL;
Expand Down Expand Up @@ -303,10 +301,8 @@ unsigned char *flag_table_3_4_location(unsigned char **sec) {
return gds+71; break;
case 1000:
return gds+50; break;
#ifdef WMO_VALIDATION
case 60:
return gds+72; break;
#endif
case 32768:
if (center == NCEP) return gds+71;
return NULL;
Expand Down
2 changes: 0 additions & 2 deletions wgrib2/Latlon.c
Original file line number Diff line number Diff line change
Expand Up @@ -434,11 +434,9 @@ int get_latlon(unsigned char **sec, double **lon, double **lat) {
else if (grid_template == 40) {
err = gauss2ll(sec, lat, lon);
}
#ifdef WMO_VALIDATION
else if (grid_template == 60) {
err = cubed_sphere2ll(sec, lat, lon);
}
#endif
else if (grid_template == 90) {
err = space_view2ll(sec, lat, lon);
}
Expand Down
6 changes: 0 additions & 6 deletions wgrib2/Sec3.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,11 +183,9 @@ int get_nxny_(unsigned char **sec, unsigned int *nx, unsigned int *ny, unsigned
case 120: *nx = uint4_missing(gds+14); // nx = bin along radials, ny = num radials
*ny = uint4_missing(gds+18);
break;
#ifdef WMO_VALIDATION
case 60: *nx = uint4_missing(gds+30);
*ny = uint4_missing(gds+34);
break;
#endif
case 32768:
case 32769:
if (center == NCEP) {
Expand Down Expand Up @@ -280,10 +278,8 @@ int get_nxny_(unsigned char **sec, unsigned int *nx, unsigned int *ny, unsigned
else if (*nx > 0 && *ny > 0) npoints = (unsigned) *nx * *ny;
*npnts = GB2_Sec3_npts(sec);

#ifdef WMO_VALIDATION
/* if global cubed sphere */
if (grid_template == 60 && GDS_Gnom_tile(gds) == 0) npoints *= 6;
#endif


if ((*nx != 0 || *ny != 0) && GB2_Sec3_npts(sec) != npoints && GDS_Scan_staggered_storage(*scan) == 0) {
Expand Down Expand Up @@ -949,7 +945,6 @@ int f_grid(ARG0) {
sprintf(inv_out,"pole of stretching lat=%lf lon=%lf stretching=%lf",
ieee2flt(gds+40), ieee2flt(gds+44),ieee2flt(gds+48));
break;
#ifdef WMO_VALIDATION
case 60: sprintf(inv_out,"%sCubed Sphere grid: face C%d:", nl, GDS_Gnom_face_size(gds));
inv_out += strlen(inv_out);
if (GDS_Gnom_tile(gds) == 0) {
Expand All @@ -973,7 +968,6 @@ int f_grid(ARG0) {
GDS_Gnom_B(gds));
inv_out += strlen(inv_out);
break;
#endif
case 90:
sprintf(inv_out,"%sSpace view perspective or orthographic grid (%d x %d)",nl,nx,ny);
inv_out += strlen(inv_out);
Expand Down
8 changes: 0 additions & 8 deletions wgrib2/Tigge.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
#include "wgrib2.h"
#include "fnlist.h"

#ifdef USE_TIGGE

/** Use TIGGE flag. */
int tigge;

Expand All @@ -34,10 +32,4 @@ int f_tigge(ARG0) {
if (mode == -1) tigge = 1;
return 0;
}
#else
int f_tigge(ARG0) {
if (mode == -1) {fprintf(stderr,"tigge is not installed\n"); return 1;}
return 0;
}
#endif

6 changes: 0 additions & 6 deletions wgrib2/cname.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,10 @@ extern struct gribtable_s *user_gribtable;

static struct gribtable_s *search_gribtable(struct gribtable_s *gribtable, unsigned char **sec);

#ifdef USE_TIGGE
/** Flag to use TIGGE */
extern int tigge;
/** TIGGE Grib Table */
extern struct gribtable_s tigge_gribtable[];
#endif

/** Indicates the GRIB table name to use */
extern int names;
Expand Down Expand Up @@ -78,14 +76,10 @@ int getName_all(unsigned char **sec, int mode, char *inv_out, char *name, char *
if (p == NULL && names == ECMWF) p = search_gribtable(ECMWF_gribtable, sec);
if (p == NULL && names == DWD1) p = search_gribtable(DWD1_gribtable, sec);
if (p == NULL && names == NCEP) {
#ifdef USE_TIGGE
if (tigge && p == NULL) p = search_gribtable(tigge_gribtable, sec); /* tigge is default table */
#endif
if (p == NULL) p = search_gribtable(NCEP_gribtable, sec);
#ifdef USE_TIGGE
/* if undefined and a tigge file */
if (p == NULL && !tigge && (code_table_1_3(sec) == 4 || code_table_1_3(sec) == 5)) p = search_gribtable(tigge_gribtable, sec);
#endif
}

/* check local tables */
Expand Down
4 changes: 0 additions & 4 deletions wgrib2/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,10 @@

#cmakedefine USE_NETCDF
#cmakedefine USE_REGEX
#cmakedefine USE_TIGGE
#cmakedefine USE_MYSQL
#cmakedefine USE_IPOLATES
#cmakedefine USE_UDF
#cmakedefine USE_OPENMP
#cmakedefine USE_PROJ4
#cmakedefine USE_WMO_VALIDATION
#cmakedefine DISABLE_TIMEZONE
#cmakedefine DISABLE_ALARM
#cmakedefine USE_NAMES @USE_NAMES@
#cmakedefine USE_G2CLIB_HIGH
Expand Down
3 changes: 0 additions & 3 deletions wgrib2/cubed_sphere2ll.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
#include "wgrib2.h"
#include "fnlist.h"

#ifdef WMO_VALIDATION

/** Output order type. */
extern enum output_order_type output_order;

Expand Down Expand Up @@ -255,4 +253,3 @@ int cubed_spherell2xy(unsigned char **sec, int n, double *lon, double *lat, doub
}
return 0;
}
#endif
3 changes: 0 additions & 3 deletions wgrib2/gribtab.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,10 @@ struct gribtable_s local_gribtable[] = {
{ -1, -1, -1, -1, -1, -1, -1, -1, NULL, NULL, NULL }
};

#ifdef USE_TIGGE

/** Struct for TIGGE GRIB table. */
struct gribtable_s tigge_gribtable[] = {
#include "gribtables/tigge/tigge_gribtable.dat"
/* END MARKER */
{ -1, -1, -1, -1, -1, -1, -1, -1, NULL, NULL, NULL }
};

#endif
4 changes: 0 additions & 4 deletions wgrib2/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,7 @@ extern char **WxKeys; /**< NDFD weather information keys. */
extern const char *text_format; /**< Pointer to text format. */
extern int text_column; /**< Number of columns in text output. */

#ifdef USE_TIGGE
extern int tigge; /**< Use TIGGE flag. */
#endif
extern int names; /**< Name convention to use. */

// extern long int pos_input; /* seq read of grib */
Expand Down Expand Up @@ -272,9 +270,7 @@ void init_globals(void) {
text_format = "%g"; /* File.c */
text_column = 1;

#ifdef USE_TIGGE
tigge = 0; /* Tigge.c */
#endif

names = USE_NAMES;

Expand Down
4 changes: 0 additions & 4 deletions wgrib2/stagger.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,12 @@ int stagger(unsigned char **sec, unsigned int assumed_npnts, double *x, double *
// number of grid points
n = (ny/2)*nx_even + ((ny+1)/2)*nx_odd;

#ifdef WMO_VALIDATION
if (code_table_3_1(sec) == 60) { /* cubed sphere */
if (GDS_Gnom_tile(sec[3]) == 0) { /* global - 6 faces */
n = n*6;
}
fprintf(stderr,"stagger: n=%d assume %d sec3 %d\n", n,assumed_npnts, GB2_Sec3_npts(sec));
}
#endif

// check to number of points
if (assumed_npnts != n)
Expand Down Expand Up @@ -143,7 +141,6 @@ int stagger(unsigned char **sec, unsigned int assumed_npnts, double *x, double *
}
}

#ifdef WMO_VALIDATION
if (code_table_3_1(sec) == 60) { /* cubed sphere */
if (GDS_Gnom_tile(sec[3]) == 0) { /* global - 6 faces */
/* calculated X, Y for one face, duplicate for all 8 faces */
Expand All @@ -157,7 +154,6 @@ int stagger(unsigned char **sec, unsigned int assumed_npnts, double *x, double *
}
}
}
#endif

return 0;
}
4 changes: 0 additions & 4 deletions wgrib2/wgrib2_meta.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,10 @@

#cmakedefine USE_NETCDF
#cmakedefine USE_REGEX
#cmakedefine USE_TIGGE
#cmakedefine USE_MYSQL
#cmakedefine USE_IPOLATES
#cmakedefine USE_UDF
#cmakedefine USE_OPENMP
#cmakedefine USE_PROJ4
#cmakedefine USE_WMO_VALIDATION
#cmakedefine DISABLE_TIMEZONE
#cmakedefine DISABLE_ALARM
#cmakedefine USE_NAMES NCEP
#cmakedefine USE_G2CLIB_HIGH
Expand Down
Loading