diff --git a/regression_scripts/build_pmesdr.sh b/regression_scripts/build_pmesdr.sh index 79e0af3b..d4539945 100755 --- a/regression_scripts/build_pmesdr.sh +++ b/regression_scripts/build_pmesdr.sh @@ -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 @@ -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 # diff --git a/regression_scripts/run_unit_tests.sh b/regression_scripts/run_ceedling_tests.sh similarity index 91% rename from regression_scripts/run_unit_tests.sh rename to regression_scripts/run_ceedling_tests.sh index 456d1018..aac61765 100755 --- a/regression_scripts/run_unit_tests.sh +++ b/regression_scripts/run_ceedling_tests.sh @@ -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 diff --git a/src/prod/Makefile b/src/prod/Makefile index 5ad60172..afe13c96 100644 --- a/src/prod/Makefile +++ b/src/prod/Makefile @@ -89,7 +89,9 @@ regression-setup: git clone git@github.com: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) diff --git a/src/prod/meas_meta_setup/meas_meta_setup.c b/src/prod/meas_meta_setup/meas_meta_setup.c index db891ee7..b2a826a1 100644 --- a/src/prod/meas_meta_setup/meas_meta_setup.c +++ b/src/prod/meas_meta_setup/meas_meta_setup.c @@ -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; @@ -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; @@ -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 @@ -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) && @@ -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"; @@ -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); @@ -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;