Commit 8f73c100 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

added env. variable CDI_COORDINATES_LONLAT to change the order of lon and lat...

added env. variable CDI_COORDINATES_LONLAT to change the order of lon and lat for the coordinates attribute.
parent fd7ae5e4
2017-05-?? Uwe Schulzweida
2017-05-16 Uwe Schulzweida
* Version 1.8.2 released
2017-05-15 Uwe Schulzweida
* added env. variable CDI_COORDINATES_LONLAT to change the order of lon and lat for the coordinates attribute.
2017-05-12 Uwe Schulzweida
* merged branch charxy [Fabian Wachsmann]
......
......@@ -610,17 +610,36 @@ int cdfDefVar(stream_t *streamptr, int varID)
int ncxvarID = streamptr->ncgrid[gridindex].ncIDs[CDF_VARID_X];
int ncyvarID = streamptr->ncgrid[gridindex].ncIDs[CDF_VARID_Y];
int ncavarID = streamptr->ncgrid[gridindex].ncIDs[CDF_VARID_A];
if ( ncyvarID != CDI_UNDEFID )
// CMOR order: coordinates = "lat lon"
if ( cdiCoordinatesLonLat )
{
size_t len = strlen(coordinates);
if ( len ) coordinates[len++] = ' ';
cdf_inq_varname(fileID, ncyvarID, coordinates+len);
if ( ncxvarID != CDI_UNDEFID )
{
size_t len = strlen(coordinates);
if ( len ) coordinates[len++] = ' ';
cdf_inq_varname(fileID, ncxvarID, coordinates+len);
}
if ( ncyvarID != CDI_UNDEFID )
{
size_t len = strlen(coordinates);
if ( len ) coordinates[len++] = ' ';
cdf_inq_varname(fileID, ncyvarID, coordinates+len);
}
}
if ( ncxvarID != CDI_UNDEFID )
else
{
size_t len = strlen(coordinates);
if ( len ) coordinates[len++] = ' ';
cdf_inq_varname(fileID, ncxvarID, coordinates+len);
if ( ncyvarID != CDI_UNDEFID )
{
size_t len = strlen(coordinates);
if ( len ) coordinates[len++] = ' ';
cdf_inq_varname(fileID, ncyvarID, coordinates+len);
}
if ( ncxvarID != CDI_UNDEFID )
{
size_t len = strlen(coordinates);
if ( len ) coordinates[len++] = ' ';
cdf_inq_varname(fileID, ncxvarID, coordinates+len);
}
}
if ( ncavarID != CDI_UNDEFID )
......
......@@ -33,6 +33,7 @@ int cdiChunkType = CDI_CHUNK_GRID;
int cdiSplitLtype105 = CDI_UNDEFID;
int cdiIgnoreAttCoordinates = FALSE;
int cdiCoordinatesLonLat = FALSE;
int cdiIgnoreValidRange = FALSE;
int cdiSkipRecords = 0;
int cdiConvention = CDI_CONVENTION_ECHAM;
......@@ -371,6 +372,9 @@ void cdiInitialize(void)
envstr = getenv("IGNORE_ATT_COORDINATES");
if ( envstr ) cdiIgnoreAttCoordinates = atoi(envstr);
envstr = getenv("CDI_COORDINATES_LONLAT");
if ( envstr ) cdiCoordinatesLonLat = atoi(envstr);
envstr = getenv("IGNORE_VALID_RANGE");
if ( envstr ) cdiIgnoreValidRange = atoi(envstr);
......
......@@ -334,6 +334,7 @@ extern int cdiSortName;
extern int cdiSortParam;
extern int cdiHaveMissval;
extern int cdiIgnoreAttCoordinates;
extern int cdiCoordinatesLonLat;
extern int cdiIgnoreValidRange;
extern int cdiSkipRecords;
extern int cdiConvention;
......
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