Skip to content

Commit

Permalink
Merge pull request #185 from adokter/fix_azimuth_selection
Browse files Browse the repository at this point in the history
fix azimuth selection
  • Loading branch information
adokter authored Feb 7, 2022
2 parents e8a2445 + 564f79c commit d8365d2
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 44 deletions.
4 changes: 2 additions & 2 deletions lib/constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@
// Name of the program, to be stored as task attribute in ODIM
#define PROGRAM "vol2bird"
// Version of the program, to be stored as task_version attribute in ODIM
#define VERSION "0.5.0.9184"
#define VERSION "0.5.0.9185"
// Date of latest version of the program
#define VERSIONDATE "03-Feb-2022"
#define VERSIONDATE "07-Feb-2022"


//-------------------------------------------------------//
Expand Down
54 changes: 16 additions & 38 deletions lib/libvol2bird.c
Original file line number Diff line number Diff line change
Expand Up @@ -426,18 +426,22 @@ static void classifyGatesSimple(vol2bird_t* alldata) {
// flagPositionVDifMax
}

if (azimValue < alldata->options.azimMin) {
// the user can specify to exclude gates based on their azimuth;
// this clause is for gates that have too low azimuth
gateCode |= 1<<(alldata->flags.flagPositionAzimTooLow);
if (alldata->options.azimMin < alldata->options.azimMax){
if ((azimValue < alldata->options.azimMin) || (azimValue > alldata->options.azimMax)) {
// the user can specify to exclude gates based on their azimuth;
// this clause is for gates that have too low azimuth
gateCode |= 1<<(alldata->flags.flagPositionAzimOutOfRange);
}
}

if (azimValue > alldata->options.azimMax) {
// the user can specify to exclude gates based on their azimuth;
// this clause is for gates that have too high azimuth
gateCode |= 1<<(alldata->flags.flagPositionAzimTooHigh);
else{
if ((azimValue < alldata->options.azimMin) && (azimValue > alldata->options.azimMax)) {
// the user can specify to exclude gates based on their azimuth;
// this clause is for gates that have too low azimuth
gateCode |= 1<<(alldata->flags.flagPositionAzimOutOfRange);
}
}


alldata->points.points[iPoint * alldata->points.nColsPoints + alldata->points.gateCodeCol] = (float) gateCode;

}
Expand Down Expand Up @@ -2632,13 +2636,13 @@ static int includeGate(const int iProfileType, const int iQuantityType, const un



if (!iQuantityType && (gateCode & 1<<(alldata->flags.flagPositionAzimTooLow))) {
if (!iQuantityType && (gateCode & 1<<(alldata->flags.flagPositionAzimOutOfRange))) {

// i.e. iQuantityType == 0, we are NOT dealing with a selection for svdfit, but with a selection of reflectivities.
// Azimuth selection does not apply to svdfit, because svdfit requires data at all azimuths
// i.e. flag 7 in gateCode is true
// the user can specify to exclude gates based on their azimuth;
// this clause is for gates that have too low azimuth
// this clause is for gates that have azimuth outside the range selected by AzimMin and AzimMax

switch (iProfileType) {
case 1 :
Expand All @@ -2656,31 +2660,6 @@ static int includeGate(const int iProfileType, const int iQuantityType, const un
}


if (!iQuantityType && (gateCode & 1<<(alldata->flags.flagPositionAzimTooHigh))) {

// i.e. iQuantityType == 0, we are NOT dealing with a selection for svdfit, but with a selection of reflectivities.
// Azimuth selection does not apply to svdfit, because svdfit requires data at all azimuths
// i.e. flag 8 in gateCode is true
// the user can specify to exclude gates based on their azimuth;
// this clause is for gates that have too high azimuth

switch (iProfileType) {
case 1 :
doInclude = FALSE;
break;
case 2 :
doInclude = FALSE;
break;
case 3 :
doInclude = FALSE;
break;
default :
fprintf(stderr, "Something went wrong; behavior not implemented for given iProfileType.\n");
}
}



return doInclude;

} // includeGate
Expand Down Expand Up @@ -4993,8 +4972,7 @@ int vol2birdSetUp(PolarVolume_t* volume, vol2bird_t* alldata) {
alldata->flags.flagPositionDbzTooHighForBirds = 4;
alldata->flags.flagPositionVradTooLow = 5;
alldata->flags.flagPositionVDifMax = 6;
alldata->flags.flagPositionAzimTooLow = 7;
alldata->flags.flagPositionAzimTooHigh = 8;
alldata->flags.flagPositionAzimOutOfRange = 7;

// segment precipitation using Mistnet deep convolutional neural net
#ifdef MISTNET
Expand Down
6 changes: 2 additions & 4 deletions lib/libvol2bird.h
Original file line number Diff line number Diff line change
Expand Up @@ -278,10 +278,8 @@ struct vol2birdFlags {
int flagPositionVradTooLow;
// the bit in 'gateCode' that says whether this gate passed the VDIFMAX test
int flagPositionVDifMax;
// the bit in 'gateCode' that says whether the gate's azimuth angle was too low
int flagPositionAzimTooLow;
// the bit in 'gateCode' that says whether the gate's azimuth angle was too high
int flagPositionAzimTooHigh;
// the bit in 'gateCode' that says whether the gate's azimuth angle was out of the selected range
int flagPositionAzimOutOfRange;
};
typedef struct vol2birdFlags vol2birdFlags_t;

Expand Down

0 comments on commit d8365d2

Please sign in to comment.