Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix regression #17

Merged
merged 2 commits into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion regression_scripts/build_pmesdr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@
# This script requires the name of a conda env to use to run the unit tests for CETB
# comparison utilities.

error_exit() {
# Use for fatal program error
# Argument:
# optional string containing descriptive error message
# if no error message, prints "Unknown Error"

echo "build_pmesdr.sh: ERROR: ${1:-"Unknown Error"}" 1>&2
return -1
}

condaenv=$1

cd ${PMESDR_TOP_DIR}/src/prod
Expand All @@ -17,6 +27,7 @@ make install
#
cd ${PMESDR_TOP_DIR}/python
source activate $condaenv
nosetests test_cetb_utilities.py
nosetests test_cetb_utilities.py || error_exit "unit tests failed"

# End of example job shell script
#
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ export LIBRARY_PATH=$CURC_HDF5_LIB:$CURC_NETCDF_LIB:$CURC_UDUNITS_LIB
cd $repo/src/prod
(make clean && make all && make install) >/dev/null

# Python tests.

cd $repo/python
nosetests test_cetb_utilities.py

# Ceedling tests.

export GEM_HOME=$HOME/.gems
Expand Down
4 changes: 3 additions & 1 deletion src/prod/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,9 @@ regression-setup:
git clone [email protected]:nsidc/pmesdr_regression_data.git

conda-env:
conda create -y -n $(CONDAENV) gsx nose
conda create -y -n $(CONDAENV) gsx; \
conda activate $(CONDAENV); \
pip install pynose

unit-test:
${PMESDR_TOP_DIR}/regression_scripts/build_pmesdr.sh $(CONDAENV)
Expand Down
24 changes: 5 additions & 19 deletions src/prod/meas_meta_setup/meas_meta_setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ typedef struct { /* BYU region information storage */
int sav_ipolar[NSAVE];
int sav_ibeam[NSAVE], sav_regnum[NSAVE];
char sav_regname[NSAVE][11], sav_fname2[NSAVE][180];
int sav_dateline[NSAVE],sav_ascdes[NSAVE];
int sav_ascdes[NSAVE];
float sav_tsplit1[NSAVE], sav_tsplit2[NSAVE];
float sav_km[NSAVE];
} region_save;
Expand Down Expand Up @@ -212,7 +212,6 @@ int main(int argc,char *argv[])
short int response_array[MAXFILL+1];

int jrec2[NSAVE]; /* measurement counter for each region */
int dateline; /* when 1, region crosses dateline */

FILE *file_id;

Expand Down Expand Up @@ -1004,7 +1003,6 @@ int main(int argc,char *argv[])
latl=save_area.sav_latl[iregion];
lonh=save_area.sav_lonh[iregion];
lonl=save_area.sav_lonl[iregion];
dateline=save_area.sav_dateline[iregion];

/*
* Apply LTOD considerations: if a
Expand Down Expand Up @@ -1061,14 +1059,10 @@ int main(int argc,char *argv[])
}
}

if (dateline) { /* convert lon to ascending order */
if (lonl < 0.0) lonl=(lonl+360.f);
if (cx < -180.0) cx=(cx+360.f);
} else { /* convert lon to -180 to 180 range */
if (cx > 180.0) cx=(cx-360.f);
if (cx < -180.0) cx=(cx+360.f);
if (cx > 180.0) cx=(cx-360.f);
}
/* convert lon to -180 to 180 range */
if (cx > 180.0) cx=(cx-360.f);
if (cx < -180.0) cx=(cx+360.f);
if (cx > 180.0) cx=(cx-360.f);

/* check to see if center is within region */
if (!((cx > lonl) && (cx < lonh) &&
Expand Down Expand Up @@ -1343,7 +1337,6 @@ FILE * get_meta(char *mname, char *outpath,
float ascale2,bscale2,a02,b02,ydeg2,xdeg2;
int iregion=0,ipolar=0;
char regname[11];
int dateline;
char fname2[180];
char outname[500];
char sensor[40]="SSMI something";
Expand Down Expand Up @@ -1522,12 +1515,6 @@ FILE * get_meta(char *mname, char *outpath,
lonh=(float)atof(++x);
}

if (strstr(line,"Dateline_crossing") != NULL) {
x = strchr(line,'='); x++;
if (*x== 'F' || *x== 'f') dateline=0;
else dateline=1;
}

if (strstr(line,"AscDesc_flag") != NULL) {
x = strchr(line,'=');
asc_des=atoi(++x);
Expand Down Expand Up @@ -1955,7 +1942,6 @@ FILE * get_meta(char *mname, char *outpath,
strncpy(a->sav_fname2[iregion-1],fname2,180);
a->sav_regnum[iregion-1]=regnum;
strncpy(a->sav_regname[iregion-1],regname,10);
a->sav_dateline[iregion-1]=dateline;
a->sav_ascdes[iregion-1]=asc_des;
a->sav_tsplit1[iregion-1]=tsplit1;
a->sav_tsplit2[iregion-1]=tsplit2;
Expand Down