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

Renamed CDI_KEY_MAPPING to CDI_KEY_GRIDMAP_VARNAME.

parent eae2e51d
......@@ -303,7 +303,7 @@ void cdf_get_gmapvarname(int gridID, char *gmapvarname)
{
int pgridID = gridID;
char mapping[CDI_MAX_NAME]; mapping[0] = 0;
cdiGridInqKeyStr(pgridID, CDI_KEY_MAPNAME, CDI_MAX_NAME, mapping);
cdiGridInqKeyStr(pgridID, CDI_KEY_GRIDMAP_NAME, CDI_MAX_NAME, mapping);
if ( !mapping[0] )
{
......@@ -311,12 +311,13 @@ void cdf_get_gmapvarname(int gridID, char *gmapvarname)
if ( projID != CDI_UNDEFID )
{
pgridID = projID;
cdiGridInqKeyStr(pgridID, CDI_KEY_MAPNAME, CDI_MAX_NAME, mapping);
cdiGridInqKeyStr(pgridID, CDI_KEY_GRIDMAP_NAME, CDI_MAX_NAME, mapping);
}
}
if ( mapping[0] )
cdiGridInqKeyStr(pgridID, CDI_KEY_MAPPING, CDI_MAX_NAME, gmapvarname);
cdiGridInqKeyStr(pgridID, CDI_KEY_GRIDMAP_VARNAME, CDI_MAX_NAME, gmapvarname);
printf("gmapvarname %s\n", gmapvarname);
}
static
......
......@@ -839,8 +839,8 @@ int cdiCopyKeys(int cdiID1, int varID1, int cdiID2, int varID2);
#define CDI_KEY_YLONGNAME 913 // Y-axis longname
#define CDI_KEY_YUNITS 914 // Y-axis units
#define CDI_KEY_VDIMNAME 920 // Vertex dimension name
#define CDI_KEY_MAPPING 921 // Grid mapping var name
#define CDI_KEY_MAPNAME 922 // Grid mapping name
#define CDI_KEY_GRIDMAP_VARNAME 921 // Grid mapping var name
#define CDI_KEY_GRIDMAP_NAME 922 // Grid mapping name
// CDI zaxis keys
#define CDI_KEY_NAME 941 // Z-axis name
......
......@@ -629,8 +629,8 @@ void *grid_key_to_ptr(grid_t *gridptr, int key)
case CDI_KEY_XDIMNAME: keyptr = (void*)gridptr->x.dimname; break;
case CDI_KEY_YDIMNAME: keyptr = (void*)gridptr->y.dimname; break;
case CDI_KEY_VDIMNAME: keyptr = (void*)gridptr->vdimname; break;
case CDI_KEY_MAPPING: keyptr = (void*)gridptr->mapname; break;
case CDI_KEY_MAPNAME: keyptr = (void*)gridptr->mapping; break;
case CDI_KEY_GRIDMAP_VARNAME: keyptr = (void*)gridptr->mapname; break;
case CDI_KEY_GRIDMAP_NAME: keyptr = (void*)gridptr->mapping; break;
}
return keyptr;
......@@ -1023,7 +1023,7 @@ int gridInqProjType(int gridID)
if ( projtype == -1 )
{
char mapping[CDI_MAX_NAME]; mapping[0] = 0;
cdiGridInqKeyStr(gridID, CDI_KEY_MAPNAME, CDI_MAX_NAME, mapping);
cdiGridInqKeyStr(gridID, CDI_KEY_GRIDMAP_NAME, CDI_MAX_NAME, mapping);
if ( mapping[0] )
{
// clang-format off
......@@ -1996,7 +1996,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);
cdiGridInqKeyStr(gridID, CDI_KEY_GRIDMAP_NAME, CDI_MAX_NAME, mapping);
if ( mapping[0] && strIsEqual(mapping, projection) )
{
int atttype, attlen;
......@@ -2035,10 +2035,10 @@ void gridInqParamRLL(int gridID, double *xpole, double *ypole, double *angle)
*/
void gridDefParamRLL(int gridID, double xpole, double ypole, double angle)
{
cdiGridDefKeyStr(gridID, CDI_KEY_MAPPING, CDI_MAX_NAME, "rotated_pole");
cdiGridDefKeyStr(gridID, CDI_KEY_GRIDMAP_VARNAME, CDI_MAX_NAME, "rotated_pole");
const char *mapping = "rotated_latitude_longitude";
cdiGridDefKeyStr(gridID, CDI_KEY_MAPNAME, CDI_MAX_NAME, mapping);
cdiGridDefKeyStr(gridID, CDI_KEY_GRIDMAP_NAME, CDI_MAX_NAME, mapping);
cdiDefAttTxt(gridID, CDI_GLOBAL, "grid_mapping_name", (int)(strlen(mapping)), mapping);
cdiDefAttFlt(gridID, CDI_GLOBAL, "grid_north_pole_longitude", CDI_DATATYPE_FLT64, 1, &xpole);
cdiDefAttFlt(gridID, CDI_GLOBAL, "grid_north_pole_latitude", CDI_DATATYPE_FLT64, 1, &ypole);
......@@ -3706,10 +3706,10 @@ void gridDefParamLCC(int gridID, double missval, double lon_0, double lat_0, dou
double a, double rf, double xval_0, double yval_0, double x_0, double y_0)
{
(void)lat_0;
cdiGridDefKeyStr(gridID, CDI_KEY_MAPPING, CDI_MAX_NAME, "Lambert_Conformal");
cdiGridDefKeyStr(gridID, CDI_KEY_GRIDMAP_VARNAME, CDI_MAX_NAME, "Lambert_Conformal");
const char *mapname = "lambert_conformal_conic";
cdiGridDefKeyStr(gridID, CDI_KEY_MAPNAME, CDI_MAX_NAME, mapname);
cdiGridDefKeyStr(gridID, CDI_KEY_GRIDMAP_NAME, CDI_MAX_NAME, mapname);
cdiDefAttTxt(gridID, CDI_GLOBAL, "grid_mapping_name", (int)(strlen(mapname)), mapname);
int nlats = 0;
double lats[2];
......@@ -3770,7 +3770,7 @@ int gridInqParamLCC(int gridID, double missval, double *lon_0, double *lat_0, do
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);
cdiGridInqKeyStr(gridID, CDI_KEY_GRIDMAP_NAME, CDI_MAX_NAME, mapname);
if ( mapname[0] && strIsEqual(mapname, projection) )
{
int atttype, attlen;
......@@ -3891,10 +3891,10 @@ The function @func{gridDefParamSTERE} defines the parameter of a Polar stereogra
void gridDefParamSTERE(int gridID, double missval, double lon_0, double lat_ts, double lat_0,
double a, double xval_0, double yval_0, double x_0, double y_0)
{
cdiGridDefKeyStr(gridID, CDI_KEY_MAPPING, CDI_MAX_NAME, "Polar_Stereographic");
cdiGridDefKeyStr(gridID, CDI_KEY_GRIDMAP_VARNAME, CDI_MAX_NAME, "Polar_Stereographic");
const char *mapname = "polar_stereographic";
cdiGridDefKeyStr(gridID, CDI_KEY_MAPNAME, CDI_MAX_NAME, mapname);
cdiGridDefKeyStr(gridID, CDI_KEY_GRIDMAP_NAME, CDI_MAX_NAME, mapname);
cdiDefAttTxt(gridID, CDI_GLOBAL, "grid_mapping_name", (int)(strlen(mapname)), mapname);
cdiDefAttFlt(gridID, CDI_GLOBAL, "standard_parallel", CDI_DATATYPE_FLT64, 1, &lat_ts);
cdiDefAttFlt(gridID, CDI_GLOBAL, "straight_vertical_longitude_from_pole", CDI_DATATYPE_FLT64, 1, &lon_0);
......@@ -3946,7 +3946,7 @@ int gridInqParamSTERE(int gridID, double missval, double *lon_0, double *lat_ts,
status = -2;
const char *projection = "polar_stereographic";
char mapname[CDI_MAX_NAME]; mapname[0] = 0;
cdiGridInqKeyStr(gridID, CDI_KEY_MAPNAME, CDI_MAX_NAME, mapname);
cdiGridInqKeyStr(gridID, CDI_KEY_GRIDMAP_NAME, CDI_MAX_NAME, mapname);
if ( mapname[0] && strIsEqual(mapname, projection) )
{
int atttype, attlen;
......
......@@ -495,8 +495,8 @@ module mo_cdi
integer(c_int), public, parameter :: CDI_KEY_YLONGNAME = 913
integer(c_int), public, parameter :: CDI_KEY_YUNITS = 914
integer(c_int), public, parameter :: CDI_KEY_VDIMNAME = 920
integer(c_int), public, parameter :: CDI_KEY_MAPPING = 921
integer(c_int), public, parameter :: CDI_KEY_MAPNAME = 922
integer(c_int), public, parameter :: CDI_KEY_GRIDMAP_VARNAME = 921
integer(c_int), public, parameter :: CDI_KEY_GRIDMAP_NAME = 922
integer(c_int), public, parameter :: CDI_KEY_NAME = 941
integer(c_int), public, parameter :: CDI_KEY_DIMNAME = 942
integer(c_int), public, parameter :: CDI_KEY_LONGNAME = 943
......
......@@ -2584,7 +2584,7 @@ void cdf_read_mapping_atts(int ncid, int gmapvarid, int projID, const char *varn
{
char attstring[CDI_MAX_NAME];
cdfGetAttText(ncid, gmapvarid, "grid_mapping_name", CDI_MAX_NAME, attstring);
cdiGridDefKeyStr(projID, CDI_KEY_MAPNAME, (int)(strlen(attstring)+1), attstring);
cdiGridDefKeyStr(projID, CDI_KEY_GRIDMAP_NAME, (int)(strlen(attstring)+1), attstring);
}
else
{
......@@ -2770,7 +2770,7 @@ int cdf_define_all_grids(ncgrid_t *ncgrid, int vlistID, ncdim_t *ncdims, int nva
const int ncid = ncvars[gmapvarid].ncid;
const char *gmapname = ncvars[gmapvarid].name;
cdf_read_mapping_atts(ncid, gmapvarid, projID, gmapname);
cdiGridDefKeyStr(projID, CDI_KEY_MAPPING, (int)(strlen(gmapname)+1), gmapname);
cdiGridDefKeyStr(projID, CDI_KEY_GRIDMAP_VARNAME, (int)(strlen(gmapname)+1), gmapname);
gridVerifyProj(projID);
}
......
......@@ -1618,11 +1618,11 @@ static
void cdf_def_mapping(stream_t *streamptr, int gridID)
{
char mapping[CDI_MAX_NAME]; mapping[0] = 0;
cdiGridInqKeyStr(gridID, CDI_KEY_MAPNAME, CDI_MAX_NAME, mapping);
cdiGridInqKeyStr(gridID, CDI_KEY_GRIDMAP_NAME, CDI_MAX_NAME, mapping);
if ( mapping[0] )
{
char gmapvarname[CDI_MAX_NAME]; gmapvarname[0] = 0;
cdiGridInqKeyStr(gridID, CDI_KEY_MAPPING, CDI_MAX_NAME, gmapvarname);
cdiGridInqKeyStr(gridID, CDI_KEY_GRIDMAP_VARNAME, CDI_MAX_NAME, gmapvarname);
const int fileID = streamptr->fileID;
if ( streamptr->ncmode == 2 ) cdf_redef(fileID);
......
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