Commit 23e31b77 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Added function cdiInqGridMissval().

parent b9dd2171
......@@ -3,6 +3,10 @@
* using EXSE library version 1.4.1
* Version 1.9.6 released
2018-09-17 Uwe Schulzweida
* Added function cdiInqGridMissval()
2018-09-13 Uwe Schulzweida
* Added support for polar stereographic projection
......
......@@ -279,6 +279,7 @@ int cdiHaveFiletype(int filetype);
void cdiDefMissval(double missval);
double cdiInqMissval(void);
double cdiInqGridMissval(void);
void cdiDefGlobal(const char *string, int val);
int namespaceNew(void);
......
......@@ -43,6 +43,7 @@ char *cdiPartabPath = NULL;
int cdiPartabIntern = 1;
double cdiDefaultMissval = -9.E33;
double CDI_grid_missval = -9999.;
static const char Filetypes[][9] = {
"UNKNOWN",
......@@ -501,6 +502,14 @@ double cdiInqMissval(void)
return cdiDefaultMissval;
}
double cdiInqGridMissval(void)
{
cdiInitialize();
return cdiDefaultMissval;
}
/*
* Local Variables:
* c-file-style: "Java"
......
......@@ -326,6 +326,7 @@ extern int CDI_Debug; /* If set to 1, debuggig (default 0) */
extern int CDI_Recopt;
extern int cdiGribApiDebug;
extern double cdiDefaultMissval;
extern double CDI_grid_missval;
extern int cdiDefaultInstID;
extern int cdiDefaultModelID;
extern int cdiDefaultTableID;
......
#ifdef HAVE_CONFIG_H
# include "config.h"
#include "config.h"
#endif
#include <assert.h>
......@@ -18,7 +18,6 @@
#include "serialize.h"
#include "vlist.h"
double grid_missval = -9999.;
int (*proj_lonlat_to_lcc_func)() = NULL;
int (*proj_lcc_to_lonlat_func)() = NULL;
int (*proj_lonlat_to_stere_func)() = NULL;
......
......@@ -6,7 +6,6 @@
#include "cdi_att.h"
extern double grid_missval;
extern int (*proj_lonlat_to_lcc_func)();
extern int (*proj_lcc_to_lonlat_func)();
extern int (*proj_lonlat_to_stere_func)();
......
......@@ -413,17 +413,17 @@ void cgribexAddRecord(stream_t * streamptr, int param, int *isec1, int *isec2, d
if ( lsouth ) { lat_1 = -lat_1; lat_2 = -lat_2; }
double lat_0 = lat_2;
double x_0 = grid_missval;
double y_0 = grid_missval;
double x_0 = CDI_grid_missval;
double y_0 = CDI_grid_missval;
if ( proj_lonlat_to_lcc_func )
{
x_0 = xval_0; y_0 = yval_0;
proj_lonlat_to_lcc_func(grid_missval, lon_0, lat_0, lat_1, lat_2, a, rf, (size_t)1, &x_0, &y_0);
if ( IS_NOT_EQUAL(x_0, grid_missval) && IS_NOT_EQUAL(y_0, grid_missval) )
proj_lonlat_to_lcc_func(CDI_grid_missval, lon_0, lat_0, lat_1, lat_2, a, rf, (size_t)1, &x_0, &y_0);
if ( IS_NOT_EQUAL(x_0, CDI_grid_missval) && IS_NOT_EQUAL(y_0, CDI_grid_missval) )
{ x_0 = -x_0; y_0 = -y_0; }
}
gridDefParamLCC(gridID, grid_missval, lon_0, lat_0, lat_1, lat_2, a, rf, xval_0, yval_0, x_0, y_0);
gridDefParamLCC(gridID, CDI_grid_missval, lon_0, lat_0, lat_1, lat_2, a, rf, xval_0, yval_0, x_0, y_0);
}
}
else
......@@ -1710,8 +1710,8 @@ void cgribexDefGridLambert(int *isec2, int gridID)
int ysize = (int)gridInqYsize(gridID);
double lon_0, lat_0, lat_1, lat_2, a, rf, xval_0, yval_0, x_0, y_0;
gridInqParamLCC(gridID, grid_missval, &lon_0, &lat_0, &lat_1, &lat_2, &a, &rf, &xval_0, &yval_0, &x_0, &y_0);
gridVerifyGribParamLCC(grid_missval, &lon_0, &lat_0, &lat_1, &lat_2, &a, &rf, &xval_0, &yval_0, &x_0, &y_0);
gridInqParamLCC(gridID, CDI_grid_missval, &lon_0, &lat_0, &lat_1, &lat_2, &a, &rf, &xval_0, &yval_0, &x_0, &y_0);
gridVerifyGribParamLCC(CDI_grid_missval, &lon_0, &lat_0, &lat_1, &lat_2, &a, &rf, &xval_0, &yval_0, &x_0, &y_0);
bool lsouth = (lat_1 < 0);
if ( lsouth ) { lat_1 = -lat_2; lat_2 = -lat_2; }
......
......@@ -529,18 +529,18 @@ void gribapiDefProjLCC(grib_handle *gh, int gridID)
if ( lsouth ) { lat_1 = -lat_1; lat_2 = -lat_2; }
double lat_0 = lat_2;
double x_0 = grid_missval;
double y_0 = grid_missval;
double x_0 = CDI_grid_missval;
double y_0 = CDI_grid_missval;
if ( proj_lonlat_to_lcc_func )
{
x_0 = xval_0; y_0 = yval_0;
proj_lonlat_to_lcc_func(grid_missval, lon_0, lat_0, lat_1, lat_2, a, rf, (size_t)1, &x_0, &y_0);
if ( IS_NOT_EQUAL(x_0, grid_missval) && IS_NOT_EQUAL(y_0, grid_missval) )
proj_lonlat_to_lcc_func(CDI_grid_missval, lon_0, lat_0, lat_1, lat_2, a, rf, (size_t)1, &x_0, &y_0);
if ( IS_NOT_EQUAL(x_0, CDI_grid_missval) && IS_NOT_EQUAL(y_0, CDI_grid_missval) )
{ x_0 = -x_0; y_0 = -y_0; }
}
gridDefParamLCC(gridID, grid_missval, lon_0, lat_0, lat_1, lat_2, a, rf, xval_0, yval_0, x_0, y_0);
gridDefParamLCC(gridID, CDI_grid_missval, lon_0, lat_0, lat_1, lat_2, a, rf, xval_0, yval_0, x_0, y_0);
}
......@@ -561,18 +561,18 @@ void gribapiDefProjSTERE(grib_handle *gh, int gridID)
grib_get_long(gh, "southPoleOnProjectionPlane", &southPoleOnProjectionPlane);
double lat_0 = southPoleOnProjectionPlane ? -90 : 90;
double x_0 = grid_missval;
double y_0 = grid_missval;
double x_0 = CDI_grid_missval;
double y_0 = CDI_grid_missval;
if ( proj_lonlat_to_stere_func )
{
x_0 = xval_0; y_0 = yval_0;
proj_lonlat_to_stere_func(grid_missval, lon_0, lat_ts, lat_0, a, (size_t)1, &x_0, &y_0);
if ( IS_NOT_EQUAL(x_0, grid_missval) && IS_NOT_EQUAL(y_0, grid_missval) )
proj_lonlat_to_stere_func(CDI_grid_missval, lon_0, lat_ts, lat_0, a, (size_t)1, &x_0, &y_0);
if ( IS_NOT_EQUAL(x_0, CDI_grid_missval) && IS_NOT_EQUAL(y_0, CDI_grid_missval) )
{ x_0 = -x_0; y_0 = -y_0; }
}
gridDefParamSTERE(gridID, grid_missval, lon_0, lat_ts, lat_0, a, xval_0, yval_0, x_0, y_0);
gridDefParamSTERE(gridID, CDI_grid_missval, lon_0, lat_ts, lat_0, a, xval_0, yval_0, x_0, y_0);
}
static
......@@ -2085,8 +2085,8 @@ void gribapiDefGridLCC(grib_handle *gh, int editionNumber, int gridID)
long ysize = (long) gridInqYsize(gridID);
double lon_0, lat_0, lat_1, lat_2, a, rf, xval_0, yval_0, x_0, y_0;
gridInqParamLCC(gridID, grid_missval, &lon_0, &lat_0, &lat_1, &lat_2, &a, &rf, &xval_0, &yval_0, &x_0, &y_0);
gridVerifyGribParamLCC(grid_missval, &lon_0, &lat_0, &lat_1, &lat_2, &a, &rf, &xval_0, &yval_0, &x_0, &y_0);
gridInqParamLCC(gridID, CDI_grid_missval, &lon_0, &lat_0, &lat_1, &lat_2, &a, &rf, &xval_0, &yval_0, &x_0, &y_0);
gridVerifyGribParamLCC(CDI_grid_missval, &lon_0, &lat_0, &lat_1, &lat_2, &a, &rf, &xval_0, &yval_0, &x_0, &y_0);
if ( xval_0 < 0 ) xval_0 += 360;
bool lsouth = (lat_1 < 0);
if ( lsouth ) { lat_1 = -lat_2; lat_2 = -lat_2; }
......@@ -2129,8 +2129,8 @@ void gribapiDefGridSTERE(grib_handle *gh, int editionNumber, int gridID)
long ysize = (long) gridInqYsize(gridID);
double lon_0, lat_ts, lat_0, a, xval_0, yval_0, x_0, y_0;
gridInqParamSTERE(gridID, grid_missval, &lon_0, &lat_ts, &lat_0, &a, &xval_0, &yval_0, &x_0, &y_0);
gridVerifyGribParamSTERE(grid_missval, &lon_0, &lat_ts, &lat_0, &a, &xval_0, &yval_0, &x_0, &y_0);
gridInqParamSTERE(gridID, CDI_grid_missval, &lon_0, &lat_ts, &lat_0, &a, &xval_0, &yval_0, &x_0, &y_0);
gridVerifyGribParamSTERE(CDI_grid_missval, &lon_0, &lat_ts, &lat_0, &a, &xval_0, &yval_0, &x_0, &y_0);
if ( xval_0 < 0 ) xval_0 += 360;
int projflag = 0;
......
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