Commit 01db1cc0 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

add support for Lambert conformal grids

parent 7dd4659e
2007-12-?? Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* using GRIB library version 1.0.7
* add support for Lambert conformal grids
* Version 1.0.9 released
2007-10-22 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* using GRIB library version 1.0.6
......
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.59 for cdi 1.0.8.
# Generated by GNU Autoconf 2.59 for cdi 1.0.9.
#
# Report bugs to <Uwe.Schulzweida@zmaw.de>.
#
......@@ -269,8 +269,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
PACKAGE_NAME='cdi'
PACKAGE_TARNAME='cdi'
PACKAGE_VERSION='1.0.8'
PACKAGE_STRING='cdi 1.0.8'
PACKAGE_VERSION='1.0.9'
PACKAGE_STRING='cdi 1.0.9'
PACKAGE_BUGREPORT='Uwe.Schulzweida@zmaw.de'
# Factoring default headers for most tests.
......@@ -795,7 +795,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures cdi 1.0.8 to adapt to many kinds of systems.
\`configure' configures cdi 1.0.9 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
......@@ -862,7 +862,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of cdi 1.0.8:";;
short | recursive ) echo "Configuration of cdi 1.0.9:";;
esac
cat <<\_ACEOF
......@@ -996,7 +996,7 @@ fi
test -n "$ac_init_help" && exit 0
if $ac_init_version; then
cat <<\_ACEOF
cdi configure 1.0.8
cdi configure 1.0.9
generated by GNU Autoconf 2.59
Copyright (C) 2003 Free Software Foundation, Inc.
......@@ -1010,7 +1010,7 @@ cat >&5 <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by cdi $as_me 1.0.8, which was
It was created by cdi $as_me 1.0.9, which was
generated by GNU Autoconf 2.59. Invocation command line was
$ $0 $@
......@@ -1697,7 +1697,7 @@ fi
# Define the identity of the package.
PACKAGE=cdi
VERSION=1.0.8
VERSION=1.0.9
cat >>confdefs.h <<_ACEOF
......@@ -5821,7 +5821,7 @@ _ASBOX
} >&5
cat >&5 <<_CSEOF
This file was extended by cdi $as_me 1.0.8, which was
This file was extended by cdi $as_me 1.0.9, which was
generated by GNU Autoconf 2.59. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
......@@ -5884,7 +5884,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
cdi config.status 1.0.8
cdi config.status 1.0.9
configured by $0, generated by GNU Autoconf 2.59,
with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
......
# Process this file with autoconf to produce a configure script.
AC_INIT(cdi, 1.0.8, Uwe.Schulzweida@zmaw.de)
AC_INIT(cdi, 1.0.9, Uwe.Schulzweida@zmaw.de)
CONFIG_ABORT=yes
......
......@@ -91,6 +91,7 @@ extern "C" {
#define GRID_TRAJECTORY 8
#define GRID_CELL 9
#define GRID_CURVILINEAR 10
#define GRID_LAMBERT 11
/* ZAXIS types */
......
......@@ -33,6 +33,7 @@
#define GTYPE_GAUSSIAN_ROT 14 /* rotated gaussian grid */
#define GTYPE_GAUSSIAN_STR 24 /* stretched gaussian grid */
#define GTYPE_GAUSSIAN_ROTSTR 34 /* rotated and stretched gaussian grid */
#define GTYPE_LAMBERT 3 /* Lambert conformal */
#define GTYPE_SPECTRAL 50 /* spherical harmonics */
#define GTYPE_GME 192 /* hexagonal GME grid */
......@@ -120,6 +121,14 @@
#define ISEC2_ScanFlag (isec2[10]) /* Scanning mode flags */
#define ISEC2_NumVCP (isec2[11]) /* Number of vertical coordinate parameters */
/* Lambert */
#define ISEC2_LoV (isec2[ 6]) /* Orientation of the grid */
#define ISEC2_Xinc (isec2[ 8]) /* X-direction grid length */
#define ISEC2_Yinc (isec2[ 9]) /* Y-direction grid length */
#define ISEC2_LatS1 (isec2[13]) /* First lat at which the secant cone cuts the sphere */
#define ISEC2_LatS2 (isec2[14]) /* Second lat at which the secant cone cuts the sphere */
#define ISEC2_Reduced (isec2[16]) /* 0: regular, 1: reduced grid */
#define ISEC2_RowLonPtr (&isec2[22])
......
/* Generated automatically from m214003 on Tue Jul 31 09:15:55 CEST 2007 */
/* Generated automatically from m214003 on Wed Oct 24 15:20:09 CEST 2007 */
/* GRIBLIB_VERSION="1.0.6" */
/* GRIBLIB_VERSION="1.0.7" */
#if defined (HAVE_CONFIG_H)
# include "config.h"
......@@ -213,6 +213,13 @@ void gribDecode(int *isec0, int *isec1, int *isec2, double *fsec2, int *isec3,
#define GDS_LonSP GET_INT3(gds[35], gds[36], gds[37])
#define GDS_RotAngle GET_Real(&(gds[38]))
/* Lambert */
#define GDS_LoV GET_INT3(gds[17], gds[18], gds[19])
#define GDS_Xinc GET_INT3(gds[20], gds[21], gds[22])
#define GDS_Yinc GET_INT3(gds[23], gds[24], gds[25])
#define GDS_LatS1 GET_INT3(gds[28], gds[29], gds[30])
#define GDS_LatS2 GET_INT3(gds[31], gds[32], gds[33])
/* Section 3: Bit Map Section (BMS) */
#define BMS_Len ((bms) == NULL ? 0 : (int) (bms[0]<<16)+(bms[1]<<8)+bms[2])
......@@ -2920,6 +2927,7 @@ void encodePDS(GRIBPACK *lpds, int pdsLen, int *isec1)
void encodeGDS(GRIBPACK *lGrib, int *gribLen, int *isec2, double *fsec2)
{
static char func[] = "encodeGDS";
int z = *gribLen;
int exponent, mantissa;
int i;
......@@ -2927,6 +2935,8 @@ void encodeGDS(GRIBPACK *lGrib, int *gribLen, int *isec2, double *fsec2)
int pvoffset = 255;
int gdslen = 32;
if ( ISEC2_GridType == GTYPE_LAMBERT ) gdslen += 10;
if ( ISEC2_GridType == GTYPE_LATLON_ROT ) gdslen += 10;
if ( ISEC2_NumVCP || ISEC2_Reduced ) pvoffset = gdslen + 1;
......@@ -2962,7 +2972,26 @@ void encodeGDS(GRIBPACK *lGrib, int *gribLen, int *isec2, double *fsec2)
Put1Byte(ISEC2_GME_BFlag);
PutnZero(5);
}
else
else if ( ISEC2_GridType == GTYPE_LAMBERT )
{
Put2Byte(ISEC2_NumLon); /* 6- 7 Longitudes */
Put2Byte(ISEC2_NumLat); /* 8- 9 Latitudes */
Put3Int(ISEC2_FirstLat);
Put3Int(ISEC2_FirstLon);
Put1Byte(ISEC2_ResFlag); /* 16 Resolution flag */
Put3Int(ISEC2_LoV); /* 17-19 */
Put3Int(ISEC2_Xinc); /* 20-22 */
Put3Int(ISEC2_Yinc); /* 23-25 */
PutnZero(1);
Put1Byte(ISEC2_ScanFlag); /* 27 Scanning mode */
Put3Int(ISEC2_LatS1); /* 28-30 */
Put3Int(ISEC2_LatS2); /* 31-33 */
PutnZero(8); /* 34-41 */
}
else if ( ISEC2_GridType == GTYPE_LATLON ||
ISEC2_GridType == GTYPE_GAUSSIAN ||
ISEC2_GridType == GTYPE_LATLON_ROT )
{
Put2Byte(ISEC2_NumLon); /* 6- 7 Longitudes */
......@@ -2988,6 +3017,10 @@ void encodeGDS(GRIBPACK *lGrib, int *gribLen, int *isec2, double *fsec2)
Put1Real(FSEC2_RotAngle);
}
}
else
{
Error(func, "Unsupported grid type %d", ISEC2_GridType);
}
#if defined (SX)
#pragma vdir novector /* vectorization gives wrong results on NEC */
......@@ -4030,6 +4063,20 @@ static int decodeGDS(unsigned char *gds, int *isec0, int *isec2, double *fsec2,
iret = decodeGDS_LL(gds, gdspos, isec0, isec2, imisng);
*/
}
else if ( ISEC2_GridType == GTYPE_LAMBERT )
{
ISEC2_NumLon = GDS_NumLon;
ISEC2_NumLat = GDS_NumLat;
ISEC2_FirstLat = GDS_FirstLat;
ISEC2_FirstLon = GDS_FirstLon;
ISEC2_ResFlag = GDS_ResFlag;
ISEC2_LoV = GDS_LoV;
ISEC2_Xinc = GDS_Xinc;
ISEC2_Yinc = GDS_Yinc;
ISEC2_LatS1 = GDS_LatS1;
ISEC2_LatS2 = GDS_LatS2;
ISEC2_ScanFlag = GDS_ScanFlag;
}
else if ( ISEC2_GridType == GTYPE_SPECTRAL )
{
ISEC2_PentaJ = GDS_PentaJ; /* Truncation */
......@@ -8049,7 +8096,7 @@ int gribUnzip(unsigned char *dbuf, long dbufsize, unsigned char *sbuf, long sbu
return (gribLen);
}
static const char grb_libvers[] = "1.0.6" " of ""Jul 31 2007"" ""09:15:56";
static const char grb_libvers[] = "1.0.7" " of ""Oct 24 2007"" ""15:20:10";
......
......@@ -32,6 +32,7 @@ char *Grids[] = {
"trajectory",
"cell",
"curvilinear",
"lambert",
};
......@@ -181,6 +182,9 @@ static void grid_init_entry(GRID *gridptr)
gridptr->nrowlon = 0;
gridptr->xinc = 0.0;
gridptr->yinc = 0.0;
gridptr->lov = 0.0;
gridptr->lats1 = 0.0;
gridptr->lats2 = 0.0;
gridptr->trunc = 0;
gridptr->nvertex = 0;
gridptr->nd = 0;
......@@ -2280,6 +2284,7 @@ int gridGenerate(GRID grid)
case GRID_CELL:
case GRID_CURVILINEAR:
case GRID_GENERIC:
case GRID_LAMBERT:
{
if ( grid.xsize > 0 ) gridDefXsize(gridID, grid.xsize);
if ( grid.ysize > 0 ) gridDefYsize(gridID, grid.ysize);
......
......@@ -15,6 +15,7 @@ typedef struct {
double xfirst, yfirst;
double xlast, ylast;
double xinc, yinc;
double lov, lats1, lats2; /* lambert grid */
double xpole, ypole, angle; /* rotated north pole */
int isCyclic; /* TRUE for global cyclic grids */
int isRotated; /* TRUE for rotated grids */
......
......@@ -48,6 +48,11 @@ int gribGetGridType(int *isec2)
gridtype = GRID_LONLAT;
break;
}
case 3:
{
gridtype = GRID_LAMBERT;
break;
}
case 4:
{
if ( ISEC2_Reduced )
......@@ -166,10 +171,8 @@ int grbInqRecord(int streamID, int *varID, int *levelID)
break;
}
case GRID_SPECTRAL:
{
break;
}
case GRID_GME:
case GRID_LAMBERT:
{
break;
}
......@@ -835,6 +838,29 @@ void grbAddRecord(int streamID, int code, int *isec1, int *isec2, double *fsec2,
}
break;
}
case GRID_LAMBERT:
{
if ( ISEC4_NumValues != ISEC2_NumLon*ISEC2_NumLat )
Error(func, "wrong datasize! isec4len = %d isec2len = %d",
ISEC4_NumValues, ISEC2_NumLon*ISEC2_NumLat);
grid.size = ISEC4_NumValues;
grid.xsize = ISEC2_NumLon;
grid.ysize = ISEC2_NumLat;
grid.xinc = ISEC2_Xinc;
grid.yinc = ISEC2_Yinc;
grid.xfirst = ISEC2_FirstLon * 0.001;
grid.xdef = 0;
grid.yfirst = ISEC2_FirstLat * 0.001;
grid.ydef = 0;
grid.lov = ISEC2_LoV * 0.001;
grid.lats1 = ISEC2_LatS1 * 0.001;
grid.lats2 = ISEC2_LatS2 * 0.001;
break;
}
case GRID_SPECTRAL:
{
grid.size = ISEC4_NumValues;
......
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