Skip to content
GitLab
Menu
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
c6c0529a
Commit
c6c0529a
authored
Mar 15, 2019
by
Uwe Schulzweida
Browse files
grid.c: replace strcmp() by strIsEqual().
parent
9f6877f6
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/grid.c
View file @
c6c0529a
...
...
@@ -1013,11 +1013,11 @@ int gridInqProjType(int gridID)
if
(
mapping
[
0
]
)
{
// clang-format off
if
(
str
cmp
(
mapping
,
"rotated_latitude_longitude"
)
==
0
)
projtype
=
CDI_PROJ_RLL
;
else
if
(
str
cmp
(
mapping
,
"lambert_azimuthal_equal_area"
)
==
0
)
projtype
=
CDI_PROJ_LAEA
;
else
if
(
str
cmp
(
mapping
,
"lambert_conformal_conic"
)
==
0
)
projtype
=
CDI_PROJ_LCC
;
else
if
(
str
cmp
(
mapping
,
"sinusoidal"
)
==
0
)
projtype
=
CDI_PROJ_SINU
;
else
if
(
str
cmp
(
mapping
,
"polar_stereographic"
)
==
0
)
projtype
=
CDI_PROJ_STERE
;
if
(
str
IsEqual
(
mapping
,
"rotated_latitude_longitude"
)
)
projtype
=
CDI_PROJ_RLL
;
else
if
(
str
IsEqual
(
mapping
,
"lambert_azimuthal_equal_area"
)
)
projtype
=
CDI_PROJ_LAEA
;
else
if
(
str
IsEqual
(
mapping
,
"lambert_conformal_conic"
)
)
projtype
=
CDI_PROJ_LCC
;
else
if
(
str
IsEqual
(
mapping
,
"sinusoidal"
)
)
projtype
=
CDI_PROJ_SINU
;
else
if
(
str
IsEqual
(
mapping
,
"polar_stereographic"
)
)
projtype
=
CDI_PROJ_STERE
;
// clang-format on
gridptr
->
projtype
=
projtype
;
}
...
...
@@ -1970,7 +1970,7 @@ void gridInqParamRLL(int gridID, double *xpole, double *ypole, double *angle)
const
char
*
projection
=
"rotated_latitude_longitude"
;
char
mapping
[
CDI_MAX_NAME
];
mapping
[
0
]
=
0
;
cdiGridInqKeyStr
(
gridID
,
CDI_KEY_MAPNAME
,
CDI_MAX_NAME
,
mapping
);
if
(
mapping
[
0
]
&&
str
cmp
(
mapping
,
projection
)
==
0
)
if
(
mapping
[
0
]
&&
str
IsEqual
(
mapping
,
projection
)
)
{
int
atttype
,
attlen
;
char
attname
[
CDI_MAX_NAME
+
1
];
...
...
@@ -1986,9 +1986,9 @@ void gridInqParamRLL(int gridID, double *xpole, double *ypole, double *angle)
double
attflt
;
if
(
cdiInqAttConvertedToFloat
(
gridID
,
atttype
,
attname
,
attlen
,
&
attflt
)
)
{
if
(
str
cmp
(
attname
,
"grid_north_pole_longitude"
)
==
0
)
*
xpole
=
attflt
;
else
if
(
str
cmp
(
attname
,
"grid_north_pole_latitude"
)
==
0
)
*
ypole
=
attflt
;
else
if
(
str
cmp
(
attname
,
"north_pole_grid_longitude"
)
==
0
)
*
angle
=
attflt
;
if
(
str
IsEqual
(
attname
,
"grid_north_pole_longitude"
)
)
*
xpole
=
attflt
;
else
if
(
str
IsEqual
(
attname
,
"grid_north_pole_latitude"
)
)
*
ypole
=
attflt
;
else
if
(
str
IsEqual
(
attname
,
"north_pole_grid_longitude"
)
)
*
angle
=
attflt
;
}
}
}
...
...
@@ -3919,7 +3919,7 @@ int gridInqParamLCC(int gridID, double missval, double *lon_0, double *lat_0, do
const
char
*
projection
=
"lambert_conformal_conic"
;
char
mapname
[
CDI_MAX_NAME
];
mapname
[
0
]
=
0
;
cdiGridInqKeyStr
(
gridID
,
CDI_KEY_MAPNAME
,
CDI_MAX_NAME
,
mapname
);
if
(
mapname
[
0
]
&&
str
cmp
(
mapname
,
projection
)
==
0
)
if
(
mapname
[
0
]
&&
str
IsEqual
(
mapname
,
projection
)
)
{
int
atttype
,
attlen
;
char
attname
[
CDI_MAX_NAME
+
1
];
...
...
@@ -3937,15 +3937,15 @@ int gridInqParamLCC(int gridID, double missval, double *lon_0, double *lat_0, do
double
attflt
[
2
];
if
(
cdiInqAttConvertedToFloat
(
gridID
,
atttype
,
attname
,
attlen
,
attflt
)
)
{
if
(
str
cmp
(
attname
,
"earth_radius"
)
==
0
)
*
a
=
attflt
[
0
];
else
if
(
str
cmp
(
attname
,
"inverse_flattening"
)
==
0
)
*
rf
=
attflt
[
0
];
else
if
(
str
cmp
(
attname
,
"longitude_of_central_meridian"
)
==
0
)
*
lon_0
=
attflt
[
0
];
else
if
(
str
cmp
(
attname
,
"latitude_of_projection_origin"
)
==
0
)
*
lat_0
=
attflt
[
0
];
else
if
(
str
cmp
(
attname
,
"false_easting"
)
==
0
)
*
x_0
=
attflt
[
0
];
else
if
(
str
cmp
(
attname
,
"false_northing"
)
==
0
)
*
y_0
=
attflt
[
0
];
else
if
(
str
cmp
(
attname
,
"longitudeOfFirstGridPointInDegrees"
)
==
0
)
*
xval_0
=
attflt
[
0
];
else
if
(
str
cmp
(
attname
,
"latitudeOfFirstGridPointInDegrees"
)
==
0
)
*
yval_0
=
attflt
[
0
];
else
if
(
str
cmp
(
attname
,
"standard_parallel"
)
==
0
)
if
(
str
IsEqual
(
attname
,
"earth_radius"
)
)
*
a
=
attflt
[
0
];
else
if
(
str
IsEqual
(
attname
,
"inverse_flattening"
)
)
*
rf
=
attflt
[
0
];
else
if
(
str
IsEqual
(
attname
,
"longitude_of_central_meridian"
)
)
*
lon_0
=
attflt
[
0
];
else
if
(
str
IsEqual
(
attname
,
"latitude_of_projection_origin"
)
)
*
lat_0
=
attflt
[
0
];
else
if
(
str
IsEqual
(
attname
,
"false_easting"
)
)
*
x_0
=
attflt
[
0
];
else
if
(
str
IsEqual
(
attname
,
"false_northing"
)
)
*
y_0
=
attflt
[
0
];
else
if
(
str
IsEqual
(
attname
,
"longitudeOfFirstGridPointInDegrees"
)
)
*
xval_0
=
attflt
[
0
];
else
if
(
str
IsEqual
(
attname
,
"latitudeOfFirstGridPointInDegrees"
)
)
*
yval_0
=
attflt
[
0
];
else
if
(
str
IsEqual
(
attname
,
"standard_parallel"
)
)
{
*
lat_1
=
attflt
[
0
];
*
lat_2
=
(
attlen
==
2
)
?
attflt
[
1
]
:
attflt
[
0
];
...
...
@@ -4094,7 +4094,7 @@ int gridInqParamSTERE(int gridID, double missval, double *lon_0, double *lat_ts,
const
char
*
projection
=
"polar_stereographic"
;
char
mapname
[
CDI_MAX_NAME
];
mapname
[
0
]
=
0
;
cdiGridInqKeyStr
(
gridID
,
CDI_KEY_MAPNAME
,
CDI_MAX_NAME
,
mapname
);
if
(
mapname
[
0
]
&&
str
cmp
(
mapname
,
projection
)
==
0
)
if
(
mapname
[
0
]
&&
str
IsEqual
(
mapname
,
projection
)
)
{
int
atttype
,
attlen
;
char
attname
[
CDI_MAX_NAME
+
1
];
...
...
@@ -4112,14 +4112,14 @@ int gridInqParamSTERE(int gridID, double missval, double *lon_0, double *lat_ts,
double
attflt
[
2
];
if
(
cdiInqAttConvertedToFloat
(
gridID
,
atttype
,
attname
,
attlen
,
attflt
)
)
{
if
(
str
cmp
(
attname
,
"earth_radius"
)
==
0
)
*
a
=
attflt
[
0
];
else
if
(
str
cmp
(
attname
,
"standard_parallel"
)
==
0
)
*
lat_ts
=
attflt
[
0
];
else
if
(
str
cmp
(
attname
,
"straight_vertical_longitude_from_pole"
)
==
0
)
*
lon_0
=
attflt
[
0
];
else
if
(
str
cmp
(
attname
,
"latitude_of_projection_origin"
)
==
0
)
*
lat_0
=
attflt
[
0
];
else
if
(
str
cmp
(
attname
,
"false_easting"
)
==
0
)
*
x_0
=
attflt
[
0
];
else
if
(
str
cmp
(
attname
,
"false_northing"
)
==
0
)
*
y_0
=
attflt
[
0
];
else
if
(
str
cmp
(
attname
,
"longitudeOfFirstGridPointInDegrees"
)
==
0
)
*
xval_0
=
attflt
[
0
];
else
if
(
str
cmp
(
attname
,
"latitudeOfFirstGridPointInDegrees"
)
==
0
)
*
yval_0
=
attflt
[
0
];
if
(
str
IsEqual
(
attname
,
"earth_radius"
)
)
*
a
=
attflt
[
0
];
else
if
(
str
IsEqual
(
attname
,
"standard_parallel"
)
)
*
lat_ts
=
attflt
[
0
];
else
if
(
str
IsEqual
(
attname
,
"straight_vertical_longitude_from_pole"
)
)
*
lon_0
=
attflt
[
0
];
else
if
(
str
IsEqual
(
attname
,
"latitude_of_projection_origin"
)
)
*
lat_0
=
attflt
[
0
];
else
if
(
str
IsEqual
(
attname
,
"false_easting"
)
)
*
x_0
=
attflt
[
0
];
else
if
(
str
IsEqual
(
attname
,
"false_northing"
)
)
*
y_0
=
attflt
[
0
];
else
if
(
str
IsEqual
(
attname
,
"longitudeOfFirstGridPointInDegrees"
)
)
*
xval_0
=
attflt
[
0
];
else
if
(
str
IsEqual
(
attname
,
"latitudeOfFirstGridPointInDegrees"
)
)
*
yval_0
=
attflt
[
0
];
}
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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