From a280c88832bb3de673008fa0b29ba6a9bbbb12fc Mon Sep 17 00:00:00 2001 From: Adriaan Dokter Date: Mon, 7 Feb 2022 14:45:08 -0500 Subject: [PATCH 1/3] fix azimuth selection --- lib/libvol2bird.c | 54 ++++++++++++++--------------------------------- lib/libvol2bird.h | 6 ++---- 2 files changed, 18 insertions(+), 42 deletions(-) diff --git a/lib/libvol2bird.c b/lib/libvol2bird.c index 1cb77894..31447d3b 100644 --- a/lib/libvol2bird.c +++ b/lib/libvol2bird.c @@ -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; } @@ -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 : @@ -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 @@ -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 diff --git a/lib/libvol2bird.h b/lib/libvol2bird.h index ec1e920d..a77e57cf 100644 --- a/lib/libvol2bird.h +++ b/lib/libvol2bird.h @@ -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; From 0dd44ea24d21d556434a7d49a6037299c071f4fb Mon Sep 17 00:00:00 2001 From: Adriaan Dokter Date: Mon, 7 Feb 2022 14:46:15 -0500 Subject: [PATCH 2/3] bump version --- lib/constants.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/constants.h b/lib/constants.h index 06f584d1..694f4d54 100644 --- a/lib/constants.h +++ b/lib/constants.h @@ -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" //-------------------------------------------------------// From 564f79cdef4ad409d2f098f4ba3dcf99c104cb53 Mon Sep 17 00:00:00 2001 From: Adriaan Dokter Date: Mon, 7 Feb 2022 14:48:18 -0500 Subject: [PATCH 3/3] fix operators --- lib/libvol2bird.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/libvol2bird.c b/lib/libvol2bird.c index 31447d3b..010898c8 100644 --- a/lib/libvol2bird.c +++ b/lib/libvol2bird.c @@ -427,14 +427,14 @@ static void classifyGatesSimple(vol2bird_t* alldata) { } if (alldata->options.azimMin < alldata->options.azimMax){ - if (azimValue < alldata->options.azimMin | azimValue > 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); } } else{ - if (azimValue < alldata->options.azimMin & azimValue > 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);