Commit e124a50f authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

gribapiDefLevel: changed grib_set_double() to grib_set_long() for key numberOfVGridUsed and nlev

parent c7ee60e9
......@@ -1973,13 +1973,6 @@ module mo_cdi
end subroutine gridDefGMEni3
end interface
interface
integer(c_int) function gridInqNumber(gridID) bind(c,name='gridInqNumber')
import :: c_int
integer(c_int), value :: gridID
end function gridInqNumber
end interface
interface
subroutine gridDefNumber(gridID,number) bind(c,name='gridDefNumber')
import :: c_int
......@@ -1989,10 +1982,10 @@ module mo_cdi
end interface
interface
integer(c_int) function gridInqPosition(gridID) bind(c,name='gridInqPosition')
integer(c_int) function gridInqNumber(gridID) bind(c,name='gridInqNumber')
import :: c_int
integer(c_int), value :: gridID
end function gridInqPosition
end function gridInqNumber
end interface
interface
......@@ -2004,11 +1997,10 @@ module mo_cdi
end interface
interface
integer(c_int) function gridInqReference(gridID,reference) bind(c,name='gridInqReference')
import :: c_int,c_char
integer(c_int) function gridInqPosition(gridID) bind(c,name='gridInqPosition')
import :: c_int
integer(c_int), value :: gridID
character(c_char), dimension(*) :: reference
end function gridInqReference
end function gridInqPosition
end interface
interface
......@@ -2020,11 +2012,11 @@ module mo_cdi
end interface
interface
character(c_char) function gridInqUUID(gridID,uuid_cbuf) bind(c,name='gridInqUUID')
integer(c_int) function gridInqReference(gridID,reference) bind(c,name='gridInqReference')
import :: c_int,c_char
integer(c_int), value :: gridID
character(c_char), dimension(*) :: uuid_cbuf
end function gridInqUUID
character(c_char), dimension(*) :: reference
end function gridInqReference
end interface
interface
......@@ -2035,6 +2027,14 @@ module mo_cdi
end subroutine gridDefUUID
end interface
interface
character(c_char) function gridInqUUID(gridID,uuid_cbuf) bind(c,name='gridInqUUID')
import :: c_int,c_char
integer(c_int), value :: gridID
character(c_char), dimension(*) :: uuid_cbuf
end function gridInqUUID
end interface
interface
subroutine gridDefLCC(gridID,originLon,originLat,lonParY,lat1,lat2,xinc,yinc,projflag,scanflag) bind(c,name='gridDefLCC')
import :: c_int,c_double
......@@ -2314,11 +2314,18 @@ module mo_cdi
end interface
interface
subroutine zaxisDefReference(zaxisID,refID) bind(c,name='zaxisDefReference')
subroutine zaxisDefNumber(gridID,number) bind(c,name='zaxisDefNumber')
import :: c_int
integer(c_int), value :: zaxisID
integer(c_int), value :: refID
end subroutine zaxisDefReference
integer(c_int), value :: gridID
integer(c_int), value :: number
end subroutine zaxisDefNumber
end interface
interface
integer(c_int) function zaxisInqNumber(gridID) bind(c,name='zaxisInqNumber')
import :: c_int
integer(c_int), value :: gridID
end function zaxisInqNumber
end interface
interface
......@@ -2337,13 +2344,6 @@ module mo_cdi
end function zaxisInqUUID
end interface
interface
integer(c_int) function zaxisInqReference(zaxisID) bind(c,name='zaxisInqReference')
import :: c_int
integer(c_int), value :: zaxisID
end function zaxisInqReference
end interface
interface
subroutine zaxisDefName(zaxisID,name) bind(c,name='zaxisDefName')
import :: c_int,c_char
......@@ -3248,14 +3248,14 @@ module mo_cdi
public :: gridDefGMEni2
public :: gridInqGMEni3
public :: gridDefGMEni3
public :: gridInqNumber
public :: gridDefNumber
public :: gridInqPosition
public :: gridInqNumber
public :: gridDefPosition
public :: gridInqReference
public :: gridInqPosition
public :: gridDefReference
public :: gridInqUUID
public :: gridInqReference
public :: gridDefUUID
public :: gridInqUUID
public :: gridDefLCC
public :: gridInqLCC
public :: gridDefLcc2
......@@ -3288,10 +3288,10 @@ module mo_cdi
public :: zaxisInqLevels
public :: zaxisDefLevel
public :: zaxisInqLevel
public :: zaxisDefReference
public :: zaxisDefNumber
public :: zaxisInqNumber
public :: zaxisDefUUID
public :: zaxisInqUUID
public :: zaxisInqReference
public :: zaxisDefName
public :: zaxisDefLongname
public :: zaxisDefUnits
......
......@@ -866,7 +866,7 @@ void gribapiAddRecord(stream_t * streamptr, int param, grib_handle *gh,
{
size_t len;
char uuid[17];
double dtmp;
long ltmp;
long nlev, nvgrid;
GRIB_CHECK(grib_get_long(gh, "NV", &lpar), 0);
......@@ -874,10 +874,10 @@ void gribapiAddRecord(stream_t * streamptr, int param, grib_handle *gh,
{
fprintf(stderr, "Warning ...\n");
}
GRIB_CHECK(grib_get_double(gh, "nlev", &dtmp), 0);
nlev = (int) NINT(dtmp);
GRIB_CHECK(grib_get_double(gh, "numberOfVGridUsed", &dtmp), 0);
nvgrid = NINT(dtmp);
GRIB_CHECK(grib_get_long(gh, "nlev", &ltmp), 0);
nlev = ltmp;
GRIB_CHECK(grib_get_long(gh, "numberOfVGridUsed", &ltmp), 0);
nvgrid = ltmp;
len = (size_t) 16;
uuid[16] = 0;
GRIB_CHECK(grib_get_bytes(gh, "uuidOfVGrid", (unsigned char *) uuid, &len), 0);
......@@ -2634,7 +2634,6 @@ void gribapiDefLevel(int editionNumber, grib_handle *gh, int param, int zaxisID,
int lbounds = 0;
int zaxistype, ltype;
static int warning = 1;
int reference;
char uuid[17];
size_t len;
double scalefactor;
......@@ -2842,6 +2841,8 @@ void gribapiDefLevel(int editionNumber, grib_handle *gh, int param, int zaxisID,
}
case ZAXIS_REFERENCE:
{
int number;
if ( !gcinit )
{
GRIB_CHECK(grib_set_long(gh, "genVertHeightCoords", 1), 0);
......@@ -2853,12 +2854,12 @@ void gribapiDefLevel(int editionNumber, grib_handle *gh, int param, int zaxisID,
; // not available
else
{
reference = zaxisInqReference(zaxisID);
number = zaxisInqNumber(zaxisID);
gribapiDefLevelType(gh, gcinit, "typeOfFirstFixedSurface", GRIB2_LTYPE_REFERENCE);
gribapiDefLevelType(gh, gcinit, "typeOfSecondFixedSurface", GRIB2_LTYPE_REFERENCE);
GRIB_CHECK(grib_set_long(gh, "NV", 6), 0);
GRIB_CHECK(grib_set_double(gh, "nlev", (double) zaxisInqSize(zaxisID)+1), 0);
GRIB_CHECK(grib_set_double(gh, "numberOfVGridUsed", (double) reference), 0);
GRIB_CHECK(grib_set_long(gh, "nlev", zaxisInqSize(zaxisID)+1), 0);
GRIB_CHECK(grib_set_long(gh, "numberOfVGridUsed", number), 0);
len = 16;
if (grib_set_bytes(gh, "uuidOfVGrid", (unsigned char *) zaxisInqUUID(zaxisID, uuid), &len) != 0)
Warning("Can't write UUID!");
......@@ -2872,11 +2873,11 @@ void gribapiDefLevel(int editionNumber, grib_handle *gh, int param, int zaxisID,
; // not available
else
{
reference = zaxisInqReference(zaxisID);
number = zaxisInqNumber(zaxisID);
gribapiDefLevelType(gh, gcinit, "typeOfFirstFixedSurface", GRIB2_LTYPE_REFERENCE);
GRIB_CHECK(grib_set_long(gh, "NV", 6), 0);
GRIB_CHECK(grib_set_double(gh, "nlev", (double) zaxisInqSize(zaxisID)), 0);
GRIB_CHECK(grib_set_double(gh, "numberOfVGridUsed", (double) reference), 0);
GRIB_CHECK(grib_set_long(gh, "nlev", zaxisInqSize(zaxisID)), 0);
GRIB_CHECK(grib_set_long(gh, "numberOfVGridUsed", number), 0);
len = 16;
if (grib_set_bytes(gh, "uuidOfVGrid", (unsigned char *) zaxisInqUUID(zaxisID, uuid), &len) != 0)
Warning("Can't write UUID!");
......
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