Commit 97c20a1f authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

cgribexlib update

parent afca0021
...@@ -124,8 +124,7 @@ int cdfOpenFile(const char *filename, const char *mode, int *filetype) ...@@ -124,8 +124,7 @@ int cdfOpenFile(const char *filename, const char *mode, int *filetype)
#endif #endif
#if defined (HAVE_NETCDF4) #if defined (HAVE_NETCDF4)
if ( *filetype == FILETYPE_NC4 ) writemode |= NC_NETCDF4; if ( *filetype == FILETYPE_NC4 ) writemode |= NC_NETCDF4;
else if ( *filetype == FILETYPE_NC4C ) else if ( *filetype == FILETYPE_NC4C ) writemode |= NC_NETCDF4 | NC_CLASSIC_MODEL;
writemode |= NC_NETCDF4 | NC_CLASSIC_MODEL;
#endif #endif
cdf_create(filename, writemode, &ncid); cdf_create(filename, writemode, &ncid);
cdfComment(ncid); cdfComment(ncid);
......
...@@ -255,8 +255,7 @@ cdf_def_var_serial(int ncid, const char *name, nc_type xtype, int ndims, ...@@ -255,8 +255,7 @@ cdf_def_var_serial(int ncid, const char *name, nc_type xtype, int ndims,
Message("ncid = %d name = %s xtype = %d ndims = %d varid = %d", Message("ncid = %d name = %s xtype = %d ndims = %d varid = %d",
ncid, name, xtype, ndims, *varidp); ncid, name, xtype, ndims, *varidp);
if ( status != NC_NOERR ) if ( status != NC_NOERR ) Error("%s", nc_strerror(status));
Error("%s", nc_strerror(status));
} }
......
...@@ -182,11 +182,11 @@ void gribSetValueCheck(int vcheck); ...@@ -182,11 +182,11 @@ void gribSetValueCheck(int vcheck);
void gribExSP(int *isec0, int *isec1, int *isec2, float *fsec2, int *isec3, void gribExSP(int *isec0, int *isec1, int *isec2, float *fsec2, int *isec3,
float *fsec3, int *isec4, float *fsec4, int klenp, int *kgrib, float *fsec3, int *isec4, float *fsec4, int klenp, int *kgrib,
int kleng, int *kword, char hoper, int *kret); int kleng, int *kword, char *hoper, int *kret);
void gribExDP(int *isec0, int *isec1, int *isec2, double *fsec2, int *isec3, void gribExDP(int *isec0, int *isec1, int *isec2, double *fsec2, int *isec3,
double *fsec3, int *isec4, double *fsec4, int klenp, int *kgrib, double *fsec3, int *isec4, double *fsec4, int klenp, int *kgrib,
int kleng, int *kword, char hoper, int *kret); int kleng, int *kword, char *hoper, int *kret);
const char *cgribexLibraryVersion(void); const char *cgribexLibraryVersion(void);
......
...@@ -24,8 +24,6 @@ ...@@ -24,8 +24,6 @@
#include "calendar.h" #include "calendar.h"
#include "timebase.h" #include "timebase.h"
#include "pio_util.h"
#ifndef _GRIB_INT_H #ifndef _GRIB_INT_H
#define _GRIB_INT_H #define _GRIB_INT_H
...@@ -117,7 +115,7 @@ ...@@ -117,7 +115,7 @@
double intpow2(int x); double intpow2(int x);
static int gribrec_len(int b1, int b2, int b3); int gribrec_len(int b1, int b2, int b3);
int correct_bdslen(int bdslen, long recsize, long gribpos); int correct_bdslen(int bdslen, long recsize, long gribpos);
/* CDI converter routines */ /* CDI converter routines */
...@@ -2803,9 +2801,9 @@ void gprintf(const char *caller, const char *fmt, ...) ...@@ -2803,9 +2801,9 @@ void gprintf(const char *caller, const char *fmt, ...)
void void
gribExDP(int *isec0, int *isec1, int *isec2, double *fsec2, int *isec3, gribExDP(int *isec0, int *isec1, int *isec2, double *fsec2, int *isec3,
double *fsec3, int *isec4, double *fsec4, int klenp, int *kgrib, double *fsec3, int *isec4, double *fsec4, int klenp, int *kgrib,
int kleng, int *kword, char hoper, int *kret) int kleng, int *kword, char *hoper, int *kret)
{ {
int yfunc = hoper; int yfunc = *hoper;
if ( yfunc == 'C' ) if ( yfunc == 'C' )
gribEncode(isec0, isec1, isec2, fsec2, isec3, gribEncode(isec0, isec1, isec2, fsec2, isec3,
...@@ -2828,13 +2826,13 @@ gribExDP(int *isec0, int *isec1, int *isec2, double *fsec2, int *isec3, ...@@ -2828,13 +2826,13 @@ gribExDP(int *isec0, int *isec1, int *isec2, double *fsec2, int *isec3,
void void
gribExSP(int *isec0, int *isec1, int *isec2, float *fsec2sp, int *isec3, gribExSP(int *isec0, int *isec1, int *isec2, float *fsec2sp, int *isec3,
float *fsec3sp, int *isec4, float *fsec4sp, int klenp, int *kgrib, float *fsec3sp, int *isec4, float *fsec4sp, int klenp, int *kgrib,
int kleng, int *kword, char hoper, int *kret) int kleng, int *kword, char *hoper, int *kret)
{ {
int inum, j; int inum, j;
double fsec2dp[1024]; double fsec2dp[1024];
double fsec3dp[2]; double fsec3dp[2];
double *fsec4dp = NULL; double *fsec4dp = NULL;
int yfunc = hoper; int yfunc = *hoper;
if ( yfunc == 'C' ) if ( yfunc == 'C' )
{ {
...@@ -2850,8 +2848,6 @@ gribExSP(int *isec0, int *isec1, int *isec2, float *fsec2sp, int *isec3, ...@@ -2850,8 +2848,6 @@ gribExSP(int *isec0, int *isec1, int *isec2, float *fsec2sp, int *isec3,
for ( j = 0; j < inum; j++ ) fsec4dp[j] = fsec4sp[j]; for ( j = 0; j < inum; j++ ) fsec4dp[j] = fsec4sp[j];
printf ( "########## %s, %s, %d\n", __FILE__, __func__, __LINE__ );
gribExDP(isec0, isec1, isec2, fsec2dp, isec3, gribExDP(isec0, isec1, isec2, fsec2dp, isec3,
fsec3dp, isec4, fsec4dp, klenp, kgrib, fsec3dp, isec4, fsec4dp, klenp, kgrib,
kleng, kword, hoper, kret); kleng, kword, hoper, kret);
...@@ -2866,8 +2862,6 @@ gribExSP(int *isec0, int *isec1, int *isec2, float *fsec2sp, int *isec3, ...@@ -2866,8 +2862,6 @@ gribExSP(int *isec0, int *isec1, int *isec2, float *fsec2sp, int *isec3,
for ( j = 0; j < 10; j++ ) fsec2dp[j] = 0.0; for ( j = 0; j < 10; j++ ) fsec2dp[j] = 0.0;
for ( j = 0; j < 2; j++ ) fsec3dp[j] = 0.0; for ( j = 0; j < 2; j++ ) fsec3dp[j] = 0.0;
printf ( "########## %s, %s, %d\n", __FILE__, __func__, __LINE__ );
gribExDP(isec0, isec1, isec2, fsec2dp, isec3, gribExDP(isec0, isec1, isec2, fsec2dp, isec3,
fsec3dp, isec4, fsec4dp, klenp, kgrib, fsec3dp, isec4, fsec4dp, klenp, kgrib,
kleng, kword, hoper, kret); kleng, kword, hoper, kret);
...@@ -4942,7 +4936,7 @@ void encodeBMS(GRIBPACK *lGrib, long *gribLen, double *fsec3, int *isec4, double ...@@ -4942,7 +4936,7 @@ void encodeBMS(GRIBPACK *lGrib, long *gribLen, double *fsec3, int *isec4, double
long bmsLen, bmsUnusedBits; long bmsLen, bmsUnusedBits;
long fsec4size; long fsec4size;
long z = *gribLen; long z = *gribLen;
#ifdef VECTORCODE #if defined (VECTORCODE)
unsigned int *imask; unsigned int *imask;
#endif #endif
static int lmissvalinfo = 1; static int lmissvalinfo = 1;
...@@ -6626,6 +6620,7 @@ int gribOpen(const char *filename, const char *mode) ...@@ -6626,6 +6620,7 @@ int gribOpen(const char *filename, const char *mode)
fileSetBufferType(fileID, FILE_BUFTYPE_MMAP); fileSetBufferType(fileID, FILE_BUFTYPE_MMAP);
} }
#endif #endif
return (fileID); return (fileID);
} }
...@@ -7063,7 +7058,7 @@ int gribWrite(int fileID, unsigned char *buffer, size_t buffersize) ...@@ -7063,7 +7058,7 @@ int gribWrite(int fileID, unsigned char *buffer, size_t buffersize)
} }
static int gribrec_len(int b1, int b2, int b3) int gribrec_len(int b1, int b2, int b3)
{ {
int gribsize; int gribsize;
......
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
#include "vlist.h" #include "vlist.h"
#include "stream_grb.h" #include "stream_grb.h"
#if defined (HAVE_LIBCGRIBEX) #if defined (HAVE_LIBCGRIBEX)
# include "cgribex.h" # include "cgribex.h"
#endif #endif
...@@ -501,7 +500,7 @@ void cgribexDecodeHeader(int *isec0, int *isec1, int *isec2, double *fsec2, ...@@ -501,7 +500,7 @@ void cgribexDecodeHeader(int *isec0, int *isec1, int *isec2, double *fsec2,
memset(isec1, 0, 256*sizeof(int)); memset(isec1, 0, 256*sizeof(int));
gribExDP(isec0, isec1, isec2, fsec2, isec3, fsec3, isec4, fsec4, gribExDP(isec0, isec1, isec2, fsec2, isec3, fsec3, isec4, fsec4,
ipunp, (int *) gribbuffer, recsize, &iword, 'J', iret); ipunp, (int *) gribbuffer, recsize, &iword, "J", iret);
*lmv = 0; *lmv = 0;
...@@ -1341,12 +1340,12 @@ int cgribexDecode(unsigned char *gribbuffer, int gribsize, double *data, int gri ...@@ -1341,12 +1340,12 @@ int cgribexDecode(unsigned char *gribbuffer, int gribsize, double *data, int gri
int izip; int izip;
long unzipsize; long unzipsize;
double fsec2[512], fsec3[2]; double fsec2[512], fsec3[2];
char hoper; char hoper[2];
*zip = 0; *zip = 0;
if ( unreduced ) hoper = 'R'; if ( unreduced ) strcpy(hoper, "R");
else hoper = 'D'; else strcpy(hoper, "D");
FSEC3_MissVal = missval; FSEC3_MissVal = missval;
...@@ -1388,7 +1387,6 @@ int cgribexDecode(unsigned char *gribbuffer, int gribsize, double *data, int gri ...@@ -1388,7 +1387,6 @@ int cgribexDecode(unsigned char *gribbuffer, int gribsize, double *data, int gri
} }
} }
gribExDP(isec0, isec1, isec2, fsec2, isec3, fsec3, isec4, data, gribExDP(isec0, isec1, isec2, fsec2, isec3, fsec3, isec4, data,
gridsize, (int *) gribbuffer, gribsize, &iword, hoper, &iret); gridsize, (int *) gribbuffer, gribsize, &iword, hoper, &iret);
...@@ -2261,7 +2259,7 @@ size_t cgribexEncode(int varID, int levelID, int vlistID, int gridID, int zaxisI ...@@ -2261,7 +2259,7 @@ size_t cgribexEncode(int varID, int levelID, int vlistID, int gridID, int zaxisI
//printf("isec4[16] %d\n", isec4[16]); //printf("isec4[16] %d\n", isec4[16]);
gribExDP(isec0, isec1, isec2, fsec2, isec3, fsec3, isec4, (double*) data, gribExDP(isec0, isec1, isec2, fsec2, isec3, fsec3, isec4, (double*) data,
datasize, (int *) gribbuffer, gribsize, &iword, 'C', &iret); datasize, (int *) gribbuffer, gribsize, &iword, "C", &iret);
if ( iret ) Error("Problem during GRIB encode (errno = %d)!", iret); if ( iret ) Error("Problem during GRIB encode (errno = %d)!", iret);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment