Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mpim-sw
libcdi
Commits
906a6d08
Commit
906a6d08
authored
Apr 10, 2017
by
Uwe Schulzweida
Browse files
gridInqParamLCC: refactor interface.
parent
3f3ac7a3
Changes
7
Hide whitespace changes
Inline
Side-by-side
src/cdi.h
View file @
906a6d08
...
...
@@ -933,7 +933,7 @@ void gridInqParamGME(int gridID, int *nd, int *ni, int *ni2, int *ni3);
/* Lambert Conformal Conic grid (GRIB version) */
void
gridDefParamLCC
(
int
gridID
,
double
a
,
double
rf
,
double
xval_0
,
double
yval_0
,
double
lon_0
,
double
lat_1
,
double
lat_2
);
void
gridInqParamLCC
(
int
gridID
,
double
*
a
,
double
*
rf
,
double
*
xval
_0
,
double
*
yval_0
,
double
*
lon
_0
,
double
*
lat_1
,
double
*
lat_2
);
int
gridInqParamLCC
(
int
gridID
,
double
missval
,
double
*
lon_0
,
double
*
lat
_0
,
double
*
lat_1
,
double
*
lat_2
,
double
*
a
,
double
*
rf
,
double
*
xval
_0
,
double
*
yval_0
,
double
*
x_0
,
double
*
y_0
);
void
gridDefArea
(
int
gridID
,
const
double
area
[]);
void
gridInqArea
(
int
gridID
,
double
area
[]);
...
...
src/cdi.inc
View file @
906a6d08
...
...
@@ -1855,15 +1855,19 @@
!
DOUBLEPRECISION
lat_2
)
EXTERNAL
gridDefParamLCC
!
gridInqParamLCC
INTEGER
gridInqParamLCC
!
(
INTEGER
gridID
,
!
DOUBLEPRECISION
missval
,
!
DOUBLEPRECISION
lon_0
,
!
DOUBLEPRECISION
lat_0
,
!
DOUBLEPRECISION
lat_1
,
!
DOUBLEPRECISION
lat_2
,
!
DOUBLEPRECISION
a
,
!
DOUBLEPRECISION
rf
,
!
DOUBLEPRECISION
xval_0
,
!
DOUBLEPRECISION
yval_0
,
!
DOUBLEPRECISION
lon_0
,
!
DOUBLEPRECISION
lat_1
,
!
DOUBLEPRECISION
lat_2
)
!
DOUBLEPRECISION
x_0
,
!
DOUBLEPRECISION
y_0
)
EXTERNAL
gridInqParamLCC
!
gridDefArea
...
...
src/cdiFortran.c
View file @
906a6d08
...
...
@@ -398,7 +398,7 @@ FCALLSCSUB5 (gridInqParamGME, GRIDINQPARAMGME, gridinqparamgme, INT, PINT, PINT,
/* Lambert Conformal Conic grid (GRIB version) */
FCALLSCSUB8
(
gridDefParamLCC
,
GRIDDEFPARAMLCC
,
griddefparamlcc
,
INT
,
DOUBLE
,
DOUBLE
,
DOUBLE
,
DOUBLE
,
DOUBLE
,
DOUBLE
,
DOUBLE
)
FCALLSC
SUB8
(
gridInqParamLCC
,
GRIDINQPARAMLCC
,
gridinqparamlcc
,
INT
,
PDOUBLE
,
PDOUBLE
,
PDOUBLE
,
PDOUBLE
,
PDOUBLE
,
PDOUBLE
,
PDOUBLE
)
FCALLSC
FUN12
(
INT
,
gridInqParamLCC
,
GRIDINQPARAMLCC
,
gridinqparamlcc
,
INT
,
DOUBLE
,
PDOUBLE
,
PDOUBLE
,
PDOUBLE
,
PDOUBLE
,
PDOUBLE
,
PDOUBLE
,
PDOUBLE
,
PDOUBLE
,
PDOUBLE
,
PDOUBLE
)
FCALLSCSUB2
(
gridDefArea
,
GRIDDEFAREA
,
griddefarea
,
INT
,
DOUBLEV
)
FCALLSCSUB2
(
gridInqArea
,
GRIDINQAREA
,
gridinqarea
,
INT
,
DOUBLEV
)
FCALLSCFUN1
(
INT
,
gridHasArea
,
GRIDHASAREA
,
gridhasarea
,
INT
)
...
...
src/grid.c
View file @
906a6d08
...
...
@@ -20,6 +20,7 @@
#include
"serialize.h"
#include
"vlist.h"
double
grid_missval
=
-
9999
.;
/* the value in the second pair of brackets must match the length of
* the longest string (including terminating NUL) */
...
...
@@ -3634,30 +3635,37 @@ void gridDefParamLCC(int gridID, double a, double rf, double xval_0, double yval
@Function gridInqParamLCC
@Title Get the parameter of a Lambert Conformal Conic grid
@Prototype void gridInqParamLCC(int gridID, double
*a
, double *
rf
, double *
xval
_0, double *
yval_0, double *lon
_0, double *
lat_1
, double *
lat_2
)
@Prototype void gridInqParamLCC(int gridID, double
missval
, double *
lon_0
, double *
lat
_0, double *
lat_1, double *lat_2, double *a, double *rf, double *xval
_0, double *
yval_0
, double *
x_0, double *y_0
)
@Parameter
@Item gridID Grid ID, from a previous call to @fref{gridCreate} or @fref{vlistInqVarGrid}.
@Item a Earth radius.
@Item rf Inverse flattening
@Item xval_0 Longitude of the first grid point.
@Item yval_0 Latitude of the first grid point.
@Item missval Missing value
@Item lon_0 The East longitude of the meridian which is parallel to the Y-axis.
@Item lat_0 Latitude of the projection origin
@Item lat_1 First latitude from the pole at which the secant cone cuts the sphere.
@Item lat_2 Second latitude at which the secant cone cuts the sphere.
@Item a Earth radius in metres (optional).
@Item rf Inverse flattening (1/f) (optional).
@Item xval_0 Longitude of the first grid point in degree (optional).
@Item yval_0 Latitude of the first grid point in degree (optional).
@Item x_0 False easting (optional).
@Item y_0 False northing (optional).
@Description
The function @func{gridInqParamLCC} returns the parameter of a Lambert Conformal Conic grid.
@EndFunction
*/
void
gridInqParamLCC
(
int
gridID
,
double
*
a
,
double
*
rf
,
double
*
xval
_0
,
double
*
yval_0
,
double
*
l
on_0
,
double
*
lat_1
,
double
*
lat_2
)
int
gridInqParamLCC
(
int
gridID
,
double
missval
,
double
*
lon_0
,
double
*
lat
_0
,
double
*
lat_1
,
double
*
l
at_2
,
double
*
a
,
double
*
rf
,
double
*
xval_0
,
double
*
yval_0
,
double
*
x_0
,
double
*
y_0
)
{
double
x_0
,
y_0
,
lat_0
;
int
status
=
-
1
;
if
(
gridInqType
(
gridID
)
!=
GRID_PROJECTION
)
return
status
;
*
a
=
0
;
*
rf
=
0
;
*
xval
_0
=
0
;
*
yval_0
=
0
;
*
lon_0
=
0
;
*
lat_1
=
0
;
*
lat_2
=
0
;
*
lon
_0
=
missval
;
*
lat_0
=
missval
,
*
lat_1
=
missval
,
*
lat_2
=
missval
;
*
xval_0
=
missval
;
*
yval_0
=
missval
;
*
x_0
=
missval
,
*
y_0
=
missval
;
status
=
-
2
;
const
char
*
projection
=
"lambert_conformal_conic"
;
char
mapname
[
CDI_MAX_NAME
];
mapname
[
0
]
=
0
;
cdiGridInqKeyStr
(
gridID
,
CDI_KEY_MAPNAME
,
CDI_MAX_NAME
,
mapname
);
...
...
@@ -3669,6 +3677,8 @@ void gridInqParamLCC(int gridID, double *a, double *rf, double *xval_0, double *
int
natts
;
cdiInqNatts
(
gridID
,
CDI_GLOBAL
,
&
natts
);
if
(
natts
)
status
=
0
;
for
(
int
iatt
=
0
;
iatt
<
natts
;
++
iatt
)
{
cdiInqAtt
(
gridID
,
CDI_GLOBAL
,
iatt
,
attname
,
&
atttype
,
&
attlen
);
...
...
@@ -3680,9 +3690,9 @@ void gridInqParamLCC(int gridID, double *a, double *rf, double *xval_0, double *
if
(
strcmp
(
attname
,
"earth_radius"
)
==
0
)
*
a
=
attflt
[
0
];
else
if
(
strcmp
(
attname
,
"inverse_flattening"
)
==
0
)
*
rf
=
attflt
[
0
];
else
if
(
strcmp
(
attname
,
"longitude_of_central_meridian"
)
==
0
)
*
lon_0
=
attflt
[
0
];
else
if
(
strcmp
(
attname
,
"latitude_of_projection_origin"
)
==
0
)
lat_0
=
attflt
[
0
];
else
if
(
strcmp
(
attname
,
"false_easting"
)
==
0
)
x_0
=
attflt
[
0
];
else
if
(
strcmp
(
attname
,
"false_northing"
)
==
0
)
y_0
=
attflt
[
0
];
else
if
(
strcmp
(
attname
,
"latitude_of_projection_origin"
)
==
0
)
*
lat_0
=
attflt
[
0
];
else
if
(
strcmp
(
attname
,
"false_easting"
)
==
0
)
*
x_0
=
attflt
[
0
];
else
if
(
strcmp
(
attname
,
"false_northing"
)
==
0
)
*
y_0
=
attflt
[
0
];
else
if
(
strcmp
(
attname
,
"longitudeOfFirstGridPointInDegrees"
)
==
0
)
*
xval_0
=
attflt
[
0
];
else
if
(
strcmp
(
attname
,
"latitudeOfFirstGridPointInDegrees"
)
==
0
)
*
yval_0
=
attflt
[
0
];
else
if
(
strcmp
(
attname
,
"standard_parallel"
)
==
0
)
...
...
@@ -3693,8 +3703,8 @@ void gridInqParamLCC(int gridID, double *a, double *rf, double *xval_0, double *
}
}
}
else
Warning
(
"%s mapping parameter missing!"
,
projection
)
;
return
status
;
}
...
...
src/grid.h
View file @
906a6d08
...
...
@@ -6,6 +6,8 @@
#include
"cdi_att.h"
extern
double
grid_missval
;
typedef
unsigned
char
mask_t
;
typedef
struct
grid_t
grid_t
;
...
...
src/stream_cgribex.c
View file @
906a6d08
...
...
@@ -1769,8 +1769,8 @@ void cgribexDefGrid(int *isec1, int *isec2, double *fsec2, int *isec4, int gridI
int
xsize
=
gridInqXsize
(
gridID
);
int
ysize
=
gridInqYsize
(
gridID
);
double
a
=
0
,
rf
=
0
,
xval_0
=
0
,
yval_0
=
0
,
lon_0
=
0
,
lat_1
=
0
,
lat_2
=
0
;
gridInqParamLCC
(
gridID
,
&
a
,
&
rf
,
&
xval_0
,
&
yval_0
,
&
lon
_0
,
&
lat_1
,
&
lat_2
);
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
);
bool
lsouth
=
(
lat_1
<
0
);
if
(
lsouth
)
{
lat_1
=
-
lat_2
;
lat_2
=
-
lat_2
;
}
...
...
src/stream_gribapi.c
View file @
906a6d08
...
...
@@ -2132,8 +2132,8 @@ void gribapiDefGrid(int editionNumber, grib_handle *gh, int gridID, int comptype
int
xsize
=
gridInqXsize
(
gridID
);
int
ysize
=
gridInqYsize
(
gridID
);
double
a
,
rf
,
xval_0
,
yval_0
,
lon
_0
,
lat_1
,
lat_2
;
gridInqParamLCC
(
gridID
,
&
a
,
&
rf
,
&
xval_0
,
&
yval_0
,
&
lon
_0
,
&
lat_1
,
&
lat_2
);
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
);
if
(
xval_0
<
0
)
xval_0
+=
360
;
bool
lsouth
=
(
lat_1
<
0
);
if
(
lsouth
)
{
lat_1
=
-
lat_2
;
lat_2
=
-
lat_2
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment