Description:
The C-API contains two function to normalize the refline and the z-channels.
- The refline normalization returns early and does nothing, but is still called during data preparation
- The z-channel (CrgChannelInfoStruct) mean values are all set to zero and used in a few calculations and evaluations that effectively do nothing (except in one case, see end of issue)
Proposed Solutions:
Either implement the feature or remove it, because as it is now, it just wastefully does nothing.
Removing it would be preferred because "normalizing" with a mean value per long section is of little use in my opinion.
|
normalizeRefLine( CrgDataStruct* crgData ) |
|
{ |
|
double xOff; |
|
double yOff; |
|
double hdg; |
|
double cHdg; |
|
double sHdg; |
|
size_t i; |
|
|
|
/** @todo: disabled on May 1, 2009 */ |
|
return; |
|
normalizeZ( CrgDataStruct* crgData ) |
|
{ |
|
double zMean = 0.0; |
|
size_t i, j; |
|
size_t nValues = 0; |
|
|
|
/* make mean elevation at first cross section = 0.0 */ |
|
/* note: prepare may be called multiple times, so take old mean value into account */ |
|
/* only use values not being NaNs! */ |
|
for ( i = 0; i < crgData->channelV.info.size; i++ ) |
|
if ( !isnan( crgData->channelZ[i].data[0] ) ) |
|
{ |
|
zMean += crgData->channelZ[i].data[0] + crgData->channelZ[i].info.mean; |
|
nValues++; |
|
} |
|
|
|
if ( nValues ) |
|
zMean /= nValues; |
|
|
|
zMean = 0.0; /** @todo: continue here */ |
|
|
|
/* @todo: check size of all channels! */ |
|
for ( i = 0; i < crgData->channelV.info.size; i++ ) |
|
{ |
|
for ( j = 0; j < crgData->channelZ[i].info.size; j++ ) |
|
if ( !isnan( crgData->channelZ[i].data[j] ) ) |
|
crgData->channelZ[i].data[j] = crgData->channelZ[i].data[j] + ( float ) ( crgData->channelZ[i].info.mean - zMean ); |
|
crgData->channelZ[i].info.mean = zMean; |
|
} |
|
} |
Mean Value use:
The mean value of the Z channels is used when offsetting the channel data and no refline info is present.
The channel is then offset by adjusting the mean value, but this could be solved differently e.g. by using the offset value of the info structure and using this one during evaluation.
Description:
The C-API contains two function to normalize the refline and the z-channels.
Proposed Solutions:
Either implement the feature or remove it, because as it is now, it just wastefully does nothing.
Removing it would be preferred because "normalizing" with a mean value per long section is of little use in my opinion.
OpenCRG/c-api/baselib/src/crgLoader.c
Lines 2301 to 2311 in 25ff0ff
OpenCRG/c-api/baselib/src/crgLoader.c
Lines 2348 to 2377 in 25ff0ff
Mean Value use:
The mean value of the Z channels is used when offsetting the channel data and no refline info is present.
The channel is then offset by adjusting the mean value, but this could be solved differently e.g. by using the offset value of the info structure and using this one during evaluation.