diff --git a/.profile/superdarn.bash b/.profile/superdarn.bash index e5306463a..3fa1a2134 100644 --- a/.profile/superdarn.bash +++ b/.profile/superdarn.bash @@ -10,8 +10,8 @@ export AACGM_DAT_PREFIX=${RSTPATH}"/tables/analysis/aacgm/aacgm_coeffs" export IGRF_PATH=${RSTPATH}"/tables/analysis/mag/" export SD_MODEL_TABLE=${RSTPATH}"/tables/superdarn/model" -export AACGM_v2_DAT_PREFIX="${RSTPATH}/tables/analysis/aacgm/aacgm_coeffs-12-" -export IGRF_COEFFS="${IGRF_PATH}magmodel_1590-2015.txt" +export AACGM_v2_DAT_PREFIX="${RSTPATH}/tables/analysis/aacgm/aacgm_coeffs-13-" +export IGRF_COEFFS="${IGRF_PATH}magmodel_1590-2020.txt" export COLOR_TABLE_PATH=${RSTPATH}"/tables/base/key/" diff --git a/.profile/superdarn.tcsh b/.profile/superdarn.tcsh index 6a69c8252..81934d9ad 100644 --- a/.profile/superdarn.tcsh +++ b/.profile/superdarn.tcsh @@ -10,8 +10,8 @@ setenv AACGM_DAT_PREFIX ${RSTPATH}"/tables/analysis/aacgm/aacgm_coeffs" setenv IGRF_PATH ${RSTPATH}"/tables/analysis/mag/" setenv SD_MODEL_TABLE ${RSTPATH}"/tables/superdarn/model" -setenv AACGM_v2_DAT_PREFIX "${RSTPATH}/tables/analysis/aacgm/aacgm_coeffs-12-" -setenv IGRF_COEFFS "${IGRF_PATH}magmodel_1590-2015.txt" +setenv AACGM_v2_DAT_PREFIX "${RSTPATH}/tables/analysis/aacgm/aacgm_coeffs-13-" +setenv IGRF_COEFFS "${IGRF_PATH}magmodel_1590-2020.txt" setenv COLOR_TABLE_PATH ${RSTPATH}"/tables/base/key/" diff --git a/codebase/analysis/src.bin/aacgm_v2/aacgm_test.1.0/expected.txt b/codebase/analysis/src.bin/aacgm_v2/aacgm_test.1.0/expected.txt deleted file mode 100644 index 7e0509601..000000000 --- a/codebase/analysis/src.bin/aacgm_v2/aacgm_test.1.0/expected.txt +++ /dev/null @@ -1,89 +0,0 @@ -================================================================================ - AACGM-v2 Test Program -================================================================================ -================================================================================ -TEST: no date/time (this WILL and SHOULD return an error.) -================================================================================ -================================================================================ -TEST: Setting time to : 20140322 0311:00 -================================================================================ - -Expected output: 20140322 0311:00 81 -Actual output: 20140322 0311:00 81 - - -================================================================================ -TEST: geographic to AACGM-v2 -================================================================================ - GLAT GLON HEIGHT MLAT MLON R -Expected 45.500000 -23.500000 1135.000000 48.189618 57.763454 1.177533 -Actual 45.500000 -23.500000 1135.000000 48.189618 57.763454 1.177533 - - -================================================================================ -TEST: AACGM-v2 to geographic -================================================================================ - MLAT MLON HEIGHT GLAT GLON HEIGHT -Expected 48.189618 57.763454 1131.097495 45.440775 -23.472757 1134.977896 -Actual 48.189618 57.763454 1131.097495 45.440775 -23.472757 1134.977896 - - -Do the same thing but use field-line tracing -================================================================================ -TEST: geographic to AACGM-v2 (TRACE) -================================================================================ - GLAT GLON HEIGHT MLAT MLON R -Expected 45.500000 -23.500000 1135.000000 48.194757 57.758831 1.177533 -Actual 45.500000 -23.500000 1135.000000 48.194757 57.758831 1.177533 - -================================================================================ -TEST: AACGM-v2 to geographic (TRACE) -================================================================================ - MLAT MLON HEIGHT GLAT GLON HEIGHT -Expected 48.194757 57.758831 1131.097495 45.500000 -23.500000 1135.000000 -Actual 48.194757 57.758831 1131.097495 45.500000 -23.500000 1135.000000 - - -================================================================================ -TEST: MLT (T: field-line tracing) (C: coefficients) -================================================================================ - GLAT GLON HEIGHT MLAT MLON MLT -Expected T 37.000000 -88.000000 300.000000 48.840368 -17.006090 1.977745 -Actual T 37.000000 -88.000000 300.000000 48.840368 -17.006090 1.977745 -Expected C 37.000000 -88.000000 300.000000 48.844355 -16.999464 1.978187 -Actual C 37.000000 -88.000000 300.000000 48.844355 -16.999464 1.978187 - - -================================================================================ -TEST: Array -================================================================================ - GLAT GLON HEIGHT MLAT MLON MLT -Expected 45.0000 0.0000 150.0000 40.2841 76.6676 8.2227 -Expected 45.0000 1.0000 150.0000 40.2447 77.4899 8.2775 -Expected 45.0000 2.0000 150.0000 40.2108 78.3157 8.3325 -Expected 45.0000 3.0000 150.0000 40.1822 79.1452 8.3878 -Expected 45.0000 4.0000 150.0000 40.1587 79.9785 8.4434 -Expected 45.0000 5.0000 150.0000 40.1400 80.8157 8.4992 -Expected 45.0000 6.0000 150.0000 40.1261 81.6569 8.5553 -Expected 45.0000 7.0000 150.0000 40.1165 82.5020 8.6116 -Expected 45.0000 8.0000 150.0000 40.1111 83.3513 8.6682 -Expected 45.0000 9.0000 150.0000 40.1097 84.2048 8.7251 - - GLAT GLON HEIGHT MLAT MLON MLT -Actual 45.0000 0.0000 150.0000 40.2841 76.6676 8.2227 -Actual 45.0000 1.0000 150.0000 40.2447 77.4899 8.2775 -Actual 45.0000 2.0000 150.0000 40.2108 78.3157 8.3325 -Actual 45.0000 3.0000 150.0000 40.1822 79.1452 8.3878 -Actual 45.0000 4.0000 150.0000 40.1587 79.9785 8.4434 -Actual 45.0000 5.0000 150.0000 40.1400 80.8157 8.4992 -Actual 45.0000 6.0000 150.0000 40.1261 81.6569 8.5553 -Actual 45.0000 7.0000 150.0000 40.1165 82.5020 8.6116 -Actual 45.0000 8.0000 150.0000 40.1111 83.3513 8.6682 -Actual 45.0000 9.0000 150.0000 40.1097 84.2048 8.7251 - - -Check Expected values against Actual values, or - -test_aacgm > some_file.txt -diff some_file.txt expected.txt - diff --git a/codebase/analysis/src.bin/aacgm_v2/aacgm_test.1.0/test_aacgm.c b/codebase/analysis/src.bin/aacgm_v2/aacgm_test.1.0/test_aacgm.c index 615856657..037122c6d 100755 --- a/codebase/analysis/src.bin/aacgm_v2/aacgm_test.1.0/test_aacgm.c +++ b/codebase/analysis/src.bin/aacgm_v2/aacgm_test.1.0/test_aacgm.c @@ -6,104 +6,88 @@ #define DEBUG 1 void next(void); -void line(char ch); +void line(char ch, int n); int main(void) { double lat,lon,hgt; double h, mlt_c, mlt_t; -/*double rtp[3];*/ +double rtp[3]; double mlat,mlon,r; int k, err, npts; -int yr, mo, dy, hr, mt, sc, dno; +int yr, mo, dy, hr, mt, sc; -line('='); -printf(" AACGM-v2 Test Program\n"); -line('='); +line('=',80); +printf("\nAACGM-v2 Test Program\n\n"); +line('=',80); +CR; /* compute AACGM-v2 lat/lon with no time specified */ -line('='); -printf("TEST: no date/time (this WILL and SHOULD return an error.)\n"); -line('='); +printf("TEST: no date/time (this will return an error.)\n"); lat = 45.5; lon = -23.5; hgt = 1135.; err = AACGM_v2_Convert(lat,lon,hgt, &mlat,&mlon, &r, G2A); if (err == 0) { - printf("lat = %lf, lon = %lf, height = %lf\n", lat,lon,hgt); - printf("mlat = %lf, mlon = %lf, r = %lf\n", mlat,mlon,r); - printf("\n\n"); + printf("lat = %lf, lon = %lf, height = %lf\n", lat,lon,hgt); + printf("mlat = %lf, mlon = %lf, r = %lf\n", mlat,mlon,r); + printf("\n\n"); } #if (DEBUG > 1) next(); -printf("TEST: Setting time to : %04d%02d%02d %02d%02d:%02d (will fail)\n", 1850,1,22,0,0,0); -AACGM_v2_SetDateTime(1850, 1, 22, 0,0,0); /* this should fail */ +printf("TEST: Setting time to : %04d%02d%02d %02d%02d:%02d (will fail)\n", 1350,1,22,0,0,0); +AACGM_v2_SetDateTime(1350, 1, 22, 0,0,0); /* should fail */ +printf("TEST: Setting time to : %04d%02d%02d %02d%02d:%02d\n", 1850,1,22,0,0,0); +AACGM_v2_SetDateTime(1850, 1, 22, 0,0,0); /* this is now valid */ printf("TEST: Setting time to : %04d%02d%02d %02d%02d:%02d\n", 1900,1,22,0,0,0); -AACGM_v2_SetDateTime(1900, 1, 22, 0,0,0); /* this is valid */ -printf("TEST: Setting time to : %04d%02d%02d %02d%02d:%02d (will fail)\n", 2020,1,22,0,0,0); -AACGM_v2_SetDateTime(2020, 1, 22, 0,0,0); /* this shoudl fail */ +AACGM_v2_SetDateTime(1900, 1, 22, 0,0,0); /* this is valid */ +printf("TEST: Setting time to : %04d%02d%02d %02d%02d:%02d\n", 2020,1,22,0,0,0); +AACGM_v2_SetDateTime(2020, 1, 22, 0,0,0); /* this is now valid */ printf("TEST: Setting time to : %04d%02d%02d %02d%02d:%02d\n", 2019,1,22,0,0,0); -AACGM_v2_SetDateTime(2019, 1, 22, 0,0,0); /* this is valid */ +AACGM_v2_SetDateTime(2019, 1, 22, 0,0,0); /* this is valid */ +printf("TEST: Setting time to : %04d%02d%02d %02d%02d:%02d (will fail)\n", 2025,1,22,0,0,0); +AACGM_v2_SetDateTime(2025, 1, 22, 0,0,0); /* should fail*/ next(); #endif -yr = 2014; +yr = 2024; mo = 3; dy = 22; hr = 3; mt = 11; sc = 0; -line('='); printf("TEST: Setting time to : %04d%02d%02d %02d%02d:%02d\n", - yr, mo, dy, hr, mt, sc); -line('='); + yr, mo, dy, hr, mt, sc); CR; /* set date and time */ AACGM_v2_SetDateTime(yr, mo, dy, hr, mt, sc); -/* get date and time just set */ -AACGM_v2_GetDateTime(&yr,&mo,&dy,&hr,&mt,&sc,&dno); -printf("Expected output: 20140322 0311:00 81\n"); -printf("Actual output: %04d%02d%02d %02d%02d:%02d %3d\n", - yr,mo,dy,hr,mt,sc,dno); -CR; CR; lat = 45.5; lon = -23.5; hgt = 1135.; -line('='); printf("TEST: geographic to AACGM-v2\n"); -line('='); /* compute AACGM lat/lon */ err = AACGM_v2_Convert(lat,lon,hgt, &mlat,&mlon, &r, G2A); -printf(" " - " GLAT GLON HEIGHT MLAT MLON R\n"); -printf("Expected " - " 45.500000 -23.500000 1135.000000 48.189618 57.763454 1.177533\n"); -printf("Actual %lf %lf %lf %lf %lf %lf\n", lat,lon,hgt, mlat,mlon,r); -CR; CR; +printf(" GLAT GLON HEIGHT MLAT MLON R\n"); +printf(" %lf %lf %lf %lf %lf %lf", lat,lon,hgt, mlat,mlon,r); +printf("\n\n"); #if (DEBUG > 1) next(); #endif -line('='); printf("TEST: AACGM-v2 to geographic\n"); -line('='); /* do the inverse: A2G */ hgt = (r-1.)*RE; err = AACGM_v2_Convert(mlat,mlon,hgt, &lat,&lon, &h, A2G); -printf(" " - " MLAT MLON HEIGHT GLAT GLON HEIGHT\n"); -printf("Expected " - " 48.189618 57.763454 1131.097495 45.440775 -23.472757 " - " 1134.977896\n"); -printf("Actual %lf %lf %lf %lf %lf %lf\n", mlat,mlon,hgt, lat,lon,h); -CR; CR; +printf(" MLAT MLON HEIGHT GLAT GLON HEIGHT\n"); +printf(" %lf %lf %lf %lf %lf %lf", mlat,mlon,hgt, lat,lon,h); +printf("\n\n"); #if (DEBUG > 1) next(); #endif @@ -113,37 +97,26 @@ lat = 45.5; lon = -23.5; hgt = 1135.; -printf("Do the same thing but use field-line tracing\n"); -line('='); +printf("Do the same thing but use field-line tracing\n\n"); printf("TEST: geographic to AACGM-v2 (TRACE)\n"); -line('='); /* compute AACGM lat/lon */ err = AACGM_v2_Convert(lat,lon,hgt, &mlat,&mlon, &r, G2A|TRACE); -printf(" " - " GLAT GLON HEIGHT MLAT MLON R\n"); -printf("Expected " - "45.500000 -23.500000 1135.000000 48.194757 57.758831 1.177533\n"); -printf("Actual %lf %lf %lf %lf %lf %lf", lat,lon,hgt, mlat,mlon,r); -CR; CR; +printf(" GLAT GLON HEIGHT MLAT MLON R\n"); +printf(" %lf %lf %lf %lf %lf %lf", lat,lon,hgt, mlat,mlon,r); +printf("\n\n"); #if (DEBUG > 1) next(); #endif -line('='); printf("TEST: AACGM-v2 to geographic (TRACE)\n"); -line('='); /* do the inverse: A2G */ hgt = (r-1.)*RE; err = AACGM_v2_Convert(mlat,mlon,hgt, &lat,&lon, &h, A2G|TRACE); -printf(" " - " MLAT MLON HEIGHT GLAT GLON HEIGHT\n"); -printf("Expected " - " 48.194757 57.758831 1131.097495 45.500000 -23.500000 " - " 1135.000000\n"); -printf("Actual %lf %lf %lf %lf %lf %lf\n", mlat,mlon,hgt, lat,lon,h); -CR; CR; +printf(" MLAT MLON HEIGHT GLAT GLON HEIGHT\n"); +printf(" %lf %lf %lf %lf %lf %lf", mlat,mlon,hgt, lat,lon,h); +printf("\n\n"); #if (DEBUG > 1) next(); #endif @@ -199,9 +172,11 @@ printf("mlat = %lf, mlon = %lf, r = %lf\n", mlat,mlon,r); next(); #endif -line('='); -printf("TEST: MLT (T: field-line tracing) (C: coefficients)\n"); -line('='); +line('-',80); +CR; +printf("Testing MLT\n"); +line('-',80); +CR; lat = 77.; lat = 37.; @@ -219,77 +194,51 @@ sc = 16; AACGM_v2_SetDateTime(yr, mo, dy, hr, mt, sc); err = AACGM_v2_Convert(lat,lon,hgt, &mlat,&mlon, &r, G2A|TRACE); mlt_t = MLTConvertYMDHMS_v2(yr,mo,dy,hr,mt,sc,mlon); -printf(" " - "GLAT GLON HEIGHT MLAT MLON MLT\n"); -printf("Expected T" - " 37.000000 -88.000000 300.000000 48.840368 -17.006090 1.977745\n"); -printf("Actual T %lf %lf %lf %lf %lf %lf\n", - lat,lon,hgt, mlat,mlon,mlt_t); +printf(" GLAT GLON HEIGHT MLAT MLON MLT\n"); +printf("TRACE %lf %lf %lf %lf %lf %lf", lat,lon,hgt, mlat,mlon,mlt_t); +printf("\n"); err = AACGM_v2_Convert(lat,lon,hgt, &mlat,&mlon, &r, G2A); mlt_c = MLTConvertYMDHMS_v2(yr,mo,dy,hr,mt,sc,mlon); -printf("Expected C" - " 37.000000 -88.000000 300.000000 48.844355 -16.999464 1.978187\n"); -printf("Actual C %lf %lf %lf %lf %lf %lf\n", - lat,lon,hgt, mlat,mlon,mlt_c); -CR; CR; - -line('='); -printf("TEST: Array\n"); -line('='); -printf(" " - "GLAT GLON HEIGHT MLAT MLON MLT\n"); -printf("Expected 45.0000 0.0000 150.0000 40.2841 76.6676 8.2227\n"); -printf("Expected 45.0000 1.0000 150.0000 40.2447 77.4899 8.2775\n"); -printf("Expected 45.0000 2.0000 150.0000 40.2108 78.3157 8.3325\n"); -printf("Expected 45.0000 3.0000 150.0000 40.1822 79.1452 8.3878\n"); -printf("Expected 45.0000 4.0000 150.0000 40.1587 79.9785 8.4434\n"); -printf("Expected 45.0000 5.0000 150.0000 40.1400 80.8157 8.4992\n"); -printf("Expected 45.0000 6.0000 150.0000 40.1261 81.6569 8.5553\n"); -printf("Expected 45.0000 7.0000 150.0000 40.1165 82.5020 8.6116\n"); -printf("Expected 45.0000 8.0000 150.0000 40.1111 83.3513 8.6682\n"); -printf("Expected 45.0000 9.0000 150.0000 40.1097 84.2048 8.7251\n"); -CR; -printf(" " - "GLAT GLON HEIGHT MLAT MLON MLT\n"); -npts = 10; +printf("COEFF %lf %lf %lf %lf %lf %lf", lat,lon,hgt, mlat,mlon,mlt_c); +printf("\n\n"); + +npts = 20; +printf("\n"); +printf("Array:\n"); for (k=0; k some_file.txt\n" - "diff some_file.txt expected.txt\n\n"); +printf("\n\n"); return (0); } void next(void) { - char ch; + char ch; - printf("Press Enter to continue "); - do { - scanf("%c", &ch); - } while (ch != '\n'); + printf("Press Enter to continue "); + do { + scanf("%c", &ch); + } while (ch != '\n'); - printf("\f"); +/* printf("\n\n");*/ + printf("\f"); } -void line(char ch) +void line(char ch, int n) { - int k,n; + int k; - n = 80; - for (k=0;k rounding errors (hour + (minute + second/60.)/60.)/24.) / days - if (fyear lt 1900. or fyear ge 2020.) then begin + if (fyear lt 1590. or fyear ge 2025.) then begin print, '' - print, 'Date range for IGRF12 is 1900-2020' + print, 'Date range for GUFM1/IGRF13 is 1590-2025' print, '' err = -1 return @@ -888,7 +888,7 @@ pro IGRF_v2_errmsg, ecode 1: begin ; Date/Time out of bounds */ print, "* IGRF ERROR: Date out of bounds *" print,"* *" - print,"* The current date range for IGRF12 is [1990-2020), which *" + print,"* The current date range for GUFM1/IGRF13 is [1590-2025), which *" print,"* includes the 5-year secular variation. *" end endcase @@ -1487,3 +1487,4 @@ function geoc2geod, lat,lon,r return, [dlat,lon,h] end + diff --git a/codebase/analysis/src.lib/aacgm_v2/aacgm.1.0/src/aacgmlib_v2.c b/codebase/analysis/src.lib/aacgm_v2/aacgm.1.0/src/aacgmlib_v2.c index e775a4e53..25cfccdf8 100755 --- a/codebase/analysis/src.lib/aacgm_v2/aacgm.1.0/src/aacgmlib_v2.c +++ b/codebase/analysis/src.lib/aacgm_v2/aacgm.1.0/src/aacgmlib_v2.c @@ -1057,7 +1057,7 @@ int AACGM_v2_Convert(double in_lat, double in_lon, double height, ; err = AACGM_v2_SetDateTime(year, month, day, hour, minute, second); ; ; Input Arguments: -; year - year [1900-2020) +; year - year [1900-2025) ; month - month of year [01-12] ; day - day of month [01-31] ; hour - hour of day [00-24] @@ -1253,8 +1253,8 @@ void AACGM_v2_errmsg(int ecode) fprintf(stderr, "* AACGM-v2 ERROR: Date out of bounds *\n" "* *\n" - "* The current date range for AACGM-v2 coordinates is [1990-2020), which *\n" - "* corresponds to the date range for the IGRF12 model, including the *\n" + "* The current date range for AACGM-v2 coordinates is [1990-2025), which *\n" + "* corresponds to the date range for the IGRF13 model, including the *\n" "* 5-year secular variation. *" "\n"); break; @@ -1417,7 +1417,7 @@ int AACGM_v2_Trace(double lat_in, double lon_in, double alt, } niter += kk; } else { - if (below) printf("BELOW\n"); + /*if (below) printf("BELOW\n");*/ for (k=0;k<3;k++) xyzc[k] = xyzg[k]; /* just use last value */ } diff --git a/codebase/analysis/src.lib/igrf_v2/igrf.1.0/include/igrflib.h b/codebase/analysis/src.lib/igrf_v2/igrf.1.0/include/igrflib.h index f1019bf3e..054beb659 100755 --- a/codebase/analysis/src.lib/igrf_v2/igrf.1.0/include/igrflib.h +++ b/codebase/analysis/src.lib/igrf_v2/igrf.1.0/include/igrflib.h @@ -2,7 +2,7 @@ #define _IGRFLIB_ #define IGRF_FIRST_EPOCH 1590 -#define IGRF_LAST_EPOCH 2015 +#define IGRF_LAST_EPOCH 2020 /* SGS using IGRF_COEFFS environment variable */ /*#define IGRF_FILE "igrf12coeffs.txt"*/ /* current IGRF model */ diff --git a/codebase/analysis/src.lib/igrf_v2/igrf.1.0/src/igrflib.c b/codebase/analysis/src.lib/igrf_v2/igrf.1.0/src/igrflib.c index 0dc7a650b..fad7869ed 100755 --- a/codebase/analysis/src.lib/igrf_v2/igrf.1.0/src/igrflib.c +++ b/codebase/analysis/src.lib/igrf_v2/igrf.1.0/src/igrflib.c @@ -74,7 +74,7 @@ void igrf_pause(void) ; ; Input Arguments: ; filename - name of file which contains IGRF coefficients; default -; is current IGRF model: igrf12coeffs.txt +; is current IGRF model: igrf13coeffs.txt ; ; Return Value: ; error code @@ -233,6 +233,8 @@ int IGRF_loadcoeffs(void) for (l=1; l<=IGRF_ORDER; l++) { k = l * (l+1); /* 1D index for l,m=0 */ fscanf(fp, "%c", &jnk); /* g or h */ + if (jnk != 'g' && jnk != 'h') /* for extra character in file */ + fscanf(fp, "%c", &jnk); /* g or h */ fscanf(fp, "%d %d", &ll, &mm); /* l amd m */ for (n=0; n