Commit a9d36698 authored by Ralf Mueller's avatar Ralf Mueller
Browse files

[mapReduce] add optional parameter for avoiding coordinates (incl. bounds) at...

[mapReduce] add optional parameter for avoiding coordinates (incl. bounds) at all for maximum file size reduction
parent 6fb89e95
......@@ -19,7 +19,7 @@ avoided by using the additional 'nobounds' keyword.
@Name = reduce
@Title = Reduce input file variables to locations, where mask is non-zero.
Horizontal grids of @file{mask} and @file{ifile} must be identical
@Parameter = mask [nobounds]
@Parameter = mask [nobounds|nocoords]
@EndOperator
@BeginParameter
......@@ -27,6 +27,8 @@ avoided by using the additional 'nobounds' keyword.
STRING file which holds the mask field
@Item = nobounds
STRING if given, coordinated bounds are not written to output
@Item = nocoords
STRING if given, coordinates and bounds are not written to output
@EndParameter
@BeginExample
......
......@@ -75,6 +75,7 @@ void *MapReduce(void *argument)
int varID, levelID, recID;
int nmiss;
int nobounds = FALSE;
int nocoords = FALSE;
/*double missval1, missval2; */
cdoInitialize(argument);
......@@ -112,11 +113,12 @@ void *MapReduce(void *argument)
/* check if coordinated bounds shound not be created */
if ( 2 <= operatorArgc() )
{
char *boundOrNoBounds = operatorArgv()[1];
if ( 0 == strncmp("nobounds",boundOrNoBounds,8) ) nobounds = TRUE;
char *coordinatesLimitation = operatorArgv()[1];
if ( 0 == strncmp("nobounds",coordinatesLimitation,8) ) nobounds = TRUE;
if ( 0 == strncmp("nocoords",coordinatesLimitation,8) ) nocoords = TRUE;
}
/* create unstructured output grid including bounds*/
int outputGridID = gridToUnstructuredSelecton(inputGridID, maskSize, maskIndexList, nobounds);
int outputGridID = gridToUnstructuredSelecton(inputGridID, maskSize, maskIndexList, nocoords, nobounds);
/* create output vlist: Only variabes which have the same gridtype and
* gridsize as the input mask should be proessed. Everything else is ignoreds
......
......@@ -1233,7 +1233,7 @@ int gridToCurvilinear(int gridID1, int lbounds)
}
int gridToUnstructuredSelecton(int gridID1, int selectionSize, int *selectionIndexList, int nobounds)
int gridToUnstructuredSelecton(int gridID1, int selectionSize, int *selectionIndexList, int nocoords, int nobounds)
{
/* transform input grid into a unstructured Version if necessary {{{ */
......@@ -1244,11 +1244,13 @@ int gridToUnstructuredSelecton(int gridID1, int selectionSize, int *selectionInd
}
else
{
unstructuredGridID = gridToUnstructured(gridID1,TRUE);
unstructuredGridID = gridToUnstructured(gridID1,!nobounds);
}
int unstructuredGridSize = gridInqSize(unstructuredGridID);
int unstructuredSelectionGridID = gridCreate(GRID_UNSTRUCTURED,selectionSize);
if ( nocoords ) return (unstructuredSelectionGridID);
/* }}} */
/* copy meta data of coordinates {{{*/
......@@ -1333,6 +1335,7 @@ int gridToUnstructuredSelecton(int gridID1, int selectionSize, int *selectionInd
return (unstructuredSelectionGridID);
}
int gridToUnstructured(int gridID1, int lbounds)
{
int gridtype = gridInqType(gridID1);
......
......@@ -41,7 +41,7 @@ int referenceToGrid(int gridID);
int gridToZonal(int gridID);
int gridToMeridional(int gridID);
int gridToUnstructured(int gridID, int lbounds);
int gridToUnstructuredSelecton(int gridID1, int selectionSize, int *selectionIndexList, int nobounds);
int gridToUnstructuredSelecton(int gridID1, int selectionSize, int *selectionIndexList, int nocoords ,int nobounds);
int gridToCurvilinear(int gridID, int lbounds);
int gridCurvilinearToRegular(int gridID);
int gridToRegular(int gridID);
......
......@@ -743,7 +743,7 @@ static const char *MapReduceHelp[] = {
" reduce - Reduce fields to user-defined mask",
"",
"SYNOPSIS",
" reduce,mask[,nobounds] ifile ofile",
" reduce,mask[,nobounds|nocoords] ifile ofile",
"",
"DESCRIPTION",
" This module holds an operator for data reduction based on a user defined mask.",
......@@ -753,6 +753,7 @@ static const char *MapReduceHelp[] = {
"PARAMETER",
" mask STRING file which holds the mask field",
" nobounds STRING if given, coordinated bounds are not written to output",
" nocoords STRING if given, coordinates and bounds are not written to output",
NULL
};
......
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